.AdjustTurn LDX #2 \ Set a counter in X to work through the three axes (the \ comments below cover the iteration for the x-axis) .atur1 LDA dxTurnLo,X \ Set xTurn = xTurn + dxTurn CLC \ ADC xTurnLo,X \ starting with the low bytes STA xTurnLo,X LDA dxTurnHi,X \ And then the high bytes ADC xTurnHi,X STA xTurnHi,X LDA dxTurnTop,X \ And then the top bytes ADC xTurnTop,X STA xTurnTop,X DEX \ Decrement the loop counter to move to the next axis BPL atur1 \ Loop back until we have processed all three axes RTS \ Return from the subroutineName: AdjustTurn [Show more] Type: Subroutine Category: Flight model Summary: Adjust the plane's turn rateContext: See this subroutine in context in the source code References: This subroutine is called as follows: * ApplyFlightModel (Part 6 of 7) calls AdjustTurn
This routine adjusts the plane's turn rate by adding a 24-bit unsigned vector to each axis of the plane's turn rate. Specifically, it does the following for each of the three axes (x, y and z): (xTurnTop xTurnHi xTurnLo) += (dxTurnTop dxTurnHi dxTurnLo) so that's: [ xTurn ] [ xTurn ] [ dxTurn ] [ yTurn ] = [ yTurn ] + [ dyTurn ] [ zTurn ] [ zTurn ] [ dzTurn ] where (dxTurn dyTurn dzTurn) and (xTurn yTurn zTurn) are vectors made up of unsigned 24-bit numbers representing angles.
[X]
Label atur1 is local to this routine
[X]
Variable dxTurnHi in workspace Main variable workspace
Rate of change of the plane's turn rate in the x-axis (high byte)
[X]
Variable dxTurnLo in workspace Main variable workspace
Rate of change of the plane's turn rate in the x-axis (low byte)
[X]
Variable dxTurnTop in workspace Main variable workspace
Rate of change of the plane's turn rate in the x-axis (top byte)
[X]
Variable xTurnHi in workspace Main variable workspace
Turn rate around the x-axis (high byte)
[X]
Variable xTurnLo in workspace Main variable workspace
Turn rate around the x-axis (low byte)
[X]
Variable xTurnTop in workspace Main variable workspace
Turn rate around the x-axis (top byte)