mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[FREELDR] Add vertical screen scrolling for Xbox with console mode (#2745)
Also turn off debug messages to screen before setting up the CPU (To print a character to the screen on some ports the MMIO access should be executed, so it throws an exception). CORE-16216
This commit is contained in:
parent
a2a24cadae
commit
98c17d3120
7 changed files with 49 additions and 9 deletions
|
@ -37,6 +37,7 @@ Pc98PrepareForReactOS(VOID)
|
|||
Pc98DiskPrepareForReactOS();
|
||||
Pc98VideoPrepareForReactOS();
|
||||
DiskStopFloppyMotor();
|
||||
DebugDisableScreenPort();
|
||||
}
|
||||
|
||||
ULONG
|
||||
|
|
|
@ -277,10 +277,6 @@ MachInit(const char *CmdLine)
|
|||
/* Set LEDs to red before anything is initialized */
|
||||
XboxSetLED("rrrr");
|
||||
|
||||
/* Initialize our stuff */
|
||||
XboxMemInit();
|
||||
XboxVideoInit();
|
||||
|
||||
/* Setup vtbl */
|
||||
MachVtbl.ConsPutChar = XboxConsPutChar;
|
||||
MachVtbl.ConsKbHit = XboxConsKbHit;
|
||||
|
@ -311,6 +307,10 @@ MachInit(const char *CmdLine)
|
|||
MachVtbl.HwDetect = XboxHwDetect;
|
||||
MachVtbl.HwIdle = XboxHwIdle;
|
||||
|
||||
/* Initialize our stuff */
|
||||
XboxMemInit();
|
||||
XboxVideoInit();
|
||||
|
||||
/* Set LEDs to orange after init */
|
||||
XboxSetLED("oooo");
|
||||
|
||||
|
@ -324,6 +324,9 @@ XboxPrepareForReactOS(VOID)
|
|||
XboxVideoPrepareForReactOS();
|
||||
XboxDiskInit(FALSE);
|
||||
DiskStopFloppyMotor();
|
||||
|
||||
/* Turn off debug messages to screen */
|
||||
DebugDisableScreenPort();
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -25,7 +25,17 @@ static unsigned CurrentAttr = 0x0f;
|
|||
VOID
|
||||
XboxConsPutChar(int c)
|
||||
{
|
||||
ULONG Width, Unused;
|
||||
ULONG Width, Height, Unused;
|
||||
BOOLEAN NeedScroll;
|
||||
|
||||
XboxVideoGetDisplaySize(&Width, &Height, &Unused);
|
||||
|
||||
NeedScroll = (CurrentCursorY >= Height);
|
||||
if (NeedScroll)
|
||||
{
|
||||
XboxVideoScrollUp();
|
||||
--CurrentCursorY;
|
||||
}
|
||||
|
||||
if (c == '\r')
|
||||
{
|
||||
|
@ -34,7 +44,9 @@ XboxConsPutChar(int c)
|
|||
else if (c == '\n')
|
||||
{
|
||||
CurrentCursorX = 0;
|
||||
CurrentCursorY++;
|
||||
|
||||
if (!NeedScroll)
|
||||
++CurrentCursorY;
|
||||
}
|
||||
else if (c == '\t')
|
||||
{
|
||||
|
@ -46,13 +58,11 @@ XboxConsPutChar(int c)
|
|||
CurrentCursorX++;
|
||||
}
|
||||
|
||||
XboxVideoGetDisplaySize(&Width, &Unused, &Unused);
|
||||
if (CurrentCursorX >= Width)
|
||||
{
|
||||
CurrentCursorX = 0;
|
||||
CurrentCursorY++;
|
||||
}
|
||||
// FIXME: Implement vertical screen scrolling if we are at the end of the screen.
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
*/
|
||||
|
||||
#include <freeldr.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <debug.h>
|
||||
DBG_DEFAULT_CHANNEL(UI);
|
||||
|
||||
PVOID FrameBuffer;
|
||||
|
@ -101,6 +101,24 @@ XboxVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
|
|||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
XboxVideoScrollUp(VOID)
|
||||
{
|
||||
ULONG BgColor, Dummy;
|
||||
ULONG PixelCount = ScreenWidth * CHAR_HEIGHT *
|
||||
(((ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT) - 1);
|
||||
PULONG Src = (PULONG)((PUCHAR)FrameBuffer + (CHAR_HEIGHT + TOP_BOTTOM_LINES) * Delta);
|
||||
PULONG Dst = (PULONG)((PUCHAR)FrameBuffer + TOP_BOTTOM_LINES * Delta);
|
||||
|
||||
XboxVideoAttrToColors(ATTR(COLOR_WHITE, COLOR_BLACK), &Dummy, &BgColor);
|
||||
|
||||
while (PixelCount--)
|
||||
*Dst++ = *Src++;
|
||||
|
||||
for (PixelCount = 0; PixelCount < ScreenWidth * CHAR_HEIGHT; PixelCount++)
|
||||
*Dst++ = BgColor;
|
||||
}
|
||||
|
||||
VOID
|
||||
XboxVideoClearScreen(UCHAR Attr)
|
||||
{
|
||||
|
|
|
@ -69,6 +69,7 @@ VOID XboxVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
|
|||
VOID XboxVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
|
||||
VOID XboxVideoSync(VOID);
|
||||
VOID XboxVideoPrepareForReactOS(VOID);
|
||||
VOID XboxVideoScrollUp(VOID);
|
||||
VOID XboxPrepareForReactOS(VOID);
|
||||
|
||||
VOID XboxMemInit(VOID);
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
ULONG DbgPrint(const char *Format, ...);
|
||||
VOID DbgPrint2(ULONG Mask, ULONG Level, const char *File, ULONG Line, char *Format, ...);
|
||||
VOID DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length);
|
||||
VOID DebugDisableScreenPort();
|
||||
VOID DbgParseDebugChannels(PCHAR Value);
|
||||
|
||||
#define ERR_LEVEL 0x1
|
||||
|
|
|
@ -327,6 +327,12 @@ DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length)
|
|||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
DebugDisableScreenPort(VOID)
|
||||
{
|
||||
DebugPort &= ~SCREEN;
|
||||
}
|
||||
|
||||
static BOOLEAN
|
||||
DbgAddDebugChannel(CHAR* channel, CHAR* level, CHAR op)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue