1 |
– |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* vga.c - driver for VGA graphics adaptor under MS-DOS |
6 |
|
*/ |
7 |
|
|
8 |
< |
#include <stdio.h> |
8 |
> |
#include "copyright.h" |
9 |
|
|
10 |
+ |
#include "standard.h" |
11 |
+ |
|
12 |
|
#include <graph.h> |
13 |
|
|
14 |
|
#include "driver.h" |
37 |
|
vga_init(name, id) /* open VGA */ |
38 |
|
char *name, *id; |
39 |
|
{ |
40 |
< |
static short mode_pref[] = {_XRES256COLOR, _SVRES256COLOR, |
40 |
> |
static short mode_pref[] = {_MRES256COLOR, -1}; |
41 |
> |
static short smode_pref[] = {_XRES256COLOR, _SVRES256COLOR, |
42 |
|
_VRES256COLOR, _MRES256COLOR, -1}; |
43 |
|
char *ep; |
44 |
< |
register int i; |
44 |
> |
register short *mp; |
45 |
|
|
46 |
< |
for (i = 0; mode_pref[i] != -1; i++) |
47 |
< |
if (_setvideomode(mode_pref[i])) |
46 |
> |
mp = !strcmp(name, "vga") ? mode_pref : smode_pref; |
47 |
> |
for ( ; *mp != -1; mp++) |
48 |
> |
if (_setvideomode(*mp)) |
49 |
|
break; |
50 |
< |
if (mode_pref[i] == -1) { |
50 |
> |
if (*mp == -1) { |
51 |
|
_setvideomode(_DEFAULTMODE); |
52 |
< |
stderr_v(name); |
53 |
< |
stderr_v(": card not present or insufficient VGA memory\n"); |
52 |
> |
eputs(name); |
53 |
> |
eputs(": card not present or insufficient VGA memory\n"); |
54 |
|
return(NULL); |
55 |
|
} |
56 |
|
_getvideoconfig(&config); |
75 |
|
_remappalette(1, _BRIGHTWHITE); |
76 |
|
_settextcolor(1); |
77 |
|
ms_gcinit(&vga_driver); |
78 |
< |
errvec = vga_errout; |
79 |
< |
cmdvec = vga_comout; |
80 |
< |
if (wrnvec != NULL) |
81 |
< |
wrnvec = vga_comout; |
78 |
> |
erract[USER].pf = |
79 |
> |
erract[SYSTEM].pf = |
80 |
> |
erract[INTERNAL].pf = |
81 |
> |
erract[CONSISTENCY].pf = vga_errout; |
82 |
> |
erract[COMMAND].pf = vga_comout; |
83 |
> |
if (erract[WARNING].pf != NULL) |
84 |
> |
erract[WARNING].pf = vga_comout; |
85 |
|
return(&vga_driver); |
86 |
|
} |
87 |
|
|
89 |
|
static |
90 |
|
vga_close() /* close VGA */ |
91 |
|
{ |
92 |
+ |
ms_gcdone(&vga_driver); |
93 |
|
_setvideomode(_DEFAULTMODE); |
94 |
< |
errvec = stderr_v; /* reset error vectors */ |
95 |
< |
cmdvec = NULL; |
96 |
< |
if (wrnvec != NULL) |
97 |
< |
wrnvec = stderr_v; |
94 |
> |
erract[USER].pf = /* reset error vector */ |
95 |
> |
erract[SYSTEM].pf = |
96 |
> |
erract[INTERNAL].pf = |
97 |
> |
erract[CONSISTENCY].pf = eputs; |
98 |
> |
erract[COMMAND].pf = NULL; |
99 |
> |
if (erract[WARNING].pf != NULL) |
100 |
> |
erract[WARNING].pf = wputs; |
101 |
|
if (fatalerr[0]) |
102 |
< |
stderr_v(fatalerr); /* repeat error message */ |
102 |
> |
eputs(fatalerr); /* repeat error message */ |
103 |
|
} |
104 |
|
|
105 |
|
|