mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
[BOOTVID]
- Revert part of r52239: Fix support for \r and do not handle backspace - Simplify it a bit [NTOSKRNL] - Add backspace support to KdpScreenPrint - Do not draw boot text bitmap if InbvDisplayString is called with "" or "." (matches NT behavior) svn path=/trunk/; revision=52409
This commit is contained in:
parent
8500f6aea6
commit
a965ca6b67
|
@ -66,6 +66,7 @@ ULONG lookup[16] =
|
||||||
ULONG TextColor = 0xF;
|
ULONG TextColor = 0xF;
|
||||||
ULONG curr_x = 0;
|
ULONG curr_x = 0;
|
||||||
ULONG curr_y = 0;
|
ULONG curr_y = 0;
|
||||||
|
BOOLEAN CarriageReturn = FALSE;
|
||||||
ULONG_PTR VgaRegisterBase = 0;
|
ULONG_PTR VgaRegisterBase = 0;
|
||||||
ULONG_PTR VgaBase = 0;
|
ULONG_PTR VgaBase = 0;
|
||||||
|
|
||||||
|
@ -279,14 +280,8 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
VgaScroll(ULONG Scroll)
|
VgaScroll(ULONG Scroll)
|
||||||
{
|
{
|
||||||
ULONG Top;
|
ULONG Top, RowSize, i;
|
||||||
ULONG SourceOffset, DestOffset;
|
PUCHAR OldPosition, NewPosition;
|
||||||
ULONG Offset;
|
|
||||||
ULONG i, j;
|
|
||||||
|
|
||||||
/* Set memory positions of the scroll */
|
|
||||||
SourceOffset = VgaBase + (ScrollRegion[1] * 80) + (ScrollRegion[0] >> 3);
|
|
||||||
DestOffset = SourceOffset + (Scroll * 80);
|
|
||||||
|
|
||||||
/* Clear the 4 planes */
|
/* Clear the 4 planes */
|
||||||
__outpw(0x3C4, 0xF02);
|
__outpw(0x3C4, 0xF02);
|
||||||
|
@ -296,56 +291,27 @@ VgaScroll(ULONG Scroll)
|
||||||
|
|
||||||
/* Set Mode 1 */
|
/* Set Mode 1 */
|
||||||
ReadWriteMode(1);
|
ReadWriteMode(1);
|
||||||
|
|
||||||
/* Save top and check if it's above the bottom */
|
RowSize = (ScrollRegion[2] - ScrollRegion[0] + 1) / 8;
|
||||||
Top = ScrollRegion[1];
|
|
||||||
if (Top > ScrollRegion[3]) return;
|
|
||||||
|
|
||||||
/* Start loop */
|
/* Start loop */
|
||||||
do
|
for(Top = ScrollRegion[1]; Top <= ScrollRegion[3]; ++Top)
|
||||||
{
|
{
|
||||||
/* Set number of bytes to loop and start offset */
|
/* Calculate the position in memory for the row */
|
||||||
Offset = ScrollRegion[0] >> 3;
|
OldPosition = (PUCHAR)VgaBase + (Top + Scroll) * 80 + ScrollRegion[0] / 8;
|
||||||
j = SourceOffset;
|
NewPosition = (PUCHAR)VgaBase + Top * 80 + ScrollRegion[0] / 8;
|
||||||
|
|
||||||
/* Check if this is part of the scroll region */
|
/* Scroll the row */
|
||||||
if (Offset <= (ScrollRegion[2] >> 3))
|
for(i = 0; i < RowSize; ++i)
|
||||||
{
|
WRITE_REGISTER_UCHAR(NewPosition + i, READ_REGISTER_UCHAR(OldPosition + i));
|
||||||
/* Update position */
|
}
|
||||||
i = DestOffset - SourceOffset;
|
|
||||||
|
|
||||||
/* Loop the X axis */
|
|
||||||
do
|
|
||||||
{
|
|
||||||
/* Write value in the new position so that we can do the scroll */
|
|
||||||
WRITE_REGISTER_UCHAR(UlongToPtr(j),
|
|
||||||
READ_REGISTER_UCHAR(UlongToPtr(j + i)));
|
|
||||||
|
|
||||||
/* Move to the next memory location to write to */
|
|
||||||
j++;
|
|
||||||
|
|
||||||
/* Move to the next byte in the region */
|
|
||||||
Offset++;
|
|
||||||
|
|
||||||
/* Make sure we don't go past the scroll region */
|
|
||||||
} while (Offset <= (ScrollRegion[2] >> 3));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move to the next line */
|
|
||||||
SourceOffset += 80;
|
|
||||||
DestOffset += 80;
|
|
||||||
|
|
||||||
/* Increase top */
|
|
||||||
Top++;
|
|
||||||
|
|
||||||
/* Make sure we don't go past the scroll region */
|
|
||||||
} while (Top <= ScrollRegion[3]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
PreserveRow(IN ULONG CurrentTop,
|
PreserveRow(IN ULONG CurrentTop,
|
||||||
IN ULONG TopDelta)
|
IN ULONG TopDelta,
|
||||||
|
IN BOOLEAN Direction)
|
||||||
{
|
{
|
||||||
PUCHAR Position1, Position2;
|
PUCHAR Position1, Position2;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
|
@ -359,9 +325,19 @@ PreserveRow(IN ULONG CurrentTop,
|
||||||
/* Set Mode 1 */
|
/* Set Mode 1 */
|
||||||
ReadWriteMode(1);
|
ReadWriteMode(1);
|
||||||
|
|
||||||
/* Calculate the position in memory for the row */
|
/* Check which way we're preserving */
|
||||||
Position1 = (PUCHAR)VgaBase + 0x9600;
|
if (Direction)
|
||||||
Position2 = (PUCHAR)VgaBase + CurrentTop * 80;
|
{
|
||||||
|
/* Calculate the position in memory for the row */
|
||||||
|
Position1 = (PUCHAR)VgaBase + CurrentTop * 80;
|
||||||
|
Position2 = (PUCHAR)VgaBase + 0x9600;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Calculate the position in memory for the row */
|
||||||
|
Position1 = (PUCHAR)VgaBase + 0x9600;
|
||||||
|
Position2 = (PUCHAR)VgaBase + CurrentTop * 80;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the count and make sure it's above 0 */
|
/* Set the count and make sure it's above 0 */
|
||||||
Count = TopDelta * 80;
|
Count = TopDelta * 80;
|
||||||
|
@ -380,33 +356,6 @@ PreserveRow(IN ULONG CurrentTop,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
CleanCharacter(IN ULONG Left,
|
|
||||||
IN ULONG Top,
|
|
||||||
IN ULONG TopDelta)
|
|
||||||
{
|
|
||||||
PUCHAR Position1, Position2;
|
|
||||||
ULONG i;
|
|
||||||
|
|
||||||
/* Clear the 4 planes */
|
|
||||||
__outpw(0x3C4, 0xF02);
|
|
||||||
|
|
||||||
/* Set the bitmask to 0xFF for all 4 planes */
|
|
||||||
__outpw(0x3CE, 0xFF08);
|
|
||||||
|
|
||||||
/* Set Mode 1 */
|
|
||||||
ReadWriteMode(1);
|
|
||||||
|
|
||||||
/* Calculate the position in memory for the character */
|
|
||||||
Position1 = (PUCHAR)VgaBase + 0x9600 + Left / 8;
|
|
||||||
Position2 = (PUCHAR)VgaBase + Top * 80 + Left / 8;
|
|
||||||
|
|
||||||
/* Copy data from preserved row */
|
|
||||||
for(i = 0; i < TopDelta; ++i)
|
|
||||||
WRITE_REGISTER_UCHAR(Position2 + i * 80, READ_REGISTER_UCHAR(Position1));
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
BitBlt(IN ULONG Left,
|
BitBlt(IN ULONG Left,
|
||||||
|
@ -772,35 +721,34 @@ VidDisplayString(PUCHAR String)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Preserve the current row */
|
/* Preserve row */
|
||||||
PreserveRow(curr_y, TopDelta);
|
PreserveRow(curr_y, TopDelta, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update current X */
|
/* Update current X */
|
||||||
curr_x = ScrollRegion[0];
|
curr_x = ScrollRegion[0];
|
||||||
|
|
||||||
|
/* Do not clear line if "\r\n" is given */
|
||||||
|
CarriageReturn = FALSE;
|
||||||
}
|
}
|
||||||
else if (*String == '\r')
|
else if (*String == '\r')
|
||||||
{
|
{
|
||||||
/* Update current X */
|
/* Update current X */
|
||||||
curr_x = ScrollRegion[0];
|
curr_x = ScrollRegion[0];
|
||||||
}
|
|
||||||
else if (*String == '\b')
|
|
||||||
{
|
|
||||||
/* Update current X */
|
|
||||||
if (curr_x > ScrollRegion[0])
|
|
||||||
curr_x -= 8;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* We are at line begin - move to previous row */
|
|
||||||
curr_x = ScrollRegion[0];
|
|
||||||
curr_y -= TopDelta;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clean current character */
|
/* Check if we're being followed by a new line */
|
||||||
CleanCharacter(curr_x, curr_y, TopDelta);
|
CarriageReturn = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* check if we had a '\r' last time */
|
||||||
|
if (CarriageReturn)
|
||||||
|
{
|
||||||
|
/* We did, clear the current row */
|
||||||
|
PreserveRow(curr_y, TopDelta, TRUE);
|
||||||
|
CarriageReturn = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Display this character */
|
/* Display this character */
|
||||||
DisplayCharacter(*String, curr_x, curr_y, TextColor, 16);
|
DisplayCharacter(*String, curr_x, curr_y, TextColor, 16);
|
||||||
curr_x += 8;
|
curr_x += 8;
|
||||||
|
@ -819,7 +767,7 @@ VidDisplayString(PUCHAR String)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Preserve the current row */
|
/* Preserve the current row */
|
||||||
PreserveRow(curr_y, TopDelta);
|
PreserveRow(curr_y, TopDelta, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update X */
|
/* Update X */
|
||||||
|
|
|
@ -717,11 +717,15 @@ NTAPI
|
||||||
INIT_FUNCTION
|
INIT_FUNCTION
|
||||||
DisplayFilter(PCHAR *String)
|
DisplayFilter(PCHAR *String)
|
||||||
{
|
{
|
||||||
/* Remove the filter */
|
/* Ignore empty and "." strings */
|
||||||
InbvInstallDisplayStringFilter(NULL);
|
if(*String && strcmp(String, ".") != 0)
|
||||||
|
{
|
||||||
/* Draw text screen */
|
/* Remove the filter */
|
||||||
DisplayBootBitmap(TRUE);
|
InbvInstallDisplayStringFilter(NULL);
|
||||||
|
|
||||||
|
/* Draw text screen */
|
||||||
|
DisplayBootBitmap(TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -29,6 +29,10 @@ KD_PORT_INFORMATION SerialPortInfo = { DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RA
|
||||||
/* Current Port in use. FIXME: Do we support more then one? */
|
/* Current Port in use. FIXME: Do we support more then one? */
|
||||||
ULONG KdpPort;
|
ULONG KdpPort;
|
||||||
|
|
||||||
|
#define KdpScreenLineLenght 80
|
||||||
|
CHAR KdpScreenLineBuffer[KdpScreenLineLenght + 1] = "";
|
||||||
|
ULONG KdpScreenLineBufferPos = 0, KdpScreenLineLength = 0;
|
||||||
|
|
||||||
/* DEBUG LOG FUNCTIONS *******************************************************/
|
/* DEBUG LOG FUNCTIONS *******************************************************/
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -316,8 +320,50 @@ NTAPI
|
||||||
KdpScreenPrint(LPSTR Message,
|
KdpScreenPrint(LPSTR Message,
|
||||||
ULONG Length)
|
ULONG Length)
|
||||||
{
|
{
|
||||||
/* Call HAL */
|
PCHAR pch = (PCHAR) Message;
|
||||||
HalDisplayString(Message);
|
|
||||||
|
while (*pch)
|
||||||
|
{
|
||||||
|
if(*pch == '\b')
|
||||||
|
{
|
||||||
|
/* HalDisplayString does not support '\b'. Workaround it and use '\r' */
|
||||||
|
if(KdpScreenLineLength > 0)
|
||||||
|
{
|
||||||
|
/* Remove last character from buffer */
|
||||||
|
KdpScreenLineBuffer[--KdpScreenLineLength] = '\0';
|
||||||
|
KdpScreenLineBufferPos = KdpScreenLineLength;
|
||||||
|
|
||||||
|
/* Clear row and print line again */
|
||||||
|
HalDisplayString("\r");
|
||||||
|
HalDisplayString(KdpScreenLineBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KdpScreenLineBuffer[KdpScreenLineLength++] = *pch;
|
||||||
|
KdpScreenLineBuffer[KdpScreenLineLength] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*pch == '\n' || KdpScreenLineLength == KdpScreenLineLenght)
|
||||||
|
{
|
||||||
|
/* Print buffered characters */
|
||||||
|
if(KdpScreenLineBufferPos != KdpScreenLineLength)
|
||||||
|
HalDisplayString(KdpScreenLineBuffer + KdpScreenLineBufferPos);
|
||||||
|
|
||||||
|
/* Clear line buffer */
|
||||||
|
KdpScreenLineBuffer[0] = '\0';
|
||||||
|
KdpScreenLineLength = KdpScreenLineBufferPos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
++pch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print buffered characters */
|
||||||
|
if(KdpScreenLineBufferPos != KdpScreenLineLength)
|
||||||
|
{
|
||||||
|
HalDisplayString(KdpScreenLineBuffer + KdpScreenLineBufferPos);
|
||||||
|
KdpScreenLineBufferPos = KdpScreenLineLength;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
Loading…
Reference in a new issue