Skip to navigation

Maths (Geometry): AddCoords

Name: AddCoords [Show more] Type: Subroutine Category: Maths (Geometry) Summary: Add to a specified coordinate variable
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * MultiplyCoords calls AddCoords * SubtractCoords calls AddCoords

This routine adds (U T) to the specified 16-bit variable.
Arguments: Y Offset of the variable to update: * 3 = xAcceleration * 4 = zAcceleration * 6 = xPlayerAccel * 9 = zVelocity * 12 = zTyreForceNose * 14 = xSteeringForce
.AddCoords LDA xPlayerSpeedHi,Y \ Add (U T) to (xPlayerSpeedTop xPlayerSpeedHi) CLC \ ADC T \ starting with the low bytes STA xPlayerSpeedHi,Y LDA xPlayerSpeedTop,Y \ And then the high bytes ADC U STA xPlayerSpeedTop,Y RTS \ Return from the subroutine