X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/8e6328ba94e7dadaef31a6186ba6d4437e1f06b3..4a4bc0fa423f2c3ffc37adb7f8c7c221d1a9ac82:/aseg-paging/vga-overlay.c?ds=sidebyside diff --git a/aseg-paging/vga-overlay.c b/aseg-paging/vga-overlay.c index 4d19c3b..f7d7bf4 100644 --- a/aseg-paging/vga-overlay.c +++ b/aseg-paging/vga-overlay.c @@ -4,6 +4,7 @@ #include #include #include +#include #define LOGLEN 96 #define LOG_ONSCREEN 4 @@ -39,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); @@ -53,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); @@ -62,30 +71,20 @@ 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); - - 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; - } + int y; - 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) % LOGLEN], y + LOG_ONSCREEN, 40, 1); } void dolog(const char *s) { strcpy(logents[prodptr], s); prodptr = (prodptr + 1) % LOGLEN; + while (*s) + serial_tx(*(s++)); + serial_tx('\r'); + serial_tx('\n'); if (flush_imm) outlog(); } @@ -93,10 +92,23 @@ void (*output)(const char *s) = dolog; void dologf(const char *fmt, ...) { + char *s; + va_list va; + + va_start(va, fmt); + vsnprintf(logents[prodptr], 40, fmt, va); + s = logents[prodptr]; + while (*s) + serial_tx(*(s++)); + serial_tx('\r'); + serial_tx('\n'); + va_end(va); + prodptr = (prodptr + 1) % LOGLEN; + if (flush_imm) + outlog(); } void (*outputf)(const char *s, ...) = dologf; void dump_log (char * target) { memcpy(target, logents, sizeof(logents)); } -