Category:6502 Assembly: Difference between revisions
→Zero Page Offset By X/Y
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) |
||
Line 151:
===Zero Page Offset By X/Y===
A zero page memory address offset by X or Y. The value in X or Y is added to the supplied address, and the resulting address is used as the operand. Only the X register can use the "Zero Page Offset by Y" mode. If you want to store the accumulator in a zero page address offset by Y, you'll need to use the absolute address by padding the front of the address with 00. Some assemblers do this automatically, which is why I got this wrong!
<lang 6502asm>LDX #$05 ;load 5 into X
LDA $02,x ;load the value stored in $07 into the accumulator. (2 + 5 = 7)
LDY #$04 ;load 4 into Y
===Absolute Offset By X/Y===
|