]> Joshua Wise's Git repositories - netwatch.git/commitdiff
Make the log longer, and make it faster to write to.
authorJoshua Wise <joshua@rebirth.joshuawise.com>
Fri, 26 Sep 2008 05:15:30 +0000 (01:15 -0400)
committerJoshua Wise <joshua@rebirth.joshuawise.com>
Fri, 26 Sep 2008 05:15:30 +0000 (01:15 -0400)
aseg/vga-overlay.c
tools/poke-rls.c

index 7aa8b412c517f73f68f5afeead935b98c5c588cb..cfe6ac9de1186f9f7c44a4b1a7b0c6cfb6dba458 100644 (file)
@@ -5,7 +5,11 @@
 #include <stdarg.h>
 #include <output.h>
 
-static char logents[4][41] = {{0}};
+#define LOGLEN 96
+#define LOG_ONSCREEN 4
+
+static char logents[LOGLEN][41] = {{0}};
+static int prodptr = 0;
 
 #define VRAM_BASE              0xA0000UL
 #define TEXT_CONSOLE_OFFSET    0x18000UL 
@@ -54,7 +58,7 @@ void outlog()
 
        smram_aseg_set_state(SMRAM_ASEG_SMMCODE);
 
-       for (y = 0; y < 4; y++)
+       for (y = 0; y < LOG_ONSCREEN; y++)
                for (x = 40; x < 80; x++)
                {
                        basep[y*80*2+x*2] = ' ';
@@ -63,14 +67,14 @@ void outlog()
 
        smram_restore_state(old_state);
        
-       for (y = 0; y < 4; y++)
-               strblit(logents[y], y, 40);
+       for (y = -LOG_ONSCREEN; y < 0; y++)
+               strblit(logents[(y + prodptr) % LOGLEN], y + LOG_ONSCREEN, 40);
 }
 
 void dolog(const char *s)
 {
-       memmove(logents[0], logents[1], sizeof(logents[0])*3);
-       strcpy(logents[3], s);
+       strcpy(logents[prodptr], s);
+       prodptr = (prodptr + 1) % LOGLEN;
 }
 void (*output)(const char *s) = dolog;
 
@@ -78,10 +82,10 @@ void dologf(const char *fmt, ...)
 {
        va_list va;
        
-       memmove(logents[0], logents[1], sizeof(logents[0])*3);
        va_start(va, fmt);
-       vsnprintf(logents[3], 40, fmt, va);
+       vsnprintf(logents[prodptr], 40, fmt, va);
        va_end(va);
+       prodptr = (prodptr + 1) % LOGLEN;
 }
 void (*outputf)(const char *s, ...) = dologf;
 
index 03c4fb1fcf564d652612fd4f7376e0cac0ab11a1..586b4f8776c34ced8e3a47046bb0c6d2b1ef0e73 100644 (file)
@@ -41,9 +41,8 @@ int main(int argc, char **argv)
        printf("returned %p\n", res);
 
        if (res == 42) {
-               printf("%s\n", packet->data);
-               printf("%s\n", packet->data+41);
-               printf("%s\n", packet->data+82);
-               printf("%s\n", packet->data+123);
+               int i;
+               for (i = 0; i < 96; i++)
+                       printf("%s\n", packet->data + i * 41);
        }
 }
This page took 0.027351 seconds and 4 git commands to generate.