From a02e8abd81a60f123ccdc7ded655c16711094122 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Tue, 25 Nov 2008 03:36:18 -0500 Subject: [PATCH] Clean up vga_overlay a bit to split out the VGA-specific code to strblit --- aseg-paging/smi.c | 2 +- aseg-paging/vga-overlay.c | 28 +++++++++++----------------- include/vga-overlay.h | 2 +- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/aseg-paging/smi.c b/aseg-paging/smi.c index bd29f64..1152723 100644 --- a/aseg-paging/smi.c +++ b/aseg-paging/smi.c @@ -22,7 +22,7 @@ void smi_entry(void) counter++; sprintf(statstr, "NetWatch! %08x %08x", smi_status(), counter); - strblit(statstr, 0, 0); + strblit(statstr, 0, 0, 0); serial_init(); eth_poll(); diff --git a/aseg-paging/vga-overlay.c b/aseg-paging/vga-overlay.c index 2fe4dc6..e6e223c 100644 --- a/aseg-paging/vga-overlay.c +++ b/aseg-paging/vga-overlay.c @@ -40,7 +40,7 @@ static char * vga_base() ); } -void strblit(char *src, int row, int col) +void strblit(char *src, int row, int col, int fill) { char *destp = vga_base() + row * 80 * 2 + col * 2; outb(0x80, 0x3C); @@ -54,7 +54,15 @@ void strblit(char *src, int row, int col) { *(destp++) = *(src++); *(destp++) = COLOR; + col++; } + if (fill) + while (col < 80) + { + *(destp++) = ' '; + *(destp++) = COLOR; + col++; + } outb(0x80, 0x3F); smram_restore_state(old_state); @@ -63,24 +71,10 @@ void strblit(char *src, int row, int col) void outlog() { - int y, x; - char *basep = vga_base(); - - smram_state_t old_state = smram_save_state(); - - smram_aseg_set_state(SMRAM_ASEG_SMMCODE); + int y; - for (y = 0; y < LOG_ONSCREEN; y++) - for (x = 40; x < 80; x++) - { - basep[y*80*2+x*2] = ' '; - basep[y*80*2+x*2+1] = 0x1F; - } - - smram_restore_state(old_state); - for (y = -LOG_ONSCREEN; y < 0; y++) - strblit(logents[(y + prodptr) % LOGLEN], y + LOG_ONSCREEN, 40); + strblit(logents[(y + prodptr) % LOGLEN], y + LOG_ONSCREEN, 40, 1); } void dolog(const char *s) diff --git a/include/vga-overlay.h b/include/vga-overlay.h index ec9efd5..d493f67 100644 --- a/include/vga-overlay.h +++ b/include/vga-overlay.h @@ -3,7 +3,7 @@ void vga_flush_imm(int enb); -void strblit(char *src, int row, int col); +void strblit(char *src, int row, int col, int fill); void dolog(char *s); void dologf(char *s, ...); -- 2.39.2