Zero-Page Indexed Addressing
In Zero-Page Indexed Addressing is similar to Indexed Addressing, except that since it applies only to the zero-page, you only need to include 1-byte for the address. In this mode, the address is added to the value either by the X or Y index register. Most opcodes support the X index register for the offset, but an additional handful also support the Y index register.
The benefit of Zero-Page Indexed addressing is that you can quickly loop through memory by simply increasing or decreasing the offset.
Examples
This example uses Zero-Page Indexed Addressing to store #$7F into all the memory from 0000-00FF. Line 0005 uses Zero-Page Indexed Addressing.
0001:A9 7F LDA #$7F ; Load A with 7F. 0003:A2 FF LDX #$FF ; Load X with FF. 0005:95 00 STA $00,X ; Store A into $0000 offset with X. 0007:CA DEX ; Decrement X. 0008:30 FB BPL $0005 ; Goto $0005 while X is not -1.
Opcodes
Since Zero-Page Indexed addressing can be both on the X and Y index registers, both are listed here separately.
X Index Register
The following opcodes support Zero-Page Indexed addressing using the X index register:
Y Index Register
The following opcodes support Zero-Page Indexed addressing using the Y index register: