pull/19/head
E. Almqvist 3 years ago
parent 43e8caefdf
commit f769e62887
  1. 10
      src/lib/vga.c

@ -7,12 +7,16 @@
static char* cursor_pos = VIDEO_MEM; static char* cursor_pos = VIDEO_MEM;
static int cursor_y = 0; 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) { void print(char* str, unsigned int str_len) {
for( int i = 0; i < str_len; i++ ) { for( unsigned int i = 0; i < str_len; i++ ) {
set_cursor_pos(i, cursor_y); // set cursor pos set_cursor_pos(i, cursor_y); // set cursor pos
*cursor_pos = str[i]; // Write char to video memory *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) cursor_y++; // Increment to next y-pos (newline)
} }

Loading…
Cancel
Save