diff options
author | Marvin Borner | 2019-09-14 18:46:32 +0200 |
---|---|---|
committer | Marvin Borner | 2019-09-14 18:46:32 +0200 |
commit | 070ed16c7193ea02856957f9e5bef62268ad0037 (patch) | |
tree | d46e18ad0fc1672560938435fca2ee44e6673e8a /src | |
parent | 49c3fc3f628523861919f1415dfc5e8ed4f01b29 (diff) |
Added linebreak support
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/kernel.c b/src/kernel.c index 9cf1b43..947d6b9 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -68,11 +68,16 @@ void terminal_put_entry_at(char c, uint8_t color, size_t x, size_t y) { } void terminal_put_char(char c) { - terminal_put_entry_at(c, terminal_color, terminal_column, terminal_row); - if (++terminal_column == VGA_WIDTH) { + if (c == '\n' || c == '\r') { + terminal_row += 1; terminal_column = 0; - if (++terminal_row == VGA_HEIGHT) - terminal_row = 0; + } else { + terminal_put_entry_at(c, terminal_color, terminal_column, terminal_row); + if (++terminal_column == VGA_WIDTH) { + terminal_column = 0; + if (++terminal_row == VGA_HEIGHT) + terminal_row = 0; + } } } @@ -87,5 +92,5 @@ void terminal_write_string(const char *data) { void kernel_main(void) { terminal_initialize(); - terminal_write_string("Melvix loaded successfully!"); + terminal_write_string("Melvix loaded successfully!\nTest"); }
\ No newline at end of file |