]> git.sur5r.net Git - cc65/blobdiff - testcode/lib/gamate/ctest.c
moved cart header into seperate file, moved nmi stub into several file, tweaked linke...
[cc65] / testcode / lib / gamate / ctest.c
index da81bf240c6d7613928eb5f642d2400e475733e0..dfebd9befc8a12e31db163bbb96a0e0415554a4d 100644 (file)
@@ -4,7 +4,7 @@
 #include <conio.h>
 
 unsigned char y = 0;
-unsigned char x;
+unsigned char x = 0;
 unsigned short n;
 
 int main(int argc, char *argv[])
@@ -22,14 +22,14 @@ int main(int argc, char *argv[])
 
         n = clock();
 
-        gotoxy(0,2);cprintf("%04x %02x %02x", n, x, y);
+        gotoxy(0,2);cprintf("%04x %02x %02x %02x", n, x, y, *((unsigned char*)JOY_DATA));
 
         switch((*((unsigned char*)JOY_DATA))) {
             case 0xff ^ JOY_DATA_UP:
-                ++y;
+                ++y; if (y == 0xc8) y = 0;
                 break;
             case 0xff ^ JOY_DATA_DOWN:
-                --y;
+                --y; if (y == 0xff) y = 0xc7;
                 break;
             case 0xff ^ JOY_DATA_LEFT:
                 ++x;
@@ -40,14 +40,12 @@ int main(int argc, char *argv[])
             case 0xff ^ JOY_DATA_FIRE_A:
                 break;
         }
-        if (y == 0xff) y = 0xc7;
-        if (y == 0xc8) y = 0;
+
+        waitvblank();
 
         (*((unsigned char*)LCD_XPOS)) = x;
         (*((unsigned char*)LCD_YPOS)) = y;
 
-        waitvblank();
-
     }
 
     return 0;