.ESCAPE JSR RES2 ; Reset a number of flight variables and workspaces LDY #19 ; Call the NOISE routine with Y = 19 to make the sound JSR NOISE ; of the escape pod launching LDA #0 ; The escape pod is a one-use item, so set ESCP to 0 so STA ESCP ; we no longer have one fitted JSR UpdateIconBar_b3 ; Update the icon bar to remove the escape pod button as ; we no longer have one LDA QQ11 ; If this is not the space view, jump to escp1 to skip BNE escp1 ; drawing the escape pod animation 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 LDA #%00101100 ; Set the Cobra's byte #32 (AI flag) to %00101100, so it STA INWK+32 ; has no AI, and we can use this value as a counter to ; do the following loop 44 times .ESL1 JSR MVEIT ; Call MVEIT to move the Cobra in space JSR DrawShipInBitplane ; Flip the drawing bitplane and draw the current ship in ; the newly flipped bitplane 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 .escp1 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") 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]
Subroutine DrawShipInBitplane (category: Drawing ships)
Flip the drawing bitplane and draw the current ship in the newly flipped bitplane
[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 MVEIT (Part 1 of 9) (category: Moving)
Move current ship: Tidy the orientation vectors
[X]
Subroutine NOISE (category: Sound)
Make the sound effect whose number is in Y
[X]
Subroutine RES2 (category: Start and end)
Reset a number of flight variables and workspaces
[X]
Subroutine UpdateIconBar_b3 (category: Icon bar)
Call the UpdateIconBar routine in ROM bank 3
[X]
Label escp1 is local to this routine
[X]
Label nosurviv is local to this routine