.DK4 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) STX KL \ Store X in KL, byte #0 of the key logger CPX #&69 \ If COPY 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 #&51 \ If "S" is not being pressed, skip to DK6 BNE DK6 LDA #0 \ "S" is being pressed, so set DNOIZ to 0 to turn the STA DNOIZ \ sound on .DK6 LDY #&40 \ We now want to loop through the keys that toggle \ various settings. These have internal key numbers \ between &40 (CAPS LOCK) and &46 ("K"), so we set up \ the first key number in Y to act as a loop counter. \ See subroutine DKS3 for more details on this .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 \ --- Mod: Code removed for Elite-A: ------------------> \CPY #&47 \ The last toggle key is &46 (K), so check whether we \ \ have just done that one \ --- And replaced by: --------------------------------> CPY #&48 \ The last toggle key is &47 (@), so check whether we \ have just done that one \ --- End of replacement ------------------------------> BNE DKL4 \ If not, loop back to check for the next toggle key .DK55 CPX #&10 \ If "Q" is not being pressed, skip to DK7 BNE DK7 STX DNOIZ \ "Q" is being pressed, so set DNOIZ to X, which is \ non-zero (&10), so this will turn the sound off .DK7 CPX #&70 \ If ESCAPE is not being pressed, skip over the next BNE P%+5 \ instruction \ --- Mod: Code removed for Elite-A: ------------------> \JMP BR1 \ ESCAPE is being pressed, so jump to BR1 to end the \ \ game \ \CPX #&64 \ If "B" is not being pressed, skip to nobit \BNE nobit \ \LDA BSTK \ Toggle the value of BSTK between 0 and &FF \EOR #&FF \STA BSTK \ \STA JSTK \ Configure JSTK to the same value, so when the Bitstik \ \ is enabled, so is the joystick \ \STA JSTE \ Configure JSTE to the same value, so when the Bitstik \ \ is enabled, the joystick is configured with reversed \ \ channels \ \.nobit \ --- And replaced by: --------------------------------> JMP escape \ ESCAPE is being pressed, so jump to escape to end \ the game \ --- End of replacement ------------------------------> CPX #&59 \ If DELETE 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 LDA QQ11 \ If the current view is non-zero (i.e. not a space BNE out \ view), return from the subroutine (as out contains \ an RTS) LDY #16 \ This is a space view, so now we want to check for all \ the secondary flight keys. The internal key numbers \ are in the keyboard table KYTB from KYTB+8 to \ KYTB+16, and their key logger locations are from KL+8 \ to KL+16. So set a decreasing counter in Y for the \ index, starting at 16, so we can loop through them LDA #&FF \ Set A to &FF so we can store this in the keyboard \ logger for keys that are being pressed \ --- Mod: Code removed for Elite-A: ------------------> \.DK5 \ --- End of removed code -----------------------------> RTS \ Return from the subroutine \ --- Mod: Code removed for Elite-A: ------------------> \.DK9 \ \STA BSTK \ DK9 is called from DOKEY using a BEQ, so we know A is \ \ 0, so this disables the Bitstik and switches to \ \ keyboard or joystick \ \BEQ DK4 \ Jump back to DK4 in DOKEY (this BEQ is effectively a \ \ JMP as A is always zero) \ --- End of removed code ----------------------------->Name: 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: This subroutine is called as follows: * DOKEY calls DK4
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 (COPY) and if it's pressed, pause the game and process any configuration key presses until the game is unpaused (DELETE) * If this is a space view, scan for secondary flight keys and update the relevant bytes in the key logger
[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]
Subroutine DKS3 (category: Keyboard)
Toggle a configuration setting and emit a beep
[X]
Label FREEZE is local to this routine
[X]
Subroutine RDKEY (category: Keyboard)
Scan the keyboard for key presses
[X]
Subroutine WSCAN (category: Drawing the screen)
Wait for the vertical sync
[X]
Subroutine escape (category: Start and end)
Load the main docked code so that it shows the docking tunnel