diff --git a/include/keyboard.h b/include/keyboard.h index b698a10..6421ede 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -51,6 +51,7 @@ char buffer[MAX_BUFFER_SIZE + 1] = { 0 }; bool echo = false; bool canBackspace = false; +// TODO: Refactor this void keyboardHandler() { uint8_t scancode; scancode = inb(0x60); @@ -75,6 +76,8 @@ void keyboardHandler() { } } +// TODO: Add a 'char readc();' function that returns a single read character and use it for read() +// Also this should be refactored to not use so many flag variables char* read(char terminator) { bufferLen = 0; echo = true; diff --git a/include/screen.h b/include/screen.h index d4d3dde..dc9772a 100644 --- a/include/screen.h +++ b/include/screen.h @@ -6,8 +6,8 @@ #define MODE_INFO_BLOCK 0x5000 #define WIDTH 1920 #define HEIGHT 1080 -#define BG_COLOR 0xff1f2937 -#define FG_COLOR 0xffd1d5db +#define BG_COLOR 0xff010b17 +#define FG_COLOR 0xffebddf4 struct cursor_s { uint32_t x; @@ -39,13 +39,22 @@ void putcAt(char c, uint32_t x, uint32_t y) { } } -void putc(char c) { - putcAt(c, cursor.x, cursor.y); +void printAt(const char* str, uint32_t x, uint32_t y) { + while (*str != '\0') { + putcAt(*str++, x, y); + x++; + } +} +void putc(char c) { if (c == '\n') { cursor.y++; cursor.x = 0; + } else if (c == '\b') { + cursor.x--; + putcAt(' ', cursor.x, cursor.y); } else { + putcAt(c, cursor.x, cursor.y); cursor.x++; } } diff --git a/todo.txt b/todo.txt index 5d2523f..72b1adc 100644 --- a/todo.txt +++ b/todo.txt @@ -1,7 +1,7 @@ === Todo === - [*] Multistage Bootloader -- [ ] Write down where stuff is in memory (0x1000 - kernel, 0x2000 - filetable, 0x5000 - VBE Mode Info, 0x6000 - Font) +- [ ] Write down where stuff is in memory (0x1000 - kernel, 0x4000? - filetable, 0x5000 - VBE Mode Info, 0x6000 - Font) - [ ] Screen - [ ] Scrolling - [ ] Scroll-back