In my loadChrRam routine, I end up first checking the type (type by type), where what I'd like to have is a look up table that populates the indexing based on the type. I'm making this sound really confusing...ok...
Right now, I have something like:
Code: Select all
LDX specifcTile ;; offset in lookup tables of specific tile to load
LDA chrType
BNE notZeroTileType
;;; if it is zero tile type
LDA #CHR0_TableLo,x
STA pointer
LDA #CHR0_TableHi,x
STA pointer+1
JMP gotMyChrTile ;; now this pointer references the right tile in the following routine.
notZeroTileType:
;;;; check other tile types
So like, it would be something more like:
Code: Select all
LDY chrType
LDA chrTypeTableLo,y ;; which, if zero, would have #CHR0_TableLo
STA pointer
LDA chrTypeTableHi,y
STA pointer+1
JMP gotMyChrTile
Code: Select all
dummyPointerTableLo_lo:
.db <chrTypeTableLo
dummyPointerTableLo_hi:
.db >chrTypeTableLo
Code: Select all
LDY #$00
LDA dummyPointerTableLo_lo
STA pointer
LDA dummyPointerTableLo_hi
STA pointer+1
LDY chrType
LDA (pointer),y
STA pointer
;;;;;;; JUST TESTING ABOVE TO SEE IF THAT GIVES ME THE VALUE FOR LOW BYTE, FINISHING THE HI BYTE AS BEFORE;;;;
LDA #CHR0_TableHi,x
STA pointer+1
JMP gotMyChrTile ;; now this pointer SHOULD reference the right tile in the following routine.