Browse Source

* i8086 implementation of fpc_int_real

git-svn-id: branches/i8086@23832 -
nickysn 12 years ago
parent
commit
6757fe5752
1 changed files with 21 additions and 1 deletions
  1. 21 1
      rtl/i8086/math.inc

+ 21 - 1
rtl/i8086/math.inc

@@ -3,7 +3,7 @@
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
     Copyright (c) 2003 by the Free Pascal development team.
     Copyright (c) 2003 by the Free Pascal development team.
 
 
-    Implementation of mathematical Routines (only for real)
+    Implementation of mathematical Routines (for extended type)
 
 
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.
@@ -13,3 +13,23 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+
+{$asmmode intel}
+
+{$define FPC_SYSTEM_HAS_INT}
+function fpc_int_real(d : ValReal) : ValReal;assembler;compilerproc;
+  asm
+    sub sp, 2
+    fnstcw [bp-2]
+    fwait
+    mov cx, word [bp-2]
+    or word [bp-2], $0f00
+    fldcw [bp-2]
+    fwait
+    fld tbyte [d]
+    frndint
+    fwait
+    mov word [bp-2], cx
+    fldcw [bp-2]
+  end;
+