Skip to navigation

Aviator on the BBC Micro

Flight model: UpdateFlightModel (Part 4 of 4)

Name: UpdateFlightModel (Part 4 of 4) [Show more] Type: Subroutine Category: Flight model Summary: Set up matrices, apply the flight model and update the dashboard
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
.umod15 LDY #2 \ We now set up the matrices, starting with the \ projected rotation angles, which we populate one axis \ at a time, so set a counter in Y to work through the \ three axes .umod16 STY matrixAxis \ Set matrixAxis to the current axis in Y, to pass to \ ProjectAxisAngle JSR ProjectAxisAngle \ Convert the rotation angles of the plane in axis Y to \ coordinates that we can use to populate the matrices \ in the call to SetMatrices LDY matrixAxis \ Restore the axis counter that we stored above DEY \ Decrement the axis counter in Y BPL umod16 \ Loop back until we have processed all three axes LDA #0 \ Set matrixNumber = 0 to pass to SetMatrices, so we STA matrixNumber \ set the values for matrices 1 to 4 STA matrixAxis \ Set matrixAxis = 0 to pass to SetMatrices, so we set \ the three standard axes in matrices 1 to 4 JSR SetMatrices \ Set up the four rotation matrices JSR ApplyFlightModel \ Apply the flight model to our plane JSR UpdateDashboard \ Update the next two indicators in the ranges 0 to 6 \ and 7 to 11 JSR UpdateDash7To11 \ Update the next indicator in the range 7 to 11 RTS \ Return from the subroutine