1
0
mirror of https://github.com/cc65/cc65.git synced 2024-05-31 22:41:32 +00:00

Merged testcode/lib/pen-test.c into the mousetest.c sample program.

A command-line option can force mousetest to be built with a statically linked
driver.
This commit is contained in:
Greg King 2013-06-27 10:01:47 -04:00
parent 88c102b993
commit ecef5551a8
3 changed files with 227 additions and 439 deletions

View File

@ -30,21 +30,14 @@ LD = ld65
else
# "samples/" is a part of a complete source tree.
CA65_INC = ../asminc
CC65_INC = ../include
LD65_CFG = ../src/ld65/cfg
LD65_LIB = ../libsrc
LD65_OBJ = ../libsrc
MOUS = ../libsrc/$(SYS)*.mou
TGI = ../libsrc/$(SYS)*.tgi
CLIB = ../libsrc/$(SYS).lib
CL = ../src/cl65/cl65
CC = ../src/cc65/cc65
AS = ../src/ca65/ca65
LD = ../src/ld65/ld65
MY_INC = --forget-inc-paths -I . -I $(CC65_INC)
MY_ASM = --forget-inc-paths -I . -I $(CA65_INC)
export CC65_HOME := $(abspath ..)
MOUS = ../mou/$(SYS)*.mou
TGI = ../tgi/$(SYS)*.tgi
CLIB = ../lib/$(SYS).lib
CL = ../bin/cl65
CC = ../bin/cc65
AS = ../bin/ca65
LD = ../bin/ld65
endif
# This one comes with VICE
@ -54,17 +47,20 @@ C1541 = c1541
# --------------------------------------------------------------------------
# Generic rules
%: %.c
%: %.s
.c.o:
@echo $<
@$(CC) $(MY_INC) -Oirs --codesize 500 -T -g -t $(SYS) $<
@$(AS) $(basename $<).s
@$(CC) $(CFLAGS) -Oirs --codesize 500 -T -g -t $(SYS) $<
@$(AS) $(<:.c=.s)
.s.o:
@echo $<
@$(AS) $(MY_ASM) -t $(SYS) $<
@$(AS) $(AFLAGS) -t $(SYS) $<
.o:
@$(LD) -o $@ -t $(SYS) -m $(basename $@).map $^ $(CLIB)
@$(LD) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
# --------------------------------------------------------------------------
@ -105,11 +101,11 @@ hello: hello.o
# The Apple machines need the start address adjusted for the mandelbrot demo
ifeq "$(SYS)" "apple2"
mandelbrot: mandelbrot.o
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
else
ifeq "$(SYS)" "apple2enh"
mandelbrot: mandelbrot.o
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
else
mandelbrot: mandelbrot.o
endif
@ -118,18 +114,18 @@ endif
# The Apple ][ needs the start address adjusted for the mousetest
ifeq "$(SYS)" "apple2"
mousetest: mousetest.o
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
else
mousetest: mousetest.o
endif
multdemo: multidemo.o
@$(LD) -t $(SYS) -m $(basename $@).map -C $(SYS)-overlay.cfg -o $@ $^ $(CLIB)
@$(LD) -o $@ -m $@.map -C $(SYS)-overlay.cfg $^ $(CLIB)
nachtm: nachtm.o
ovrldemo: overlaydemo.o
@$(LD) -t $(SYS) -m $(basename $@).map -C $(SYS)-overlay.cfg -o $@ $^ $(CLIB)
@$(LD) -o $@ -m $@.map -C $(SYS)-overlay.cfg $^ $(CLIB)
plasma: plasma.o
@ -138,11 +134,11 @@ sieve: sieve.o
# The Apple machines need the start address adjusted for the tgidemo
ifeq "$(SYS)" "apple2"
tgidemo: tgidemo.o
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
else
ifeq "$(SYS)" "apple2enh"
tgidemo: tgidemo.o
@$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^ $(CLIB)
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
else
tgidemo: tgidemo.o
endif

View File

@ -1,12 +1,15 @@
/*
* Demo program for mouse usage. Will work for the C64/C128/CBM510/Atari/Apple2
*
* Ullrich von Bassewitz, 13.09.2001
*
*/
** Test/demo program for mouse usage.
** Will work for the C64/C128/CBM510/Atari/Apple2.
**
** 2001-09-13, Ullrich von Bassewitz
** 2013-06-26, Greg King
**
*/
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <mouse.h>
@ -14,225 +17,306 @@
#include <ctype.h>
#include <dbg.h>
#if defined(__C64__) || defined(__C128__)
/* Address of data for sprite 0 */
#if defined(__C64__)
# define SPRITE0_DATA 0x0340
# define SPRITE0_PTR 0x07F8
#elif defined(__C128__)
# define SPRITE0_DATA 0x0E00
# define SPRITE0_PTR 0x07F8
#endif
/* The mouse sprite (an arrow) */
static const unsigned char MouseSprite[64] = {
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x0F, 0xE0, 0x00,
0x0F, 0xC0, 0x00,
0x0F, 0x80, 0x00,
0x0F, 0xC0, 0x00,
0x0D, 0xE0, 0x00,
0x08, 0xF0, 0x00,
0x00, 0x78, 0x00,
0x00, 0x3C, 0x00,
0x00, 0x1E, 0x00,
0x00, 0x0F, 0x00,
0x00, 0x07, 0x80,
0x00, 0x03, 0x80,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00
};
#endif /* __C64__ or __C128__ */
/* Dynamically loaded driver by default */
#ifndef DYN_DRV
# define DYN_DRV 1
#endif
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
static void CheckError (const char* S, unsigned char Error)
#ifdef MOUSE_DRIVER
/* A statically linked driver was named on the compiler's command line.
** Make sure that it is used instead of a dynamic one.
*/
# undef DYN_DRV
# define DYN_DRV 0
#else
/* Use a dynamically loaded driver, by default. */
# ifndef DYN_DRV
# define DYN_DRV 1
# endif
#endif
#if defined(__C64__) || defined(__C128__) || defined(__CBM510__)
/* 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
/* 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
static void __fastcall__ CheckError (const char* S, unsigned char Error)
{
if (Error != MOUSE_ERR_OK) {
cprintf ("%s: %s(%d)\r\n", S, mouse_geterrormsg (Error), Error);
cprintf ("%s: %s(%u)\r\n", S, mouse_geterrormsg (Error), Error);
exit (EXIT_FAILURE);
}
}
#if DYN_DRV
/* Points to the dynamic driver's name. */
static const char *mouse_name;
static void DoWarning (void)
/* Warn the user that a mouse driver is needed for this program */
/* Warn the user that a driver is needed for this program. */
{
cprintf ("Warning: This program needs the mouse\r\n"
"driver with the name\r\n"
cprintf ("Warning: This program needs\r\n"
"the driver with the name\r\n"
" %s\r\n"
"on disk! Press 'y' if you have it or\r\n"
"any other key to exit.\r\n", mouse_stddrv);
"on a disk! Press 'y' if you have it;\r\n"
"or, any other key to exit.\r\n", mouse_stddrv);
if (tolower (cgetc ()) != 'y') {
exit (EXIT_SUCCESS);
}
cprintf ("Ok. Please wait patiently...\r\n");
cprintf ("OK. Please wait patiently...\r\n");
}
#endif
static void ShowState (unsigned char Jailed, unsigned char Invisible)
/* Display jail and cursor state */
static void __fastcall__ ShowState (unsigned char Jailed, unsigned char Invisible)
/* Display jail and cursor states. */
{
gotoxy (0, 6);
cclear (40);
gotoxy (0, 6);
cprintf ("Mouse cursor %svisible%s", Invisible? "in" : "", Jailed? ", jailed" : "");
cclearxy (0, 7, 32);
gotoxy (0, 7);
cprintf ("Pointer is %svisible%s.", Invisible? "in" : "", Jailed? " and jailed" : "");
}
#if DYN_DRV
int main (int argc, char *argv[])
#else
int main (void)
#endif
{
struct mouse_info info;
struct mouse_box full_box;
struct mouse_box small_box;
unsigned char Invisible;
unsigned char Done;
unsigned char Jailed;
struct mouse_box full_box, small_box;
unsigned char width, height;
char C;
bool Invisible = true, Done = false, Jailed = false;
/* Initialize the debugger */
DbgInit (0);
/* Clear the screen, set white on black */
(void) bordercolor (COLOR_BLACK);
(void) bgcolor (COLOR_BLACK);
(void) textcolor (COLOR_GRAY3);
/* Set dark-on-light colors. Clear the screen. */
#ifdef __CBM__
(void) bordercolor (COLOR_GRAY2);
(void) bgcolor (COLOR_WHITE);
(void) textcolor (COLOR_GRAY1);
#else
(void) bordercolor (COLOR_BLUE);
(void) bgcolor (COLOR_WHITE);
(void) textcolor (COLOR_BLACK);
#endif
cursor (0);
clrscr ();
/* The pointer is 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 sprite pointer */
*(unsigned char*)SPRITE0_PTR = SPRITE0_DATA / 64;
/* 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_WHITE);
#else
VIC.spr0_color = COLOR_WHITE;
# 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.)
*/
#ifdef __CBM__
pen_adjust ("pen.dat");
#endif
#if DYN_DRV
/* Output a warning about the driver that is needed */
DoWarning ();
/* If a dynamically loadable driver is named on the command line,
** then use that driver instead of the standard one.
*/
if (argc > 1) {
mouse_name = argv[1];
} else {
/* Output a warning about the standard driver that is needed. */
DoWarning ();
mouse_name = mouse_stddrv;
}
/* Load and install the mouse driver */
/* Load and install the driver. */
CheckError ("mouse_load_driver",
mouse_load_driver (&mouse_def_callbacks, mouse_stddrv));
mouse_load_driver (&mouse_def_callbacks, mouse_name));
#else
/* Install the mouse driver */
/* Install the driver. */
CheckError ("mouse_install",
mouse_install (&mouse_def_callbacks, mouse_static_stddrv));
mouse_install (&mouse_def_callbacks,
# ifdef MOUSE_DRIVER
MOUSE_DRIVER
# else
mouse_static_stddrv
# endif
));
#endif
/* Get the initial mouse bounding box */
/* Get the initial bounding box. */
mouse_getbox (&full_box);
/* Print a help line */
screensize (&width, &height);
top:
clrscr ();
revers (1);
cputsxy (0, 0, "d)ebug h)ide q)uit s)how j)ail ");
revers (0);
/* Print a help line */
cputs (" d)ebug h)ide q)uit s)how j)ail");
/* Put a cross at the center of the screen. */
gotoxy (width / 2 - 3, height / 2 - 1);
cprintf ("%3u,%3u\r\n%*s\xDB", width / 2 * 8 + 4, height / 2 * 8 + 4,
width / 2, "");
/* Test loop */
Done = 0;
Jailed = 0;
Invisible = 1;
ShowState (Jailed, Invisible);
while (!Done) {
/* Get the current mouse coordinates and button states and print them */
do {
/* Get the current co-ordinates and button states; and, print them. */
mouse_info (&info);
gotoxy (0, 2);
cprintf ("X = %3d", info.pos.x);
gotoxy (0, 3);
cprintf ("Y = %3d", info.pos.y);
gotoxy (0, 4);
cprintf ("LB = %c", (info.buttons & MOUSE_BTN_LEFT)? '1' : '0');
gotoxy (0, 5);
cprintf ("RB = %c", (info.buttons & MOUSE_BTN_RIGHT)? '1' : '0');
cprintf (" X = %3d\r\n", info.pos.x);
cprintf (" Y = %3d\r\n", info.pos.y);
cprintf (" B1 = %c\r\n", (info.buttons & MOUSE_BTN_LEFT) ?
#ifdef __CBM__
0x5F
#else
'v'
#endif
: '^');
cprintf (" B2 = %c", (info.buttons & MOUSE_BTN_RIGHT) ?
#ifdef __CBM__
0x5F
#else
'v'
#endif
: '^');
/* Handle user input */
if (kbhit ()) {
switch (tolower (cgetc ())) {
cclearxy (1, 9, 23);
switch (tolower (C = cgetc ())) {
case 'd':
BREAK();
break;
/* The debugger might have changed the colors.
** Restore them.
*/
#ifdef __CBM__
(void) bordercolor (COLOR_GRAY2);
(void) bgcolor (COLOR_WHITE);
(void) textcolor (COLOR_GRAY1);
#else
(void) bordercolor (COLOR_BLUE);
(void) bgcolor (COLOR_WHITE);
(void) textcolor (COLOR_BLACK);
#endif
/* The debugger changed the screen; restore it. */
goto top;
case 'h':
ShowState (Jailed, ++Invisible);
mouse_hide ();
ShowState (Jailed, ++Invisible);
break;
case 'j':
if (Jailed) {
Jailed = 0;
mouse_setbox (&full_box);
Jailed = false;
} else {
Jailed = 1;
small_box.minx = max (info.pos.x - 10, full_box.minx);
small_box.miny = max (info.pos.y - 10, full_box.miny);
small_box.maxx = min (info.pos.x + 10, full_box.maxx);
small_box.maxy = min (info.pos.y + 10, full_box.maxy);
mouse_setbox (&small_box);
Jailed = true;
}
ShowState (Jailed, Invisible);
break;
case 's':
mouse_show ();
if (Invisible) {
ShowState (Jailed, --Invisible);
mouse_show ();
}
break;
case 'q':
Done = 1;
Done = true;
break;
default:
gotoxy (1, 9);
cprintf ("Spurious character: $%02X", C);
}
}
}
} while (!Done);
#if DYN_DRV
/* Uninstall and unload the mouse driver */
/* Uninstall and unload the driver. */
CheckError ("mouse_unload", mouse_unload ());
#else
/* Uninstall the mouse driver */
/* Uninstall the static driver. */
CheckError ("mouse_uninstall", mouse_uninstall ());
#endif
/* Say goodbye */
clrscr ();
cputs ("Goodbye!\r\n");
cputsxy (0, height / 2 + 3, "Goodbye!");
return EXIT_SUCCESS;
}

View File

@ -1,292 +0,0 @@
/*
** Test program for lightpen drivers. Will work for the C64/C128.
**
** 2001-09-13, Ullrich von Bassewitz
** 2013-06-21, Greg King
**
*/
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <mouse.h>
#include <conio.h>
#include <ctype.h>
#include <dbg.h>
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
/* Statically linked driver */
#define DYN_DRV 0
#ifdef __C64__
# if DYN_DRV
# define mouse_stddrv "c64-inkwell.mou"
# else
# define mouse_static_stddrv c64_inkwell_mou
# endif
#endif
#ifdef __C128__
# if DYN_DRV
# define mouse_stddrv "c128-inkwell.mou"
# else
# define mouse_static_stddrv c128_inkwell_mou
# endif
#endif
#if defined(__C64__) || defined(__C128__)
/* 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)
#endif
/* An arrow sprite */
static const unsigned char PenSprite[64] = {
0xFF, 0xFF, 0xFF,
0xFC, 0x00, 0x00,
0xF8, 0x00, 0x00,
0xFC, 0x00, 0x00,
0xDE, 0x00, 0x00,
0x8F, 0x00, 0x00,
0x87, 0x80, 0x00,
0x83, 0xC0, 0x00,
0x81, 0xE0, 0x00,
0x80, 0xF0, 0x00,
0x80, 0x78, 0x00,
0x80, 0x38, 0x00,
0x80, 0x00, 0x00,
0x80, 0x00, 0x00,
0x80, 0x00, 0x00,
0x80, 0x00, 0x00,
0x80, 0x00, 0x00,
0x80, 0x00, 0x00,
0x80, 0x00, 0x00,
0x80, 0x00, 0x00,
0x80, 0x00, 0x00
};
#endif /* __C64__ or __C128__ */
static void __fastcall__ CheckError (const char* S, unsigned char Error)
{
if (Error != MOUSE_ERR_OK) {
cprintf ("%s: %s(%u)\r\n", S, mouse_geterrormsg (Error), Error);
exit (EXIT_FAILURE);
}
}
#if DYN_DRV
static void DoWarning (void)
/* Warn the user that a lightpen driver is needed for this program. */
{
cprintf ("Warning: This program needs a lightpen\r\n"
"driver with the name\r\n"
" %s\r\n"
"on disk! Press 'y' if you have it; or,\r\n"
"any other key to exit.\r\n", mouse_stddrv);
if (tolower (cgetc ()) != 'y') {
exit (EXIT_SUCCESS);
}
cprintf ("OK. Please wait patiently...\r\n");
}
#endif
static void __fastcall__ ShowState (unsigned char Jailed, unsigned char Invisible)
/* Display jail and cursor states. */
{
cclearxy (0, 7, 32);
gotoxy (0, 7);
cprintf ("Pointer is %svisible%s.", Invisible? "in" : "", Jailed? " and jailed" : "");
}
int main (void)
{
struct mouse_info info;
struct mouse_box full_box, small_box;
char C;
unsigned char width, height;
bool Invisible = false, Done = false, Jailed = false;
#ifdef __C128__
/* Only the VIC-IIe has a lightpen connection. */
videomode (VIDEOMODE_40x25);
#endif
/* Initiate the debugger. */
DbgInit (0);
/* Set dark-on-light colors. Clear the screen. */
#ifdef __CBM__
(void) bordercolor (COLOR_GRAY2);
(void) bgcolor (COLOR_WHITE);
(void) textcolor (COLOR_GRAY1);
#else
(void) bordercolor (COLOR_BLUE);
(void) bgcolor (COLOR_WHITE);
(void) textcolor (COLOR_BLACK);
#endif
cursor (0);
clrscr ();
#if defined(__C64__) || defined(__C128__)
/* Copy the sprite data. */
memcpy (SPRITE0_DATA, PenSprite, sizeof PenSprite);
/* Set the VIC-II sprite pointer. */
*SPRITE0_PTR = ((unsigned) SPRITE0_DATA & 0x3FFF) / sizeof SPRITE0_DATA;
/* Set the color of sprite 0. */
VIC.spr0_color = COLOR_BLACK;
pen_adjust ("inkwell.dat");
#endif
#if DYN_DRV
/* Output a warning about the driver that is needed. */
DoWarning ();
/* Load and install the lightpen driver. */
CheckError ("mouse_load_driver",
mouse_load_driver (&mouse_def_callbacks, mouse_stddrv));
#else
/* Install the lightpen driver. */
CheckError ("mouse_install",
mouse_install (&mouse_def_callbacks, mouse_static_stddrv));
#endif
/* Get the initial lightpen bounding box. */
mouse_getbox (&full_box);
screensize (&width, &height);
top:
clrscr ();
/* Print a help line. */
cputs (" d)ebug h)ide q)uit s)how j)ail");
/* Put a cross at the center of the screen. */
gotoxy (width / 2 - 3, height / 2 - 1);
cprintf ("%3u,%3u\r\n%*s\xDB", width / 2 * 8 + 4, height / 2 * 8 + 4,
width / 2, "");
/* Expose the arrow. */
mouse_show ();
ShowState (Jailed, Invisible);
/* Test loop */
do {
/* Get the current lightpen co-ordinates and button states;
** and, print them.
*/
mouse_info (&info);
gotoxy (0, 2);
cprintf (" X = %3d\r\n", info.pos.x);
cprintf (" Y = %3d\r\n", info.pos.y);
cprintf (" B1 = %c\r\n", (info.buttons & MOUSE_BTN_LEFT) ?
#ifdef __CBM__
0x5F
#else
'v'
#endif
: '^');
cprintf (" B2 = %c", (info.buttons & MOUSE_BTN_RIGHT) ?
#ifdef __CBM__
0x5F
#else
'v'
#endif
: '^');
/* Handle user input. */
if (kbhit ()) {
cclearxy (1, 9, 23);
switch (tolower (C = cgetc ())) {
case 'd':
BREAK();
/* The debugger might have changed the colors.
** Restore them.
*/
#ifdef __CBM__
(void) bordercolor (COLOR_GRAY2);
(void) bgcolor (COLOR_WHITE);
(void) textcolor (COLOR_GRAY1);
#else
(void) bordercolor (COLOR_BLUE);
(void) bgcolor (COLOR_WHITE);
(void) textcolor (COLOR_BLACK);
#endif
goto top;
case 'h':
mouse_hide ();
ShowState (Jailed, ++Invisible);
break;
case 'j':
if (Jailed) {
mouse_setbox (&full_box);
Jailed = false;
} else {
small_box.minx = max (info.pos.x - 10, full_box.minx);
small_box.miny = max (info.pos.y - 10, full_box.miny);
small_box.maxx = min (info.pos.x + 10, full_box.maxx);
small_box.maxy = min (info.pos.y + 10, full_box.maxy);
mouse_setbox (&small_box);
Jailed = true;
}
ShowState (Jailed, Invisible);
break;
case 's':
mouse_show ();
if (Invisible) {
ShowState (Jailed, --Invisible);
}
break;
case 'q':
Done = true;
break;
default:
gotoxy (1, 9);
cprintf ("Spurious character: $%02X", C);
}
}
} while (!Done);
#if DYN_DRV
/* Uninstall and unload the lightpen driver. */
CheckError ("mouse_unload", mouse_unload ());
#else
/* Uninstall the lightpen driver. */
CheckError ("mouse_uninstall", mouse_uninstall ());
#endif
/* Say goodbye. */
cputsxy (0, height / 2 + 3, "Goodbye!");
return EXIT_SUCCESS;
}