我正在重做,但我这次关闭。使用6502芯片。装配打印缓冲区
我在写一个程序集的打印缓冲区。
我遇到的一个问题是检查字符串是否为空。
这里是我到目前为止的代码:(人类可读)
buffer = $03ff
x = $01
[START]: $0500
LDX buffer // load buffer (at safe memory address $03ff)
LDY #$00 // loading the y register with 0 so that you can count up
// checking for a null string; if null, branch to the break instruction
LOOP: LDA buffer+1, y // get byte using the buffer
STA (x), y // store the value at the pointer
INY // increment y
DEX // decrement x (counting down with the x register)
BEQ $500? // if x is equal to 0, program is done
BNE LOOP: // if x is not equal to 0, keep going
BRK // if brk, it’s null
我怎么会去检查,如果该字符串为空?
谢谢!
谢谢你试试这个!所以SUPER SUPER(确切的说是2天)组装的新手问题......但我对BEQ的语法感到困惑。 – Surz
在汇编程序中,是否放置了BEQ ENDOFLOOP(我对什么是内存地址感到困惑......是否只计算我将输入多少行并放入内存地址? – Surz
如果您在编写实际的机器代码,跳转会从计算机所在的位置开始计算字节数,当它决定它应该到达何处时,您不必担心汇编程序的问题 - 确切的语法会有所不同,但通常像'LOOP:'会由汇编器作为标签,'BNE LOOP'将意味着'BNE'指向该标签所在的位置;汇编器将计算正确的字节数并填写。 – Tommy