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 }
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 }
static void PutPalette( short pixval, long colour ) //================================================= { unsigned short blue; unsigned short green; unsigned short red; short cnvcol; short mode; blue = ( (unsigned long)colour & 0x00ff0000 ) >> 16; green = (unsigned short)( colour & 0x0000ff00 ) >> 8; red = colour & 0x000000ff; switch( _CurrState->vc.adapter ) { case _MCGA : case _VGA : case _SVGA : VideoInt( _BIOS_SET_PALETTE + 0x10, pixval, ( green << 8 ) + blue, red << 8 ); break; case _EGA : mode = _CurrState->vc.mode; if( mode == 13 || mode == 14 ) { cnvcol = _CnvColour( colour ); if( cnvcol > 7 ) { cnvcol |= 0x10; /* set intensity bit */ } } else { red >>= 4; /* map from range 0..63 to range 0..3 */ green >>= 4; blue >>= 4; cnvcol = EGA_Intensity[ blue ] + ( EGA_Intensity[ green ] << 1 ) + ( EGA_Intensity[ red ] << 2 ); } VideoInt( _BIOS_SET_PALETTE, ( cnvcol << 8 ) + pixval, 0, 0 ); } }
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() ); }