Commodore VIC-20 Programmer's Reference Manual page 151

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

location where the address to be used is hefd. Then the actual
address will be comprised of:
low address byte = contents of S01 = $45
high address byte « contents of S02 = $1E
Y register = S10
The actual address = S1E45 + Y = S1E55
If you think of indexed addressing like delivering Junk mail
Through a post office, here is the principle for indirect indexed
addressing:
We will deliver the letters to ail the houses on the block starting at
$1E00 Memory St. and continuing for 256 houses. Here is the
equivalent program for VICMon:
•A 1200 LDA #S00
•A 1202 STA S01
•A 1204 STASFE
•A 1206 LDA #S1E
* A 1208 STA S02
•A 120A LDA #$96
■A 120C STA $FF
•A 120E LDY #500
'A 1210 LDA #S66
* A 1212 STA (S01),Y
'A 1214 LDA #S0A
•A 1216 STA (SFE).Y
*A 1218 INY
►A 1219 BNE S1210
-A 121B BRK
•G 1200
load low order actual base address
set the low byte of the first indirect
address
set the low byte of the second address
load high order indirect address
set the high byte oi the first indirect
address
load the second address's high byte
set the high byte of the second address
set the indirect index (Y)
66 is the value of our "letter" to the first
"block11
store the "letter" in the house on the
first "block"
0A is the value of our second "letter11
store the 'letter" in the house on the
second "block"
add 1 to index
branch back & send next letter
return to VICMon when done
sends the "letter"—fills the top of the
screen with blue & red lines!
INDEXED INDIRECT ADDRESSING
This mode allows the program to choose an address from a table
in page zero. Since page zero space is limited to 256 bytes, this is a
mode that isn't used too often.
This mode only works with the X register. It is like indirect
indexed, except that the zero page location is indexed, rather than
an address stored in zero page. Therefore, the address stored in
135

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents