.M% LDA QQ11 ; If this is not the space view, jump to main1 to skip BNE main1 ; the following, as we only need to flip the drawing ; bitplane for animating the space view JSR FlipDrawingPlane ; Flip the drawing bitplane so we draw into the bitplane ; that isn't visible on-screen .main1 SETUP_PPU_FOR_ICON_BAR ; If the PPU has started drawing the icon bar, configure ; the PPU to use nametable 0 and pattern table 0 LDA K% ; We want to seed the random number generator with a ; pretty random number, so fetch the contents of K%, ; which is the x_lo coordinate of the planet. This value ; will be fairly unpredictable, so it's a pretty good ; candidate EOR nmiTimerLo ; EOR the value of K% with the low byte of the NMI ; timer, which gets updated by the NMI interrupt ; routine, so this will be fairly unpredictable too STA RAND ; Store the seed in the first byte of the four-byte ; random number seed that's stored in RANDName: Main flight loop (Part 1 of 16) [Show more] Type: Subroutine Category: Main loop Summary: Seed the random number generator Deep dive: Program flow of the main game loop Generating random numbersContext: See this subroutine in context in the source code References: This subroutine is called as follows: * Main game loop (Part 2 of 6) calls via M%
The main flight loop covers most of the flight-specific aspects of Elite. This section covers the following: * Seed the random number generator
Other entry points: M% The entry point for the main flight loop
[X]
Subroutine FlipDrawingPlane (category: Drawing the screen)
Flip the drawing bitplane
[X]
Workspace K% (category: Workspaces)
Ship data blocks
[X]
Macro SETUP_PPU_FOR_ICON_BAR (category: PPU)
If the PPU has started drawing the icon bar, configure the PPU to use nametable 0 and pattern table 0
[X]
Label main1 is local to this routine
[X]
Variable nmiTimerLo in workspace ZP
Low byte of a counter that's incremented by 1 every time nmiTimer wraps