VOID NTAPI LlbVideoPutChar(IN UCHAR c) { ULONG cx, cy, CharsPerLine, BackColor, ScreenWidth; /* Backcolor on this machine */ #ifdef BLUE_SCREEN BackColor = LlbHwVideoCreateColor(14, 0, 82); #else BackColor = LlbHwVideoCreateColor(0, 0, 0); #endif /* Amount of characters in a line */ ScreenWidth = LlbHwGetScreenWidth(); CharsPerLine = ScreenWidth / 8; /* Handle new line and scrolling */ if (c == '\n') { /* Move a line down */ ScreenCursor += CharsPerLine - (ScreenCursor % CharsPerLine); /* FIXME: Scrolling */ } else { /* Calculate character position from pixel position */ cy = (ScreenCursor / CharsPerLine) * FONT_HEIGHT; cx = (ScreenCursor % CharsPerLine) * 8; /* Draw the character and increment the cursor */ LlbVideoDrawChar(c, (PUSHORT)LlbHwGetFrameBuffer() + ScreenWidth * cy + cx, 0xFFFF, BackColor); ScreenCursor++; } }
VOID NTAPI LlbVideoClearScreen(IN BOOLEAN OsLoader) { ULONG ScreenSize, p; ULONG BackColor; PUSHORT VideoBuffer; /* Get frame buffer and reset cursor position */ VideoBuffer = LlbHwGetFrameBuffer(); ScreenCursor = 0; /* Backcolor on this machine */ if (OsLoader) { /* Black */ BackColor = 0; } else { /* Deep blue */ #ifdef BLUE_SCREEN BackColor = LlbHwVideoCreateColor(14, 0, 82); #else BackColor = LlbHwVideoCreateColor(0, 0, 0); #endif BackColor = (BackColor << 16) | BackColor; } /* Screen size on this machine */ ScreenSize = LlbHwGetScreenWidth() * LlbHwGetScreenHeight(); /* Clear the screen with the given color */ for (p = 0; p < ScreenSize * 2; p += 4) { *(PULONG)((PCHAR)VideoBuffer + p) = BackColor; } }
VOID LlbFwVideoPutChar(IN INT c, IN UCHAR Attr, IN ULONG X, IN ULONG Y) { ULONG Color, BackColor; PUSHORT Buffer; /* Convert EGA index to color used by hardware */ Color = LlbHwVideoCreateColor(ColorPalette[Attr & 0xF][0], ColorPalette[Attr & 0xF][1], ColorPalette[Attr & 0xF][2]); BackColor = LlbHwVideoCreateColor(ColorPalette[Attr >> 4][0], ColorPalette[Attr >> 4][1], ColorPalette[Attr >> 4][2]); /* Compute buffer address */ Buffer = (PUSHORT)LlbHwGetFrameBuffer() + (LlbHwGetScreenWidth() * (Y * 16)) + (X * 8); /* Draw it */ LlbVideoDrawChar(c, Buffer, Color, BackColor); }