From b1506d95ed7b3f3078ebfec996b31d19cc2f9b88 Mon Sep 17 00:00:00 2001 From: pjht Date: Sat, 9 Feb 2019 14:35:45 -0600 Subject: [PATCH] VGA driver now clears on initialization --- drivers/i386/vga.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/i386/vga.c b/drivers/i386/vga.c index 9f729a1..b31cd7e 100644 --- a/drivers/i386/vga.c +++ b/drivers/i386/vga.c @@ -1,13 +1,28 @@ #include #include "../vga.h" +#define xy_to_mem(x,y) ((x+(y*height))*2) char* screen; int width; int height; vga_colors fg_color=VGA_WHITE; vga_colors bg_color=VGA_BLACK; +void vga_set_char(int x,int y,char c) { + screen[xy_to_mem(x,y)]=c; + screen[xy_to_mem(x,y)+1]=(bg_color<<4)|fg_color; +} + void vga_init(text_fb_info framebuffer_info) { screen=framebuffer_info.address; width=framebuffer_info.width; height=framebuffer_info.height; + vga_clear(); +} + +void vga_clear() { + for (int y=0;y