コード例 #1
0
ファイル: clearscr.c プロジェクト: ABratovic/open-watcom-v2
void _TxtClear( short r1, short c1, short r2, short c2 )
/*======================================================

    Clear an area of the screen in text mode. Can't use BIOS scroll
    function when the active page is not equal to the visual page. */

{
    short               len;
    short               i;
    unsigned short      seg;
    unsigned int        offset;
    short __far         *p;
    short               blank;

    if( _CurrState->vc.mode == _TEXTMONO ) {
        seg = _MonoSeg;
        offset = _MonoOff;
    } else {
        seg = _CgaSeg;
        offset = _CgaOff;
    }
    offset += 2 * ( r1 * _CurrState->vc.numtextcols + c1 ) +
                    _CurrActivePage * *(short __far *)_BIOS_data( CRT_LEN );
    len = c2 - c1 + 1;
    blank = ( _CharAttr << 8 ) + ' ';
    for( ; r1 <= r2; ++r1 ) {
        p = MK_FP( seg, offset );
        for( i = 0; i < len; ++i ) {
            *p = blank;
            ++p;
        }
        offset += 2 * _CurrState->vc.numtextcols;
    }
}
コード例 #2
0
ファイル: setrows.c プロジェクト: Ukusbobra/open-watcom-v2
short _SetRows( short rows )
/*==========================

   This function sets the number of text rows in the current mode. It only
   affects the _VGA, _EGA, and _MCGA adapters.  */

{
    _ErrorStatus = _GROK;
    _InitState();           // read the current machine state
    if( _GrMode ) {
        GrModeRows( rows );
    } else {
        TextModeRows( rows );
    }
    if( _ErrorStatus != _GROK ) {
        return( 0 );
    } else {
        rows = *(char far *)_BIOS_data( ROWS ) + 1;     // 0 for Hercules
        if( rows == 1 ) rows = 25;
        _CurrState->vc.numtextrows = rows;
        if( !_GrMode ) {
            _CalcNumPages();              // update the video configuration
        }
        _Tx_Row_Min = 0;                            // text window is now
        _Tx_Col_Min = 0;                            // the full screen
        _Tx_Row_Max = _CurrState->vc.numtextrows - 1;
        _Tx_Col_Max = _CurrState->vc.numtextcols - 1;
        _TextPos.row = 0;                           // set mode function
        _TextPos.col = 0;                           // sets position to 0,0
        _CurrVisualPage = 0;
        _CurrActivePage = 0;
        VideoInt( _BIOS_VIDEO_PAGE, 0, 0, 0 );      // set to page 0
        return( _CurrState->vc.numtextrows );
    }
}
コード例 #3
0
ファイル: activepg.c プロジェクト: ABratovic/open-watcom-v2
_WCRTLINK short _WCI86FAR _CGRAPH _setactivepage( short pagenum )
/*================================================

   This routine sets the active page for graphics output. */

{
    short               pos;
    short               prev;

    _InitState();
    if( _CurrState->vc.numvideopages == 1 ) {
        if( pagenum != 0 ) {
            _ErrorStatus = _GRINVALIDPARAMETER;
            return( -1 );
        } else {
            return( 0 );
        }
    }
    pagenum %= _CurrState->vc.numvideopages;
//    #if defined( __386__ )
        _CurrState->screen_seg = _CurrState->screen_seg_base;
        _CurrState->screen_off = _CurrState->screen_off_base +
                                 ( ( _CurrState->page_size * pagenum ) << 4 );
//    #else
//      _CurrState->screen_seg = _CurrState->screen_seg_base +
//                                  _CurrState->page_size * pagenum;
//      _CurrState->screen_off = _CurrState->screen_off_base;
//    #endif
    pos = *(short __far *)_BIOS_data( CURSOR_POSN + 2 * pagenum );
    _TextPos.row = pos >> 8;                        /* cursor position  */
    _TextPos.col = pos & 0xFF;                      /* on new page      */
    prev = _CurrActivePage;
    _CurrActivePage = pagenum;
    return( prev );
}
コード例 #4
0
ファイル: setrows.c プロジェクト: Ukusbobra/open-watcom-v2
static void Load_MCGA( short rows, short font, short cursor )
/*===========================================================

   This routines loads an alphanumeric font for the MCGA.   */

{
    VideoInt( _BIOS_VIDEO_PAGE, 0, 0, 0 );         // set active page to 0
    VideoInt( _BIOS_SET_MODE + GetVideoMode(), 0, 0, 0 );
    _fmemset( MK_FP( _EgaSeg, _EgaOff ), 0, 0x2000 );  // must do for MCGA 40 rows
    VideoInt( font & 0xFF0F, 0, 0, 0 );             // load character set
    VideoInt( 0x1103, 0, 0, 0 );
    VideoInt( _BIOS_CURSOR_SIZE, 0, cursor, 0 );    // reset the cursor
    outpw( 0x03D4, ( cursor & 0xFF00 ) + 0x09 );    // # double scan lines
    *(char far *)_BIOS_data( ROWS ) = rows - 1;       // # of rows
    // # of vertical points per character
    *(short far *)_BIOS_data( POINTS ) = 2 * ( cursor & 0xFF + 1 );
    _GrCursor = 1;                                          // cursor is on
}
コード例 #5
0
ファイル: setrows.c プロジェクト: Ukusbobra/open-watcom-v2
static void Load_25( void )
/*===================

   When we want to go back to a 25-row display, just do a set mode
   and update a few variables. */

{
    VideoInt( _BIOS_SET_MODE + GetVideoMode(), 0, 0, 0 );
    *(char far *)_BIOS_data( INFO ) &= 0xFE;  // cursor emulation off
    VideoInt( _BIOS_CURSOR_SIZE, 0, 0x0607, 0 );    // reset the cursor
    _GrCursor = 1;                                  // cursor is on
}
コード例 #6
0
ファイル: setrows.c プロジェクト: Ukusbobra/open-watcom-v2
static void Load_EGA( short rows, short font, short cursor )
/*==========================================================

   This routines loads an alphanumeric font for the EGA.    */

{
    VideoInt( _BIOS_VIDEO_PAGE, 0, 0, 0 );          // set active page to 0
    VideoInt( _BIOS_SET_MODE + GetVideoMode(), 0, 0, 0 );
    VideoInt( font, 0, 0, 0 );                      // load pointer to character set in block 0
    if( rows == 43 ) {                              // cursor emulation
        *(char far *)_BIOS_data( INFO ) |= 1;     // 43 rows only
    } else {
        outpw( 0x03D4, 0x1414 );        // reset underline location to none
    }
    VideoInt( _BIOS_CURSOR_SIZE, 0, cursor, 0 );    // reset the cursor
    _GrCursor = 1;                                  // cursor is on
}
コード例 #7
0
ファイル: setmode.c プロジェクト: Azarien/open-watcom-v2
short _SetMode( short mode )
/*==========================

    This function sets the video mode on IBM PC family. */

{
    char __far          *p;

    if( _ValidMode( mode ) ) {
        p = _BIOS_data( EQUIP_FLAGS );        // equipment flags
        *p &= 0xCF;                                 // remove previous settings
        if( mode == 7 || mode == 15 ) {
            *p |= 0x30;                                 // monochrome
        } else {
            *p |= 0x20;                                 // colour
        }
        if( _NoClear ) {
            mode |= 0x80;           // set high bit, screen won't be cleared
        }
        VideoInt( _BIOS_SET_MODE + mode, 0, 0, 0 );
    }
    return( GetVideoMode() );
}