This code appears in the following versions (click to see it in the source code):
Code variations between these versions are shown below.
Name: TT102 Type: Subroutine Category: Keyboard Summary: Process function key, save key, hyperspace and chart key presses
and update the hyperspace counter
Process function key presses, plus "@" (save commander), "H" (hyperspace), "D" (show distance to system) and "O" (move chart cursor back to current system). We can also pass cursor position deltas in X and Y to indicate that
This routine also checks for the "F" key press (search for a system), which applies to enhanced versions only.
Arguments:
X The amount to move the crosshairs in the x-axis Y The amount to move the crosshairs in the y-axis
Other entry points: T95 Print the distance to the selected system
This variation is blank in the Cassette, Disc (flight), Disc (docked), 6502 Second Processor and Master versions.
.TT102
.TT92
.fvw
This variation is blank in the Disc (flight) and Disc (docked) versions.
Tap on a block to expand it, and tap it again to revert.
This variation is blank in the Disc (flight) version.
Tap on a block to expand it, and tap it again to revert.
Pressing "@" brings up the disc access menu in the enhanced versions.
See below for more variations related to this code.
This variation is blank in the Disc (flight) version.
Tap on a block to expand it, and tap it again to revert.
Code variation 13 of 29
See variation 12 above for details.
This variation is blank in the Cassette, Disc (flight) and Electron versions.
JSR SVE \ "@" was pressed, so call SVE to show the disc access \ menu BCC P%+5 \ If the C flag was set by SVE, then we loaded a new JMP QU5 \ commander file, so jump to QU5 to restart the game \ with the newly loaded commander JMP BAY \ Otherwise the C flag was clear, so jump to BAY to go \ to the docking bay (i.e. show the Status Mode screen) .nosave
This variation is blank in the Disc (flight) version.
Tap on a block to expand it, and tap it again to revert.
This variation is blank in the Disc (docked) version.
Tap on a block to expand it, and tap it again to revert.
.LABEL_3
This variation is blank in the Cassette, Disc (flight), Disc (docked), Master and Electron versions.
\ In the 6502 Second Processor version, the LABEL_3 \ label is actually `` (two backticks), but that doesn't \ compile in BeebAsm and it's pretty cryptic, so instead \ this version sticks with the label LABEL_3 from the \ cassette version
When docked in the disc version, the screen-clearing and DOCKED printing is done here rather than in hyp and hy6, but the code is the same.
Tap on a block to expand it, and tap it again to revert.
This variation is blank in the Cassette, Disc (flight) and Electron versions.
Pressing "F" in the enhanced versions when viewing a chart lets us search for systems by name.
See below for more variations related to this code.
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.
This variation is blank in the Cassette, Disc (flight), Disc (docked) and Electron versions.
LDA QQ12 \ If QQ12 = 0 (we are not docked), we can't search for BEQ t95 \ systems, so return from the subroutine (as t95 \ contains an RTS)
Code variation 22 of 29
See variation 20 above for details.
This variation is blank in the Cassette, Disc (flight) and Electron versions.
STA T1 \ Store A (the key that's been pressed) in T1
LDA T1 \ Restore the original value of A (the key that's been \ pressed) from T1
JSR TT103 \ Draw small crosshairs at coordinates (QQ9, QQ10), \ which will erase the crosshairs currently there JSR ping \ Set the target system to the current system (which \ will move the location in (QQ9, QQ10) to the current \ home system
This might be a bug fix? If "O" is pressed in the advanced versions, then the target system is set to home, and the routine terminates, which is different to the other versions; they stick around for one more move of the cursor, so presumably this fixes a bug where pressing "O" might not always move the cursor exactly to the current system.
Tap on a block to expand it, and tap it again to revert.
.ee2 JSR TT16 \ Call TT16 to move the crosshairs by the amount in X \ and Y, which were passed to this subroutine as \ arguments
.TT107 LDA QQ22+1 \ If the on-screen hyperspace counter is zero, return BEQ t95 \ from the subroutine (as t95 contains an RTS), as we \ are not currently counting down to a hyperspace jump DEC QQ22 \ Decrement the internal hyperspace counter BNE t95 \ If the internal hyperspace counter is still non-zero, \ then we are still counting down, so return from the \ subroutine (as t95 contains an RTS) \ If we get here then the internal hyperspace counter \ has just reached zero and it wasn't zero before, so \ we need to reduce the on-screen counter and update \ the screen. We do this by first printing the next \ number in the countdown sequence, and then printing \ the old number, which will erase the old number \ and display the new one because printing uses EOR \ logic LDX QQ22+1 \ Set X = the on-screen hyperspace counter - 1 DEX \ (i.e. the next number in the sequence) JSR ee3 \ Print the 8-bit number in X at text location (0, 1) LDA #5 \ Reset the internal hyperspace counter to 5 STA QQ22 LDX QQ22+1 \ Set X = the on-screen hyperspace counter (i.e. the \ current number in the sequence, which is already \ shown on-screen) JSR ee3 \ Print the 8-bit number in X at text location (0, 1), \ i.e. print the hyperspace countdown in the top-left \ corner DEC QQ22+1 \ Decrement the on-screen hyperspace countdown BNE t95 \ If the countdown is not yet at zero, return from the \ subroutine (as t95 contains an RTS) JMP TT18 \ Otherwise the countdown has finished, so jump to TT18 \ to do a hyperspace jump, returning from the subroutine \ using a tail call
.t95 RTS \ Return from the subroutine .T95 \ If we get here, "D" was pressed, so we need to show \ the distance to the selected system (if we are in a \ chart view) LDA QQ11 \ If the current view is a chart (QQ11 = 64 or 128), AND #%11000000 \ keep going, otherwise return from the subroutine (as BEQ t95 \ t95 contains an RTS)
This variation is blank in the Cassette, Disc (flight), Disc (docked), Master and Electron versions.
LDA #CYAN \ Send a #SETCOL CYAN command to the I/O processor to JSR DOCOL \ switch to colour 3, which is white in the chart view
JSR hm \ Call hm to move the crosshairs to the target system \ in (QQ9, QQ10), returning with A = 0
JSR cpl \ Print control code 3 (the selected system name) LDA #%10000000 \ Set bit 7 of QQ17 to switch to Sentence Case, with the STA QQ17 \ next letter in capitals
JMP TT146 \ Print the distance to the selected system and return \ from the subroutine using a tail call