User guide

Example:
LDA (&12, X) ; load A from
; address pointed to
; at (&12 + X)
Indirect indexed addressing (post-indexed)
<instruction> (<zero page address>), Y
This time... The second byte of the instruction points to an address in page zero. We add this new
address to the contents of the Y register to obtain our ‘real’ target address.
Example:
ORA (&12), Y ; ORA with byte at
; address pointed to
; by:
; (Y + value at &12)
For a walk-through, refer to the memory dump below:
First we set Y to &02.
The LDA command retrieves the value “&0007” from address &0005.
So now the LDA looks to &0007 + Y, which is &0009.
The value actually loaded into the accumulator is &03.
Where indexed indirect could be used to interrogate multiple peripherals, the indirect indexed is
more suited to reading and writing multiple registers within one peripheral.
Consider the 6522 VIA. It contains 16 registers:
0 ORB 5 T1C-L 10 SR
1 ORAh 6 T1L-L 11 ACR
2 DDRB 7 T1L-H 12 PCR
3 DDRA 8 T2C-L 13 IFR
4 T1C-L 9 T2C-H 14 IER
15 ORA
If the parameter address pointed to the base address of the 6522 in the memory map, you could
use the index register to select which register to read. On the BBC micro, the user port is at
&FE60 to &FE6F; so we could indirectly index memory locations &FE60 + Y...
6502asm user guide – prerelease version
page 14
&0000 A4 02 LDY &02
&0002 B1 05 LDA (&05), Y
&0004 60 RTS
&0005 07 ???
&0006 00 BRK
&0007 01 02 ORA (&02, X)
&0009 03 ???
&0000 A6 02 A1 05 60 07 00 01 02 03 ª·í·‘····