home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / MATH / MODF.S < prev    next >
Encoding:
Text File  |  1993-01-02  |  712 b   |  33 lines

  1. / modf.s (emx+gcc) -- Copyright (c) 1991-1993 by Eberhard Mattes
  2.  
  3.         .globl  _modf
  4.  
  5.         .text
  6.  
  7.         .align  2, 0x90
  8.  
  9. / double modf (double x, double *intptr)
  10.  
  11. #define cw1       0(%esp)
  12. #define cw2       2(%esp)
  13. /define ret_addr  4(%esp)
  14. #define x         8(%esp)
  15. #define intptr   16(%esp)
  16.  
  17. _modf:
  18.         subl    $4, %esp
  19.         fstcww  cw1
  20.         movw    cw1, %ax
  21.         orw     $0x0c00, %ax            / chop mode
  22.         movw    %ax, cw2
  23.         movl    intptr, %eax
  24.         fldcww  cw2
  25.         fldl    x                       / x
  26.         fldl    %st
  27.         frndint
  28.         fstl    (%eax)
  29.         fldcww  cw1
  30.         fsubrp
  31.         addl    $4, %esp
  32.         ret
  33.