home *** CD-ROM | disk | FTP | other *** search
- *------------------------------------------------------------------
- * mathtrans.a: PDC library interface to motorola floating point
- * transient library base library supplied by Commodore.
- * Maintenance Notes:
- * 06Jun89 - Created by Jal
- *------------------------------------------------------------------
-
- AG_OpenLib equ $00030000
- AO_MathLib equ $00008005
- bias SET -30
-
- libref MACRO
- _LVO\1 EQU bias
- bias SET bias-6
- ENDM
-
- *------------------------------------------------------------------
- * Note: these *Must* be in the same order as the
- * mathtrans_lib.fd file.
- *------------------------------------------------------------------
-
- libref SPAtan
- libref SPSin
- libref SPCos
- libref SPTan
- libref SPSincos
- libref SPSinh
- libref SPCosh
- libref SPTanh
- libref SPExp
- libref SPLog
- libref SPPow
- libref SPSqrt
- libref SPTieee
- libref SPFieee
- libref SPAsin
- libref SPAcos
- libref SPLog10
-
- XREF _Alert
- XREF _exit
- XREF _MathTransBase
- XREF __MathTransClose
- XREF _OpenLibrary
- XREF _CloseLibrary
-
- *------------------------------------------------------------------
-
- SECTION DATA,DATA
-
- MathTransBase dc.l 0
- MATHName dc.b 'mathtrans.library',0
-
- SECTION CODE,CODE
-
- *------------------------------------------------------------------
- * Close the MathTrans library if we opened it.
- *------------------------------------------------------------------
- MathTransClose:
- move.l MathTransBase,-(A7)
- jsr _CloseLibrary
- addq #4,A7
- rts
-
- *------------------------------------------------------------------
- * Open the MathTrans library
- *------------------------------------------------------------------
-
- .fpopen:
- movem.l D0-D1/A0-A1,-(A7) ; save temporary registers
- pea 0 ; any version will do....
- pea MATHName ; Load the name of library
- jsr _OpenLibrary ; Open the library
- addq #8,A7
- move.l D0,_MathTransBase ; Save the return code
- bne.s 1$ ; If non-zero then OK
-
- pea 0 ; Parameter for Alert.
- pea AG_OpenLib!AO_MathLib ; Signal an error
- jsr _Alert
- addq #8,A7
- pea 100 ; push return code
- jsr _exit ; and exit
- 1$:
- move.l D0,MathTransBase
- move.l #MathTransClose,__MathTransClose
- movem.l (A7)+,D0-D1/A0-A1 ; restore temporaries
- rts
-
- *------------------------------------------------------------------
- * Do the MathTrans function
- *------------------------------------------------------------------
-
- .fpdo:
- tst.l _MathTransBase
- bne.s 1$
- jsr .fpopen
- 1$:
- movem.l 8(A7),D0
- movem.l A6,-(A7)
- move.l _MathTransBase,A6
- add.l 4(A7),A6
- jsr (A6)
- movem.l (A7)+,A6
- addq #4,A7 ; Chuck function offset.
- rts
-
- *------------------------------------------------------------------
- * atan: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _atan
- _atan:
- pea _LVOSPAtan
- jmp .fpdo
-
- *------------------------------------------------------------------
- * sin: Input double (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _sin
- _sin:
- pea _LVOSPSin
- jmp .fpdo
-
- *------------------------------------------------------------------
- * cos: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _cos
- _cos:
- pea _LVOSPCos
- jmp .fpdo
-
- *------------------------------------------------------------------
- * tan: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _tan
- _tan:
- pea _LVOSPTan
- jmp .fpdo
-
- *------------------------------------------------------------------
- * sinh: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _sinh
- _sinh:
- pea _LVOSPSinh
- jmp .fpdo
-
- *------------------------------------------------------------------
- * cosh: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _cosh
- _cosh:
- pea _LVOSPCosh
- jmp .fpdo
-
- *------------------------------------------------------------------
- * tanh: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _tanh
- _tanh:
- pea _LVOSPTanh
- jmp .fpdo
-
- *------------------------------------------------------------------
- * exp: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _exp
- _exp:
- pea _LVOSPExp
- jmp .fpdo
-
- *------------------------------------------------------------------
- * log: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _log
- _log:
- pea _LVOSPLog
- jmp .fpdo
-
- *------------------------------------------------------------------
- * pow: pow(exp, power) : Output D0
- *------------------------------------------------------------------
- XDEF _pow
- _pow:
- movem.l 12(A7),D1
- pea _LVOSPPow
- jmp .fpdo
-
- *------------------------------------------------------------------
- * sqrt: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _sqrt
- _sqrt:
- pea _LVOSPSqrt
- jmp .fpdo
-
- *------------------------------------------------------------------
- * asin: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _asin
- _asin:
- pea _LVOSPAsin
- jmp .fpdo
-
- *------------------------------------------------------------------
- * acos: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _acos
- _acos:
- pea _LVOSPAcos
- jmp .fpdo
-
- *------------------------------------------------------------------
- * log10: Input (on stack): Output D0
- *------------------------------------------------------------------
- XDEF _log10
- _log10:
- pea _LVOSPLog10
- jmp .fpdo
-
- END
-