Skip to navigation

Revs on the BBC Micro

Keyboard: ProcessDrivingKeys (Part 5 of 6)

Name: ProcessDrivingKeys (Part 5 of 6) [Show more] Type: Subroutine Category: Keyboard Summary: Process joystick gear change
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
BIT configJoystick \ If bit 7 of configJoystick is clear then the joystick BPL keys21 \ is not configured, so jump to keys21 to skip the \ following joystick-specific gear checks LDX #0 \ Call OSBYTE with A = 128 and X = 0 to fetch the ADC LDA #128 \ channel that was last used for ADC conversion, JSR OSBYTE \ returning the channel number in Y, and the status of \ the two fire buttons in X TXA \ If bit 0 of X is zero, then no fire buttons are being AND #1 \ pressed, so jump to keys22 to check the next key BEQ keys22 LDY throttleBrakeState \ If throttleBrakeState <> 1, then the throttle is not DEY \ being applied, so jump to keys23 BNE keys23 \ If we get here then the fire button is being pressed \ and the throttle is being applied, which is the \ joystick method for changing gear, so now we jump to \ the correct part below to change up or down a gear LDA throttleBrake \ If the throttle amount is >= 200, jump to keys24 to CMP #200 \ change up a gear BCS keys24 BCC keys23 \ Otherwise jump to keys23 to change down a gear