.Absolute16Bit BPL ScanKeyboard-1 \ If the high byte in A is already positive, return from \ the subroutine (as ScanKeyboard-1 contains an RTS) \ Otherwise fall through into Negate16Bit to negate the \ number in (A T), which will make it positive, so this \ sets (A T) = |A T|Name: Absolute16Bit [Show more] Type: Subroutine Category: Maths (Arithmetic) Summary: Calculate the absolute value (modulus) of a 16-bit numberContext: See this subroutine in context in the source code References: This subroutine is called as follows: * ApplyDrivingModel calls Absolute16Bit * ApplyLimitAndSign calls Absolute16Bit * AssistSteering calls Absolute16Bit * CompareSegments calls Absolute16Bit * DrawSegmentEdge (Part 2 of 7) calls Absolute16Bit * Multiply8x16Signed calls Absolute16Bit * ProcessContact calls Absolute16Bit * ProcessDrivingKeys (Part 2 of 6) calls Absolute16Bit
This routine sets (A T) = |A T|. It can also return (A T) * abs(n), where A is given the sign of n.
Arguments: (A T) The number to make positive N flag Controls the sign to be applied: * If we want to calculate |A T|, do an LDA or equivalent before calling the routine * If we want to calculate (A T) * abs(n), do a BIT n before calling the routine * If we want to set the sign of (A T), then call with: * N flag clear to calculate (A T) * 1 * N flag set to calculate (A T) * -1
[X]
Entry point ScanKeyboard-1 in subroutine ScanKeyboard (category: Keyboard)
Contains an RTS