我正在查看这个站点的一些代码示例:
http://www.6502asm.com/
看一看,我看到它们有一些说明,它们没有直接使用内存位置,而是使用标签,例如,在alive.asm中:
lda ypos,x而ypos是
ypos:
dcb $00,$02,$20,$02,$40,$02,$60,$02
dcb $80,$02,$a0,$02,$c0,$02,$e0,$02
dcb $00,$03,$20,$03,$40,$03,$60,$03
dcb $80,$03,$a0,$03,$c0,$03,$e0,$03
dcb $00,$04,$20,$04,$40,$04,$60,$04
dcb $80,$04,$a0,$04,$c0,$04,$e0,$04
dcb $00,$05,$20,$05,$40,$05,$60,$05
dcb $80,$05,$a0,$05,$c0,$05,$e0,$05我知道标签根据汇编程序的不同而不同,但我假设它是经过这个列表的,但是它的特殊性如何工作呢?
发布于 2018-06-25 08:33:00
下面是关于指令lda ypos,x的详细信息:
ypos位于零页之外(等于或超过0x0100):- Opcode is 0xBD: it uses an _**indexed absolute**_ addressing mode using the index register X, also called _**absolute,X**_ mode
- it computes an address by adding the content of X register to the 2-bytes address represented by the label `ypos`, then it loads the A register (accumulator) with the byte located at the computed address
- its size is **3 bytes**; it takes **4 CPU cycles** + 1 cycle if page boundary is crossed, i.e. if the high byte of `ypos` is different from the high byte of the compute address `ypos + X`.
- it updates only the status **flags N and Z** (Negative and Zero)
ypos位于零页内(在0x00和0xFF之间),那么它可能依赖于您的汇编程序(检查操作码):它要么使用索引的绝对寻址模式,然后按照前面的描述工作,要么:。ypos表示的1字节地址中计算地址,包装在0x00-0xFF范围内,然后用位于计算地址的字节加载A寄存器(累加器)。
注意:要非常小心,因为如果在ypos中定义的值超出了零页,则可能不是预期的行为。您的汇编程序中可能有特定的语法来强制使用绝对的X寻址模式。
https://stackoverflow.com/questions/51004893
复制相似问题