From de20d7430df08731d9108acb83e1234ba7f1fe16 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 19 Sep 2020 14:53:29 -0400 Subject: file manager --- src/kernel/vga.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/kernel/vga.c') diff --git a/src/kernel/vga.c b/src/kernel/vga.c index daa92fe..42da312 100644 --- a/src/kernel/vga.c +++ b/src/kernel/vga.c @@ -2,8 +2,9 @@ #include #define VGA_COLUMNS 80 +#define VGA_ROWS 25 #define VGA_START (uint16_t *)0x000b8000 -#define VGA_END (VGA_START + VGA_COLUMNS * 25) +#define VGA_END (VGA_START + VGA_COLUMNS * VGA_ROWS) static uint16_t *cursor = VGA_START; static uint16_t mask; @@ -25,7 +26,7 @@ void vga_blank() { uint32_t *p = (uint32_t *)VGA_START; while (p < (uint32_t *)VGA_END) *p++ = f; - cursor = VGA_START; + cursor = VGA_END - VGA_COLUMNS; } void vga_printch(char ch) { @@ -37,4 +38,10 @@ void vga_printch(char ch) { *cursor++ = mask | (uint8_t)ch; if (cursor == VGA_END) vga_scroll(); +} + +void vga_print_at(uint16_t pos, const char *sz) { + cursor = VGA_START + (pos >> 8) * VGA_COLUMNS + (pos & 0xff); + while (*sz) + vga_printch(*sz++); } \ No newline at end of file -- cgit v1.2.3