summaryrefslogtreecommitdiff
path: root/src/kernel/vga.c
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2020-09-19 14:53:29 -0400
committerBenji Dial <benji6283@gmail.com>2020-09-19 14:53:29 -0400
commitde20d7430df08731d9108acb83e1234ba7f1fe16 (patch)
tree8646f3d1bae3d30391df34766e3e58c0c2af8aab /src/kernel/vga.c
parent20853582d5385d12421433d21910e783caa00764 (diff)
downloadportland-os-de20d7430df08731d9108acb83e1234ba7f1fe16.tar.gz
file manager
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