mac-rom/Libs/InterfaceSrcs/FixMathAsm.a
Elliot Nunn 4325cdcc78 Bring in CubeE sources
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included.

The Tools directory, containing mostly junk, is also excluded.
2017-12-26 09:52:23 +08:00

91 lines
2.4 KiB
Plaintext

; File: FixMath.a
;
; Version 2.0a3
;
; Copyright 1984, 1985, 1986 Apple Computer, Inc. All Rights Reserved
;
INCLUDE 'SysEqu.a'
; This file is the implementation of the FixMath calls.
; FUNCTION FixDiv (x, y: Fixed): Fixed; { returns x/y, signed }
;
; FUNCTION FracDiv (x, y: Fracd): Fracd; { returns x/y }
;
; FUNCTION FracMul (x, y: Fracd): Fracd; { returns x*y }
;
; FUNCTION FracSqrt (x: Fracd) : Fracd; { returns square root of x }
;
; FUNCTION FracSin (x: Fixed) : Fracd; { returns Sin(x) }
;
; FUNCTION FracCos (x: Fixed) : Fracd; { returns Cos(x) }
;
; Type Fixed is 32-bit binary fixed-point with binary point between
; high and low words. Sign is kept a la 2's-complement.
; Type double is 64-bit IEEE binary floating point.
; Type Fracd is 32-bit binary fixed point-point with binary point
; after leading bits. Sign is kept a la 2's-complement.
;
; Exceptional cases:
; Fixed overflow is set to $7FFFFFFF when positive, $80000000 when
; negative.
; Division by zero yields $7FFFFFFF when x is positive or zero,
; and $80000000 when x is negative.
;
; Calling conventions:
; Fixed results are returned in D0.32, double results in D0-D1.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; There are two flavors of multiply, FracMul and FixMul. FracMul uses the
; top 35 bits of the 64-bit product: the top two are shifted off the left,
; the the last bit is used for rounding. FixMul uses the middle 32 bits
; of the product, with the attendant overflow checks, and rounds with a
; 32nd bit.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;128K Rom Fixmath Traps with auto-pop bit set
_NFracDiv OPWORD $AC4B
_NFixDiv OPWORD $AC4D
_NFracCos OPWORD $AC47
_NFracSin OPWORD $AC48
_NFracMul OPWORD $AC4A
_NFracSqrt OPWORD $AC49
FixMath PROC EXPORT
EXPORT FracMul
EXPORT FracDiv
EXPORT FixDiv
EXPORT FracSqrt
EXPORT FracSin
EXPORT FracCos
FracMul
_NFracMul ;the trap
;will return to caller
FracDiv
_NFracDiv ;the trap
;will return to caller
FixDiv
_NFixDiv ;the trap
;will return to caller
FracSqrt
_NFracSqrt ;the trap
;will return to caller
FracCos
_NFracCos ;the trap
;will return to caller
FracSin
_NFracSin ;the trap
;will return to caller
END