8 #if defined(__C64__) || defined(__C128__)
10 /* Address of data for sprite 1 */
11 #define SPRITE1_DATA 0x340
13 /* The mouse sprite (an arrow) */
14 static const unsigned char MouseSprite[64] = {
42 static void ShowState (unsigned char Invisible)
43 /* Display cursor visibility */
48 cprintf ("Mouse cursor %svisible", Invisible? "in" : "");
55 struct mouse_info info;
56 unsigned char Invisible;
58 /* Clear the screen, set white on black */
59 bordercolor (COLOR_BLACK);
60 bgcolor (COLOR_BLACK);
61 textcolor (COLOR_GRAY3);
65 /* Print a help line */
66 cputsxy (0, 0, "s = show h = hide q = quit");
68 #if defined(__C64__) || defined(__C128__)
69 /* Copy the sprite data */
70 memcpy ((void*) SPRITE1_DATA, MouseSprite, sizeof (MouseSprite));
72 /* Set the VIC sprite pointer */
73 *(unsigned char*)0x7F8 = SPRITE1_DATA / 64;
75 /* Set the color of sprite 0 */
76 VIC.spr0_color = COLOR_WHITE;
78 /* Initialize the mouse */
79 mouse_init (0, 1, MOUSE_C64);
82 /* Move the mouse to the center of the screen */
83 mouse_move (160, 100);
86 ShowState (Invisible = 1);
92 ShowState (--Invisible);
97 ShowState (++Invisible);
106 /* Get the current mouse coordinates and button states and print them */
109 cprintf ("X = %3d", info.pos.x);
111 cprintf ("Y = %3d", info.pos.y);
113 cprintf ("LB = %c", (info.buttons & MOUSE_BTN_LEFT)? '1' : '0');
115 cprintf ("RB = %c", (info.buttons & MOUSE_BTN_RIGHT)? '1' : '0');