Skip to navigation

Aviator on the BBC Micro

Dashboard: UpdateDashboard

Name: UpdateDashboard [Show more] Type: Subroutine Category: Dashboard Summary: Update two indicators on the dashboard, one from 0-6, one from 7-11, cycling through them with each subsequent call
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * UpdateFlightModel (Part 4 of 4) calls UpdateDashboard * UpdateFlightModel (Part 4 of 4) calls entry point UpdateDash7To11

Each call to this routine updates two indicators, one from the range 0 to 6, and the other from 7 to 11, with subsequent calls working their way through the ranges in order (so the first call updates indicators 0 and 7, the second call updates indicators 1 and 8, and so on). When we reach the end of a range, we wrap round to the start again. Note that the joystick position display has two numbers, 8 and 10, so it gets updated at twice the rate of the other indicators. Also, because the first group covers seven indicators (0 to 6) and the second group covers five (7 to 11), the indicators in the second group are updated more frequently than those in the first group. Other entry points: UpdateDash7To11 Update the next indicator in the range 7 to 11
.UpdateDashboard LDX indicator0To6 \ Increment the indicator number to point to the next INX \ indicator within the range 0 to 6 CPX #7 \ If X < 7, skip the following instruction BCC udas1 LDX #0 \ Set X = 0, so X steps through the range 0 to 6 with \ each subsequent call to UpdateDashboard .udas1 STX indicator0To6 \ Store the updated indicator number JSR UpdateIndicator \ Update indicator X (0 to 6) .UpdateDash7To11 LDX indicator7To11 \ Increment the indicator number to point to the next INX \ indicator within the range 7 to 11 CPX #11 \ If X < 11, skip the following instruction BCC udas2 LDX #7 \ Set X = 7, so X steps through the range 7 to 11 with \ each subsequent call to UpdateDashboard .udas2 STX indicator7To11 \ Store the updated indicator number JSR UpdateIndicator \ Update indicator X (7 to 11) LDA #%01110111 \ Redraw the small horizontal line in the centre of the STA row28_block26_5 \ slip-and-turn indicator RTS \ Return from the subroutine