ReactOS  0.4.14-dev-49-gfb4591c
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
 

Enumerations

enum  {
  INT1FhFont = 0x00, INT43hFont = 0x01, ROM_8x14CharacterFont = 0x02, ROM_8x8DoubleDotFontLo = 0x03,
  ROM_8x8DoubleDotFontHi = 0x04, ROM_AlphaAlternate = 0x05, ROM_8x16Font = 0x06, ROM_Alternate9x16Font = 0x07,
  UltraVision_8x20Font = 0x11, UltraVision_8x10Font = 0x12
}
 

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 PcVideoGetFontsFromFirmware (PULONG RomFontPointers)
 
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 (VOID)
 

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 50 of file pcvideo.c.

◆ VERTRES_350_SCANLINES

#define VERTRES_350_SCANLINES   0x01

Definition at line 51 of file pcvideo.c.

◆ VERTRES_400_SCANLINES

#define VERTRES_400_SCANLINES   0x02

Definition at line 52 of file pcvideo.c.

◆ VIDEOCARD_CGA_OR_OTHER

#define VIDEOCARD_CGA_OR_OTHER   0

Definition at line 34 of file pcvideo.c.

◆ VIDEOCARD_EGA

#define VIDEOCARD_EGA   1

Definition at line 35 of file pcvideo.c.

◆ VIDEOCARD_VGA

#define VIDEOCARD_VGA   2

Definition at line 36 of file pcvideo.c.

◆ VIDEOMODE_132X25

#define VIDEOMODE_132X25   0x8419

Definition at line 45 of file pcvideo.c.

◆ VIDEOMODE_132X43

#define VIDEOMODE_132X43   0x842B

Definition at line 46 of file pcvideo.c.

◆ VIDEOMODE_132X50

#define VIDEOMODE_132X50   0x8432

Definition at line 47 of file pcvideo.c.

◆ VIDEOMODE_132X60

#define VIDEOMODE_132X60   0x843C

Definition at line 48 of file pcvideo.c.

◆ VIDEOMODE_80X28

#define VIDEOMODE_80X28   0x501C

Definition at line 40 of file pcvideo.c.

◆ VIDEOMODE_80X30

#define VIDEOMODE_80X30   0x501E

Definition at line 41 of file pcvideo.c.

◆ VIDEOMODE_80X34

#define VIDEOMODE_80X34   0x5022

Definition at line 42 of file pcvideo.c.

◆ VIDEOMODE_80X43

#define VIDEOMODE_80X43   0x502B

Definition at line 43 of file pcvideo.c.

◆ VIDEOMODE_80X60

#define VIDEOMODE_80X60   0x503C

Definition at line 44 of file pcvideo.c.

◆ VIDEOMODE_EXTENDED_TEXT

#define VIDEOMODE_EXTENDED_TEXT   1

Definition at line 39 of file pcvideo.c.

◆ VIDEOMODE_NORMAL_TEXT

#define VIDEOMODE_NORMAL_TEXT   0

Definition at line 38 of file pcvideo.c.

◆ VIDEOPORT_PALETTE_DATA

#define VIDEOPORT_PALETTE_DATA   0x03C9

Definition at line 27 of file pcvideo.c.

◆ VIDEOPORT_PALETTE_READ

#define VIDEOPORT_PALETTE_READ   0x03C7

Definition at line 25 of file pcvideo.c.

◆ VIDEOPORT_PALETTE_WRITE

#define VIDEOPORT_PALETTE_WRITE   0x03C8

Definition at line 26 of file pcvideo.c.

◆ VIDEOPORT_VERTICAL_RETRACE

#define VIDEOPORT_VERTICAL_RETRACE   0x03DA

Definition at line 28 of file pcvideo.c.

◆ VIDEOTEXT_MEM_ADDRESS

#define VIDEOTEXT_MEM_ADDRESS   0xB8000

Definition at line 31 of file pcvideo.c.

◆ VIDEOTEXT_MEM_SIZE

#define VIDEOTEXT_MEM_SIZE   0x8000

Definition at line 32 of file pcvideo.c.

◆ VIDEOVGA_MEM_ADDRESS

#define VIDEOVGA_MEM_ADDRESS   0xA0000

Definition at line 30 of file pcvideo.c.

Typedef Documentation

◆ PSVGA_MODE_INFORMATION

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
INT1FhFont 
INT43hFont 
ROM_8x14CharacterFont 
ROM_8x8DoubleDotFontLo 
ROM_8x8DoubleDotFontHi 
ROM_AlphaAlternate 
ROM_8x16Font 
ROM_Alternate9x16Font 
UltraVision_8x20Font 
UltraVision_8x10Font 

Definition at line 120 of file pcvideo.c.

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UI  )

◆ PcVideoClearScreen()

VOID PcVideoClearScreen ( UCHAR  Attr)

Definition at line 1087 of file pcvideo.c.

1088 {
1089  USHORT AttrChar;
1090  USHORT *BufPtr;
1091 
1092  AttrChar = ((USHORT) Attr << 8) | ' ';
1093  for (BufPtr = (USHORT *) VIDEOTEXT_MEM_ADDRESS;
1095  BufPtr++)
1096  {
1098  *BufPtr = AttrChar;
1099  }
1100 }
#define VIDEOTEXT_MEM_SIZE
Definition: pcvideo.c:32
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:31
#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 1046 of file pcvideo.c.

1047 {
1048  USHORT BanksToCopy;
1049  ULONG BytesInLastBank;
1050  USHORT CurrentBank;
1051  ULONG BankSize;
1052 
1053  /* PcVideoWaitForVerticalRetrace(); */
1054 
1055  /* Text mode (BIOS or VESA) */
1056  if (VideoTextMode == DisplayMode)
1057  {
1059  }
1060  /* VESA graphics mode */
1062  {
1066 
1067  /* Copy all the banks but the last one because
1068  * it is probably a partial bank */
1069  for (CurrentBank = 0; CurrentBank < BanksToCopy; CurrentBank++)
1070  {
1071  PcVideoSetMemoryBank(CurrentBank);
1072  RtlCopyMemory((PVOID) VIDEOVGA_MEM_ADDRESS, (char *) Buffer + CurrentBank * BankSize, BankSize);
1073  }
1074 
1075  /* Copy the remaining bytes into the last bank */
1076  PcVideoSetMemoryBank(CurrentBank);
1077  RtlCopyMemory((PVOID)VIDEOVGA_MEM_ADDRESS, (char *) Buffer + CurrentBank * BankSize, BytesInLastBank);
1078  }
1079  /* BIOS graphics mode */
1080  else
1081  {
1082  UNIMPLEMENTED;
1083  }
1084 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
static SVGA_MODE_INFORMATION VesaVideoModeInformation
Definition: pcvideo.c:117
static BOOLEAN VesaVideoMode
Definition: pcvideo.c:116
#define VIDEOVGA_MEM_ADDRESS
Definition: pcvideo.c:30
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:31
static VOID PcVideoSetMemoryBank(USHORT BankNumber)
Definition: pcvideo.c:848
Definition: bufpool.h:45
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:115
USHORT BytesPerScanLine
Definition: pcvideo.c:65
unsigned short USHORT
Definition: pedump.c:61
USHORT WindowGranularity
Definition: pcvideo.c:60
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:114
USHORT HeightInPixels
Definition: pcvideo.c:68
ULONG PcVideoGetBufferSize(VOID)
Definition: pcvideo.c:968

Referenced by PcMachInit().

◆ PcVideoDefineCursor()

static VOID PcVideoDefineCursor ( UCHAR  StartScanLine,
UCHAR  EndScanLine 
)
static

Definition at line 315 of file pcvideo.c.

316 {
317  REGS Regs;
318 
319  /* Int 10h AH=01h
320  * VIDEO - SET TEXT-MODE CURSOR SHAPE
321  *
322  * AH = 01h
323  * CH = cursor start and options
324  * CL = bottom scan line containing cursor (bits 0-4)
325  * Return:
326  * Nothing
327  *
328  * Specify the starting and ending scan lines to be occupied
329  * by the hardware cursor in text modes.
330  *
331  * AMI 386 BIOS and AST Premier 386 BIOS will lock up the
332  * system if AL is not equal to the current video mode.
333  *
334  * Bitfields for cursor start and options:
335  *
336  * Bit(s) Description
337  * 7 should be zero
338  * 6,5 cursor blink
339  * (00=normal, 01=invisible, 10=erratic, 11=slow).
340  * (00=normal, other=invisible on EGA/VGA)
341  * 4-0 topmost scan line containing cursor
342  */
343  Regs.b.ah = 0x01;
344  Regs.b.al = 0x03;
345  Regs.b.ch = StartScanLine;
346  Regs.b.cl = EndScanLine;
347  Int386(0x10, &Regs, &Regs);
348 }
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char ch
Definition: pcbios.h:126
unsigned char cl
Definition: pcbios.h:125
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
Definition: pcbios.h:146

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

◆ PcVideoDetectVideoCard()

static ULONG PcVideoDetectVideoCard ( VOID  )
static

Definition at line 135 of file pcvideo.c.

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

Referenced by PcVideoSetDisplayMode(), and PcVideoSetMode80x50_80x43().

◆ PcVideoDisableCursorEmulation()

static VOID PcVideoDisableCursorEmulation ( VOID  )
static

Definition at line 290 of file pcvideo.c.

291 {
292  REGS Regs;
293 
294  /* Int 10h AH=12h BL=34h
295  * VIDEO - ALTERNATE FUNCTION SELECT (VGA) - CURSOR EMULATION
296  *
297  * AH = 12h
298  * BL = 34h
299  * AL = new state
300  * 00h enable alphanumeric cursor emulation
301  * 01h disable alphanumeric cursor emulation
302  * Return:
303  * AL = 12h if function supported
304  *
305  * Specify whether the BIOS should automatically remap cursor start/end
306  * according to the current character height in text modes.
307  */
308  Regs.b.ah = 0x12;
309  Regs.b.bl = 0x34;
310  Regs.b.al = 0x01;
311  Int386(0x10, &Regs, &Regs);
312 }
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:122
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
Definition: pcbios.h:146

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

◆ PcVideoGetBufferSize()

ULONG PcVideoGetBufferSize ( VOID  )

Definition at line 968 of file pcvideo.c.

969 {
971 }
static ULONG ScreenHeight
Definition: pcvideo.c:113
static ULONG BytesPerScanLine
Definition: pcvideo.c:114

Referenced by PcMachInit(), and PcVideoCopyOffScreenBufferToVRAM().

◆ PcVideoGetDisplaySize()

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

Definition at line 944 of file pcvideo.c.

945 {
946  *Width = ScreenWidth;
947  *Height = ScreenHeight;
949  {
951  {
952  /* 16-bit color modes give green an extra bit (5:6:5)
953  * 15-bit color modes have just 5:5:5 for R:G:B */
954  *Depth = (6 == VesaVideoModeInformation.GreenMaskSize ? 16 : 15);
955  }
956  else
957  {
959  }
960  }
961  else
962  {
963  *Depth = 0;
964  }
965 }
_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:117
static BOOLEAN VesaVideoMode
Definition: pcvideo.c:116
static ULONG ScreenHeight
Definition: pcvideo.c:113
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:115
static ULONG ScreenWidth
Definition: pcvideo.c:112

Referenced by PcMachInit().

◆ PcVideoGetFontsFromFirmware()

VOID PcVideoGetFontsFromFirmware ( PULONG  RomFontPointers)

Definition at line 974 of file pcvideo.c.

975 {
976  REGS BiosRegs;
977 
978  /* Get the address of the BIOS ROM fonts.
979  Int 10h, AX=1130h, BH = pointer specifier
980  returns: es:bp = address */
981  BiosRegs.d.eax = 0x1130;
982  BiosRegs.b.bh = ROM_8x14CharacterFont;
983  Int386(0x10, &BiosRegs, &BiosRegs);
984  RomFontPointers[0] = BiosRegs.w.es << 4 | BiosRegs.w.bp;
985 
986  BiosRegs.b.bh = ROM_8x8DoubleDotFontLo;
987  Int386(0x10, &BiosRegs, &BiosRegs);
988  RomFontPointers[1] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
989 
990  BiosRegs.b.bh = ROM_8x8DoubleDotFontHi;
991  Int386(0x10, &BiosRegs, &BiosRegs);
992  RomFontPointers[2] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
993 
994  BiosRegs.b.bh = ROM_AlphaAlternate;
995  Int386(0x10, &BiosRegs, &BiosRegs);
996  RomFontPointers[3] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
997 
998  BiosRegs.b.bh = ROM_8x16Font;
999  Int386(0x10, &BiosRegs, &BiosRegs);
1000  RomFontPointers[4] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1001 
1002  BiosRegs.b.bh = ROM_Alternate9x16Font;
1003  Int386(0x10, &BiosRegs, &BiosRegs);
1004  RomFontPointers[5] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1005 }
unsigned long eax
Definition: pcbios.h:79
unsigned short es
Definition: pcbios.h:109
int __cdecl Int386(int ivec, REGS *in, REGS *out)
BYTEREGS b
Definition: pcbios.h:151
DWORDREGS d
Definition: pcbios.h:149
unsigned char bh
Definition: pcbios.h:123
#define RomFontPointers
Definition: winldr.c:422
unsigned short bp
Definition: pcbios.h:106
Definition: pcbios.h:146
WORDREGS w
Definition: pcbios.h:150

Referenced by PcMachInit().

◆ PcVideoGetPaletteColor()

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

Definition at line 1127 of file pcvideo.c.

1128 {
1133 }
Definition: bl.h:202
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
#define VIDEOPORT_PALETTE_READ
Definition: pcvideo.c:25
Definition: bl.h:199
Definition: bl.h:200
unsigned char UCHAR
Definition: xmlstorage.h:181
#define VIDEOPORT_PALETTE_DATA
Definition: pcvideo.c:27
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by PcMachInit().

◆ PcVideoHideShowTextCursor()

VOID PcVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 1033 of file pcvideo.c.

1034 {
1035  if (Show)
1036  {
1037  PcVideoDefineCursor(0x0D, 0x0E);
1038  }
1039  else
1040  {
1041  PcVideoDefineCursor(0x20, 0x00);
1042  }
1043 }
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:315

Referenced by PcMachInit(), and PcVideoPrepareForReactOS().

◆ PcVideoIsPaletteFixed()

BOOLEAN PcVideoIsPaletteFixed ( VOID  )

Definition at line 1112 of file pcvideo.c.

1113 {
1114  return FALSE;
1115 }

Referenced by PcMachInit().

◆ PcVideoPrepareForReactOS()

VOID PcVideoPrepareForReactOS ( VOID  )

Definition at line 1159 of file pcvideo.c.

1160 {
1161  // PcVideoSetMode80x50_80x43();
1164 }
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:601
VOID PcVideoHideShowTextCursor(BOOLEAN Show)
Definition: pcvideo.c:1033

Referenced by PcPrepareForReactOS().

◆ PcVideoPutChar()

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

Definition at line 1103 of file pcvideo.c.

1104 {
1105  USHORT *BufPtr;
1106 
1107  BufPtr = (USHORT *) (ULONG_PTR)(VIDEOTEXT_MEM_ADDRESS + Y * BytesPerScanLine + X * 2);
1108  *BufPtr = ((USHORT) Attr << 8) | (Ch & 0xff);
1109 }
#define Y(I)
#define Ch(x, y, z)
Definition: sha2.c:141
static ULONG BytesPerScanLine
Definition: pcvideo.c:114
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:31
unsigned short USHORT
Definition: pedump.c:61

Referenced by PcMachInit().

◆ PcVideoSelectAlternatePrintScreen()

static VOID PcVideoSelectAlternatePrintScreen ( VOID  )
static

Definition at line 266 of file pcvideo.c.

267 {
268  REGS Regs;
269 
270  /* Int 10h AH=12h BL=20h
271  * VIDEO - ALTERNATE FUNCTION SELECT (PS,EGA,VGA,MCGA) - ALTERNATE PRTSC
272  *
273  * AH = 12h
274  * BL = 20h select alternate print screen routine
275  * Return:
276  * Nothing
277  *
278  * Installs a PrtSc routine from the video card's BIOS to replace the
279  * default PrtSc handler from the ROM BIOS, which usually does not
280  * understand screen heights other than 25 lines.
281  *
282  * Some adapters disable print-screen instead of enhancing it.
283  */
284  Regs.b.ah = 0x12;
285  Regs.b.bl = 0x20;
286  Int386(0x10, &Regs, &Regs);
287 }
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:122
BYTEREGS b
Definition: pcbios.h:151
Definition: pcbios.h:146

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

◆ PcVideoSet480ScanLines()

static VOID PcVideoSet480ScanLines ( VOID  )
static

Definition at line 378 of file pcvideo.c.

379 {
380  INT_PTR CRTC;
381 
382  /* Read CRTC port */
383  CRTC = READ_PORT_UCHAR((PUCHAR)0x03CC);
384 
385  if (CRTC & 1)
386  {
387  CRTC = 0x3D4;
388  }
389  else
390  {
391  CRTC = 0x3B4;
392  }
393 
394  /* Vertical sync end (also unlocks CR0-7) */
395  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x11);
396  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x0C);
397 
398  /* Vertical total */
399  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x06);
400  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x0B);
401 
402  /* (vertical) overflow */
403  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x07);
404  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x3E);
405 
406  /* Vertical sync start */
407  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x10);
408  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xEA);
409 
410  /* Vertical display end */
411  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x12);
412  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xDF);
413 
414  /* Vertical blank start */
415  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x15);
416  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xE7);
417 
418  /* Vertical blank end */
419  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x16);
420  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0x04);
421 
422  /* Misc output register (read) */
423  CRTC = READ_PORT_UCHAR((PUCHAR)0x03CC);
424 
425  /* Preserve clock select bits and color bit */
426  CRTC = (CRTC & 0x0D);
427  /* Set correct sync polarity */
428  CRTC = (CRTC | 0xE2);
429 
430  /* (write) */
431  WRITE_PORT_UCHAR((PUCHAR)0x03C2, (UCHAR)CRTC);
432 }
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
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:532

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

◆ PcVideoSetBiosMode()

static VOID PcVideoSetBiosMode ( UCHAR  VideoMode)
static

Definition at line 208 of file pcvideo.c.

209 {
210  REGS Regs;
211 
212  /* Int 10h AH=00h
213  * VIDEO - SET VIDEO MODE
214  *
215  * AH = 00h
216  * AL = desired video mode
217  * Return:
218  * AL = video mode flag (Phoenix, AMI BIOS)
219  * 20h mode > 7
220  * 30h modes 0-5 and 7
221  * 3Fh mode 6
222  * AL = CRT controller mode byte (Phoenix 386 BIOS v1.10)
223  */
224  Regs.b.ah = 0x00;
225  Regs.b.al = VideoMode;
226  Int386(0x10, &Regs, &Regs);
227 }
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
struct _VideoMode VideoMode
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
Definition: pcbios.h:146

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

◆ PcVideoSetBiosVesaMode()

static BOOLEAN PcVideoSetBiosVesaMode ( USHORT  Mode)
static

Definition at line 529 of file pcvideo.c.

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

Referenced by PcVideoSetMode().

◆ PcVideoSetBlinkBit()

static VOID PcVideoSetBlinkBit ( BOOLEAN  Enable)
static

Definition at line 823 of file pcvideo.c.

824 {
825  REGS Regs;
826 
827  /* Int 10h AX=1003h
828  * VIDEO - TOGGLE INTENSITY/BLINKING BIT (Jr, PS, TANDY 1000, EGA, VGA)
829  *
830  * AX = 1003h
831  * BL = new state
832  * 00h background intensity enabled
833  * 01h blink enabled
834  * BH = 00h to avoid problems on some adapters
835  * Return:
836  * Nothing
837  *
838  * Note: although there is no function to get
839  * the current status, bit 5 of 0040h:0065h
840  * indicates the state.
841  */
842  Regs.w.ax = 0x1003;
843  Regs.w.bx = Enable ? 0x0001 : 0x0000;
844  Int386(0x10, &Regs, &Regs);
845 }
_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:100
unsigned short ax
Definition: pcbios.h:99
Definition: pcbios.h:146
WORDREGS w
Definition: pcbios.h:150

Referenced by PcVideoSetDisplayMode().

◆ PcVideoSetDisplayEnd()

static VOID PcVideoSetDisplayEnd ( VOID  )
static

Definition at line 435 of file pcvideo.c.

436 {
437  INT_PTR CRTC;
438 
439  /* Read CRTC port */
440  CRTC = READ_PORT_UCHAR((PUCHAR)0x03CC);
441 
442  if (CRTC & 1)
443  {
444  CRTC = 0x3D4;
445  }
446  else
447  {
448  CRTC = 0x3B4;
449  }
450 
451  /* Vertical display end */
452  WRITE_PORT_UCHAR((PUCHAR)CRTC, 0x12);
453  WRITE_PORT_UCHAR((PUCHAR)CRTC+1, 0xDF);
454 }
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
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:532

Referenced by PcVideoSetMode80x34(), and PcVideoSetMode80x60().

◆ PcVideoSetDisplayMode()

VIDEODISPLAYMODE PcVideoSetDisplayMode ( char DisplayModeName,
BOOLEAN  Init 
)

Definition at line 886 of file pcvideo.c.

887 {
889 
890  if (NULL == DisplayModeName || '\0' == *DisplayModeName)
891  {
893  return DisplayMode;
894  }
895 
897  {
898  TRACE("CGA or other display adapter detected.\n");
899  printf("CGA or other display adapter detected.\n");
900  printf("Using 80x25 text mode.\n");
902  }
904  {
905  TRACE("EGA display adapter detected.\n");
906  printf("EGA display adapter detected.\n");
907  printf("Using 80x25 text mode.\n");
909  }
910  else /* if (VIDEOCARD_VGA == PcVideoDetectVideoCard()) */
911  {
912  TRACE("VGA display adapter detected.\n");
913 
914  if (0 == _stricmp(DisplayModeName, "NORMAL_VGA"))
915  {
917  }
918  else if (0 == _stricmp(DisplayModeName, "EXTENDED_VGA"))
919  {
921  }
922  else
923  {
924  VideoMode = (USHORT)strtoul(DisplayModeName, NULL, 0);
925  }
926  }
927 
928  if (! PcVideoSetMode(VideoMode))
929  {
930  printf("Error: unable to set video display mode 0x%x\n", (int) VideoMode);
931  printf("Defaulting to 80x25 text mode.\n");
932  printf("Press any key to continue.\n");
933  PcConsGetCh();
934 
936  }
937 
939 
940  return DisplayMode;
941 }
#define VIDEOCARD_CGA_OR_OTHER
Definition: pcvideo.c:34
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
static BOOLEAN PcVideoSetMode(USHORT NewMode)
Definition: pcvideo.c:715
#define VIDEOMODE_EXTENDED_TEXT
Definition: pcvideo.c:39
#define VIDEOMODE_NORMAL_TEXT
Definition: pcvideo.c:38
#define _stricmp
Definition: cat.c:22
smooth NULL
Definition: ftsmooth.c:416
static VOID PcVideoSetBlinkBit(BOOLEAN Enable)
Definition: pcvideo.c:823
#define TRACE(s)
Definition: solgame.cpp:4
static ULONG PcVideoDetectVideoCard(VOID)
Definition: pcvideo.c:135
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:115
#define VIDEOCARD_EGA
Definition: pcvideo.c:35
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 248 of file pcvideo.c.

249 {
250  REGS Regs;
251 
252  /* Int 10h AX=1111h
253  * VIDEO - TEXT-MODE CHARGEN - LOAD ROM MONOCHROME PATTERNS (PS,EGA,VGA)
254  *
255  * AX = 1111h
256  * BL = block to load
257  * Return:
258  * Nothing
259  */
260  Regs.w.ax = 0x1111;
261  Regs.b.bl = 0;
262  Int386(0x10, &Regs, &Regs);
263 }
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:122
BYTEREGS b
Definition: pcbios.h:151
unsigned short ax
Definition: pcbios.h:99
Definition: pcbios.h:146
WORDREGS w
Definition: pcbios.h:150

Referenced by PcVideoSetMode80x28(), and PcVideoSetMode80x34().

◆ PcVideoSetFont8x8()

static VOID PcVideoSetFont8x8 ( VOID  )
static

Definition at line 230 of file pcvideo.c.

231 {
232  REGS Regs;
233 
234  /* Int 10h AX=1112h
235  * VIDEO - TEXT-MODE CHARGEN - LOAD ROM 8x8 DBL-DOT PATTERNS (PS,EGA,VGA)
236  *
237  * AX = 1112h
238  * BL = block to load
239  * Return:
240  * Nothing
241  */
242  Regs.w.ax = 0x1112;
243  Regs.b.bl = 0x00;
244  Int386(0x10, &Regs, &Regs);
245 }
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:122
BYTEREGS b
Definition: pcbios.h:151
unsigned short ax
Definition: pcbios.h:99
Definition: pcbios.h:146
WORDREGS w
Definition: pcbios.h:150

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

◆ PcVideoSetMemoryBank()

static VOID PcVideoSetMemoryBank ( USHORT  BankNumber)
static

Definition at line 848 of file pcvideo.c.

849 {
850  REGS Regs;
851 
852  if (CurrentMemoryBank != BankNumber)
853  {
854  /* Int 10h AX=4F05h
855  * VESA SuperVGA BIOS - CPU VIDEO MEMORY CONTROL
856  *
857  * AX = 4F05h
858  * BH = subfunction
859  * 00h select video memory window
860  * 01h get video memory window
861  * DX = window address in video memory (in granularity units)
862  * Return:
863  * DX = window address in video memory (in gran. units)
864  * BL = window number
865  * 00h window A
866  * 01h window B.
867  * Return:
868  * AL = 4Fh if function supported
869  * AH = status
870  * 00h successful
871  * 01h failed
872  */
873  Regs.w.ax = 0x4F05;
874  Regs.w.bx = 0x0000;
875  Regs.w.dx = BankNumber;
876  Int386(0x10, &Regs, &Regs);
877 
878  if (0x004F == Regs.w.ax)
879  {
880  CurrentMemoryBank = BankNumber;
881  }
882  }
883 }
unsigned short dx
Definition: pcbios.h:102
int __cdecl Int386(int ivec, REGS *in, REGS *out)
static ULONG CurrentMemoryBank
Definition: pcvideo.c:118
unsigned short bx
Definition: pcbios.h:100
unsigned short ax
Definition: pcbios.h:99
Definition: pcbios.h:146
WORDREGS w
Definition: pcbios.h:150

Referenced by PcVideoCopyOffScreenBufferToVRAM().

◆ PcVideoSetMode()

static BOOLEAN PcVideoSetMode ( USHORT  NewMode)
static

Definition at line 715 of file pcvideo.c.

716 {
717  CurrentMemoryBank = 0;
718 
719  /* Set the values for the default text modes
720  * If they are setting a graphics mode then
721  * these values will be changed.
722  */
723  BiosVideoMode = NewMode;
724  ScreenWidth = 80;
725  ScreenHeight = 25;
726  BytesPerScanLine = 160;
729 
730  switch (NewMode)
731  {
733  case 0x03: /* BIOS 80x25 text mode number */
734  return PcVideoSetMode80x25();
736  return PcVideoSetMode80x50_80x43();
737  case VIDEOMODE_80X28:
738  return PcVideoSetMode80x28();
739  case VIDEOMODE_80X30:
740  return PcVideoSetMode80x30();
741  case VIDEOMODE_80X34:
742  return PcVideoSetMode80x34();
743  case VIDEOMODE_80X43:
744  return PcVideoSetMode80x43();
745  case VIDEOMODE_80X60:
746  return PcVideoSetMode80x60();
747  }
748 
749  if (0x12 == NewMode)
750  {
751  /* 640x480x16 */
752  PcVideoSetBiosMode((UCHAR)NewMode);
753  WRITE_PORT_USHORT((USHORT*)0x03CE, 0x0F01); /* For some reason this is necessary? */
754  ScreenWidth = 640;
755  ScreenHeight = 480;
756  BytesPerScanLine = 80;
757  BiosVideoMode = NewMode;
759 
760  return TRUE;
761  }
762  else if (0x13 == NewMode)
763  {
764  /* 320x200x256 */
765  PcVideoSetBiosMode((UCHAR)NewMode);
766  ScreenWidth = 320;
767  ScreenHeight = 200;
768  BytesPerScanLine = 320;
769  BiosVideoMode = NewMode;
771 
772  return TRUE;
773  }
774  else if (0x0108 <= NewMode && NewMode <= 0x010C)
775  {
776  /* VESA Text Mode */
778  {
779  return FALSE;
780  }
781 
782  if (! PcVideoSetBiosVesaMode(NewMode))
783  {
784  return FALSE;
785  }
786 
790  BiosVideoMode = NewMode;
793 
794  return TRUE;
795  }
796  else
797  {
798  /* VESA Graphics Mode */
800  {
801  return FALSE;
802  }
803 
804  if (! PcVideoSetBiosVesaMode(NewMode))
805  {
806  return FALSE;
807  }
808 
812  BiosVideoMode = NewMode;
815 
816  return TRUE;
817  }
818 
819  return FALSE;
820 }
#define VIDEOMODE_80X30
Definition: pcvideo.c:41
#define VIDEOMODE_80X43
Definition: pcvideo.c:43
static BOOLEAN PcVideoSetMode80x50_80x43(VOID)
Definition: pcvideo.c:611
#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:682
#define VIDEOMODE_80X60
Definition: pcvideo.c:44
#define VIDEOMODE_EXTENDED_TEXT
Definition: pcvideo.c:39
#define VIDEOMODE_80X28
Definition: pcvideo.c:40
#define VIDEOMODE_NORMAL_TEXT
Definition: pcvideo.c:38
static SVGA_MODE_INFORMATION VesaVideoModeInformation
Definition: pcvideo.c:117
static USHORT BiosVideoMode
Definition: pcvideo.c:111
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:601
static BOOLEAN VesaVideoMode
Definition: pcvideo.c:116
static ULONG ScreenHeight
Definition: pcvideo.c:113
USHORT WidthInPixels
Definition: pcvideo.c:67
static ULONG BytesPerScanLine
Definition: pcvideo.c:114
static ULONG CurrentMemoryBank
Definition: pcvideo.c:118
static BOOLEAN PcVideoVesaGetSVGAModeInformation(USHORT Mode, PSVGA_MODE_INFORMATION ModeInformation)
Definition: pcvideo.c:457
#define VIDEOMODE_80X34
Definition: pcvideo.c:42
static BOOLEAN PcVideoSetBiosVesaMode(USHORT Mode)
Definition: pcvideo.c:529
static BOOLEAN PcVideoSetMode80x30(VOID)
Definition: pcvideo.c:655
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:115
unsigned char UCHAR
Definition: xmlstorage.h:181
static BOOLEAN PcVideoSetMode80x28(VOID)
Definition: pcvideo.c:642
static BOOLEAN PcVideoSetMode80x34(VOID)
Definition: pcvideo.c:667
USHORT BytesPerScanLine
Definition: pcvideo.c:65
unsigned short USHORT
Definition: pedump.c:61
static VOID PcVideoSetBiosMode(UCHAR VideoMode)
Definition: pcvideo.c:208
static ULONG ScreenWidth
Definition: pcvideo.c:112
USHORT HeightInPixels
Definition: pcvideo.c:68
static BOOLEAN PcVideoSetMode80x60(VOID)
Definition: pcvideo.c:698

Referenced by PcVideoSetDisplayMode().

◆ PcVideoSetMode80x25()

static BOOLEAN PcVideoSetMode80x25 ( VOID  )
static

Definition at line 601 of file pcvideo.c.

602 {
603  PcVideoSetBiosMode(0x03);
604  ScreenWidth = 80;
605  ScreenHeight = 25;
606 
607  return TRUE;
608 }
#define TRUE
Definition: types.h:120
static ULONG ScreenHeight
Definition: pcvideo.c:113
static VOID PcVideoSetBiosMode(UCHAR VideoMode)
Definition: pcvideo.c:208
static ULONG ScreenWidth
Definition: pcvideo.c:112

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

◆ PcVideoSetMode80x28()

static BOOLEAN PcVideoSetMode80x28 ( VOID  )
static

Definition at line 642 of file pcvideo.c.

643 {
644  /* FIXME: Is this VGA-only? */
647  PcVideoDefineCursor(11, 12);
648  ScreenWidth = 80;
649  ScreenHeight = 28;
650 
651  return TRUE;
652 }
static VOID PcVideoSetFont8x14(VOID)
Definition: pcvideo.c:248
#define TRUE
Definition: types.h:120
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:601
static ULONG ScreenHeight
Definition: pcvideo.c:113
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:315
static ULONG ScreenWidth
Definition: pcvideo.c:112

Referenced by PcVideoSetMode().

◆ PcVideoSetMode80x30()

static BOOLEAN PcVideoSetMode80x30 ( VOID  )
static

Definition at line 655 of file pcvideo.c.

656 {
657  /* FIXME: Is this VGA-only? */
660  ScreenWidth = 80;
661  ScreenHeight = 30;
662 
663  return TRUE;
664 }
#define TRUE
Definition: types.h:120
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:601
static ULONG ScreenHeight
Definition: pcvideo.c:113
static ULONG ScreenWidth
Definition: pcvideo.c:112
static VOID PcVideoSet480ScanLines(VOID)
Definition: pcvideo.c:378

Referenced by PcVideoSetMode().

◆ PcVideoSetMode80x34()

static BOOLEAN PcVideoSetMode80x34 ( VOID  )
static

Definition at line 667 of file pcvideo.c.

668 {
669  /* FIXME: Is this VGA-only? */
673  PcVideoDefineCursor(11, 12);
675  ScreenWidth = 80;
676  ScreenHeight = 34;
677 
678  return TRUE;
679 }
static VOID PcVideoSetFont8x14(VOID)
Definition: pcvideo.c:248
#define TRUE
Definition: types.h:120
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:601
static ULONG ScreenHeight
Definition: pcvideo.c:113
static VOID PcVideoSetDisplayEnd(VOID)
Definition: pcvideo.c:435
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:315
static ULONG ScreenWidth
Definition: pcvideo.c:112
static VOID PcVideoSet480ScanLines(VOID)
Definition: pcvideo.c:378

Referenced by PcVideoSetMode().

◆ PcVideoSetMode80x43()

static BOOLEAN PcVideoSetMode80x43 ( VOID  )
static

Definition at line 682 of file pcvideo.c.

683 {
684  /* FIXME: Is this VGA-only? */
690  PcVideoDefineCursor(6, 7);
691  ScreenWidth = 80;
692  ScreenHeight = 43;
693 
694  return TRUE;
695 }
#define TRUE
Definition: types.h:120
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:601
static ULONG ScreenHeight
Definition: pcvideo.c:113
static VOID PcVideoSelectAlternatePrintScreen(VOID)
Definition: pcvideo.c:266
#define VERTRES_350_SCANLINES
Definition: pcvideo.c:51
static VOID PcVideoSetVerticalResolution(UCHAR VerticalResolutionMode)
Definition: pcvideo.c:351
static VOID PcVideoDisableCursorEmulation(VOID)
Definition: pcvideo.c:290
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:315
static VOID PcVideoSetFont8x8(VOID)
Definition: pcvideo.c:230
static ULONG ScreenWidth
Definition: pcvideo.c:112

Referenced by PcVideoSetMode().

◆ PcVideoSetMode80x50_80x43()

static BOOLEAN PcVideoSetMode80x50_80x43 ( VOID  )
static

Definition at line 611 of file pcvideo.c.

612 {
614  {
615  PcVideoSetBiosMode(0x12);
619  PcVideoDefineCursor(6, 7);
620  ScreenWidth = 80;
621  ScreenHeight = 50;
622  }
624  {
625  PcVideoSetBiosMode(0x03);
629  PcVideoDefineCursor(6, 7);
630  ScreenWidth = 80;
631  ScreenHeight = 43;
632  }
633  else /* VIDEOCARD_CGA_OR_OTHER */
634  {
635  return FALSE;
636  }
637 
638  return TRUE;
639 }
#define TRUE
Definition: types.h:120
#define VIDEOCARD_VGA
Definition: pcvideo.c:36
static ULONG ScreenHeight
Definition: pcvideo.c:113
static VOID PcVideoSelectAlternatePrintScreen(VOID)
Definition: pcvideo.c:266
static ULONG PcVideoDetectVideoCard(VOID)
Definition: pcvideo.c:135
#define VIDEOCARD_EGA
Definition: pcvideo.c:35
static VOID PcVideoDisableCursorEmulation(VOID)
Definition: pcvideo.c:290
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:315
static VOID PcVideoSetFont8x8(VOID)
Definition: pcvideo.c:230
static VOID PcVideoSetBiosMode(UCHAR VideoMode)
Definition: pcvideo.c:208
static ULONG ScreenWidth
Definition: pcvideo.c:112

Referenced by PcVideoSetMode().

◆ PcVideoSetMode80x60()

static BOOLEAN PcVideoSetMode80x60 ( VOID  )
static

Definition at line 698 of file pcvideo.c.

699 {
700  /* FIXME: Is this VGA-only? */
706  PcVideoDefineCursor(6, 7);
708  ScreenWidth = 80;
709  ScreenHeight = 60;
710 
711  return TRUE;
712 }
#define TRUE
Definition: types.h:120
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:601
static ULONG ScreenHeight
Definition: pcvideo.c:113
static VOID PcVideoSetDisplayEnd(VOID)
Definition: pcvideo.c:435
static VOID PcVideoSelectAlternatePrintScreen(VOID)
Definition: pcvideo.c:266
static VOID PcVideoDisableCursorEmulation(VOID)
Definition: pcvideo.c:290
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:315
static VOID PcVideoSetFont8x8(VOID)
Definition: pcvideo.c:230
static ULONG ScreenWidth
Definition: pcvideo.c:112
static VOID PcVideoSet480ScanLines(VOID)
Definition: pcvideo.c:378

Referenced by PcVideoSetMode().

◆ PcVideoSetPaletteColor()

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

Definition at line 1118 of file pcvideo.c.

1119 {
1124 }
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:26
#define VIDEOPORT_PALETTE_DATA
Definition: pcvideo.c:27
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by PcMachInit().

◆ PcVideoSetTextCursorPosition()

VOID PcVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 1008 of file pcvideo.c.

1009 {
1010  REGS Regs;
1011 
1012  /* Int 10h AH=02h
1013  * VIDEO - SET CURSOR POSITION
1014  *
1015  * AH = 02h
1016  * BH = page number
1017  * 0-3 in modes 2&3
1018  * 0-7 in modes 0&1
1019  * 0 in graphics modes
1020  * DH = row (00h is top)
1021  * DL = column (00h is left)
1022  * Return:
1023  * Nothing
1024  */
1025  Regs.b.ah = 0x02;
1026  Regs.b.bh = 0x00;
1027  Regs.b.dh = Y;
1028  Regs.b.dl = X;
1029  Int386(0x10, &Regs, &Regs);
1030 }
#define Y(I)
unsigned char ah
Definition: pcbios.h:120
unsigned char dh
Definition: pcbios.h:129
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char dl
Definition: pcbios.h:128
BYTEREGS b
Definition: pcbios.h:151
unsigned char bh
Definition: pcbios.h:123
Definition: pcbios.h:146
#define X(b, s)

Referenced by PcMachInit().

◆ PcVideoSetVerticalResolution()

static VOID PcVideoSetVerticalResolution ( UCHAR  VerticalResolutionMode)
static

Definition at line 351 of file pcvideo.c.

352 {
353  REGS Regs;
354 
355  /* Int 10h AH=12h BL=30h
356  * VIDEO - ALTERNATE FUNCTION SELECT (VGA) - SELECT VERTICAL RESOLUTION
357  *
358  * AH = 12h
359  * BL = 30h
360  * AL = vertical resolution
361  * 00h 200 scan lines
362  * 01h 350 scan lines
363  * 02h 400 scan lines
364  * Return:
365  * AL = 12h if function supported
366  *
367  * Specify the number of scan lines used to display text modes.
368  *
369  * The specified resolution will take effect on the next mode set.
370  */
371  Regs.b.ah = 0x12;
372  Regs.b.bl = 0x30;
373  Regs.b.al = VerticalResolutionMode;
374  Int386(0x10, &Regs, &Regs);
375 }
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char bl
Definition: pcbios.h:122
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
Definition: pcbios.h:146

Referenced by PcVideoSetMode80x43().

◆ PcVideoSync()

VOID PcVideoSync ( VOID  )

Definition at line 1136 of file pcvideo.c.

1137 {
1139  {
1140  /*
1141  * Keep reading the port until bit 3 is clear
1142  * This waits for the current retrace to end and
1143  * we can catch the next one so we know we are
1144  * getting a full retrace.
1145  */
1146  }
1147 
1148  while (!(READ_PORT_UCHAR((UCHAR*)VIDEOPORT_VERTICAL_RETRACE) & 0x08))
1149  {
1150  /*
1151  * Keep reading the port until bit 3 is set
1152  * Now that we know we aren't doing a vertical
1153  * retrace we need to wait for the next one.
1154  */
1155  }
1156 }
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
unsigned char UCHAR
Definition: xmlstorage.h:181
#define VIDEOPORT_VERTICAL_RETRACE
Definition: pcvideo.c:28

Referenced by PcMachInit().

◆ PcVideoVesaGetSVGAModeInformation()

static BOOLEAN PcVideoVesaGetSVGAModeInformation ( USHORT  Mode,
PSVGA_MODE_INFORMATION  ModeInformation 
)
static

Definition at line 457 of file pcvideo.c.

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

Referenced by PcVideoSetMode().

Variable Documentation

◆ BiosVideoMode

USHORT BiosVideoMode
static

Definition at line 111 of file pcvideo.c.

Referenced by PcVideoSetMode().

◆ BytesPerScanLine

ULONG BytesPerScanLine = 160
static

Definition at line 114 of file pcvideo.c.

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

◆ CurrentMemoryBank

ULONG CurrentMemoryBank = 0
static

Definition at line 118 of file pcvideo.c.

Referenced by PcVideoSetMemoryBank(), and PcVideoSetMode().

◆ DisplayMode

◆ ScreenHeight

◆ ScreenWidth

◆ VesaVideoMode

BOOLEAN VesaVideoMode = FALSE
static

◆ VesaVideoModeInformation

SVGA_MODE_INFORMATION VesaVideoModeInformation
static