Test program for the VESA code
authorH. Peter Anvin <hpa@zytor.com>
Mon, 28 Aug 2006 09:46:06 +0000 (02:46 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 28 Aug 2006 09:46:06 +0000 (02:46 -0700)
com32/samples/Makefile
com32/samples/vesa.c [new file with mode: 0644]

index 214c0c7..b07667c 100644 (file)
@@ -38,7 +38,7 @@ LNXLIBS          = ../libutil/libutil_lnx.a
 
 .SUFFIXES: .lss .c .o .elf .c32 .lnx
 
-all:   hello.c32 cat.c32 resolv.c32 \
+all:   hello.c32 cat.c32 resolv.c32 vesa.c32 \
        fancyhello.c32 fancyhello.lnx \
        keytest.c32 keytest.lnx \
 
diff --git a/com32/samples/vesa.c b/com32/samples/vesa.c
new file mode 100644 (file)
index 0000000..faeb3b0
--- /dev/null
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <inttypes.h>
+#include "../lib/sys/vesa/video.h"
+
+int __vesacon_init(void);
+void vesacon_write_at(int row, int col, const char *str, uint8_t attr, int rev);
+
+int main(void)
+{
+  int row, col;
+  int attr;
+  char attr_buf[16];
+
+  __vesacon_init();
+
+  row = col = 0;
+  
+  for (attr = 0; attr < 256; attr++) {
+    snprintf(attr_buf, sizeof attr_buf, " [%02X] ", attr);
+    vesacon_write_at(row, col, attr_buf, attr, attr & 3);
+    row++;
+    if (row >= 29) {
+      row = 0;
+      col += 8;
+    }
+  }  
+
+  while (1)
+    asm volatile("hlt");
+}