3 * modified from original freebios code
4 * by Steve M. Gehlbach <steve@kesa.com>
11 #include <console/console.h>
15 static char *vidmem; /* The video buffer, should be replaced by symbol in ldscript.ld */
16 int vga_line, vga_col;
18 #define VIDBUFFER 0xB8000;
20 static void memsetw(void *s, int c, unsigned int n)
25 for (i = 0; i < n; i++) {
30 static void vga_init(void)
36 vidmem = (unsigned char *) VIDBUFFER;
38 // mainboard or chip specific init routines
42 // set attributes, char for entire screen
43 // font should be previously loaded in
44 // device specific code (vga_hardware_fixup)
45 memsetw(vidmem, VGA_ATTR_CLR_WHT, 2*1024); //
48 static void vga_scroll(void)
52 memcpy(vidmem, vidmem + COLS * 2, (LINES - 1) * COLS * 2);
53 for (i = (LINES - 1) * COLS * 2; i < LINES * COLS * 2; i += 2)
57 static void vga_tx_byte(unsigned char byte)
63 } else if (byte == '\r') {
66 } else if (byte == '\b') {
69 } else if (byte == '\t') {
72 } else if (byte == '\a') {
77 vidmem[((vga_col + (vga_line *COLS)) * 2)] = byte;
78 vidmem[((vga_col + (vga_line *COLS)) * 2) +1] = VGA_ATTR_CLR_WHT;
84 if (vga_col >= COLS) {
88 if (vga_line >= LINES) {
93 write_crtc((vga_col + (vga_line *COLS)) >> 8, CRTC_CURSOR_HI);
94 write_crtc((vga_col + (vga_line *COLS)) & 0x0ff, CRTC_CURSOR_LO);
97 struct console_driver {
99 .tx_byte = vga_tx_byte,