From 070ed16c7193ea02856957f9e5bef62268ad0037 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 14 Sep 2019 18:46:32 +0200 Subject: Added linebreak support --- src/kernel.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') 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 -- cgit v1.2.3