home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
C-ASM_VI.ARJ
/
PROGC.ZIP
/
PROGC002.C
< prev
next >
Wrap
Text File
|
1988-05-25
|
4KB
|
80 lines
/************************************************************************/
/* Load all control registers using a table */
/* First we determine type of display attached and then load register */
/* with values for mode 3 (if Color display) or mode 7 (if Mono display)*/
/************************************************************************/
select_mode_x()
{
#define MONO 5
#define VMONO 7
#define VCOLOR 8
static char mode_0[] = {
0xD4, /* CRTC Address */
0x23, /* Miscellaneous Regs */
0x0B,0x03,0x00,0x03, /* Sequencer */
/* CRT Controller */
0x37,0x27,0x2D,0x37, 0x31,0x15,0x04,0x11,
0x00,0x07,0x06,0x07, 0x00,0x00,0x00,0x00,
0xE1,0x24,0xC7,0x14, 0x08,0xE0,0xF0,0xA3, 0xFF,
/* Graphics Controller */
0x00,0x00,0x00,0x00, 0x00,0x10,0x0E,0x00, 0xFF,
/* Attribute Controller */
0x00,0x01,0x02,0x03, 0x04,0x05,0x14,0x07,
0x38,0x39,0x3A,0x3B, 0x3C,0x3D,0x3E,0x3F,
0x08,0x00,0x0F,0x00};
static char mode_3[] = {
0xD4, /* CRTC Address */
0xA7, /* Miscellaneous Regs */
0x01,0x03,0x00,0x03, /* Sequencer */
/* CRT Controller */
0x5B,0x4F,0x53,0x37, 0x51,0x5B,0x6C,0x1F,
0x00,0x0D,0x0B,0x0C, 0x00,0x00,0x00,0x00,
0x5E,0x2B,0x5D,0x28, 0x0F,0x5E,0x0A,0xA3, 0xFF,
/* Graphics Controller */
0x00,0x00,0x00,0x00, 0x00,0x10,0x0E,0x00, 0xFF,
/* Attribute Controller */
0x00,0x01,0x02,0x03, 0x04,0x05,0x14,0x07,
0x38,0x39,0x3A,0x3B, 0x3C,0x3D,0x3E,0x3F,
0x08,0x00,0x0F,0x00};
static char mode_7[] = {
0xB4, /* CRTC Address */
0xA6, /* Miscellaneous Regs */
0x00,0x03,0x00,0x03, /* Sequencer */
/* CRT Controller */
0x60,0x4F,0x56,0x3A, 0x51,0x60,0x70,0x1F,
0x00,0x0D,0x0B,0x0C, 0x00,0x00,0x00,0x00,
0x5E,0x2E,0x5D,0x28, 0x0D,0x5E,0x6E,0xA3, 0xFF,
/* Graphics Controller */
0x00,0x00,0x00,0x00, 0x00,0x10,0x0A,0x00, 0xFF,
/* Attribute Controller */
0x00,0x08,0x08,0x08, 0x08,0x08,0x08,0x08,
0x10,0x18,0x18,0x18, 0x18,0x18,0x18,0x18,
0x0E,0x00,0x0F,0x08};
if (get_display_type() == VCOLOR)
{
write_register_set(mode_3); /* Set VGA into mode 3 */
getchar();
set_mode(3);
}
else if (get_display_type() == MONO || get_display_type() == VMONO)
{
write_register_set(mode_7); /* Set EGA into mode 7 */
getchar();
set_mode(7);
}
else
{
write_register_set(mode_0); /* Set EGA into mode 0 */
getchar();
set_mode(3);
}
}