Fixing vga_write_line_color newline colour

This commit is contained in:
Jarkko Toivanen 2023-06-14 05:21:38 +03:00
parent 663a6317c4
commit 7d576d3cd5
Signed by: jt
GPG key ID: 9151B109B73ECAD5

4
vga.c
View file

@ -8,6 +8,7 @@
unsigned int cursor_loc = CURSOR_HOME; unsigned int cursor_loc = CURSOR_HOME;
unsigned char fgcolor; unsigned char fgcolor;
unsigned char bgcolor; unsigned char bgcolor;
unsigned short blank;
static unsigned char vga_entry_color(enum vga_color fg, enum vga_color bg) { static unsigned char vga_entry_color(enum vga_color fg, enum vga_color bg) {
return fg | bg << 4; return fg | bg << 4;
@ -26,17 +27,16 @@ void vga_set_color(enum vga_color fg, enum vga_color bg) {
} }
void vga_init(enum vga_color fg, enum vga_color bg) { void vga_init(enum vga_color fg, enum vga_color bg) {
vga_set_color(fg, bg); vga_set_color(fg, bg);
blank = vga_blank_entry();
cls(); cls();
} }
void cls(void) { void cls(void) {
unsigned short blank = vga_blank_entry();
int i; int i;
for (i=0; i<VGA_HEIGHT*VGA_WIDTH;i++) { for (i=0; i<VGA_HEIGHT*VGA_WIDTH;i++) {
*((unsigned short *) VGA_MEM_ADDR+i) = blank; *((unsigned short *) VGA_MEM_ADDR+i) = blank;
} }
} }
void scroll(void) { void scroll(void) {
unsigned short blank = vga_blank_entry();
int y; int y;
int x; int x;
*((unsigned short *) VGA_MEM_ADDR+cursor_loc) = blank; *((unsigned short *) VGA_MEM_ADDR+cursor_loc) = blank;