summaryrefslogtreecommitdiff
path: root/src/kernel/vga.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/vga.c')
-rw-r--r--src/kernel/vga.c11
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