|
|
@ -12,7 +12,8 @@ |
|
|
|
#define VIDEO_MEM_MAX (char*)0xb8fa0 |
|
|
|
#define VIDEO_MEM_MAX (char*)0xb8fa0 |
|
|
|
|
|
|
|
|
|
|
|
// Global
|
|
|
|
// Global
|
|
|
|
static int cursor_row = 0; |
|
|
|
static unsigned int cursor_row = 0; |
|
|
|
|
|
|
|
static unsigned int cursor_col = 0; |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
VGA & Memory Functions |
|
|
|
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) { |
|
|
|
void putc(char c, unsigned int col, unsigned int row, int colorcode) { |
|
|
|
char* mem = get_vga_charpos_pointer(col, row); |
|
|
|
char* mem = get_vga_charpos_pointer(col, row); |
|
|
|
*mem = c; |
|
|
|
*mem = c; // Write the character
|
|
|
|
*(mem+1) = colorcode; |
|
|
|
*(mem+1) = colorcode; // Write the colorcode
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -32,18 +33,22 @@ void putc(char c, unsigned int col, unsigned int row, int colorcode) { |
|
|
|
Graphics Functions |
|
|
|
Graphics Functions |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void clear_screen() { |
|
|
|
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; |
|
|
|
*c = 0x20; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
General Printing Functions |
|
|
|
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) { |
|
|
|
void print(char* str, int colorcode) { |
|
|
|
for( char* c = str; *c != '\0'; c++ )
|
|
|
|
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) { |
|
|
|
void println(char* str, int colorcode) { |
|
|
|