1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
7
This software is distributed under license and may not be copied, modified
8
or distributed except as expressly authorized under the terms of that
9
license. Refer to licensing information at http://www.artifex.com/
10
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
13
/* $Id: gdevevga.c 8022 2007-06-05 22:23:38Z giles $ */
14
/* IBM PC EGA and VGA display drivers */
15
/* All of the real code is in gdevpcfb.c. */
22
/* ------ Internal routines ------ */
24
/* We can't catch signals.... */
26
pcfb_set_signals(gx_device * dev)
30
/* Read the device state */
32
pcfb_get_state(pcfb_bios_state * pbs)
37
int86(0x10, ®s, ®s);
38
pbs->display_mode = regs.h.al;
39
pbs->text_page = regs.h.bh;
41
int86(0x10, ®s, ®s);
42
pbs->text_cursor_mode = regs.rshort.cx;
43
regs.rshort.ax = 0x1130;
45
int86(0x10, ®s, ®s);
46
switch (regs.rshort.cx) {
48
pbs->text_font = 0x1112;
51
pbs->text_font = 0x1114;
54
pbs->text_font = 0x1111; /* 8 x 14 */
57
regs.h.bh = pbs->text_page;
58
int86(0x10, ®s, ®s);
59
pbs->text_attribute = regs.h.ah;
60
pbs->border_color = (regs.h.ah >> 4);
61
regs.rshort.ax = 0x1a00;
62
int86(0x10, ®s, ®s);
63
if (regs.h.al == 0x1a && regs.h.bl == 0x8) {
64
regs.rshort.ax = 0x1008;
65
int86(0x10, ®s, ®s);
66
pbs->border_color = regs.h.bh;
68
if (pbs->display_mode != 3) {
69
pbs->display_mode = 3;
70
pbs->text_font = 0x1112;
71
pbs->text_cursor_mode = 0x0607;
72
pbs->text_attribute = 7;
77
/* Set the device mode */
79
pcfb_set_mode(int mode)
85
int86(0x10, ®s, ®s);
88
/* Restore the device state */
90
pcfb_set_state(const pcfb_bios_state * pbs)
94
pcfb_set_mode(pbs->display_mode);
95
regs.rshort.ax = 0x500; /* force display of page 0 */
96
int86(0x10, ®s, ®s);
97
regs.rshort.ax = pbs->text_font;
99
int86(0x10, ®s, ®s);
102
int86(0x10, ®s, ®s); /* Get cursor to reset MCGA */
103
regs.h.al = pbs->text_page;
105
int86(0x10, ®s, ®s);
106
regs.rshort.cx = pbs->text_cursor_mode;
108
int86(0x10, ®s, ®s);
109
regs.rshort.ax = 0x1001;
110
regs.h.bh = pbs->border_color;
111
int86(0x10, ®s, ®s);