mirror of
https://github.com/jeremysrand/joytest.git
synced 2025-01-03 02:31:24 +00:00
Ask the cc65 driver how many joysticks are supported and use that to drive the test interface.
This commit is contained in:
parent
60b95f6cd7
commit
c8c1f2c89a
@ -3,7 +3,7 @@ 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.3/joytest.dsk)
|
||||
[Download a disk image](https://github.com/jeremysrand/joytest/releases/download/0.4/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. 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.
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
// Defines
|
||||
|
||||
#define SW_VERSION "0.3"
|
||||
#define SW_VERSION "0.4"
|
||||
|
||||
|
||||
// Globals
|
||||
@ -95,6 +95,7 @@ void drawJoystick(uint8_t joyDriverMask)
|
||||
|
||||
void pollJoystick(void)
|
||||
{
|
||||
uint8_t joystickCount;
|
||||
uint8_t joyDriverMask = 0x00;
|
||||
uint8_t prevJoyDriverMask = 0x00;
|
||||
uint8_t joystickNum = 0;
|
||||
@ -107,10 +108,22 @@ void pollJoystick(void)
|
||||
|
||||
clearGlobals();
|
||||
|
||||
joystickCount = joy_count();
|
||||
|
||||
clrscr();
|
||||
cputsxy(11, 0, "CC65 JOYSTICK TEST");
|
||||
cputsxy(11, 1, "------------------");
|
||||
|
||||
if (joystickCount == 0)
|
||||
{
|
||||
cputsxy(0, 3, "NO JOYSTICKS FOUND");
|
||||
cputsxy(0, 4, "PRESS ANY KEY TO QUIT");
|
||||
while (!kbhit())
|
||||
;
|
||||
cgetc();
|
||||
return;
|
||||
}
|
||||
|
||||
cputsxy(0, 3, "JOYSTICK NUM:");
|
||||
|
||||
cputsxy(0, 11, "BUTTONS:");
|
||||
@ -118,7 +131,12 @@ void pollJoystick(void)
|
||||
cputsxy(20, 10, "X POSITION: ");
|
||||
cputsxy(20, 11, "Y POSITION: ");
|
||||
|
||||
cputsxy(0, 20, "PRESS 1/2 TO SELECT JOYSTICK NUMBER");
|
||||
if (joystickCount > 1)
|
||||
{
|
||||
gotoxy(0, 20);
|
||||
cprintf("PRESS 1%c%u TO SELECT JOYSTICK NUMBER",
|
||||
(joystickCount > 2 ? '-' : '/'), joystickCount);
|
||||
}
|
||||
cputsxy(0, 21, "PRESS X/Y TO SELECT AXIS TEST");
|
||||
cputsxy(0, 22, "PRESS C TO CLEAR TEST RESULTS");
|
||||
cputsxy(0, 23, "PRESS Q TO QUIT");
|
||||
@ -257,9 +275,29 @@ void pollJoystick(void)
|
||||
{
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
{
|
||||
uint8_t newJoystickNum = (ch - '1');
|
||||
|
||||
if (joystickCount < 2)
|
||||
break;
|
||||
|
||||
if (newJoystickNum >= joystickCount)
|
||||
break;
|
||||
|
||||
if (newJoystickNum == joystickNum)
|
||||
break;
|
||||
|
||||
joystickNum = (ch - '1');
|
||||
pdlNum = (testingX ? (2 * joystickNum) : ((2 * joystickNum) + 1));
|
||||
|
||||
}
|
||||
|
||||
// Fallthrough...
|
||||
case 'C':
|
||||
case 'c':
|
||||
|
Loading…
Reference in New Issue
Block a user