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 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); }