109 lines
3.6 KiB
Plaintext
Raw Normal View History

;
; File: FixMath.a
;
; Contains: xxx put contents here xxx
;
; Written by: xxx put writers here xxx
;
; Copyright: <09> 1991-1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <8> 2/11/92 MH Move conditional assembly directive to immediately following
; copyright notice. This matches the public interface, and reduces
; assembler overhead in case the file is included more than once.
; <7> 1/30/91 gbm sab, #38: Change the <20>already including this file<6C> variable to
; all uppercase (for security reasons)
;
; To Do:
;
; Version: 2.94
; Created: Friday, October 20, 1989 at 9:16:04 PM
; File: FixMath.a
;
; Copyright Apple Computer, Inc. 1984-1988
; All Rights Reserved
;
; 1.0 CCH 11/ 9/1988 Adding to EASE.
; END EASE MODIFICATION HISTORY
;<3B>1.1 CCH 9/14/1988 Updated EASE with the current rev of this file.
IF &TYPE('__INCLUDINGFIXMATH__') = 'UNDEFINED' THEN
__INCLUDINGFIXMATH__ SET 1
; These calls support three types of fixed point numbers, each 32 bits long.
; The bits are interpreted as shown. The '-' represents the sign bit.
;
; Type <---------Integer Portion--------> <-------Fractional Portion------>
;LongInt -xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx.
;Fixed -xxxxxxx xxxxxxxx.xxxxxxxx xxxxxxxx
;Fract -x.xxxxxxxx xxxxxxxx xxxxxxxx xxxxxx
;
; Type LongInt can represent integers between +/-2147483647. Type Fixed can
; represent fractional quantities between +/-32768, with about 5 digits of
; accuracy. Type Fract can represent fractional quantities between +/-2 with
; about 9 digits of accuracy. These numeric representations are useful for
; applications that do not require the accuracy of the floating point routines,
; and which need to run as fast as possible. The Graf3D three dimensional
; graphics package resides on top of these routines. Although FixMul is in the
; file ToolTraps, it is shown below to show how it handles different types.
; Additional fixed point routines are described in the Inside Macintosh chapter,
; <20>Toolbox Utilities.<2E>
; FUNCTION FixMul(x, y: Fixed): Fixed;
; FixMul returns x * y. Note that FixMul effects "type * Fixed --> type":
; Fixed * Fixed --> Fixed
; LONGINT * Fixed --> LONGINT
; Fixed * LONGINT --> LONGINT
; Fract * Fixed --> Fract
; Fixed * Fract --> Fract
; FUNCTION FracMul(x, y: Fract): Fract;
; FracMul returns x * y. Note that FracMul effects "type * Fract --> type":
; Fract * Fract --> Fract
; LONGINT * Fract --> LONGINT
; Fract * LONGINT --> LONGINT
; Fixed * Fract --> Fixed
; Fract * Fixed --> Fixed
; FUNCTION FixDiv(x, y: Fixed): Fixed;
; FixDiv returns x / y. Note that FixDiv effects "type / type --> Fixed":
; Fixed / Fixed --> Fixed
; LONGINT / LONGINT --> Fixed
; Fract / Fract --> Fixed
; LONGINT / Fixed --> LONGINT
; Fract / Fixed --> Fract
; FUNCTION FracDiv(x, y: Fract): Fract;
; FracDiv returns x / y. Note that FracDiv effects "type / type --> Fract":
; Fract / Fract --> Fract
; LONGINT / LONGINT --> Fract
; Fixed / Fixed --> Fract
; LONGINT / Fract --> LONGINT
; Fixed / Fract --> Fixed
; FUNCTION FracSqrt(x: Fract): Fract;
; FracSqrt returns the square root of x. Both argument and result are regarded
; as unsigned.
; FUNCTION FracCos(x: Fixed): Fract;
; FUNCTION FracSin(x: Fixed): Fract;
; FracCos and FracSin return the cosine and sine, respectively, given the
; argument x in radians.
;The following routines are accessed via the glue code
;which will call the trap on a 128K ROM machine
_FracCos OPWORD $A847
_FracSin OPWORD $A848
_FracSqrt OPWORD $A849
_FracMul OPWORD $A84A
_FracDiv OPWORD $A84B
_FixDiv OPWORD $A84D
ENDIF ; ...already included