Let us suppose that location $02 contains $45, and location $03 contains $10. If the instruction to load the accumulator in the indexed indirect mode is executed and the specified zero page address is $02, then the actual address will be:
Low order = contents of ($02+X) High order = contents of ($03+X) X register = $00
Thus the actual pointer is in = $02 + X = $02.
Therefore, the actual address is the indirect address contained in $02 which is again $1045.
The title of this mode does in fact imply the principle, although it may be difficult to grasp at first sight. Look at it this way:
"I am going to deliver this letter to the fourth post office at address $01,MEMORY ST., and the address on the letter will then be delivered to $1600, MEMORY street." This is equivalent to the code:
LDA #$00 - load low order actual base address STA $06 - set the low byte of the indirect address LDA #$16 - load high order indirect address STA $07 - set the high byte of the indirect address LDX #$05 - set the indirect index (X) LDA ($02,X) - load indirectly indexed by X
NOTE: Of the two indirect methods of addressing, the first (indirect indexed) is far more widely used. |
This page has been created by Sami Rautiainen. | |
Read the small print. | Last updated July 10, 2002. |