.Absolute16Bit BPL MainTitleLoop-1 \ If the high byte in A is already positive, return from \ the subroutine (as MainTitleLoop-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: * FollowGazeVector (Part 5 of 5) calls Absolute16Bit * GetPolygonLines (Part 6 of 6) calls Absolute16Bit * ProcessTileData 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. This routine is from Revs, Geoff Crammond's previous game.
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 MainTitleLoop-1 in subroutine MainTitleLoop (category: Main title loop)
Contains an RTS