.WARP LDA demoInProgress ; If the demo is not in progress, jump to warp1 to skip BEQ warp1 ; the following ; If we get here then the demo is in progress, in which ; case the fast-forward icon ends the demo and starts ; the game JSR ResetShipStatus ; Reset the ship's speed, hyperspace counter, laser ; temperature, shields and energy banks JMP StartGame ; Jump to StartGame to reset the stack and go to the ; docking bay (i.e. show the Status Mode screen) .warp1 LDA auto ; If the docking computer is engaged (auto is non-zero) AND SSPR ; and we are inside the space station safe zone (SSPR BEQ warp2 ; is non-zero), then this sets A to be non-zero, so if ; this is not the case, jump to warp2 to skip the ; following ; If we get here then the docking computer is engaged ; and we are in the space station safe zone, in which ; case the fast-forward button docks us instantly JMP GOIN ; Go to the docking bay (i.e. show the ship hangar ; screen) and return from the subroutine with a tail ; call .warp2 JSR FastForwardJump ; Do an in-system (fast-forward) jump and run the ; distance checks BCS warp3 ; If the C flag is set then we are too close to the ; planet or sun for any more jumps, so jump to warp3 ; to stop jumping JSR FastForwardJump ; Do a second in-system (fast-forward) jump and run the ; distance checks BCS warp3 ; If the C flag is set then we are too close to the ; planet or sun for any more jumps, so jump to warp3 ; to stop jumping JSR FastForwardJump ; Do a third in-system (fast-forward) jump and run the ; distance checks BCS warp3 ; If the C flag is set then we are too close to the ; planet or sun for any more jumps, so jump to warp3 ; to stop jumping JSR WaitForNMI ; Wait until the next NMI interrupt has passed (i.e. the ; next VBlank) JSR InSystemJump ; Do a fourth in-system jump (fast-forward) without ; doing the distance checks .warp3 LDA #1 ; Set the main loop counter to 1, so the next iteration STA MCNT ; through the main loop will potentially spawn ships ; (see part 2 of the main game loop at me3) LSR A ; Set EV, the extra vessels spawning counter, to 0 STA EV ; (the LSR produces a 0 as A was previously 1) JSR CheckAltitude ; Perform an altitude check with the planet, ending the ; game if we hit the ground LDA QQ11 ; If this is not the space view, jump to warp4 to skip BNE warp4 ; the updating of the space view and return from the ; subroutine LDX VIEW ; Set X to the current view (front, rear, left or right) DEC VIEW ; Decrement the view in VIEW so the call to LOOK1 thinks ; the view has changed, so it will update the screen JMP LOOK1 ; Jump to LOOK1 to initialise the view in X, returning ; from the subroutine using a tail call .warp4 RTS ; Return from the subroutineName: WARP [Show more] Type: Subroutine Category: Flight Summary: Process the fast-forward button to end the demo, dock instantly or perform an in-system jump Deep dive: A sense of scaleContext: See this subroutine in context in the source code References: This subroutine is called as follows: * Main flight loop (Part 3 of 16) calls WARP
This routine does a similar job to the routine of the same name in the BBC Master version of Elite, but the code is significantly different.
[X]
Subroutine CheckAltitude (category: Flight)
Perform an altitude check with the planet, ending the game if we hit the ground
[X]
Subroutine FastForwardJump (category: Flight)
Perform an in-system jump
[X]
Entry point GOIN in subroutine Main flight loop (Part 9 of 16) (category: Main loop)
We jump here from part 3 of the main flight loop if the docking computer is activated by pressing "C"
[X]
Subroutine InSystemJump (category: Flight)
Perform an in-system (fast-forward) jump
[X]
Subroutine LOOK1 (category: Flight)
Initialise the space view
[X]
Subroutine ResetShipStatus (category: Flight)
Reset the ship's speed, hyperspace counter, laser temperature, shields and energy banks
[X]
Subroutine StartGame (category: Start and end)
Reset the stack and game variables, and start the game by going to the docking bay
[X]
Subroutine WaitForNMI (category: Utility routines)
Wait until the next NMI interrupt has passed (i.e. the next VBlank)
[X]
Variable demoInProgress in workspace WP
A flag to determine whether we are playing the demo
[X]
Label warp1 is local to this routine
[X]
Label warp2 is local to this routine
[X]
Label warp3 is local to this routine
[X]
Label warp4 is local to this routine