I am hoping that those of you well versed in NES programming could answer a beginner's question. I am new to the NES and to ASM. I have followed bunnyboy's excellent NESASM tutorials, and have tried to modify one of the demos in a small way. I'm trying to change the attribute of a sprite tile so that all four sprite palettes are shown for that one tile alternatingly. I've gotten it to work when switching between one four-color set and another, but when I try to show pal 0->1->2->3->0->..., it starts behaving oddly. I've tried writing the code in several ways (incrementing with X, using ADC/SBC) and I've tried slowing it down, but it still doesn't work. I think that maybe there's some kind of fundamental, obvious thing that I don't understand about what I'm doing. Any help would be greatly appreciated. Some code snippets are below. (Now, granted, this probably isn't the way I would actually do the color switching in a real game, but it's the way that I had saved in my .asm, so that's what gets posted.)
Thanks in advance for the help.
Rachel
; Switching between first two palettes (works)
LDX #$00
Flash:
INX
TXA
STA $0202
DEX
TXA
STA $0202
JMP Flash
; Switching between all four palettes (does not work)
LDX #$00
Flash:
INX
TXA
STA $0202
INX
TXA
STA $0202
DEX
TXA
STA $0202
DEX
TXA
STA $0202
JMP Flash
-------------------------
Resident collector of and expert on vintage girly games and consoles--especially rare stuff!
Currently playing: Miitomo (iOS), Yoshi's Woolly World (WiiU)