I'm able to initialize and render my first nametable just fine (start screen), but am having trouble trying to load a second nametable upon starting the game (play screen).
Here is what I'm doing:
1. During NMI I check for the start button press during my initial game state. If this happens I set a change state flag.
2. During my 'Forever' loop, outside of NMI, I check if the change flag is set, and if so, I update my game state then disable NMI:
Code: Select all
LDA #%00000000
STA $2000
Code: Select all
LoadPlayNametable:
LDA $2002 ; read PPU status to reset the high/low latch
LDA #$20
STA $2006 ; write the high byte of $2000 address
LDA #$00
STA $2006 ; write the low byte of $2000 address
LDA #LOW(PlayNametable)
STA pointerLow
LDA #HIGH(PlayNametable)
STA pointerHigh
LDX #$00
LDY #$00
LoadPlayNametableLoop:
LDA [pointerLow], y
STA $2007
INY
CPY #$00
BNE LoadPlayNametableLoop
INC pointerHigh
INX
CPX #$04
BNE LoadPlayNametableLoop
RTS
Code: Select all
LDA #%10010000
STA $2000
I've been doing some reading on here and have learned something like this should not happen during NMI, and NMI should be off, so curious why this fails to work.