Okay, so I'm getting back into this NES game I've been working on. The problem is, I can't get the PPU tile drawing right. I'm trying to write 2 text strings on the screen. Then the player presses A and they disapear and the game goes into play mode. The problem is, whenever I press A, one of the text strings go away, but the other doesn't. How can I fix this were they both go away?
Relevant part of code:
And then a check if the player presses A, (I've got it setup where pressing A just INCs the game state.):
And then finally: (Just in case you might need it)
Relevant part of code:
Code:
Text:
LDA $2002 ;Read PPU status to reset it (It is reset by reading from it)
LDA #$32 ;\ High byte
STA $2006 ;/
LDA #$00 ;\ Low byte
STA $2006 ;/
LDX #$00 ;We start at 00
Text2:
LDA backg,x ;Load from text table from data section below
STA $2007 ;And we write it to the PPU I/O
INX ;We set the start of a loop
CPX #$07
BNE Text2 ;Loop if not zero
Text3:
LDA $2002 ;Read PPU status to reset it (It is reset by reading from it)
LDA #$31 ;\ High byte
STA $2006 ;/
LDA #$00 ;\ Low byte
STA $2006 ;/
LDX #$00 ;We start at 00
Text4:
LDA backg1,x ;Load from text table from data section below
STA $2007 ;And we write it to the PPU I/O
INX ;We set the start of a loop
CPX #$0C
BNE Text4 ;Loop if not zero
LDA $2002 ;Read PPU status to reset it (It is reset by reading from it)
LDA #$32 ;\ High byte
STA $2006 ;/
LDA #$00 ;\ Low byte
STA $2006 ;/
LDX #$00 ;We start at 00
Text2:
LDA backg,x ;Load from text table from data section below
STA $2007 ;And we write it to the PPU I/O
INX ;We set the start of a loop
CPX #$07
BNE Text2 ;Loop if not zero
Text3:
LDA $2002 ;Read PPU status to reset it (It is reset by reading from it)
LDA #$31 ;\ High byte
STA $2006 ;/
LDA #$00 ;\ Low byte
STA $2006 ;/
LDX #$00 ;We start at 00
Text4:
LDA backg1,x ;Load from text table from data section below
STA $2007 ;And we write it to the PPU I/O
INX ;We set the start of a loop
CPX #$0C
BNE Text4 ;Loop if not zero
And then a check if the player presses A, (I've got it setup where pressing A just INCs the game state.):
Code:
DisplayGraphics:
LDA gamestate
CMP #$01
BNE Return1
set:
LDA $2002 ;Rest during game play
LDA #$32 ;\ High byte
STA $2006 ;/
LDA #$00 ;\ Low byte
STA $2006 ;/
LDA gamestate
CMP #$01
BNE Return1
set:
LDA $2002 ;Rest during game play
LDA #$32 ;\ High byte
STA $2006 ;/
LDA #$00 ;\ Low byte
STA $2006 ;/
And then finally: (Just in case you might need it)
Code:
backg1:
.db $1D,$1E,$26,$28,$02,$1B,$32,$02,$39,$24,$3A,$29
backg:
.db $29,$2B,$1E,$2C,$2C,$03,$1A,$FF
.db $1D,$1E,$26,$28,$02,$1B,$32,$02,$39,$24,$3A,$29
backg:
.db $29,$2B,$1E,$2C,$2C,$03,$1A,$FF