Code: Select all
FillNametables:
LDA $2002 ; read PPU status to reset the high/low latch
LDA #$20
STA $2006 ; write the high byte of $2000 address (nametable 0)
LDA #$00
STA $2006 ; write the low byte of $2000 address
LDY #$00 ; start a background row 0
LDX #$00 ; start at background column 0
FillNametablesLoop:
LDA #$45 ; this is my tile value. this is supposed to incrementally get the background value from the data, but now it's just hardcoded.
STA $2007
INX ; move right one tile
CPX #$20
BNE FillNametablesLoop
INY ; move down one line
CPY #$1E
BNE FillNametablesLoop
background:
.db $45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45
.db $45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45,$45
etc, etc. for 32 x 30 tiles.
Is there an example I can look at?
Thanks!
Shawn