Skip to navigation

Aviator on the BBC Micro

Dashboard: IndicatorF

Name: IndicatorF [Show more] Type: Subroutine Category: Dashboard Summary: Update the flaps indicator ("F") and and related variables
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * NewGame calls IndicatorF * RetractFlapsIfFast calls IndicatorF * UpdateFlightModel (Part 3 of 4) calls IndicatorF
.IndicatorF LDA forceFactor+5 \ Set A to the force factor for zLiftDrag LDY flapsStatus \ If flapsStatus is non-zero then the flaps are on, so BNE indf1 \ jump to indf1 \ If we get here then the flaps are off SEC \ Set A = A - 200 SBC #200 \ \ so having the flaps off reduces drag LDX #0 \ Set X = 0 to use as the force factor for yFlapsLift \ below LDY #%01000100 \ Set Y to a four-pixel block with pixel 2 in white, to \ act as the centre of the flaps indicator when turned \ off BNE indf2 \ Jump to indf2 to update the indicator (this BNE is \ effectively a JMP as Y is never zero) .indf1 \ If we get here then the flaps are on CLC \ Set A = A + 200 ADC #200 \ \ so having the flaps on increases drag LDX #152 \ Set X = 152 to use as the force factor for yFlapsLift \ below LDY #%11001100 \ Set Y to a four-pixel block with pixels 1 and 2 in \ white, to act as the centre of the flaps indicator \ when turned on .indf2 STA forceFactor+5 \ Store A in the force factor for zLiftDrag, so it is \ incremented by 200 when the flaps are on, and reduced \ by 200 when the flaps are off, i.e. having the flaps \ on increases drag STX forceFactor+7 \ Store X in the force factor for yFlapsLift, so it is 0 \ if the flaps are off and 152 if they are on, i.e. \ having the flaps on increases the vertical lift TYA \ Set A to the pixel pattern in Y LDX #2 \ Set X = 2 to use as a pixel row counter for the three \ pixel rows in the flaps indicator .indf3 STA row30_block35_2,X \ Update pixel row X of the flaps indicator to the pixel \ pattern in A DEX \ Decrement the byte counter to the pixel row above BPL indf3 \ Loop back to update the next row of the indicator RTS \ Return from the subroutine