Implemented a simple draw_rect function into the video driver.

This commit is contained in:
2020-05-22 16:30:00 -05:00
parent a1b1b90793
commit 7613ba9de2
3 changed files with 24 additions and 1 deletions
+14
View File
@@ -45,6 +45,20 @@ void print_banner(){
}
}
}
//index = (y_value * width_of_screen) + x_value;
void draw_rect(int start_x, int start_y, int end_x, int end_y, unsigned char fg, unsigned char bg){
unsigned char y = end_y - start_y;
unsigned char x = end_x - start_x;
int attr = ((bg << 4) | (fg & 0x0F));
unsigned short *buffer = (unsigned short*) 0x000B8000 + (start_y * 80) + start_x;
for(unsigned char i = 0; i < y; i++){
for(unsigned char j = 0; j < x; j++){
unsigned short *where = (unsigned short*) buffer + (i * 80) + j;
*where = 0x23 | (attr << 8);
}
}
}
void draw_s(char* string, unsigned char fg, unsigned char bg)
{