Skip to navigation

Keyboard: DOKEY

[BBC Micro disc version, Docked]

Name: DOKEY [Show more] Type: Subroutine Category: Keyboard Summary: Scan for the joystick
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * TT17 calls DOKEY
.DOKEY LDA JSTK \ If JSTK is zero, then we are configured to use the BEQ DK9 \ keyboard rather than the joystick, so jump to DK9 to \ make sure the Bitstik is disabled as well (DK9 then \ jumps to DK4 to scan for pause, configuration and \ secondary flight keys) LDX #1 \ Call DKS2 to fetch the value of ADC channel 1 (the JSR DKS2 \ joystick X value) into (A X), and OR A with 1. This ORA #1 \ ensures that the high byte is at least 1, and then we STA JSTX \ store the result in JSTX LDX #2 \ Call DKS2 to fetch the value of ADC channel 2 (the JSR DKS2 \ joystick Y value) into (A X), and EOR A with JSTGY. EOR JSTGY \ JSTGY will be &FF if the game is configured to STA JSTY \ reverse the joystick Y channel, so this EOR does \ exactly that, and then we store the result in JSTY \ Fall through into DK4 to scan for other keys