Ejemplo n.º 1
0
/*
 * SetInterrupts - set all interrupt handlers
 */
void SetInterrupts( void )
{
#if defined( _M_I86 ) || defined( __4G__ )
    oldInt1c = DosGetVect( 0x1c );
    oldInt1b = DosGetVect( 0x1b );
    oldInt23 = DosGetVect( 0x23 );
    oldInt24 = DosGetVect( 0x24 );
#else
    getIntVect( 0x1b, &old1b );
    getIntVect( 0x1c, &old1c );
    getIntVect( 0x23, &old23 );
    getIntVect( 0x24, &old24 );
#endif

    setClockTime();
#if defined( _M_I86 ) || defined( __4G__ )
    DosSetVect( 0x1b, handleInt1b_23 );
    DosSetVect( 0x1c, handleInt1c );
    DosSetVect( 0x23, handleInt1b_23 );
    DosSetVect( 0x24, HandleInt24 );
#else
    newIntVect( 0x1b, handleInt1b_23 );
    setStupid1c();
    newIntVect( 0x23, handleInt1b_23 );
    newIntVect( 0x24, HandleInt24 );
#endif

} /* SetInterrupts */
Ejemplo n.º 2
0
/*
 * EMSInit - init for EMS memory usage
 */
void EMSInit( void )
{
    void                *vect;
    char                *check;
    unsigned            i;
    unsigned short      seg;
    unsigned char       handle;
    ems_addr            h;

    EMSCtrl.inuse = FALSE;
    if( !EditFlags.ExtendedMemory ) {
        return;
    }

    EMSCtrl.exhausted = FALSE;
    vect = DosGetVect( EMS_INTERRUPT );
    check = MK_FP( FP_SEG( vect ), EMS_INTERRUPT_OFFSET );
    for( i = 0; i <= 7; i++ ) {
        if( check[i] != emsStr[i] ) {
            return;
        }
    }
    if( _EMSStatus() != 0 ) {
        return;
    }
    if( _EMSGetPageFrame( &seg ) != 0 ) {
        return;
    }
    EMSCtrl.seg = seg;

    if( _EMSAllocateMemory( EMS_MAX_LOGICAL_PAGES, &handle ) != 0 ) {
        return;
    }
    EMSCtrl.handles[EMSCtrl.allocated] = handle;
    EMSCtrl.logical = 0;
    EMSCtrl.max_logical = EMS_MAX_LOGICAL_PAGES;
    EMSCtrl.offset = 0;
    EMSCtrl.allocated = 1;
    for( i = 0; i < EMS_MAX_PHYSICAL_PAGES; i++ ) {
        EMSCtrl.physical[i].used = FALSE;
    }

    emsPtrs = MemAlloc( sizeof( long ) * MaxEMSBlocks );

    for( i = 0; i < MaxEMSBlocks; i++ ) {
        emsPtrs[i] = eMSAlloc( MAX_IO_BUFFER );
        if( emsPtrs[i] == NULL ) {
            break;
        }
        h.external = emsPtrs[i];
        TotalEMSBlocks++;
    }
    emsPtrs = MemReAlloc( emsPtrs, TotalEMSBlocks * sizeof( long ) );

    EMSCtrl.inuse = TRUE;


} /* EMSInit */