ReactOS  0.4.13-dev-257-gfabbd7c
pcvideo.c File Reference
#include <freeldr.h>
#include <suppress.h>
#include <debug.h>
#include <pshpack2.h>
#include <poppack.h>
Include dependency graph for pcvideo.c:

Go to the source code of this file.

Classes

struct  SVGA_MODE_INFORMATION
 

Macros

#define VIDEOPORT_PALETTE_READ   0x03C7
 
#define VIDEOPORT_PALETTE_WRITE   0x03C8
 
#define VIDEOPORT_PALETTE_DATA   0x03C9
 
#define VIDEOPORT_VERTICAL_RETRACE   0x03DA
 
#define VIDEOVGA_MEM_ADDRESS   0xA0000
 
#define VIDEOTEXT_MEM_ADDRESS   0xB8000
 
#define VIDEOTEXT_MEM_SIZE   0x8000
 
#define VIDEOCARD_CGA_OR_OTHER   0
 
#define VIDEOCARD_EGA   1
 
#define VIDEOCARD_VGA   2
 
#define VIDEOMODE_NORMAL_TEXT   0
 
#define VIDEOMODE_EXTENDED_TEXT   1
 
#define VIDEOMODE_80X28   0x501C
 
#define VIDEOMODE_80X30   0x501E
 
#define VIDEOMODE_80X34   0x5022
 
#define VIDEOMODE_80X43   0x502B
 
#define VIDEOMODE_80X60   0x503C
 
#define VIDEOMODE_132X25   0x8419
 
#define VIDEOMODE_132X43   0x842B
 
#define VIDEOMODE_132X50   0x8432
 
#define VIDEOMODE_132X60   0x843C
 
#define VERTRES_200_SCANLINES   0x00
 
#define VERTRES_350_SCANLINES   0x01
 
#define VERTRES_400_SCANLINES   0x02
 

Typedefs

typedef struct SVGA_MODE_INFORMATIONPSVGA_MODE_INFORMATION
 

Functions

 DBG_DEFAULT_CHANNEL (UI)
 
static ULONG PcVideoDetectVideoCard (VOID)
 
static VOID PcVideoSetBiosMode (UCHAR VideoMode)
 
static VOID PcVideoSetFont8x8 (VOID)
 
static VOID PcVideoSetFont8x14 (VOID)
 
static VOID PcVideoSelectAlternatePrintScreen (VOID)
 
static VOID PcVideoDisableCursorEmulation (VOID)
 
static VOID PcVideoDefineCursor (UCHAR StartScanLine, UCHAR EndScanLine)
 
static VOID PcVideoSetVerticalResolution (UCHAR VerticalResolutionMode)
 
static VOID PcVideoSet480ScanLines (VOID)
 
static VOID PcVideoSetDisplayEnd (VOID)
 
static BOOLEAN PcVideoVesaGetSVGAModeInformation (USHORT Mode, PSVGA_MODE_INFORMATION ModeInformation)
 
static BOOLEAN PcVideoSetBiosVesaMode (USHORT Mode)
 
static BOOLEAN PcVideoSetMode80x25 (VOID)
 
static BOOLEAN PcVideoSetMode80x50_80x43 (VOID)
 
static BOOLEAN PcVideoSetMode80x28 (VOID)
 
static BOOLEAN PcVideoSetMode80x30 (VOID)
 
static BOOLEAN PcVideoSetMode80x34 (VOID)
 
static BOOLEAN PcVideoSetMode80x43 (VOID)
 
static BOOLEAN PcVideoSetMode80x60 (VOID)
 
static BOOLEAN PcVideoSetMode (USHORT NewMode)
 
static VOID PcVideoSetBlinkBit (BOOLEAN Enable)
 
static VOID PcVideoSetMemoryBank (USHORT BankNumber)
 
VIDEODISPLAYMODE PcVideoSetDisplayMode (char *DisplayModeName, BOOLEAN Init)
 
VOID PcVideoGetDisplaySize (PULONG Width, PULONG Height, PULONG Depth)
 
ULONG PcVideoGetBufferSize (VOID)
 
VOID PcVideoSetTextCursorPosition (UCHAR X, UCHAR Y)
 
VOID PcVideoHideShowTextCursor (BOOLEAN Show)
 
VOID PcVideoCopyOffScreenBufferToVRAM (PVOID Buffer)
 
VOID PcVideoClearScreen (UCHAR Attr)
 
VOID PcVideoPutChar (int Ch, UCHAR Attr, unsigned X, unsigned Y)
 
BOOLEAN PcVideoIsPaletteFixed (VOID)
 
VOID PcVideoSetPaletteColor (UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
 
VOID PcVideoGetPaletteColor (UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
 
VOID PcVideoSync (VOID)
 
VOID PcVideoPrepareForReactOS (IN BOOLEAN Setup)
 

Variables

static USHORT BiosVideoMode
 
static ULONG ScreenWidth = 80
 
static ULONG ScreenHeight = 25
 
static ULONG BytesPerScanLine = 160
 
static VIDEODISPLAYMODE DisplayMode = VideoTextMode
 
static BOOLEAN VesaVideoMode = FALSE
 
static SVGA_MODE_INFORMATION VesaVideoModeInformation
 
static ULONG CurrentMemoryBank = 0
 

Macro Definition Documentation

◆ VERTRES_200_SCANLINES

#define VERTRES_200_SCANLINES   0x00

Definition at line 49 of file pcvideo.c.

◆ VERTRES_350_SCANLINES

#define VERTRES_350_SCANLINES   0x01

Definition at line 50 of file pcvideo.c.

◆ VERTRES_400_SCANLINES

#define VERTRES_400_SCANLINES   0x02

Definition at line 51 of file pcvideo.c.

◆ VIDEOCARD_CGA_OR_OTHER

#define VIDEOCARD_CGA_OR_OTHER   0

Definition at line 33 of file pcvideo.c.

◆ VIDEOCARD_EGA

#define VIDEOCARD_EGA   1

Definition at line 34 of file pcvideo.c.

◆ VIDEOCARD_VGA

#define VIDEOCARD_VGA   2

Definition at line 35 of file pcvideo.c.

◆ VIDEOMODE_132X25

#define VIDEOMODE_132X25   0x8419

Definition at line 44 of file pcvideo.c.

◆ VIDEOMODE_132X43

#define VIDEOMODE_132X43   0x842B

Definition at line 45 of file pcvideo.c.

◆ VIDEOMODE_132X50

#define VIDEOMODE_132X50   0x8432

Definition at line 46 of file pcvideo.c.

◆ VIDEOMODE_132X60

#define VIDEOMODE_132X60   0x843C

Definition at line 47 of file pcvideo.c.

◆ VIDEOMODE_80X28

#define VIDEOMODE_80X28   0x501C

Definition at line 39 of file pcvideo.c.

◆ VIDEOMODE_80X30

#define VIDEOMODE_80X30   0x501E

Definition at line 40 of file pcvideo.c.

◆ VIDEOMODE_80X34

#define VIDEOMODE_80X34   0x5022

Definition at line 41 of file pcvideo.c.

◆ VIDEOMODE_80X43

#define VIDEOMODE_80X43   0x502B

Definition at line 42 of file pcvideo.c.

◆ VIDEOMODE_80X60

#define VIDEOMODE_80X60   0x503C

Definition at line 43 of file pcvideo.c.

◆ VIDEOMODE_EXTENDED_TEXT

#define VIDEOMODE_EXTENDED_TEXT   1

Definition at line 38 of file pcvideo.c.

◆ VIDEOMODE_NORMAL_TEXT

#define VIDEOMODE_NORMAL_TEXT   0

Definition at line 37 of file pcvideo.c.

◆ VIDEOPORT_PALETTE_DATA

#define VIDEOPORT_PALETTE_DATA   0x03C9

Definition at line 26 of file pcvideo.c.

◆ VIDEOPORT_PALETTE_READ

#define VIDEOPORT_PALETTE_READ   0x03C7

Definition at line 24 of file pcvideo.c.

◆ VIDEOPORT_PALETTE_WRITE

#define VIDEOPORT_PALETTE_WRITE   0x03C8

Definition at line 25 of file pcvideo.c.

◆ VIDEOPORT_VERTICAL_RETRACE

#define VIDEOPORT_VERTICAL_RETRACE   0x03DA

Definition at line 27 of file pcvideo.c.

◆ VIDEOTEXT_MEM_ADDRESS

#define VIDEOTEXT_MEM_ADDRESS   0xB8000

Definition at line 30 of file pcvideo.c.

◆ VIDEOTEXT_MEM_SIZE

#define VIDEOTEXT_MEM_SIZE   0x8000

Definition at line 31 of file pcvideo.c.

◆ VIDEOVGA_MEM_ADDRESS

#define VIDEOVGA_MEM_ADDRESS   0xA0000

Definition at line 29 of file pcvideo.c.

Typedef Documentation

◆ PSVGA_MODE_INFORMATION

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UI  )

◆ PcVideoClearScreen()

VOID PcVideoClearScreen ( UCHAR  Attr)

Definition at line 1040 of file pcvideo.c.

1041 {
1042  USHORT AttrChar;
1043  USHORT *BufPtr;
1044 
1045  AttrChar = ((USHORT) Attr << 8) | ' ';
1046  for (BufPtr = (USHORT *) VIDEOTEXT_MEM_ADDRESS;
1048  BufPtr++)
1049  {
1051  *BufPtr = AttrChar;
1052  }
1053 }
#define VIDEOTEXT_MEM_SIZE
Definition: pcvideo.c:31
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:30
#define __WARNING_DEREF_NULL_PTR
Definition: suppress.h:32
unsigned short USHORT
Definition: pedump.c:61
#define _PRAGMA_WARNING_SUPPRESS(x)
Definition: suppress.h:28

Referenced by PcMachInit().

◆ PcVideoCopyOffScreenBufferToVRAM()

VOID PcVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 999 of file pcvideo.c.

1000 {
1001  USHORT BanksToCopy;
1002  ULONG BytesInLastBank;
1003  USHORT CurrentBank;
1004  ULONG BankSize;
1005 
1006  /* PcVideoWaitForVerticalRetrace(); */
1007 
1008  /* Text mode (BIOS or VESA) */
1009  if (VideoTextMode == DisplayMode)
1010  {
1012  }
1013  /* VESA graphics mode */
1015  {
1019 
1020  /* Copy all the banks but the last one because
1021  * it is probably a partial bank */
1022  for (CurrentBank = 0; CurrentBank < BanksToCopy; CurrentBank++)
1023  {
1024  PcVideoSetMemoryBank(CurrentBank);
1025  RtlCopyMemory((PVOID) VIDEOVGA_MEM_ADDRESS, (char *) Buffer + CurrentBank * BankSize, BankSize);
1026  }
1027 
1028  /* Copy the remaining bytes into the last bank */
1029  PcVideoSetMemoryBank(CurrentBank);
1030  RtlCopyMemory((PVOID)VIDEOVGA_MEM_ADDRESS, (char *) Buffer + CurrentBank * BankSize, BytesInLastBank);
1031  }
1032  /* BIOS graphics mode */
1033  else
1034  {
1035  UNIMPLEMENTED;
1036  }
1037 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
static SVGA_MODE_INFORMATION VesaVideoModeInformation
Definition: pcvideo.c:118
static BOOLEAN VesaVideoMode
Definition: pcvideo.c:117
#define VIDEOVGA_MEM_ADDRESS
Definition: pcvideo.c:29
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:30
static VOID PcVideoSetMemoryBank(USHORT BankNumber)
Definition: pcvideo.c:835
Definition: bufpool.h:45
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:116
USHORT BytesPerScanLine
Definition: pcvideo.c:66
unsigned short USHORT
Definition: pedump.c:61
USHORT WindowGranularity
Definition: pcvideo.c:61
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:114
USHORT HeightInPixels
Definition: pcvideo.c:69
ULONG PcVideoGetBufferSize(VOID)
Definition: pcvideo.c:955

Referenced by PcMachInit().

◆ PcVideoDefineCursor()

static VOID PcVideoDefineCursor ( UCHAR  StartScanLine,
UCHAR  EndScanLine 
)
static

Definition at line 302 of file pcvideo.c.

303 {
304  REGS Regs;
305 
306  /* Int 10h AH=01h
307  * VIDEO - SET TEXT-MODE CURSOR SHAPE
308  *
309  * AH = 01h
310  * CH = cursor start and options
311  * CL = bottom scan line containing cursor (bits 0-4)
312  * Return:
313  * Nothing
314  *
315  * Specify the starting and ending scan lines to be occupied
316  * by the hardware cursor in text modes.
317  *
318  * AMI 386 BIOS and AST Premier 386 BIOS will lock up the
319  * system if AL is not equal to the current video mode.
320  *
321  * Bitfields for cursor start and options:
322  *
323  * Bit(s) Description
324  * 7 should be zero
325  * 6,5 cursor blink
326  * (00=normal, 01=invisible, 10=erratic, 11=slow).
327  * (00=normal, other=invisible on EGA/VGA)
328  * 4-0 topmost scan line containing cursor
329  */
330  Regs.b.ah = 0x01;
331  Regs.b.al = 0x03;
332  Regs.b.ch = StartScanLine;
333  Regs.b.cl = EndScanLine;
334  Int386(0x10, &Regs, &Regs);
335 }
unsigned char ah
Definition: pcbios.h:112
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char ch
Definition: pcbios.h:118
unsigned char cl
Definition: pcbios.h:117
BYTEREGS b
Definition: pcbios.h:143
unsigned char al
Definition: pcbios.h:111
Definition: pcbios.h:138

Referenced by PcVideoHideShowTextCursor(), PcVideoSetMode80x28(), PcVideoSetMode80x34(), PcVideoSetMode80x43(), PcVideoSetMode80x50_80x43(), and PcVideoSetMode80x60().

◆ PcVideoDetectVideoCard()

static ULONG PcVideoDetectVideoCard ( VOID  )
static

Definition at line 122 of file pcvideo.c.

123 {
124  REGS Regs;
125 
126  /* Int 10h AH=12h BL=10h
127  * VIDEO - ALTERNATE FUNCTION SELECT (PS,EGA,VGA,MCGA) - GET EGA INFO
128  *
129  * AH = 12h
130  * BL = 10h
131  * Return:
132  * BH = video state
133  * 00h color mode in effect (I/O port 3Dxh)
134  * 01h mono mode in effect (I/O port 3Bxh)
135  * BL = installed memory (00h = 64K, 01h = 128K, 02h = 192K, 03h = 256K)
136  * CH = feature connector bits
137  * CL = switch settings
138  * AH destroyed (at least by Tseng ET4000 BIOS v8.00n)
139  *
140  * Installation check;EGA
141  */
142  Regs.b.ah = 0x12;
143  Regs.b.bl = 0x10;
144  Int386(0x10, &Regs, &Regs);
145 
146  /* If BL is still equal to 0x10 then there is no EGA/VGA present */
147  if (0x10 == Regs.b.bl)
148  {
149  return VIDEOCARD_CGA_OR_OTHER;
150  }
151 
152  /* Int 10h AX=1A00h
153  * VIDEO - GET DISPLAY COMBINATION CODE (PS,VGA/MCGA)
154  *
155  * AX = 1A00h
156  * Return:
157  * AL = 1Ah if function was supported
158  * BL = active display code
159  * BH = alternate display code
160  *
161  * This function is commonly used to check for the presence of a VGA.
162  *
163  * Installation check;VGA
164  *
165  * Values for display combination code:
166  * 00h no display
167  * 01h monochrome adapter w/ monochrome display
168  * 02h CGA w/ color display
169  * 03h reserved
170  * 04h EGA w/ color display
171  * 05h EGA w/ monochrome display
172  * 06h PGA w/ color display
173  * 07h VGA w/ monochrome analog display
174  * 08h VGA w/ color analog display
175  * 09h reserved
176  * 0Ah MCGA w/ digital color display
177  * 0Bh MCGA w/ monochrome analog display
178  * 0Ch MCGA w/ color analog display
179  * FFh unknown display type
180  */
181  Regs.b.ah = 0x12;
182  Regs.b.bl = 0x10;
183  Int386(0x10, &Regs, &Regs);
184 
185  if (0x1a == Regs.b.al)
186  {
187  return VIDEOCARD_VGA;
188  }
189  else
190  {
191  return VIDEOCARD_EGA;
192  }
193 }
#define VIDEOCARD_CGA_OR_OTHER
Definition: pcvideo.c:33
#define VIDEOCARD_VGA
Definition: pcvideo.c:35
unsigned char ah
Definition: pcbios.h:112
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:114
#define VIDEOCARD_EGA
Definition: pcvideo.c:34
BYTEREGS b
Definition: pcbios.h:143
unsigned char al
Definition: pcbios.h:111
Definition: pcbios.h:138

Referenced by PcVideoSetDisplayMode(), and PcVideoSetMode80x50_80x43().

◆ PcVideoDisableCursorEmulation()

static VOID PcVideoDisableCursorEmulation ( VOID  )
static

Definition at line 277 of file pcvideo.c.

278 {
279  REGS Regs;
280 
281  /* Int 10h AH=12h BL=34h
282  * VIDEO - ALTERNATE FUNCTION SELECT (VGA) - CURSOR EMULATION
283  *
284  * AH = 12h
285  * BL = 34h
286  * AL = new state
287  * 00h enable alphanumeric cursor emulation
288  * 01h disable alphanumeric cursor emulation
289  * Return:
290  * AL = 12h if function supported
291  *
292  * Specify whether the BIOS should automatically remap cursor start/end
293  * according to the current character height in text modes.
294  */
295  Regs.b.ah = 0x12;
296  Regs.b.bl = 0x34;
297  Regs.b.al = 0x01;
298  Int386(0x10, &Regs, &Regs);
299 }
unsigned char ah
Definition: pcbios.h:112
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:114
BYTEREGS b
Definition: pcbios.h:143
unsigned char al
Definition: pcbios.h:111
Definition: pcbios.h:138

Referenced by PcVideoSetMode80x43(), PcVideoSetMode80x50_80x43(), and PcVideoSetMode80x60().

◆ PcVideoGetBufferSize()

ULONG PcVideoGetBufferSize ( VOID  )

Definition at line 955 of file pcvideo.c.

956 {
958 }
static ULONG ScreenHeight
Definition: pcvideo.c:114
static ULONG BytesPerScanLine
Definition: pcvideo.c:115

Referenced by PcMachInit(), and PcVideoCopyOffScreenBufferToVRAM().

◆ PcVideoGetDisplaySize()

VOID PcVideoGetDisplaySize ( PULONG  Width,
PULONG  Height,
PULONG  Depth 
)

Definition at line 931 of file pcvideo.c.

932 {
933  *Width = ScreenWidth;
934  *Height = ScreenHeight;
936  {
938  {
939  /* 16-bit color modes give green an extra bit (5:6:5)
940  * 15-bit color modes have just 5:5:5 for R:G:B */
941  *Depth = (6 == VesaVideoModeInformation.GreenMaskSize ? 16 : 15);
942  }
943  else
944  {
946  }
947  }
948  else
949  {
950  *Depth = 0;
951  }
952 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:656
static SVGA_MODE_INFORMATION VesaVideoModeInformation
Definition: pcvideo.c:118
static BOOLEAN VesaVideoMode
Definition: pcvideo.c:117
static ULONG ScreenHeight
Definition: pcvideo.c:114
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:116
static ULONG ScreenWidth
Definition: pcvideo.c:113

Referenced by PcMachInit().

◆ PcVideoGetPaletteColor()

VOID PcVideoGetPaletteColor ( UCHAR  Color,
UCHAR Red,
UCHAR Green,
UCHAR Blue 
)

Definition at line 1080 of file pcvideo.c.

1081 {
1086 }
Definition: bl.h:202
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:535
#define VIDEOPORT_PALETTE_READ
Definition: pcvideo.c:24
Definition: bl.h:199
Definition: bl.h:200
unsigned char UCHAR
Definition: xmlstorage.h:181
#define VIDEOPORT_PALETTE_DATA
Definition: pcvideo.c:26
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:539

Referenced by PcMachInit().

◆ PcVideoHideShowTextCursor()

VOID PcVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 986 of file pcvideo.c.

987 {
988  if (Show)
989  {
990  PcVideoDefineCursor(0x0D, 0x0E);
991  }
992  else
993  {
994  PcVideoDefineCursor(0x20, 0x00);
995  }
996 }
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:302

Referenced by PcMachInit(), and PcVideoPrepareForReactOS().

◆ PcVideoIsPaletteFixed()

BOOLEAN PcVideoIsPaletteFixed ( VOID  )

Definition at line 1065 of file pcvideo.c.

1066 {
1067  return FALSE;
1068 }

Referenced by PcMachInit().

◆ PcVideoPrepareForReactOS()

VOID PcVideoPrepareForReactOS ( IN BOOLEAN  Setup)

Definition at line 1112 of file pcvideo.c.

1113 {
1114  if (Setup)
1115  {
1117  }
1118  else
1119  {
1120  PcVideoSetBiosMode(0x12);
1121  }
1123 }
static BOOLEAN PcVideoSetMode80x50_80x43(VOID)
Definition: pcvideo.c:598
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE ACPI_ADR_SPACE_HANDLER ACPI_ADR_SPACE_SETUP Setup
Definition: acpixf.h:816
VOID PcVideoHideShowTextCursor(BOOLEAN Show)
Definition: pcvideo.c:986
static VOID PcVideoSetBiosMode(UCHAR VideoMode)
Definition: pcvideo.c:195

Referenced by PcPrepareForReactOS().

◆ PcVideoPutChar()

VOID PcVideoPutChar ( int  Ch,
UCHAR  Attr,
unsigned  X,
unsigned  Y 
)

Definition at line 1056 of file pcvideo.c.

1057 {
1058  USHORT *BufPtr;
1059 
1060  BufPtr = (USHORT *) (ULONG_PTR)(VIDEOTEXT_MEM_ADDRESS + Y * BytesPerScanLine + X * 2);
1061  *BufPtr = ((USHORT) Attr << 8) | (Ch & 0xff);
1062 }
#define Y(I)
#define Ch(x, y, z)
Definition: sha2.c:141
static ULONG BytesPerScanLine
Definition: pcvideo.c:115
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:30
unsigned short USHORT
Definition: pedump.c:61

Referenced by PcMachInit().

◆ PcVideoSelectAlternatePrintScreen()

static VOID PcVideoSelectAlternatePrintScreen ( VOID  )
static

Definition at line 253 of file pcvideo.c.

254 {
255  REGS Regs;
256 
257  /* Int 10h AH=12h BL=20h
258  * VIDEO - ALTERNATE FUNCTION SELECT (PS,EGA,VGA,MCGA) - ALTERNATE PRTSC
259  *
260  * AH = 12h
261  * BL = 20h select alternate print screen routine
262  * Return:
263  * Nothing
264  *
265  * Installs a PrtSc routine from the video card's BIOS to replace the
266  * default PrtSc handler from the ROM BIOS, which usually does not
267  * understand screen heights other than 25 lines.
268  *
269  * Some adapters disable print-screen instead of enhancing it.
270  */
271  Regs.b.ah = 0x12;
272  Regs.b.bl = 0x20;
273  Int386(0x10, &Regs, &Regs);
274 }
unsigned char ah
Definition: pcbios.h:112
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:114
BYTEREGS b
Definition: pcbios.h:143
Definition: pcbios.h:138

Referenced by PcVideoSetMode80x43(), PcVideoSetMode80x50_80x43(), and PcVideoSetMode80x60().

◆ PcVideoSet480ScanLines()

static VOID PcVideoSet480ScanLines ( VOID  )
static

Definition at line 365 of file pcvideo.c.

366 {
367  INT_PTR CRTC;
368 
369  /* Read CRTC port */
370  CRTC = READ_PORT_UCHAR((PUCHAR)0x03CC);
371 
372  if (CRTC & 1)
373  {
374  CRTC = 0x3D4;
375  }
376  else
377  {
378  CRTC = 0x3B4;
379  }
380 
381  /* Vertical sync end (also unlocks CR0-7) */
382  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x11);
383  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x0C);
384 
385  /* Vertical total */
386  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x06);
387  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x0B);
388 
389  /* (vertical) overflow */
390  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x07);
391  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x3E);
392 
393  /* Vertical sync start */
394  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x10);
395  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xEA);
396 
397  /* Vertical display end */
398  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x12);
399  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xDF);
400 
401  /* Vertical blank start */
402  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x15);
403  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xE7);
404 
405  /* Vertical blank end */
406  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x16);
407  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x04);
408 
409  /* Misc output register (read) */
410  CRTC = READ_PORT_UCHAR((PUCHAR)0x03CC);
411 
412  /* Preserve clock select bits and color bit */
413  CRTC = (CRTC & 0x0D);
414  /* Set correct sync polarity */
415  CRTC = (CRTC | 0xE2);
416 
417  /* (write) */
418  WRITE_PORT_UCHAR((PUCHAR)0x03C2, (UCHAR)CRTC);
419 }
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:535
int32_t INT_PTR
Definition: typedefs.h:62
unsigned char UCHAR
Definition: xmlstorage.h:181
#define CRTC
Definition: blue.h:123
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:539

Referenced by PcVideoSetMode80x30(), PcVideoSetMode80x34(), and PcVideoSetMode80x60().

◆ PcVideoSetBiosMode()

static VOID PcVideoSetBiosMode ( UCHAR  VideoMode)
static

Definition at line 195 of file pcvideo.c.

196 {
197  REGS Regs;
198 
199  /* Int 10h AH=00h
200  * VIDEO - SET VIDEO MODE
201  *
202  * AH = 00h
203  * AL = desired video mode
204  * Return:
205  * AL = video mode flag (Phoenix, AMI BIOS)
206  * 20h mode > 7
207  * 30h modes 0-5 and 7
208  * 3Fh mode 6
209  * AL = CRT controller mode byte (Phoenix 386 BIOS v1.10)
210  */
211  Regs.b.ah = 0x00;
212  Regs.b.al = VideoMode;
213  Int386(0x10, &Regs, &Regs);
214 }
unsigned char ah
Definition: pcbios.h:112
int __cdecl Int386(int ivec, REGS *in, REGS *out)
struct _VideoMode VideoMode
BYTEREGS b
Definition: pcbios.h:143
unsigned char al
Definition: pcbios.h:111
Definition: pcbios.h:138

Referenced by PcVideoPrepareForReactOS(), PcVideoSetMode(), PcVideoSetMode80x25(), and PcVideoSetMode80x50_80x43().

◆ PcVideoSetBiosVesaMode()

static BOOLEAN PcVideoSetBiosVesaMode ( USHORT  Mode)
static

Definition at line 516 of file pcvideo.c.

517 {
518  REGS Regs;
519 
520  /* Int 10h AX=4F02h
521  * VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE
522  *
523  * AX = 4F02h
524  * BX = new video mode
525  * ES:DI -> (VBE 3.0+) CRTC information block, bit mode bit 11 set
526  * Return:
527  * AL = 4Fh if function supported
528  * AH = status
529  * 00h successful
530  * 01h failed
531  *
532  * Values for VESA video mode:
533  * 00h-FFh OEM video modes (see #00010 at AH=00h)
534  * 100h 640x400x256
535  * 101h 640x480x256
536  * 102h 800x600x16
537  * 103h 800x600x256
538  * 104h 1024x768x16
539  * 105h 1024x768x256
540  * 106h 1280x1024x16
541  * 107h 1280x1024x256
542  * 108h 80x60 text
543  * 109h 132x25 text
544  * 10Ah 132x43 text
545  * 10Bh 132x50 text
546  * 10Ch 132x60 text
547  * ---VBE v1.2+ ---
548  * 10Dh 320x200x32K
549  * 10Eh 320x200x64K
550  * 10Fh 320x200x16M
551  * 110h 640x480x32K
552  * 111h 640x480x64K
553  * 112h 640x480x16M
554  * 113h 800x600x32K
555  * 114h 800x600x64K
556  * 115h 800x600x16M
557  * 116h 1024x768x32K
558  * 117h 1024x768x64K
559  * 118h 1024x768x16M
560  * 119h 1280x1024x32K (1:5:5:5)
561  * 11Ah 1280x1024x64K (5:6:5)
562  * 11Bh 1280x1024x16M
563  * ---VBE 2.0+ ---
564  * 120h 1600x1200x256
565  * 121h 1600x1200x32K
566  * 122h 1600x1200x64K
567  * 81FFh special full-memory access mode
568  *
569  * Notes: The special mode 81FFh preserves the contents of the video memory and gives
570  * access to all of the memory; VESA recommends that the special mode be a packed-pixel
571  * mode. For VBE 2.0+, it is required that the VBE implement the mode, but not place it
572  * in the list of available modes (mode information for this mode can be queried
573  * directly, however).. As of VBE 2.0, VESA will no longer define video mode numbers
574  */
575  Regs.w.ax = 0x4F02;
576  Regs.w.bx = Mode;
577  Int386(0x10, &Regs, &Regs);
578 
579  if (0x004F != Regs.w.ax)
580  {
581  return FALSE;
582  }
583 
584  return TRUE;
585 }
#define TRUE
Definition: types.h:120
_In_ ULONG Mode
Definition: hubbusif.h:303
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned short bx
Definition: pcbios.h:92
unsigned short ax
Definition: pcbios.h:91
Definition: pcbios.h:138
WORDREGS w
Definition: pcbios.h:142

Referenced by PcVideoSetMode().

◆ PcVideoSetBlinkBit()

static VOID PcVideoSetBlinkBit ( BOOLEAN  Enable)
static

Definition at line 810 of file pcvideo.c.

811 {
812  REGS Regs;
813 
814  /* Int 10h AX=1003h
815  * VIDEO - TOGGLE INTENSITY/BLINKING BIT (Jr, PS, TANDY 1000, EGA, VGA)
816  *
817  * AX = 1003h
818  * BL = new state
819  * 00h background intensity enabled
820  * 01h blink enabled
821  * BH = 00h to avoid problems on some adapters
822  * Return:
823  * Nothing
824  *
825  * Note: although there is no function to get
826  * the current status, bit 5 of 0040h:0065h
827  * indicates the state.
828  */
829  Regs.w.ax = 0x1003;
830  Regs.w.bx = Enable ? 0x0001 : 0x0000;
831  Int386(0x10, &Regs, &Regs);
832 }
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned short bx
Definition: pcbios.h:92
unsigned short ax
Definition: pcbios.h:91
Definition: pcbios.h:138
WORDREGS w
Definition: pcbios.h:142

Referenced by PcVideoSetDisplayMode().

◆ PcVideoSetDisplayEnd()

static VOID PcVideoSetDisplayEnd ( VOID  )
static

Definition at line 422 of file pcvideo.c.

423 {
424  INT_PTR CRTC;
425 
426  /* Read CRTC port */
427  CRTC = READ_PORT_UCHAR((PUCHAR)0x03CC);
428 
429  if (CRTC & 1)
430  {
431  CRTC = 0x3D4;
432  }
433  else
434  {
435  CRTC = 0x3B4;
436  }
437 
438  /* Vertical display end */
439  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x12);
440  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xDF);
441 }
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:535
int32_t INT_PTR
Definition: typedefs.h:62
#define CRTC
Definition: blue.h:123
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:539

Referenced by PcVideoSetMode80x34(), and PcVideoSetMode80x60().

◆ PcVideoSetDisplayMode()

VIDEODISPLAYMODE PcVideoSetDisplayMode ( char DisplayModeName,
BOOLEAN  Init 
)

Definition at line 873 of file pcvideo.c.

874 {
876 
877  if (NULL == DisplayModeName || '\0' == *DisplayModeName)
878  {
880  return DisplayMode;
881  }
882 
884  {
885  TRACE("CGA or other display adapter detected.\n");
886  printf("CGA or other display adapter detected.\n");
887  printf("Using 80x25 text mode.\n");
889  }
891  {
892  TRACE("EGA display adapter detected.\n");
893  printf("EGA display adapter detected.\n");
894  printf("Using 80x25 text mode.\n");
896  }
897  else /* if (VIDEOCARD_VGA == PcVideoDetectVideoCard()) */
898  {
899  TRACE("VGA display adapter detected.\n");
900 
901  if (0 == _stricmp(DisplayModeName, "NORMAL_VGA"))
902  {
904  }
905  else if (0 == _stricmp(DisplayModeName, "EXTENDED_VGA"))
906  {
908  }
909  else
910  {
911  VideoMode = (USHORT)strtoul(DisplayModeName, NULL, 0);
912  }
913  }
914 
915  if (! PcVideoSetMode(VideoMode))
916  {
917  printf("Error: unable to set video display mode 0x%x\n", (int) VideoMode);
918  printf("Defaulting to 80x25 text mode.\n");
919  printf("Press any key to continue.\n");
920  PcConsGetCh();
921 
923  }
924 
926 
927  return DisplayMode;
928 }
#define VIDEOCARD_CGA_OR_OTHER
Definition: pcvideo.c:33
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
static BOOLEAN PcVideoSetMode(USHORT NewMode)
Definition: pcvideo.c:702
#define VIDEOMODE_EXTENDED_TEXT
Definition: pcvideo.c:38
#define VIDEOMODE_NORMAL_TEXT
Definition: pcvideo.c:37
#define _stricmp
Definition: cat.c:22
smooth NULL
Definition: ftsmooth.c:416
static VOID PcVideoSetBlinkBit(BOOLEAN Enable)
Definition: pcvideo.c:810
#define TRACE(s)
Definition: solgame.cpp:4
static ULONG PcVideoDetectVideoCard(VOID)
Definition: pcvideo.c:122
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:116
#define VIDEOCARD_EGA
Definition: pcvideo.c:34
unsigned short USHORT
Definition: pedump.c:61
int PcConsGetCh(void)
Definition: pccons.c:90
#define printf
Definition: config.h:203

Referenced by PcMachInit().

◆ PcVideoSetFont8x14()

static VOID PcVideoSetFont8x14 ( VOID  )
static

Definition at line 235 of file pcvideo.c.

236 {
237  REGS Regs;
238 
239  /* Int 10h AX=1111h
240  * VIDEO - TEXT-MODE CHARGEN - LOAD ROM MONOCHROME PATTERNS (PS,EGA,VGA)
241  *
242  * AX = 1111h
243  * BL = block to load
244  * Return:
245  * Nothing
246  */
247  Regs.w.ax = 0x1111;
248  Regs.b.bl = 0;
249  Int386(0x10, &Regs, &Regs);
250 }
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:114
BYTEREGS b
Definition: pcbios.h:143
unsigned short ax
Definition: pcbios.h:91
Definition: pcbios.h:138
WORDREGS w
Definition: pcbios.h:142

Referenced by PcVideoSetMode80x28(), and PcVideoSetMode80x34().

◆ PcVideoSetFont8x8()

static VOID PcVideoSetFont8x8 ( VOID  )
static

Definition at line 217 of file pcvideo.c.

218 {
219  REGS Regs;
220 
221  /* Int 10h AX=1112h
222  * VIDEO - TEXT-MODE CHARGEN - LOAD ROM 8x8 DBL-DOT PATTERNS (PS,EGA,VGA)
223  *
224  * AX = 1112h
225  * BL = block to load
226  * Return:
227  * Nothing
228  */
229  Regs.w.ax = 0x1112;
230  Regs.b.bl = 0x00;
231  Int386(0x10, &Regs, &Regs);
232 }
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:114
BYTEREGS b
Definition: pcbios.h:143
unsigned short ax
Definition: pcbios.h:91
Definition: pcbios.h:138
WORDREGS w
Definition: pcbios.h:142

Referenced by PcVideoSetMode80x43(), PcVideoSetMode80x50_80x43(), and PcVideoSetMode80x60().

◆ PcVideoSetMemoryBank()

static VOID PcVideoSetMemoryBank ( USHORT  BankNumber)
static

Definition at line 835 of file pcvideo.c.

836 {
837  REGS Regs;
838 
839  if (CurrentMemoryBank != BankNumber)
840  {
841  /* Int 10h AX=4F05h
842  * VESA SuperVGA BIOS - CPU VIDEO MEMORY CONTROL
843  *
844  * AX = 4F05h
845  * BH = subfunction
846  * 00h select video memory window
847  * 01h get video memory window
848  * DX = window address in video memory (in granularity units)
849  * Return:
850  * DX = window address in video memory (in gran. units)
851  * BL = window number
852  * 00h window A
853  * 01h window B.
854  * Return:
855  * AL = 4Fh if function supported
856  * AH = status
857  * 00h successful
858  * 01h failed
859  */
860  Regs.w.ax = 0x4F05;
861  Regs.w.bx = 0x0000;
862  Regs.w.dx = BankNumber;
863  Int386(0x10, &Regs, &Regs);
864 
865  if (0x004F == Regs.w.ax)
866  {
867  CurrentMemoryBank = BankNumber;
868  }
869  }
870 }
unsigned short dx
Definition: pcbios.h:94
int __cdecl Int386(int ivec, REGS *in, REGS *out)
static ULONG CurrentMemoryBank
Definition: pcvideo.c:119
unsigned short bx
Definition: pcbios.h:92
unsigned short ax
Definition: pcbios.h:91
Definition: pcbios.h:138
WORDREGS w
Definition: pcbios.h:142

Referenced by PcVideoCopyOffScreenBufferToVRAM().

◆ PcVideoSetMode()

static BOOLEAN PcVideoSetMode ( USHORT  NewMode)
static

Definition at line 702 of file pcvideo.c.

703 {
704  CurrentMemoryBank = 0;
705 
706  /* Set the values for the default text modes
707  * If they are setting a graphics mode then
708  * these values will be changed.
709  */
710  BiosVideoMode = NewMode;
711  ScreenWidth = 80;
712  ScreenHeight = 25;
713  BytesPerScanLine = 160;
716 
717  switch (NewMode)
718  {
720  case 0x03: /* BIOS 80x25 text mode number */
721  return PcVideoSetMode80x25();
723  return PcVideoSetMode80x50_80x43();
724  case VIDEOMODE_80X28:
725  return PcVideoSetMode80x28();
726  case VIDEOMODE_80X30:
727  return PcVideoSetMode80x30();
728  case VIDEOMODE_80X34:
729  return PcVideoSetMode80x34();
730  case VIDEOMODE_80X43:
731  return PcVideoSetMode80x43();
732  case VIDEOMODE_80X60:
733  return PcVideoSetMode80x60();
734  }
735 
736  if (0x12 == NewMode)
737  {
738  /* 640x480x16 */
739  PcVideoSetBiosMode((UCHAR)NewMode);
740  WRITE_PORT_USHORT((USHORT*)0x03CE, 0x0F01); /* For some reason this is necessary? */
741  ScreenWidth = 640;
742  ScreenHeight = 480;
743  BytesPerScanLine = 80;
744  BiosVideoMode = NewMode;
746 
747  return TRUE;
748  }
749  else if (0x13 == NewMode)
750  {
751  /* 320x200x256 */
752  PcVideoSetBiosMode((UCHAR)NewMode);
753  ScreenWidth = 320;
754  ScreenHeight = 200;
755  BytesPerScanLine = 320;
756  BiosVideoMode = NewMode;
758 
759  return TRUE;
760  }
761  else if (0x0108 <= NewMode && NewMode <= 0x010C)
762  {
763  /* VESA Text Mode */
765  {
766  return FALSE;
767  }
768 
769  if (! PcVideoSetBiosVesaMode(NewMode))
770  {
771  return FALSE;
772  }
773 
777  BiosVideoMode = NewMode;
780 
781  return TRUE;
782  }
783  else
784  {
785  /* VESA Graphics Mode */
787  {
788  return FALSE;
789  }
790 
791  if (! PcVideoSetBiosVesaMode(NewMode))
792  {
793  return FALSE;
794  }
795 
799  BiosVideoMode = NewMode;
802 
803  return TRUE;
804  }
805 
806  return FALSE;
807 }
#define VIDEOMODE_80X30
Definition: pcvideo.c:40
#define VIDEOMODE_80X43
Definition: pcvideo.c:42
static BOOLEAN PcVideoSetMode80x50_80x43(VOID)
Definition: pcvideo.c:598
#define TRUE
Definition: types.h:120
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
static BOOLEAN PcVideoSetMode80x43(VOID)
Definition: pcvideo.c:669
#define VIDEOMODE_80X60
Definition: pcvideo.c:43
#define VIDEOMODE_EXTENDED_TEXT
Definition: pcvideo.c:38
#define VIDEOMODE_80X28
Definition: pcvideo.c:39
#define VIDEOMODE_NORMAL_TEXT
Definition: pcvideo.c:37
static SVGA_MODE_INFORMATION VesaVideoModeInformation
Definition: pcvideo.c:118
static USHORT BiosVideoMode
Definition: pcvideo.c:112
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:588
static BOOLEAN VesaVideoMode
Definition: pcvideo.c:117
static ULONG ScreenHeight
Definition: pcvideo.c:114
USHORT WidthInPixels
Definition: pcvideo.c:68
static ULONG BytesPerScanLine
Definition: pcvideo.c:115
static ULONG CurrentMemoryBank
Definition: pcvideo.c:119
static BOOLEAN PcVideoVesaGetSVGAModeInformation(USHORT Mode, PSVGA_MODE_INFORMATION ModeInformation)
Definition: pcvideo.c:444
#define VIDEOMODE_80X34
Definition: pcvideo.c:41
static BOOLEAN PcVideoSetBiosVesaMode(USHORT Mode)
Definition: pcvideo.c:516
static BOOLEAN PcVideoSetMode80x30(VOID)
Definition: pcvideo.c:642
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:116
unsigned char UCHAR
Definition: xmlstorage.h:181
static BOOLEAN PcVideoSetMode80x28(VOID)
Definition: pcvideo.c:629
static BOOLEAN PcVideoSetMode80x34(VOID)
Definition: pcvideo.c:654
USHORT BytesPerScanLine
Definition: pcvideo.c:66
unsigned short USHORT
Definition: pedump.c:61
static VOID PcVideoSetBiosMode(UCHAR VideoMode)
Definition: pcvideo.c:195
static ULONG ScreenWidth
Definition: pcvideo.c:113
USHORT HeightInPixels
Definition: pcvideo.c:69
static BOOLEAN PcVideoSetMode80x60(VOID)
Definition: pcvideo.c:685

Referenced by PcVideoSetDisplayMode().

◆ PcVideoSetMode80x25()

static BOOLEAN PcVideoSetMode80x25 ( VOID  )
static

Definition at line 588 of file pcvideo.c.

589 {
590  PcVideoSetBiosMode(0x03);
591  ScreenWidth = 80;
592  ScreenHeight = 25;
593 
594  return TRUE;
595 }
#define TRUE
Definition: types.h:120
static ULONG ScreenHeight
Definition: pcvideo.c:114
static VOID PcVideoSetBiosMode(UCHAR VideoMode)
Definition: pcvideo.c:195
static ULONG ScreenWidth
Definition: pcvideo.c:113

Referenced by PcVideoSetMode(), PcVideoSetMode80x28(), PcVideoSetMode80x30(), PcVideoSetMode80x34(), PcVideoSetMode80x43(), and PcVideoSetMode80x60().

◆ PcVideoSetMode80x28()

static BOOLEAN PcVideoSetMode80x28 ( VOID  )
static

Definition at line 629 of file pcvideo.c.

630 {
631  /* FIXME: Is this VGA-only? */
634  PcVideoDefineCursor(11, 12);
635  ScreenWidth = 80;
636  ScreenHeight = 28;
637 
638  return TRUE;
639 }
static VOID PcVideoSetFont8x14(VOID)
Definition: pcvideo.c:235
#define TRUE
Definition: types.h:120
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:588
static ULONG ScreenHeight
Definition: pcvideo.c:114
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:302
static ULONG ScreenWidth
Definition: pcvideo.c:113

Referenced by PcVideoSetMode().

◆ PcVideoSetMode80x30()

static BOOLEAN PcVideoSetMode80x30 ( VOID  )
static

Definition at line 642 of file pcvideo.c.

643 {
644  /* FIXME: Is this VGA-only? */
647  ScreenWidth = 80;
648  ScreenHeight = 30;
649 
650  return TRUE;
651 }
#define TRUE
Definition: types.h:120
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:588
static ULONG ScreenHeight
Definition: pcvideo.c:114
static ULONG ScreenWidth
Definition: pcvideo.c:113
static VOID PcVideoSet480ScanLines(VOID)
Definition: pcvideo.c:365

Referenced by PcVideoSetMode().

◆ PcVideoSetMode80x34()

static BOOLEAN PcVideoSetMode80x34 ( VOID  )
static

Definition at line 654 of file pcvideo.c.

655 {
656  /* FIXME: Is this VGA-only? */
660  PcVideoDefineCursor(11, 12);
662  ScreenWidth = 80;
663  ScreenHeight = 34;
664 
665  return TRUE;
666 }
static VOID PcVideoSetFont8x14(VOID)
Definition: pcvideo.c:235
#define TRUE
Definition: types.h:120
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:588
static ULONG ScreenHeight
Definition: pcvideo.c:114
static VOID PcVideoSetDisplayEnd(VOID)
Definition: pcvideo.c:422
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:302
static ULONG ScreenWidth
Definition: pcvideo.c:113
static VOID PcVideoSet480ScanLines(VOID)
Definition: pcvideo.c:365

Referenced by PcVideoSetMode().

◆ PcVideoSetMode80x43()

static BOOLEAN PcVideoSetMode80x43 ( VOID  )
static

Definition at line 669 of file pcvideo.c.

670 {
671  /* FIXME: Is this VGA-only? */
677  PcVideoDefineCursor(6, 7);
678  ScreenWidth = 80;
679  ScreenHeight = 43;
680 
681  return TRUE;
682 }
#define TRUE
Definition: types.h:120
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:588
static ULONG ScreenHeight
Definition: pcvideo.c:114
static VOID PcVideoSelectAlternatePrintScreen(VOID)
Definition: pcvideo.c:253
#define VERTRES_350_SCANLINES
Definition: pcvideo.c:50
static VOID PcVideoSetVerticalResolution(UCHAR VerticalResolutionMode)
Definition: pcvideo.c:338
static VOID PcVideoDisableCursorEmulation(VOID)
Definition: pcvideo.c:277
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:302
static VOID PcVideoSetFont8x8(VOID)
Definition: pcvideo.c:217
static ULONG ScreenWidth
Definition: pcvideo.c:113

Referenced by PcVideoSetMode().

◆ PcVideoSetMode80x50_80x43()

static BOOLEAN PcVideoSetMode80x50_80x43 ( VOID  )
static

Definition at line 598 of file pcvideo.c.

599 {
601  {
602  PcVideoSetBiosMode(0x12);
606  PcVideoDefineCursor(6, 7);
607  ScreenWidth = 80;
608  ScreenHeight = 50;
609  }
611  {
612  PcVideoSetBiosMode(0x03);
616  PcVideoDefineCursor(6, 7);
617  ScreenWidth = 80;
618  ScreenHeight = 43;
619  }
620  else /* VIDEOCARD_CGA_OR_OTHER */
621  {
622  return FALSE;
623  }
624 
625  return TRUE;
626 }
#define TRUE
Definition: types.h:120
#define VIDEOCARD_VGA
Definition: pcvideo.c:35
static ULONG ScreenHeight
Definition: pcvideo.c:114
static VOID PcVideoSelectAlternatePrintScreen(VOID)
Definition: pcvideo.c:253
static ULONG PcVideoDetectVideoCard(VOID)
Definition: pcvideo.c:122
#define VIDEOCARD_EGA
Definition: pcvideo.c:34
static VOID PcVideoDisableCursorEmulation(VOID)
Definition: pcvideo.c:277
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:302
static VOID PcVideoSetFont8x8(VOID)
Definition: pcvideo.c:217
static VOID PcVideoSetBiosMode(UCHAR VideoMode)
Definition: pcvideo.c:195
static ULONG ScreenWidth
Definition: pcvideo.c:113

Referenced by PcVideoPrepareForReactOS(), and PcVideoSetMode().

◆ PcVideoSetMode80x60()

static BOOLEAN PcVideoSetMode80x60 ( VOID  )
static

Definition at line 685 of file pcvideo.c.

686 {
687  /* FIXME: Is this VGA-only? */
693  PcVideoDefineCursor(6, 7);
695  ScreenWidth = 80;
696  ScreenHeight = 60;
697 
698  return TRUE;
699 }
#define TRUE
Definition: types.h:120
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:588
static ULONG ScreenHeight
Definition: pcvideo.c:114
static VOID PcVideoSetDisplayEnd(VOID)
Definition: pcvideo.c:422
static VOID PcVideoSelectAlternatePrintScreen(VOID)
Definition: pcvideo.c:253
static VOID PcVideoDisableCursorEmulation(VOID)
Definition: pcvideo.c:277
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:302
static VOID PcVideoSetFont8x8(VOID)
Definition: pcvideo.c:217
static ULONG ScreenWidth
Definition: pcvideo.c:113
static VOID PcVideoSet480ScanLines(VOID)
Definition: pcvideo.c:365

Referenced by PcVideoSetMode().

◆ PcVideoSetPaletteColor()

VOID PcVideoSetPaletteColor ( UCHAR  Color,
UCHAR  Red,
UCHAR  Green,
UCHAR  Blue 
)

Definition at line 1071 of file pcvideo.c.

1072 {
1077 }
Definition: bl.h:202
Definition: bl.h:199
Definition: bl.h:200
unsigned char UCHAR
Definition: xmlstorage.h:181
#define VIDEOPORT_PALETTE_WRITE
Definition: pcvideo.c:25
#define VIDEOPORT_PALETTE_DATA
Definition: pcvideo.c:26
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:539

Referenced by PcMachInit().

◆ PcVideoSetTextCursorPosition()

VOID PcVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 961 of file pcvideo.c.

962 {
963  REGS Regs;
964 
965  /* Int 10h AH=02h
966  * VIDEO - SET CURSOR POSITION
967  *
968  * AH = 02h
969  * BH = page number
970  * 0-3 in modes 2&3
971  * 0-7 in modes 0&1
972  * 0 in graphics modes
973  * DH = row (00h is top)
974  * DL = column (00h is left)
975  * Return:
976  * Nothing
977  */
978  Regs.b.ah = 0x02;
979  Regs.b.bh = 0x00;
980  Regs.b.dh = Y;
981  Regs.b.dl = X;
982  Int386(0x10, &Regs, &Regs);
983 }
#define Y(I)
unsigned char ah
Definition: pcbios.h:112
unsigned char dh
Definition: pcbios.h:121
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char dl
Definition: pcbios.h:120
BYTEREGS b
Definition: pcbios.h:143
unsigned char bh
Definition: pcbios.h:115
Definition: pcbios.h:138
#define X(b, s)

Referenced by PcMachInit().

◆ PcVideoSetVerticalResolution()

static VOID PcVideoSetVerticalResolution ( UCHAR  VerticalResolutionMode)
static

Definition at line 338 of file pcvideo.c.

339 {
340  REGS Regs;
341 
342  /* Int 10h AH=12h BL=30h
343  * VIDEO - ALTERNATE FUNCTION SELECT (VGA) - SELECT VERTICAL RESOLUTION
344  *
345  * AH = 12h
346  * BL = 30h
347  * AL = vertical resolution
348  * 00h 200 scan lines
349  * 01h 350 scan lines
350  * 02h 400 scan lines
351  * Return:
352  * AL = 12h if function supported
353  *
354  * Specify the number of scan lines used to display text modes.
355  *
356  * The specified resolution will take effect on the next mode set.
357  */
358  Regs.b.ah = 0x12;
359  Regs.b.bl = 0x30;
360  Regs.b.al = VerticalResolutionMode;
361  Int386(0x10, &Regs, &Regs);
362 }
unsigned char ah
Definition: pcbios.h:112
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:114
BYTEREGS b
Definition: pcbios.h:143
unsigned char al
Definition: pcbios.h:111
Definition: pcbios.h:138

Referenced by PcVideoSetMode80x43().

◆ PcVideoSync()

VOID PcVideoSync ( VOID  )

Definition at line 1089 of file pcvideo.c.

1090 {
1092  {
1093  /*
1094  * Keep reading the port until bit 3 is clear
1095  * This waits for the current retrace to end and
1096  * we can catch the next one so we know we are
1097  * getting a full retrace.
1098  */
1099  }
1100 
1101  while (!(READ_PORT_UCHAR((UCHAR*)VIDEOPORT_VERTICAL_RETRACE) & 0x08))
1102  {
1103  /*
1104  * Keep reading the port until bit 3 is set
1105  * Now that we know we aren't doing a vertical
1106  * retrace we need to wait for the next one.
1107  */
1108  }
1109 }
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:535
unsigned char UCHAR
Definition: xmlstorage.h:181
#define VIDEOPORT_VERTICAL_RETRACE
Definition: pcvideo.c:27

Referenced by PcMachInit().

◆ PcVideoVesaGetSVGAModeInformation()

static BOOLEAN PcVideoVesaGetSVGAModeInformation ( USHORT  Mode,
PSVGA_MODE_INFORMATION  ModeInformation 
)
static

Definition at line 444 of file pcvideo.c.

445 {
446  REGS Regs;
447 
449 
450  /* VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION
451  * AX = 4F01h
452  * CX = SuperVGA video mode (see #04082 for bitfields)
453  * ES:DI -> 256-byte buffer for mode information (see #00079)
454  * Return:
455  * AL = 4Fh if function supported
456  * AH = status
457  * 00h successful
458  * ES:DI buffer filled
459  * 01h failed
460  *
461  * Desc: Determine the attributes of the specified video mode
462  *
463  * Note: While VBE 1.1 and higher will zero out all unused bytes
464  * of the buffer, v1.0 did not, so applications that want to be
465  * backward compatible should clear the buffer before calling
466  */
467  Regs.w.ax = 0x4F01;
468  Regs.w.cx = Mode;
469  Regs.w.es = BIOSCALLBUFSEGMENT;
470  Regs.w.di = BIOSCALLBUFOFFSET;
471  Int386(0x10, &Regs, &Regs);
472 
473  if (Regs.w.ax != 0x004F)
474  {
475  return FALSE;
476  }
477 
478  RtlCopyMemory(ModeInformation, (PVOID)BIOSCALLBUFFER, sizeof(SVGA_MODE_INFORMATION));
479 
480  TRACE("\n");
481  TRACE("BiosVesaGetSVGAModeInformation() mode 0x%x\n", Mode);
482  TRACE("ModeAttributes = 0x%x\n", ModeInformation->ModeAttributes);
483  TRACE("WindowAttributesA = 0x%x\n", ModeInformation->WindowAttributesA);
484  TRACE("WindowAttributesB = 0x%x\n", ModeInformation->WindowsAttributesB);
485  TRACE("WindowGranularity = %dKB\n", ModeInformation->WindowGranularity);
486  TRACE("WindowSize = %dKB\n", ModeInformation->WindowSize);
487  TRACE("WindowAStartSegment = 0x%x\n", ModeInformation->WindowAStartSegment);
488  TRACE("WindowBStartSegment = 0x%x\n", ModeInformation->WindowBStartSegment);
489  TRACE("WindowPositioningFunction = 0x%x\n", ModeInformation->WindowPositioningFunction);
490  TRACE("BytesPerScanLine = %d\n", ModeInformation->BytesPerScanLine);
491  TRACE("WidthInPixels = %d\n", ModeInformation->WidthInPixels);
492  TRACE("HeightInPixels = %d\n", ModeInformation->HeightInPixels);
493  TRACE("CharacterWidthInPixels = %d\n", ModeInformation->CharacterWidthInPixels);
494  TRACE("CharacterHeightInPixels = %d\n", ModeInformation->CharacterHeightInPixels);
495  TRACE("NumberOfMemoryPlanes = %d\n", ModeInformation->NumberOfMemoryPlanes);
496  TRACE("BitsPerPixel = %d\n", ModeInformation->BitsPerPixel);
497  TRACE("NumberOfBanks = %d\n", ModeInformation->NumberOfBanks);
498  TRACE("MemoryModel = %d\n", ModeInformation->MemoryModel);
499  TRACE("BankSize = %d\n", ModeInformation->BankSize);
500  TRACE("NumberOfImagePlanes = %d\n", ModeInformation->NumberOfImagePanes);
501  TRACE("---VBE v1.2+ ---\n");
502  TRACE("RedMaskSize = %d\n", ModeInformation->RedMaskSize);
503  TRACE("RedMaskPosition = %d\n", ModeInformation->RedMaskPosition);
504  TRACE("GreenMaskSize = %d\n", ModeInformation->GreenMaskSize);
505  TRACE("GreenMaskPosition = %d\n", ModeInformation->GreenMaskPosition);
506  TRACE("BlueMaskSize = %d\n", ModeInformation->BlueMaskSize);
507  TRACE("BlueMaskPosition = %d\n", ModeInformation->BlueMaskPosition);
508  TRACE("ReservedMaskSize = %d\n", ModeInformation->ReservedMaskSize);
509  TRACE("ReservedMaskPosition = %d\n", ModeInformation->ReservedMaskPosition);
510  TRACE("\n");
511 
512  return TRUE;
513 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
UCHAR BlueMaskPosition
Definition: pcvideo.c:85
_In_ ULONG Mode
Definition: hubbusif.h:303
#define BIOSCALLBUFFER
Definition: x86common.h:12
unsigned short cx
Definition: pcbios.h:93
unsigned short es
Definition: pcbios.h:101
UCHAR GreenMaskPosition
Definition: pcvideo.c:83
UCHAR ReservedMaskSize
Definition: pcvideo.c:86
USHORT WidthInPixels
Definition: pcvideo.c:68
UCHAR NumberOfMemoryPlanes
Definition: pcvideo.c:72
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define BIOSCALLBUFSEGMENT
Definition: x86common.h:21
ULONG WindowPositioningFunction
Definition: pcvideo.c:65
USHORT WindowAStartSegment
Definition: pcvideo.c:63
UCHAR ReservedMaskPosition
Definition: pcvideo.c:87
#define TRACE(s)
Definition: solgame.cpp:4
#define BIOSCALLBUFOFFSET
Definition: x86common.h:22
UCHAR CharacterWidthInPixels
Definition: pcvideo.c:70
UCHAR WindowsAttributesB
Definition: pcvideo.c:60
USHORT BytesPerScanLine
Definition: pcvideo.c:66
USHORT WindowBStartSegment
Definition: pcvideo.c:64
USHORT WindowGranularity
Definition: pcvideo.c:61
UCHAR CharacterHeightInPixels
Definition: pcvideo.c:71
unsigned short ax
Definition: pcbios.h:91
UCHAR WindowAttributesA
Definition: pcvideo.c:59
Definition: pcbios.h:138
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
USHORT HeightInPixels
Definition: pcvideo.c:69
UCHAR NumberOfImagePanes
Definition: pcvideo.c:77
USHORT ModeAttributes
Definition: pcvideo.c:58
unsigned short di
Definition: pcbios.h:97
WORDREGS w
Definition: pcbios.h:142

Referenced by PcVideoSetMode().

Variable Documentation

◆ BiosVideoMode

USHORT BiosVideoMode
static

Definition at line 112 of file pcvideo.c.

Referenced by PcVideoSetMode().

◆ BytesPerScanLine

ULONG BytesPerScanLine = 160
static

Definition at line 115 of file pcvideo.c.

Referenced by PcVideoGetBufferSize(), PcVideoPutChar(), and PcVideoSetMode().

◆ CurrentMemoryBank

ULONG CurrentMemoryBank = 0
static

Definition at line 119 of file pcvideo.c.

Referenced by PcVideoSetMemoryBank(), and PcVideoSetMode().

◆ DisplayMode

◆ ScreenHeight

◆ ScreenWidth

◆ VesaVideoMode

BOOLEAN VesaVideoMode = FALSE
static

◆ VesaVideoModeInformation

SVGA_MODE_INFORMATION VesaVideoModeInformation
static