|
|
1.1 root 1: /*++
2:
3: Copyright (c) 1992 Microsoft Corporation
4:
5: Module Name:
6:
7: Modeset.h
8:
9: Abstract:
10:
11: This module contains all the global data used by the Cirrus Logic
12: CL-6410 and CL-6420 driver.
13:
14: Environment:
15:
16: Kernel mode
17:
18: Revision History:
19:
20: --*/
21: //---------------------------------------------------------------------------
22: //
23: // only one banking variable must be defined
24: //
25: #if TWO_32K_BANKS
26: #if ONE_64K_BANK
27: #error !!ERROR: two types of banking defined!
28: #endif
29: #elif ONE_64K_BANK
30: #else
31: #error !!ERROR: banking type must be defined!
32: #endif
33:
34: //---------------------------------------------------------------------------
35:
36: #define INT10_MODE_SET
37:
38: #ifndef INT10_MODE_SET
39: #error !!ERROR: int10_mode_set not defined!
40: #endif
41:
42: #include "cmdcnst.h"
43:
44: //---------------------------------------------------------------------------
45: //
46: // The actual register values for the supported modes are in chipset-specific
47: // include files:
48: //
49: // mode64xx.h has values for CL6410 and CL6420
50: // mode542x.h has values for CL5422, CL5424, and CL5426
51: //
52: #include "mode6410.h"
53: #include "mode6420.h"
54: #include "mode542x.h"
55:
56: USHORT MODESET_1K_WIDE[] = {
57: OW, // stretch scans to 1k
58: CRTC_ADDRESS_PORT_COLOR,
59: 0x8013,
60:
61: EOD
62: };
63:
64: //---------------------------------------------------------------------------
65: //
66: // Memory map table -
67: //
68: // These memory maps are used to save and restore the physical video buffer.
69: //
70:
71: //
72: // Memory map table definition
73: //
74:
75: typedef struct {
76: ULONG MaxSize; // Maximum addressable size of memory
77: ULONG Start; // Start address of display memory
78: } MEMORYMAPS;
79:
80: MEMORYMAPS MemoryMaps[] = {
81:
82: // length start
83: // ------ -----
84: { 0x08000, 0xB0000}, // all mono text modes (7)
85: { 0x08000, 0xB8000}, // all color text modes (0, 1, 2, 3,
86: { 0x20000, 0xA0000}, // all VGA graphics modes
87: };
88:
89: //
90: // Video mode table - contains information and commands for initializing each
91: // mode. These entries must correspond with those in VIDEO_MODE_VGA. The first
92: // entry is commented; the rest follow the same format, but are not so
93: // heavily commented.
94: //
95:
96: VIDEOMODE ModesVGA[] = {
97:
98: // Mode index 0
99: // Color text mode 3, 720x400, 9x16 char cell (VGA).
100: //
101: {
102: VIDEO_MODE_COLOR, // flags that this mode is a color mode, but not graphics
103: 4, // four planes
104: 1, // one bit of colour per plane
105: 80, 25, // 80x25 text resolution
106: 720, 400, // 720x400 pixels on screen
107: 160, 0x10000, // 160 bytes per scan line, 64K of CPU-addressable bitmap
108: 0, 0, // only support one frequency, non-interlaced
109: 0, // montype is 'dont care' for text modes
110: NoBanking, // no banking supported or needed in this mode
111: MemMap_CGA, // the memory mapping is the standard CGA memory mapping
112: // of 32K at B8000
113: CL6410 | CL6420 | CL542x,
114: crt | panel,
115: FALSE, // ModeValid default is always off
116: { 3,3,3}, // int10 BIOS modes
117: { CL6410_80x25Text_crt, CL6410_80x25Text_panel,
118: CL6420_80x25Text_crt, CL6420_80x25Text_panel,
119: CL542x_80x25Text, 0 },
120: },
121:
122: //
123: // Mode index 1.
124: // Color text mode 3, 640x350, 8x14 char cell (EGA).
125: //
126: { VIDEO_MODE_COLOR, // flags that this mode is a color mode, but not graphics
127: 4, // four planes
128: 1, // one bit of colour per plane
129: 80, 25, // 80x25 text resolution
130: 640, 350, // 640x350 pixels on screen
131: 160, 0x10000, // 160 bytes per scan line, 64K of CPU-addressable bitmap
132: 0, 0, // only support one frequency, non-interlaced
133: 0, // montype is 'dont care' for text modes
134: NoBanking, // no banking supported or needed in this mode
135: MemMap_CGA, // the memory mapping is the standard CGA memory mapping
136: // of 32K at B8000
137: CL6410 | CL6420 | CL542x,
138: crt | panel,
139: FALSE, // ModeValid default is always off
140: { 3,3,3}, // int10 BIOS modes
141: { CL6410_80x25_14_Text_crt, CL6410_80x25_14_Text_panel,
142: CL6420_80x25_14_Text_crt, CL6420_80x25_14_Text_panel,
143: CL542x_80x25_14_Text, 0 },
144: },
145: //
146: //
147: // Mode index 2
148: // Standard VGA Color graphics mode 0x12, 640x480 16 colors.
149: //
150: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 80, 30,
151: 640, 480, 80, 0x10000,
152: 60, 0, // 60hz, non-interlaced
153: 3, // montype
154: NoBanking, MemMap_VGA,
155: CL6410 | CL6420 | CL542x,
156: crt | panel,
157: FALSE, // ModeValid default is always off
158: { 0x12,0x12,0x12}, // int10 BIOS modes
159: { CL6410_640x480_crt, CL6410_640x480_panel,
160: CL6420_640x480_crt, CL6420_640x480_panel,
161: CL542x_640x480, 0 },
162: },
163:
164: // Mode index 2b
165: // Standard VGA Color graphics mode 0x12, 640x480 16 colors.
166: //
167: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 80, 30,
168: 640, 480, 80, 0x10000,
169: 72, 0, // 72hz, non-interlaced
170: 4, // montype
171: NoBanking, MemMap_VGA,
172: CL542x,
173: crt,
174: FALSE, // ModeValid default is always off
175: { 0,0,0x12}, // int10 BIOS modes
176: { NULL, NULL,
177: NULL, NULL,
178: CL542x_640x480, 0 },
179: },
180:
181:
182: //
183: // Beginning of SVGA modes
184: //
185:
186: //
187: // Mode index 3
188: // 800x600 16 colors.
189: //
190: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 100, 37,
191: 800, 600, 100, 0x10000,
192: 56, 0, // 56hz, non-interlaced
193: 3, // montype
194: NoBanking, MemMap_VGA,
195: CL6410 | CL6420 | CL542x,
196: crt,
197: FALSE, // ModeValid default is always off
198: { 0x6a,0x6a,0x6a}, // int10 BIOS modes
199: { CL6410_800x600_crt, NULL,
200: CL6420_800x600_crt, NULL,
201: CL542x_800x600, 0 },
202: },
203:
204: //
205: // Mode index 3b
206: // 800x600 16 colors.
207: //
208: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 100, 37,
209: 800, 600, 100, 0x10000,
210: 60, 0, // 60hz, non-interlaced
211: 4, // montype
212: NoBanking, MemMap_VGA,
213: CL6420 | CL542x,
214: crt,
215: FALSE, // ModeValid default is always off
216: { 0,0x6a,0x6a}, // int10 BIOS modes
217: { NULL, NULL,
218: CL6420_800x600_crt, NULL,
219: CL542x_800x600, 0 },
220: },
221:
222: //
223: // Mode index 3c
224: // 800x600 16 colors.
225: //
226: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 100, 37,
227: 800, 600, 100, 0x10000,
228: 72, 0, // 72hz, non-interlaced
229: 5, // montype
230: NoBanking, MemMap_VGA,
231: CL542x,
232: crt,
233: FALSE, // ModeValid default is always off
234: { 0,0,0x6a}, // int10 BIOS modes
235: { NULL, NULL,
236: NULL, NULL,
237: CL542x_800x600, 0 },
238: },
239:
240: //
241: // Mode index 4
242: // 1024x768 non-interlaced 16 colors.
243: // Assumes 512K.
244: //
245: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 128, 48,
246: 1024, 768, 128, 0x20000,
247: 60, 0, // 60hz, non-interlaced
248: 5, // montype
249: NormalBanking, MemMap_VGA,
250: CL542x,
251: crt,
252: FALSE, // ModeValid default is always off
253: { 0,0,0x5d}, // int10 BIOS modes
254: { NULL, NULL,
255: NULL, NULL,
256: CL542x_1024x768, 0 },
257: },
258:
259: //
260: // Mode index 4b
261: // 1024x768 non-interlaced 16 colors.
262: // Assumes 512K.
263: //
264: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 128, 48,
265: 1024, 768, 128, 0x20000,
266: 70, 0, // 70hz, non-interlaced
267: 6, // montype
268: NormalBanking, MemMap_VGA,
269: CL542x,
270: crt,
271: FALSE, // ModeValid default is always off
272: { 0,0,0x5d}, // int10 BIOS modes
273: { NULL, NULL,
274: NULL, NULL,
275: CL542x_1024x768, 0 },
276: },
277:
278: //
279: // Mode index 4c
280: // 1024x768 non-interlaced 16 colors.
281: // Assumes 512K.
282: //
283: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 128, 48,
284: 1024, 768, 128, 0x20000,
285: 72, 0, // 72hz, non-interlaced
286: 7, // montype
287: NormalBanking, MemMap_VGA,
288: CL542x,
289: crt,
290: FALSE, // ModeValid default is always off
291: { 0,0,0x5d}, // int10 BIOS modes
292: { NULL, NULL,
293: NULL, NULL,
294: CL542x_1024x768, 0 },
295: },
296:
297: //
298: // Mode index 4d
299: // 1024x768 interlaced 16 colors.
300: // Assumes 512K.
301: //
302: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 128, 48,
303: 1024, 768, 128, 0x20000,
304: 45, 1, // 45hz, interlaced
305: 4, // montype
306: NormalBanking, MemMap_VGA,
307: CL6420 | CL542x,
308: crt,
309: FALSE, // ModeValid default is always off
310: { 0,0x37,0x5d}, // int10 BIOS modes
311: { NULL, NULL,
312: CL6420_1024x768_crt, NULL,
313: CL542x_1024x768, 0 },
314: },
315:
316: //
317: // Mode index 5
318: // 1280x1024 interlaced 16 colors.
319: // Assumes 1meg required.
320: //
321: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 4, 1, 128, 48,
322: 1280, 1024, 160, 0x30000,
323: 45, 1, // 45Hz, interlaced
324: 5, // montype
325: NormalBanking, MemMap_VGA,
326: CL542x,
327: crt,
328: FALSE, // ModeValid default is always off
329: { 0,0,0x6c}, // int10 BIOS modes
330: { NULL, NULL,
331: NULL, NULL,
332: CL542x_1280x1024_I, 0},
333: },
334:
335: //
336: //
337: // Mode index 6
338: // VGA Color graphics, 640x480 256 colors. 1K scan line
339: //
340: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 80, 30,
341: 640, 480, 1024, 0x80000,
342: 60, 0, // 60hz, non-interlaced
343: 3, // montype
344: PlanarHCBanking, MemMap_VGA,
345: CL6420 | CL542x,
346: crt | panel,
347: FALSE, // ModeValid default is always off
348: { 0,0x2e,0x5f}, // int10 BIOS modes
349: { NULL, NULL,
350: CL6420_640x480_256color_crt, CL6420_640x480_256color_panel,
351: CL542x_640x480_256, MODESET_1K_WIDE },
352: },
353:
354: //
355: //
356: // Mode index 6b
357: // VGA Color graphics, 640x480 256 colors. 1K scan line
358: //
359: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 80, 30,
360: 640, 480, 1024, 0x80000,
361: 72, 0, // 72hz, non-interlaced
362: 4, // montype
363: PlanarHCBanking, MemMap_VGA,
364: CL542x,
365: crt,
366: FALSE, // ModeValid default is always off
367: { 0,0,0x5f}, // int10 BIOS modes
368: { NULL, NULL,
369: NULL, NULL,
370: CL542x_640x480_256, MODESET_1K_WIDE },
371: },
372:
373: //
374: // Mode index 7
375: // 800x600 256 colors. 1K scan line requires 1 MEG
376: //
377: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 100, 37,
378: 800, 600, 1024, 0x100000,
379: 56, 0, // 56hz, non-interlaced
380: 3, // montype
381: PlanarHCBanking, MemMap_VGA,
382: CL6420 | CL542x,
383: crt,
384: FALSE, // ModeValid default is always off
385: { 0,0x30,0x5c}, // int10 BIOS modes
386: { NULL, NULL,
387: CL6420_800x600_256color_crt, NULL,
388: CL542x_800x600_256, MODESET_1K_WIDE },
389: },
390:
391: //
392: // Mode index 7b
393: // 800x600 256 colors. 1K scan line requires 1 MEG
394: //
395: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 100, 37,
396: 800, 600, 1024, 0x100000,
397: 60, 0, // 60hz, non-interlaced
398: 4, // montype
399: PlanarHCBanking, MemMap_VGA,
400: CL6420 | CL542x,
401: crt,
402: FALSE, // ModeValid default is always off
403: { 0,0x30,0x5c}, // int10 BIOS modes
404: { NULL, NULL,
405: CL6420_800x600_256color_crt, NULL,
406: CL542x_800x600_256, MODESET_1K_WIDE },
407: },
408:
409: //
410: // Mode index 7c
411: // 800x600 256 colors. 1K scan line requires 1 MEG
412: //
413: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 100, 37,
414: 800, 600, 1024, 0x100000,
415: 72, 0, // 72hz, non-interlaced
416: 5, // montype
417: PlanarHCBanking, MemMap_VGA,
418: CL542x,
419: crt,
420: FALSE, // ModeValid default is always off
421: { 0,0,0x5c}, // int10 BIOS modes
422: { NULL, NULL,
423: NULL, NULL,
424: CL542x_800x600_256, MODESET_1K_WIDE },
425: },
426: //
427: // Mode index 8
428: // 1024x768 non-interlaced 256 colors.
429: // Assumes 1Meg.
430: //
431: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
432: 1024, 768, 1024, 0x100000,
433: 60, 0, // 60hz, non-interlaced
434: 5, // montype
435: PlanarHCBanking, MemMap_VGA,
436: CL542x,
437: crt,
438: FALSE, // ModeValid default is always off
439: { 0,0,0x60}, // int10 BIOS modes
440: { NULL, NULL,
441: NULL, NULL,
442: CL542x_1024x768_256, 0 },
443: },
444:
445: //
446: // Mode index 8b
447: // 1024x768 non-interlaced 256 colors.
448: // Assumes 1Meg.
449: //
450: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
451: 1024, 768, 1024, 0x100000,
452: 70, 0, // 70hz, non-interlaced
453: 6, // montype
454: PlanarHCBanking, MemMap_VGA,
455: CL542x,
456: crt,
457: FALSE, // ModeValid default is always off
458: { 0,0,0x60}, // int10 BIOS modes
459: { NULL, NULL,
460: NULL, NULL,
461: CL542x_1024x768_256, 0 },
462: },
463:
464: //
465: // Mode index 8
466: // 1024x768 non-interlaced 256 colors.
467: // Assumes 1Meg.
468: //
469: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
470: 1024, 768, 1024, 0x100000,
471: 72, 0, // 72hz, non-interlaced
472: 7, // montype
473: PlanarHCBanking, MemMap_VGA,
474: CL542x,
475: crt,
476: FALSE, // ModeValid default is always off
477: { 0,0,0x60}, // int10 BIOS modes
478: { NULL, NULL,
479: NULL, NULL,
480: CL542x_1024x768_256, 0 },
481: },
482:
483: //
484: // Mode index 8
485: // 1024x768 interlaced 256 colors.
486: // Assumes 1Meg.
487: //
488: { VIDEO_MODE_COLOR+VIDEO_MODE_GRAPHICS, 1, 8, 128, 48,
489: 1024, 768, 1024, 0x100000,
490: 45, 1, // 45hz, interlaced
491: 4, // montype
492: PlanarHCBanking, MemMap_VGA,
493: CL6420 | CL542x,
494: crt,
495: FALSE, // ModeValid default is always off
496: { 0,0x38,0x60}, // int10 BIOS modes
497: { NULL, NULL,
498: CL6420_1024x768_256color_crt, NULL,
499: CL542x_1024x768_256, 0 },
500: },
501:
502: };
503:
504:
505: ULONG NumVideoModes = sizeof(ModesVGA) / sizeof(VIDEOMODE);
506:
507:
508: //
509: //
510: // Data used to set the Graphics and Sequence Controllers to put the
511: // VGA into a planar state at A0000 for 64K, with plane 2 enabled for
512: // reads and writes, so that a font can be loaded, and to disable that mode.
513: //
514:
515: // Settings to enable planar mode with plane 2 enabled.
516: //
517:
518: USHORT EnableA000Data[] = {
519: OWM,
520: SEQ_ADDRESS_PORT,
521: 1,
522: 0x0100,
523:
524: OWM,
525: GRAPH_ADDRESS_PORT,
526: 3,
527: 0x0204, // Read Map = plane 2
528: 0x0005, // Graphics Mode = read mode 0, write mode 0
529: 0x0406, // Graphics Miscellaneous register = A0000 for 64K, not odd/even,
530: // graphics mode
531: OWM,
532: SEQ_ADDRESS_PORT,
533: 3,
534: 0x0402, // Map Mask = write to plane 2 only
535: 0x0404, // Memory Mode = not odd/even, not full memory, graphics mode
536: 0x0300, // end sync reset
537: EOD
538: };
539:
540: //
541: // Settings to disable the font-loading planar mode.
542: //
543:
544: USHORT DisableA000Color[] = {
545: OWM,
546: SEQ_ADDRESS_PORT,
547: 1,
548: 0x0100,
549:
550: OWM,
551: GRAPH_ADDRESS_PORT,
552: 3,
553: 0x0004, 0x1005, 0x0E06,
554:
555: OWM,
556: SEQ_ADDRESS_PORT,
557: 3,
558: 0x0302, 0x0204, 0x0300, // end sync reset
559: EOD
560:
561: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.