ReactOS 0.4.16-dev-2104-gb84fa49
pcvideo.c
Go to the documentation of this file.
1/*
2 * FreeLoader
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#include <freeldr.h>
20#include <suppress.h>
21
22#include <debug.h>
24
25#define VIDEOPORT_PALETTE_READ 0x03C7
26#define VIDEOPORT_PALETTE_WRITE 0x03C8
27#define VIDEOPORT_PALETTE_DATA 0x03C9
28#define VIDEOPORT_VERTICAL_RETRACE 0x03DA
29
30#define VIDEOVGA_MEM_ADDRESS 0xA0000
31#define VIDEOTEXT_MEM_ADDRESS 0xB8000
32#define VIDEOTEXT_MEM_SIZE 0x8000
33
34#define VIDEOCARD_CGA_OR_OTHER 0
35#define VIDEOCARD_EGA 1
36#define VIDEOCARD_VGA 2
37
38#define VIDEOMODE_NORMAL_TEXT 0
39#define VIDEOMODE_EXTENDED_TEXT 1
40#define VIDEOMODE_80X28 0x501C
41#define VIDEOMODE_80X30 0x501E
42#define VIDEOMODE_80X34 0x5022
43#define VIDEOMODE_80X43 0x502B
44#define VIDEOMODE_80X60 0x503C
45#define VIDEOMODE_132X25 0x8419
46#define VIDEOMODE_132X43 0x842B
47#define VIDEOMODE_132X50 0x8432
48#define VIDEOMODE_132X60 0x843C
49
50#define VERTRES_200_SCANLINES 0x00
51#define VERTRES_350_SCANLINES 0x01
52#define VERTRES_400_SCANLINES 0x02
53
54#include <pshpack2.h>
55typedef struct
56{
57 USHORT ModeAttributes; /* Mode attributes (see #00080) */
58 UCHAR WindowAttributesA; /* Window attributes, window A (see #00081) */
59 UCHAR WindowsAttributesB; /* Window attributes, window B (see #00081) */
60 USHORT WindowGranularity; /* Window granularity in KB */
61 USHORT WindowSize; /* Window size in KB */
62 USHORT WindowAStartSegment; /* Start segment of window A (0000h if not supported) */
63 USHORT WindowBStartSegment; /* Start segment of window B (0000h if not supported) */
64 ULONG WindowPositioningFunction; /* -> FAR window positioning function (equivalent to AX=4F05h) */
65 USHORT BytesPerScanLine; /* Bytes per scan line */
66 /* ---remainder is optional for VESA modes in v1.0/1.1, needed for OEM modes--- */
67 USHORT WidthInPixels; /* Width in pixels (graphics) or characters (text) */
68 USHORT HeightInPixels; /* Height in pixels (graphics) or characters (text) */
69 UCHAR CharacterWidthInPixels; /* Width of character cell in pixels */
70 UCHAR CharacterHeightInPixels; /* Height of character cell in pixels */
71 UCHAR NumberOfMemoryPlanes; /* Number of memory planes */
72 UCHAR BitsPerPixel; /* Number of bits per pixel */
73 UCHAR NumberOfBanks; /* Number of banks */
74 UCHAR MemoryModel; /* Memory model type (see #00082) */
75 UCHAR BankSize; /* Size of bank in KB */
76 UCHAR NumberOfImagePanes; /* Number of image pages (less one) that will fit in video RAM */
77 UCHAR Reserved1; /* Reserved (00h for VBE 1.0-2.0, 01h for VBE 3.0) */
78 /* ---VBE v1.2+ --- */
79 UCHAR RedMaskSize; /* Red mask size */
80 UCHAR RedMaskPosition; /* Red field position */
81 UCHAR GreenMaskSize; /* Green mask size */
82 UCHAR GreenMaskPosition; /* Green field size */
83 UCHAR BlueMaskSize; /* Blue mask size */
84 UCHAR BlueMaskPosition; /* Blue field size */
85 UCHAR ReservedMaskSize; /* Reserved mask size */
86 UCHAR ReservedMaskPosition; /* Reserved mask position */
87 UCHAR DirectColorModeInfo; /* Direct color mode info
88 * bit 0:Color ramp is programmable
89 * bit 1:Bytes in reserved field may be used by application */
90 /* ---VBE v2.0+ --- */
91 ULONG LinearVideoBufferAddress; /* Physical address of linear video buffer */
92 ULONG OffscreenMemoryPointer; /* Pointer to start of offscreen memory */
93 USHORT OffscreenMemorySize; /* KB of offscreen memory */
94 /* ---VBE v3.0 --- */
95 USHORT LinearBytesPerScanLine; /* Bytes per scan line in linear modes */
96 UCHAR BankedNumberOfImages; /* Number of images (less one) for banked video modes */
97 UCHAR LinearNumberOfImages; /* Number of images (less one) for linear video modes */
98 UCHAR LinearRedMaskSize; /* Linear modes:Size of direct color red mask (in bits) */
99 UCHAR LinearRedMaskPosition; /* Linear modes:Bit position of red mask LSB (e.g. shift count) */
100 UCHAR LinearGreenMaskSize; /* Linear modes:Size of direct color green mask (in bits) */
101 UCHAR LinearGreenMaskPosition; /* Linear modes:Bit position of green mask LSB (e.g. shift count) */
102 UCHAR LinearBlueMaskSize; /* Linear modes:Size of direct color blue mask (in bits) */
103 UCHAR LinearBlueMaskPosition; /* Linear modes:Bit position of blue mask LSB (e.g. shift count) */
104 UCHAR LinearReservedMaskSize; /* Linear modes:Size of direct color reserved mask (in bits) */
105 UCHAR LinearReservedMaskPosition; /* Linear modes:Bit position of reserved mask LSB */
106 ULONG MaximumPixelClock; /* Maximum pixel clock for graphics video mode, in Hz */
107 UCHAR Reserved2[190]; /* 190 BYTEs reserved (0) */
110#include <poppack.h>
111
113
114static ULONG VideoCard = VIDEOCARD_CGA_OR_OTHER; /* Type of video card installed on the system */
115static USHORT BiosVideoMode = VIDEOMODE_NORMAL_TEXT; /* Current video mode as known by BIOS */
116static ULONG ScreenWidth = 80; /* Screen Width in characters */
117static ULONG ScreenHeight = 25; /* Screen Height in characters */
118static ULONG BytesPerScanLine = 160; /* Number of bytes per scanline (delta) */
119static VIDEODISPLAYMODE DisplayMode = VideoTextMode; /* Current display mode */
120static BOOLEAN VesaVideoMode = FALSE; /* Are we using a VESA mode? */
121static SVGA_MODE_INFORMATION VesaVideoModeInformation; /* Only valid when in VESA mode */
122static ULONG CurrentMemoryBank = 0; /* Currently selected VESA bank */
123
124enum
125{
136};
137
138static ULONG
140{
141 REGS Regs;
142
143 /* Int 10h AH=12h BL=10h
144 * VIDEO - ALTERNATE FUNCTION SELECT (PS,EGA,VGA,MCGA) - GET EGA INFO
145 *
146 * AH = 12h
147 * BL = 10h
148 * Return:
149 * BH = video state
150 * 00h color mode in effect (I/O port 3Dxh)
151 * 01h mono mode in effect (I/O port 3Bxh)
152 * BL = installed memory (00h = 64K, 01h = 128K, 02h = 192K, 03h = 256K)
153 * CH = feature connector bits
154 * CL = switch settings
155 * AH destroyed (at least by Tseng ET4000 BIOS v8.00n)
156 *
157 * Installation check;EGA
158 */
159 Regs.b.ah = 0x12;
160 Regs.b.bl = 0x10;
161 Int386(0x10, &Regs, &Regs);
162
163 /* If BL is still equal to 0x10 then there is no EGA/VGA present */
164 if (Regs.b.bl == 0x10)
166
167 /* Int 10h AX=1A00h
168 * VIDEO - GET DISPLAY COMBINATION CODE (PS,VGA/MCGA)
169 *
170 * AX = 1A00h
171 * Return:
172 * AL = 1Ah if function was supported
173 * BL = active display code
174 * BH = alternate display code
175 *
176 * This function is commonly used to check for the presence of a VGA.
177 *
178 * Installation check;VGA
179 *
180 * Values for display combination code:
181 * 00h no display
182 * 01h monochrome adapter w/ monochrome display
183 * 02h CGA w/ color display
184 * 03h reserved
185 * 04h EGA w/ color display
186 * 05h EGA w/ monochrome display
187 * 06h PGA w/ color display
188 * 07h VGA w/ monochrome analog display
189 * 08h VGA w/ color analog display
190 * 09h reserved
191 * 0Ah MCGA w/ digital color display
192 * 0Bh MCGA w/ monochrome analog display
193 * 0Ch MCGA w/ color analog display
194 * FFh unknown display type
195 */
196 Regs.w.ax = 0x1A00;
197 Int386(0x10, &Regs, &Regs);
198
199 if (Regs.b.al == 0x1a)
200 return VIDEOCARD_VGA;
201 else
202 return VIDEOCARD_EGA;
203}
204
205static BOOLEAN
208 _Out_ PSVGA_MODE_INFORMATION ModeInformation)
209{
210 REGS Regs;
211
212 RtlZeroMemory((PVOID)BIOSCALLBUFFER, sizeof(*ModeInformation));
213
214 /* VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION
215 * AX = 4F01h
216 * CX = SuperVGA video mode (see #04082 for bitfields)
217 * ES:DI -> 256-byte buffer for mode information (see #00079)
218 * Return:
219 * AL = 4Fh if function supported
220 * AH = status
221 * 00h successful
222 * ES:DI buffer filled
223 * 01h failed
224 *
225 * Desc: Determine the attributes of the specified video mode.
226 *
227 * Note: While VBE 1.1 and higher will zero out all unused bytes
228 * of the buffer, v1.0 did not, so applications that want to be
229 * backward compatible should clear the buffer before calling.
230 */
231 Regs.w.ax = 0x4F01;
232 Regs.w.cx = Mode;
233 Regs.w.es = BIOSCALLBUFSEGMENT;
234 Regs.w.di = BIOSCALLBUFOFFSET;
235 Int386(0x10, &Regs, &Regs);
236
237 if (Regs.w.ax != 0x004F)
238 return FALSE;
239
240 RtlCopyMemory(ModeInformation, (PVOID)BIOSCALLBUFFER, sizeof(*ModeInformation));
241
242 TRACE("\n");
243 TRACE("BiosVesaGetSVGAModeInformation(Mode 0x%x)\n", Mode);
244 TRACE("ModeAttributes = 0x%04x\n", ModeInformation->ModeAttributes);
245 TRACE("WindowAttributesA = 0x%02x\n", ModeInformation->WindowAttributesA);
246 TRACE("WindowAttributesB = 0x%02x\n", ModeInformation->WindowsAttributesB);
247 TRACE("WindowGranularity = %huKB\n", ModeInformation->WindowGranularity);
248 TRACE("WindowSize = %huKB\n", ModeInformation->WindowSize);
249 TRACE("WindowAStartSegment = 0x%04x\n", ModeInformation->WindowAStartSegment);
250 TRACE("WindowBStartSegment = 0x%04x\n", ModeInformation->WindowBStartSegment);
251 TRACE("WindowPositioningFunction = 0x%x\n", ModeInformation->WindowPositioningFunction);
252 TRACE("BytesPerScanLine = %hu\n", ModeInformation->BytesPerScanLine);
253 TRACE("WidthInPixels = %hu\n", ModeInformation->WidthInPixels);
254 TRACE("HeightInPixels = %hu\n", ModeInformation->HeightInPixels);
255 TRACE("CharacterWidthInPixels = %u\n", ModeInformation->CharacterWidthInPixels);
256 TRACE("CharacterHeightInPixels = %u\n", ModeInformation->CharacterHeightInPixels);
257 TRACE("NumberOfMemoryPlanes = %u\n", ModeInformation->NumberOfMemoryPlanes);
258 TRACE("BitsPerPixel = %u\n", ModeInformation->BitsPerPixel);
259 TRACE("NumberOfBanks = %u\n", ModeInformation->NumberOfBanks);
260 TRACE("MemoryModel = %u\n", ModeInformation->MemoryModel);
261 TRACE("BankSize = %u\n", ModeInformation->BankSize);
262 TRACE("NumberOfImagePanes = %u\n", ModeInformation->NumberOfImagePanes);
263 TRACE("Reserved1 = 0x%02x\n", ModeInformation->Reserved1);
264 TRACE("---VBE v1.2+ ---\n");
265 TRACE("RedMaskSize = %u\n", ModeInformation->RedMaskSize);
266 TRACE("RedMaskPosition = %u\n", ModeInformation->RedMaskPosition);
267 TRACE("GreenMaskSize = %u\n", ModeInformation->GreenMaskSize);
268 TRACE("GreenMaskPosition = %u\n", ModeInformation->GreenMaskPosition);
269 TRACE("BlueMaskSize = %u\n", ModeInformation->BlueMaskSize);
270 TRACE("BlueMaskPosition = %u\n", ModeInformation->BlueMaskPosition);
271 TRACE("ReservedMaskSize = %u\n", ModeInformation->ReservedMaskSize);
272 TRACE("ReservedMaskPosition = %u\n", ModeInformation->ReservedMaskPosition);
273 TRACE("DirectColorModeInfo = 0x%02x\n", ModeInformation->DirectColorModeInfo);
274 TRACE("---VBE v2.0+ ---\n");
275 TRACE("LinearVideoBufferAddress = 0x%x\n", ModeInformation->LinearVideoBufferAddress);
276 TRACE("OffscreenMemoryPointer = 0x%x\n", ModeInformation->OffscreenMemoryPointer);
277 TRACE("OffscreenMemorySize = %huKB\n", ModeInformation->OffscreenMemorySize);
278 TRACE("---VBE v3.0 ---\n");
279 TRACE("LinearBytesPerScanLine = %hu\n", ModeInformation->LinearBytesPerScanLine);
280 TRACE("BankedNumberOfImages = %u\n", ModeInformation->BankedNumberOfImages);
281 TRACE("LinearNumberOfImages = %u\n", ModeInformation->LinearNumberOfImages);
282 TRACE("LinearRedMaskSize = %u\n", ModeInformation->LinearRedMaskSize);
283 TRACE("LinearRedMaskPosition = %u\n", ModeInformation->LinearRedMaskPosition);
284 TRACE("LinearGreenMaskSize = %u\n", ModeInformation->LinearGreenMaskSize);
285 TRACE("LinearGreenMaskPosition = %u\n", ModeInformation->LinearGreenMaskPosition);
286 TRACE("LinearBlueMaskSize = %u\n", ModeInformation->LinearBlueMaskSize);
287 TRACE("LinearBlueMaskPosition = %u\n", ModeInformation->LinearBlueMaskPosition);
288 TRACE("LinearReservedMaskSize = %u\n", ModeInformation->LinearReservedMaskSize);
289 TRACE("LinearReservedMaskPosition = %u\n", ModeInformation->LinearReservedMaskPosition);
290 TRACE("MaximumPixelClock = %luHz\n", ModeInformation->MaximumPixelClock);
291 TRACE("\n");
292
293 return TRUE;
294}
295
296static BOOLEAN
299{
300 REGS Regs;
301
302 /*
303 * VESA SuperVGA BIOS - GET CURRENT VIDEO MODE
304 *
305 * AX = 4F03h
306 * Return:
307 * AL = 4Fh if function supported
308 * AH = status
309 * 00h successful
310 * BX = video mode (see #00083,#00084)
311 *
312 * bit 13:
313 * VBE/AF v1.0P accelerated video mode
314 *
315 * bit 14:
316 * Linear frame buffer enabled (VBE v2.0+)
317 *
318 * bit 15:
319 * Don't clear video memory
320 * 01h failed
321 */
322 Regs.w.ax = 0x4F03;
323 Int386(0x10, &Regs, &Regs);
324
325 if (Regs.w.ax != 0x004F)
326 return FALSE;
327
328 *Mode = Regs.w.bx;
329 return TRUE;
330}
331
332static BOOLEAN
335{
336 REGS Regs;
337
338 /* Int 10h AH=0Fh
339 * VIDEO - GET CURRENT VIDEO MODE
340 *
341 * AH = 0Fh
342 * Return:
343 * AH = number of character columns
344 * AL = display mode (see #00010 at AH=00h)
345 * BH = active page (see AH=05h)
346 *
347 * Notes: If mode was set with bit 7 set ("no blanking"), the returned
348 * mode will also have bit 7 set. EGA, VGA, and UltraVision return either
349 * AL=03h (color) or AL=07h (monochrome) in all extended-row text modes.
350 * HP 200LX returns AL=07h (monochrome) if mode was set to AL=21h and
351 * always 80 resp. 40 columns in all text modes regardless of current
352 * zoom setting (see AH=D0h). When using a Hercules Graphics Card,
353 * additional checks are necessary:
354 *
355 * mode 05h:
356 * If WORD 0040h:0063h is 03B4h, may be in graphics page 1
357 * (as set by DOSSHELL and other Microsoft software)
358 *
359 * mode 06h:
360 * If WORD 0040h:0063h is 03B4h, may be in graphics page 0
361 * (as set by DOSSHELL and other Microsoft software)
362 *
363 * mode 07h:
364 * If BYTE 0040h:0065h bit 1 is set, Hercules card is in
365 * graphics mode, with bit 7 indicating the page (mode set by
366 * Hercules driver for Borland Turbo C).
367 * The Tandy 2000 BIOS is only documented as returning AL, not AH or BH
368 */
369 Regs.b.ah = 0x0F;
370 Int386(0x10, &Regs, &Regs);
371
372 if (Regs.b.ah == 0)
373 return FALSE;
374
375 *Mode = Regs.b.al;
376 return TRUE;
377}
378
379static VOID
381{
382 USHORT Mode = 0;
383
384 /* Is the current mode VESA? */
387 {
388 TRACE("VESA mode detected\n");
393 DisplayMode = (0x0108 <= Mode && Mode <= 0x010C) ? VideoTextMode : VideoGraphicsMode;
395 }
396 /* If not, it should be a regular BIOS mode */
397 else if (PcVideoGetBiosMode(&Mode))
398 {
399 /*
400 * The BIOS data area 0x400 holds information about the current video mode.
401 * Infos at: https://web.archive.org/web/20240119203029/http://www.bioscentral.com/misc/bda.htm
402 * https://stanislavs.org/helppc/bios_data_area.html
403 */
404
405 UCHAR BiosMode = (*(PUCHAR)0x449) & 0x7F; /* Current video mode */
406 ASSERT(BiosMode == Mode);
408 TRACE("BIOS mode detected\n");
409
410 ScreenWidth = *(PUSHORT)0x44A; /* Number of screen columns */
411 ScreenHeight = 1 + *(PUCHAR)0x484; /* 1 + "Rows on the screen (less 1, EGA+)" */
412
413 /*
414 * Select bits 7 and 4 of "Video display data area (MCGA and VGA)"
415 * |7|6|5|4|3|2|1|0|
416 * | `------ see table below
417 * `--------- alphanumeric scan lines (see table below)
418 *
419 * then convert to a number and map it to the scanline number:
420 * Bit7 Bit4 Scan Lines
421 * 0 0 350 line mode
422 * 0 1 400 line mode
423 * 1 0 200 line mode
424 * 1 1 reserved
425 */
426 BytesPerScanLine = (*(PUCHAR)0x489) & 0x90;
427 BytesPerScanLine = ((BytesPerScanLine & 0x80) >> 6) | ((BytesPerScanLine & 0x10) >> 4);
428 switch (BytesPerScanLine)
429 {
431 BytesPerScanLine = 200; break;
433 BytesPerScanLine = 350; break;
435 BytesPerScanLine = 400; break;
436 default:
437 BytesPerScanLine = 160; break;
438 }
439
442 }
443 else
444 {
445 /* Set the values for the default text mode.
446 * If a graphics mode is set, these values will be changed. */
447 TRACE("Fallback mode detected\n");
449 ScreenWidth = 80;
450 ScreenHeight = 25;
451 BytesPerScanLine = 160;
454 }
455
456 TRACE("This is a %s video mode\n", VesaVideoMode ? "VESA" : "BIOS");
457 TRACE("BiosVideoMode = 0x%x\n", BiosVideoMode);
458 TRACE("DisplayMode = %sMode\n", DisplayMode == VideoTextMode ? "Text" : "Graphics");
459 TRACE("ScreenWidth = %lu\n", ScreenWidth);
460 TRACE("ScreenHeight = %lu\n", ScreenHeight);
461 TRACE("BytesPerScanLine = %lu\n", BytesPerScanLine);
462}
463
464static BOOLEAN
466{
467 REGS Regs;
468
469 /* Int 10h AX=4F02h
470 * VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE
471 *
472 * AX = 4F02h
473 * BX = new video mode
474 * ES:DI -> (VBE 3.0+) CRTC information block, bit mode bit 11 set
475 * Return:
476 * AL = 4Fh if function supported
477 * AH = status
478 * 00h successful
479 * 01h failed
480 *
481 * Values for VESA video mode:
482 * 00h-FFh OEM video modes (see #00010 at AH=00h)
483 * 100h 640x400x256
484 * 101h 640x480x256
485 * 102h 800x600x16
486 * 103h 800x600x256
487 * 104h 1024x768x16
488 * 105h 1024x768x256
489 * 106h 1280x1024x16
490 * 107h 1280x1024x256
491 * 108h 80x60 text
492 * 109h 132x25 text
493 * 10Ah 132x43 text
494 * 10Bh 132x50 text
495 * 10Ch 132x60 text
496 * ---VBE v1.2+ ---
497 * 10Dh 320x200x32K
498 * 10Eh 320x200x64K
499 * 10Fh 320x200x16M
500 * 110h 640x480x32K
501 * 111h 640x480x64K
502 * 112h 640x480x16M
503 * 113h 800x600x32K
504 * 114h 800x600x64K
505 * 115h 800x600x16M
506 * 116h 1024x768x32K
507 * 117h 1024x768x64K
508 * 118h 1024x768x16M
509 * 119h 1280x1024x32K (1:5:5:5)
510 * 11Ah 1280x1024x64K (5:6:5)
511 * 11Bh 1280x1024x16M
512 * ---VBE 2.0+ ---
513 * 120h 1600x1200x256
514 * 121h 1600x1200x32K
515 * 122h 1600x1200x64K
516 * 81FFh special full-memory access mode
517 *
518 * Notes: The special mode 81FFh preserves the contents of the video memory and gives
519 * access to all of the memory; VESA recommends that the special mode be a packed-pixel
520 * mode. For VBE 2.0+, it is required that the VBE implement the mode, but not place it
521 * in the list of available modes (mode information for this mode can be queried
522 * directly, however). As of VBE 2.0, VESA will no longer define video mode numbers.
523 */
524 Regs.w.ax = 0x4F02;
525 Regs.w.bx = Mode;
526 Int386(0x10, &Regs, &Regs);
527 return (Regs.w.ax == 0x004F);
528}
529
530static VOID
532{
533 REGS Regs;
534
535 /* Int 10h AH=00h
536 * VIDEO - SET VIDEO MODE
537 *
538 * AH = 00h
539 * AL = desired video mode
540 * Return:
541 * AL = video mode flag (Phoenix, AMI BIOS)
542 * 20h mode > 7
543 * 30h modes 0-5 and 7
544 * 3Fh mode 6
545 * AL = CRT controller mode byte (Phoenix 386 BIOS v1.10)
546 */
547 Regs.b.ah = 0x00;
548 Regs.b.al = VideoMode;
549 Int386(0x10, &Regs, &Regs);
550}
551
552static VOID
554{
555 REGS Regs;
556
557 /* Int 10h AX=1112h
558 * VIDEO - TEXT-MODE CHARGEN - LOAD ROM 8x8 DBL-DOT PATTERNS (PS,EGA,VGA)
559 *
560 * AX = 1112h
561 * BL = block to load
562 * Return:
563 * Nothing
564 */
565 Regs.w.ax = 0x1112;
566 Regs.b.bl = 0x00;
567 Int386(0x10, &Regs, &Regs);
568}
569
570static VOID
572{
573 REGS Regs;
574
575 /* Int 10h AX=1111h
576 * VIDEO - TEXT-MODE CHARGEN - LOAD ROM MONOCHROME PATTERNS (PS,EGA,VGA)
577 *
578 * AX = 1111h
579 * BL = block to load
580 * Return:
581 * Nothing
582 */
583 Regs.w.ax = 0x1111;
584 Regs.b.bl = 0;
585 Int386(0x10, &Regs, &Regs);
586}
587
588static VOID
590{
591 REGS Regs;
592
593 /* Int 10h AH=12h BL=20h
594 * VIDEO - ALTERNATE FUNCTION SELECT (PS,EGA,VGA,MCGA) - ALTERNATE PRTSC
595 *
596 * AH = 12h
597 * BL = 20h select alternate print screen routine
598 * Return:
599 * Nothing
600 *
601 * Installs a PrtSc routine from the video card's BIOS to replace the
602 * default PrtSc handler from the ROM BIOS, which usually does not
603 * understand screen heights other than 25 lines.
604 *
605 * Some adapters disable print-screen instead of enhancing it.
606 */
607 Regs.b.ah = 0x12;
608 Regs.b.bl = 0x20;
609 Int386(0x10, &Regs, &Regs);
610}
611
612static VOID
614{
615 REGS Regs;
616
617 /* Int 10h AH=12h BL=34h
618 * VIDEO - ALTERNATE FUNCTION SELECT (VGA) - CURSOR EMULATION
619 *
620 * AH = 12h
621 * BL = 34h
622 * AL = new state
623 * 00h enable alphanumeric cursor emulation
624 * 01h disable alphanumeric cursor emulation
625 * Return:
626 * AL = 12h if function supported
627 *
628 * Specify whether the BIOS should automatically remap cursor start/end
629 * according to the current character height in text modes.
630 */
631 Regs.b.ah = 0x12;
632 Regs.b.bl = 0x34;
633 Regs.b.al = 0x01;
634 Int386(0x10, &Regs, &Regs);
635}
636
637static VOID
638PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
639{
640 REGS Regs;
641
642 /* Int 10h AH=01h
643 * VIDEO - SET TEXT-MODE CURSOR SHAPE
644 *
645 * AH = 01h
646 * CH = cursor start and options
647 * CL = bottom scan line containing cursor (bits 0-4)
648 * Return:
649 * Nothing
650 *
651 * Specify the starting and ending scan lines to be occupied
652 * by the hardware cursor in text modes.
653 *
654 * AMI 386 BIOS and AST Premier 386 BIOS will lock up the
655 * system if AL is not equal to the current video mode.
656 *
657 * Bitfields for cursor start and options:
658 *
659 * Bit(s) Description
660 * 7 should be zero
661 * 6,5 cursor blink
662 * (00=normal, 01=invisible, 10=erratic, 11=slow).
663 * (00=normal, other=invisible on EGA/VGA)
664 * 4-0 topmost scan line containing cursor
665 */
666 Regs.b.ah = 0x01;
667 Regs.b.al = 0x03;
668 Regs.b.ch = StartScanLine;
669 Regs.b.cl = EndScanLine;
670 Int386(0x10, &Regs, &Regs);
671}
672
673static VOID
674PcVideoSetVerticalResolution(UCHAR VerticalResolutionMode)
675{
676 REGS Regs;
677
678 /* Int 10h AH=12h BL=30h
679 * VIDEO - ALTERNATE FUNCTION SELECT (VGA) - SELECT VERTICAL RESOLUTION
680 *
681 * AH = 12h
682 * BL = 30h
683 * AL = vertical resolution
684 * 00h 200 scan lines
685 * 01h 350 scan lines
686 * 02h 400 scan lines
687 * Return:
688 * AL = 12h if function supported
689 *
690 * Specify the number of scan lines used to display text modes.
691 *
692 * The specified resolution will take effect on the next mode set.
693 */
694 Regs.b.ah = 0x12;
695 Regs.b.bl = 0x30;
696 Regs.b.al = VerticalResolutionMode;
697 Int386(0x10, &Regs, &Regs);
698}
699
700static VOID
702{
704
705 /* Read CRTC port */
706 CRTC = READ_PORT_UCHAR((PUCHAR)0x03CC);
707 if (CRTC & 1)
708 CRTC = 0x3D4;
709 else
710 CRTC = 0x3B4;
711
712 /* Vertical sync end (also unlocks CR0-7) */
714 WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x0C);
715
716 /* Vertical total */
718 WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x0B);
719
720 /* (vertical) overflow */
722 WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x3E);
723
724 /* Vertical sync start */
726 WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xEA);
727
728 /* Vertical display end */
730 WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xDF);
731
732 /* Vertical blank start */
734 WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xE7);
735
736 /* Vertical blank end */
738 WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x04);
739
740 /* Misc output register (read) */
741 CRTC = READ_PORT_UCHAR((PUCHAR)0x03CC);
742
743 /* Preserve clock select bits and color bit */
744 CRTC = (CRTC & 0x0D);
745 /* Set correct sync polarity */
746 CRTC = (CRTC | 0xE2);
747
748 /* (write) */
750}
751
752static VOID
754{
756
757 /* Read CRTC port */
758 CRTC = READ_PORT_UCHAR((PUCHAR)0x03CC);
759 if (CRTC & 1)
760 CRTC = 0x3D4;
761 else
762 CRTC = 0x3B4;
763
764 /* Vertical display end */
766 WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xDF);
767}
768
769static BOOLEAN
771{
772 PcVideoSetBiosMode(0x03);
773 ScreenWidth = 80;
774 ScreenHeight = 25;
775 return TRUE;
776}
777
778static BOOLEAN
780{
782 {
783 PcVideoSetBiosMode(0x03);
788 ScreenWidth = 80;
789 ScreenHeight = 50;
790 }
791 else if (VideoCard == VIDEOCARD_EGA)
792 {
793 PcVideoSetBiosMode(0x03);
798 ScreenWidth = 80;
799 ScreenHeight = 43;
800 }
801 else /* VIDEOCARD_CGA_OR_OTHER */
802 {
803 return FALSE;
804 }
805
806 return TRUE;
807}
808
809static BOOLEAN
811{
812 /* FIXME: Is this VGA-only? */
815 PcVideoDefineCursor(11, 12);
816 ScreenWidth = 80;
817 ScreenHeight = 28;
818 return TRUE;
819}
820
821static BOOLEAN
823{
824 /* FIXME: Is this VGA-only? */
827 ScreenWidth = 80;
828 ScreenHeight = 30;
829 return TRUE;
830}
831
832static BOOLEAN
834{
835 /* FIXME: Is this VGA-only? */
839 PcVideoDefineCursor(11, 12);
841 ScreenWidth = 80;
842 ScreenHeight = 34;
843 return TRUE;
844}
845
846static BOOLEAN
848{
849 /* FIXME: Is this VGA-only? */
856 ScreenWidth = 80;
857 ScreenHeight = 43;
858 return TRUE;
859}
860
861static BOOLEAN
863{
864 /* FIXME: Is this VGA-only? */
872 ScreenWidth = 80;
873 ScreenHeight = 60;
874 return TRUE;
875}
876
877static BOOLEAN
879{
881
882 /* Set the values for the default text modes
883 * If they are setting a graphics mode then
884 * these values will be changed. */
885 BiosVideoMode = NewMode;
886 ScreenWidth = 80;
887 ScreenHeight = 25;
888 BytesPerScanLine = 160;
891
892 switch (NewMode)
893 {
895 case 0x03: /* BIOS 80x25 text mode number */
896 return PcVideoSetMode80x25();
899 case VIDEOMODE_80X28:
900 return PcVideoSetMode80x28();
901 case VIDEOMODE_80X30:
902 return PcVideoSetMode80x30();
903 case VIDEOMODE_80X34:
904 return PcVideoSetMode80x34();
905 case VIDEOMODE_80X43:
906 return PcVideoSetMode80x43();
907 case VIDEOMODE_80X60:
908 return PcVideoSetMode80x60();
909 }
910
911 if (NewMode == 0x12)
912 {
913 /* 640x480x16 */
914 PcVideoSetBiosMode((UCHAR)NewMode);
915 WRITE_PORT_USHORT((USHORT*)0x03CE, 0x0F01); /* For some reason this is necessary? */
916 ScreenWidth = 640;
917 ScreenHeight = 480;
918 BytesPerScanLine = 80;
919 BiosVideoMode = NewMode;
921
922 return TRUE;
923 }
924 else if (NewMode == 0x13)
925 {
926 /* 320x200x256 */
927 PcVideoSetBiosMode((UCHAR)NewMode);
928 ScreenWidth = 320;
929 ScreenHeight = 200;
930 BytesPerScanLine = 320;
931 BiosVideoMode = NewMode;
933
934 return TRUE;
935 }
936 else
937 {
938 /* VESA Text/Graphics Mode */
940 return FALSE;
941
942 if (!PcVideoSetBiosVesaMode(NewMode))
943 return FALSE;
944
948 BiosVideoMode = NewMode;
949 DisplayMode = (0x0108 <= NewMode && NewMode <= 0x010C) ? VideoTextMode : VideoGraphicsMode;
951
952 return TRUE;
953 }
954
955 return FALSE;
956}
957
958static VOID
960{
961 REGS Regs;
962
963 /* Int 10h AX=1003h
964 * VIDEO - TOGGLE INTENSITY/BLINKING BIT (Jr, PS, TANDY 1000, EGA, VGA)
965 *
966 * AX = 1003h
967 * BL = new state
968 * 00h background intensity enabled
969 * 01h blink enabled
970 * BH = 00h to avoid problems on some adapters
971 * Return:
972 * Nothing
973 *
974 * Note: although there is no function to get
975 * the current status, bit 5 of 0040h:0065h
976 * indicates the state.
977 */
978 Regs.w.ax = 0x1003;
979 Regs.w.bx = Enable ? 0x0001 : 0x0000;
980 Int386(0x10, &Regs, &Regs);
981}
982
983static VOID
985{
986 REGS Regs;
987
988 if (CurrentMemoryBank == BankNumber)
989 return;
990
991 /* Int 10h AX=4F05h
992 * VESA SuperVGA BIOS - CPU VIDEO MEMORY CONTROL
993 *
994 * AX = 4F05h
995 * BH = subfunction
996 * 00h select video memory window
997 * 01h get video memory window
998 * DX = window address in video memory (in granularity units)
999 * Return:
1000 * DX = window address in video memory (in gran. units)
1001 * BL = window number
1002 * 00h window A
1003 * 01h window B.
1004 * Return:
1005 * AL = 4Fh if function supported
1006 * AH = status
1007 * 00h successful
1008 * 01h failed
1009 */
1010 Regs.w.ax = 0x4F05;
1011 Regs.w.bx = 0x0000;
1012 Regs.w.dx = BankNumber;
1013 Int386(0x10, &Regs, &Regs);
1014
1015 if (Regs.w.ax == 0x004F)
1016 CurrentMemoryBank = BankNumber;
1017}
1018
1019VOID
1021{
1022 /* Detect the installed video card */
1024
1025 /* Retrieve the initial display mode parameters */
1027
1028 /* If any video options have been specified, try to set a display mode */
1031
1032 // FIXME: We don't support graphics modes yet!
1033 // Revert to 80x25 text mode.
1036}
1037
1038#define TRACE_printf(Format, ...) \
1039do { \
1040 TRACE(Format, ##__VA_ARGS__); \
1041 printf(Format, ##__VA_ARGS__); \
1042} while (0)
1043
1046{
1048
1049 if (!DisplayModeName || *DisplayModeName == '\0')
1050 goto Quit;
1051
1053 {
1054 TRACE_printf("CGA or other display adapter detected.\n");
1055 TRACE_printf("Using 80x25 text mode.\n");
1057 }
1058 else if (VideoCard == VIDEOCARD_EGA)
1059 {
1060 TRACE_printf("EGA display adapter detected.\n");
1061 TRACE_printf("Using 80x25 text mode.\n");
1063 }
1064 else /* VIDEOCARD_VGA */
1065 {
1066 TRACE_printf("VGA display adapter detected.\n");
1067
1068 /* Get the video option separator, if any */
1069 size_t NameLen = strcspn(DisplayModeName, ",");
1070 if (!NameLen)
1071 goto Quit;
1072
1073 if (_strnicmp(DisplayModeName, "NORMAL_VGA", NameLen) == 0)
1075 else if (_strnicmp(DisplayModeName, "EXTENDED_VGA", NameLen) == 0)
1077 else
1078 VideoMode = (USHORT)strtoul(DisplayModeName, NULL, 0);
1079 }
1080
1082 {
1083 TRACE_printf("Error: unable to set video display mode 0x%x\n", VideoMode);
1084 TRACE_printf("Defaulting to 80x25 text mode.\n");
1085 printf("Press any key to continue.\n");
1086 PcConsGetCh();
1087
1089 }
1090
1091Quit:
1093 return DisplayMode;
1094}
1095
1096VOID
1098{
1099 *Width = ScreenWidth;
1102 {
1104 {
1105 /* 16-bit color modes give green an extra bit (5:6:5)
1106 * 15-bit color modes have just 5:5:5 for R:G:B */
1107 *Depth = (VesaVideoModeInformation.GreenMaskSize == 6 ? 16 : 15);
1108 }
1109 else
1110 {
1112 }
1113 }
1114 else
1115 {
1116 *Depth = 0;
1117 }
1118}
1119
1120ULONG
1122{
1124}
1125
1126VOID
1128{
1129 REGS BiosRegs;
1130
1131 /* Get the address of the BIOS ROM fonts.
1132 * Int 10h, AX=1130h, BH = pointer specifier
1133 * Returns: es:bp = address */
1134 BiosRegs.d.eax = 0x1130;
1135 BiosRegs.b.bh = ROM_8x14CharacterFont;
1136 Int386(0x10, &BiosRegs, &BiosRegs);
1137 RomFontPointers[0] = BiosRegs.w.es << 4 | BiosRegs.w.bp;
1138
1139 BiosRegs.b.bh = ROM_8x8DoubleDotFontLo;
1140 Int386(0x10, &BiosRegs, &BiosRegs);
1141 RomFontPointers[1] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1142
1143 BiosRegs.b.bh = ROM_8x8DoubleDotFontHi;
1144 Int386(0x10, &BiosRegs, &BiosRegs);
1145 RomFontPointers[2] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1146
1147 BiosRegs.b.bh = ROM_AlphaAlternate;
1148 Int386(0x10, &BiosRegs, &BiosRegs);
1149 RomFontPointers[3] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1150
1151 BiosRegs.b.bh = ROM_8x16Font;
1152 Int386(0x10, &BiosRegs, &BiosRegs);
1153 RomFontPointers[4] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1154
1155 BiosRegs.b.bh = ROM_Alternate9x16Font;
1156 Int386(0x10, &BiosRegs, &BiosRegs);
1157 RomFontPointers[5] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1158}
1159
1160VOID
1162{
1163 REGS Regs;
1164
1165 /* Int 10h AH=02h
1166 * VIDEO - SET CURSOR POSITION
1167 *
1168 * AH = 02h
1169 * BH = page number
1170 * 0-3 in modes 2&3
1171 * 0-7 in modes 0&1
1172 * 0 in graphics modes
1173 * DH = row (00h is top)
1174 * DL = column (00h is left)
1175 * Return:
1176 * Nothing
1177 */
1178 Regs.b.ah = 0x02;
1179 Regs.b.bh = 0x00;
1180 Regs.b.dh = Y;
1181 Regs.b.dl = X;
1182 Int386(0x10, &Regs, &Regs);
1183}
1184
1185VOID
1187{
1188 if (Show)
1189 PcVideoDefineCursor(0x0D, 0x0E);
1190 else
1191 PcVideoDefineCursor(0x20, 0x00);
1192}
1193
1194VOID
1196{
1197 USHORT BanksToCopy;
1198 ULONG BytesInLastBank;
1199 USHORT CurrentBank;
1200 ULONG BankSize;
1201
1202 /* PcVideoWaitForVerticalRetrace(); */
1203
1204 /* Text mode (BIOS or VESA) */
1206 {
1208 }
1209 /* VESA graphics mode */
1211 {
1215
1216 /* Copy all the banks but the last one because
1217 * it is probably a partial bank */
1218 for (CurrentBank = 0; CurrentBank < BanksToCopy; CurrentBank++)
1219 {
1220 PcVideoSetMemoryBank(CurrentBank);
1221 RtlCopyMemory((PVOID)VIDEOVGA_MEM_ADDRESS, (char*)Buffer + CurrentBank * BankSize, BankSize);
1222 }
1223
1224 /* Copy the remaining bytes into the last bank */
1225 PcVideoSetMemoryBank(CurrentBank);
1226 RtlCopyMemory((PVOID)VIDEOVGA_MEM_ADDRESS, (char*)Buffer + CurrentBank * BankSize, BytesInLastBank);
1227 }
1228 /* BIOS graphics mode */
1229 else
1230 {
1232 }
1233}
1234
1235VOID
1237{
1238 USHORT AttrChar;
1239 USHORT *BufPtr;
1240
1241 AttrChar = ((USHORT)Attr << 8) | ' ';
1242 for (BufPtr = (USHORT*)VIDEOTEXT_MEM_ADDRESS;
1244 BufPtr++)
1245 {
1247 *BufPtr = AttrChar;
1248 }
1249}
1250
1251VOID
1252PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
1253{
1254 USHORT *BufPtr;
1255
1256 BufPtr = (USHORT*)(ULONG_PTR)(VIDEOTEXT_MEM_ADDRESS + Y * BytesPerScanLine + X * 2);
1257 *BufPtr = ((USHORT)Attr << 8) | (Ch & 0xff);
1258}
1259
1260BOOLEAN
1262{
1263 return FALSE;
1264}
1265
1266VOID
1268{
1273}
1274
1275VOID
1277{
1282}
1283
1284VOID
1286{
1288 {
1289 /*
1290 * Keep reading the port until bit 3 is clear
1291 * This waits for the current retrace to end and
1292 * we can catch the next one so we know we are
1293 * getting a full retrace.
1294 */
1295 }
1296
1298 {
1299 /*
1300 * Keep reading the port until bit 3 is set
1301 * Now that we know we aren't doing a vertical
1302 * retrace we need to wait for the next one.
1303 */
1304 }
1305}
1306
1307VOID
1309{
1310 // PcVideoSetMode80x50_80x43();
1313}
1314
1315/* EOF */
unsigned char BOOLEAN
#define RomFontPointers
Definition: winldr.c:348
@ Reserved2
Definition: bcd.h:202
@ Green
Definition: bl.h:199
@ Red
Definition: bl.h:201
@ Blue
Definition: bl.h:198
#define CRTC
Definition: blue.h:111
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
@ VideoTextMode
Definition: machine.h:35
@ VideoGraphicsMode
Definition: machine.h:36
enum tagVIDEODISPLAYMODE VIDEODISPLAYMODE
BOOTMGRINFO BootMgrInfo
Definition: settings.c:19
#define COLOR_GRAY
Definition: ui.h:335
Definition: bufpool.h:45
struct _VideoMode VideoMode
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define Y(I)
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
_ACRTIMP __msvcrt_ulong __cdecl strtoul(const char *, char **, int)
Definition: string.c:1859
_ACRTIMP size_t __cdecl strcspn(const char *, const char *)
Definition: string.c:3493
#define printf
Definition: freeldr.h:97
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
#define X(b, s)
_In_ ULONG Mode
Definition: hubbusif.h:303
#define C_ASSERT(e)
Definition: intsafe.h:73
#define ASSERT(a)
Definition: mode.c:44
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
int __cdecl Int386(int ivec, REGS *in, REGS *out)
int PcConsGetCh(void)
Definition: pccons.c:84
#define VIDEOPORT_PALETTE_WRITE
Definition: pcvideo.c:26
static BOOLEAN PcVideoGetBiosMode(_Out_ PUSHORT Mode)
Definition: pcvideo.c:333
#define VIDEOCARD_VGA
Definition: pcvideo.c:36
#define VIDEOMODE_80X28
Definition: pcvideo.c:40
#define VIDEOCARD_CGA_OR_OTHER
Definition: pcvideo.c:34
VOID PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: pcvideo.c:1161
static SVGA_MODE_INFORMATION VesaVideoModeInformation
Definition: pcvideo.c:121
VOID PcVideoPrepareForReactOS(VOID)
Definition: pcvideo.c:1308
struct SVGA_MODE_INFORMATION * PSVGA_MODE_INFORMATION
static BOOLEAN PcVideoSetMode80x34(VOID)
Definition: pcvideo.c:833
static ULONG ScreenWidth
Definition: pcvideo.c:116
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:31
@ INT43hFont
Definition: pcvideo.c:127
@ UltraVision_8x20Font
Definition: pcvideo.c:134
@ ROM_AlphaAlternate
Definition: pcvideo.c:131
@ ROM_8x16Font
Definition: pcvideo.c:132
@ ROM_8x14CharacterFont
Definition: pcvideo.c:128
@ INT1FhFont
Definition: pcvideo.c:126
@ UltraVision_8x10Font
Definition: pcvideo.c:135
@ ROM_8x8DoubleDotFontHi
Definition: pcvideo.c:130
@ ROM_8x8DoubleDotFontLo
Definition: pcvideo.c:129
@ ROM_Alternate9x16Font
Definition: pcvideo.c:133
#define VIDEOMODE_80X34
Definition: pcvideo.c:42
BOOLEAN PcVideoIsPaletteFixed(VOID)
Definition: pcvideo.c:1261
#define TRACE_printf(Format,...)
Definition: pcvideo.c:1038
static VOID PcVideoDisableCursorEmulation(VOID)
Definition: pcvideo.c:613
VOID PcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: pcvideo.c:1267
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:770
#define VIDEOPORT_PALETTE_READ
Definition: pcvideo.c:25
VOID PcVideoSync(VOID)
Definition: pcvideo.c:1285
static VOID PcVideoSetFont8x8(VOID)
Definition: pcvideo.c:553
#define VIDEOPORT_PALETTE_DATA
Definition: pcvideo.c:27
static ULONG ScreenHeight
Definition: pcvideo.c:117
static ULONG PcVideoDetectVideoCard(VOID)
Definition: pcvideo.c:139
static ULONG CurrentMemoryBank
Definition: pcvideo.c:122
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:119
static VOID PcVideoSetVerticalResolution(UCHAR VerticalResolutionMode)
Definition: pcvideo.c:674
VOID PcVideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: pcvideo.c:1127
#define VIDEOTEXT_MEM_SIZE
Definition: pcvideo.c:32
#define VIDEOMODE_80X43
Definition: pcvideo.c:43
#define VIDEOMODE_NORMAL_TEXT
Definition: pcvideo.c:38
VOID PcVideoInit(VOID)
Definition: pcvideo.c:1020
static ULONG VideoCard
Definition: pcvideo.c:114
static VOID PcVideoSetDisplayEnd(VOID)
Definition: pcvideo.c:753
static ULONG BytesPerScanLine
Definition: pcvideo.c:118
static BOOLEAN PcVideoSetMode80x60(VOID)
Definition: pcvideo.c:862
#define VERTRES_200_SCANLINES
Definition: pcvideo.c:50
static VOID PcVideoSet480ScanLines(VOID)
Definition: pcvideo.c:701
static BOOLEAN PcVideoSetMode80x30(VOID)
Definition: pcvideo.c:822
#define VIDEOMODE_80X60
Definition: pcvideo.c:44
#define VIDEOPORT_VERTICAL_RETRACE
Definition: pcvideo.c:28
#define VIDEOMODE_80X30
Definition: pcvideo.c:41
static BOOLEAN PcVideoSetMode(USHORT NewMode)
Definition: pcvideo.c:878
#define VIDEOMODE_EXTENDED_TEXT
Definition: pcvideo.c:39
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:638
UCHAR MachDefaultTextColor
Definition: pcvideo.c:112
static VOID PcVideoSetBiosMode(UCHAR VideoMode)
Definition: pcvideo.c:531
static BOOLEAN PcVideoVesaGetSVGAModeInformation(_In_ USHORT Mode, _Out_ PSVGA_MODE_INFORMATION ModeInformation)
Definition: pcvideo.c:206
static BOOLEAN PcVideoSetMode80x43(VOID)
Definition: pcvideo.c:847
static VOID PcVideoSetFont8x14(VOID)
Definition: pcvideo.c:571
#define VIDEOVGA_MEM_ADDRESS
Definition: pcvideo.c:30
static BOOLEAN VesaVideoMode
Definition: pcvideo.c:120
static VOID PcVideoSetMemoryBank(USHORT BankNumber)
Definition: pcvideo.c:984
static BOOLEAN PcVideoSetBiosVesaMode(USHORT Mode)
Definition: pcvideo.c:465
VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: pcvideo.c:1097
static VOID PcVideoSelectAlternatePrintScreen(VOID)
Definition: pcvideo.c:589
#define VERTRES_350_SCANLINES
Definition: pcvideo.c:51
VOID PcVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: pcvideo.c:1276
VIDEODISPLAYMODE PcVideoSetDisplayMode(PCSTR DisplayModeName, BOOLEAN Init)
Definition: pcvideo.c:1045
static BOOLEAN PcVideoSetMode80x50_80x43(VOID)
Definition: pcvideo.c:779
ULONG PcVideoGetBufferSize(VOID)
Definition: pcvideo.c:1121
VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: pcvideo.c:1252
static VOID PcVideoGetDisplayMode(VOID)
Definition: pcvideo.c:380
VOID PcVideoClearScreen(UCHAR Attr)
Definition: pcvideo.c:1236
#define VERTRES_400_SCANLINES
Definition: pcvideo.c:52
static BOOLEAN PcVideoSetMode80x28(VOID)
Definition: pcvideo.c:810
VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: pcvideo.c:1195
static BOOLEAN PcVideoVesaGetCurrentSVGAMode(_Out_ PUSHORT Mode)
Definition: pcvideo.c:297
#define VIDEOCARD_EGA
Definition: pcvideo.c:35
static VOID PcVideoSetBlinkBit(BOOLEAN Enable)
Definition: pcvideo.c:959
VOID PcVideoHideShowTextCursor(BOOLEAN Show)
Definition: pcvideo.c:1186
static USHORT BiosVideoMode
Definition: pcvideo.c:115
unsigned short USHORT
Definition: pedump.c:61
#define Ch(x, y, z)
Definition: sha2.c:141
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char bl
Definition: pcbios.h:136
unsigned char ch
Definition: pcbios.h:140
unsigned char dl
Definition: pcbios.h:142
unsigned char cl
Definition: pcbios.h:139
unsigned char al
Definition: pcbios.h:133
unsigned char ah
Definition: pcbios.h:134
unsigned char dh
Definition: pcbios.h:143
unsigned char bh
Definition: pcbios.h:137
unsigned long eax
Definition: pcbios.h:93
UCHAR LinearRedMaskSize
Definition: pcvideo.c:98
UCHAR ReservedMaskPosition
Definition: pcvideo.c:86
USHORT HeightInPixels
Definition: pcvideo.c:68
UCHAR GreenMaskPosition
Definition: pcvideo.c:82
UCHAR BlueMaskPosition
Definition: pcvideo.c:84
UCHAR BankedNumberOfImages
Definition: pcvideo.c:96
USHORT WindowAStartSegment
Definition: pcvideo.c:62
UCHAR CharacterHeightInPixels
Definition: pcvideo.c:70
UCHAR DirectColorModeInfo
Definition: pcvideo.c:87
USHORT LinearBytesPerScanLine
Definition: pcvideo.c:95
UCHAR NumberOfMemoryPlanes
Definition: pcvideo.c:71
USHORT BytesPerScanLine
Definition: pcvideo.c:65
UCHAR WindowsAttributesB
Definition: pcvideo.c:59
ULONG OffscreenMemoryPointer
Definition: pcvideo.c:92
UCHAR WindowAttributesA
Definition: pcvideo.c:58
UCHAR LinearBlueMaskPosition
Definition: pcvideo.c:103
UCHAR LinearBlueMaskSize
Definition: pcvideo.c:102
USHORT OffscreenMemorySize
Definition: pcvideo.c:93
USHORT WidthInPixels
Definition: pcvideo.c:67
ULONG WindowPositioningFunction
Definition: pcvideo.c:64
UCHAR LinearReservedMaskPosition
Definition: pcvideo.c:105
USHORT WindowGranularity
Definition: pcvideo.c:60
UCHAR LinearGreenMaskSize
Definition: pcvideo.c:100
UCHAR CharacterWidthInPixels
Definition: pcvideo.c:69
UCHAR LinearRedMaskPosition
Definition: pcvideo.c:99
ULONG LinearVideoBufferAddress
Definition: pcvideo.c:91
USHORT WindowBStartSegment
Definition: pcvideo.c:63
UCHAR ReservedMaskSize
Definition: pcvideo.c:85
UCHAR NumberOfImagePanes
Definition: pcvideo.c:76
UCHAR LinearGreenMaskPosition
Definition: pcvideo.c:101
UCHAR LinearReservedMaskSize
Definition: pcvideo.c:104
UCHAR LinearNumberOfImages
Definition: pcvideo.c:97
USHORT ModeAttributes
Definition: pcvideo.c:57
Definition: ui.h:200
unsigned short bp
Definition: pcbios.h:120
unsigned short es
Definition: pcbios.h:123
unsigned short di
Definition: pcbios.h:119
unsigned short cx
Definition: pcbios.h:115
unsigned short dx
Definition: pcbios.h:116
unsigned short bx
Definition: pcbios.h:114
unsigned short ax
Definition: pcbios.h:113
PCSTR VideoOptions
Definition: settings.h:13
#define __WARNING_DEREF_NULL_PTR
Definition: suppress.h:32
#define _PRAGMA_WARNING_SUPPRESS(x)
Definition: suppress.h:28
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t * PULONG
Definition: typedefs.h:59
uint16_t * PUSHORT
Definition: typedefs.h:56
const char * PCSTR
Definition: typedefs.h:52
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
Definition: pcbios.h:161
DWORDREGS d
Definition: pcbios.h:163
BYTEREGS b
Definition: pcbios.h:165
WORDREGS w
Definition: pcbios.h:164
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
#define BIOSCALLBUFSEGMENT
Definition: x86common.h:24
#define BIOSCALLBUFOFFSET
Definition: x86common.h:25
#define BIOSCALLBUFFER
Definition: x86common.h:12
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:819
unsigned char UCHAR
Definition: xmlstorage.h:181