diff options
author | Benji Dial <benji6283@gmail.com> | 2020-09-06 00:48:07 -0400 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2020-09-06 00:48:07 -0400 |
commit | e8c6577617bffa4402c07c7aa20e3c24f03c1c20 (patch) | |
tree | 2fb9230b62d2344a44453117de9e656892219788 /src/kernel/vga.c | |
parent | 7ff724fe8f709440da9c730fdb8dcbaa4f989ed5 (diff) | |
download | portland-os-e8c6577617bffa4402c07c7aa20e3c24f03c1c20.tar.gz |
program loading, others
big kernel additions: paging, elf loading, separate kernel and user page allocation
it now properly loads and runs sd0:bin/init.elf
still need to determine which disk was booted from, and start the init on that disk
Diffstat (limited to 'src/kernel/vga.c')
-rw-r--r-- | src/kernel/vga.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/kernel/vga.c b/src/kernel/vga.c index 7506416..c03e5f0 100644 --- a/src/kernel/vga.c +++ b/src/kernel/vga.c @@ -2,9 +2,8 @@ #include <stdint.h> #define VGA_COLUMNS 80 -#define VGA_LINES 25 #define VGA_START (uint16_t *)0x000b8000 -#define VGA_END (VGA_START + VGA_COLUMNS * VGA_LINES) +#define VGA_END (VGA_START + VGA_COLUMNS * 25) static uint16_t *cursor = VGA_START; static uint16_t mask; @@ -12,12 +11,12 @@ void vga_set_color(uint8_t new_color) { mask = new_color << 8; } -void vga_scroll() { +static void vga_scroll() { for (uint32_t *i = (uint32_t *)VGA_START; i < (uint32_t *)(VGA_END - VGA_COLUMNS); ++i) *i = *(i + VGA_COLUMNS / 2); uint32_t f = (mask | (uint8_t)' ') * 0x00010001; for (uint32_t *i = (uint32_t *)(VGA_END - VGA_COLUMNS); i < (uint32_t *)VGA_END; ++i) - *i++ = f; + *i = f; cursor -= VGA_COLUMNS; } @@ -30,12 +29,10 @@ void vga_blank() { } void vga_printch(char ch) { - if (ch == '\n') { - if ((cursor = cursor - (cursor - VGA_START) % VGA_COLUMNS + VGA_COLUMNS) == VGA_END) - vga_scroll(); - return; - } - *cursor++ = mask | (uint8_t)ch; + if (ch == '\n') + cursor = ((cursor - VGA_START) / VGA_COLUMNS + 1) * VGA_COLUMNS + VGA_START; + else + *cursor++ = mask | (uint8_t)ch; if (cursor == VGA_END) vga_scroll(); }
\ No newline at end of file |