home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
354.lha
/
mathtrans_v1.1
/
MatLib.asm
< prev
next >
Wrap
Assembly Source File
|
1990-03-10
|
8KB
|
539 lines
; Mathtrans.library 24.1. 1990
; optimiert für MC68881
;
; MatLib.asm V1.1
; © 1989/90 Heiner Hückstädt
; Gellertstraße 12
; 5090 Leverkusen 1
; West-Germany
;
; PLACED IN THE PUBLIC DOMAIN
; Assemble with Manx V3.6
; as matlib.asm
; ln matlib.o -o mathtrans.library
; Comments, donations, bug-reports are welcome.
; Please refer to the adress given above.
; This library was tested with Distant Suns, Funktion, StarChart...
; I think it should work properly.
; Have fun.....
include "exec/types.i"
include "exec/nodes.i"
include "exec/libraries.i"
include "exec/initializers.i"
include "exec/resident.i"
include "exec/execbase.i"
VERSION EQU 33 ; Der Kompatibilität wegen
REVISION EQU 8
MYPRI EQU $0
DisplayAlert EQU -90
OpenLibrary EQU -552
CloseLibrary EQU -414
STRUCTURE MyLib,LIB_SIZE
* ---- STRUCTURE LN,0
ULONG ml_SysLib
ULONG ml_DosLib
ULONG ml_SegList
UBYTE ml_Flags
UBYTE ml_Pad
LABEL MyLib_Sizeof
mc68881
FirstAddress:
moveq #0,d0
rts
;ROMTag Struktur zum Einbinden der Library
InitDescription:
dc.w RTC_MATCHWORD
dc.l InitDescription
dc.l EndCode
dc.b RTF_AUTOINIT
dc.b VERSION
dc.b NT_LIBRARY
dc.b MYPRI
dc.l LibName
dc.l IdString
dc.l InitTab
LibName: dc.b "mathtrans.library",0
even
IdString: dc.b "MC68881/82 Version 1.1 (1/90) © Heiner Hückstädt Public Domain",13,10,0
even
InitTab: dc.l MyLib_Sizeof ;Länge der Library Struktur
dc.l FuncTable
dc.l DataTable
dc.l InitLibrary
FuncTable: dc.l Open
dc.l Close
dc.l Expunge
dc.l FirstAddress
; Ab hier die Library Funktionen
dc.l SPAtan
dc.l SPSin
dc.l SPCos
dc.l SPTan
dc.l SPSincos
dc.l SPSinh
dc.l SPCosh
dc.l SPTanh
dc.l SPExp
dc.l SPLog
dc.l SPPow
dc.l SPSqrt
dc.l SPTieee
dc.l SPFieee
dc.l SPAsin
dc.l SPAcos
dc.l SPLog10
dc.l -1
; Ende der Tabelle
DataTable: INITBYTE LN_TYPE,NT_LIBRARY
INITLONG LN_NAME,LibName
INITBYTE LIB_FLAGS,LIBF_SUMUSED|LIBF_CHANGED
INITWORD LIB_VERSION,VERSION
INITWORD LIB_REVISION,REVISION
INITLONG LIB_IDSTRING,IdString
dc.l 0
InitLibrary:
MOVEA.L D0,A1
MOVE.L A6,34(A1)
MOVE.L A0,38(A1)
move.w AttnFlags(a6),d0
btst #4,d0
beq.s not_ok
move.w #1,32(a1)
move.l a1,d0
rts
not_ok:
bra no_fpu_alert
Open:
ADDQ.W #1,32(A6)
BCLR.B #3,42(A6)
MOVE.L A6,D0
RTS
Close:
MOVEQ.L #0,D0
SUBQ.W #1,32(A6)
BNE.S L000009
BTST.B #3,42(A6)
BEQ.S L000009
BSR.S Expunge
L000009:
RTS
Expunge:
MOVEM.L D2/A5-A6,-(A7)
MOVEA.L A6,A5
MOVEA.L 34(A5),A6
TST.W 32(A5)
BEQ.S L00000B
BSET.B #3,42(A5)
MOVEQ.L #0,D0
BRA.S L00000C
L00000B:
MOVE.L 38(A5),D2
MOVEA.L A5,A1
JSR -252(A6)
MOVEA.L A5,A1
MOVEQ.L #0,D1
MOVEQ.L #0,D0
MOVE.W 16(A5),D1
SUBA.L D1,A1
MOVE.W 18(A5),D0
ADD.L D1,D0
JSR -210(A6)
MOVE.L D2,D0
L00000C:
MOVEM.L (A7)+,D2/A5-A6
RTS
; MOVEQ.L #0,D0
; RTS
; LibraryFunktionen jetzt !!
SPTieee:
ADD.L D0,D0
BEQ.S L000088
EORI.B #128,D0
ASR.B #1,D0
SUBI.B #130,D0
SWAP D0
ROL.L #7,D0
L000088:
RTS
SPFieee:
SWAP D0
ROR.L #7,D0
EORI.B #128,D0
ADD.B D0,D0
BVS.S L00008B
ADDQ.B #5,D0
BVS.S L000090
EORI.B #128,D0
ROR.L #1,D0
L00008A:
RTS
L00008B:
BCC.S L00008F
CMPI.B #124,D0
BEQ.S L00008C
CMPI.B #126,D0
BNE.S L00008D
L00008C:
ADDI.B #133,D0
ROR.L #1,D0
TST.B D0
BNE.S L00008A
MOVEQ.L #0,D0
RTS
L00008D:
ANDI.W #65279,D0
TST.L D0
BEQ.S L00008A
TST.B D0
L00008E:
MOVEQ.L #0,D0
RTS
L00008F:
CMPI.B #254,D0
BNE.S L000090
LSR.L #8,D0
LSR.L #1,D0
BNE.S L000092
BRA.S L000091
L000090:
LSL.W #8,D0
L000091:
MOVEQ.L #-1,D0
ROXR.B #1,D0
ORI.B #$02,CCR
RTS
L000092:
MOVEQ.L #0,D0
RTS
SPAtan:
fmove.s fp0,-(sp)
bsr SPTieee
fatan.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPSin:
fmove.s fp0,-(sp)
bsr SPTieee
fsin.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPCos:
fmove.s fp0,-(sp)
bsr SPTieee
fcos.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPTan:
fmove.s fp0,-(sp)
bsr SPTieee
ftan.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPSincos:
fmovem.x fp0/fp1,-(sp)
bsr SPTieee
move.l d1,a0
fsincos.s d0,fp0:fp1
fmove.s fp0,d0 ;cosinus
bsr SPFieee
move.l d0,(a0)
fmove.s fp1,d0 ;sinus
bsr SPFieee
fmovem.x (sp)+,fp0/fp1
rts
SPSinh:
fmove.s fp0,-(sp)
bsr SPTieee
fsinh.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPCosh:
fmove.s fp0,-(sp)
bsr SPTieee
fcosh.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPTanh:
fmove.s fp0,-(sp)
bsr SPTieee
ftanh.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPExp:
fmove.s fp0,-(sp)
bsr SPTieee
fetox.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPLog:
fmove.s fp0,-(sp)
bsr SPTieee
flogn.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPPow:
fmove.s fp0,-(sp)
bsr SPTieee
fabs.s d0,fp0
fmove.s fp0,d0
flogn.s d0,fp0
move.l d1,d0
bsr SPTieee
fmul.s d0,fp0
fmove.s fp0,d0
fetox.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPSqrt:
fmove.s fp0,-(sp)
bsr SPTieee
fsqrt.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPAsin:
fmove.s fp0,-(sp)
bsr SPTieee
fasin.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPAcos:
fmove.s fp0,-(sp)
bsr SPTieee
facos.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
SPLog10:
fmove.s fp0,-(sp)
bsr SPTieee
flog10.s d0,fp0
fmove.s fp0,d0
bsr SPFieee
fmove.s (sp)+,fp0
rts
no_fpu_alert:
movem.l d1-d7/a0-a6,-(sp)
; move.l ExecBase,a6 bereits geladen
lea intname(pc),a1
moveq.l #0,d0
jsr OpenLibrary(a6)
move.l a6,a5
move.l d0,a6
moveq.l #40,d1
moveq.l #0,d0
lea alert(pc),a0
jsr DisplayAlert(a6)
move.l a6,a1
move.l a5,a6
jsr CloseLibrary(a6)
movem.l (sp)+,d1-d7/a0-a6
moveq #0,d0
rts
intname:
dc.b "intuition.library",0
even
alert:
dc.b 0
dc.b 40
dc.b 16
dc.b 84
dc.b 104
dc.b 105
dc.b 115
dc.b 32
dc.b 109
dc.b 97
dc.b 116
dc.b 104
dc.b 116
dc.b 114
dc.b 97
dc.b 110
dc.b 115
dc.b 46
dc.b 108
dc.b 105
dc.b 98
dc.b 114
dc.b 97
dc.b 114
dc.b 121
dc.b 32
dc.b 114
dc.b 101
dc.b 113
dc.b 117
dc.b 105
dc.b 114
dc.b 101
dc.b 115
dc.b 32
dc.b 116
dc.b 104
dc.b 101
dc.b 32
dc.b 110
dc.b 117
dc.b 109
dc.b 101
dc.b 114
dc.b 105
dc.b 99
dc.b 32
dc.b 99
dc.b 111
dc.b 112
dc.b 114
dc.b 111
dc.b 99
dc.b 101
dc.b 115
dc.b 115
dc.b 111
dc.b 114
dc.b 32
dc.b 77
dc.b 54
dc.b 56
dc.b 56
dc.b 56
dc.b 49
dc.b 47
dc.b 50
dc.b 0
dc.b 1
dc.b 0
dc.b 40
dc.b 24
dc.b 80
dc.b 108
dc.b 101
dc.b 97
dc.b 115
dc.b 101
dc.b 32
dc.b 117
dc.b 115
dc.b 101
dc.b 32
dc.b 116
dc.b 104
dc.b 101
dc.b 32
dc.b 108
dc.b 105
dc.b 98
dc.b 114
dc.b 97
dc.b 114
dc.b 121
dc.b 32
dc.b 102
dc.b 114
dc.b 111
dc.b 109
dc.b 32
dc.b 121
dc.b 111
dc.b 117
dc.b 114
dc.b 32
dc.b 111
dc.b 114
dc.b 105
dc.b 103
dc.b 105
dc.b 110
dc.b 97
dc.b 108
dc.b 32
dc.b 87
dc.b 111
dc.b 114
dc.b 107
dc.b 98
dc.b 101
dc.b 110
dc.b 99
dc.b 104
dc.b 32
dc.b 100
dc.b 105
dc.b 115
dc.b 107
dc.b 0
dc.b 0
dc.b 0
even
EndCode:
End