Indirect-indexed addressing
In this commonly used Addressing mode, the Y Index Register is used as an offset from the given zero page vector. The effective address is calculated as the vector plus the value in Y.
Indirect-indexed addressing is written as follows:
LDY #$04 LDA ($02),Y
In the above case, Y is loaded with four (4), and the vector is given as ($02). If zero page memory $02-$03 contains 00 80
, then the effective address from the vector ($02) plus the offset (Y) would be $8004.
This addressing mode is commonly used in array addressing, such that the array index is placed in Y and the array base address is stored in zero page as the vector. Typically, the value in Y is calculated as the array element size multiplied by the array index. For single byte-sized array elements (such as character strings), the value in Y is the array index without modification.
The following 8 machine language instructions support indirect-indexed addressing: ADC, AND, CMP, EOR, LDA, ORA, SBC, and STA.