_WCRTLINK void _WCI86FAR _CGRAPH _clearscreen( short area ) /*========================================== This routine clears either the entire screen, the current viewport, or the text window depending on the parameter. */ { _InitState(); _CursorOff(); #if defined( _DEFAULT_WINDOWS ) _L2clearscreen( area ); #else if( _GrMode ) { _L2clearscreen( area ); } else { switch( area ) { case _GVIEWPORT: /* do nothing */ _ErrorStatus = _GRNOTINPROPERMODE; break; case _GWINDOW: /* clear current text window */ _TxtClear( _Tx_Row_Min, _Tx_Col_Min, _Tx_Row_Max, _Tx_Col_Max ); _settextposition( 1, 1 ); break; case _GCLEARSCREEN: /* clear entire screen */ default: /* in all other cases */ _TxtClear( 0, 0, _CurrState->vc.numtextrows - 1, _CurrState->vc.numtextcols - 1 ); _settextposition( 1, 1 ); } } #endif _GrEpilog(); }
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 ); } }
_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 ); }
short _SetRows( short rows ) /*========================== This function has no effect on Windows. It only re-initializes the variable states. */ { _ErrorStatus = _GROK; _InitState(); // read the current machine state rows = rows; _clearscreen( _GCLEARSCREEN ); _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 return( 0 ); }