diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2017-06-24 18:42:30 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2017-06-24 18:42:30 +0200 |
commit | 583fa983a9c2f54a5ab27bf73ebee5e6eb5164e6 (patch) | |
tree | c9287386b61cf264c1bf98622cb5f72f97c3633c | |
parent | e6a749b7c0bec98df1f6d64371b2847ad71c2f10 (diff) | |
download | abaos-583fa983a9c2f54a5ab27bf73ebee5e6eb5164e6.tar.gz abaos-583fa983a9c2f54a5ab27bf73ebee5e6eb5164e6.tar.bz2 |
printing whole ASCII font in VGA graphics mode
-rw-r--r-- | src/drivers/video/vga.c | 2 | ||||
-rw-r--r-- | src/drivers/video/vga_font.c | 21 | ||||
-rw-r--r-- | src/gui/desktop.c | 4 | ||||
-rw-r--r-- | src/kernel/kernel.c | 35 |
4 files changed, 15 insertions, 47 deletions
diff --git a/src/drivers/video/vga.c b/src/drivers/video/vga.c index b245aad..b0b61f7 100644 --- a/src/drivers/video/vga.c +++ b/src/drivers/video/vga.c @@ -361,7 +361,7 @@ void vga_draw_char( vga_t *vga, const unsigned char c, const int x, const int y, int mask[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; // for now, the 34 entry, character height is 16, assuming A-Z - const unsigned char *bmap = &vga_font.Bitmap[(34+c-65)*16]; + const unsigned char *bmap = &vga_font.Bitmap[(c-32)*16]; for( int xx = 0; xx < vga_font.Width; xx++ ) { for( int yy = 0; yy < vga_font.Height; yy++ ) { diff --git a/src/drivers/video/vga_font.c b/src/drivers/video/vga_font.c index 0800dff..36c2f6f 100644 --- a/src/drivers/video/vga_font.c +++ b/src/drivers/video/vga_font.c @@ -5,24 +5,6 @@ /// character bitmap for each encoding static const unsigned char __font_bitmap__[] = { -// 0 $00 'char0' -// width 8, bbx 0, bby -4, bbw 8, bbh 16 - ________, - ________, - XX_XX_X_, - ______X_, - X_______, - X_____X_, - ______X_, - X_______, - X_____X_, - ______X_, - X_______, - X_XX_XX_, - ________, - ________, - ________, - ________, // 32 $20 'space' // width 8, bbx 0, bby -4, bbw 8, bbh 16 ________, @@ -1855,7 +1837,6 @@ static const unsigned char __font_widths__[] = { /// character encoding for each index entry static const unsigned short __font_index__[] = { - 0, 32, 33, 34, @@ -1957,7 +1938,7 @@ static const unsigned short __font_index__[] = { /// bitmap font structure const struct bitmap_font vga_font = { .Width = 8, .Height = 16, - .Chars = 97, + .Chars = 96, .Widths = __font_widths__, .Index = __font_index__, .Bitmap = __font_bitmap__, diff --git a/src/gui/desktop.c b/src/gui/desktop.c index 506bf4d..ee4a6e5 100644 --- a/src/gui/desktop.c +++ b/src/gui/desktop.c @@ -37,10 +37,6 @@ void desktop_draw( void *obj, graphics_context_t *context ) ((widget_vtable_t *)(desktop->base.vtable))->draw( obj, context ); - vga_draw_char( context, 'D', desktop->base.base.x, - desktop->base.base.y, desktop->base.base.background_color, - VGA_COLOR_WHITE ); - // TODO: use a mouse bitmap and copy it /* for( int i = 0; i < 4; i++ ) { diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index cd9a94b..0b1f8c7 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -200,36 +200,27 @@ static void handle_keyboard_event( keyboard_event_t *event, void *context ) desktop_init( &desktop, 320, 200, VGA_COLOR_BLUE ); widget_t widget1; - widget_init( &widget1, (widget_t *)&desktop, 50, 50, 60, 70, VGA_COLOR_LIGHT_GREY ); + widget_init( &widget1, (widget_t *)&desktop, 60, 60, 60, 70, VGA_COLOR_LIGHT_GREY ); ((composite_widget_vtable_t *)desktop.vtable)->add_child( &desktop, &widget1 ); widget_t widget2; widget_init( &widget2, (widget_t *)&desktop, 120, 120, 60, 70, VGA_COLOR_GREEN ); ((composite_widget_vtable_t *)desktop.vtable)->add_child( &desktop, &widget2 ); + // as vga_t is equals to the graphical context for now ((widget_vtable_t *)desktop.vtable)->draw( &desktop, &global_context->vga ); -#if 0 - vga_clear_screen( vga, VGA_COLOR_BLUE ); - vga_draw_char( vga, 'A', 10, 10, VGA_COLOR_BLUE, - VGA_COLOR_WHITE ); - vga_draw_char( vga, 'B', 20, 10, VGA_COLOR_BLUE, - VGA_COLOR_WHITE ); - vga_draw_char( vga, 'C', 30, 10, VGA_COLOR_BLUE, - VGA_COLOR_WHITE ); - vga_draw_char( vga, 'D', 40, 10, VGA_COLOR_BLUE, - VGA_COLOR_WHITE ); - vga_draw_char( vga, 'E', 50, 10, VGA_COLOR_BLUE, - VGA_COLOR_WHITE ); - vga_draw_char( vga, 'F', 60, 10, VGA_COLOR_BLUE, - VGA_COLOR_WHITE ); - vga_draw_char( vga, 'G', 70, 10, VGA_COLOR_BLUE, - VGA_COLOR_WHITE ); - widget_t widget; - widget_init( &widget, NULL, 50, 50, 60, 70 ); - // as vga_t is equals to the graphical context for now - widget.vtable->draw( &widget, &global_context->vga ); -#endif + int x = 0; + int y = 10; + for( char c = '!'; c <= '~'; c++ ) { + vga_draw_char( vga, c, x, y, VGA_COLOR_BLUE, + VGA_COLOR_WHITE ); + x += 9; + if( x >= vga->mode.x - 9 ) { + y += 16; + x = 0; + } + } } global_context->mode = MODE_GRAPHICS; break; |