; Math package - version 24.12.88

               XDEF    LinkTop
               XDEF    ComalStr
               XDEF    Cot

               include 'package.i'

; Initialisation section
               MOVE.L  D0,A0                  ; Address of package structure
               MOVE.L  #LinkTop,PckTopId(A0)  ; Address of top-link
               MOVE.L  PckCmlStr(A0),ComalStr ; Address of Comal structure
               CLR.W   D0                     ; No error
               RTS

; Return value of cot(x)=cos(x)/sin(x)
;
Cot:           MOVE.L  -(A5),D3        ; Get exponent
               MOVE.L  -(A5),D2        ; .. and mantissa of x
               MOVE.L  D3,D1           ; Move to NUMREG1
               MOVE.L  D2,D0
               MOVE.L  ComalStr,A0     ; Address of Comal structure
               JSR     NUMSIN(A0)      ; NUMREG2:=sin(NUMREG2)
               EXG     D0,D2           ; NUMREG1 <-> NUMREG2
               EXG     D1,D3
               JSR     NUMCOS(A0)      ; NUMREG2:=cos(NUMREG2)
               JMP     NUMDIV(A0)      ; NUMREG2:=NUMREG2/NUMREG1

               SECTION MathData,DATA

CotLink:       DC.L    0
               DC.L    CotName
               DC.W    fltcode     ; Float function
               DC.W    1           ; One argument
               DC.W    fltval      ; Argument type = float value
               DC.L    Cot         ; Routine address
CotName:       DC.B    'COT',0

               CNOP    0,2
LinkTop:       DC.L    CotLink

               SECTION MathBlock,BSS
;
; Internal workspace
;
ComalStr:      DS.L    1           ; Pointer to Comal structure

               END 
