;-----------------------------------------------------------
;
; FILE:  INCLUDE.EQUS
;
; Copyright Apple Computer, Inc. 1984, 1985
; All Rights Reserved
;
;  These equates and the individual assembly language macros 
;  give access to the 6502 floating-point arithmetic routines.
;-----------------------------------------------------------
;
;-----------------------------------------------------------
; Operation code masks.
;-----------------------------------------------------------
FOADD EQU $0000 ; add
FOSUB EQU $0002 ; subtract
FOMUL EQU $0004 ; multiply
FODIV EQU $0006 ; divide
FOCMP EQU $0008 ; compare, no exception from unordered
FOCPX EQU $000A ; compare, signal invalid if unordered
FOREM EQU $000C ; remainder
FOZ2X EQU $000E ; convert to extended
FOX2Z EQU $0010 ; convert from extended
FOSQRT EQU $0012 ; square root
FORTI EQU $0014 ; round to integral value
FOTTI EQU $0016 ; truncate to integral value
FOSCALB EQU $0018 ; binary scale
FOLOGB EQU $001A ; binary log
FOCLASS EQU $001C ; classify
FONEXT EQU $001E ; next-after
;
FOSETENV EQU $0001 ; set environment
FOGETENV EQU $0003 ; get environment
FOSETHV EQU $0005 ; set halt vector
FOGETHV EQU $0007 ; get halt vector
FOD2B EQU $0009 ; convert decimal to binary
FOB2D EQU $000B ; convert binary to decimal
FONEG EQU $000D ; negate
FOABS EQU $000F ; absolute value
FOCPYSGN EQU $0011 ; copy sign
; UNDEFINED    EQU    $0013
FOSETXCP EQU $0015 ; set exception
FOPROCENTRY EQU $0017 ; procedure-entry
FOPROCEXIT EQU $0019 ; procedure-exit
FOTESTXCP EQU $001B ; test exception
; UNDEFINED    EQU    $001D
; UNDEFINED    EQU    $001F
;
;-----------------------------------------------------------
; Operand format masks.
;-----------------------------------------------------------
FFEXT EQU $00 ; extended -- 80-bit float
FFDBL EQU $01 ; double   -- 64-bit float
FFSGL EQU $02 ; single   -- 32-bit float
FFLNG EQU $03 ; longint  -- 32-bit integer                                                   
FFINT EQU $04 ; integer  -- 16-bit integer
FFCOMP EQU $05 ; comp     -- 64-bit integer
; UNDEFINED    EQU    $06
; UNDEFINED    EQU    $07
;
;-----------------------------------------------------------
; Class.
;-----------------------------------------------------------
FCSNAN EQU $FC ; -4: signaling NAN
FCQNAN EQU $FD ; -3: quiet NAN
FCINF EQU $FE ; -2: infinite
FCZERO EQU $FF ; -1: zero
FCNORM EQU $00 ;  0: normal
FCDENORM EQU $01 ;  1: denormal
;
;-----------------------------------------------------------
; Exceptions.
;-----------------------------------------------------------
FBINVALID EQU $01
FBUFLOW EQU $02
FBOFLOW EQU $04
FBDIVZER EQU $08
FBINEXACT EQU $10
; 
;-----------------------------------------------------------
; Elementary function operation code masks.
;-----------------------------------------------------------
FOLNX EQU $00 ; base-e log 
FOLOG2X EQU $02 ; base-2 log
FOLN1X EQU $04 ; ln (1 + x)
FOLOG21X EQU $06 ; log2 (1 + x)
FOEXPX EQU $08 ; base-e exponential  
FOEXP2X EQU $0A ; base-2 exponential
FOEXP1X EQU $0C ; exp (x) - 1
FOEXP21X EQU $0E ; exp2 (x) - 1
FOXPWRI EQU $10 ; integer exponentiation
FOXPWRY EQU $12 ; general exponentiation
FOCOMPND EQU $14 ; compound
FOANNUIT EQU $16 ; annuity
FOATANX EQU $18 ; arctangent
FOSINX EQU $1A ; sine
FOCOSX EQU $1C ; cosine
FOTANX EQU $1E ; tangent
FORANDX EQU $20 ; random
;
;-----------------------------------------------------------
; NaN error codes.  
;-----------------------------------------------------------
NANSQRT EQU 1 ; Invalid square root such as sqrt(-1).
NANADD EQU 2 ; Invalid addition such as +INF - +INF. 
NANDIV EQU 4 ; Invalid division such as 0/0. 
NANMUL EQU 8 ; Invalid multiply such as 0 * INF. 
NANREM  EQU 9 ; Invalid remainder or mod such as x REM 0. 
NANASCBIN EQU 17 ; Attempt to convert invalid ASCII string. 
NANCOMP EQU 20 ; Result of converting comp NaN to floating.
NANZERO EQU 21 ; Attempt to create a NaN with a zero code.
NANTRIG EQU 33 ; Invalid argument to trig routine. 
NANINVTRIG EQU 34 ; Invalid argument to inverse trig routine. 
NANLOG EQU 36 ; Invalid argument to log routine. 
NANPOWER EQU 37 ; Invalid argument to x^i or x^y routine. 
NANFINAN EQU 38 ; Invalid argument to financial function. 
;-----------------------------------------------------------
;-----------------------------------------------------------
;-----------------------------------------------------------
;-----------------------------------------------------------
