X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=samples%2Fmousetest.c;h=3910d5a0a17d71cfa7ec0c2d3c102bd093916d60;hb=b858b0d6230d263dedec8e741b01cd8a5602cb59;hp=e5ee4ca49e5ae0120d8c5b7f6e743bc44748decf;hpb=d5f3e91cb8be9464ad7492f81c6cbda012dff711;p=cc65 diff --git a/samples/mousetest.c b/samples/mousetest.c index e5ee4ca49..3910d5a0a 100644 --- a/samples/mousetest.c +++ b/samples/mousetest.c @@ -3,7 +3,7 @@ ** Will work for the C64/C128/CBM510/Atari/Apple2. ** ** 2001-09-13, Ullrich von Bassewitz -** 2013-08-23, Greg King +** 2013-09-05, Greg King ** */ @@ -17,6 +17,7 @@ #include #include #include +#include #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) @@ -40,44 +41,11 @@ -#if defined(__C64__) || defined(__C128__) || defined(__CBM510__) +#ifdef __CBM__ -/* Addresses of data for sprite 0 */ -#if defined(__C64__) -# define SPRITE0_DATA ((unsigned char[64])0x0340) -# define SPRITE0_PTR ((unsigned char *)0x07F8) -#elif defined(__C128__) -# define SPRITE0_DATA ((unsigned char[64])0x0E00) -# define SPRITE0_PTR ((unsigned char *)0x07F8) -#elif defined(__CBM510__) -# define SPRITE0_DATA ((unsigned char[64])0xF400) -# define SPRITE0_PTR ((unsigned char *)0xF3F8) -#endif +/* Set dark-on-light colors. */ +const unsigned char mouse_def_pointercolor = COLOR_BLACK; -/* The mouse sprite (an arrow) */ -static const unsigned char MouseSprite[64] = { - 0xFE, 0x00, 0x00, - 0xFC, 0x00, 0x00, - 0xF8, 0x00, 0x00, - 0xFC, 0x00, 0x00, - 0xDE, 0x00, 0x00, - 0x8F, 0x00, 0x00, - 0x07, 0x80, 0x00, - 0x03, 0xC0, 0x00, - 0x01, 0xE0, 0x00, - 0x00, 0xF0, 0x00, - 0x00, 0x78, 0x00, - 0x00, 0x38, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 -}; #endif @@ -90,7 +58,9 @@ static void __fastcall__ CheckError (const char* S, unsigned char Error) /* Wait for a key-press, so that some platforms can show the error ** message before they remove the current screen. */ - cgetc(); + if (doesclrscrafterexit ()) { + cgetc (); + } exit (EXIT_FAILURE); } } @@ -159,31 +129,12 @@ int main (void) cursor (0); clrscr (); - /* The pointer should be created before the driver is installed, - ** in case a lightpen driver needs it during calibration. - */ - -#if defined(__C64__) || defined(__C128__) || defined(__CBM510__) - /* Copy the sprite data */ - memcpy ((void*) SPRITE0_DATA, MouseSprite, sizeof (MouseSprite)); - - /* Set the VIC-II sprite pointer. */ - *SPRITE0_PTR = ((unsigned) SPRITE0_DATA & 0x3FFF) / sizeof SPRITE0_DATA; - - /* Set the color of sprite 0 */ -# ifdef __CBM510__ - pokebsys ((unsigned) &VIC.spr0_color, COLOR_BLACK); -# else - VIC.spr0_color = COLOR_BLACK; -# endif -#endif - /* If a lightpen driver is installed, then it can get a calibration value ** from this file (if it exists). Or, the user can adjust the pen; and, ** the value will be put into this file, for the next time. ** (Other drivers will ignore this.) */ -#if defined(__C64__) || defined(__C128__) +#if defined(__C64__) || defined(__C128__) || defined(__CBM510__) pen_adjust ("pen.dat"); #endif