Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.3 KiB

  1. page ,132
  2. title 87ftol - truncate TOS to 32-bit integer
  3. ;***
  4. ;87ftol.asm - truncate TOS to 32-bit integer
  5. ;
  6. ; Copyright (c) 1985-88, Microsoft Corporation
  7. ;
  8. ;Purpose:
  9. ;
  10. ;Revision History:
  11. ;
  12. ; 07/16/85 Greg Whitten
  13. ; save BX and CX for sloppy code generator
  14. ; 10/15/86 Greg Whitten
  15. ; in-line instructions rather than call _fpmath
  16. ; 08/24/87 Barry McCord
  17. ; expand the functionality of _ftol to handle
  18. ; unsigned long by using "fistp qword ptr"
  19. ; 11/24/87 Barry McCord
  20. ; added _loadds under ifdef DLL
  21. ;
  22. ; 08/26/88 Bill Johnston
  23. ; 386 version
  24. ;
  25. ;*******************************************************************************
  26. .xlist
  27. ; include cruntime.inc
  28. ; include mrt386.inc
  29. ; include os2supp.inc
  30. .list
  31. ; CODESEG
  32. .386
  33. .387
  34. .model small,C
  35. .code
  36. public _fltused
  37. _fltused equ 9876h
  38. _ftol proc
  39. local oldcw:word
  40. local newcw:word
  41. local intval:qword
  42. fstcw [oldcw] ; get control word
  43. fwait ; synchronize
  44. mov ax, [oldcw] ; round mode saved
  45. or ah, 0ch ; set chop rounding mode
  46. mov [newcw], ax ; back to memory
  47. fldcw [newcw] ; reset rounding
  48. fistp qword ptr [intval] ; store chopped integer
  49. fldcw [oldcw] ; restore rounding
  50. ; mov rax, IWORD ptr [intval]
  51. ; mov rdx, IWORD ptr [intval+ISIZE]
  52. mov eax, dword ptr [intval]
  53. mov edx, dword ptr [intval+4]
  54. ret
  55. _ftol endp
  56. sqrt proc x:qword
  57. fld [x]
  58. fsqrt
  59. ret
  60. sqrt endp
  61. end