我正在通过 C64 模拟器学习 6502 micro 的汇编。目前正在尝试将字符串输出到屏幕。这是我的代码:
processor 6502
org $1000
ldx #$00 ;using x register as column counter
print:
lda message,x;load a with x bit from message
sta $0400,x ;store this bit in row 0 col 0 address
inx ;x++
cpx #$05 ;is x >= 5?
bne print ;if not x >= 5, loop again
rts ;return from program
message dc "HELLO"
hexmsg dc $08,$05,$0c,$0c,$0f
Because my editor (notepad++ on win 10) uses ascii-like char-codes, the "HELLO"
in message
is bits 48 45 4C 4C 4F. This gives the following output in the top left corner of the screen:
通过查看 Commodore 屏幕代码表,我猜这是正确的here http://sta.c64.org/cbm64scr.html.
如果我将第 6 行更改为lda hexmsg,x
然后我就得到了我想要的,这个词HELLO
.
我还不太熟悉 DASM 汇编器,并且很难找到它的完整文档(如果存在)。我发现的大多数教程只是让你声明message .byte "HELLO"
或类似的东西,它之所以起作用,是因为他们使用的汇编器会自动将类似 ASCII 的文本字符串自动转换为 Commodore 字符串,但 DASM 似乎并没有这样做。
有谁知道我可以让 DASM 来执行此操作,或者推荐另一种方法来简单地将字符串输入到汇编器中,而不是手动将字符串作为一堆十六进制数据输入?