簡體   English   中英

如何使用easy68K編輯器/匯編器以“橫幅”格式顯示字母?

[英]How to display out the letters in 'banner' format using easy68K editor/assembler?

基本上,我需要使用此數據語句,當我輸入 A 時,屏幕上將顯示“橫幅”格式的“A”字母。 我需要使用 2 個嵌套的 for 循環來做到這一點。 還有,str下的data語句是不能改的,比如dc.b '#',13,10,0 那怎么辦呢? 在此處輸入圖片說明

這是我的嘗試。 完全公開,我從來沒有使用過easy68k,只有VASM 來為Neo Geo 組裝。 所以我不知道你的 print 和 getKey 函數是如何工作的。

banner:
CLR.L D0        ;we'll clear this now to avoid problems later.
JSR getKeyPress
;some function that waits until a key is pressed
;   and returns ascii code of keyboard press into lowest 8 bits of D0.
CMP.B #'Z',D0
BEQ EXIT
CMP.B #'A',D0
BCS banner  ;if less than 'A', ignore input and go back to start

    CMP.B #'F'+1,D0
    BCC banner  ;if greater than or equal to 'G', ignore input and go back to start

;if we've gotten here the key input must have been good.

;array dimensions are 10 by 7 for each letter.
;the 'challenge' is that you can't add labels or modify the array of ascii art.
;but since each letter has the same dimensions we don't need to!

SUB.B #'A',D0   ;subtract 0x41, this gives us our map of A = 0, B = 1, C = 2, etc.
MOVE.W #70,D1   ;7 rows times 10 columns
MULU D1,D0      ;this product still fits into 16 bits. So the bottom half of D0 is our offset into str for the desired letter.
LEA str,A0
LEA (A0,D0),A1


MOVE.W #7-1,D5  ;inner loop for DBRA
outerloop:
MOVE.W #10-1,D4 ;outer loop for DBRA
innerloop:
    MOVE.B (A1)+,D0
    JSR PRINTCHAR           ;some routine that prints D0 to the screen.
    DBRA D4,innerloop       ;repeat for all chars in text.

    MOVE.B #13,D0           
    JSR PRINTCHAR
    MOVE.B #10,D0
    JSR PRINTCHAR           ;new line
    
    DBRA D5,outerloop       ;repeat for each row in letter      


JMP banner

exit:


暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM