diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index 398e90c..e5db7da 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -6,5 +6,6 @@ void main() { *vidmem = 'X'; clear_screen(); - println("eOS Version 0.0 2021", 0x0f); + set_cursor_pos(0, 5); + println("\t eOS Version 0.0 2021", 0xf0); } diff --git a/src/kernel/lib/vga.c b/src/kernel/lib/vga.c index 4ba02d1..7de8f48 100644 --- a/src/kernel/lib/vga.c +++ b/src/kernel/lib/vga.c @@ -12,7 +12,8 @@ #define VIDEO_MEM_MAX (char*)0xb8fa0 // Global -static int cursor_row = 0; +static unsigned int cursor_row = 0; +static unsigned int cursor_col = 0; /* VGA & Memory Functions @@ -23,8 +24,8 @@ char* get_vga_charpos_pointer(unsigned int col, unsigned int row) { void putc(char c, unsigned int col, unsigned int row, int colorcode) { char* mem = get_vga_charpos_pointer(col, row); - *mem = c; - *(mem+1) = colorcode; + *mem = c; // Write the character + *(mem+1) = colorcode; // Write the colorcode } @@ -32,18 +33,22 @@ void putc(char c, unsigned int col, unsigned int row, int colorcode) { Graphics Functions */ void clear_screen() { - for( char* c = VIDEO_MEM; c <= VIDEO_MEM_MAX; c += 2 ) { + // Make all the characters spaces + for( char* c = VIDEO_MEM; c <= VIDEO_MEM_MAX; c += 2 ) *c = 0x20; - } } /* General Printing Functions */ +void set_cursor_pos(unsigned int x, unsigned int y) { + cursor_col, cursor_row = x, y; +} + void print(char* str, int colorcode) { for( char* c = str; *c != '\0'; c++ ) - putc(*c, (int)(c - str), cursor_row, colorcode); + putc(*c, (unsigned int)(c - str + cursor_col), cursor_row, colorcode); } void println(char* str, int colorcode) {