This code appears in the following versions (click to see it in the source code):
Code variations between these versions are shown below.
.DEATHName: DEATH Type: Subroutine Category: Start and end Summary: Display the death screen
We have been killed, so display the chaos of our destruction above a "GAME OVER" sign, and clean up the mess ready for the next attempt.
JSR RES2 \ Reset a number of flight variables and workspaces ASL DELTA \ Divide our speed in DELTA by 4 ASL DELTA
The Electron version doesn't hide the dashboard when you die. This effect is implemented in the BBC versions by programming the 6845 CRTC, which isn't present on the Electron.
See below for more variations related to this code.
This variation is blank in the Electron version.
LDX #24 \ Set the screen to only show 24 text rows, which hides JSR DET1 \ the dashboard, setting A to 6 in the process
The Master version has a unique view type for the title screen (13).
Tap on a block to expand it, and tap it again to revert.
This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Master versions.
LDX #50 \ Set the laser count to 50 to act as a counter in the STX LASCT \ D2 loop below, so this setting determines how long the \ death animation lasts (LASCT decreases by 4 for each \ iteration round the main loop, and we also decrement \ it by 1 below to give a total of 5, so this makes the \ animation last for 10 iterations of the main loop)
JSR BOX \ Call BOX to redraw the same border box (BOX is part \ of TT66), which removes the border as it is drawn \ using EOR logic JSR nWq \ Create a cloud of stardust containing the correct \ number of dust particles (i.e. NOSTM of them)
In the Master version, the "GAME OVER" message is cyan, while in the 6502SP version it is yellow.
See below for more variations related to this code.
This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Electron versions.
LDA #CYAN \ Change the current colour to cyan STA COL
Code variation 7 of 21
See variation 5 above for details.
This variation is blank in the Cassette, Disc (flight), Master and Electron versions.
LDA #YELLOW \ Send a #SETCOL YELLOW command to the I/O processor to JSR DOCOL \ change the current colour to yellow
.D1 JSR Ze \ Call Ze to initialise INWK to a potentially hostile \ ship, and set A and X to random values
In the Electron version, the cargo canisters we see when we die always spawn at an x-coordinate of magnitude 32, so canisters appear on either side of the view but never in the centre. It's much more random in the other versions.
Tap on a block to expand it, and tap it again to revert.
DEY \ Set Y = 255
STY MCNT \ Reset the main loop counter to 255, so all timer-based \ calls will be stopped
This variation is blank in the 6502 Second Processor, Master and Electron versions.
STY LASCT \ Set the laser count to 255 to act as a counter in the \ D2 loop below, so this setting determines how long the \ death animation lasts (it's 5.1 seconds, as LASCT is \ decremented every vertical sync, or 50 times a second, \ and 255 / 50 = 5.1)
EOR #%00101010 \ Flip bits 1, 3 and 5 in A (x_lo) to get another number STA INWK+3 \ between 48 and 63, and store in byte #3 (y_lo) ORA #%01010000 \ Set bits 4 and 6 of A to bump it up to between 112 and STA INWK+6 \ 127, and store in byte #6 (z_lo) TXA \ Set A to the random number in X and keep bits 0-3 and AND #%10001111 \ the sign in bit 7 to get a number between -15 and +15, STA INWK+29 \ and store in byte #29 (roll counter) to give our ship \ a gentle roll with damping
This variation is blank in the Cassette, Disc (flight) and Electron versions.
Tap on a block to expand it, and tap it again to revert.
In the cassette, disc and 6502SP versions, our ship is given a gentle pitch up or down when we die; the same is true in the Master version, but the pitch is always downwards so the detritus of our death always rises to the top of the screen.
Tap on a block to expand it, and tap it again to revert.
On death, the cassette and Electron versions show your ship explosion along with up to four cargo canisters; in the enhanced versions, it shows up to five items, which can be a mix of cargo canisters and alloy plates.
Tap on a block to expand it, and tap it again to revert.
This variation is blank in the Cassette, Disc (flight), 6502 Second Processor and Electron versions.
JSR M% \ Call the M% routine to do the main flight loop once, \ which will display our exploding canister scene and \ move everything about, as well as decrementing the \ value in LASCT \JSR NOSPRITES \ This instruction is commented out in the original \ source
.D2
Code variation 20 of 21
See variation 2 above for details.
This variation is blank in the Electron version.
LDX #31 \ Set the screen to show all 31 text rows, which shows JSR DET1 \ the dashboard