Reputation: 1
Basically, I need to use this data statement and when I enter A then an 'A'letter in 'banner' format will be display on the screen. And I need to use 2 nested for loop to do that. Also, the data statement under str cannot be changed,eg dc.b ' # ',13,10,0 So, what can I do? enter image description here
Upvotes: -1
Views: 182
Reputation: 1688
Here's my attempt. Full disclosure, I've never used easy68k, only VASM to assemble for Neo Geo. So I don't know how your print and getKey functions work.
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:
Upvotes: 0