Display the current X/Y position of the joystick using the ROM routine which can help to distinguish between a HW problem with a flakey joystick and a driver problem.

This commit is contained in:
Jeremy Rand 2020-06-10 21:43:22 -04:00
parent 4c76a19e4c
commit d20919ef00
2 changed files with 16 additions and 4 deletions

View File

@ -3,9 +3,9 @@ joytest
This is a joystick test program for the cc65 joystick driver. A problem was found with the original cc65 driver so it has being re-written by Oliver Schmidt. I am creating this program to provide feedback on the new implementation when run on a variety of HW. I have access to an Apple //e and an Apple //gs, each with a CH brand joystick attached. By making this program available, I am hoping to get feedback from more of the community and get coverage of other HW. Please download the disk image to assist in getting greater coverage of this new joystick driver:
[Download a disk image](https://github.com/jeremysrand/joytest/releases/download/0.1/joytest.dsk)
[Download a disk image](https://github.com/jeremysrand/joytest/releases/download/0.2/joytest.dsk)
When run, the left side of the screen shows the current state of the joystick as read by the cc65 driver. The direction of the joystick (if any) and the state of the two buttons is displayed. The right side displays information about X or Y axis testing which may be useful for tweaking the thresholds used to determine direction.
When run, the left side of the screen shows the current state of the joystick as read by the cc65 driver. The direction of the joystick (if any) and the state of the two buttons is displayed. The right side displays information about X or Y axis testing which may be useful for tweaking the thresholds used to determine direction. Below that is a current X and Y position (0-255) as read by the ROM routine, not the cc65 driver. If your joystick is not centred, producing noisy samples or some other problem outside of those with the cc65 driver itself, you may see that here.
If you have an accelerator, you may want to disable it. For systems that shipped running at greater than 1MHz (like the //gs and the //c+), testing at 1MHz and at accelerated speed is useful. Feel free to provide feedback about the behaviour of the driver on a machine with an optional accelerator card active. Although this information is interesting, but I don't think the cc65 project intends to add any support for accelerator detection and handling. Most important is to show that it works acceptably at the speed(s) supported by the platform as it originally shipped.

View File

@ -21,7 +21,7 @@
// Defines
#define SW_VERSION "0.1"
#define SW_VERSION "0.2"
// Globals
@ -115,6 +115,9 @@ void pollJoystick(void)
cputsxy(0, 11, "BUTTONS:");
cputsxy(20, 10, "X POSITION: ");
cputsxy(20, 11, "Y POSITION: ");
cputsxy(0, 20, "PRESS 0/1 TO SELECT JOYSTICK");
cputsxy(0, 21, "PRESS X/Y TO SELECT AXIS TEST");
cputsxy(0, 22, "PRESS C TO CLEAR TEST RESULTS");
@ -127,6 +130,8 @@ void pollJoystick(void)
do {
joyDriverMask = joy_read(joystickNum);
drawJoystick(joyDriverMask);
if (testingX)
{
x = pdlRead(pdlNum);
@ -178,6 +183,8 @@ void pollJoystick(void)
cputs("N/A");
else
cprintf("%3d", lowestRight);
y = pdlRead(pdlNum + 1);
}
else
{
@ -230,9 +237,14 @@ void pollJoystick(void)
cputs("N/A");
else
cprintf("%3d", lowestDown);
x = pdlRead(pdlNum - 1);
}
drawJoystick(joyDriverMask);
gotoxy(36, 10);
cprintf("%3d", x);
gotoxy(36, 11);
cprintf("%3d", y);
cputcxy(14, 3, '0' + joystickNum);