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