infinite hardware scrolling
[3sys] / sys1 / kern / src / main.c
index f0441e5..00d3882 100644 (file)
@@ -12,11 +12,31 @@ void drawtext(int x, int y, const char *s)
 
 void kmain(void)
 {
+       int i, row;
+       int line, scroll;
        char buf[64];
+       char twirl[] = "-\\|/";
 
        vga_reset();
-       vga_setcolor(VGA_YELLOW | VGA_BRIGHT, VGA_BLACK);
 
-       sprintf(buf, "kmain addr: %p", (void*)kmain);
-       drawtext(10, 5, buf);
+       line = 0;
+       for(;;) {
+               scroll = line <= 24 ? 0 : line - 24;
+               row = line <= 24 ? line : 24;
+               sprintf(buf, "line %d  (scroll %d [%d])", line, scroll, scroll % 25);
+               vga_scroll(scroll);
+               if(scroll) {
+                       vga_clearline(24);
+               }
+               vga_setcolor(VGA_YELLOW | VGA_BRIGHT, VGA_BLACK);
+               drawtext(line & 7, row, buf);
+
+               for(i=0; i<65536 * 4; i++) {
+                       buf[0] = twirl[(i >> 18) & 3];
+                       buf[1] = 0;
+                       vga_setcolor(VGA_WHITE, VGA_BLACK);
+                       drawtext(50, row, buf);
+               }
+               line++;
+       }
 }