]> git.sur5r.net Git - cc65/blobdiff - testcode/lib/atari/displaylist.c
Made C's sizeof operator work with initialized void variables.
[cc65] / testcode / lib / atari / displaylist.c
index 04c5998786eb1cddb1b1c5f4c56af9ab5b82afd3..ae1931e64df042ede5534102349a44ed596a98a4 100644 (file)
@@ -1,59 +1,55 @@
 /*
-** testprogram for ANTIC instructions as defined in "_antic.h"
+** test program for ANTIC instructions as defined in "_antic.h"
 **
 ** 23-Feb-2017, Christian Krueger
 */
 
 #include <conio.h>
 #include <atari.h>
-#include <peekpoke.h>
-#include <string.h>
 
-// code is only for testing purposes, as screen and display list are not aligned
+// code is only for testing purposes, as screen and display list are not aligned,
 // and jumps not set!
 
 unsigned char DummyScreen[400];
 
 void DisplayList = {
-       DL_BLK1,
-       DL_BLK2,
-       DL_BLK3,
-       DL_BLK4,
-       DL_BLK5,
-       DL_BLK6,
-       DL_BLK7,
-       DL_DLI(DL_BLK8),
-       DL_LMS(DL_CHR40x8x1),
-       DummyScreen,
-       DL_HSCROL(DL_CHR40x10x1),
-       DL_VSCROL(DL_CHR40x8x4),
-       DL_CHR40x16x4,
-       DL_LMS(DL_HSCROL(DL_VSCROL(DL_DLI(DL_CHR20x8x2)))),
-       DummyScreen+120,
-       DL_CHR20x16x2,
-       DL_MAP40x8x4,
-       DL_MAP80x4x2,
-       DL_MAP80x4x4,
-       DL_MAP160x2x2,
-       DL_MAP160x1x2,
-       DL_MAP160x2x4,
-       DL_MAP160x1x4,
-       DL_MAP320x1x1, 
-       DL_JVB,
-       DL_JMP
+    DL_BLK1,
+    DL_BLK2,
+    DL_BLK3,
+    DL_BLK4,
+    DL_BLK5,
+    DL_BLK6,
+    DL_BLK7,
+    DL_DLI(DL_BLK8),
+    DL_LMS(DL_CHR40x8x1),
+    DummyScreen,
+    DL_HSCROL(DL_CHR40x10x1),
+    DL_VSCROL(DL_CHR40x8x4),
+    DL_CHR40x16x4,
+    DL_LMS(DL_HSCROL(DL_VSCROL(DL_DLI(DL_CHR20x8x2)))),
+    DummyScreen+120,
+    DL_CHR20x16x2,
+    DL_MAP40x8x4,
+    DL_MAP80x4x2,
+    DL_MAP80x4x4,
+    DL_MAP160x2x2,
+    DL_MAP160x1x2,
+    DL_MAP160x2x4,
+    DL_MAP160x1x4,
+    DL_MAP320x1x1,
+    DL_JVB,
+    DL_JMP
 };
 
-unsigned char dlend = 0;
 
+/* We know that the sizeof expression is constant; don't tell us. */
+
+#pragma warn (const-comparison, off)
 
 int
 main(void)
 {
-    // unfortunately "sizeof()" doesn't work with void data
-    // (Error: Size of data type is unknown)
-    // so we trick with the addresses at front and end...
-
-    int returnValue = (((unsigned int)&dlend-(unsigned int)&DisplayList) != 28);  // assure only one byte per instruction!
+    int returnValue = (sizeof DisplayList != 28);       // assure only one byte per instruction!
 
     clrscr();
     if (returnValue)
@@ -66,4 +62,3 @@ main(void)
 
     return returnValue;
 }
-