]> git.sur5r.net Git - cc65/blobdiff - samples/mousedemo.c
Added the new mandelbrot sample
[cc65] / samples / mousedemo.c
index ce7af232ece672193db46f67b4664a69a4a94d2b..2ac1dc38dd7500ed06f744262c4008e937dc5e3e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Demo program for mouse usage. Will work for the C64/C128/Atari
+ * Demo program for mouse usage. Will work for the C64/C128/CBM510/Atari
  *
  * Ullrich von Bassewitz, 13.09.2001
  *
@@ -25,8 +25,8 @@
 #  define SPRITE0_DATA    0x0E00
 #  define SPRITE0_PTR     0x07F8
 #elif defined(__CBM510__)
-#  define SPRITE0_DATA    0xF800
-#  define SPRITE0_PTR     0xF7F8
+#  define SPRITE0_DATA    0xF400
+#  define SPRITE0_PTR     0xF3F8
 #endif
 
 /* The mouse sprite (an arrow) */
@@ -75,6 +75,9 @@ int main (void)
     struct mouse_info info;
     unsigned char Invisible;
     unsigned char Done;
+#if defined(__ATARI__)
+    unsigned char type;
+#endif
 
     /* Initialize the debugger */
     DbgInit (0);
@@ -86,11 +89,6 @@ int main (void)
     cursor (0);
     clrscr ();
 
-    /* Print a help line */
-    revers (1);
-    cputsxy (0, 0, "d: debug   h: hide   q: quit   s: show  ");
-    revers (0);
-
 #if defined(__C64__) || defined(__C128__) || defined(__CBM510__)
     /* Copy the sprite data */
     memcpy ((void*) SPRITE0_DATA, MouseSprite, sizeof (MouseSprite));
@@ -99,18 +97,40 @@ int main (void)
     *(unsigned char*)SPRITE0_PTR = SPRITE0_DATA / 64;
 
     /* Set the color of sprite 0 */
+#ifdef __CBM510__
+    pokebsys ((unsigned) &VIC.spr0_color, COLOR_WHITE);
+#else
     VIC.spr0_color = COLOR_WHITE;
+#endif
 
     /* Initialize the mouse */
-    mouse_init (MOUSE_C64);
+    mouse_init (MOUSE_CBM1351);
 
 #elif defined(__ATARI__)
 
+    do {
+        cputs("\r\n");
+        cputs("0 = trak-ball\r\n");
+        cputs("1 = ST mouse\r\n");
+        cputs("2 = Amiga mouse\r\n");
+        cputs("Enter type (0-2): ");
+        type = cgetc();
+        cputc(type);
+    } while (type < '0' || type > '2');
+    type -= '0';
+
     /* Initialize the mouse */
-    mouse_init (MOUSE_TRAKBALL);
+    mouse_init (type);
+    *(unsigned char *)0x2c0 = 15;  /* set mouse cursor color (PM0) */
+    clrscr ();
 
 #endif
 
+    /* Print a help line */
+    revers (1);
+    cputsxy (0, 0, "d: debug   h: hide   q: quit   s: show  ");
+    revers (0);
+
     /* Test loop */
     Done = 0;
     ShowState (Invisible = 1);