|
|
@ -9,6 +9,9 @@ static int line, col; |
|
|
|
|
|
|
|
static volatile short *vga = (short *)VGA_ADDR; |
|
|
|
static void clearScreen(uint bgColor); |
|
|
|
static void cursorMove(int x, int y); |
|
|
|
static void cursorEnable(uint8_t cursor_start, uint8_t cursor_end); |
|
|
|
static void printCharDetails(char str, uint color, uint bgColor, int startX, int startY); |
|
|
|
|
|
|
|
int VGASetup(uint bgColor, uint color) |
|
|
|
{ |
|
|
@ -17,6 +20,7 @@ int VGASetup(uint bgColor, uint color) |
|
|
|
line = 0; |
|
|
|
col = 0; |
|
|
|
clearScreen(bgColor); |
|
|
|
cursorEnable(14, 15); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
@ -32,7 +36,7 @@ static void clearScreen(uint bgColor) |
|
|
|
restore_IRQs(flags); |
|
|
|
} |
|
|
|
|
|
|
|
void clearScreenLine(uint bgColor, uint line) |
|
|
|
void VGAclearLine(uint bgColor, uint line) |
|
|
|
{ |
|
|
|
uint32_t flags; |
|
|
|
long int colorAttr = bgColor << 12; |
|
|
@ -47,7 +51,7 @@ void clearScreenLine(uint bgColor, uint line) |
|
|
|
restore_IRQs(flags); |
|
|
|
} |
|
|
|
|
|
|
|
void VGAprintf(uint color, uint bgColor, int startX, int startY, const char *format, ...) |
|
|
|
void VGAPrintf(uint color, uint bgColor, int startX, int startY, const char *format, ...) |
|
|
|
{ |
|
|
|
int flags; |
|
|
|
char tmp[VGA_WIDTH]; |
|
|
@ -68,13 +72,13 @@ void VGAprintf(uint color, uint bgColor, int startX, int startY, const char *for |
|
|
|
restore_IRQs(flags); |
|
|
|
} |
|
|
|
|
|
|
|
void printCharDetails(const char str, uint color, uint bgColor, int startX, int startY) |
|
|
|
static void printCharDetails(const char str, uint color, uint bgColor, int startX, int startY) |
|
|
|
{ |
|
|
|
long int colorAttr = (bgColor << 4 | (color & 0x0f)) << 8; |
|
|
|
vga[VGA_WIDTH * startY + startX] = colorAttr | str; |
|
|
|
} |
|
|
|
|
|
|
|
void vgaScrollUp(void) |
|
|
|
void VGAScrollUp(void) |
|
|
|
{ |
|
|
|
long int colorAttr = vgaBgColor << 12; |
|
|
|
int flags; |
|
|
@ -90,7 +94,7 @@ void vgaScrollUp(void) |
|
|
|
restore_IRQs(flags); |
|
|
|
} |
|
|
|
|
|
|
|
void VGAputc(const char str) |
|
|
|
void VGAPutc(const char str) |
|
|
|
{ |
|
|
|
int flags; |
|
|
|
|
|
|
@ -99,7 +103,7 @@ void VGAputc(const char str) |
|
|
|
line++; |
|
|
|
col = 0; |
|
|
|
if (line >= VGA_HEIGHT - 1) { |
|
|
|
vgaScrollUp(); |
|
|
|
VGAScrollUp(); |
|
|
|
line--; |
|
|
|
} |
|
|
|
} else if (str == '\r') { |
|
|
@ -118,7 +122,7 @@ void VGAputc(const char str) |
|
|
|
line++; |
|
|
|
} |
|
|
|
if (line >= VGA_HEIGHT - 1) { |
|
|
|
vgaScrollUp(); |
|
|
|
VGAScrollUp(); |
|
|
|
line--; |
|
|
|
} |
|
|
|
} |
|
|
@ -127,7 +131,7 @@ void VGAputc(const char str) |
|
|
|
restore_IRQs(flags); |
|
|
|
} |
|
|
|
|
|
|
|
void cursorEnable(uint8_t cursor_start, uint8_t cursor_end) |
|
|
|
static void cursorEnable(uint8_t cursor_start, uint8_t cursor_end) |
|
|
|
{ |
|
|
|
outb(0x3D4, 0x0A); |
|
|
|
outb(0x3D5, (inb(0x3D5) & 0xC0) | cursor_start); |
|
|
@ -142,7 +146,7 @@ void cursorDisable(void) |
|
|
|
outb(0x3D5, 0x20); |
|
|
|
} |
|
|
|
|
|
|
|
void cursorMove(int x, int y) |
|
|
|
static void cursorMove(int x, int y) |
|
|
|
{ |
|
|
|
long int colorAttr = (vgaBgColor << 4 | (vgaColor & 0x0f)) << 8; |
|
|
|
uint16_t pos = y * VGA_WIDTH + x; |
|
|
|