From f769e62887f91f35b4768c9d17a33f470bbf74ec Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Wed, 11 Aug 2021 19:40:00 +0200 Subject: [PATCH] Refactor --- src/lib/vga.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/vga.c b/src/lib/vga.c index 61e6275..33de16a 100644 --- a/src/lib/vga.c +++ b/src/lib/vga.c @@ -7,12 +7,16 @@ static char* cursor_pos = VIDEO_MEM; static int cursor_y = 0; -void set_cursor_pos(int row, int col) { cursor_pos = (char*)(VIDEO_MEM + 2*(row*80 + col)); } +void set_cursor_pos(unsigned int row, unsigned int col) { cursor_pos = (char*)(VIDEO_MEM + 2*(row*80 + col)); } -void println(char* str, int str_len) { - for( int i = 0; i < str_len; i++ ) { +void print(char* str, unsigned int str_len) { + for( unsigned int i = 0; i < str_len; i++ ) { set_cursor_pos(i, cursor_y); // set cursor pos *cursor_pos = str[i]; // Write char to video memory } +} + +void println(char* str, unsigned int str_len) { + print(str, str_len); cursor_y++; // Increment to next y-pos (newline) }