I'm messing around with Nintendulator for the first time (via VMware), along with Donkey Kong and its disassembly (from romhacking.net).
A fairly simple behavior is puzzling me: when you pause DK, it waits a few frames and then disables the sprites onscreen. I say 'disabled' with some certainty - according to Nintendulator, the sprites' y-coordinates have not been changed to #FF, so they're still in place, just 'invisible.' My assumption was that sprites were disabled via $2001, but I can't figure out exactly where in the source this happens.
I've found three $2001 references:
1. In the NMI handler, after a controller read. This would be my top candidate:
2. In a routine that disables the BG:
3. In the initial PPU setup:
First, am I correct that excerpt one is disabling the sprites on pause? If so, why only the sprites and not the BG? I assume it's contingent upon what's currently loaded in variable $11 (PPU control 2 copy). And finally, why include this behavior? Is it to prevent players from 'planning ahead' while the game is paused? Does arcade DK behave this way? I assume there's no pause on the arcade game...
A fairly simple behavior is puzzling me: when you pause DK, it waits a few frames and then disables the sprites onscreen. I say 'disabled' with some certainty - according to Nintendulator, the sprites' y-coordinates have not been changed to #FF, so they're still in place, just 'invisible.' My assumption was that sprites were disabled via $2001, but I can't figure out exactly where in the source this happens.
I've found three $2001 references:
1. In the NMI handler, after a controller read. This would be my top candidate:
Code:
;Read gamepads
C886 : 20 1D F5 jsr $F51D
;Toggle BKG and sprite visibility
C889 : A5 11 lda $11 ;
C88B : 49 18 eor #$18 ;
C88D : 8D 01 20 sta $2001 ;
C886 : 20 1D F5 jsr $F51D
;Toggle BKG and sprite visibility
C889 : A5 11 lda $11 ;
C88B : 49 18 eor #$18 ;
C88D : 8D 01 20 sta $2001 ;
2. In a routine that disables the BG:
Code:
;Load local copy of PPU control 2 register
D196 : A5 11 lda $11 ; $11 = PPU Control 2 local copy
;Disable BKG layer display (clear bit 3)
D198 : 29 E7 and #$E7 ;
;Update local copy and real PPU register
D19A : 8D 01 20 sta $2001 ;
D196 : A5 11 lda $11 ; $11 = PPU Control 2 local copy
;Disable BKG layer display (clear bit 3)
D198 : 29 E7 and #$E7 ;
;Update local copy and real PPU register
D19A : 8D 01 20 sta $2001 ;
3. In the initial PPU setup:
Code:
;Set sprite clipping off, bkg clipping off, store local copy in $11
C7EE : A9 06 lda #$06 ;
C7F0 : 8D 01 20 sta $2001 ;
C7F3 : 85 11 sta $11 ;
C7EE : A9 06 lda #$06 ;
C7F0 : 8D 01 20 sta $2001 ;
C7F3 : 85 11 sta $11 ;
First, am I correct that excerpt one is disabling the sprites on pause? If so, why only the sprites and not the BG? I assume it's contingent upon what's currently loaded in variable $11 (PPU control 2 copy). And finally, why include this behavior? Is it to prevent players from 'planning ahead' while the game is paused? Does arcade DK behave this way? I assume there's no pause on the arcade game...