console cursor positioning
[3sys] / sys1 / kern / src / main.c
index f0441e5..3c93cab 100644 (file)
@@ -1,22 +1,34 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
+#include "con.h"
 #include "vga.h"
-
-void drawtext(int x, int y, const char *s)
-{
-       while(*s) {
-               vga_drawchar(x++, y, *s++);
-       }
-}
+#include "mem.h"
+#include "intr.h"
 
 void kmain(void)
 {
-       char buf[64];
+       int i, line;
 
-       vga_reset();
-       vga_setcolor(VGA_YELLOW | VGA_BRIGHT, VGA_BLACK);
+       con_init();
 
-       sprintf(buf, "kmain addr: %p", (void*)kmain);
-       drawtext(10, 5, buf);
+       mem_init();
+       intr_init();
+
+       line = 0;
+       for(;;) {
+               printf("line %d", line++);
+
+               con_pushcur();
+               con_setcur(30, 0);
+               for(i=0; i<65536 * 300; i++) {
+                       if((i & 0xfffff) == 0) {
+                               con_setcolor(VGA_BRIGHT | (line & 7), VGA_BLACK);
+                               con_putchar('>');
+                       }
+               }
+               con_setcolor(VGA_WHITE, VGA_BLACK);
+               con_popcur();
+               con_putchar('\n');
+       }
 }