[BOOTVID]

- Synchronize correctly arm/bootdata.c with i386, as it was done previously.
- Code formatting: whitespace fixes, add braces/brackets and spaces where needed; comments styling.
- Correctly put braces for casts and around macro parameters.
- Add some IN/OUT.
- Fix parameter names of a function.

[INBV]
- Fix parameter names of two functions.

svn path=/trunk/; revision=64017
This commit is contained in:
Hermès Bélusca-Maïto 2014-08-31 23:00:29 +00:00
parent 02c93ba93a
commit 4948419f9f
8 changed files with 265 additions and 249 deletions

View file

@ -48,7 +48,10 @@ USHORT AT_Initialization[] =
0x0 // End of command stream 0x0 // End of command stream
}; };
UCHAR FontData[256 * 13] = //
// The character generator is in natural order, top of char is first element.
//
UCHAR FontData[256 * BOOTCHAR_HEIGHT] =
{ {
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 0 0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 0
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 13 0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 13

View file

@ -107,11 +107,11 @@ VidpSetPixel(IN ULONG Left,
VOID VOID
NTAPI NTAPI
DisplayCharacter(CHAR Character, DisplayCharacter(IN CHAR Character,
ULONG Left, IN ULONG Left,
ULONG Top, IN ULONG Top,
ULONG TextColor, IN ULONG TextColor,
ULONG BackTextColor) IN ULONG BackTextColor)
{ {
PUCHAR FontChar; PUCHAR FontChar;
ULONG i, j, XOffset; ULONG i, j, XOffset;
@ -152,7 +152,7 @@ DisplayCharacter(CHAR Character,
VOID VOID
NTAPI NTAPI
VgaScroll(ULONG Scroll) VgaScroll(IN ULONG Scroll)
{ {
ULONG Top, Offset; ULONG Top, Offset;
PUSHORT SourceOffset, DestOffset; PUSHORT SourceOffset, DestOffset;
@ -229,20 +229,16 @@ PreserveRow(IN ULONG CurrentTop,
Position2 = &VgaArmBase[CurrentTop * 80]; Position2 = &VgaArmBase[CurrentTop * 80];
} }
/* Set the count and make sure it's above 0 */ /* Set the count and loop every pixel */
Count = TopDelta * 80; Count = TopDelta * 80;
if (Count) while (Count--)
{
/* Loop every pixel */
do
{ {
/* Write the data back on the other position */ /* Write the data back on the other position */
WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2)); WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2));
/* Increase both positions */ /* Increase both positions */
Position2++;
Position1++; Position1++;
} while (--Count); Position2++;
} }
} }
@ -339,7 +335,7 @@ VidResetDisplay(IN BOOLEAN HalReset)
*/ */
ULONG ULONG
NTAPI NTAPI
VidSetTextColor(ULONG Color) VidSetTextColor(IN ULONG Color)
{ {
UCHAR OldColor; UCHAR OldColor;
@ -360,10 +356,10 @@ VidSetTextColor(ULONG Color)
*/ */
VOID VOID
NTAPI NTAPI
VidDisplayStringXY(PUCHAR String, VidDisplayStringXY(IN PUCHAR String,
ULONG Left, IN ULONG Left,
ULONG Top, IN ULONG Top,
BOOLEAN Transparent) IN BOOLEAN Transparent)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
while (TRUE); while (TRUE);
@ -374,24 +370,24 @@ VidDisplayStringXY(PUCHAR String,
*/ */
VOID VOID
NTAPI NTAPI
VidSetScrollRegion(ULONG x1, VidSetScrollRegion(IN ULONG Left,
ULONG y1, IN ULONG Top,
ULONG x2, IN ULONG Right,
ULONG y2) IN ULONG Bottom)
{ {
/* Assert alignment */ /* Assert alignment */
ASSERT((x1 & 0x7) == 0); ASSERT((Left & 0x7) == 0);
ASSERT((x2 & 0x7) == 7); ASSERT((Right & 0x7) == 7);
/* Set Scroll Region */ /* Set Scroll Region */
VidpScrollRegion[0] = x1; VidpScrollRegion[0] = Left;
VidpScrollRegion[1] = y1; VidpScrollRegion[1] = Top;
VidpScrollRegion[2] = x2; VidpScrollRegion[2] = Right;
VidpScrollRegion[3] = y2; VidpScrollRegion[3] = Bottom;
/* Set current X and Y */ /* Set current X and Y */
VidpCurrentX = x1; VidpCurrentX = Left;
VidpCurrentY = y1; VidpCurrentY = Top;
} }
/* /*
@ -426,7 +422,7 @@ VidBufferToScreenBlt(IN PUCHAR Buffer,
*/ */
VOID VOID
NTAPI NTAPI
VidDisplayString(PUCHAR String) VidDisplayString(IN PUCHAR String)
{ {
ULONG TopDelta = 14; ULONG TopDelta = 14;
@ -510,9 +506,9 @@ VidDisplayString(PUCHAR String)
*/ */
VOID VOID
NTAPI NTAPI
VidBitBlt(PUCHAR Buffer, VidBitBlt(IN PUCHAR Buffer,
ULONG Left, IN ULONG Left,
ULONG Top) IN ULONG Top)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
//while (TRUE); //while (TRUE);
@ -523,12 +519,12 @@ VidBitBlt(PUCHAR Buffer,
*/ */
VOID VOID
NTAPI NTAPI
VidScreenToBufferBlt(PUCHAR Buffer, VidScreenToBufferBlt(IN PUCHAR Buffer,
ULONG Left, IN ULONG Left,
ULONG Top, IN ULONG Top,
ULONG Width, IN ULONG Width,
ULONG Height, IN ULONG Height,
ULONG Delta) IN ULONG Delta)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
while (TRUE); while (TRUE);

View file

@ -5,7 +5,7 @@
/* PRIVATE FUNCTIONS *********************************************************/ /* PRIVATE FUNCTIONS *********************************************************/
BOOLEAN static BOOLEAN
NTAPI NTAPI
VgaInterpretCmdStream(IN PUSHORT CmdStream) VgaInterpretCmdStream(IN PUSHORT CmdStream)
{ {
@ -139,6 +139,7 @@ VgaInterpretCmdStream(IN PUSHORT CmdStream)
switch (Minor) switch (Minor)
{ {
case 0: case 0:
{
/* The port is what is in the stream right now */ /* The port is what is in the stream right now */
ShortPort = UlongToPtr(*CmdStream); ShortPort = UlongToPtr(*CmdStream);
@ -167,7 +168,10 @@ VgaInterpretCmdStream(IN PUSHORT CmdStream)
WRITE_PORT_USHORT(ShortPort, ShortValue); WRITE_PORT_USHORT(ShortPort, ShortValue);
} }
break; break;
}
case 1: case 1:
{
/* The port is what is in the stream right now. Add the base too */ /* The port is what is in the stream right now. Add the base too */
Port = *CmdStream + Base; Port = *CmdStream + Base;
@ -196,7 +200,10 @@ VgaInterpretCmdStream(IN PUSHORT CmdStream)
WRITE_PORT_UCHAR(Port, Value); WRITE_PORT_UCHAR(Port, Value);
} }
break; break;
}
case 2: case 2:
{
/* The port is what is in the stream right now. Add the base too */ /* The port is what is in the stream right now. Add the base too */
Port = *CmdStream + Base; Port = *CmdStream + Base;
@ -208,6 +215,8 @@ VgaInterpretCmdStream(IN PUSHORT CmdStream)
/* Write the value */ /* Write the value */
WRITE_PORT_UCHAR(Port, Value); WRITE_PORT_UCHAR(Port, Value);
break; break;
}
default: default:
/* Unknown command, fail */ /* Unknown command, fail */
return FALSE; return FALSE;
@ -227,7 +236,7 @@ VgaInterpretCmdStream(IN PUSHORT CmdStream)
return TRUE; return TRUE;
} }
BOOLEAN static BOOLEAN
NTAPI NTAPI
VgaIsPresent(VOID) VgaIsPresent(VOID)
{ {

View file

@ -2,14 +2,14 @@
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
ULONG ScrollRegion[4] = static ULONG ScrollRegion[4] =
{ {
0, 0,
0, 0,
640 - 1, 640 - 1,
480 - 1 480 - 1
}; };
UCHAR lMaskTable[8] = static UCHAR lMaskTable[8] =
{ {
(1 << 8) - (1 << 0), (1 << 8) - (1 << 0),
(1 << 7) - (1 << 0), (1 << 7) - (1 << 0),
@ -20,7 +20,7 @@ UCHAR lMaskTable[8] =
(1 << 2) - (1 << 0), (1 << 2) - (1 << 0),
(1 << 1) - (1 << 0) (1 << 1) - (1 << 0)
}; };
UCHAR rMaskTable[8] = static UCHAR rMaskTable[8] =
{ {
(1 << 7), (1 << 7),
(1 << 7)+ (1 << 6), (1 << 7)+ (1 << 6),
@ -43,7 +43,7 @@ UCHAR PixelMask[8] =
(1 << 1), (1 << 1),
(1 << 0), (1 << 0),
}; };
ULONG lookup[16] = static ULONG lookup[16] =
{ {
0x0000, 0x0000,
0x0100, 0x0100,
@ -63,24 +63,24 @@ ULONG lookup[16] =
0x1111, 0x1111,
}; };
ULONG VidTextColor = 0xF;
ULONG curr_x = 0;
ULONG curr_y = 0;
BOOLEAN CarriageReturn = FALSE;
ULONG_PTR VgaRegisterBase = 0; ULONG_PTR VgaRegisterBase = 0;
ULONG_PTR VgaBase = 0; ULONG_PTR VgaBase = 0;
ULONG curr_x = 0;
ULONG curr_y = 0;
static ULONG VidTextColor = 0xF;
static BOOLEAN CarriageReturn = FALSE;
#define __outpb(Port, Value) \ #define __outpb(Port, Value) \
WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + Port, (UCHAR)Value) WRITE_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)), (UCHAR)(Value))
#define __outpw(Port, Value) \ #define __outpw(Port, Value) \
WRITE_PORT_USHORT((PUSHORT)(VgaRegisterBase + Port), (USHORT)Value) WRITE_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)), (USHORT)(Value))
/* PRIVATE FUNCTIONS *********************************************************/ /* PRIVATE FUNCTIONS *********************************************************/
VOID static VOID
NTAPI NTAPI
ReadWriteMode(UCHAR Mode) ReadWriteMode(IN UCHAR Mode)
{ {
UCHAR Value; UCHAR Value;
@ -94,7 +94,6 @@ ReadWriteMode(UCHAR Mode)
__outpb(0x3CF, Mode | Value); __outpb(0x3CF, Mode | Value);
} }
FORCEINLINE FORCEINLINE
VOID VOID
SetPixel(IN ULONG Left, SetPixel(IN ULONG Left,
@ -104,7 +103,7 @@ SetPixel(IN ULONG Left,
PUCHAR PixelPosition; PUCHAR PixelPosition;
/* Calculate the pixel position. */ /* Calculate the pixel position. */
PixelPosition = (PUCHAR)VgaBase + (Left >> 3) + (Top * 80); PixelPosition = (PUCHAR)(VgaBase + (Left >> 3) + (Top * 80));
/* Select the bitmask register and write the mask */ /* Select the bitmask register and write the mask */
__outpw(0x3CE, (PixelMask[Left & 7] << 8) | 8); __outpw(0x3CE, (PixelMask[Left & 7] << 8) | 8);
@ -114,6 +113,14 @@ SetPixel(IN ULONG Left,
READ_REGISTER_UCHAR(PixelPosition) & Color); READ_REGISTER_UCHAR(PixelPosition) & Color);
} }
#define SET_PIXELS(_PixelPtr, _PixelMask, _TextColor) \
do { \
/* Select the bitmask register and write the mask */ \
__outpw(0x3CE, ((_PixelMask) << 8) | 8); \
/* Set the new color */ \
WRITE_REGISTER_UCHAR((_PixelPtr), (UCHAR)(_TextColor)); \
} while (0);
#ifdef CHAR_GEN_UPSIDE_DOWN #ifdef CHAR_GEN_UPSIDE_DOWN
# define GetFontPtr(_Char) &FontData[_Char * BOOTCHAR_HEIGHT] + BOOTCHAR_HEIGHT - 1; # define GetFontPtr(_Char) &FontData[_Char * BOOTCHAR_HEIGHT] + BOOTCHAR_HEIGHT - 1;
# define FONT_PTR_DELTA (-1) # define FONT_PTR_DELTA (-1)
@ -122,20 +129,13 @@ SetPixel(IN ULONG Left,
# define FONT_PTR_DELTA (1) # define FONT_PTR_DELTA (1)
#endif #endif
#define SET_PIXELS(_PixelPtr, _PixelMask, _TextColor) \ static VOID
/* Select the bitmask register and write the mask */ \
__outpw(0x3CE, (_PixelMask << 8) | 8); \
\
/* Set the new color */ \
WRITE_REGISTER_UCHAR(_PixelPtr, (UCHAR)_TextColor);\
VOID
NTAPI NTAPI
DisplayCharacter(CHAR Character, DisplayCharacter(IN CHAR Character,
ULONG Left, IN ULONG Left,
ULONG Top, IN ULONG Top,
ULONG TextColor, IN ULONG TextColor,
ULONG BackColor) IN ULONG BackColor)
{ {
PUCHAR FontChar, PixelPtr; PUCHAR FontChar, PixelPtr;
ULONG Height; ULONG Height;
@ -155,7 +155,7 @@ DisplayCharacter(CHAR Character,
/* Get the font and pixel pointer */ /* Get the font and pixel pointer */
FontChar = GetFontPtr(Character); FontChar = GetFontPtr(Character);
PixelPtr = (PUCHAR)VgaBase + (Left >> 3) + (Top * 80); PixelPtr = (PUCHAR)(VgaBase + (Left >> 3) + (Top * 80));
/* Loop all pixel rows */ /* Loop all pixel rows */
Height = BOOTCHAR_HEIGHT; Height = BOOTCHAR_HEIGHT;
@ -174,7 +174,7 @@ DisplayCharacter(CHAR Character,
/* Get the font and pixel pointer (2nd byte) */ /* Get the font and pixel pointer (2nd byte) */
FontChar = GetFontPtr(Character); FontChar = GetFontPtr(Character);
PixelPtr = (PUCHAR)VgaBase + (Left >> 3) + (Top * 80) + 1; PixelPtr = (PUCHAR)(VgaBase + (Left >> 3) + (Top * 80) + 1);
/* Loop all pixel rows */ /* Loop all pixel rows */
Height = BOOTCHAR_HEIGHT; Height = BOOTCHAR_HEIGHT;
@ -198,7 +198,7 @@ DisplayCharacter(CHAR Character,
/* Get the font and pixel pointer */ /* Get the font and pixel pointer */
FontChar = GetFontPtr(Character); FontChar = GetFontPtr(Character);
PixelPtr = (PUCHAR)VgaBase + (Left >> 3) + (Top * 80); PixelPtr = (PUCHAR)(VgaBase + (Left >> 3) + (Top * 80));
/* Loop all pixel rows */ /* Loop all pixel rows */
Height = BOOTCHAR_HEIGHT; Height = BOOTCHAR_HEIGHT;
@ -217,7 +217,7 @@ DisplayCharacter(CHAR Character,
/* Get the font and pixel pointer (2nd byte) */ /* Get the font and pixel pointer (2nd byte) */
FontChar = GetFontPtr(Character); FontChar = GetFontPtr(Character);
PixelPtr = (PUCHAR)VgaBase + (Left >> 3) + (Top * 80) + 1; PixelPtr = (PUCHAR)(VgaBase + (Left >> 3) + (Top * 80) + 1);
/* Loop all pixel rows */ /* Loop all pixel rows */
Height = BOOTCHAR_HEIGHT; Height = BOOTCHAR_HEIGHT;
@ -230,13 +230,13 @@ DisplayCharacter(CHAR Character,
} }
} }
VOID static VOID
NTAPI NTAPI
DisplayStringXY(PUCHAR String, DisplayStringXY(IN PUCHAR String,
ULONG Left, IN ULONG Left,
ULONG Top, IN ULONG Top,
ULONG TextColor, IN ULONG TextColor,
ULONG BackColor) IN ULONG BackColor)
{ {
/* Loop every character */ /* Loop every character */
while (*String) while (*String)
@ -250,7 +250,7 @@ DisplayStringXY(PUCHAR String,
} }
} }
VOID static VOID
NTAPI NTAPI
SetPaletteEntryRGB(IN ULONG Id, SetPaletteEntryRGB(IN ULONG Id,
IN ULONG Rgb) IN ULONG Rgb)
@ -266,7 +266,7 @@ SetPaletteEntryRGB(IN ULONG Id,
__outpb(0x3C9, Colors[0] >> 2); __outpb(0x3C9, Colors[0] >> 2);
} }
VOID static VOID
NTAPI NTAPI
InitPaletteWithTable(IN PULONG Table, InitPaletteWithTable(IN PULONG Table,
IN ULONG Count) IN ULONG Count)
@ -282,7 +282,7 @@ InitPaletteWithTable(IN PULONG Table,
} }
} }
VOID static VOID
NTAPI NTAPI
SetPaletteEntry(IN ULONG Id, SetPaletteEntry(IN ULONG Id,
IN ULONG PaletteEntry) IN ULONG PaletteEntry)
@ -300,18 +300,18 @@ VOID
NTAPI NTAPI
InitializePalette(VOID) InitializePalette(VOID)
{ {
ULONG PaletteEntry[16] = {0, ULONG PaletteEntry[16] = {0x000000,
0x20, 0x000020,
0x2000, 0x002000,
0x2020, 0x002020,
0x200000, 0x200000,
0x200020, 0x200020,
0x202000, 0x202000,
0x202020, 0x202020,
0x303030, 0x303030,
0x3F, 0x00003F,
0x3F00, 0x003F00,
0x3F3F, 0x003F3F,
0x3F0000, 0x3F0000,
0x3F003F, 0x3F003F,
0x3F3F00, 0x3F3F00,
@ -322,9 +322,9 @@ InitializePalette(VOID)
for (i = 0; i < 16; i++) SetPaletteEntry(i, PaletteEntry[i]); for (i = 0; i < 16; i++) SetPaletteEntry(i, PaletteEntry[i]);
} }
VOID static VOID
NTAPI NTAPI
VgaScroll(ULONG Scroll) VgaScroll(IN ULONG Scroll)
{ {
ULONG Top, RowSize; ULONG Top, RowSize;
PUCHAR OldPosition, NewPosition; PUCHAR OldPosition, NewPosition;
@ -341,11 +341,11 @@ VgaScroll(ULONG Scroll)
RowSize = (ScrollRegion[2] - ScrollRegion[0] + 1) / 8; RowSize = (ScrollRegion[2] - ScrollRegion[0] + 1) / 8;
/* Calculate the position in memory for the row */ /* Calculate the position in memory for the row */
OldPosition = (PUCHAR)VgaBase + (ScrollRegion[1] + Scroll) * 80 + ScrollRegion[0] / 8; OldPosition = (PUCHAR)(VgaBase + (ScrollRegion[1] + Scroll) * 80 + ScrollRegion[0] / 8);
NewPosition = (PUCHAR)VgaBase + ScrollRegion[1] * 80 + ScrollRegion[0] / 8; NewPosition = (PUCHAR)(VgaBase + ScrollRegion[1] * 80 + ScrollRegion[0] / 8);
/* Start loop */ /* Start loop */
for(Top = ScrollRegion[1]; Top <= ScrollRegion[3]; ++Top) for (Top = ScrollRegion[1]; Top <= ScrollRegion[3]; ++Top)
{ {
#if defined(_M_IX86) || defined(_M_AMD64) #if defined(_M_IX86) || defined(_M_AMD64)
__movsb(NewPosition, OldPosition, RowSize); __movsb(NewPosition, OldPosition, RowSize);
@ -353,7 +353,7 @@ VgaScroll(ULONG Scroll)
ULONG i; ULONG i;
/* Scroll the row */ /* Scroll the row */
for(i = 0; i < RowSize; ++i) for (i = 0; i < RowSize; ++i)
WRITE_REGISTER_UCHAR(NewPosition + i, READ_REGISTER_UCHAR(OldPosition + i)); WRITE_REGISTER_UCHAR(NewPosition + i, READ_REGISTER_UCHAR(OldPosition + i));
#endif #endif
OldPosition += 80; OldPosition += 80;
@ -361,7 +361,7 @@ VgaScroll(ULONG Scroll)
} }
} }
VOID static VOID
NTAPI NTAPI
PreserveRow(IN ULONG CurrentTop, PreserveRow(IN ULONG CurrentTop,
IN ULONG TopDelta, IN ULONG TopDelta,
@ -383,36 +383,35 @@ PreserveRow(IN ULONG CurrentTop,
if (Direction) if (Direction)
{ {
/* Calculate the position in memory for the row */ /* Calculate the position in memory for the row */
Position1 = (PUCHAR)VgaBase + CurrentTop * 80; Position1 = (PUCHAR)(VgaBase + CurrentTop * 80);
Position2 = (PUCHAR)VgaBase + 0x9600; Position2 = (PUCHAR)(VgaBase + 0x9600);
} }
else else
{ {
/* Calculate the position in memory for the row */ /* Calculate the position in memory for the row */
Position1 = (PUCHAR)VgaBase + 0x9600; Position1 = (PUCHAR)(VgaBase + 0x9600);
Position2 = (PUCHAR)VgaBase + CurrentTop * 80; Position2 = (PUCHAR)(VgaBase + CurrentTop * 80);
} }
/* Set the count and make sure it's above 0 */ /* Set the count and loop every pixel */
Count = TopDelta * 80; Count = TopDelta * 80;
#if defined(_M_IX86) || defined(_M_AMD64) #if defined(_M_IX86) || defined(_M_AMD64)
__movsb(Position1, Position2, Count); __movsb(Position1, Position2, Count);
#else #else
/* Loop every pixel */
while (Count--) while (Count--)
{ {
/* Write the data back on the other position */ /* Write the data back on the other position */
WRITE_REGISTER_UCHAR(Position1, READ_REGISTER_UCHAR(Position2)); WRITE_REGISTER_UCHAR(Position1, READ_REGISTER_UCHAR(Position2));
/* Increase both positions */ /* Increase both positions */
Position2++;
Position1++; Position1++;
Position2++;
} }
#endif #endif
} }
VOID static VOID
NTAPI NTAPI
BitBlt(IN ULONG Left, BitBlt(IN ULONG Left,
IN ULONG Top, IN ULONG Top,
@ -479,7 +478,7 @@ BitBlt(IN ULONG Left,
} while (dy < Bottom); } while (dy < Bottom);
} }
VOID static VOID
NTAPI NTAPI
RleBitBlt(IN ULONG Left, RleBitBlt(IN ULONG Left,
IN ULONG Top, IN ULONG Top,
@ -577,22 +576,24 @@ RleBitBlt(IN ULONG Left,
{ {
/* Case 0 */ /* Case 0 */
case 0: case 0:
{
/* Set new x value, decrease distance and restart */ /* Set new x value, decrease distance and restart */
x = Left; x = Left;
YDelta--; YDelta--;
Buffer++; Buffer++;
continue; continue;
}
/* Case 1 */ /* Case 1 */
case 1: case 1:
{
/* Done */ /* Done */
return; return;
}
/* Case 2 */ /* Case 2 */
case 2: case 2:
{
/* Set new x value, decrease distance and restart */ /* Set new x value, decrease distance and restart */
Buffer++; Buffer++;
x += *Buffer; x += *Buffer;
@ -600,13 +601,15 @@ RleBitBlt(IN ULONG Left,
YDelta -= *Buffer; YDelta -= *Buffer;
Buffer++; Buffer++;
continue; continue;
}
/* Other values */ /* Other values */
default: default:
{
Buffer++; Buffer++;
break; break;
} }
}
/* Check if we've gone past the edge */ /* Check if we've gone past the edge */
if ((x + RleValue) > (Width + Left)) if ((x + RleValue) > (Width + Left))
@ -684,7 +687,7 @@ RleBitBlt(IN ULONG Left,
*/ */
ULONG ULONG
NTAPI NTAPI
VidSetTextColor(ULONG Color) VidSetTextColor(IN ULONG Color)
{ {
ULONG OldColor; ULONG OldColor;
@ -699,16 +702,18 @@ VidSetTextColor(ULONG Color)
*/ */
VOID VOID
NTAPI NTAPI
VidDisplayStringXY(PUCHAR String, VidDisplayStringXY(IN PUCHAR String,
ULONG Left, IN ULONG Left,
ULONG Top, IN ULONG Top,
BOOLEAN Transparent) IN BOOLEAN Transparent)
{ {
ULONG BackColor; ULONG BackColor;
/* If the caller wanted transparent, then send the special value (16), else */ /*
/* use our default and call the helper routine. */ * If the caller wanted transparent, then send the special value (16),
BackColor = (Transparent) ? 16 : 14; * else use our default and call the helper routine.
*/
BackColor = Transparent ? 16 : 14;
DisplayStringXY(String, Left, Top, 12, BackColor); DisplayStringXY(String, Left, Top, 12, BackColor);
} }
@ -717,24 +722,24 @@ VidDisplayStringXY(PUCHAR String,
*/ */
VOID VOID
NTAPI NTAPI
VidSetScrollRegion(ULONG x1, VidSetScrollRegion(IN ULONG Left,
ULONG y1, IN ULONG Top,
ULONG x2, IN ULONG Right,
ULONG y2) IN ULONG Bottom)
{ {
/* Assert alignment */ /* Assert alignment */
ASSERT((x1 & 0x7) == 0); ASSERT((Left & 0x7) == 0);
ASSERT((x2 & 0x7) == 7); ASSERT((Right & 0x7) == 7);
/* Set Scroll Region */ /* Set Scroll Region */
ScrollRegion[0] = x1; ScrollRegion[0] = Left;
ScrollRegion[1] = y1; ScrollRegion[1] = Top;
ScrollRegion[2] = x2; ScrollRegion[2] = Right;
ScrollRegion[3] = y2; ScrollRegion[3] = Bottom;
/* Set current X and Y */ /* Set current X and Y */
curr_x = x1; curr_x = Left;
curr_y = y1; curr_y = Top;
} }
/* /*
@ -764,7 +769,7 @@ VidBufferToScreenBlt(IN PUCHAR Buffer,
IN ULONG Delta) IN ULONG Delta)
{ {
/* Make sure we have a width and height */ /* Make sure we have a width and height */
if (!(Width) || !(Height)) return; if (!Width || !Height) return;
/* Call the helper function */ /* Call the helper function */
BitBlt(Left, Top, Width, Height, Buffer, 4, Delta); BitBlt(Left, Top, Width, Height, Buffer, 4, Delta);
@ -775,7 +780,7 @@ VidBufferToScreenBlt(IN PUCHAR Buffer,
*/ */
VOID VOID
NTAPI NTAPI
VidDisplayString(PUCHAR String) VidDisplayString(IN PUCHAR String)
{ {
ULONG TopDelta = BOOTCHAR_HEIGHT + 1; ULONG TopDelta = BOOTCHAR_HEIGHT + 1;
@ -859,9 +864,9 @@ VidDisplayString(PUCHAR String)
*/ */
VOID VOID
NTAPI NTAPI
VidBitBlt(PUCHAR Buffer, VidBitBlt(IN PUCHAR Buffer,
ULONG Left, IN ULONG Left,
ULONG Top) IN ULONG Top)
{ {
PBITMAPINFOHEADER BitmapInfoHeader; PBITMAPINFOHEADER BitmapInfoHeader;
LONG Delta; LONG Delta;
@ -878,15 +883,17 @@ VidBitBlt(PUCHAR Buffer,
/* Make sure we can support this bitmap */ /* Make sure we can support this bitmap */
ASSERT((BitmapInfoHeader->biBitCount * BitmapInfoHeader->biPlanes) <= 4); ASSERT((BitmapInfoHeader->biBitCount * BitmapInfoHeader->biPlanes) <= 4);
/* Calculate the delta and align it on 32-bytes, then calculate the actual */ /*
/* start of the bitmap data. */ * Calculate the delta and align it on 32-bytes, then calculate
* the actual start of the bitmap data.
*/
Delta = (BitmapInfoHeader->biBitCount * BitmapInfoHeader->biWidth) + 31; Delta = (BitmapInfoHeader->biBitCount * BitmapInfoHeader->biWidth) + 31;
Delta >>= 3; Delta >>= 3;
Delta &= ~3; Delta &= ~3;
BitmapOffset = Buffer + sizeof(BITMAPINFOHEADER) + 16 * sizeof(ULONG); BitmapOffset = Buffer + sizeof(BITMAPINFOHEADER) + 16 * sizeof(ULONG);
/* Check the compression of the bitmap */ /* Check the compression of the bitmap */
if (BitmapInfoHeader->biCompression == 2) if (BitmapInfoHeader->biCompression == BI_RLE4)
{ {
/* Make sure we have a width and a height */ /* Make sure we have a width and a height */
if ((BitmapInfoHeader->biWidth) && (BitmapInfoHeader->biHeight)) if ((BitmapInfoHeader->biWidth) && (BitmapInfoHeader->biHeight))
@ -910,7 +917,7 @@ VidBitBlt(PUCHAR Buffer,
else else
{ {
/* Update buffer offset */ /* Update buffer offset */
BitmapOffset += ((BitmapInfoHeader->biHeight -1) * Delta); BitmapOffset += ((BitmapInfoHeader->biHeight - 1) * Delta);
Delta *= -1; Delta *= -1;
} }
@ -934,12 +941,12 @@ VidBitBlt(PUCHAR Buffer,
*/ */
VOID VOID
NTAPI NTAPI
VidScreenToBufferBlt(PUCHAR Buffer, VidScreenToBufferBlt(IN PUCHAR Buffer,
ULONG Left, IN ULONG Left,
ULONG Top, IN ULONG Top,
ULONG Width, IN ULONG Width,
ULONG Height, IN ULONG Height,
ULONG Delta) IN ULONG Delta)
{ {
ULONG Plane; ULONG Plane;
ULONG XDistance; ULONG XDistance;
@ -974,7 +981,7 @@ VidScreenToBufferBlt(PUCHAR Buffer,
do do
{ {
/* Set the current pixel position and reset buffer loop variable */ /* Set the current pixel position and reset buffer loop variable */
PixelPosition = (PUCHAR)VgaBase + PixelOffset; PixelPosition = (PUCHAR)(VgaBase + PixelOffset);
i = Buffer; i = Buffer;
/* Set Mode 0 */ /* Set Mode 0 */
@ -1073,7 +1080,7 @@ VidSolidColorFill(IN ULONG Left,
__outpw(0x3CE, 7); __outpw(0x3CE, 7);
/* Calculate pixel position for the read */ /* Calculate pixel position for the read */
Offset = VgaBase + (Top * 80) + (PUCHAR)(ULONG_PTR)LeftOffset; Offset = (PUCHAR)(VgaBase + (Top * 80) + LeftOffset);
/* Select the bitmask register and write the mask */ /* Select the bitmask register and write the mask */
__outpw(0x3CE, (USHORT)lMask); __outpw(0x3CE, (USHORT)lMask);
@ -1097,7 +1104,7 @@ VidSolidColorFill(IN ULONG Left,
if (Distance) if (Distance)
{ {
/* Calculate new pixel position */ /* Calculate new pixel position */
Offset = VgaBase + (Top * 80) + (PUCHAR)(ULONG_PTR)RightOffset; Offset = (PUCHAR)(VgaBase + (Top * 80) + RightOffset);
Distance--; Distance--;
/* Select the bitmask register and write the mask */ /* Select the bitmask register and write the mask */
@ -1123,7 +1130,7 @@ VidSolidColorFill(IN ULONG Left,
if (Distance) if (Distance)
{ {
/* Calculate new pixel position */ /* Calculate new pixel position */
Offset = VgaBase + (Top * 80) + (PUCHAR)(ULONG_PTR)(LeftOffset + 1); Offset = (PUCHAR)(VgaBase + (Top * 80) + LeftOffset + 1);
/* Set the bitmask to 0xFF for all 4 planes */ /* Set the bitmask to 0xFF for all 4 planes */
__outpw(0x3CE, 0xFF08); __outpw(0x3CE, 0xFF08);

View file

@ -31,11 +31,13 @@ typedef struct tagBITMAPINFOHEADER
ULONG biClrImportant; ULONG biClrImportant;
} BITMAPINFOHEADER, *PBITMAPINFOHEADER; } BITMAPINFOHEADER, *PBITMAPINFOHEADER;
/* Supported bitmap compression formats */
#define BI_RGB 0
#define BI_RLE4 2
VOID VOID
NTAPI NTAPI
InitializePalette( InitializePalette(VOID);
VOID
);
/* Globals */ /* Globals */
extern USHORT AT_Initialization[]; extern USHORT AT_Initialization[];

View file

@ -94,8 +94,8 @@ NTAPI
InbvSetScrollRegion( InbvSetScrollRegion(
_In_ ULONG Left, _In_ ULONG Left,
_In_ ULONG Top, _In_ ULONG Top,
_In_ ULONG Width, _In_ ULONG Right,
_In_ ULONG Height _In_ ULONG Bottom
); );
VOID VOID
@ -109,8 +109,8 @@ NTAPI
InbvSolidColorFill( InbvSolidColorFill(
_In_ ULONG Left, _In_ ULONG Left,
_In_ ULONG Top, _In_ ULONG Top,
_In_ ULONG Width, _In_ ULONG Right,
_In_ ULONG Height, _In_ ULONG Bottom,
_In_ ULONG Color _In_ ULONG Color
); );

View file

@ -11,22 +11,21 @@ VidResetDisplay(IN BOOLEAN HalReset);
ULONG ULONG
NTAPI NTAPI
VidSetTextColor(ULONG Color); VidSetTextColor(IN ULONG Color);
VOID VOID
NTAPI NTAPI
VidDisplayStringXY(PUCHAR String, VidDisplayStringXY(IN PUCHAR String,
ULONG Left, IN ULONG Left,
ULONG Top, IN ULONG Top,
BOOLEAN Transparent); IN BOOLEAN Transparent);
VOID VOID
NTAPI NTAPI
VidSetScrollRegion(ULONG x1, VidSetScrollRegion(IN ULONG Left,
ULONG y1, IN ULONG Top,
ULONG x2, IN ULONG Right,
ULONG y2); IN ULONG Bottom);
VOID VOID
NTAPI NTAPI
@ -43,22 +42,22 @@ VidBufferToScreenBlt(IN PUCHAR Buffer,
VOID VOID
NTAPI NTAPI
VidDisplayString(PUCHAR String); VidDisplayString(IN PUCHAR String);
VOID VOID
NTAPI NTAPI
VidBitBlt(PUCHAR Buffer, VidBitBlt(IN PUCHAR Buffer,
ULONG Left, IN ULONG Left,
ULONG Top); IN ULONG Top);
VOID VOID
NTAPI NTAPI
VidScreenToBufferBlt(PUCHAR Buffer, VidScreenToBufferBlt(IN PUCHAR Buffer,
ULONG Left, IN ULONG Left,
ULONG Top, IN ULONG Top,
ULONG Width, IN ULONG Width,
ULONG Height, IN ULONG Height,
ULONG Delta); IN ULONG Delta);
VOID VOID
NTAPI NTAPI

View file

@ -363,7 +363,7 @@ InbvDisplayString(IN PCHAR String)
InbvAcquireLock(); InbvAcquireLock();
/* Make sure we're installed and display the string */ /* Make sure we're installed and display the string */
if (InbvBootDriverInstalled) VidDisplayString((PUCHAR) String); if (InbvBootDriverInstalled) VidDisplayString((PUCHAR)String);
/* Print the string on the EMS port */ /* Print the string on the EMS port */
HeadlessDispatch(HeadlessCmdPutString, HeadlessDispatch(HeadlessCmdPutString,
@ -462,11 +462,11 @@ VOID
NTAPI NTAPI
InbvSetScrollRegion(IN ULONG Left, InbvSetScrollRegion(IN ULONG Left,
IN ULONG Top, IN ULONG Top,
IN ULONG Width, IN ULONG Right,
IN ULONG Height) IN ULONG Bottom)
{ {
/* Just call bootvid */ /* Just call bootvid */
VidSetScrollRegion(Left, Top, Width, Height); VidSetScrollRegion(Left, Top, Right, Bottom);
} }
VOID VOID
@ -483,8 +483,8 @@ VOID
NTAPI NTAPI
InbvSolidColorFill(IN ULONG Left, InbvSolidColorFill(IN ULONG Left,
IN ULONG Top, IN ULONG Top,
IN ULONG Width, IN ULONG Right,
IN ULONG Height, IN ULONG Bottom,
IN ULONG Color) IN ULONG Color)
{ {
/* Make sure we own it */ /* Make sure we own it */
@ -497,7 +497,7 @@ InbvSolidColorFill(IN ULONG Left,
if (InbvBootDriverInstalled) if (InbvBootDriverInstalled)
{ {
/* Call bootvid */ /* Call bootvid */
VidSolidColorFill(Left, Top, Width, Height, (UCHAR)Color); VidSolidColorFill(Left, Top, Right, Bottom, (UCHAR)Color);
} }
/* FIXME: Headless */ /* FIXME: Headless */