The intention is to use nested lookup tables for scenes, palettes, and the suchlike. I can currently only get an indirect reference working for a single byte and a word however, which would seem to limit me to 16ks worth of addresses.
Where am I going wrong?
The lookup is like this:
Code: Select all
hello_palettes:
.word palette_1, palette_2
Code: Select all
palette_0:
.byte %00000011, %11111111
.byte %00011100, %00011111
.byte %11111111, %00000011
.byte %11110011, %01100011
palette_2:
.byte %00000011, %11111111
.byte %00000011, %11100000
.byte %01111111, %11111111
.byte %00000000, %00010100
Code: Select all
.pushseg
.ZEROPAGE
palette_pointer:
.res 2
.popseg
.proc load_palette
sta PPU_CG_ADDR
lda #2
asl a
;for 3 byte addresses, another asl a would be here
tax
lda hello_palettes,x
sta palette_pointer
lda hello_palettes+1,x
sta palette_pointer +1
lda hello_palettes+ 2,x
sta palette_pointer + 2
ldy #0
@loop:
lda (palette_pointer),y
sta PPU_CG_DATA
iny
cpy #8
bmi @loop
rts
.endproc ;end of load_palette
I've been using bsnes debugger and it looks like the 65816 doesn't load a 3 byte address, only a two byte one.
What am I doing wrong? Is this the wrong way to address storage across banks?