I have a 32 by 30 table defined of what my background should be. Problem is, I can't figure out the code to fill the PPU. This is modified from the Nerdy Nights Background 2 example. In it, only the first few lines are filled but I'd like to fill the whole screen.
So I'd like to feed A with the background values, but I'm not sure how to do it.
Is there an example I can look at?
Thanks!
Shawn
Code:
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.
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.
So I'd like to feed A with the background values, but I'm not sure how to do it.
Is there an example I can look at?
Thanks!
Shawn