NintendoAge http://nintendoage.com/forum/ -Sqooner Question about changing tile attributes http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=8410 2008-05-27T15:49:48 -05.00 Rachel 11 Question about changing tile attributes http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=8410 2008-05-27T12:48:35 -05.00 Rachel 11 Question about changing tile attributes http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=8410 2008-05-27T07:28:04 -05.00 Rachel 11 Question about changing tile attributes http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=8410 2008-05-27T02:20:24 -05.00 Rachel 11

Head over to NESDev too for lots of useful information and people:

http://nesdev.parodius.com/bbs/

and

http://nesdevwiki.org/ ]]>
Question about changing tile attributes http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=8410 2008-05-27T01:47:36 -05.00 Rachel 11 R ]]> Question about changing tile attributes http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=8410 2008-05-27T01:13:57 -05.00 Rachel 11
0-1-2-3-4-3-2-1-0-1-2-3-4-3-2-1 (etc)

Every 1/60th (or 1/50th of a second depending on PAL or NTSC) the vblank interrupt will occur causing the sprites to be updated using whatever value is currently at $0202. As Memblers pointed out, this will work out to be a random point in the above cycle of numbers - wherever it was up to at the point in time the vblank occured. If you want it to cycle through these palettes every frame, you should put the increase/decrease code into the vblank (and I think you want to loop between 0 and 3, not 0 to 4):

e.g.

vblank:
; Update sprites
LDA #$02
STA $4014

LDA DirectionVariable ; create a variable in Zero page memory called this to keep track of whether to loop forward or backwards. 0 = forwards, 1 = backwards
CMP #$01
BEQ loopBackwards

loopForwards:
LDA $0202
CLC
ADC #$01
STA $0202
CMP #$03 ; check if we are up to 3, if so we'll change direction next frame
BNE endNMI
LDA #$01
STA DirectionVariable
JMP endNMI

loopBackwards:
LDA $0202
SEC
SBC #$01
STA $0202
CMP #$00 ; check if we are up to 0, if so we'll change direction next frame
BNE endNMI
LDA #$00
STA DirectionVariable

endNMI:
RTI ]]>
Question about changing tile attributes http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=8410 2008-05-26T23:02:30 -05.00 Rachel 11 2->3->4), wouldn't you see the tile to start flipping horizontally and vertically as the attribute value got higher than expected? Or maybe I'm not understanding... ]]> Question about changing tile attributes http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=8410 2008-05-26T22:35:31 -05.00 Rachel 11
But I could only assume that without seeing the rest of the program. ]]>
Question about changing tile attributes http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=8410 2008-05-26T17:57:59 -05.00 Rachel 11 If you don't mind, could you confirm that this code makes sense? I've already made the mistake of thinking I understood something that I didn't and then trying to build on that erroneous knowledge. It's a hard lesson to learn, but I know that just because it works in an emulator doesn't mean it makes a lick of sense.
Thanks again!

LDA $0202 ;(data at $0202 is 0)
Flash:
; I had the LDA $0202 here before... oops...
CLC
ADC #$01
STA $0202
CMP #$04
BNE Flash
Flash2:
SEC
SBC #$01
STA $0202
CMP #$00
BNE Flash2
JMP Flash ]]>
Question about changing tile attributes http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=8410 2008-05-26T17:37:14 -05.00 Rachel 11
What you would want to do is only do one increment each frame. In your nmi, read from $0202, increment, write back to 0202. If it now equals 4, write 0 instead to start again. It will go super fast (60 fps) but try coding that and post again if you need more help! ]]>