ReactOS  0.4.15-dev-1068-g467feb9
pc.h File Reference

Go to the source code of this file.

Macros

#define __inpb(Port)   READ_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)))
 
#define __inpw(Port)   READ_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)))
 
#define __outpb(Port, Value)   WRITE_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)), (UCHAR)(Value))
 
#define __outpw(Port, Value)   WRITE_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)), (USHORT)(Value))
 

Functions

VOID NTAPI InitPaletteWithTable (_In_ PULONG Table, _In_ ULONG Count)
 
VOID PrepareForSetPixel (VOID)
 
FORCEINLINE VOID SetPixel (_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
 
VOID NTAPI PreserveRow (_In_ ULONG CurrentTop, _In_ ULONG TopDelta, _In_ BOOLEAN Restore)
 
VOID NTAPI DoScroll (_In_ ULONG Scroll)
 
VOID NTAPI DisplayCharacter (_In_ CHAR Character, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG TextColor, _In_ ULONG BackColor)
 

Variables

ULONG_PTR VgaRegisterBase
 
ULONG_PTR VgaBase
 
USHORT AT_Initialization []
 
USHORT VGA_640x480 []
 
UCHAR PixelMask [8]
 

Macro Definition Documentation

◆ __inpb

#define __inpb (   Port)    READ_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)))

Definition at line 10 of file pc.h.

◆ __inpw

#define __inpw (   Port)    READ_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)))

Definition at line 13 of file pc.h.

◆ __outpb

#define __outpb (   Port,
  Value 
)    WRITE_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)), (UCHAR)(Value))

Definition at line 16 of file pc.h.

◆ __outpw

#define __outpw (   Port,
  Value 
)    WRITE_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)), (USHORT)(Value))

Definition at line 19 of file pc.h.

Function Documentation

◆ DisplayCharacter()

VOID NTAPI DisplayCharacter ( _In_ CHAR  Character,
_In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  TextColor,
_In_ ULONG  BackColor 
)

Definition at line 13 of file bootvid.c.

19 {
20  PUCHAR FontChar;
21  ULONG i, j, XOffset;
22 
23  /* Get the font line for this character */
24  FontChar = &VidpFontData[Character * BOOTCHAR_HEIGHT - Top];
25 
26  /* Loop each pixel height */
27  for (i = BOOTCHAR_HEIGHT; i > 0; --i)
28  {
29  /* Loop each pixel width */
30  XOffset = Left;
31  for (j = (1 << 7); j > 0; j >>= 1)
32  {
33  /* Check if we should draw this pixel */
34  if (FontChar[Top] & (UCHAR)j)
35  {
36  /* We do, use the given Text Color */
37  SetPixel(XOffset, Top, (UCHAR)TextColor);
38  }
39  else if (BackColor < BV_COLOR_NONE)
40  {
41  /*
42  * This is a background pixel. We're drawing it
43  * unless it's transparent.
44  */
45  SetPixel(XOffset, Top, (UCHAR)BackColor);
46  }
47 
48  /* Increase X Offset */
49  XOffset++;
50  }
51 
52  /* Move to the next Y ordinate */
53  Top++;
54  }
55 }
VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: bootvid.c:265
unsigned char * PUCHAR
Definition: retypes.h:3
#define BOOTCHAR_HEIGHT
Definition: precomp.h:27
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define BV_COLOR_NONE
Definition: display.h:31
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR VidpFontData[256 *BOOTCHAR_HEIGHT]
Definition: fontdata.c:9
unsigned int ULONG
Definition: retypes.h:1
static LPHIST_ENTRY Top
Definition: history.c:53

◆ DoScroll()

VOID NTAPI DoScroll ( _In_ ULONG  Scroll)

Definition at line 59 of file bootvid.c.

61 {
62  ULONG Top, Offset;
63  PUSHORT SourceOffset, DestOffset;
64  PUSHORT i, j;
65 
66  /* Set memory positions of the scroll */
68  DestOffset = &SourceOffset[Scroll * (SCREEN_WIDTH / 8)];
69 
70  /* Start loop */
71  for (Top = VidpScrollRegion[1]; Top <= VidpScrollRegion[3]; ++Top)
72  {
73  /* Set number of bytes to loop and start offset */
74  Offset = VidpScrollRegion[0] >> 3;
75  j = SourceOffset;
76 
77  /* Check if this is part of the scroll region */
78  if (Offset <= (VidpScrollRegion[2] >> 3))
79  {
80  /* Update position */
81  i = (PUSHORT)(DestOffset - SourceOffset);
82 
83  /* Loop the X axis */
84  do
85  {
86  /* Write value in the new position so that we can do the scroll */
88 
89  /* Move to the next memory location to write to */
90  j++;
91 
92  /* Move to the next byte in the region */
93  Offset++;
94 
95  /* Make sure we don't go past the scroll region */
96  } while (Offset <= (VidpScrollRegion[2] >> 3));
97  }
98 
99  /* Move to the next line */
100  SourceOffset += (SCREEN_WIDTH / 8);
101  DestOffset += (SCREEN_WIDTH / 8);
102  }
103 }
PUSHORT VgaArmBase
Definition: bootvid.c:6
#define SCREEN_WIDTH
Definition: pc98video.c:27
NTKERNELAPI VOID NTAPI WRITE_REGISTER_USHORT(IN PUSHORT Register, IN USHORT Value)
uint32_t ULONG_PTR
Definition: typedefs.h:65
ULONG VidpScrollRegion[4]
Definition: common.c:10
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT SourceOffset
Definition: ndis.h:3167
unsigned int ULONG
Definition: retypes.h:1
NTKERNELAPI USHORT NTAPI READ_REGISTER_USHORT(IN PUSHORT Register)
static LPHIST_ENTRY Top
Definition: history.c:53
unsigned short * PUSHORT
Definition: retypes.h:2

◆ InitPaletteWithTable()

VOID NTAPI InitPaletteWithTable ( _In_ PULONG  Table,
_In_ ULONG  Count 
)

Definition at line 170 of file bootvid.c.

173 {
175 }
#define UNIMPLEMENTED
Definition: debug.h:115

◆ PrepareForSetPixel()

VOID PrepareForSetPixel ( VOID  )

Definition at line 81 of file vga.c.

82 {
83  /* Switch to mode 10 */
84  ReadWriteMode(10);
85 
86  /* Clear the 4 planes (we're already in unchained mode here) */
88 
89  /* Select the color don't care register */
91 }
static VOID NTAPI ReadWriteMode(_In_ UCHAR Mode)
Definition: vga.c:65
#define GRAPH_ADDRESS_PORT
Definition: vga.h:81
#define VGA_BASE_IO_PORT
Definition: vga.h:38
#define SEQ_ADDRESS_PORT
Definition: vga.h:69
#define __outpw(Port, Value)
Definition: pc.h:19

Referenced by BitBlt(), and RleBitBlt().

◆ PreserveRow()

VOID NTAPI PreserveRow ( _In_ ULONG  CurrentTop,
_In_ ULONG  TopDelta,
_In_ BOOLEAN  Restore 
)

Definition at line 107 of file bootvid.c.

111 {
112  PUSHORT Position1, Position2;
113  ULONG Count;
114 
115  /* Calculate the position in memory for the row */
116  if (Restore)
117  {
118  /* Restore the row by copying back the contents saved off-screen */
119  Position1 = &VgaArmBase[CurrentTop * (SCREEN_WIDTH / 8)];
120  Position2 = &VgaArmBase[SCREEN_HEIGHT * (SCREEN_WIDTH / 8)];
121  }
122  else
123  {
124  /* Preserve the row by saving its contents off-screen */
125  Position1 = &VgaArmBase[SCREEN_HEIGHT * (SCREEN_WIDTH / 8)];
126  Position2 = &VgaArmBase[CurrentTop * (SCREEN_WIDTH / 8)];
127  }
128 
129  /* Set the count and loop every pixel */
130  Count = TopDelta * (SCREEN_WIDTH / 8);
131  while (Count--)
132  {
133  /* Write the data back on the other position */
134  WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2));
135 
136  /* Increase both positions */
137  Position1++;
138  Position2++;
139  }
140 }
PUSHORT VgaArmBase
Definition: bootvid.c:6
#define SCREEN_WIDTH
Definition: pc98video.c:27
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1223
NTKERNELAPI VOID NTAPI WRITE_REGISTER_USHORT(IN PUSHORT Register, IN USHORT Value)
#define SCREEN_HEIGHT
Definition: pc98video.c:28
unsigned int ULONG
Definition: retypes.h:1
NTKERNELAPI USHORT NTAPI READ_REGISTER_USHORT(IN PUSHORT Register)
unsigned short * PUSHORT
Definition: retypes.h:2

◆ SetPixel()

FORCEINLINE VOID SetPixel ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ UCHAR  Color 
)

Definition at line 33 of file pc.h.

37 {
38  PUCHAR PixelPosition;
39 
40  /* Calculate the pixel position */
41  PixelPosition = (PUCHAR)(VgaBase + (Left >> 3) + (Top * (SCREEN_WIDTH / 8)));
42 
43  /* Select the bitmask register and write the mask */
45 
46  /* Dummy read to load latch registers */
47  (VOID)READ_REGISTER_UCHAR(PixelPosition);
48 
49  /* Set the new color */
50  WRITE_REGISTER_UCHAR(PixelPosition, Color);
51 }
unsigned char * PUCHAR
Definition: retypes.h:3
#define SCREEN_WIDTH
Definition: pc98video.c:27
ULONG_PTR VgaBase
Definition: vga.c:59
#define GRAPH_ADDRESS_PORT
Definition: vga.h:81
#define VGA_BASE_IO_PORT
Definition: vga.h:38
#define VOID
Definition: acefi.h:82
#define IND_BIT_MASK
Definition: vga.h:114
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)
UCHAR PixelMask[8]
Definition: vga.c:27
#define __outpw(Port, Value)
Definition: pc.h:19
static LPHIST_ENTRY Top
Definition: history.c:53
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)

Variable Documentation

◆ AT_Initialization

USHORT AT_Initialization[]

Definition at line 7 of file bootdata.c.

Referenced by VidInitialize(), and VidResetDisplay().

◆ PixelMask

UCHAR PixelMask[8]

Definition at line 27 of file vga.c.

Referenced by ConsoleEfiGopIsPixelFormatSupported(), DisplayCharacter(), and SetPixel().

◆ VGA_640x480

USHORT VGA_640x480[]

Definition at line 38 of file bootdata.c.

Referenced by VidInitialize(), and VidResetDisplay().

◆ VgaBase

◆ VgaRegisterBase

ULONG_PTR VgaRegisterBase

Definition at line 58 of file vga.c.

Referenced by VgaInterpretCmdStream(), and VidInitialize().