Fixed backspace in new printing

This commit is contained in:
2024-04-19 13:56:15 +02:00
parent 12c0fafa1f
commit 889f283fcd
3 changed files with 17 additions and 5 deletions
+3
View File
@@ -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;
+13 -4
View File
@@ -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++;
}
}
+1 -1
View File
@@ -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