Beispiel #1
0
void __chk8087( void )
/********************/
{
    if( _RWD_8087 != 0 )             /* if we already know we have an 80x87 */
        return;                      /* this prevents real87 from being set */
                                     /* when we have an emulator */
    if( GetWinFlags() & WF_80x87 ) { /* if a coprocessor is present then we */
  #if defined( __386__ )
        _FloatingPoint();
  #endif
        _RWD_real87 = __x87id();     /* initialize even when NO87 is defined */
        _RWD_8087 = _RWD_real87;     /* this handles the fpi87 and NO87 case */
        __init_8087();
    } else {
  #if defined( __386__ )
        // check to see if emulator is loaded
        union REGS regs;
        regs.w.ax = 0xfa00;
        int86( 0x2f, &regs, &regs );
        if( regs.w.ax == 0x0666 ) {  /* check for emulator present */
            _RWD_real87 = __x87id(); /* initialize even when NO87 is defined */
            _RWD_8087 = _RWD_real87; /* this handles the fpi87 and NO87 case */
            __init_8087();
        }
  #endif
    }
    if( _RWD_no87 != 0 ) {           /* if NO87 environment var is defined */
        _RWD_8087 = 0;               /* then we want to pretend that the */
        _RWD_real87 = 0;             /* coprocessor doesn't exist */
    }
}
Beispiel #2
0
void __chk8087()
{
    unsigned char rc;
    unsigned char real87_rc;

    if( _RWD_8087 != 0 )return;     /* if we already know we have an 80x87 */
                                    /* this prevents real87 from being set */
                                    /* when we have an emulator */
    rc = 0;
    real87_rc = 0;
    _RWD_real87 = real87_rc;
#if defined(__WINDOWS_386__) || defined(__WINDOWS__)
    if( GetWinFlags() & WF_80x87 ) {/* if a coprocessor is present then we */
        #if defined( __WINDOWS_386__ )
            extern void pascal _FloatingPoint( void );
            _FloatingPoint();
        #endif
        rc = __init_8087();         /* initialize even when NO87 is defined */
                                    /* this handles the fpi87 and NO87 case */
        real87_rc = rc;
    } else {
        #if defined( __WINDOWS_386__ )
            // check to see if emulator is loaded
            union REGS regs;
            regs.w.ax = 0xfa00;
            int86( 0x2f, &regs, &regs );
            if( regs.w.ax==1638 ) { /* check for emulator present */
                rc = __init_8087(); /* initialize even when NO87 is defined */
                                    /* this handles the fpi87 and NO87 case */
            }
        #endif
    }
#else
    if( __test8087() == 3 ) {       /* if a coprocessor is present then we */
        rc = __init_8087();         /* initialize even when NO87 is defined */
                                    /* this handles the fpi87 and NO87 case */
        real87_rc = rc;
    }
#endif
    if( _RWD_no87 != 0 )return;     /* if NO87 environment var is defined */
                                    /* then we want to pretend that the */
    _RWD_8087 = rc;                 /* coprocessor doesn't exist */
    _RWD_real87 = real87_rc;
}