home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / OS2 / EMXFIX04.ZIP / FIXUXFDI.S < prev    next >
Text File  |  1993-12-21  |  1KB  |  50 lines

  1. / fixuxfdi.s (emx+gcc) -- Copyright (c) 1993 by Eberhard Mattes
  2.  
  3.         .globl ___fixunsxfdi
  4.  
  5.         .text
  6.  
  7.     .align 2, 0x90
  8.  
  9. / ldexp (1.0, 63)
  10.  
  11. LC1:    .long   0x00000000
  12.         .long   0x43e00000
  13.  
  14.     .align 2, 0x90
  15.  
  16. #define tmp_lo       -12(%ebp)
  17. #define tmp_hi        -8(%ebp)
  18. #define cw1           -4(%ebp)
  19. #define cw2           -2(%ebp)
  20. /define saved_ebp      0(%ebp)
  21. /define ret_addr       4(%ebp)
  22. #define x              8(%ebp)
  23.  
  24. ___fixunsxfdi:
  25.         pushl   %ebp
  26.         movl    %esp, %ebp
  27.         subl    $12, %esp
  28.         fstcw   cw1
  29.         movw    cw1, %ax
  30.         orw     $0x0c00, %ax            / truncate towards zero
  31.         movw    %ax, cw2
  32.         fldcw   cw2
  33.         fldt    x
  34.         fcoml   LC1
  35.         fstsww  %ax
  36.         sahf
  37.         jb      1f
  38.         fsubl   LC1
  39.         fistpq  tmp_lo
  40.         addl    $0x80000000, tmp_hi
  41.         jmp     2f
  42.  
  43.         .align  2, 0x90
  44. 1:      fistpq  tmp_lo
  45. 2:      movl    tmp_lo, %eax
  46.         movl    tmp_hi, %edx
  47.         fldcw   cw1
  48.         leave
  49.         ret
  50.