-1

基本上,我需要使用这个数据语句,当我输入 A 时,屏幕上会显示一个“横幅”格式的“A”字母。我需要使用 2 个嵌套的 for 循环来做到这一点。还有,str下的data语句不能改,比如dc.b '#',13,10,0 那怎么办呢? 在此处输入图像描述

4

1 回答 1

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:


于 2021-11-02T17:17:21.090 回答