X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=bootcensus;a=blobdiff_plain;f=src%2Fcontty.c;h=6601ce81a5af9bcd00d3a3a05462b2067144356e;hp=606072c72d138c2599d73a6dadbe684632e082ad;hb=5e8cc93aaf1173688852acaa0825698c2dc0cb3f;hpb=91253d061647c194cdc8c16c9ae85eccdf942139 diff --git a/src/contty.c b/src/contty.c index 606072c..6601ce8 100644 --- a/src/contty.c +++ b/src/contty.c @@ -17,6 +17,7 @@ along with this program. If not, see . */ #include #include +#include #include "contty.h" #include "serial.h" #include "asmops.h" @@ -145,8 +146,7 @@ void con_putchar(int c) break; default: - ptr = (uint16_t*)TEXT_ADDR; - ptr[(cursor_y + start_line) * NCOLS + cursor_x] = VMEM_CHAR(c, txattr); + con_putchar_scr(cursor_x, cursor_y, c); if(++cursor_x >= NCOLS) { linefeed(); @@ -161,6 +161,27 @@ void con_putchar(int c) #endif } +void con_putchar_scr(int x, int y, int c) +{ + uint16_t *ptr = (uint16_t*)TEXT_ADDR; + ptr[(y + start_line) * NCOLS + x] = VMEM_CHAR(c, txattr); +} + +void con_printf(int x, int y, const char *fmt, ...) +{ + va_list ap; + char buf[81]; + char *ptr = buf; + + va_start(ap, fmt); + vsnprintf(buf, 80, fmt, ap); + va_end(ap); + + while(*ptr && x < 80) { + con_putchar_scr(x++, y, *ptr++); + } +} + static void scroll(void) { int new_line;