https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cd91271796117c0f89c06…
commit cd91271796117c0f89c06a6c3f66e6ba4328dd9b
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Sat May 9 17:20:57 2020 +0300
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Tue May 12 15:56:37 2020 +0300
[NTOSKRNL][HAL][BOOTVID] Some more code refactoring
- Add boot video color constants
- Refactor palette initialization
- Move some common stuff in right place
- Get rid of some magic constants and hardcoded values
- Get rid of TopDelta variable (calculated at compile time)
- Update SAL annotations
Addendum to 5f2ca473. CORE-16216 CORE-16219
---
drivers/base/bootvid/arm/arm.h | 56 ++++---
drivers/base/bootvid/arm/bootvid.c | 167 +++++----------------
drivers/base/bootvid/common.c | 144 ++++++++++++++++--
drivers/base/bootvid/fontdata.c | 2 +-
drivers/base/bootvid/i386/pc/bootvid.c | 11 +-
drivers/base/bootvid/i386/pc/pc.h | 30 ++++
drivers/base/bootvid/i386/pc/vga.c | 202 ++++----------------------
drivers/base/bootvid/precomp.h | 49 +++----
hal/halx86/generic/misc.c | 6 +-
ntoskrnl/inbv/inbv.c | 22 +--
ntoskrnl/kd/kdio.c | 4 +-
ntoskrnl/ke/bug.c | 4 +-
ntoskrnl/po/poshtdwn.c | 2 +-
sdk/include/reactos/drivers/bootvid/bootvid.h | 74 ++++++----
sdk/include/reactos/drivers/bootvid/display.h | 20 +++
15 files changed, 367 insertions(+), 426 deletions(-)
diff --git a/drivers/base/bootvid/arm/arm.h b/drivers/base/bootvid/arm/arm.h
index 2f46aa8fff6..7c3801c0594 100644
--- a/drivers/base/bootvid/arm/arm.h
+++ b/drivers/base/bootvid/arm/arm.h
@@ -23,41 +23,28 @@ extern PUSHORT VgaArmBase;
#define READ_REGISTER_USHORT(r) (*(volatile USHORT * const)(r))
#define WRITE_REGISTER_USHORT(r, v) (*(volatile USHORT *)(r) = (v))
-PALETTE_ENTRY VidpVga8To16BitTransform[16] =
-{
- {0x00, 0x00, 0x00}, // Black
- {0x00, 0x00, 0x08}, // Blue
- {0x00, 0x08, 0x00}, // Green
- {0x00, 0x08, 0x08}, // Cyan
- {0x08, 0x00, 0x00}, // Red
- {0x08, 0x00, 0x08}, // Magenta
- {0x0B, 0x0D, 0x0F}, // Brown
- {0x10, 0x10, 0x10}, // Light Gray
- {0x08, 0x08, 0x08}, // Dark Gray
- {0x00, 0x00, 0x1F}, // Light Blue
- {0x00, 0x1F, 0x00}, // Light Green
- {0x00, 0x1F, 0x1F}, // Light Cyan
- {0x1F, 0x00, 0x00}, // Light Red
- {0x1F, 0x00, 0x1F}, // Light Magenta
- {0x1F, 0x1F, 0x00}, // Yellow
- {0x1F, 0x1F, 0x1F}, // White
-};
-
FORCEINLINE
USHORT
-VidpBuildColor(_In_ UCHAR Color)
+VidpBuildColor(
+ _In_ UCHAR Color)
{
UCHAR Red, Green, Blue;
/* Extract color components */
- Red = VidpVga8To16BitTransform[Color].Red;
- Green = VidpVga8To16BitTransform[Color].Green;
- Blue = VidpVga8To16BitTransform[Color].Blue;
+ Red = GetRValue(DefaultPalette[Color]) >> 3;
+ Green = GetGValue(DefaultPalette[Color]) >> 3;
+ Blue = GetBValue(DefaultPalette[Color]) >> 3;
/* Build the 16-bit color mask */
return ((Red & 0x1F) << 11) | ((Green & 0x1F) << 6) | ((Blue
& 0x1F));
}
+VOID
+NTAPI
+InitPaletteWithTable(
+ _In_ PULONG Table,
+ _In_ ULONG Count);
+
FORCEINLINE
VOID
SetPixel(
@@ -73,3 +60,24 @@ SetPixel(
/* Set our color */
WRITE_REGISTER_USHORT(PixelPosition, VidpBuildColor(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);
diff --git a/drivers/base/bootvid/arm/bootvid.c b/drivers/base/bootvid/arm/bootvid.c
index c21ec620c9b..d34f08140a5 100644
--- a/drivers/base/bootvid/arm/bootvid.c
+++ b/drivers/base/bootvid/arm/bootvid.c
@@ -5,23 +5,23 @@
PUSHORT VgaArmBase;
PHYSICAL_ADDRESS VgaPhysical;
-BOOLEAN ClearRow = FALSE;
/* PRIVATE FUNCTIONS *********************************************************/
VOID
NTAPI
-DisplayCharacter(IN CHAR Character,
- IN ULONG Left,
- IN ULONG Top,
- IN ULONG TextColor,
- IN ULONG BackColor)
+DisplayCharacter(
+ _In_ CHAR Character,
+ _In_ ULONG Left,
+ _In_ ULONG Top,
+ _In_ ULONG TextColor,
+ _In_ ULONG BackColor)
{
PUCHAR FontChar;
ULONG i, j, XOffset;
/* Get the font line for this character */
- FontChar = &FontData[Character * BOOTCHAR_HEIGHT - Top];
+ FontChar = &VidpFontData[Character * BOOTCHAR_HEIGHT - Top];
/* Loop each pixel height */
for (i = BOOTCHAR_HEIGHT; i > 0; --i)
@@ -36,7 +36,7 @@ DisplayCharacter(IN CHAR Character,
/* We do, use the given Text Color */
SetPixel(XOffset, Top, (UCHAR)TextColor);
}
- else if (BackColor < 16)
+ else if (BackColor < BV_COLOR_NONE)
{
/*
* This is a background pixel. We're drawing it
@@ -56,7 +56,8 @@ DisplayCharacter(IN CHAR Character,
VOID
NTAPI
-VgaScroll(IN ULONG Scroll)
+DoScroll(
+ _In_ ULONG Scroll)
{
ULONG Top, Offset;
PUSHORT SourceOffset, DestOffset;
@@ -103,9 +104,10 @@ VgaScroll(IN ULONG Scroll)
VOID
NTAPI
-PreserveRow(IN ULONG CurrentTop,
- IN ULONG TopDelta,
- IN BOOLEAN Restore)
+PreserveRow(
+ _In_ ULONG CurrentTop,
+ _In_ ULONG TopDelta,
+ _In_ BOOLEAN Restore)
{
PUSHORT Position1, Position2;
ULONG Count;
@@ -179,7 +181,8 @@ InitPaletteWithTable(
*/
BOOLEAN
NTAPI
-VidInitialize(IN BOOLEAN SetMode)
+VidInitialize(
+ _In_ BOOLEAN SetMode)
{
DPRINT1("bv-arm v0.1\n");
@@ -214,7 +217,8 @@ VidInitialize(IN BOOLEAN SetMode)
*/
VOID
NTAPI
-VidResetDisplay(IN BOOLEAN HalReset)
+VidResetDisplay(
+ _In_ BOOLEAN HalReset)
{
//
// Clear the current position
@@ -230,29 +234,8 @@ VidResetDisplay(IN BOOLEAN HalReset)
//
// Re-initialize the palette and fill the screen black
//
- //InitializePalette();
- VidSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 0);
-}
-
-/*
- * @implemented
- */
-ULONG
-NTAPI
-VidSetTextColor(IN ULONG Color)
-{
- UCHAR OldColor;
-
- //
- // Save the old, set the new
- //
- OldColor = VidpTextColor;
- VidpTextColor = Color;
-
- //
- // Return the old text color
- //
- return OldColor;
+ InitializePalette();
+ VidSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_BLACK);
}
/*
@@ -271,98 +254,13 @@ VidCleanUp(VOID)
*/
VOID
NTAPI
-VidDisplayString(IN PUCHAR String)
-{
- ULONG TopDelta = BOOTCHAR_HEIGHT + 1;
-
- /* Start looping the string */
- for (; *String; ++String)
- {
- /* Treat new-line separately */
- if (*String == '\n')
- {
- /* Modify Y position */
- VidpCurrentY += TopDelta;
- if (VidpCurrentY + TopDelta - 1 > VidpScrollRegion[3])
- {
- /* Scroll the view and clear the current row */
- VgaScroll(TopDelta);
- VidpCurrentY -= TopDelta;
- PreserveRow(VidpCurrentY, TopDelta, TRUE);
- }
- else
- {
- /* Preserve the current row */
- PreserveRow(VidpCurrentY, TopDelta, FALSE);
- }
-
- /* Update current X */
- VidpCurrentX = VidpScrollRegion[0];
-
- /* No need to clear this row */
- ClearRow = FALSE;
- }
- else if (*String == '\r')
- {
- /* Update current X */
- VidpCurrentX = VidpScrollRegion[0];
-
- /* If a new-line does not follow we will clear the current row */
- if (String[1] != '\n') ClearRow = TRUE;
- }
- else
- {
- /* Clear the current row if we had a return-carriage without a new-line */
- if (ClearRow)
- {
- PreserveRow(VidpCurrentY, TopDelta, TRUE);
- ClearRow = FALSE;
- }
-
- /* Display this character */
- DisplayCharacter(*String,
- VidpCurrentX,
- VidpCurrentY,
- VidpTextColor,
- 16);
- VidpCurrentX += 8;
-
- /* Check if we should scroll */
- if (VidpCurrentX + 7 > VidpScrollRegion[2])
- {
- /* Update Y position and check if we should scroll it */
- VidpCurrentY += TopDelta;
- if (VidpCurrentY + TopDelta - 1 > VidpScrollRegion[3])
- {
- /* Scroll the view and clear the current row */
- VgaScroll(TopDelta);
- VidpCurrentY -= TopDelta;
- PreserveRow(VidpCurrentY, TopDelta, TRUE);
- }
- else
- {
- /* Preserve the current row */
- PreserveRow(VidpCurrentY, TopDelta, FALSE);
- }
-
- /* Update current X */
- VidpCurrentX = VidpScrollRegion[0];
- }
- }
- }
-}
-
-/*
- * @implemented
- */
-VOID
-NTAPI
-VidScreenToBufferBlt(OUT PUCHAR Buffer,
- IN ULONG Left,
- IN ULONG Top,
- IN ULONG Width,
- IN ULONG Height,
- IN ULONG Delta)
+VidScreenToBufferBlt(
+ _Out_ PUCHAR Buffer,
+ _In_ ULONG Left,
+ _In_ ULONG Top,
+ _In_ ULONG Width,
+ _In_ ULONG Height,
+ _In_ ULONG Delta)
{
UNIMPLEMENTED;
while (TRUE);
@@ -373,11 +271,12 @@ VidScreenToBufferBlt(OUT PUCHAR Buffer,
*/
VOID
NTAPI
-VidSolidColorFill(IN ULONG Left,
- IN ULONG Top,
- IN ULONG Right,
- IN ULONG Bottom,
- IN UCHAR Color)
+VidSolidColorFill(
+ _In_ ULONG Left,
+ _In_ ULONG Top,
+ _In_ ULONG Right,
+ _In_ ULONG Bottom,
+ _In_ UCHAR Color)
{
int y, x;
diff --git a/drivers/base/bootvid/common.c b/drivers/base/bootvid/common.c
index 07e98eced0a..7979ea42a04 100644
--- a/drivers/base/bootvid/common.c
+++ b/drivers/base/bootvid/common.c
@@ -2,7 +2,7 @@
/* GLOBALS ********************************************************************/
-UCHAR VidpTextColor = 0x0F;
+UCHAR VidpTextColor = BV_COLOR_WHITE;
ULONG VidpCurrentX = 0;
ULONG VidpCurrentY = 0;
@@ -15,6 +15,33 @@ ULONG VidpScrollRegion[4] =
SCREEN_HEIGHT - 1
};
+/*
+ * Boot video driver default palette is similar to the standard 16-color
+ * CGA palette, but it has Red and Blue channels swapped, and also dark
+ * and light gray colors swapped.
+ */
+const RGBQUAD VidpDefaultPalette[BV_MAX_COLORS] =
+{
+ RGB( 0, 0, 0), /* Black */
+ RGB(128, 0, 0), /* Red */
+ RGB( 0, 128, 0), /* Green */
+ RGB(128, 128, 0), /* Brown */
+ RGB( 0, 0, 128), /* Blue */
+ RGB(128, 0, 128), /* Magenta */
+ RGB( 0, 128, 128), /* Cyan */
+ RGB(128, 128, 128), /* Dark Gray */
+ RGB(192, 192, 192), /* Light Gray */
+ RGB(255, 0, 0), /* Light Red */
+ RGB( 0, 255, 0), /* Light Green */
+ RGB(255, 255, 0), /* Yellow */
+ RGB( 0, 0, 255), /* Light Blue */
+ RGB(255, 0, 255), /* Light Magenta */
+ RGB( 0, 255, 255), /* Light Cyan */
+ RGB(255, 255, 255), /* White */
+};
+
+static BOOLEAN ClearRow = FALSE;
+
/* PRIVATE FUNCTIONS **********************************************************/
static VOID
@@ -272,6 +299,22 @@ RleBitBlt(
/* PUBLIC FUNCTIONS ***********************************************************/
+/*
+ * @implemented
+ */
+ULONG
+NTAPI
+VidSetTextColor(
+ _In_ ULONG Color)
+{
+ ULONG OldColor;
+
+ /* Save the old color and set the new one */
+ OldColor = VidpTextColor;
+ VidpTextColor = Color;
+ return OldColor;
+}
+
VOID
NTAPI
VidDisplayStringXY(
@@ -286,13 +329,13 @@ VidDisplayStringXY(
* If the caller wanted transparent, then send the special value (16),
* else use our default and call the helper routine.
*/
- BackColor = Transparent ? 16 : 14;
+ BackColor = Transparent ? BV_COLOR_NONE : BV_COLOR_LIGHT_CYAN;
/* Loop every character and adjust the position */
- for (; *String; ++String, Left += 8)
+ for (; *String; ++String, Left += BOOTCHAR_WIDTH)
{
/* Display a character */
- DisplayCharacter(*String, Left, Top, 12, BackColor);
+ DisplayCharacter(*String, Left, Top, BV_COLOR_LIGHT_BLUE, BackColor);
}
}
@@ -305,8 +348,8 @@ VidSetScrollRegion(
_In_ ULONG Bottom)
{
/* Assert alignment */
- ASSERT((Left & 0x7) == 0);
- ASSERT((Right & 0x7) == 7);
+ ASSERT((Left % BOOTCHAR_WIDTH) == 0);
+ ASSERT((Right % BOOTCHAR_WIDTH) == BOOTCHAR_WIDTH - 1);
/* Set Scroll Region */
VidpScrollRegion[0] = Left;
@@ -319,6 +362,87 @@ VidSetScrollRegion(
VidpCurrentY = Top;
}
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+VidDisplayString(
+ _In_ PUCHAR String)
+{
+ /* Start looping the string */
+ for (; *String; ++String)
+ {
+ /* Treat new-line separately */
+ if (*String == '\n')
+ {
+ /* Modify Y position */
+ VidpCurrentY += BOOTCHAR_HEIGHT + 1;
+ if (VidpCurrentY + BOOTCHAR_HEIGHT > VidpScrollRegion[3])
+ {
+ /* Scroll the view and clear the current row */
+ DoScroll(BOOTCHAR_HEIGHT + 1);
+ VidpCurrentY -= BOOTCHAR_HEIGHT + 1;
+ PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, TRUE);
+ }
+ else
+ {
+ /* Preserve the current row */
+ PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, FALSE);
+ }
+
+ /* Update current X */
+ VidpCurrentX = VidpScrollRegion[0];
+
+ /* No need to clear this row */
+ ClearRow = FALSE;
+ }
+ else if (*String == '\r')
+ {
+ /* Update current X */
+ VidpCurrentX = VidpScrollRegion[0];
+
+ /* If a new-line does not follow we will clear the current row */
+ if (String[1] != '\n') ClearRow = TRUE;
+ }
+ else
+ {
+ /* Clear the current row if we had a return-carriage without a new-line */
+ if (ClearRow)
+ {
+ PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, TRUE);
+ ClearRow = FALSE;
+ }
+
+ /* Display this character */
+ DisplayCharacter(*String, VidpCurrentX, VidpCurrentY, VidpTextColor,
BV_COLOR_NONE);
+ VidpCurrentX += BOOTCHAR_WIDTH;
+
+ /* Check if we should scroll */
+ if (VidpCurrentX + BOOTCHAR_WIDTH - 1 > VidpScrollRegion[2])
+ {
+ /* Update Y position and check if we should scroll it */
+ VidpCurrentY += BOOTCHAR_HEIGHT + 1;
+ if (VidpCurrentY + BOOTCHAR_HEIGHT > VidpScrollRegion[3])
+ {
+ /* Scroll the view and clear the current row */
+ DoScroll(BOOTCHAR_HEIGHT + 1);
+ VidpCurrentY -= BOOTCHAR_HEIGHT + 1;
+ PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, TRUE);
+ }
+ else
+ {
+ /* Preserve the current row */
+ PreserveRow(VidpCurrentY, BOOTCHAR_HEIGHT + 1, FALSE);
+ }
+
+ /* Update current X */
+ VidpCurrentX = VidpScrollRegion[0];
+ }
+ }
+ }
+}
+
VOID
NTAPI
VidBufferToScreenBlt(
@@ -347,14 +471,16 @@ VidBitBlt(
PBITMAPINFOHEADER BitmapInfoHeader;
LONG Delta;
PUCHAR BitmapOffset;
+ ULONG PaletteCount;
/* Get the Bitmap Header */
BitmapInfoHeader = (PBITMAPINFOHEADER)Buffer;
/* Initialize the palette */
+ PaletteCount = BitmapInfoHeader->biClrUsed ?
+ BitmapInfoHeader->biClrUsed : BV_MAX_COLORS;
InitPaletteWithTable((PULONG)(Buffer + BitmapInfoHeader->biSize),
- (BitmapInfoHeader->biClrUsed) ?
- BitmapInfoHeader->biClrUsed : 16);
+ PaletteCount);
/* Make sure we can support this bitmap */
ASSERT((BitmapInfoHeader->biBitCount * BitmapInfoHeader->biPlanes) <= 4);
@@ -366,7 +492,7 @@ VidBitBlt(
Delta = (BitmapInfoHeader->biBitCount * BitmapInfoHeader->biWidth) + 31;
Delta >>= 3;
Delta &= ~3;
- BitmapOffset = Buffer + sizeof(BITMAPINFOHEADER) + 16 * sizeof(ULONG);
+ BitmapOffset = Buffer + sizeof(BITMAPINFOHEADER) + PaletteCount * sizeof(ULONG);
/* Check the compression of the bitmap */
if (BitmapInfoHeader->biCompression == BI_RLE4)
diff --git a/drivers/base/bootvid/fontdata.c b/drivers/base/bootvid/fontdata.c
index 12f4a1dfe84..e4a6922bbbf 100644
--- a/drivers/base/bootvid/fontdata.c
+++ b/drivers/base/bootvid/fontdata.c
@@ -6,7 +6,7 @@
// Available from
http://mirtchovski.com/p9/fonts/
// FontData Array generated by bootvid_font_generator.
//
-UCHAR FontData[256 * BOOTCHAR_HEIGHT] =
+UCHAR VidpFontData[256 * BOOTCHAR_HEIGHT] =
{
0x00, 0x00, 0x00, 0x00, 0xFE, 0x82, 0x82, 0x82, 0x82, 0x82, 0xFE, 0x00, 0x00, // 0
0x00, 0x00, 0x00, 0x00, 0xFE, 0x82, 0x82, 0x82, 0x82, 0x82, 0xFE, 0x00, 0x00, // 13
diff --git a/drivers/base/bootvid/i386/pc/bootvid.c
b/drivers/base/bootvid/i386/pc/bootvid.c
index c80911d1aba..f3336527d4a 100644
--- a/drivers/base/bootvid/i386/pc/bootvid.c
+++ b/drivers/base/bootvid/i386/pc/bootvid.c
@@ -4,7 +4,8 @@
static BOOLEAN
NTAPI
-VgaInterpretCmdStream(IN PUSHORT CmdStream)
+VgaInterpretCmdStream(
+ _In_ PUSHORT CmdStream)
{
USHORT Cmd;
UCHAR Major, Minor;
@@ -358,7 +359,8 @@ VgaIsPresent(VOID)
*/
BOOLEAN
NTAPI
-VidInitialize(IN BOOLEAN SetMode)
+VidInitialize(
+ _In_ BOOLEAN SetMode)
{
ULONG_PTR Context = 0;
PHYSICAL_ADDRESS TranslatedAddress;
@@ -464,7 +466,8 @@ VidInitialize(IN BOOLEAN SetMode)
*/
VOID
NTAPI
-VidResetDisplay(IN BOOLEAN HalReset)
+VidResetDisplay(
+ _In_ BOOLEAN HalReset)
{
/* Clear the current position */
VidpCurrentX = 0;
@@ -485,5 +488,5 @@ VidResetDisplay(IN BOOLEAN HalReset)
/* Re-initialize the palette and fill the screen black */
InitializePalette();
- VidSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 0);
+ VidSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_BLACK);
}
diff --git a/drivers/base/bootvid/i386/pc/pc.h b/drivers/base/bootvid/i386/pc/pc.h
index fef2324f8b4..c1a96e797a6 100644
--- a/drivers/base/bootvid/i386/pc/pc.h
+++ b/drivers/base/bootvid/i386/pc/pc.h
@@ -19,6 +19,15 @@ extern UCHAR PixelMask[8];
#define __outpw(Port, Value) \
WRITE_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)), (USHORT)(Value))
+VOID
+NTAPI
+InitPaletteWithTable(
+ _In_ PULONG Table,
+ _In_ ULONG Count);
+
+VOID
+PrepareForSetPixel(VOID);
+
FORCEINLINE
VOID
SetPixel(
@@ -37,3 +46,24 @@ SetPixel(
/* Read the current pixel value and add our color */
WRITE_REGISTER_UCHAR(PixelPosition, READ_REGISTER_UCHAR(PixelPosition) & 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);
diff --git a/drivers/base/bootvid/i386/pc/vga.c b/drivers/base/bootvid/i386/pc/vga.c
index b2d003657ee..b985bc68eb1 100644
--- a/drivers/base/bootvid/i386/pc/vga.c
+++ b/drivers/base/bootvid/i386/pc/vga.c
@@ -57,13 +57,13 @@ static ULONG lookup[16] =
ULONG_PTR VgaRegisterBase = 0;
ULONG_PTR VgaBase = 0;
-static BOOLEAN ClearRow = FALSE;
/* PRIVATE FUNCTIONS *********************************************************/
static VOID
NTAPI
-ReadWriteMode(IN UCHAR Mode)
+ReadWriteMode(
+ _In_ UCHAR Mode)
{
UCHAR Value;
@@ -98,14 +98,6 @@ do { \
WRITE_REGISTER_UCHAR((_PixelPtr), (UCHAR)(_TextColor)); \
} while (0);
-#ifdef CHAR_GEN_UPSIDE_DOWN
-# define GetFontPtr(_Char) &FontData[_Char * BOOTCHAR_HEIGHT] + BOOTCHAR_HEIGHT - 1;
-# define FONT_PTR_DELTA (-1)
-#else
-# define GetFontPtr(_Char) &FontData[_Char * BOOTCHAR_HEIGHT];
-# define FONT_PTR_DELTA (1)
-#endif
-
VOID
NTAPI
DisplayCharacter(
@@ -156,7 +148,7 @@ DisplayCharacter(
}
/* Check if the background color is transparent */
- if (BackColor >= 16)
+ if (BackColor >= BV_COLOR_NONE)
{
/* We are done */
return;
@@ -199,18 +191,17 @@ DisplayCharacter(
static VOID
NTAPI
-SetPaletteEntryRGB(IN ULONG Id,
- IN ULONG Rgb)
+SetPaletteEntryRGB(
+ _In_ ULONG Id,
+ _In_ RGBQUAD Rgb)
{
- PCHAR Colors = (PCHAR)&Rgb;
-
/* Set the palette index */
__outpb(VGA_BASE_IO_PORT + DAC_ADDRESS_WRITE_PORT, (UCHAR)Id);
/* Set RGB colors */
- __outpb(VGA_BASE_IO_PORT + DAC_DATA_REG_PORT, Colors[2] >> 2);
- __outpb(VGA_BASE_IO_PORT + DAC_DATA_REG_PORT, Colors[1] >> 2);
- __outpb(VGA_BASE_IO_PORT + DAC_DATA_REG_PORT, Colors[0] >> 2);
+ __outpb(VGA_BASE_IO_PORT + DAC_DATA_REG_PORT, GetRValue(Rgb) >> 2);
+ __outpb(VGA_BASE_IO_PORT + DAC_DATA_REG_PORT, GetGValue(Rgb) >> 2);
+ __outpb(VGA_BASE_IO_PORT + DAC_DATA_REG_PORT, GetBValue(Rgb) >> 2);
}
VOID
@@ -222,57 +213,16 @@ InitPaletteWithTable(
ULONG i;
PULONG Entry = Table;
- /* Loop every entry */
for (i = 0; i < Count; i++, Entry++)
{
- /* Set the entry */
SetPaletteEntryRGB(i, *Entry);
}
}
-static VOID
-NTAPI
-SetPaletteEntry(IN ULONG Id,
- IN ULONG PaletteEntry)
-{
- /* Set the palette index */
- __outpb(VGA_BASE_IO_PORT + DAC_ADDRESS_WRITE_PORT, (UCHAR)Id);
-
- /* Set RGB colors */
- __outpb(VGA_BASE_IO_PORT + DAC_DATA_REG_PORT, PaletteEntry & 0xFF);
- __outpb(VGA_BASE_IO_PORT + DAC_DATA_REG_PORT, (PaletteEntry >>= 8) &
0xFF);
- __outpb(VGA_BASE_IO_PORT + DAC_DATA_REG_PORT, (PaletteEntry >> 8) & 0xFF);
-}
-
VOID
NTAPI
-InitializePalette(VOID)
-{
- ULONG PaletteEntry[16] = {0x000000,
- 0x000020,
- 0x002000,
- 0x002020,
- 0x200000,
- 0x200020,
- 0x202000,
- 0x202020,
- 0x303030,
- 0x00003F,
- 0x003F00,
- 0x003F3F,
- 0x3F0000,
- 0x3F003F,
- 0x3F3F00,
- 0x3F3F3F};
- ULONG i;
-
- /* Loop all the entries and set their palettes */
- for (i = 0; i < 16; i++) SetPaletteEntry(i, PaletteEntry[i]);
-}
-
-static VOID
-NTAPI
-VgaScroll(IN ULONG Scroll)
+DoScroll(
+ _In_ ULONG Scroll)
{
ULONG Top, RowSize;
PUCHAR OldPosition, NewPosition;
@@ -309,11 +259,12 @@ VgaScroll(IN ULONG Scroll)
}
}
-static VOID
+VOID
NTAPI
-PreserveRow(IN ULONG CurrentTop,
- IN ULONG TopDelta,
- IN BOOLEAN Restore)
+PreserveRow(
+ _In_ ULONG CurrentTop,
+ _In_ ULONG TopDelta,
+ _In_ BOOLEAN Restore)
{
PUCHAR Position1, Position2;
ULONG Count;
@@ -360,21 +311,6 @@ PreserveRow(IN ULONG CurrentTop,
/* PUBLIC FUNCTIONS **********************************************************/
-/*
- * @implemented
- */
-ULONG
-NTAPI
-VidSetTextColor(IN ULONG Color)
-{
- ULONG OldColor;
-
- /* Save the old color and set the new one */
- OldColor = VidpTextColor;
- VidpTextColor = Color;
- return OldColor;
-}
-
/*
* @implemented
*/
@@ -392,94 +328,13 @@ VidCleanUp(VOID)
*/
VOID
NTAPI
-VidDisplayString(IN PUCHAR String)
-{
- ULONG TopDelta = BOOTCHAR_HEIGHT + 1;
-
- /* Start looping the string */
- for (; *String; ++String)
- {
- /* Treat new-line separately */
- if (*String == '\n')
- {
- /* Modify Y position */
- VidpCurrentY += TopDelta;
- if (VidpCurrentY + TopDelta - 1 > VidpScrollRegion[3])
- {
- /* Scroll the view and clear the current row */
- VgaScroll(TopDelta);
- VidpCurrentY -= TopDelta;
- PreserveRow(VidpCurrentY, TopDelta, TRUE);
- }
- else
- {
- /* Preserve the current row */
- PreserveRow(VidpCurrentY, TopDelta, FALSE);
- }
-
- /* Update current X */
- VidpCurrentX = VidpScrollRegion[0];
-
- /* No need to clear this row */
- ClearRow = FALSE;
- }
- else if (*String == '\r')
- {
- /* Update current X */
- VidpCurrentX = VidpScrollRegion[0];
-
- /* If a new-line does not follow we will clear the current row */
- if (String[1] != '\n') ClearRow = TRUE;
- }
- else
- {
- /* Clear the current row if we had a return-carriage without a new-line */
- if (ClearRow)
- {
- PreserveRow(VidpCurrentY, TopDelta, TRUE);
- ClearRow = FALSE;
- }
-
- /* Display this character */
- DisplayCharacter(*String, VidpCurrentX, VidpCurrentY, VidpTextColor, 16);
- VidpCurrentX += 8;
-
- /* Check if we should scroll */
- if (VidpCurrentX + 7 > VidpScrollRegion[2])
- {
- /* Update Y position and check if we should scroll it */
- VidpCurrentY += TopDelta;
- if (VidpCurrentY + TopDelta - 1 > VidpScrollRegion[3])
- {
- /* Scroll the view and clear the current row */
- VgaScroll(TopDelta);
- VidpCurrentY -= TopDelta;
- PreserveRow(VidpCurrentY, TopDelta, TRUE);
- }
- else
- {
- /* Preserve the current row */
- PreserveRow(VidpCurrentY, TopDelta, FALSE);
- }
-
- /* Update current X */
- VidpCurrentX = VidpScrollRegion[0];
- }
- }
- }
-}
-
-/*
- * @implemented
- */
-VOID
-NTAPI
-VidScreenToBufferBlt(OUT PUCHAR Buffer,
- IN ULONG Left,
- IN ULONG Top,
- IN ULONG Width,
- IN ULONG Height,
- IN ULONG Delta)
+VidScreenToBufferBlt(
+ _Out_ PUCHAR Buffer,
+ _In_ ULONG Left,
+ _In_ ULONG Top,
+ _In_ ULONG Width,
+ _In_ ULONG Height,
+ _In_ ULONG Delta)
{
ULONG Plane;
ULONG XDistance;
@@ -573,11 +428,12 @@ VidScreenToBufferBlt(OUT PUCHAR Buffer,
*/
VOID
NTAPI
-VidSolidColorFill(IN ULONG Left,
- IN ULONG Top,
- IN ULONG Right,
- IN ULONG Bottom,
- IN UCHAR Color)
+VidSolidColorFill(
+ _In_ ULONG Left,
+ _In_ ULONG Top,
+ _In_ ULONG Right,
+ _In_ ULONG Bottom,
+ _In_ UCHAR Color)
{
ULONG rMask, lMask;
ULONG LeftOffset, RightOffset, Distance;
diff --git a/drivers/base/bootvid/precomp.h b/drivers/base/bootvid/precomp.h
index d89e93d359e..da64ef71c86 100644
--- a/drivers/base/bootvid/precomp.h
+++ b/drivers/base/bootvid/precomp.h
@@ -41,35 +41,7 @@ typedef struct tagBITMAPINFOHEADER
#define BI_RGB 0
#define BI_RLE4 2
-typedef struct _PALETTE_ENTRY
-{
- UCHAR Red;
- UCHAR Green;
- UCHAR Blue;
-} PALETTE_ENTRY, *PPALETTE_ENTRY;
-
-VOID
-NTAPI
-InitializePalette(VOID);
-
-VOID
-NTAPI
-DisplayCharacter(
- _In_ CHAR Character,
- _In_ ULONG Left,
- _In_ ULONG Top,
- _In_ ULONG TextColor,
- _In_ ULONG BackColor
-);
-
-VOID
-PrepareForSetPixel(VOID);
-
-VOID
-NTAPI
-InitPaletteWithTable(
- _In_ PULONG Table,
- _In_ ULONG Count);
+typedef ULONG RGBQUAD;
/*
* Globals
@@ -78,6 +50,23 @@ extern UCHAR VidpTextColor;
extern ULONG VidpCurrentX;
extern ULONG VidpCurrentY;
extern ULONG VidpScrollRegion[4];
-extern UCHAR FontData[256 * BOOTCHAR_HEIGHT];
+extern UCHAR VidpFontData[256 * BOOTCHAR_HEIGHT];
+extern const RGBQUAD VidpDefaultPalette[BV_MAX_COLORS];
+
+#define RGB(r, g, b) ((RGBQUAD)(((UCHAR)(b) | ((USHORT)((UCHAR)(g))<<8)) |
(((ULONG)(UCHAR)(r))<<16)))
+
+#define GetRValue(quad) ((UCHAR)(((quad)>>16) & 0xFF))
+#define GetGValue(quad) ((UCHAR)(((quad)>>8) & 0xFF))
+#define GetBValue(quad) ((UCHAR)((quad) & 0xFF))
+
+#define InitializePalette() InitPaletteWithTable((PULONG)VidpDefaultPalette,
BV_MAX_COLORS)
+
+#ifdef CHAR_GEN_UPSIDE_DOWN
+# define GetFontPtr(_Char) &VidpFontData[_Char * BOOTCHAR_HEIGHT] + BOOTCHAR_HEIGHT -
1;
+# define FONT_PTR_DELTA (-1)
+#else
+# define GetFontPtr(_Char) &VidpFontData[_Char * BOOTCHAR_HEIGHT];
+# define FONT_PTR_DELTA (1)
+#endif
#endif /* _BOOTVID_PCH_ */
diff --git a/hal/halx86/generic/misc.c b/hal/halx86/generic/misc.c
index 407f1e6047a..7e1eb37d7ad 100644
--- a/hal/halx86/generic/misc.c
+++ b/hal/halx86/generic/misc.c
@@ -244,7 +244,7 @@ HalHandleNMI(IN PVOID NmiInfo)
SystemControl.Bits = __inbyte(SYSTEM_CONTROL_PORT_B);
//
- // Switch to boot vieo
+ // Switch to boot video
//
if (InbvIsBootDriverInstalled())
{
@@ -257,13 +257,13 @@ HalHandleNMI(IN PVOID NmiInfo)
//
// Fill the screen
//
- InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 1);
+ InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_RED);
InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
//
// Enable text
//
- InbvSetTextColor(15);
+ InbvSetTextColor(BV_COLOR_WHITE);
InbvInstallDisplayStringFilter(NULL);
InbvEnableDisplayString(TRUE);
}
diff --git a/ntoskrnl/inbv/inbv.c b/ntoskrnl/inbv/inbv.c
index 5617e8577e2..76af14c4bd7 100644
--- a/ntoskrnl/inbv/inbv.c
+++ b/ntoskrnl/inbv/inbv.c
@@ -779,7 +779,7 @@ InbvUpdateProgressBar(IN ULONG Progress)
ProgressBarTop,
ProgressBarLeft + FillCount,
ProgressBarTop + 12,
- 15);
+ BV_COLOR_WHITE);
/* Release the lock */
InbvReleaseLock();
@@ -827,7 +827,7 @@ InbvBitBlt(IN PUCHAR Buffer,
VOID
NTAPI
-InbvScreenToBufferBlt(IN PUCHAR Buffer,
+InbvScreenToBufferBlt(OUT PUCHAR Buffer,
IN ULONG X,
IN ULONG Y,
IN ULONG Width,
@@ -1021,7 +1021,7 @@ InbvRotationThread(
if (Index >= 3)
{
/* Fill previous bar position */
- VidSolidColorFill(X + ((Index - 3) * 8), Y, (X + ((Index - 3) * 8)) + 8 -
1, Y + 9 - 1, 0);
+ VidSolidColorFill(X + ((Index - 3) * 8), Y, (X + ((Index - 3) * 8)) + 8 -
1, Y + 9 - 1, BV_COLOR_BLACK);
}
if (Index < Total - 1)
{
@@ -1120,9 +1120,9 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
if (SharedUserData->NtProductType == NtProductWinNt)
{
/* Workstation; set colors */
- InbvSetTextColor(15);
- InbvSolidColorFill(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, 7);
- InbvSolidColorFill(0, VID_FOOTER_BG_TOP, SCREEN_WIDTH-1, SCREEN_HEIGHT-1,
1);
+ InbvSetTextColor(BV_COLOR_WHITE);
+ InbvSolidColorFill(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1,
BV_COLOR_DARK_GRAY);
+ InbvSolidColorFill(0, VID_FOOTER_BG_TOP, SCREEN_WIDTH-1, SCREEN_HEIGHT-1,
BV_COLOR_RED);
/* Get resources */
Header = InbvGetResourceAddress(IDB_WKSTA_HEADER);
@@ -1131,9 +1131,9 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
else
{
/* Server; set colors */
- InbvSetTextColor(14);
- InbvSolidColorFill(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, 6);
- InbvSolidColorFill(0, VID_FOOTER_BG_TOP, SCREEN_WIDTH-1, SCREEN_HEIGHT-1,
1);
+ InbvSetTextColor(BV_COLOR_LIGHT_CYAN);
+ InbvSolidColorFill(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, BV_COLOR_CYAN);
+ InbvSolidColorFill(0, VID_FOOTER_BG_TOP, SCREEN_WIDTH-1, SCREEN_HEIGHT-1,
BV_COLOR_RED);
/* Get resources */
Header = InbvGetResourceAddress(IDB_SERVER_HEADER);
@@ -1246,7 +1246,7 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
InbvScreenToBufferBlt(Buffer, VID_SKU_SAVE_AREA_LEFT,
VID_SKU_SAVE_AREA_TOP, 7, 7, 8);
InbvSolidColorFill(VID_SKU_AREA_LEFT, VID_SKU_AREA_TOP,
- VID_SKU_AREA_RIGHT, VID_SKU_AREA_BOTTOM, 0);
+ VID_SKU_AREA_RIGHT, VID_SKU_AREA_BOTTOM,
BV_COLOR_BLACK);
InbvBufferToScreenBlt(Buffer, VID_SKU_SAVE_AREA_LEFT,
VID_SKU_SAVE_AREA_TOP, 7, 7, 8);
@@ -1390,7 +1390,7 @@ FinalizeBootLogo(VOID)
if (InbvGetDisplayState() == INBV_DISPLAY_STATE_OWNED)
{
/* Clear the screen */
- VidSolidColorFill(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, 0);
+ VidSolidColorFill(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1, BV_COLOR_BLACK);
}
/* Reset progress bar and lock */
diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c
index 89ca1685f74..678a335741f 100644
--- a/ntoskrnl/kd/kdio.c
+++ b/ntoskrnl/kd/kdio.c
@@ -418,8 +418,8 @@ KdpScreenAcquire(VOID)
/* Acquire ownership and reset the display */
InbvAcquireDisplayOwnership();
InbvResetDisplay();
- InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 0);
- InbvSetTextColor(15);
+ InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_BLACK);
+ InbvSetTextColor(BV_COLOR_WHITE);
InbvInstallDisplayStringFilter(NULL);
InbvEnableDisplayString(TRUE);
InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
diff --git a/ntoskrnl/ke/bug.c b/ntoskrnl/ke/bug.c
index 0601855d359..38e0077d9de 100644
--- a/ntoskrnl/ke/bug.c
+++ b/ntoskrnl/ke/bug.c
@@ -626,8 +626,8 @@ KiDisplayBlueScreen(IN ULONG MessageId,
InbvResetDisplay();
/* Display blue screen */
- InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 4);
- InbvSetTextColor(15);
+ InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_BLUE);
+ InbvSetTextColor(BV_COLOR_WHITE);
InbvInstallDisplayStringFilter(NULL);
InbvEnableDisplayString(TRUE);
InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
diff --git a/ntoskrnl/po/poshtdwn.c b/ntoskrnl/po/poshtdwn.c
index 31a1165e33f..c52f8c7680b 100644
--- a/ntoskrnl/po/poshtdwn.c
+++ b/ntoskrnl/po/poshtdwn.c
@@ -162,7 +162,7 @@ PopShutdownHandler(VOID)
/* Yes we do, cleanup for shutdown screen */
if (!InbvCheckDisplayOwnership()) InbvAcquireDisplayOwnership();
InbvResetDisplay();
- InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 0);
+ InbvSolidColorFill(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, BV_COLOR_BLACK);
InbvEnableDisplayString(TRUE);
InbvSetScrollRegion(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
diff --git a/sdk/include/reactos/drivers/bootvid/bootvid.h
b/sdk/include/reactos/drivers/bootvid/bootvid.h
index 23971957f4d..6df26e96739 100644
--- a/sdk/include/reactos/drivers/bootvid/bootvid.h
+++ b/sdk/include/reactos/drivers/bootvid/bootvid.h
@@ -14,29 +14,34 @@
BOOLEAN
NTAPI
-VidInitialize(IN BOOLEAN SetMode);
+VidInitialize(
+ _In_ BOOLEAN SetMode);
VOID
NTAPI
-VidResetDisplay(IN BOOLEAN HalReset);
+VidResetDisplay(
+ _In_ BOOLEAN HalReset);
ULONG
NTAPI
-VidSetTextColor(IN ULONG Color);
+VidSetTextColor(
+ _In_ ULONG Color);
VOID
NTAPI
-VidDisplayStringXY(IN PUCHAR String,
- IN ULONG Left,
- IN ULONG Top,
- IN BOOLEAN Transparent);
+VidDisplayStringXY(
+ _In_ PUCHAR String,
+ _In_ ULONG Left,
+ _In_ ULONG Top,
+ _In_ BOOLEAN Transparent);
VOID
NTAPI
-VidSetScrollRegion(IN ULONG Left,
- IN ULONG Top,
- IN ULONG Right,
- IN ULONG Bottom);
+VidSetScrollRegion(
+ _In_ ULONG Left,
+ _In_ ULONG Top,
+ _In_ ULONG Right,
+ _In_ ULONG Bottom);
VOID
NTAPI
@@ -44,38 +49,43 @@ VidCleanUp(VOID);
VOID
NTAPI
-VidBufferToScreenBlt(IN PUCHAR Buffer,
- IN ULONG Left,
- IN ULONG Top,
- IN ULONG Width,
- IN ULONG Height,
- IN ULONG Delta);
+VidBufferToScreenBlt(
+ _In_ PUCHAR Buffer,
+ _In_ ULONG Left,
+ _In_ ULONG Top,
+ _In_ ULONG Width,
+ _In_ ULONG Height,
+ _In_ ULONG Delta);
VOID
NTAPI
-VidDisplayString(IN PUCHAR String);
+VidDisplayString(
+ _In_ PUCHAR String);
VOID
NTAPI
-VidBitBlt(IN PUCHAR Buffer,
- IN ULONG Left,
- IN ULONG Top);
+VidBitBlt(
+ _In_ PUCHAR Buffer,
+ _In_ ULONG Left,
+ _In_ ULONG Top);
VOID
NTAPI
-VidScreenToBufferBlt(OUT PUCHAR Buffer,
- IN ULONG Left,
- IN ULONG Top,
- IN ULONG Width,
- IN ULONG Height,
- IN ULONG Delta);
+VidScreenToBufferBlt(
+ _Out_ 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);
+VidSolidColorFill(
+ _In_ ULONG Left,
+ _In_ ULONG Top,
+ _In_ ULONG Right,
+ _In_ ULONG Bottom,
+ _In_ UCHAR Color);
#endif // _BOOTVID_
diff --git a/sdk/include/reactos/drivers/bootvid/display.h
b/sdk/include/reactos/drivers/bootvid/display.h
index af9178153ad..fc509c1fe6b 100644
--- a/sdk/include/reactos/drivers/bootvid/display.h
+++ b/sdk/include/reactos/drivers/bootvid/display.h
@@ -10,3 +10,23 @@
/* For default VGA */
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
+
+/* Boot video default color palette constants */
+#define BV_COLOR_BLACK 0
+#define BV_COLOR_RED 1
+#define BV_COLOR_GREEN 2
+#define BV_COLOR_BROWN 3
+#define BV_COLOR_BLUE 4
+#define BV_COLOR_MAGENTA 5
+#define BV_COLOR_CYAN 6
+#define BV_COLOR_DARK_GRAY 7
+#define BV_COLOR_LIGHT_GRAY 8
+#define BV_COLOR_LIGHT_RED 9
+#define BV_COLOR_LIGHT_GREEN 10
+#define BV_COLOR_YELLOW 11
+#define BV_COLOR_LIGHT_BLUE 12
+#define BV_COLOR_LIGHT_MAGENTA 13
+#define BV_COLOR_LIGHT_CYAN 14
+#define BV_COLOR_WHITE 15
+#define BV_COLOR_NONE 16
+#define BV_MAX_COLORS 16