home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------
- * filename - stat87.cas
- *
- * function(s)
- * _status87 - gets floating-point status
- *-----------------------------------------------------------------------*/
-
- /*[]------------------------------------------------------------[]*/
- /*| |*/
- /*| Turbo C Run Time Library - Version 3.0 |*/
- /*| |*/
- /*| |*/
- /*| Copyright (c) 1987, 1990 by Borland International |*/
- /*| All Rights Reserved. |*/
- /*| |*/
- /*[]------------------------------------------------------------[]*/
-
- #pragma inline
-
- #include <float.h>
- #include "emuvars.h"
-
- /*--------------------------------------------------------------------------*
-
- Name _status87 - gets floating-point status
-
- Usage unsigned int _status87(void);
-
- Prototype in float.h
-
- Description _status87 gets the floating-point status word, which is a
- combination of the 80x87 status word and other
- conditions detected by the 80x87 exception handler.
-
- Return value The bits in the return value give the floating-point
- status. See <float.h> for a complete definition of the bits
- returned by _status87.
-
- Note:
- The TC RTL controls the Denormal and Invalid exceptions, because certain
- of these errors can be repaired without damage. If a call to _control87()
- attempted to mask these, then the bits are kept in memory instead of on
- the coprocessor.
-
- Denormal exceptions are never reported, as they can always be repaired.
-
- *---------------------------------------------------------------------------*/
-
- unsigned int _status87(void)
- {
- volatile unsigned int Status;
-
- #pragma warn -asm
- asm emul
- #pragma warn .asm
-
- asm fstsw Status
- asm fwait
- asm mov ax, Status
- /*
- asm or al, byte ptr SS: _emu.control [1]
- */
- asm or al, byte ptr SS: _emu.status2 [0]
-
- return _AX &
- SW_INVALID+SW_ZERODIVIDE+SW_OVERFLOW+SW_UNDERFLOW+SW_INEXACT;
- }
-