xref: /reactos/drivers/base/bootvid/i386/pc/pc.h (revision 8a978a17)
1 
2 #pragma once
3 
4 extern ULONG_PTR VgaRegisterBase;
5 extern ULONG_PTR VgaBase;
6 extern USHORT AT_Initialization[];
7 extern USHORT VGA_640x480[];
8 extern UCHAR PixelMask[8];
9 
10 #define __inpb(Port) \
11     READ_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)))
12 
13 #define __inpw(Port) \
14     READ_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)))
15 
16 #define __outpb(Port, Value) \
17     WRITE_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)), (UCHAR)(Value))
18 
19 #define __outpw(Port, Value) \
20     WRITE_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)), (USHORT)(Value))
21 
22 VOID
23 NTAPI
24 InitPaletteWithTable(
25     _In_ PULONG Table,
26     _In_ ULONG Count);
27 
28 VOID
29 PrepareForSetPixel(VOID);
30 
31 FORCEINLINE
32 VOID
33 SetPixel(
34     _In_ ULONG Left,
35     _In_ ULONG Top,
36     _In_ UCHAR Color)
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 */
44     __outpw(VGA_BASE_IO_PORT + GRAPH_ADDRESS_PORT, (PixelMask[Left & 7] << 8) | IND_BIT_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 }
52 
53 VOID
54 NTAPI
55 PreserveRow(
56     _In_ ULONG CurrentTop,
57     _In_ ULONG TopDelta,
58     _In_ BOOLEAN Restore);
59 
60 VOID
61 NTAPI
62 DoScroll(
63     _In_ ULONG Scroll);
64 
65 VOID
66 NTAPI
67 DisplayCharacter(
68     _In_ CHAR Character,
69     _In_ ULONG Left,
70     _In_ ULONG Top,
71     _In_ ULONG TextColor,
72     _In_ ULONG BackColor);
73