Author: fireball Date: Mon Jun 25 22:02:59 2007 New Revision: 27277
URL: http://svn.reactos.org/svn/reactos?rev=27277&view=rev Log: - Map the framebuffer to 0xEE000000 in the freeldr, since 0xFF000000+ virtual addresses are used by the kernel for different purposes. - Add solid color fill. - Add VGA palette lookup for colors passed to the bootvid.dll. - Add support for transparent background in letters (color 16).
Modified: branches/olpc/boot/freeldr/freeldr/arch/i386/loader.c branches/olpc/drivers/base/bootvid/vid.c branches/olpc/drivers/base/bootvid/vid_fb.c
Modified: branches/olpc/boot/freeldr/freeldr/arch/i386/loader.c URL: http://svn.reactos.org/svn/reactos/branches/olpc/boot/freeldr/freeldr/arch/i... ============================================================================== --- branches/olpc/boot/freeldr/freeldr/arch/i386/loader.c (original) +++ branches/olpc/boot/freeldr/freeldr/arch/i386/loader.c Mon Jun 25 22:02:59 2007 @@ -49,7 +49,7 @@ extern PAGE_DIRECTORY_X86 framebuffer_pagetable;
#define FRAMEBUFFER_PHYS 0xFD000000 -#define FRAMEBUFFER_VIRT 0xFF000000 +#define FRAMEBUFFER_VIRT 0xEE000000 #define FRAMEBUFFER_SIZE 2 * 1024 * 1024
PVOID
Modified: branches/olpc/drivers/base/bootvid/vid.c URL: http://svn.reactos.org/svn/reactos/branches/olpc/drivers/base/bootvid/vid.c?... ============================================================================== --- branches/olpc/drivers/base/bootvid/vid.c (original) +++ branches/olpc/drivers/base/bootvid/vid.c Mon Jun 25 22:02:59 2007 @@ -40,7 +40,7 @@ 900 - 1 };
-ULONG TextColor = 0xFFFF; +ULONG TextColor = 0xF; ULONG curr_x = 0, curr_y = 0; BOOLEAN NextLine = FALSE;
Modified: branches/olpc/drivers/base/bootvid/vid_fb.c URL: http://svn.reactos.org/svn/reactos/branches/olpc/drivers/base/bootvid/vid_fb... ============================================================================== --- branches/olpc/drivers/base/bootvid/vid_fb.c (original) +++ branches/olpc/drivers/base/bootvid/vid_fb.c Mon Jun 25 22:02:59 2007 @@ -31,9 +31,27 @@ extern UCHAR BitmapFont8x16[256 * 16]; extern UCHAR BitmapFont10x18[256 * 18 * 2];
- -//static BOOLEAN VidpInitialized = FALSE; -static PUCHAR VidpMemory = (VOID *)0xFF000000; +USHORT VgaPalette[] = { + 0x0000, /* 0 black */ + 0xA800, /* 1 blue */ + 0x0540, /* 2 green */ + 0xAD40, /* 3 cyan */ + 0x0015, /* 4 red */ + 0xA815, /* 5 magenta */ + 0x02B5, /* 6 brown */ + 0xAD55, /* 7 light gray */ + 0x52AA, /* 8 dark gray */ + 0xFAAA, /* 9 bright blue */ + 0x57EA, /* 10 bright green */ + 0xFFEA, /* 11 bright cyan */ + 0x52BF, /* 12 bright red */ + 0xFABF, /* 13 bright magenta */ + 0x57FF, /* 14 bright yellow */ + 0xFFFF /* 15 bright white */ +}; + +static BOOLEAN VidpInitialized = FALSE; +static PUCHAR VidpMemory = (VOID *)0xEE000000;
#define CHAR_WIDTH 10 #define CHAR_HEIGHT 18 @@ -60,10 +78,16 @@ unsigned Line; unsigned Col; UCHAR BytesPerChar = (CHAR_WIDTH < 8) ? 1 : 2; - - //HACK - Color = 0xFFFF; - BackTextColor = 0; + BOOLEAN Transparent = FALSE; + + /* Transform from VGA palette to RGB565 */ + if (Color < 16) + Color = VgaPalette[Color]; + + if (BackTextColor < 16) + BackTextColor = VgaPalette[BackTextColor]; + else + Transparent = TRUE;
FontPtr = (PUSHORT)(BitmapFont10x18 + Character * CHAR_HEIGHT * BytesPerChar);
@@ -74,7 +98,11 @@ Mask = (1 << (CHAR_WIDTH-1)); for (Col = 0; Col < CHAR_WIDTH; Col++) { - Pixel[Col] = (0 != (FontPtr[Line] & Mask) ? Color : BackTextColor); + if (!Transparent) + Pixel[Col] = (0 != (FontPtr[Line] & Mask) ? Color : BackTextColor); + else + Pixel[Col] = (0 != (FontPtr[Line] & Mask) ? Color : Pixel[Col]); // transparent background + Mask = Mask >> 1; } Pixel = (WORD *) ((char *) Pixel + Stride); @@ -150,7 +178,6 @@ VidFbInitialize( IN BOOLEAN SetMode) { -#if 0 PHYSICAL_ADDRESS PhysicalAddress;
if (!VidpInitialized) @@ -160,12 +187,9 @@ if (VidpMemory == NULL) return FALSE;
- memset(VidpMemory, 0x00, 0x200000); - //memset((VOID *)0xFF000000, 0x90, 1024*1024); - VidpInitialized = TRUE; } -#endif + DPRINT1("VidFbInitialize(SetMode %d)\n", SetMode); return TRUE; } @@ -218,6 +242,27 @@ IN ULONG Bottom, IN ULONG Color) { + ULONG Line, Col; + PUSHORT p; + + /* Sanity checks */ + if (Top > Bottom) + return; + if (Left > Right) + return; + + /* Translate color to the VGA palette */ + if (Color < 16) + Color = VgaPalette[Color]; + + for (Line = Top; Line <= Bottom; Line++) + { + p = (PUSHORT)(VidpMemory + (Line * DISPLAY_WIDTH * BytesPerPixel) + Left * BytesPerPixel); + for (Col = 0; Col < (Right-Left); Col++) + { + *p++ = Color; + } + } }
static VOID NTAPI