home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / MAXONC3_6OF8.DMS / in.adf / LIBSRC.LHA / LIBSRC / math_double.asm < prev    next >
Encoding:
Assembly Source File  |  1994-04-15  |  1.4 KB  |  85 lines

  1.  
  2. *    Maxon C++ Library:
  3. *    "math_double"
  4. *    Jens Gelhar 19.03.93, 15.04.94
  5.  
  6.     xdef    _INIT_1_Math_double_o,_EXIT_1_Math_double_o
  7.     xdef    _MathIeeeDoubBasBase,lib_MathDoubleBase,GetDoubmath
  8.     xdef    lib_int2double,lib_double2int
  9.     xdef    _fabs,_floor,_ceil
  10.  
  11.     xref    __OpenLib
  12.  
  13. Execbase    = 4
  14.  
  15. CloseLibrary    = -414
  16. OpenLibrary    = -552
  17.  
  18. GetDoubmath:
  19.     move.l _MathIeeeDoubBasBase,a6
  20.     cmp.w #0,a6
  21.     bne.b ret
  22.     movem.l d0-d2/a0-a2,-(a7)
  23.     bsr.b _INIT_1_Math_double_o
  24.     movem.l (a7)+,d0-d2/a0-a2
  25.     bra.b GetDoubmath
  26.  
  27. _INIT_1_Math_double_o:
  28.     lea mathieeedoubname,a1
  29.     jsr __OpenLib
  30.     move.l d0,_MathIeeeDoubBasBase
  31.     rts
  32.  
  33. _EXIT_1_Math_double_o:
  34.     move.l _MathIeeeDoubBasBase,d0
  35.     beq.b ret
  36.     move.l d0,a1
  37.     move.l Execbase.w,a6
  38.     jsr CloseLibrary(a6)
  39. ret:    rts
  40.  
  41. lib_double2int:
  42.     movem.l a0/a1/a6,-(a7)
  43.     move.l _MathIeeeDoubBasBase,a6
  44.     jsr -30(a6)
  45.     movem.l (a7)+,a0/a1/a6
  46.     rts
  47.  
  48. lib_int2double:
  49.     movem.l a0/a1/a6,-(a7)
  50.     move.l _MathIeeeDoubBasBase,a6
  51.     jsr -36(a6)
  52.     movem.l (a7)+,a0/a1/a6
  53.     rts
  54.  
  55. _fabs:    movem.l 4(a7),d0/d1
  56.     move.l a6,-(a7)
  57.     move.l _MathIeeeDoubBasBase,a6
  58.     jsr -54(a6)
  59.     move.l (a7)+,a6
  60.     rts
  61.  
  62. _floor:    movem.l 4(a7),d0/d1
  63.     move.l a6,-(a7)
  64.     move.l _MathIeeeDoubBasBase,a6
  65.     jsr -90(a6)
  66.     move.l (a7)+,a6
  67.     rts
  68.  
  69. _ceil:    movem.l 4(a7),d0/d1
  70.     move.l a6,-(a7)
  71.     move.l _MathIeeeDoubBasBase,a6
  72.     jsr -96(a6)
  73.     move.l (a7)+,a6
  74.     rts
  75.  
  76. mathieeedoubname:    dc.b 'mathieeedoubbas.library',0
  77.  
  78.     SECTION D,DATA
  79.  
  80. lib_MathDoubleBase:
  81. _MathIeeeDoubBasBase:    dc.l 0
  82.  
  83.     end
  84.  
  85.