X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fcontty.c;h=6601ce81a5af9bcd00d3a3a05462b2067144356e;hb=e253f9a0cad14f636a51f6211308491ab19dfbe5;hp=b8f8cde030a275443d9ae77216a3373e5c592a01;hpb=97356e29f73e12f0856fde92a48e86c73bef387c;p=bootcensus
diff --git a/src/contty.c b/src/contty.c
index b8f8cde..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;
@@ -175,7 +196,7 @@ static void scroll(void)
/* clear the next line that will be revealed by scrolling */
new_line = start_line + NROWS - 1;
- memset16(TEXT_ADDR + new_line * NCOLS, VMEM_CHAR(' ', txattr), NCOLS);
+ memset16(TEXT_ADDR + new_line * NCOLS * 2, VMEM_CHAR(' ', txattr), NCOLS);
crtc_setstart(start_line);
}