Skip to navigation

Aviator on the BBC Micro

Flight model: ProcessLanding (Part 3 of 7)

Name: ProcessLanding (Part 3 of 7) [Show more] Type: Subroutine Category: Flight model Summary: If we are taxiing, restrict the plane's vertical movement and roll Deep dive: Take-offs and landings
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file

This part checks whether we are in the process of landing, and if so we jump to part 6. Otherwise we have already landed and are taxxing, so we set the plane's height, vertical velocity and roll accordingly.
\ If we get here then the plane is close enough to the \ ground to be touching down LDX L \ Fetch the current value of onGround BEQ clan10 \ If L is zero then we are not on the ground, so jump \ to clan10 to skip to part 6 \ If we get here then we are already on the ground, so \ we are in the process of landing STA yPlaneLo \ Set the low byte of the plane's y-coordinate to A, \ which contains the value of yLandingGear, so this sets \ the plane's height to the correct value for taxiing, \ i.e. the distance between the cockpit and the lowest \ part of the plane LDX yVelocityTop \ If the top byte of the plane's vertical velocity is BPL clan5 \ positive, skip the following LDX #&8A \ We are on the ground and the plane's vertical velocity JSR ResetVariable \ is negative, so set (yVelocityTop yVelocityHi) = 0 as \ the plane can't travel down into the ground .clan5 LDX #&EC \ Set (zRotationHi zRotationLo) = 0 to set the plane to JSR ResetVariable \ the horizontal position (i.e. zero roll angle) LDX #&02 \ Set (zTurnTop zTurnHi) = 0 to stop the plane turning JSR ResetVariable \ around the z-axis (i.e. stop the plane rolling) LDX ucStatus \ If ucStatus is non-zero then the undercarriage is BNE clan9 \ down, so jump to clan9