【问题标题】:How to display out the letters in 'banner' format using easy68K editor/assembler?如何使用 easy68K 编辑器/汇编器以“横幅”格式显示字母?
【发布时间】:2021-09-30 13:12:52
【问题描述】:

基本上,我需要使用这个数据语句,当我输入 A 时,屏幕上会显示一个 'banner' 格式的 'A'letter。 我需要使用 2 个嵌套的 for 循环来做到这一点。 另外str下的数据语句不能更改,例如dc.b ' # ',13,10,0 那么,我能做些什么呢? enter image description here

【问题讨论】:

  • 哪个部分导致您出现问题?每个字母正好是 70 个字节,计算从开始的偏移量并打印 7 行,每行 10 列。
  • stackoverflow.com/questions/68062722/…也可以看到类似的作业
  • 令我困惑的部分是我如何打印出第一行然后跳转到下一行以使用嵌套的 for 循环打印第二行。因为现在当我输入 A 时,字符串将打印在一行中。
  • 您只需打印一个换行符或使用 easy68k 必须移动到下一行的任何功能。
  • 请澄清您的具体问题或提供更多详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: assembly microprocessors easy68k


【解决方案1】:

这是我的尝试。完全披露,我从未使用过 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:


【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多