ReactOS  0.4.15-dev-1201-gb2cf5a4
bootvid.c File Reference
#include "precomp.h"
Include dependency graph for bootvid.c:

Go to the source code of this file.

Macros

#define PEGC_MAX_COLORS   256
 

Functions

static BOOLEAN GraphGetStatus (_In_ UCHAR Status)
 
static BOOLEAN TestMmio (VOID)
 
static BOOLEAN HasPegcController (VOID)
 
static VOID TextSync (VOID)
 
static VOID InitializeDisplay (VOID)
 
static VOID SetPaletteEntryRGB (_In_ ULONG Id, _In_ RGBQUAD Rgb)
 
VOID NTAPI InitPaletteWithTable (_In_ PULONG Table, _In_ ULONG Count)
 
VOID NTAPI DisplayCharacter (_In_ CHAR Character, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG TextColor, _In_ ULONG BackColor)
 
VOID NTAPI PreserveRow (_In_ ULONG CurrentTop, _In_ ULONG TopDelta, _In_ BOOLEAN Restore)
 
VOID PrepareForSetPixel (VOID)
 
VOID NTAPI DoScroll (_In_ ULONG Scroll)
 
BOOLEAN NTAPI VidInitialize (_In_ BOOLEAN SetMode)
 
VOID NTAPI VidCleanUp (VOID)
 
VOID NTAPI VidResetDisplay (_In_ BOOLEAN HalReset)
 
VOID NTAPI VidScreenToBufferBlt (_Out_writes_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_ ULONG Delta)
 
VOID NTAPI VidSolidColorFill (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR Color)
 

Variables

static ULONG_PTR PegcControl = 0
 
ULONG_PTR FrameBuffer = 0
 

Macro Definition Documentation

◆ PEGC_MAX_COLORS

#define PEGC_MAX_COLORS   256

Definition at line 17 of file bootvid.c.

Function Documentation

◆ DisplayCharacter()

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

Definition at line 268 of file bootvid.c.

274 {
275  ULONG X, Y, PixelMask;
276  PUCHAR FontChar = GetFontPtr(Character);
277 
278  for (Y = Top;
279  Y < Top + BOOTCHAR_HEIGHT;
280  ++Y, FontChar += FONT_PTR_DELTA)
281  {
282  for (X = Left, PixelMask = 1 << (BOOTCHAR_WIDTH - 1);
283  X < Left + BOOTCHAR_WIDTH;
284  ++X, PixelMask >>= 1)
285  {
286  if (*FontChar & PixelMask)
287  SetPixel(X, Y, (UCHAR)TextColor);
288  else if (BackColor < BV_COLOR_NONE)
289  SetPixel(X, Y, (UCHAR)BackColor);
290  }
291  }
292 }
VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: bootvid.c:265
#define Y(I)
unsigned char * PUCHAR
Definition: retypes.h:3
#define FONT_PTR_DELTA
Definition: precomp.h:75
#define BOOTCHAR_HEIGHT
Definition: precomp.h:27
#define BV_COLOR_NONE
Definition: display.h:31
#define GetFontPtr(_Char)
Definition: precomp.h:74
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned int ULONG
Definition: retypes.h:1
UCHAR PixelMask[8]
Definition: vga.c:27
static LPHIST_ENTRY Top
Definition: history.c:53
#define BOOTCHAR_WIDTH
Definition: precomp.h:28
#define X(b, s)

◆ DoScroll()

VOID NTAPI DoScroll ( _In_ ULONG  Scroll)

Definition at line 329 of file bootvid.c.

331 {
332  USHORT i, Line;
333  PUCHAR Src, Dst;
334  PULONG SrcWide, DstWide;
335  USHORT PixelCount = (VidpScrollRegion[2] - VidpScrollRegion[0]) + 1;
338 
339  for (Line = VidpScrollRegion[1]; Line <= VidpScrollRegion[3]; Line++)
340  {
341  SrcWide = (PULONG)SourceOffset;
342  DstWide = (PULONG)DestinationOffset;
343  for (i = 0; i < PixelCount / sizeof(ULONG); i++)
344  WRITE_REGISTER_ULONG(DstWide++, READ_REGISTER_ULONG(SrcWide++));
345 
346  Src = (PUCHAR)SrcWide;
347  Dst = (PUCHAR)DstWide;
348  for (i = 0; i < PixelCount % sizeof(ULONG); i++)
350 
353  }
354 }
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
unsigned char * PUCHAR
Definition: retypes.h:3
#define SCREEN_WIDTH
Definition: pc98video.c:27
NTKERNELAPI ULONG NTAPI READ_REGISTER_ULONG(IN PULONG Register)
ULONG_PTR FrameBuffer
Definition: bootvid.c:15
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
Definition: ncftp.h:79
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT SourceOffset
Definition: ndis.h:3167
_In_ UINT DestinationOffset
Definition: ndis.h:3167
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)
#define Dst
Definition: mesh.h:153
unsigned short USHORT
Definition: pedump.c:61
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)
#define FB_OFFSET(x, y)
Definition: pc98.h:17
struct Line Line

◆ GraphGetStatus()

static BOOLEAN GraphGetStatus ( _In_ UCHAR  Status)
static

Definition at line 22 of file bootvid.c.

24 {
25  UCHAR Result;
26 
29 
30  return (Result & GRAPH_STATUS_SET) && (Result != 0xFF);
31 }
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:21
unsigned char * PUCHAR
Definition: retypes.h:3
#define GRAPH_STATUS_SET
Definition: video.h:347
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define GRAPH_IO_o_STATUS_SELECT
Definition: video.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:20
#define GRAPH_IO_i_STATUS
Definition: video.h:346

Referenced by HasPegcController().

◆ HasPegcController()

static BOOLEAN HasPegcController ( VOID  )
static

Definition at line 50 of file bootvid.c.

51 {
53 
55  return TestMmio();
56 
62 
63  return Success;
64 }
unsigned char * PUCHAR
Definition: retypes.h:3
static BOOLEAN TestMmio(VOID)
Definition: bootvid.c:34
#define GRAPH_STATUS_PEGC
Definition: video.h:352
#define GDC2_IO_o_MODE_FLIPFLOP2
Definition: video.h:280
#define GDC2_EGC_FF_PROTECT
Definition: video.h:285
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
static BOOLEAN GraphGetStatus(_In_ UCHAR Status)
Definition: bootvid.c:22
#define GDC2_EGC_FF_UNPROTECT
Definition: video.h:286
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:20
#define GDC2_MODE_PEGC_ENABLE
Definition: video.h:288
#define GDC2_MODE_PEGC_DISABLE
Definition: video.h:287

Referenced by Pc98VidFindAdapter(), and VidInitialize().

◆ InitializeDisplay()

static VOID InitializeDisplay ( VOID  )
static

Definition at line 77 of file bootvid.c.

78 {
79  SYNCPARAM SyncParameters;
80  CSRFORMPARAM CursorParameters;
82  PITCHPARAM PitchParameters;
83  PRAMPARAM RamParameters;
84  ZOOMPARAM ZoomParameters;
85  UCHAR RelayState;
86 
87  /* RESET, without FIFO check */
90 
91  /* Configure chipset */
103 
104  /* =========================== MASTER ============================ */
105 
106  /* MASTER */
108 
109  /* SYNC */
112  SyncParameters.ScreenWidthChars = 80;
113  SyncParameters.HorizontalSyncWidth = 12;
114  SyncParameters.VerticalSyncWidth = 2;
115  SyncParameters.HorizontalFrontPorchWidth = 4;
116  SyncParameters.HorizontalBackPorchWidth = 4;
117  SyncParameters.VerticalFrontPorchWidth = 6;
118  SyncParameters.ScreenWidthLines = 480;
119  SyncParameters.VerticalBackPorchWidth = 37;
121  WRITE_GDC_SYNC((PUCHAR)GDC1_IO_o_PARAM, &SyncParameters);
122 
123  /* CSRFORM */
124  CursorParameters.Show = FALSE;
125  CursorParameters.Blink = FALSE;
126  CursorParameters.BlinkRate = 12;
127  CursorParameters.LinesPerRow = 16;
128  CursorParameters.StartScanLine = 0;
129  CursorParameters.EndScanLine = 15;
131  WRITE_GDC_CSRFORM((PUCHAR)GDC1_IO_o_PARAM, &CursorParameters);
132 
133  /* PITCH */
134  PitchParameters.WordsPerScanline = BYTES_PER_SCANLINE;
136  WRITE_GDC_PITCH((PUCHAR)GDC1_IO_o_PARAM, &PitchParameters);
137 
138  /* PRAM */
139  RamParameters.StartingAddress = 0;
140  RamParameters.Length = 1023;
141  RamParameters.ImageBit = FALSE;
142  RamParameters.WideDisplay = FALSE;
144  WRITE_GDC_PRAM((PUCHAR)GDC1_IO_o_PARAM, &RamParameters);
145 
146  /* ZOOM */
147  ZoomParameters.DisplayZoomFactor = 0;
148  ZoomParameters.WritingZoomFactor = 0;
150  WRITE_GDC_ZOOM((PUCHAR)GDC1_IO_o_PARAM, &ZoomParameters);
151 
152  /* CSRW */
153  CursorPosition.CursorAddress = 0;
154  CursorPosition.DotAddress = 0;
157 
158  /* START */
160 
161  /* ============================ SLAVE ============================ */
162 
163  /* SLAVE */
165 
166  /* SYNC */
170  SyncParameters.ScreenWidthChars = 80;
171  SyncParameters.HorizontalSyncWidth = 12;
172  SyncParameters.VerticalSyncWidth = 2;
173  SyncParameters.HorizontalFrontPorchWidth = 4;
174  SyncParameters.HorizontalBackPorchWidth = 132;
175  SyncParameters.VerticalFrontPorchWidth = 6;
176  SyncParameters.ScreenWidthLines = 480;
177  SyncParameters.VerticalBackPorchWidth = 37;
179  WRITE_GDC_SYNC((PUCHAR)GDC2_IO_o_PARAM, &SyncParameters);
180 
181  /* CSRFORM */
182  CursorParameters.Show = FALSE;
183  CursorParameters.Blink = FALSE;
184  CursorParameters.BlinkRate = 0;
185  CursorParameters.LinesPerRow = 1;
186  CursorParameters.StartScanLine = 0;
187  CursorParameters.EndScanLine = 0;
189  WRITE_GDC_CSRFORM((PUCHAR)GDC2_IO_o_PARAM, &CursorParameters);
190 
191  /* PITCH */
192  PitchParameters.WordsPerScanline = BYTES_PER_SCANLINE;
194  WRITE_GDC_PITCH((PUCHAR)GDC2_IO_o_PARAM, &PitchParameters);
195 
196  /* PRAM */
197  RamParameters.StartingAddress = 0;
198  RamParameters.Length = 1023;
199  RamParameters.ImageBit = TRUE;
200  RamParameters.WideDisplay = FALSE;
202  WRITE_GDC_PRAM((PUCHAR)GDC2_IO_o_PARAM, &RamParameters);
203 
204  /* ZOOM */
205  ZoomParameters.DisplayZoomFactor = 0;
206  ZoomParameters.WritingZoomFactor = 0;
208  WRITE_GDC_ZOOM((PUCHAR)GDC2_IO_o_PARAM, &ZoomParameters);
209 
210  /* CSRW */
211  CursorPosition.CursorAddress = 0;
212  CursorPosition.DotAddress = 0;
215 
216  /* Synchronize the master sync source */
217  TextSync();
218  TextSync();
219  TextSync();
220  TextSync();
221 
222  /* START */
224 
225  /* 256 colors */
232 
233  /* Select the video source */
235  RelayState |= GRAPH_VID_SRC_INTERNAL | GRAPH_SRC_GDC;
237 }
#define GRAPH_RELAY_0
Definition: video.h:365
#define GDC_COMMAND_CSRFORM
Definition: video.h:173
#define PEGC_FB_MAP
Definition: video.h:426
static VOID TextSync(VOID)
Definition: bootvid.c:67
#define GDC2_MODE_LINES_400
Definition: video.h:301
static ULONG_PTR PegcControl
Definition: bootvid.c:14
#define GRAPH_VID_SRC_INTERNAL
Definition: video.h:370
BOOLEAN ImageBit
Definition: video.h:207
USHORT Length
Definition: video.h:206
ULONG StartingAddress
Definition: video.h:205
UCHAR StartScanLine
Definition: video.h:180
UCHAR VerticalFrontPorchWidth
Definition: video.h:98
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:21
#define TRUE
Definition: types.h:120
#define GDC1_IO_o_MODE_FLIPFLOP1
Definition: video.h:238
#define GDC_COMMAND_MASTER
Definition: video.h:200
unsigned char * PUCHAR
Definition: retypes.h:3
#define GRAPH_SRC_GDC
Definition: video.h:373
#define GRAPH_IO_i_RELAY
Definition: video.h:364
NTKERNELAPI VOID NTAPI WRITE_REGISTER_USHORT(IN PUSHORT Register, IN USHORT Value)
#define GDC2_IO_o_VIDEO_PAGE_ACCESS
Definition: video.h:274
#define GDC2_IO_o_VIDEO_PAGE
Definition: video.h:273
#define GDC2_MODE_LINES_800
Definition: video.h:302
#define GDC_COMMAND_BCTRL_START
Definition: video.h:73
FORCEINLINE VOID WRITE_GDC1_COMMAND(UCHAR Command)
Definition: video.h:326
#define GDC2_IO_o_MODE_FLIPFLOP2
Definition: video.h:280
FORCEINLINE VOID WRITE_GDC_ZOOM(PUCHAR Port, PZOOMPARAM ZoomParameters)
Definition: video.h:133
#define GDC2_MODE_LCD
Definition: video.h:298
#define SYNC_DRAW_DURING_ACTIVE_DISPLAY_TIME_AND_RETRACE_BLANKING
Definition: video.h:87
BOOLEAN WideDisplay
Definition: video.h:208
UCHAR VerticalBackPorchWidth
Definition: video.h:100
#define GDC2_EGC_FF_PROTECT
Definition: video.h:285
#define FALSE
Definition: types.h:117
FORCEINLINE VOID WRITE_GDC_PITCH(PUCHAR Port, PPITCHPARAM PitchParameters)
Definition: video.h:146
UCHAR WritingZoomFactor
Definition: video.h:128
UCHAR HorizontalSyncWidth
Definition: video.h:94
#define GDC_COMMAND_PITCH
Definition: video.h:138
FORCEINLINE VOID WRITE_GDC_CSRFORM(PUCHAR Port, PCSRFORMPARAM CursorParameters)
Definition: video.h:186
#define GDC2_MODE_GRCG
Definition: video.h:283
UCHAR DisplayZoomFactor
Definition: video.h:127
UCHAR EndScanLine
Definition: video.h:181
#define BYTES_PER_SCANLINE
Definition: pc98video.c:29
#define SYNC_DISPLAY_MODE_GRAPHICS_AND_CHARACTERS
Definition: video.h:79
UCHAR ScreenWidthChars
Definition: video.h:93
FORCEINLINE VOID WRITE_GDC2_COMMAND(UCHAR Command)
Definition: video.h:336
#define GRAPH_HF_31KHZ
Definition: video.h:362
#define PEGC_MMIO_MODE
Definition: video.h:420
UCHAR HorizontalBackPorchWidth
Definition: video.h:97
#define SYNC_DISPLAY_MODE_GRAPHICS
Definition: video.h:80
#define GDC_COMMAND_RESET1
Definition: video.h:68
unsigned char UCHAR
Definition: xmlstorage.h:181
#define GDC2_IO_o_COMMAND
Definition: video.h:272
#define GDC_COMMAND_SLAVE
Definition: video.h:199
#define GDC2_EGC_FF_UNPROTECT
Definition: video.h:286
#define GRAPH_MODE_COLORED
Definition: video.h:241
FORCEINLINE VOID WRITE_GDC_SYNC(PUCHAR Port, PSYNCPARAM SyncParameters)
Definition: video.h:105
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:20
#define PEGC_MMIO_FRAMEBUFFER
Definition: video.h:424
#define GDC2_CLOCK2_5MHZ
Definition: video.h:308
#define GDC2_MODE_PEGC_ENABLE
Definition: video.h:288
USHORT ScreenWidthLines
Definition: video.h:99
#define SYNC_DRAW_ONLY_DURING_RETRACE_BLANKING
Definition: video.h:88
UCHAR Flags
Definition: video.h:78
#define GDC_COMMAND_SYNC_ON
Definition: video.h:75
#define GRAPH_IO_o_HORIZONTAL_SCAN_RATE
Definition: video.h:360
#define GDC_COMMAND_CSRW
Definition: video.h:151
#define SYNC_VIDEO_FRAMING_NONINTERLACED
Definition: video.h:83
BOOLEAN Show
Definition: video.h:176
FORCEINLINE VOID WRITE_GDC_CSRW(PUCHAR Port, PCSRWPARAM CursorParameters)
Definition: video.h:160
UCHAR VerticalSyncWidth
Definition: video.h:95
ULONG WordsPerScanline
Definition: video.h:141
#define PEGC_MODE_PACKED
Definition: video.h:421
UCHAR BlinkRate
Definition: video.h:178
BOOLEAN Blink
Definition: video.h:177
#define GDC1_IO_o_PARAM
Definition: video.h:234
#define GRAPH_RELAY_1
Definition: video.h:366
FORCEINLINE VOID WRITE_GDC_PRAM(PUCHAR Port, PPRAMPARAM RamParameters)
Definition: video.h:213
#define GDC_COMMAND_PRAM
Definition: video.h:202
#define SYNC_STATIC_RAM_NO_REFRESH
Definition: video.h:90
#define GDC2_IO_o_PARAM
Definition: video.h:271
static USHORT CursorPosition
Definition: pc98cons.c:20
#define GDC1_IO_o_COMMAND
Definition: video.h:235
unsigned short * PUSHORT
Definition: retypes.h:2
#define GDC_COMMAND_ZOOM
Definition: video.h:124
#define GDC2_CLOCK1_5MHZ
Definition: video.h:306
#define GRAPH_IO_o_RELAY
Definition: video.h:368
UCHAR HorizontalFrontPorchWidth
Definition: video.h:96
UCHAR LinesPerRow
Definition: video.h:179
#define GDC2_MODE_ODD_RLINE_SHOW
Definition: video.h:247
#define GDC2_MODE_COLORS_16
Definition: video.h:282

Referenced by VidResetDisplay().

◆ InitPaletteWithTable()

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

Definition at line 252 of file bootvid.c.

255 {
256  ULONG i;
257  PULONG Entry = Table;
258 
259  for (i = 0; i < Count; i++)
261 
262  for (i = Count; i < PEGC_MAX_COLORS; i++)
264 }
ASMGENDATA Table[]
Definition: genincdata.c:61
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1223
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
const RGBQUAD VidpDefaultPalette[BV_MAX_COLORS]
Definition: common.c:23
#define PEGC_MAX_COLORS
Definition: bootvid.c:17
static VOID SetPaletteEntryRGB(_In_ ULONG Id, _In_ RGBQUAD Rgb)
Definition: bootvid.c:240
unsigned int * PULONG
Definition: retypes.h:1
#define BV_COLOR_BLACK
Definition: display.h:15
unsigned int ULONG
Definition: retypes.h:1
base of all file and directory entries
Definition: entries.h:82

◆ PrepareForSetPixel()

VOID PrepareForSetPixel ( VOID  )

Definition at line 322 of file bootvid.c.

323 {
324  NOTHING;
325 }
#define NOTHING
Definition: env_spec_w32.h:461

◆ PreserveRow()

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

Definition at line 296 of file bootvid.c.

300 {
301  PULONG OldPosition, NewPosition;
302  ULONG PixelCount = TopDelta * (SCREEN_WIDTH / sizeof(ULONG));
303 
304  if (Restore)
305  {
306  /* Restore the row by copying back the contents saved off-screen */
307  OldPosition = (PULONG)(FrameBuffer + FB_OFFSET(0, SCREEN_HEIGHT));
308  NewPosition = (PULONG)(FrameBuffer + FB_OFFSET(0, CurrentTop));
309  }
310  else
311  {
312  /* Preserve the row by saving its contents off-screen */
313  OldPosition = (PULONG)(FrameBuffer + FB_OFFSET(0, CurrentTop));
314  NewPosition = (PULONG)(FrameBuffer + FB_OFFSET(0, SCREEN_HEIGHT));
315  }
316 
317  while (PixelCount--)
318  WRITE_REGISTER_ULONG(NewPosition++, READ_REGISTER_ULONG(OldPosition++));
319 }
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
#define SCREEN_WIDTH
Definition: pc98video.c:27
NTKERNELAPI ULONG NTAPI READ_REGISTER_ULONG(IN PULONG Register)
ULONG_PTR FrameBuffer
Definition: bootvid.c:15
#define SCREEN_HEIGHT
Definition: pc98video.c:28
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
#define FB_OFFSET(x, y)
Definition: pc98.h:17

◆ SetPaletteEntryRGB()

static VOID SetPaletteEntryRGB ( _In_ ULONG  Id,
_In_ RGBQUAD  Rgb 
)
static

Definition at line 240 of file bootvid.c.

243 {
248 }
#define GDC2_IO_o_RED
Definition: video.h:277
#define GDC2_IO_o_BLUE
Definition: video.h:278
unsigned char * PUCHAR
Definition: retypes.h:3
#define GetRValue(quad)
Definition: precomp.h:64
DWORD Id
#define GetBValue(quad)
Definition: precomp.h:66
#define GetGValue(quad)
Definition: precomp.h:65
#define GDC2_IO_o_PALETTE_INDEX
Definition: video.h:275
#define GDC2_IO_o_GREEN
Definition: video.h:276
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:20

Referenced by InitPaletteWithTable().

◆ TestMmio()

static BOOLEAN TestMmio ( VOID  )
static

Definition at line 34 of file bootvid.c.

35 {
36  USHORT OldValue, NewValue;
37 
39 
40  /* Bits [15:1] are not writable */
43 
45 
46  return !(NewValue & 0x80);
47 }
static ULONG_PTR PegcControl
Definition: bootvid.c:14
NTKERNELAPI VOID NTAPI WRITE_REGISTER_USHORT(IN PUSHORT Register, IN USHORT Value)
#define PEGC_MMIO_MODE
Definition: video.h:420
unsigned short USHORT
Definition: pedump.c:61
NTKERNELAPI USHORT NTAPI READ_REGISTER_USHORT(IN PUSHORT Register)
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by HasPegcController().

◆ TextSync()

static VOID TextSync ( VOID  )
static

Definition at line 67 of file bootvid.c.

68 {
70  NOTHING;
71 
73  NOTHING;
74 }
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:21
unsigned char * PUCHAR
Definition: retypes.h:3
#define GDC1_IO_i_STATUS
Definition: video.h:230
#define NOTHING
Definition: env_spec_w32.h:461
#define GDC_STATUS_VSYNC
Definition: video.h:41

Referenced by InitializeDisplay().

◆ VidCleanUp()

VOID NTAPI VidCleanUp ( VOID  )

Definition at line 392 of file bootvid.c.

393 {
395 }
#define GRAPH_MODE_DISPLAY_DISABLE
Definition: video.h:253
#define GDC1_IO_o_MODE_FLIPFLOP1
Definition: video.h:238
unsigned char * PUCHAR
Definition: retypes.h:3
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:20

◆ VidInitialize()

BOOLEAN NTAPI VidInitialize ( _In_ BOOLEAN  SetMode)

Definition at line 360 of file bootvid.c.

362 {
364 
365  BaseAddress.QuadPart = VRAM_NORMAL_PLANE_I;
367  if (!PegcControl)
368  goto Failure;
369 
370  if (!HasPegcController())
371  goto Failure;
372 
375  if (!FrameBuffer)
376  goto Failure;
377 
378  if (SetMode)
380 
381  return TRUE;
382 
383 Failure:
384  if (PegcControl)
386 
387  return FALSE;
388 }
static ULONG_PTR PegcControl
Definition: bootvid.c:14
#define TRUE
Definition: types.h:120
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
#define PEGC_FRAMEBUFFER_PACKED
Definition: video.h:22
#define PEGC_FRAMEBUFFER_SIZE
Definition: video.h:23
VOID NTAPI VidResetDisplay(_In_ BOOLEAN HalReset)
Definition: bootvid.c:220
ULONG_PTR FrameBuffer
Definition: bootvid.c:15
#define FALSE
Definition: types.h:117
static BOOLEAN HasPegcController(VOID)
Definition: bootvid.c:50
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define PEGC_CONTROL_SIZE
Definition: video.h:25
#define VRAM_NORMAL_PLANE_I
Definition: video.h:15
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:193
#define ULONG_PTR
Definition: config.h:101

◆ VidResetDisplay()

VOID NTAPI VidResetDisplay ( _In_ BOOLEAN  HalReset)

Definition at line 399 of file bootvid.c.

401 {
402  PULONG PixelsPosition = (PULONG)(FrameBuffer + FB_OFFSET(0, 0));
403  ULONG PixelCount = ((SCREEN_WIDTH * SCREEN_HEIGHT) / sizeof(ULONG)) + 1;
404 
405  /* Clear the current position */
406  VidpCurrentX = 0;
407  VidpCurrentY = 0;
408 
409  /* Clear the screen with HAL if we were asked to */
410  if (HalReset)
411  HalResetDisplay();
412 
414 
415  /* 640x480 256-color 31 kHz mode */
417 
418  /* Re-initialize the palette and fill the screen black */
420  while (PixelCount--)
421  WRITE_REGISTER_ULONG(PixelsPosition++, 0);
422 
424 }
#define HalResetDisplay
Definition: halfuncs.h:45
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
#define GRAPH_MODE_DISPLAY_DISABLE
Definition: video.h:253
#define GDC1_IO_o_MODE_FLIPFLOP1
Definition: video.h:238
unsigned char * PUCHAR
Definition: retypes.h:3
#define SCREEN_WIDTH
Definition: pc98video.c:27
ULONG_PTR FrameBuffer
Definition: bootvid.c:15
#define SCREEN_HEIGHT
Definition: pc98video.c:28
ULONG VidpCurrentY
Definition: common.c:8
static VOID InitializeDisplay(VOID)
Definition: bootvid.c:77
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:20
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
#define FB_OFFSET(x, y)
Definition: pc98.h:17
#define GRAPH_MODE_DISPLAY_ENABLE
Definition: video.h:254
ULONG VidpCurrentX
Definition: common.c:7
#define InitializePalette()
Definition: precomp.h:68

◆ VidScreenToBufferBlt()

VOID NTAPI VidScreenToBufferBlt ( _Out_writes_bytes_(Delta *Height) PUCHAR  Buffer,
_In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Width,
_In_ ULONG  Height,
_In_ ULONG  Delta 
)

Definition at line 428 of file bootvid.c.

435 {
436  ULONG X, Y;
438  USHORT Px;
439  PUSHORT PixelsPosition;
440 
441  /* Clear the destination buffer */
442  RtlZeroMemory(Buffer, Delta * Height);
443 
444  for (Y = 0; Y < Height; Y++)
445  {
446  OutputBuffer = Buffer + Y * Delta;
447  PixelsPosition = (PUSHORT)(FrameBuffer + FB_OFFSET(Left, Top + Y));
448 
449  for (X = 0; X < Width; X += sizeof(USHORT))
450  {
451  Px = READ_REGISTER_USHORT(PixelsPosition++);
452  *OutputBuffer++ = (FIRSTBYTE(Px) << 4) | (SECONDBYTE(Px) & 0x0F);
453  }
454  }
455 }
#define Y(I)
unsigned char * PUCHAR
Definition: retypes.h:3
#define FIRSTBYTE(VALUE)
Definition: rtlfuncs.h:795
ULONG_PTR FrameBuffer
Definition: bootvid.c:15
Definition: bufpool.h:45
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID OutputBuffer
Definition: cdrom.h:1437
unsigned short USHORT
Definition: pedump.c:61
static ULONG Delta
Definition: xboxvideo.c:33
unsigned int ULONG
Definition: retypes.h:1
NTKERNELAPI USHORT NTAPI READ_REGISTER_USHORT(IN PUSHORT Register)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
static LPHIST_ENTRY Top
Definition: history.c:53
unsigned short * PUSHORT
Definition: retypes.h:2
#define FB_OFFSET(x, y)
Definition: pc98.h:17
#define X(b, s)
#define SECONDBYTE(VALUE)
Definition: rtlfuncs.h:796

◆ VidSolidColorFill()

VOID NTAPI VidSolidColorFill ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Right,
_In_ ULONG  Bottom,
_In_ UCHAR  Color 
)

Definition at line 459 of file bootvid.c.

465 {
466  USHORT i, Line;
467  PUCHAR PixelPtr;
468  PULONG PixelsPtr;
469  ULONG WideColor = (Color << 24) | (Color << 16) | (Color << 8) | Color;
470  USHORT PixelCount = (Right - Left) + 1;
471  ULONG_PTR StartOffset = FrameBuffer + FB_OFFSET(Left, Top);
472 
473  for (Line = Top; Line <= Bottom; Line++)
474  {
475  PixelsPtr = (PULONG)StartOffset;
476  for (i = 0; i < PixelCount / sizeof(ULONG); i++)
477  WRITE_REGISTER_ULONG(PixelsPtr++, WideColor);
478 
479  PixelPtr = (PUCHAR)PixelsPtr;
480  for (i = 0; i < PixelCount % sizeof(ULONG); i++)
481  WRITE_REGISTER_UCHAR(PixelPtr++, Color);
482 
483  StartOffset += SCREEN_WIDTH;
484  }
485 }
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
unsigned char * PUCHAR
Definition: retypes.h:3
#define SCREEN_WIDTH
Definition: pc98video.c:27
ULONG_PTR FrameBuffer
Definition: bootvid.c:15
uint32_t ULONG_PTR
Definition: typedefs.h:65
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
Definition: ncftp.h:79
static LPHIST_ENTRY Bottom
Definition: history.c:54
unsigned short USHORT
Definition: pedump.c:61
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
static LPHIST_ENTRY Top
Definition: history.c:53
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)
#define FB_OFFSET(x, y)
Definition: pc98.h:17
struct Line Line

Variable Documentation

◆ FrameBuffer

◆ PegcControl

ULONG_PTR PegcControl = 0
static

Definition at line 14 of file bootvid.c.

Referenced by InitializeDisplay(), TestMmio(), and VidInitialize().