.IndicatorU LDA forceFactor+5 \ Set A to the force factor for zLiftDrag LDY ucStatus \ If ucStatus is non-zero then the undercarriage is BNE indu1 \ down, so jump to indu1 \ If we get here then the undercarriage is up SEC \ Set A = A - 10 SBC #10 \ \ so having the undercarriage up reduces drag LDX #5 \ Set X = 5 to store in yLandingGear below, as the \ vertical distance between the cockpit and the bottom \ of the plane LDY #%01010101 \ Set Y to a four-pixel block with pixels 0 and 2 in \ white, to act as the centre of the undercarriage \ indicator when turned off BNE indu2 \ Jump to indu2 to update the indicator (this BNE is \ effectively a JMP as Y is never zero) .indu1 \ If we get here then the undercarriage is down LDY onGround \ If onGround is non-zero, then we are on the ground, so BNE indu4 \ jump to indu4 to set the undercarriage to up (because \ once we have landed with the undercarriage up, we \ can't put it down again) CLC \ Set A = A + 10 ADC #10 \ \ so having the undercarriage down increases drag LDX #10 \ Set X = 10 to store in in yLandingGear below, as the \ vertical distance between the cockpit and the bottom \ of the plane LDY #%01110111 \ Set Y to a four-pixel block with pixels 0, 1 and 2 in \ white, to act as the centre of the undercarriage \ indicator when turned on .indu2 STA forceFactor+5 \ Store A in the force factor for zLiftDrag, so it is \ incremented by 10 when the undercarriage is down, and \ reduced by 10 when the undercarriage is up, i.e. \ having the undercarriage down increases drag STX yLandingGear \ Store X in yLandingGear, so the vertical distance \ between the cockpit and the bottom of the plane is 5 \ if the undercarriage is up, or 10 if it is down 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 undercarriage indicator .indu3 STA row30_char32_2,X \ Update pixel row X of the undercarriage indicator to \ the pixel pattern in A DEX \ Decrement the byte counter to the pixel row above BPL indu3 \ Loop back to update the next row of the indicator RTS \ Return from the subroutine .indu4 LDA #0 \ Set ucStatus = 0 to set the undercarriage to up, STA ucStatus \ because once we have landed with the undercarriage up, \ the belly of the plane is on the ground and we can't \ put the undercarriage down again RTS \ Return from the subroutineName: IndicatorU [Show more] Type: Subroutine Category: Dashboard Summary: Update the undercarriage indicator ("U") and related variablesContext: See this subroutine in context in the source code References: This subroutine is called as follows: * ResetVariables calls IndicatorU * UpdateFlightModel (Part 3 of 4) calls IndicatorU
[X]
Variable forceFactor (category: Flight model)
The factors by which the flight forces are multiplied as part of the scaling process
[X]
Label indu1 is local to this routine
[X]
Label indu2 is local to this routine
[X]
Label indu3 is local to this routine
[X]
Label indu4 is local to this routine
[X]
Variable onGround in workspace Main variable workspace
"On the ground" status
[X]
Configuration variable row30_char32_2 = &7E82
Undercarriage indicator
[X]
Variable ucStatus in workspace Main variable workspace
Undercarriage status
[X]
Variable yLandingGear in workspace Main variable workspace
The vertical distance between the cockpit and the lowest part of the plane