1 // Tables used by VGA bios
3 // Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net>
4 // Copyright (C) 2001-2008 the LGPL VGABios developers Team
6 // This file may be distributed under the terms of the GNU LGPLv3 license.
8 #include "vgabios.h" // struct VideoParamTableEntry_s
9 #include "biosvar.h" // GET_GLOBAL
10 #include "util.h" // memcpy_far
11 #include "stdvga.h" // struct vgamode_s
14 /****************************************************************
15 * Video parameter table
16 ****************************************************************/
18 // Standard Video Save Pointer Table
19 struct VideoSavePointer_s {
20 struct segoff_s videoparam;
21 struct segoff_s paramdynamicsave;
22 struct segoff_s textcharset;
23 struct segoff_s graphcharset;
24 struct segoff_s secsavepointer;
28 struct VideoSavePointer_s video_save_pointer_table VAR16;
30 // standard BIOS Video Parameter Table
43 struct VideoParam_s video_param_table[29] VAR16;
46 build_video_param(void)
48 static u8 parammodes[ARRAY_SIZE(video_param_table)] VAR16 = {
49 0, 0, 0, 0, 0x04, 0x05, 0x06, 0x07,
50 0, 0, 0, 0, 0, 0x0d, 0x0e, 0,
51 0, 0x0f, 0x10, 0, 0, 0, 0, 0x01,
52 0x03, 0x07, 0x11, 0x12, 0x13
56 for (i=0; i<ARRAY_SIZE(parammodes); i++) {
57 int mode = GET_GLOBAL(parammodes[i]);
60 struct VideoParam_s *vparam_g = &video_param_table[i];
61 struct vgamode_s *vmode_g = find_vga_entry(mode);
64 int width = GET_GLOBAL(vmode_g->width);
65 int height = GET_GLOBAL(vmode_g->height);
66 int cheight = GET_GLOBAL(vmode_g->cheight);
67 if (GET_GLOBAL(vmode_g->memmodel) == MM_TEXT) {
68 SET_VGA(vparam_g->twidth, width);
69 SET_VGA(vparam_g->theightm1, height-1);
71 int cwidth = GET_GLOBAL(vmode_g->cwidth);
72 SET_VGA(vparam_g->twidth, width / cwidth);
73 SET_VGA(vparam_g->theightm1, (height / cheight) - 1);
75 SET_VGA(vparam_g->cheight, cheight);
76 SET_VGA(vparam_g->slength, GET_GLOBAL(vmode_g->slength));
77 memcpy_far(get_global_seg(), vparam_g->sequ_regs
78 , get_global_seg(), GET_GLOBAL(vmode_g->sequ_regs)
79 , ARRAY_SIZE(vparam_g->sequ_regs));
80 SET_VGA(vparam_g->miscreg, GET_GLOBAL(vmode_g->miscreg));
81 memcpy_far(get_global_seg(), vparam_g->crtc_regs
82 , get_global_seg(), GET_GLOBAL(vmode_g->crtc_regs)
83 , ARRAY_SIZE(vparam_g->crtc_regs));
84 memcpy_far(get_global_seg(), vparam_g->actl_regs
85 , get_global_seg(), GET_GLOBAL(vmode_g->actl_regs)
86 , ARRAY_SIZE(vparam_g->actl_regs));
87 memcpy_far(get_global_seg(), vparam_g->grdc_regs
88 , get_global_seg(), GET_GLOBAL(vmode_g->grdc_regs)
89 , ARRAY_SIZE(vparam_g->grdc_regs));
92 SET_VGA(video_save_pointer_table.videoparam
93 , SEGOFF(get_global_seg(), (u32)video_param_table));
97 /****************************************************************
98 * Register definitions
99 ****************************************************************/
102 static u8 palette0[] VAR16 = {
103 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
104 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
105 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
106 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
107 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
108 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
109 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f,
110 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f,
111 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
112 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
113 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
114 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
115 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
116 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
117 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f,
118 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f
121 static u8 palette1[] VAR16 = {
122 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
123 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
124 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
125 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
126 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
127 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
128 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
129 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
130 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
131 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
132 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
133 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
134 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
135 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
136 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
137 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f
140 static u8 palette2[] VAR16 = {
141 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
142 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x2a,0x00, 0x2a,0x2a,0x2a,
143 0x00,0x00,0x15, 0x00,0x00,0x3f, 0x00,0x2a,0x15, 0x00,0x2a,0x3f,
144 0x2a,0x00,0x15, 0x2a,0x00,0x3f, 0x2a,0x2a,0x15, 0x2a,0x2a,0x3f,
145 0x00,0x15,0x00, 0x00,0x15,0x2a, 0x00,0x3f,0x00, 0x00,0x3f,0x2a,
146 0x2a,0x15,0x00, 0x2a,0x15,0x2a, 0x2a,0x3f,0x00, 0x2a,0x3f,0x2a,
147 0x00,0x15,0x15, 0x00,0x15,0x3f, 0x00,0x3f,0x15, 0x00,0x3f,0x3f,
148 0x2a,0x15,0x15, 0x2a,0x15,0x3f, 0x2a,0x3f,0x15, 0x2a,0x3f,0x3f,
149 0x15,0x00,0x00, 0x15,0x00,0x2a, 0x15,0x2a,0x00, 0x15,0x2a,0x2a,
150 0x3f,0x00,0x00, 0x3f,0x00,0x2a, 0x3f,0x2a,0x00, 0x3f,0x2a,0x2a,
151 0x15,0x00,0x15, 0x15,0x00,0x3f, 0x15,0x2a,0x15, 0x15,0x2a,0x3f,
152 0x3f,0x00,0x15, 0x3f,0x00,0x3f, 0x3f,0x2a,0x15, 0x3f,0x2a,0x3f,
153 0x15,0x15,0x00, 0x15,0x15,0x2a, 0x15,0x3f,0x00, 0x15,0x3f,0x2a,
154 0x3f,0x15,0x00, 0x3f,0x15,0x2a, 0x3f,0x3f,0x00, 0x3f,0x3f,0x2a,
155 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
156 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f
159 static u8 palette3[] VAR16 = {
160 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
161 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
162 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
163 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
164 0x00,0x00,0x00, 0x05,0x05,0x05, 0x08,0x08,0x08, 0x0b,0x0b,0x0b,
165 0x0e,0x0e,0x0e, 0x11,0x11,0x11, 0x14,0x14,0x14, 0x18,0x18,0x18,
166 0x1c,0x1c,0x1c, 0x20,0x20,0x20, 0x24,0x24,0x24, 0x28,0x28,0x28,
167 0x2d,0x2d,0x2d, 0x32,0x32,0x32, 0x38,0x38,0x38, 0x3f,0x3f,0x3f,
168 0x00,0x00,0x3f, 0x10,0x00,0x3f, 0x1f,0x00,0x3f, 0x2f,0x00,0x3f,
169 0x3f,0x00,0x3f, 0x3f,0x00,0x2f, 0x3f,0x00,0x1f, 0x3f,0x00,0x10,
170 0x3f,0x00,0x00, 0x3f,0x10,0x00, 0x3f,0x1f,0x00, 0x3f,0x2f,0x00,
171 0x3f,0x3f,0x00, 0x2f,0x3f,0x00, 0x1f,0x3f,0x00, 0x10,0x3f,0x00,
172 0x00,0x3f,0x00, 0x00,0x3f,0x10, 0x00,0x3f,0x1f, 0x00,0x3f,0x2f,
173 0x00,0x3f,0x3f, 0x00,0x2f,0x3f, 0x00,0x1f,0x3f, 0x00,0x10,0x3f,
174 0x1f,0x1f,0x3f, 0x27,0x1f,0x3f, 0x2f,0x1f,0x3f, 0x37,0x1f,0x3f,
175 0x3f,0x1f,0x3f, 0x3f,0x1f,0x37, 0x3f,0x1f,0x2f, 0x3f,0x1f,0x27,
177 0x3f,0x1f,0x1f, 0x3f,0x27,0x1f, 0x3f,0x2f,0x1f, 0x3f,0x37,0x1f,
178 0x3f,0x3f,0x1f, 0x37,0x3f,0x1f, 0x2f,0x3f,0x1f, 0x27,0x3f,0x1f,
179 0x1f,0x3f,0x1f, 0x1f,0x3f,0x27, 0x1f,0x3f,0x2f, 0x1f,0x3f,0x37,
180 0x1f,0x3f,0x3f, 0x1f,0x37,0x3f, 0x1f,0x2f,0x3f, 0x1f,0x27,0x3f,
181 0x2d,0x2d,0x3f, 0x31,0x2d,0x3f, 0x36,0x2d,0x3f, 0x3a,0x2d,0x3f,
182 0x3f,0x2d,0x3f, 0x3f,0x2d,0x3a, 0x3f,0x2d,0x36, 0x3f,0x2d,0x31,
183 0x3f,0x2d,0x2d, 0x3f,0x31,0x2d, 0x3f,0x36,0x2d, 0x3f,0x3a,0x2d,
184 0x3f,0x3f,0x2d, 0x3a,0x3f,0x2d, 0x36,0x3f,0x2d, 0x31,0x3f,0x2d,
185 0x2d,0x3f,0x2d, 0x2d,0x3f,0x31, 0x2d,0x3f,0x36, 0x2d,0x3f,0x3a,
186 0x2d,0x3f,0x3f, 0x2d,0x3a,0x3f, 0x2d,0x36,0x3f, 0x2d,0x31,0x3f,
187 0x00,0x00,0x1c, 0x07,0x00,0x1c, 0x0e,0x00,0x1c, 0x15,0x00,0x1c,
188 0x1c,0x00,0x1c, 0x1c,0x00,0x15, 0x1c,0x00,0x0e, 0x1c,0x00,0x07,
189 0x1c,0x00,0x00, 0x1c,0x07,0x00, 0x1c,0x0e,0x00, 0x1c,0x15,0x00,
190 0x1c,0x1c,0x00, 0x15,0x1c,0x00, 0x0e,0x1c,0x00, 0x07,0x1c,0x00,
191 0x00,0x1c,0x00, 0x00,0x1c,0x07, 0x00,0x1c,0x0e, 0x00,0x1c,0x15,
192 0x00,0x1c,0x1c, 0x00,0x15,0x1c, 0x00,0x0e,0x1c, 0x00,0x07,0x1c,
194 0x0e,0x0e,0x1c, 0x11,0x0e,0x1c, 0x15,0x0e,0x1c, 0x18,0x0e,0x1c,
195 0x1c,0x0e,0x1c, 0x1c,0x0e,0x18, 0x1c,0x0e,0x15, 0x1c,0x0e,0x11,
196 0x1c,0x0e,0x0e, 0x1c,0x11,0x0e, 0x1c,0x15,0x0e, 0x1c,0x18,0x0e,
197 0x1c,0x1c,0x0e, 0x18,0x1c,0x0e, 0x15,0x1c,0x0e, 0x11,0x1c,0x0e,
198 0x0e,0x1c,0x0e, 0x0e,0x1c,0x11, 0x0e,0x1c,0x15, 0x0e,0x1c,0x18,
199 0x0e,0x1c,0x1c, 0x0e,0x18,0x1c, 0x0e,0x15,0x1c, 0x0e,0x11,0x1c,
200 0x14,0x14,0x1c, 0x16,0x14,0x1c, 0x18,0x14,0x1c, 0x1a,0x14,0x1c,
201 0x1c,0x14,0x1c, 0x1c,0x14,0x1a, 0x1c,0x14,0x18, 0x1c,0x14,0x16,
202 0x1c,0x14,0x14, 0x1c,0x16,0x14, 0x1c,0x18,0x14, 0x1c,0x1a,0x14,
203 0x1c,0x1c,0x14, 0x1a,0x1c,0x14, 0x18,0x1c,0x14, 0x16,0x1c,0x14,
204 0x14,0x1c,0x14, 0x14,0x1c,0x16, 0x14,0x1c,0x18, 0x14,0x1c,0x1a,
205 0x14,0x1c,0x1c, 0x14,0x1a,0x1c, 0x14,0x18,0x1c, 0x14,0x16,0x1c,
206 0x00,0x00,0x10, 0x04,0x00,0x10, 0x08,0x00,0x10, 0x0c,0x00,0x10,
207 0x10,0x00,0x10, 0x10,0x00,0x0c, 0x10,0x00,0x08, 0x10,0x00,0x04,
208 0x10,0x00,0x00, 0x10,0x04,0x00, 0x10,0x08,0x00, 0x10,0x0c,0x00,
209 0x10,0x10,0x00, 0x0c,0x10,0x00, 0x08,0x10,0x00, 0x04,0x10,0x00,
211 0x00,0x10,0x00, 0x00,0x10,0x04, 0x00,0x10,0x08, 0x00,0x10,0x0c,
212 0x00,0x10,0x10, 0x00,0x0c,0x10, 0x00,0x08,0x10, 0x00,0x04,0x10,
213 0x08,0x08,0x10, 0x0a,0x08,0x10, 0x0c,0x08,0x10, 0x0e,0x08,0x10,
214 0x10,0x08,0x10, 0x10,0x08,0x0e, 0x10,0x08,0x0c, 0x10,0x08,0x0a,
215 0x10,0x08,0x08, 0x10,0x0a,0x08, 0x10,0x0c,0x08, 0x10,0x0e,0x08,
216 0x10,0x10,0x08, 0x0e,0x10,0x08, 0x0c,0x10,0x08, 0x0a,0x10,0x08,
217 0x08,0x10,0x08, 0x08,0x10,0x0a, 0x08,0x10,0x0c, 0x08,0x10,0x0e,
218 0x08,0x10,0x10, 0x08,0x0e,0x10, 0x08,0x0c,0x10, 0x08,0x0a,0x10,
219 0x0b,0x0b,0x10, 0x0c,0x0b,0x10, 0x0d,0x0b,0x10, 0x0f,0x0b,0x10,
220 0x10,0x0b,0x10, 0x10,0x0b,0x0f, 0x10,0x0b,0x0d, 0x10,0x0b,0x0c,
221 0x10,0x0b,0x0b, 0x10,0x0c,0x0b, 0x10,0x0d,0x0b, 0x10,0x0f,0x0b,
222 0x10,0x10,0x0b, 0x0f,0x10,0x0b, 0x0d,0x10,0x0b, 0x0c,0x10,0x0b,
223 0x0b,0x10,0x0b, 0x0b,0x10,0x0c, 0x0b,0x10,0x0d, 0x0b,0x10,0x0f,
224 0x0b,0x10,0x10, 0x0b,0x0f,0x10, 0x0b,0x0d,0x10, 0x0b,0x0c,0x10,
225 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
226 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00
229 static u8 sequ_01[] VAR16 = { 0x08, 0x03, 0x00, 0x02 };
230 static u8 crtc_01[] VAR16 = {
231 0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f,
232 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
233 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3,
235 static u8 actl_01[] VAR16 = {
236 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
237 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
238 0x0c, 0x00, 0x0f, 0x08 };
239 static u8 grdc_01[] VAR16 = {
240 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x0f, 0xff };
241 static u8 sequ_03[] VAR16 = { 0x00, 0x03, 0x00, 0x02 };
242 static u8 crtc_03[] VAR16 = {
243 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
244 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
245 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3,
247 static u8 sequ_04[] VAR16 = { 0x09, 0x03, 0x00, 0x02 };
248 static u8 crtc_04[] VAR16 = {
249 0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f,
250 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
251 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xa2,
253 static u8 actl_04[] VAR16 = {
254 0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07,
255 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
256 0x01, 0x00, 0x03, 0x00 };
257 static u8 grdc_04[] VAR16 = {
258 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x0f, 0xff };
259 static u8 sequ_06[] VAR16 = { 0x01, 0x01, 0x00, 0x06 };
260 static u8 crtc_06[] VAR16 = {
261 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
262 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
263 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xc2,
265 static u8 actl_06[] VAR16 = {
266 0x00, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
267 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
268 0x01, 0x00, 0x01, 0x00 };
269 static u8 grdc_06[] VAR16 = {
270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x0f, 0xff };
271 static u8 crtc_07[] VAR16 = {
272 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
273 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
274 0x9c, 0x8e, 0x8f, 0x28, 0x0f, 0x96, 0xb9, 0xa3,
276 static u8 actl_07[] VAR16 = {
277 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
278 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
279 0x0e, 0x00, 0x0f, 0x08 };
280 static u8 grdc_07[] VAR16 = {
281 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x0f, 0xff };
282 static u8 sequ_0d[] VAR16 = { 0x09, 0x0f, 0x00, 0x06 };
283 static u8 crtc_0d[] VAR16 = {
284 0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f,
285 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
286 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xe3,
288 static u8 actl_0d[] VAR16 = {
289 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
290 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
291 0x01, 0x00, 0x0f, 0x00 };
292 static u8 grdc_0d[] VAR16 = {
293 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff };
294 static u8 sequ_0e[] VAR16 = { 0x01, 0x0f, 0x00, 0x06 };
295 static u8 crtc_0e[] VAR16 = {
296 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
297 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
298 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xe3,
300 static u8 crtc_0f[] VAR16 = {
301 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
302 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
303 0x83, 0x85, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3,
305 static u8 actl_0f[] VAR16 = {
306 0x00, 0x08, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
307 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
308 0x01, 0x00, 0x01, 0x00 };
309 static u8 actl_10[] VAR16 = {
310 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
311 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
312 0x01, 0x00, 0x0f, 0x00 };
313 static u8 crtc_11[] VAR16 = {
314 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
315 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
316 0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
318 static u8 actl_11[] VAR16 = {
319 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f,
320 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f,
321 0x01, 0x00, 0x0f, 0x00 };
322 static u8 sequ_13[] VAR16 = { 0x01, 0x0f, 0x00, 0x0e };
323 static u8 crtc_13[] VAR16 = {
324 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
325 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326 0x9c, 0x8e, 0x8f, 0x28, 0x40, 0x96, 0xb9, 0xa3,
328 static u8 actl_13[] VAR16 = {
329 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
330 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
331 0x41, 0x00, 0x0f, 0x00 };
332 static u8 grdc_13[] VAR16 = {
333 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, 0xff };
334 static u8 crtc_6A[] VAR16 = {
335 0x7f, 0x63, 0x63, 0x83, 0x6b, 0x1b, 0x72, 0xf0,
336 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
337 0x59, 0x8d, 0x57, 0x32, 0x00, 0x57, 0x73, 0xe3,
341 /****************************************************************
343 ****************************************************************/
345 #define PAL(x) x, sizeof(x)
346 #define VPARAM(x) &video_param_table[x]
348 static struct vgamode_s vga_modes[] VAR16 = {
349 //mode model tx ty bpp cw ch sstart slength
350 // pelm dac sequ misc crtc actl grdc
351 {0x00, MM_TEXT, 40, 25, 4, 9, 16, SEG_CTEXT, 0x0800
352 , 0xFF, PAL(palette2), sequ_01, 0x67, crtc_01, actl_01, grdc_01},
353 {0x01, MM_TEXT, 40, 25, 4, 9, 16, SEG_CTEXT, 0x0800
354 , 0xFF, PAL(palette2), sequ_01, 0x67, crtc_01, actl_01, grdc_01},
355 {0x02, MM_TEXT, 80, 25, 4, 9, 16, SEG_CTEXT, 0x1000
356 , 0xFF, PAL(palette2), sequ_03, 0x67, crtc_03, actl_01, grdc_01},
357 {0x03, MM_TEXT, 80, 25, 4, 9, 16, SEG_CTEXT, 0x1000
358 , 0xFF, PAL(palette2), sequ_03, 0x67, crtc_03, actl_01, grdc_01},
359 {0x04, MM_CGA, 320, 200, 2, 8, 8, SEG_CTEXT, 0x0800
360 , 0xFF, PAL(palette1), sequ_04, 0x63, crtc_04, actl_04, grdc_04},
361 {0x05, MM_CGA, 320, 200, 2, 8, 8, SEG_CTEXT, 0x0800
362 , 0xFF, PAL(palette1), sequ_04, 0x63, crtc_04, actl_04, grdc_04},
363 {0x06, MM_CGA, 640, 200, 1, 8, 8, SEG_CTEXT, 0x1000
364 , 0xFF, PAL(palette1), sequ_06, 0x63, crtc_06, actl_06, grdc_06},
365 {0x07, MM_TEXT, 80, 25, 4, 9, 16, SEG_MTEXT, 0x1000
366 , 0xFF, PAL(palette0), sequ_03, 0x66, crtc_07, actl_07, grdc_07},
367 {0x0D, MM_PLANAR, 320, 200, 4, 8, 8, SEG_GRAPH, 0x2000
368 , 0xFF, PAL(palette1), sequ_0d, 0x63, crtc_0d, actl_0d, grdc_0d},
369 {0x0E, MM_PLANAR, 640, 200, 4, 8, 8, SEG_GRAPH, 0x4000
370 , 0xFF, PAL(palette1), sequ_0e, 0x63, crtc_0e, actl_0d, grdc_0d},
371 {0x0F, MM_PLANAR, 640, 350, 1, 8, 14, SEG_GRAPH, 0x8000
372 , 0xFF, PAL(palette0), sequ_0e, 0xa3, crtc_0f, actl_0f, grdc_0d},
373 {0x10, MM_PLANAR, 640, 350, 4, 8, 14, SEG_GRAPH, 0x8000
374 , 0xFF, PAL(palette2), sequ_0e, 0xa3, crtc_0f, actl_10, grdc_0d},
375 {0x11, MM_PLANAR, 640, 480, 1, 8, 16, SEG_GRAPH, 0x0000
376 , 0xFF, PAL(palette2), sequ_0e, 0xe3, crtc_11, actl_11, grdc_0d},
377 {0x12, MM_PLANAR, 640, 480, 4, 8, 16, SEG_GRAPH, 0x0000
378 , 0xFF, PAL(palette2), sequ_0e, 0xe3, crtc_11, actl_10, grdc_0d},
379 {0x13, MM_PACKED, 320, 200, 8, 8, 8, SEG_GRAPH, 0x0000
380 , 0xFF, PAL(palette3), sequ_13, 0x63, crtc_13, actl_13, grdc_13},
381 {0x6A, MM_PLANAR, 800, 600, 4, 8, 16, SEG_GRAPH, 0x0000
382 , 0xFF, PAL(palette2), sequ_0e, 0xe3, crtc_6A, actl_10, grdc_0d},
386 find_vga_entry(u8 mode)
389 for (i = 0; i < ARRAY_SIZE(vga_modes); i++) {
390 struct vgamode_s *vmode_g = &vga_modes[i];
391 if (GET_GLOBAL(vmode_g->mode) == mode)
398 /****************************************************************
399 * Static functionality table
400 ****************************************************************/
402 u8 static_functionality[0x10] VAR16 = {
403 /* 0 */ 0xff, // All modes supported #1
404 /* 1 */ 0xe0, // All modes supported #2
405 /* 2 */ 0x0f, // All modes supported #3
406 /* 3 */ 0x00, 0x00, 0x00, 0x00, // reserved
407 /* 7 */ 0x07, // 200, 350, 400 scan lines
408 /* 8 */ 0x02, // mamimum number of visible charsets in text mode
409 /* 9 */ 0x08, // total number of charset blocks in text mode
410 /* a */ 0xe7, // Change to add new functions
411 /* b */ 0x0c, // Change to add new functions
412 /* c */ 0x00, // reserved
413 /* d */ 0x00, // reserved
414 /* e */ 0x00, // Change to add new functions
415 /* f */ 0x00 // reserved