[vga_font] Font rendering updates.

This commit is contained in:
Kevin Lange 2011-03-28 16:29:59 -05:00
parent 16050f2da8
commit 5450546a15
5 changed files with 35 additions and 15 deletions

View File

@ -30,7 +30,7 @@ install: toaruos-initrd toaruos-kernel
@${ECHO} "\r\033[34;1m -- Kernel and ramdisk installed.\033[0m"
run: toaruos-kernel toaruos-initrd
${EMU} -kernel toaruos-kernel -initrd toaruos-initrd -append vid=qemu -serial stdio -vga std -s
${EMU} -kernel toaruos-kernel -initrd toaruos-initrd -append vid=qemu -serial stdio -vga std
#################
# Documentation #

View File

@ -1,5 +1,7 @@
/* This is the default VGA 8 x 12 font */
char number_font[][12] = {
#include <system.h>
uint8_t number_font[][12] = {
{ 0b00000000,
0b00000000,
0b00000000,
@ -832,6 +834,19 @@ char number_font[][12] = {
0b11111111,
0b00000000 /* 12 */
},
{ 0b00110000,
0b00110000,
0b00011000,
0b00000000, /* 4 */
0b00000000,
0b00000000,
0b00000000,
0b00000000, /* 8 */
0b00000000,
0b00000000,
0b00000000,
0b00000000 /* 12 */
},
{ 0b00000000,
0b00000000,
0b00000000,
@ -1018,9 +1033,9 @@ char number_font[][12] = {
0b00000000,
0b00000000,
0b00000000, /* 4 */
0b00000000,
0b01111000,
0b11001100,
0b11001100,
0b11001100, /* 8 */
0b11001100,
0b01111000,

View File

@ -152,14 +152,14 @@ bochs_fill_rect(
}
void
bochs_write_number(
bochs_write_char(
uint8_t val,
uint16_t x,
uint16_t y,
uint32_t fg,
uint32_t bg
) {
char * c = number_font[val + 0x10];
char * c = number_font[val - 0x20];
for (uint8_t i = 0; i < 12; ++i) {
bochs_set_bank((y+i) * bochs_resolution_x / BOCHS_BANK_SIZE);
if (c[i] & 0x80) { bochs_set_point(x,y+i,fg); } else { bochs_set_point(x,y+i,bg); }

View File

@ -194,11 +194,11 @@ extern void bochs_set_coord(uint16_t x, uint16_t y, uint32_t color);
extern void bochs_fill_rect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint32_t color);
extern void bochs_draw_logo(char *);
extern void bochs_scroll();
extern void bochs_write_number(uint8_t val, uint16_t x, uint16_t y, uint32_t fg, uint32_t bg);
extern void bochs_write_char(uint8_t val, uint16_t x, uint16_t y, uint32_t fg, uint32_t bg);
extern uint16_t bochs_resolution_x;
extern uint16_t bochs_resolution_y;
extern uint16_t bochs_resolution_b;
extern char number_font[][12];
extern uint8_t number_font[][12];
#endif

View File

@ -140,6 +140,11 @@ int main(struct multiboot *mboot_ptr, uint32_t mboot_mag, uintptr_t esp)
*/
cls();
char * welcome = "Welcome to ToAruOS!";
for (uint16_t i = 0; i < strlen(welcome); ++i) {
bochs_write_char(welcome[i], i * 8, 0, 0x00FFFFFF, 0x0);
}
/*
* Aw man...
*/
@ -154,14 +159,14 @@ int main(struct multiboot *mboot_ptr, uint32_t mboot_mag, uintptr_t esp)
/* It would help a lot if I had %.2d */
/* kprintf("[%.2d:%.2d:%.2d]", hours, minutes, seconds); */
if (bochs_resolution_x) {
bochs_write_number(hours / 10, bochs_resolution_x - 8 * 8, 0, 0x00FFFFFF, 0x0);
bochs_write_number(hours % 10, bochs_resolution_x - 8 * 7, 0, 0x00FFFFFF, 0x0);
bochs_write_number( 10, bochs_resolution_x - 8 * 6, 0, 0x00FFFFFF, 0x0);
bochs_write_number(minutes / 10, bochs_resolution_x - 8 * 5, 0, 0x00FFFFFF, 0x0);
bochs_write_number(minutes % 10, bochs_resolution_x - 8 * 4, 0, 0x00FFFFFF, 0x0);
bochs_write_number( 10, bochs_resolution_x - 8 * 3, 0, 0x00FFFFFF, 0x0);
bochs_write_number(seconds / 10, bochs_resolution_x - 8 * 2, 0, 0x00FFFFFF, 0x0);
bochs_write_number(seconds % 10, bochs_resolution_x - 8 * 1, 0, 0x00FFFFFF, 0x0);
bochs_write_char('0' + hours / 10, bochs_resolution_x - 8 * 8 - 1, 0, 0x00FFFFFF, 0x0);
bochs_write_char('0' + hours % 10, bochs_resolution_x - 8 * 7 - 1, 0, 0x00FFFFFF, 0x0);
bochs_write_char(':', bochs_resolution_x - 8 * 6 - 1, 0, 0x00FFFFFF, 0x0);
bochs_write_char('0' + minutes / 10, bochs_resolution_x - 8 * 5 - 1, 0, 0x00FFFFFF, 0x0);
bochs_write_char('0' + minutes % 10, bochs_resolution_x - 8 * 4 - 1, 0, 0x00FFFFFF, 0x0);
bochs_write_char(':', bochs_resolution_x - 8 * 3 - 1, 0, 0x00FFFFFF, 0x0);
bochs_write_char('0' + seconds / 10, bochs_resolution_x - 8 * 2 - 1, 0, 0x00FFFFFF, 0x0);
bochs_write_char('0' + seconds % 10, bochs_resolution_x - 8 * 1 - 1, 0, 0x00FFFFFF, 0x0);
} else {
store_csr();
set_serial(0);