\ 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 clan9Name: 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 landingsContext: 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 taxiing, so we set the plane's height, vertical velocity and roll accordingly.
[X]
Subroutine ResetVariable (category: Utility routines)
Set a 16-bit in the variable workspace to 0
[X]
Label clan10 in subroutine ProcessLanding (Part 6 of 7)
[X]
Label clan5 is local to this routine
[X]
Label clan9 in subroutine ProcessLanding (Part 5 of 7)
[X]
Variable ucStatus in workspace Main variable workspace
Undercarriage status
[X]
Variable yPlaneLo in workspace Main variable workspace
Plane altitude/y-coordinate (low byte)
[X]
Variable yVelocityTop in workspace Main variable workspace
Plane velocity in the y-axis from the perspective of the outside world (top byte)