diff options
author | Benji Dial <benji6283@gmail.com> | 2020-09-19 14:53:29 -0400 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2020-09-19 14:53:29 -0400 |
commit | de20d7430df08731d9108acb83e1234ba7f1fe16 (patch) | |
tree | 8646f3d1bae3d30391df34766e3e58c0c2af8aab /src/kernel/vga.c | |
parent | 20853582d5385d12421433d21910e783caa00764 (diff) | |
download | portland-os-de20d7430df08731d9108acb83e1234ba7f1fe16.tar.gz |
file manager
Diffstat (limited to 'src/kernel/vga.c')
-rw-r--r-- | src/kernel/vga.c | 11 |
1 files changed, 9 insertions, 2 deletions
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 <stdint.h> #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 |