Skip to navigation

Elite on the BBC Micro and NES

Version analysis of ESCAPE

This code appears in the following versions (click to see it in the source code):

Code variations between these versions are shown below.

Name: ESCAPE Type: Subroutine Category: Flight Summary: Launch our escape pod
This routine displays our doomed Cobra Mk III disappearing off into the ether before arranging our replacement ship. Called when we press ESCAPE during flight and have an escape pod fitted.
.ESCAPE

Code variation 1 of 11Related to a standard feature

In the cassette version, launching an escape pod in witchspace is immediately fatal, while in the disc version it launches properly. In the advanced versions, meanwhile, the launch key is disabled as soon as you enter witchspace.

See below for more variations related to this code.

This variation is blank in the Disc (flight), 6502 Second Processor, Master and Electron versions.

LDA MJ \ Store the value of MJ on the stack (the "are we in PHA \ witchspace?" flag)
 JSR RES2               \ Reset a number of flight variables and workspaces

Code variation 2 of 11Related to the Electron version

When you launch an escape pod in the Electron version, you don't see an animation of your Cobra Mk III drifting away, but jump straight into the station.

See below for more variations related to this code.

This variation is blank in the Electron version.

LDX #CYL \ Set the current ship type to a Cobra Mk III, so we STX TYPE \ can show our ship disappear into the distance when we \ eject in our pod JSR FRS1 \ Call FRS1 to launch the Cobra Mk III straight ahead, \ like a missile launch, but with our ship instead

Code variation 3 of 11Related to an enhanced feature

When trying to spawn a Cobra Mk III to display when we use an escape pod, the enhanced versions will first try to spawn a normal Cobra, and if that fails, they will try again with a pirate Cobra.

This variation is blank in the Cassette and Electron versions.

BCS ES1 \ If the Cobra was successfully added to the local \ bubble, jump to ES1 to skip the following instructions LDX #CYL2 \ The Cobra wasn't added to the local bubble for some JSR FRS1 \ reason, so try launching a pirate Cobra Mk III instead .ES1

Code variation 4 of 11Related to the Electron version

See variation 2 above for details.

This variation is blank in the Electron version.

LDA #8 \ Set the Cobra's byte #27 (speed) to 8 STA INWK+27 LDA #194 \ Set the Cobra's byte #30 (pitch counter) to 194, so it STA INWK+30 \ pitches up as we pull away LSR A \ Set the Cobra's byte #32 (AI flag) to %01100001, so it STA INWK+32 \ has no AI, and we can use this value as a counter to \ do the following loop 97 times
.ESL1

Code variation 5 of 11Related to the Electron version

See variation 2 above for details.

This variation is blank in the Electron version.

JSR MVEIT \ Call MVEIT to move the Cobra in space

Code variation 6 of 11Related to the Master version

In the Master version, if you launch your escape pod while looking out of the side or rear views, you won't see your Cobra as you leave it behind, while in the other versions you do.

This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Electron versions.

LDA QQ11 \ If either of QQ11 or VIEW is non-zero (i.e. this is ORA VIEW \ not the front space view), skip the following BNE P%+5 \ instruction

Code variation 7 of 11Related to the Electron version

See variation 2 above for details.

This variation is blank in the Electron version.

JSR LL9 \ Call LL9 to draw the Cobra on-screen DEC INWK+32 \ Decrement the counter in byte #32 BNE ESL1 \ Loop back to keep moving the Cobra until the AI flag \ is 0, which gives it time to drift away from our pod JSR SCAN \ Call SCAN to remove the Cobra from the scanner (by \ redrawing it)

Code variation 8 of 11Related to a standard feature

See variation 1 above for details.

Tap on a block to expand it, and tap it again to revert.

JSR RESET \ Call RESET to reset our ship and various controls PLA \ Restore the witchspace flag from before the escape pod BEQ P%+5 \ launch, and if we were in normal space, skip the \ following instruction JMP DEATH \ Launching an escape pod in witchspace is fatal, so \ jump to DEATH to begin the funeral and return from the \ subroutine using a tail call
LDA #0 \ Set A = 0 so we can use it to zero the contents of \ the cargo hold
JSR RESET \ Call RESET to reset our ship and various controls LDA #0 \ Set A = 0 so we can use it to zero the contents of \ the cargo hold
 LDX #16                \ We lose all our cargo when using our escape pod, so
                        \ up a counter in X so we can zero the 17 cargo slots
                        \ in QQ20

.ESL2

Code variation 9 of 11A variation in the comments only

Tap on a block to expand it, and tap it again to revert.

STA QQ20,X \ Set the X-th byte of QQ20 to zero (as we know A = 0 \ from the BEQ above), so we no longer have any of item \ type X in the cargo hold
STA QQ20,X \ Set the X-th byte of QQ20 to zero, so we no longer \ have any of item type X in the cargo hold
 DEX                    \ Decrement the counter

 BPL ESL2               \ Loop back to ESL2 until we have emptied the entire
                        \ cargo hold

 STA FIST               \ Launching an escape pod also clears our criminal
                        \ record, so set our legal status in FIST to 0 ("clean")

 STA ESCP               \ The escape pod is a one-use item, so set ESCP to 0 so
                        \ we no longer have one fitted

Code variation 10 of 11A variation in the comments only

This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Electron versions.

\LDA TRIBBLE \ These instructions are commented out in the original \ORA TRIBBLE+1 \ source \BEQ nosurviv \ \JSR DORND \ They ensure that in games with the Trumble mission, \AND #7 \ at least one Trumble will hitch a ride in the escape \ORA #1 \ pod (so using an escape pod is not a solution to the \STA TRIBBLE \ trouble with Trumbles) \LDA #0 \ \STA TRIBBLE+1 \ The Master version does not contains the Trumble \.nosurviv \ mission, so the code is disabled
 LDA #70                \ Our replacement ship is delivered with a full tank of
 STA QQ14               \ fuel, so set the current fuel level in QQ14 to 70, or
                        \ 7.0 light years

Code variation 11 of 11Specific to an individual platform

Tap on a block to expand it, and tap it again to revert.

JMP BAY \ Go to the docking bay (i.e. show the Status Mode \ screen) and return from the subroutine with a tail \ call
JMP GOIN \ Go to the docking bay (i.e. show the ship hangar \ screen) and return from the subroutine with a tail \ call