]> 4ch.mooo.com Git - 16.git/blobdiff - src/test2.c
compy4 sync
[16.git] / src / test2.c
index 5b3d32c0c962afe65d9857a1fb2c8751d7719d74..ac939e573a2ef62a4506be253cb0f11d6868d335 100644 (file)
@@ -1,19 +1,46 @@
+#include <stdio.h>\r
 #include "src\lib\modex16.h"\r
+#include "src\lib\planar.h"\r
+#include "src\lib\bitmap.h"\r
 \r
 word far* clock= (word far*) 0x046C; /* 18.2hz clock */\r
 \r
 void main() {\r
+    bitmap_t bmp;\r
+    planar_buf_t *p;\r
+    word size;\r
     int i;\r
-    word start;\r
-    page_t page;\r
+    int plane;\r
+    int x,y;\r
+    byte color;\r
 \r
-    page=modexDefaultPage();\r
+    /* get the size we want */\r
+    printf("Width: ");\r
+    scanf("%d", &bmp.width);\r
+    printf("Height: ");\r
+    scanf("%d", &bmp.height);\r
+    printf("Color: ");\r
+    scanf("%x", &color);\r
 \r
-    modexEnter();\r
-    start = *clock;\r
-    for(i=0; i<500; i++) {\r
-       modexShowPage(&page);\r
+    /* allocate the bmp and fill it with 42 */\r
+    size = bmp.width * bmp.height;\r
+    bmp.data = malloc(size);\r
+    for(i=0; i<size; i++) {\r
+       bmp.data[i] = color;\r
     }\r
-    modexLeave();\r
 \r
+    /* create the planar buffer */\r
+    p = planar_buf_from_bitmap(&bmp);\r
+\r
+    /* print out the contents of each plane */\r
+    for(plane=0; plane < 4; plane++) {\r
+        i=0;\r
+       printf("Plane %d\n", plane);\r
+       for(y=0; y < p->height; y++) {\r
+           for(x=0; x < p->pwidth; x++) {\r
+               printf("%02X ", (int) p->plane[plane][i++]);\r
+           }\r
+           printf("\n");\r
+       }\r
+    }\r
 }\r