Leaked source code of windows server 2003
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.

43 lines
805 B

  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. ;*******************************************************************************
  11. .xlist
  12. include cruntime.inc
  13. .list
  14. CODESEG
  15. public _ftol
  16. _ftol proc
  17. local oldcw:word
  18. local newcw:word
  19. local intval:qword
  20. fstcw [oldcw] ; get control word
  21. fwait ; synchronize
  22. mov ax, [oldcw] ; round mode saved
  23. or ah, 0ch ; set chop rounding mode
  24. mov [newcw], ax ; back to memory
  25. fldcw [newcw] ; reset rounding
  26. fistp qword ptr [intval] ; store chopped integer
  27. fldcw [oldcw] ; restore rounding
  28. mov eax, dword ptr [intval]
  29. mov edx, dword ptr [intval+4]
  30. ret
  31. _ftol endp
  32. end