mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 02:03:43 +00:00
[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:
parent
02c93ba93a
commit
4948419f9f
8 changed files with 265 additions and 249 deletions
|
@ -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
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2)
|
#define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2)
|
||||||
#define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1)
|
#define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1)
|
||||||
#define LCDCONTROL_LCDPWR (1 << 11)
|
#define LCDCONTROL_LCDPWR (1 << 11)
|
||||||
#define LCDCONTROL_LCDEN (1)
|
#define LCDCONTROL_LCDEN (1)
|
||||||
#define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1)
|
#define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1)
|
||||||
#define LCDCONTROL_LCDTFT (1 << 5)
|
#define LCDCONTROL_LCDTFT (1 << 5)
|
||||||
|
|
||||||
#define PL110_LCDTIMING0 (PVOID)0xE0020000
|
#define PL110_LCDTIMING0 (PVOID)0xE0020000
|
||||||
#define PL110_LCDTIMING1 (PVOID)0xE0020004
|
#define PL110_LCDTIMING1 (PVOID)0xE0020004
|
||||||
#define PL110_LCDTIMING2 (PVOID)0xE0020008
|
#define PL110_LCDTIMING2 (PVOID)0xE0020008
|
||||||
#define PL110_LCDUPBASE (PVOID)0xE0020010
|
#define PL110_LCDUPBASE (PVOID)0xE0020010
|
||||||
#define PL110_LCDLPBASE (PVOID)0xE0020014
|
#define PL110_LCDLPBASE (PVOID)0xE0020014
|
||||||
#define PL110_LCDCONTROL (PVOID)0xE0020018
|
#define PL110_LCDCONTROL (PVOID)0xE0020018
|
||||||
|
|
||||||
#define READ_REGISTER_ULONG(r) (*(volatile ULONG * const)(r))
|
#define READ_REGISTER_ULONG(r) (*(volatile ULONG * const)(r))
|
||||||
#define WRITE_REGISTER_ULONG(r, v) (*(volatile ULONG *)(r) = (v))
|
#define WRITE_REGISTER_ULONG(r, v) (*(volatile ULONG *)(r) = (v))
|
||||||
|
@ -71,14 +71,14 @@ FORCEINLINE
|
||||||
VidpBuildColor(IN UCHAR Color)
|
VidpBuildColor(IN UCHAR Color)
|
||||||
{
|
{
|
||||||
UCHAR Red, Green, Blue;
|
UCHAR Red, Green, Blue;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract color components
|
// Extract color components
|
||||||
//
|
//
|
||||||
Red = VidpVga8To16BitTransform[Color].Red;
|
Red = VidpVga8To16BitTransform[Color].Red;
|
||||||
Green = VidpVga8To16BitTransform[Color].Green;
|
Green = VidpVga8To16BitTransform[Color].Green;
|
||||||
Blue = VidpVga8To16BitTransform[Color].Blue;
|
Blue = VidpVga8To16BitTransform[Color].Blue;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Build the 16-bit color mask
|
// Build the 16-bit color mask
|
||||||
//
|
//
|
||||||
|
@ -93,7 +93,7 @@ VidpSetPixel(IN ULONG Left,
|
||||||
IN UCHAR Color)
|
IN UCHAR Color)
|
||||||
{
|
{
|
||||||
PUSHORT PixelPosition;
|
PUSHORT PixelPosition;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Calculate the pixel position
|
// Calculate the pixel position
|
||||||
//
|
//
|
||||||
|
@ -107,18 +107,18 @@ 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;
|
||||||
|
|
||||||
/* Get the font line for this character */
|
/* Get the font line for this character */
|
||||||
FontChar = &FontData[Character * 13 - Top];
|
FontChar = &FontData[Character * 13 - Top];
|
||||||
|
|
||||||
/* Loop each pixel height */
|
/* Loop each pixel height */
|
||||||
i = 13;
|
i = 13;
|
||||||
do
|
do
|
||||||
|
@ -140,11 +140,11 @@ DisplayCharacter(CHAR Character,
|
||||||
/* transparent. */
|
/* transparent. */
|
||||||
VidpSetPixel(XOffset, Top, (UCHAR)BackTextColor);
|
VidpSetPixel(XOffset, Top, (UCHAR)BackTextColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Increase X Offset */
|
/* Increase X Offset */
|
||||||
XOffset++;
|
XOffset++;
|
||||||
} while (j >>= 1);
|
} while (j >>= 1);
|
||||||
|
|
||||||
/* Move to the next Y ordinate */
|
/* Move to the next Y ordinate */
|
||||||
Top++;
|
Top++;
|
||||||
} while (--i);
|
} while (--i);
|
||||||
|
@ -152,56 +152,56 @@ 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;
|
||||||
PUSHORT i, j;
|
PUSHORT i, j;
|
||||||
|
|
||||||
/* Set memory positions of the scroll */
|
/* Set memory positions of the scroll */
|
||||||
SourceOffset = &VgaArmBase[(VidpScrollRegion[1] * 80) + (VidpScrollRegion[0] >> 3)];
|
SourceOffset = &VgaArmBase[(VidpScrollRegion[1] * 80) + (VidpScrollRegion[0] >> 3)];
|
||||||
DestOffset = &SourceOffset[Scroll * 80];
|
DestOffset = &SourceOffset[Scroll * 80];
|
||||||
|
|
||||||
/* Save top and check if it's above the bottom */
|
/* Save top and check if it's above the bottom */
|
||||||
Top = VidpScrollRegion[1];
|
Top = VidpScrollRegion[1];
|
||||||
if (Top > VidpScrollRegion[3]) return;
|
if (Top > VidpScrollRegion[3]) return;
|
||||||
|
|
||||||
/* Start loop */
|
/* Start loop */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* Set number of bytes to loop and start offset */
|
/* Set number of bytes to loop and start offset */
|
||||||
Offset = VidpScrollRegion[0] >> 3;
|
Offset = VidpScrollRegion[0] >> 3;
|
||||||
j = SourceOffset;
|
j = SourceOffset;
|
||||||
|
|
||||||
/* Check if this is part of the scroll region */
|
/* Check if this is part of the scroll region */
|
||||||
if (Offset <= (VidpScrollRegion[2] >> 3))
|
if (Offset <= (VidpScrollRegion[2] >> 3))
|
||||||
{
|
{
|
||||||
/* Update position */
|
/* Update position */
|
||||||
i = (PUSHORT)(DestOffset - SourceOffset);
|
i = (PUSHORT)(DestOffset - SourceOffset);
|
||||||
|
|
||||||
/* Loop the X axis */
|
/* Loop the X axis */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* Write value in the new position so that we can do the scroll */
|
/* Write value in the new position so that we can do the scroll */
|
||||||
WRITE_REGISTER_USHORT(j, READ_REGISTER_USHORT(j + (ULONG_PTR)i));
|
WRITE_REGISTER_USHORT(j, READ_REGISTER_USHORT(j + (ULONG_PTR)i));
|
||||||
|
|
||||||
/* Move to the next memory location to write to */
|
/* Move to the next memory location to write to */
|
||||||
j++;
|
j++;
|
||||||
|
|
||||||
/* Move to the next byte in the region */
|
/* Move to the next byte in the region */
|
||||||
Offset++;
|
Offset++;
|
||||||
|
|
||||||
/* Make sure we don't go past the scroll region */
|
/* Make sure we don't go past the scroll region */
|
||||||
} while (Offset <= (VidpScrollRegion[2] >> 3));
|
} while (Offset <= (VidpScrollRegion[2] >> 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to the next line */
|
/* Move to the next line */
|
||||||
SourceOffset += 80;
|
SourceOffset += 80;
|
||||||
DestOffset += 80;
|
DestOffset += 80;
|
||||||
|
|
||||||
/* Increase top */
|
/* Increase top */
|
||||||
Top++;
|
Top++;
|
||||||
|
|
||||||
/* Make sure we don't go past the scroll region */
|
/* Make sure we don't go past the scroll region */
|
||||||
} while (Top <= VidpScrollRegion[3]);
|
} while (Top <= VidpScrollRegion[3]);
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ PreserveRow(IN ULONG CurrentTop,
|
||||||
{
|
{
|
||||||
PUSHORT Position1, Position2;
|
PUSHORT Position1, Position2;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
|
|
||||||
/* Check which way we're preserving */
|
/* Check which way we're preserving */
|
||||||
if (Direction)
|
if (Direction)
|
||||||
{
|
{
|
||||||
|
@ -228,21 +228,17 @@ PreserveRow(IN ULONG CurrentTop,
|
||||||
Position1 = &VgaArmBase[0x9600];
|
Position1 = &VgaArmBase[0x9600];
|
||||||
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 */
|
/* Write the data back on the other position */
|
||||||
do
|
WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2));
|
||||||
{
|
|
||||||
/* Write the data back on the other position */
|
/* Increase both positions */
|
||||||
WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2));
|
Position1++;
|
||||||
|
Position2++;
|
||||||
/* Increase both positions */
|
|
||||||
Position2++;
|
|
||||||
Position1++;
|
|
||||||
} while (--Count);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,17 +251,17 @@ VidpInitializeDisplay(VOID)
|
||||||
//
|
//
|
||||||
WRITE_REGISTER_ULONG(PL110_LCDUPBASE, VgaPhysical.LowPart);
|
WRITE_REGISTER_ULONG(PL110_LCDUPBASE, VgaPhysical.LowPart);
|
||||||
WRITE_REGISTER_ULONG(PL110_LCDLPBASE, VgaPhysical.LowPart);
|
WRITE_REGISTER_ULONG(PL110_LCDLPBASE, VgaPhysical.LowPart);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize timings to 640x480
|
// Initialize timings to 640x480
|
||||||
//
|
//
|
||||||
WRITE_REGISTER_ULONG(PL110_LCDTIMING0, LCDTIMING0_PPL(640));
|
WRITE_REGISTER_ULONG(PL110_LCDTIMING0, LCDTIMING0_PPL(640));
|
||||||
WRITE_REGISTER_ULONG(PL110_LCDTIMING1, LCDTIMING1_LPP(480));
|
WRITE_REGISTER_ULONG(PL110_LCDTIMING1, LCDTIMING1_LPP(480));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Enable the LCD Display
|
// Enable the LCD Display
|
||||||
//
|
//
|
||||||
WRITE_REGISTER_ULONG(PL110_LCDCONTROL,
|
WRITE_REGISTER_ULONG(PL110_LCDCONTROL,
|
||||||
LCDCONTROL_LCDEN |
|
LCDCONTROL_LCDEN |
|
||||||
LCDCONTROL_LCDTFT |
|
LCDCONTROL_LCDTFT |
|
||||||
LCDCONTROL_LCDPWR |
|
LCDCONTROL_LCDPWR |
|
||||||
|
@ -280,9 +276,9 @@ VidpInitializeDisplay(VOID)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
VidInitialize(IN BOOLEAN SetMode)
|
VidInitialize(IN BOOLEAN SetMode)
|
||||||
{
|
{
|
||||||
DPRINT1("bv-arm v0.1\n");
|
DPRINT1("bv-arm v0.1\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate framebuffer
|
// Allocate framebuffer
|
||||||
// 600kb works out to 640x480@16bpp
|
// 600kb works out to 640x480@16bpp
|
||||||
|
@ -290,7 +286,7 @@ VidInitialize(IN BOOLEAN SetMode)
|
||||||
VgaPhysical.QuadPart = -1;
|
VgaPhysical.QuadPart = -1;
|
||||||
VgaArmBase = MmAllocateContiguousMemory(600 * 1024, VgaPhysical);
|
VgaArmBase = MmAllocateContiguousMemory(600 * 1024, VgaPhysical);
|
||||||
if (!VgaArmBase) return FALSE;
|
if (!VgaArmBase) return FALSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get physical address
|
// Get physical address
|
||||||
//
|
//
|
||||||
|
@ -321,12 +317,12 @@ VidResetDisplay(IN BOOLEAN HalReset)
|
||||||
//
|
//
|
||||||
VidpCurrentX = 0;
|
VidpCurrentX = 0;
|
||||||
VidpCurrentY = 0;
|
VidpCurrentY = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Re-initialize the VGA Display
|
// Re-initialize the VGA Display
|
||||||
//
|
//
|
||||||
VidpInitializeDisplay();
|
VidpInitializeDisplay();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Re-initialize the palette and fill the screen black
|
// Re-initialize the palette and fill the screen black
|
||||||
//
|
//
|
||||||
|
@ -339,16 +335,16 @@ VidResetDisplay(IN BOOLEAN HalReset)
|
||||||
*/
|
*/
|
||||||
ULONG
|
ULONG
|
||||||
NTAPI
|
NTAPI
|
||||||
VidSetTextColor(ULONG Color)
|
VidSetTextColor(IN ULONG Color)
|
||||||
{
|
{
|
||||||
UCHAR OldColor;
|
UCHAR OldColor;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save the old, set the new
|
// Save the old, set the new
|
||||||
//
|
//
|
||||||
OldColor = VidpTextColor;
|
OldColor = VidpTextColor;
|
||||||
VidpTextColor = Color;
|
VidpTextColor = Color;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Return the old text color
|
// Return the old text color
|
||||||
//
|
//
|
||||||
|
@ -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,10 +422,10 @@ VidBufferToScreenBlt(IN PUCHAR Buffer,
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
VidDisplayString(PUCHAR String)
|
VidDisplayString(IN PUCHAR String)
|
||||||
{
|
{
|
||||||
ULONG TopDelta = 14;
|
ULONG TopDelta = 14;
|
||||||
|
|
||||||
/* Start looping the string */
|
/* Start looping the string */
|
||||||
while (*String)
|
while (*String)
|
||||||
{
|
{
|
||||||
|
@ -443,14 +439,14 @@ VidDisplayString(PUCHAR String)
|
||||||
/* Scroll the view */
|
/* Scroll the view */
|
||||||
VgaScroll(TopDelta);
|
VgaScroll(TopDelta);
|
||||||
VidpCurrentY -= TopDelta;
|
VidpCurrentY -= TopDelta;
|
||||||
|
|
||||||
/* Preserve row */
|
/* Preserve row */
|
||||||
PreserveRow(VidpCurrentY, TopDelta, TRUE);
|
PreserveRow(VidpCurrentY, TopDelta, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update current X */
|
/* Update current X */
|
||||||
VidpCurrentX = VidpScrollRegion[0];
|
VidpCurrentX = VidpScrollRegion[0];
|
||||||
|
|
||||||
/* Preseve the current row */
|
/* Preseve the current row */
|
||||||
PreserveRow(VidpCurrentY, TopDelta, FALSE);
|
PreserveRow(VidpCurrentY, TopDelta, FALSE);
|
||||||
}
|
}
|
||||||
|
@ -458,7 +454,7 @@ VidDisplayString(PUCHAR String)
|
||||||
{
|
{
|
||||||
/* Update current X */
|
/* Update current X */
|
||||||
VidpCurrentX = VidpScrollRegion[0];
|
VidpCurrentX = VidpScrollRegion[0];
|
||||||
|
|
||||||
/* Check if we're being followed by a new line */
|
/* Check if we're being followed by a new line */
|
||||||
if (String[1] != '\n') NextLine = TRUE;
|
if (String[1] != '\n') NextLine = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -471,7 +467,7 @@ VidDisplayString(PUCHAR String)
|
||||||
PreserveRow(VidpCurrentY, TopDelta, TRUE);
|
PreserveRow(VidpCurrentY, TopDelta, TRUE);
|
||||||
NextLine = FALSE;
|
NextLine = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display this character */
|
/* Display this character */
|
||||||
DisplayCharacter(*String,
|
DisplayCharacter(*String,
|
||||||
VidpCurrentX,
|
VidpCurrentX,
|
||||||
|
@ -479,7 +475,7 @@ VidDisplayString(PUCHAR String)
|
||||||
VidpTextColor,
|
VidpTextColor,
|
||||||
16);
|
16);
|
||||||
VidpCurrentX += 8;
|
VidpCurrentX += 8;
|
||||||
|
|
||||||
/* Check if we should scroll */
|
/* Check if we should scroll */
|
||||||
if (VidpCurrentX > VidpScrollRegion[2])
|
if (VidpCurrentX > VidpScrollRegion[2])
|
||||||
{
|
{
|
||||||
|
@ -490,19 +486,19 @@ VidDisplayString(PUCHAR String)
|
||||||
/* Do the scroll */
|
/* Do the scroll */
|
||||||
VgaScroll(TopDelta);
|
VgaScroll(TopDelta);
|
||||||
VidpCurrentY -= TopDelta;
|
VidpCurrentY -= TopDelta;
|
||||||
|
|
||||||
/* Save the row */
|
/* Save the row */
|
||||||
PreserveRow(VidpCurrentY, TopDelta, TRUE);
|
PreserveRow(VidpCurrentY, TopDelta, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update X */
|
/* Update X */
|
||||||
VidpCurrentX = VidpScrollRegion[0];
|
VidpCurrentX = VidpScrollRegion[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the next character */
|
/* Get the next character */
|
||||||
String++;
|
String++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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);
|
||||||
|
@ -546,12 +542,12 @@ VidSolidColorFill(IN ULONG Left,
|
||||||
IN UCHAR Color)
|
IN UCHAR Color)
|
||||||
{
|
{
|
||||||
int y, x;
|
int y, x;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Loop along the Y-axis
|
// Loop along the Y-axis
|
||||||
//
|
//
|
||||||
for (y = Top; y <= Bottom; y++)
|
for (y = Top; y <= Bottom; y++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Loop along the X-axis
|
// Loop along the X-axis
|
||||||
//
|
//
|
||||||
|
@ -562,5 +558,5 @@ VidSolidColorFill(IN ULONG Left,
|
||||||
//
|
//
|
||||||
VidpSetPixel(x, y, Color);
|
VidpSetPixel(x, y, Color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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,12 +601,14 @@ 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 */
|
||||||
|
@ -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);
|
||||||
|
|
|
@ -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[];
|
||||||
|
|
|
@ -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
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue