xref: /reactos/drivers/base/bootvid/precomp.h (revision ff790a91)
1*ff790a91SHermès Bélusca-Maïto /*
2*ff790a91SHermès Bélusca-Maïto  * PROJECT:     ReactOS Boot Video Driver
3*ff790a91SHermès Bélusca-Maïto  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4*ff790a91SHermès Bélusca-Maïto  * PURPOSE:     Precompiled header
5*ff790a91SHermès Bélusca-Maïto  * COPYRIGHT:   Copyright 2007 Alex Ionescu <alex.ionescu@reactos.org>
6*ff790a91SHermès Bélusca-Maïto  *              Copyright 2020 Dmitry Borisov <di.sean@protonmail.com>
7*ff790a91SHermès Bélusca-Maïto  *              Copyright 2020 Stanislav Motylkov <x86corez@gmail.com>
8*ff790a91SHermès Bélusca-Maïto  */
9*ff790a91SHermès Bélusca-Maïto 
10c2c66affSColin Finck #ifndef _BOOTVID_PCH_
11c2c66affSColin Finck #define _BOOTVID_PCH_
12c2c66affSColin Finck 
13025cfb10SHermès Bélusca-Maïto #include <ntifs.h>
14025cfb10SHermès Bélusca-Maïto #include <ndk/halfuncs.h>
15c2c66affSColin Finck #include <drivers/bootvid/bootvid.h>
16c2c66affSColin Finck 
175f2ca473SDmitry Borisov /* Arch specific includes */
185f2ca473SDmitry Borisov #if defined(_M_IX86) || defined(_M_AMD64)
19e9014895SDmitry Borisov #if defined(SARCH_PC98)
20e9014895SDmitry Borisov #include "i386/pc98/pc98.h"
21fa1ec0a2SStanislav Motylkov #elif defined(SARCH_XBOX)
222a77e359SStanislav Motylkov #include "i386/xbox/xbox.h"
23e9014895SDmitry Borisov #else
245f2ca473SDmitry Borisov #include "i386/pc/vga.h"
255f2ca473SDmitry Borisov #include "i386/pc/pc.h"
26e9014895SDmitry Borisov #endif
275f2ca473SDmitry Borisov #elif defined(_M_ARM)
285f2ca473SDmitry Borisov #include "arm/arm.h"
295f2ca473SDmitry Borisov #else
305f2ca473SDmitry Borisov #error Unknown architecture
315f2ca473SDmitry Borisov #endif
325f2ca473SDmitry Borisov 
33c2c66affSColin Finck /* Define if FontData has upside down characters */
34c2c66affSColin Finck #undef CHAR_GEN_UPSIDE_DOWN
35c2c66affSColin Finck 
36c2c66affSColin Finck #define BOOTCHAR_HEIGHT 13
371d2b0fbcSHermès Bélusca-Maïto #define BOOTCHAR_WIDTH  8 // Each character line is encoded in a UCHAR.
381d2b0fbcSHermès Bélusca-Maïto 
39c2c66affSColin Finck /* Bitmap Header */
40c2c66affSColin Finck typedef struct tagBITMAPINFOHEADER
41c2c66affSColin Finck {
42c2c66affSColin Finck     ULONG biSize;
43c2c66affSColin Finck     LONG biWidth;
44c2c66affSColin Finck     LONG biHeight;
45c2c66affSColin Finck     USHORT biPlanes;
46c2c66affSColin Finck     USHORT biBitCount;
47c2c66affSColin Finck     ULONG biCompression;
48c2c66affSColin Finck     ULONG biSizeImage;
49c2c66affSColin Finck     LONG biXPelsPerMeter;
50c2c66affSColin Finck     LONG biYPelsPerMeter;
51c2c66affSColin Finck     ULONG biClrUsed;
52c2c66affSColin Finck     ULONG biClrImportant;
53c2c66affSColin Finck } BITMAPINFOHEADER, *PBITMAPINFOHEADER;
54c2c66affSColin Finck 
55c2c66affSColin Finck /* Supported bitmap compression formats */
56c2c66affSColin Finck #define BI_RGB  0
57c2c66affSColin Finck #define BI_RLE4 2
58c2c66affSColin Finck 
59cd912717SStanislav Motylkov typedef ULONG RGBQUAD;
605f2ca473SDmitry Borisov 
615f2ca473SDmitry Borisov /*
625f2ca473SDmitry Borisov  * Globals
635f2ca473SDmitry Borisov  */
645f2ca473SDmitry Borisov extern UCHAR VidpTextColor;
655f2ca473SDmitry Borisov extern ULONG VidpCurrentX;
665f2ca473SDmitry Borisov extern ULONG VidpCurrentY;
675f2ca473SDmitry Borisov extern ULONG VidpScrollRegion[4];
68cd912717SStanislav Motylkov extern UCHAR VidpFontData[256 * BOOTCHAR_HEIGHT];
69cd912717SStanislav Motylkov extern const RGBQUAD VidpDefaultPalette[BV_MAX_COLORS];
70cd912717SStanislav Motylkov 
71cd912717SStanislav Motylkov #define RGB(r, g, b)    ((RGBQUAD)(((UCHAR)(b) | ((USHORT)((UCHAR)(g))<<8)) | (((ULONG)(UCHAR)(r))<<16)))
72cd912717SStanislav Motylkov 
73cd912717SStanislav Motylkov #define GetRValue(quad)     ((UCHAR)(((quad)>>16) & 0xFF))
74cd912717SStanislav Motylkov #define GetGValue(quad)     ((UCHAR)(((quad)>>8) & 0xFF))
75cd912717SStanislav Motylkov #define GetBValue(quad)     ((UCHAR)((quad) & 0xFF))
76cd912717SStanislav Motylkov 
77cd912717SStanislav Motylkov #define InitializePalette() InitPaletteWithTable((PULONG)VidpDefaultPalette, BV_MAX_COLORS)
78cd912717SStanislav Motylkov 
79cd912717SStanislav Motylkov #ifdef CHAR_GEN_UPSIDE_DOWN
807b956a0aSHermès Bélusca-Maïto # define GetFontPtr(_Char)  (&VidpFontData[(_Char) * BOOTCHAR_HEIGHT] + BOOTCHAR_HEIGHT - 1)
81cd912717SStanislav Motylkov # define FONT_PTR_DELTA     (-1)
82cd912717SStanislav Motylkov #else
837b956a0aSHermès Bélusca-Maïto # define GetFontPtr(_Char)  (&VidpFontData[(_Char) * BOOTCHAR_HEIGHT])
84cd912717SStanislav Motylkov # define FONT_PTR_DELTA     (1)
85cd912717SStanislav Motylkov #endif
86c2c66affSColin Finck 
87c2c66affSColin Finck #endif /* _BOOTVID_PCH_ */
88