.DK4 LDX thiskey ; Fetch the key pressed from thiskey in the key logger STX KL ; Store X in KL, which is used to store the value of the ; last key pressed CPX #$40 ; If INST/DEL is not being pressed, jump to DK2 below, BNE DK2 ; otherwise let's process the configuration keys .FREEZE ; COPY is being pressed, so we enter a loop that ; listens for configuration keys, and we keep looping ; until we detect a DELETE key press. This effectively ; pauses the game when COPY is pressed, and unpauses ; it when DELETE is pressed JSR WSCAN ; Call WSCAN to wait for the vertical sync, so the whole ; screen gets drawn JSR RDKEY ; Scan the keyboard for a key press and return the ; internal key number in A and X (or 0 for no key press) CPX #$02 ; If "Q" is not being pressed, skip to DK6 BNE DK6 STX DNOIZ ; "Q" is being pressed, so set DNOIZ to a non-zero value ; to turn the sound off .DK6 LDY #0 ; We now want to loop through the keys that toggle ; various settings, so set a counter in Y to work our ; way through them .DKL4 JSR DKS3 ; Call DKS3 to scan for the key given in Y, and toggle ; the relevant setting if it is pressed INY ; Increment Y to point to the next toggle key CPY #(MUFOR-DAMP) ; Check to see whether we have reached the last toggle ; key (i.e. MUFOR-1, as the standard set of options run ; from DAMP to PLTOG, which just before MUFOR) BNE DKL4 ; If not, loop back to check for the next toggle key BIT PATG ; If bit 7 of PATG is clear then the "X" configuration BPL nosillytog ; option has not been enabled, so jump to nosillytog to ; skip the following .DKL42 ; If we get here then the "X" configuration option has ; been enabled, so the title screen shows the authors' ; names, we can force a mis-jump, and we can alter the ; MUFOR, MUDOCK and MUSILLY configuration options, which ; are unavailable by default JSR DKS3 ; Call DKS3 to scan for the key given in Y, and toggle ; the relevant setting if it is pressed INY ; Increment Y to point to the next toggle key CPY #(MUSILLY+1-DAMP) ; Check to see whether we have reached the last toggle ; key (i.e. MUSILLY, as the standard set of options run ; from DAMP to PLTOG, and the extended options run from ; MUFOR to MUSILLY) BNE DKL42 ; If not, loop back to check for the next toggle key .nosillytog LDA MUTOK ; If the value of MUTOK has changed (i.e. it does not CMP MUTOKOLD ; match the value in MUTOKOLD) then the docking music BEQ P%+5 ; has either been enabled or disabled, so call MUTOKCH JSR MUTOKCH ; to process a change in the docking music configuration ; setting CPX #$33 ; If "S" is not being pressed, jump to DK7 BNE DK7 LDA #0 ; "S" is being pressed, so set DNOIZ to 0 to turn the STA DNOIZ ; sound on .DK7 CPX #$07 ; If left arrow is not being pressed, skip over the next BNE P%+5 ; instruction JMP DEATH2 ; Left arrow is being pressed, so jump to DEATH2 to end ; the game CPX #$0D ; If CLR/HOME is not being pressed, we are still paused, BNE FREEZE ; so loop back up to keep listening for configuration ; keys, otherwise fall through into the rest of the ; key detection code, which unpauses the game .DK2 RTS ; Return from the subroutineName: DK4 [Show more] Type: Subroutine Category: Keyboard Summary: Scan for pause, configuration and secondary flight keys Deep dive: The key loggerContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
Scan for pause and configuration keys, and if this is a space view, also scan for secondary flight controls. Specifically: * Scan for the pause button (INST/DEL) and if it's pressed, pause the game and process any configuration key presses until the game is unpaused (CLR/HOME) * If this is a space view, scan for secondary flight keys and update the relevant bytes in the key logger
Other entry points: FREEZE Rejoin the pause routine after processing a screen save
[X]
Variable DAMP in workspace Option variables
Keyboard damping configuration setting
[X]
Subroutine DEATH2 (category: Start and end)
Reset most of the game and restart from the title screen
[X]
Label DK2 is local to this routine
[X]
Label DK6 is local to this routine
[X]
Label DK7 is local to this routine
[X]
Label DKL4 is local to this routine
[X]
Label DKL42 is local to this routine
[X]
Subroutine DKS3 (category: Keyboard)
Toggle a configuration setting and emit a beep
[X]
Variable DNOIZ in workspace Option variables
Sound on/off configuration setting
[X]
Variable MUFOR in workspace Option variables
Configuration setting that controls whether the docking music can be enabled or disabled
[X]
Variable MUSILLY in workspace Option variables
Sounds during music configuration setting
[X]
Variable MUTOK in workspace Option variables
Docking music configuration setting
[X]
Subroutine MUTOKCH (category: Sound)
Process a change in the docking music configuration setting
[X]
Variable MUTOKOLD in workspace Option variables
Used to store the previous value of MUTOK, so we can track whether the docking music configuration changes
[X]
Variable PATG in workspace Option variables
Configuration setting to show the author names on the start-up screen and enable manual hyperspace mis-jumps
[X]
Subroutine RDKEY (category: Keyboard)
Scan the keyboard for key presses
[X]
Subroutine WSCAN (category: Drawing the screen)
Wait for the vertical sync
[X]
Label nosillytog is local to this routine