Skip to navigation

Revs on the BBC Micro

Track geometry: SpinTrackSection

Name: SpinTrackSection [Show more] Type: Subroutine Category: Track geometry Summary: Apply spin to a section in the track section list
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * GetSectionAngles (Part 1 of 3) calls SpinTrackSection

Arguments: Y The index of the entry in the track section list: Y = 0 to 5 (update the right verge): * Reset vergeDataRight to zero * Subtract spinYawAngle from the yaw angles in xVergeRightLo, xVergeRightHi * Subtract spinPitchAngle from the pitch angle in yVergeRight * Update horizonListIndex and horizonLine Y = 0 to 5 + 40 (update the left verge): * Reset vergeDataLeft to zero * Subtract spinYawAngle from the yaw angles in xVergeLeftLo, xVergeLeftHi * Subtract spinPitchAngle from the pitch angle in yVergeLeft * Update horizonListIndex and horizonLine
.SpinTrackSection LDA #0 \ Set the Y-th entry in vergeDataRight to 0, to reset STA vergeDataRight,Y \ the colour of the verge mark to black (this is \ recalculated in the GetVergeAndMarkers routine) LDA xVergeRightLo,Y \ Set xVergeRight = xVergeRight - spinYawAngle SEC \ SBC spinYawAngleHi \ starting with the low bytes STA xVergeRightLo,Y LDA xVergeRightHi,Y \ And then the high bytes SBC spinYawAngleTop STA xVergeRightHi,Y LDA yVergeRight,Y \ Set A = Y-th entry in yVergeRight - spinPitchAngle SEC SBC spinPitchAngle STA yVergeRight,Y \ Store the result in the Y-th entry in yVergeRight CMP horizonLine \ If A < horizonLine, then this track section is lower BCC rott1 \ than the current horizon, so jump to rott1 to return \ from the subroutine STA horizonLine \ Otherwise this track section is higher than the \ current horizon pitch angle, so the track obscures the \ horizon and we need to update horizonLine to this \ new pitch angle STY horizonListIndex \ Set horizonListIndex to the track section list index \ number in Y .rott1 RTS \ Return from the subroutine