.SetupDemoUniverse LDY #12 ; Wait until 12 NMI interrupts have passed (i.e. the JSR DELAY ; next 12 VBlanks) LDA #0 ; Set A = 0 CLC ; ADC #0 ; The ADC has no effect, so presumably it was left over ; from a previous version of the code STA nmiCounter ; Reset the NMI counter to zero STA nmiTimer ; Set the NMI timer to zero STA nmiTimerLo STA nmiTimerHi STA hiddenBitplane ; Set the hidden, NMI and drawing bitplanes to 0 STA nmiBitplane STA drawingBitplane LDA #$FF ; Set soundVibrato = $FF $80 $1B $34 to set the seeds STA soundVibrato ; for the randomised vibrato that's applied to sound LDA #$80 ; effects STA soundVibrato+1 LDA #$1B STA soundVibrato+2 LDA #$34 STA soundVibrato+3 JSR ResetOptions ; Reset the game options to their default values LDA #0 ; Set K%+6 to 0 so the random number seeding at the STA K%+6 ; start of the main game loop at TT100 proceeds in a ; predictable manner STA K% ; Set K% to 0 so the random number seeding at the start ; of the main flight loop at M% proceeds in a ; predictable manner ; Fall through into FixRandomNumbers to set the random ; number seeds to a known stateName: SetupDemoUniverse [Show more] Type: Subroutine Category: Combat demo Summary: Initialise the local bubble of universe for the demo Deep dive: The NES combat demoContext: See this subroutine in context in the source code References: This subroutine is called as follows: * DEATH2 calls SetupDemoUniverse * SetDemoAutoPlay calls SetupDemoUniverse
[X]
Subroutine DELAY (category: Utility routines)
Wait until a specified number of NMI interrupts have passed (i.e. a specified number of VBlanks)
[X]
Workspace K% (category: Workspaces)
Ship data blocks
[X]
Subroutine ResetOptions (category: Start and end)
Reset the game options to their default values
[X]
Variable drawingBitplane in workspace ZP
Flipped manually by calling FlipDrawingPlane, controls whether we are showing nametable/palette buffer 0 or 1
[X]
Variable nmiBitplane in workspace ZP
The number of the bitplane (0 or 1) that is currently being processed in the NMI handler during VBlank
[X]
Variable nmiCounter in workspace WP
A counter that increments every VBlank at the start of the NMI handler
[X]
Variable nmiTimerHi in workspace ZP
High byte of a counter that's incremented by 1 every time nmiTimer wraps
[X]
Variable nmiTimerLo in workspace ZP
Low byte of a counter that's incremented by 1 every time nmiTimer wraps
[X]
Variable soundVibrato in workspace WP
The four-byte seeds for adding randomised vibrato to the current sound effect