Skip to navigation

Elite on the BBC Micro

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 10Related 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.

Cassette

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 10Related 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.

Cassette, Flight, 6502SP, Master

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 10Related 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.

Flight, 6502SP, Master

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 10Related to the Electron version

See variation 2 above for details.

This variation is blank in the Electron version.

Cassette, Flight, 6502SP, Master

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 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 10Related to the Electron version

See variation 2 above for details.

This variation is blank in the Electron version.

Cassette, Flight, 6502SP, Master

JSR MVEIT \ Call MVEIT to move the Cobra in space

Code variation 6 of 10Related 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.

Master

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 10Related to the Electron version

See variation 2 above for details.

This variation is blank in the Electron version.

Cassette, Flight, 6502SP, Master

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 10Related to a standard feature

See variation 1 above for details.

Tap on a version to expand it, and tap it again to show to all variations.

Cassette

Flight, 6502SP, Master

Electron

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 10A variation in the comments only

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Electron

Flight, 6502SP, Master

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

 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 10 of 10Specific to an individual platform

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Electron

Flight, 6502SP, Master

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 hanger \ screen) and return from the subroutine with a tail \ call
RSS Feed