.DKJ1 LDA auto \ If auto is non-zero, then the docking computer is BNE auton \ currently activated, so jump to auton in DOKEY so the \ docking computer can "press" the flight keys for us LDA KTRAN+1 \ Copy the key press state for the "?" key from the STA KL+1 \ key logger buffer to the key logger LDA KTRAN+2 \ Copy the key press state for the SPACE key from the STA KL+2 \ key logger buffer to the key logger .BS1 LDA KTRAN+12 \ Fetch the key press state for the joystick 1 fire \ button from the key logger buffer, which contains \ the value of the 6522 System VIA input register IRB \ (SHEILA &40) TAX \ This instruction doesn't seem to have any effect, as \ X is overwritten in a few instructions. When the \ joystick is checked in a similar way in the TITLE \ subroutine for the "Press Fire Or Space,Commander." \ stage of the start-up screen, there's another \ unnecessary TAX instruction present, but there it's \ commented out AND #%00010000 \ Bit 4 of IRB (PB4) is clear if joystick 1's fire \ button is pressed, otherwise it is set, so AND'ing \ the value of IRB with %10000 extracts this bit EOR #%00010000 \ Flip bit 4 so that it's set if the fire button has STA KY7 \ been pressed, and store the result in the keyboard \ logger at location KY7, which is also where the A key \ (fire lasers) key is logged 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 JMP DK4 \ We are done scanning the joystick flight controls, \ so jump to DK4 to scan for other keys, using a tail \ call so we can return from the subroutine thereName: DKJ1 [View in context] Type: Subroutine [Compare versions] Category: Keyboard Summary: Read joystick and flight controls
Specifically, scan the keyboard for the speed up and slow down keys, and read the joystick's fire button and X and Y axes, storing the results in the key logger and the joystick position variables. This routine is only called if joysticks are enabled (JSTK = non-zero).
Scan for pause, configuration and secondary flight keys
Read the joystick position
The key logger buffer that gets updated by the OSWORD 240 command
Entry point auton in subroutine DOKEY (category: Keyboard)
Get the docking computer to "press" the flight keys to dock the ship