3 * modified from original freebios code
4 * by Steve M. Gehlbach <steve@kesa.com>
10 * * make vga_console_init take FB location, columns, lines and starting
12 * * track a word offset, and not columns/lines. The offset is needed more
13 * often than columns/lines and the latter two can be calculated easily.
14 * * then implement real vga scrolling, instead of memcpying stuff around.
21 #include <pc80/vga_io.h>
23 #include <console/console.h>
25 /* The video buffer, should be replaced by symbol in ldscript.ld */
27 static int total_lines
, total_columns
;
28 static int current_line
, current_column
;
29 static int vga_console_inited
= 0;
34 void vga_console_init(void)
36 vidmem
= (char *) VGA_FB
;
37 total_columns
= VGA_COLUMNS
;
38 total_lines
= VGA_LINES
;
42 vga_console_inited
= 1;
45 static void vga_scroll(void)
49 memcpy(vidmem
, vidmem
+ total_columns
* 2, (total_lines
- 1) * total_columns
* 2);
50 for (i
= (total_lines
- 1) * total_columns
* 2; i
< total_lines
* total_columns
* 2; i
+= 2)
55 vga_tx_byte(unsigned char byte
)
57 if (!vga_console_inited
)
77 vidmem
[((current_column
+ (current_line
* total_columns
)) * 2)] = byte
;
78 vidmem
[((current_column
+ (current_line
* total_columns
)) * 2) +1] = 0x07;
83 if (current_column
< 0)
85 if (current_column
>= total_columns
) {
89 if (current_line
>= total_lines
) {
95 vga_cr_write(0x0E, (current_column
+ (current_line
* total_columns
)) >> 8);
96 vga_cr_write(0x0F, (current_column
+ (current_line
* total_columns
)) & 0x0ff);
99 static const struct console_driver vga_console __console
={
101 .tx_byte
= vga_tx_byte
,