Hi guys. It's been a while! Can someone refresh me on how $2006/$2007/$2005/$2000 relationships work again? I'm doing a simple thing that flashes a palette color in NMI, however it seems to corrupt the whole palette and part of the nametable somehow.
Does this code look correctly? It does to me. I'll spare you guys the whole code, but I will say that all other writes to $2007 are followed by the same writes to $2000 and $2005 as shown above.
Code:
NMI:
PHA
TXA
PHA
TYA
PHA
LDA $2002 ;to acknowledge vblank
INC NMITimer
LDA NMITimer
LSR A
LSR A
AND #$01
TAX
LDA #$3F
STA $2006
LDA #$01
STA $2006
LDA Palette,x
STA $2007
LDA #%10010000
STA $2000
LDA #$00
STA $2005
STA $2005
PLA
TAY
PLA
TAX
PLA
RTI
Palette: .db $04, $05
PHA
TXA
PHA
TYA
PHA
LDA $2002 ;to acknowledge vblank
INC NMITimer
LDA NMITimer
LSR A
LSR A
AND #$01
TAX
LDA #$3F
STA $2006
LDA #$01
STA $2006
LDA Palette,x
STA $2007
LDA #%10010000
STA $2000
LDA #$00
STA $2005
STA $2005
PLA
TAY
PLA
TAX
PLA
RTI
Palette: .db $04, $05
Does this code look correctly? It does to me. I'll spare you guys the whole code, but I will say that all other writes to $2007 are followed by the same writes to $2000 and $2005 as shown above.