I have a bug in my Vigilante game, which I have no idea why it happens...I changed the 'death' sequence, to just freeze the frame for 2 seconds and have the hero blink. But, when I played it on real hardware, occasionally the top of the screen will jitter with the wrong scroll amount...
It's supposed to be scrolls = 0 for the top and sprite zero hit, and then set a new x scroll.
It's literally the same code that runs during the game, I cut and pasted it...several times (just to be sure). The only difference is that I'm using a NMI to time the regular game, and I have NMI off for the death sequence, and I'm using $2002 to time the death sequence.
FCEUX never shows this bug. But both Nintendulator and Nestopia do. I've stepped through the code about a dozen times, and all of the scroll values look correct and at the correct time... MAYBE, the top of the screen scroll is (apparently) still holding the scroll value from the bottom of the screen?
Does anyone have any guesses as to why this might be happening?
This is the code for the top of the screen...
Then it goes into a sprite zero wait loop. Then it sets the scroll, blinks the hero, updates hero sprites, and jumps back up to DeathWait. I've even tried replacing the sprite zero wait with timed code, it still does it. I've tried commenting out every JSR (blinking the hero), no good.
It really bothers me, because it's exactly the same code as the game (except NMIs off), yet the game never has any similar issues.
It's supposed to be scrolls = 0 for the top and sprite zero hit, and then set a new x scroll.
It's literally the same code that runs during the game, I cut and pasted it...several times (just to be sure). The only difference is that I'm using a NMI to time the regular game, and I have NMI off for the death sequence, and I'm using $2002 to time the death sequence.
FCEUX never shows this bug. But both Nintendulator and Nestopia do. I've stepped through the code about a dozen times, and all of the scroll values look correct and at the correct time... MAYBE, the top of the screen scroll is (apparently) still holding the scroll value from the bottom of the screen?
Does anyone have any guesses as to why this might be happening?
This is the code for the top of the screen...
Code:
DeathWait:
lda $2002
bpl DeathWait
lda #$00 ;draw sprites
sta $2003
lda #$07
sta $4014
lda #$00
sta $2006
sta $2006
sta $2005
sta $2005
lda #$14
sta $2000
lda #$1e
sta $2001
lda $2002
bpl DeathWait
lda #$00 ;draw sprites
sta $2003
lda #$07
sta $4014
lda #$00
sta $2006
sta $2006
sta $2005
sta $2005
lda #$14
sta $2000
lda #$1e
sta $2001
Then it goes into a sprite zero wait loop. Then it sets the scroll, blinks the hero, updates hero sprites, and jumps back up to DeathWait. I've even tried replacing the sprite zero wait with timed code, it still does it. I've tried commenting out every JSR (blinking the hero), no good.
It really bothers me, because it's exactly the same code as the game (except NMIs off), yet the game never has any similar issues.