-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

duzi
  • 1
  • Which part is causing you problem? Each letter is exactly 70 bytes, calculate the offset from the start and print 7 rows each with 10 columns. – Jester Sep 30 '21 at 13:18
  • See also a similar assignment at https://stackoverflow.com/questions/68062722/convert-user-input-character-to-symbol-x86-64-assembly – vitsoft Sep 30 '21 at 14:53
  • The part im confusing is that how can I print out the first row then jump to the next line to print the second row using a nested for loop. Because now when I enter A then the strings will print out in one line. – duzi Sep 30 '21 at 15:24
  • You just print a newline or use whatever function your easy68k has to move to the next line. – Jester Sep 30 '21 at 21:32
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 08 '21 at 00:40

1 Answers1

0

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:


puppydrum64
  • 1,598
  • 2
  • 15