.ESCAPE JSR RES2 ; Reset a number of flight variables and workspaces 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 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 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 JSR MVEIT ; Call MVEIT to move the Cobra in space 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) 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 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 TRIBBLE ; If there are no Trumbles in our hold, then both bytes ORA TRIBBLE+1 ; of TRIBBLE(1 0) will be zero, so jump to nosurviv to BEQ nosurviv ; skip the following JSR DORND ; Otherwise set TRIBBLE(1 0) to a random number between AND #7 ; 1 and 7, to determine how many Trumbles manage to ORA #1 ; hitch a ride in the escape pod (so using an escape pod STA TRIBBLE ; is not a solution to the trouble with Trumbles) LDA #0 STA TRIBBLE+1 .nosurviv 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 JMP GOIN ; Go to the docking bay (i.e. show the ship hangar ; screen) and return from the subroutine with a tail ; callName: ESCAPE [Show more] Type: Subroutine Category: Flight Summary: Launch our escape podContext: See this subroutine in context in the source code References: This subroutine is called as follows: * Main flight loop (Part 3 of 16) calls ESCAPE
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.
[X]
Configuration variable CYL = 11
Ship type for a Cobra Mk III
[X]
Configuration variable CYL2 = 24
Ship type for a Cobra Mk III (pirate)
[X]
Subroutine DORND (category: Maths (Arithmetic))
Generate random numbers
[X]
Label ES1 is local to this routine
[X]
Label ESL1 is local to this routine
[X]
Label ESL2 is local to this routine
[X]
Subroutine FRS1 (category: Tactics)
Launch a ship straight ahead of us, below the laser sights
[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 LL9 (Part 1 of 12) (category: Drawing ships)
Draw ship: Check if ship is exploding, check if ship is in front
[X]
Subroutine MVEIT (Part 1 of 9) (category: Moving)
Move current ship: Tidy the orientation vectors
[X]
Subroutine RES2 (category: Start and end)
Reset a number of flight variables and workspaces
[X]
Subroutine SCAN (category: Dashboard)
Display the current ship on the scanner
[X]
Label nosurviv is local to this routine