Page 3 of 5

Re: Simple Atari-Style Joystick to Creativision adaptor

Posted: Sun Mar 19, 2023 2:55 am
by kevgal
Gday guys my original transistor based adaptor doesn't work with diagonals but I can modify it to work by adding 8 extra transistors and 16 diodes for the diagonal bits! This will then AND the cardinal positions to set the diagonal bit.
I would then have to add a switch on my internal mod to disconnect the diagonal bit if I want use Basic as some buttons use these these bits. e.g keyboard 1 uses the same bits as Up and Right combined, by using U/R to set the diagonal bit it would make keyboard 1 look like joystick U/R.
The Cardinal positions also use as much real estate as all the 12 diagonal positions so I'm not sure why they bothered with a 16 way joystick - would have been a lot easier if it was only 8 way.

I'd like to see the schematic of the logic gate version to compare.

What games use 6 or N to start?

Attached is my updated Scancodes list

Cheers
Kev

Re: Simple Atari-Style Joystick to Creativision adaptor

Posted: Sun Mar 19, 2023 7:08 am
by Scouter3d
Hi kevgal,

sadly i never created a schematic other than the drawing on page 2 of this thread, maybe mamejay or cheshirenoir?

here is a snippet from @usernames@s code for the PS/2 keyboard and joystickinterface we built showing the additional pins for diagonals...

Cheers, TOM:0)

Code: Select all

/**
 * Left Joystick
 */

/** Up - Pin 9 + Pin 5 **/
static const int8_t CVJ_UP = B00000100;

/** Down - Pin 9 + Pin 7 **/
static const int8_t CVJ_DOWN = B00000110;

/** Left - Pin 9 + Pin1 **/
static const int8_t CVJ_LEFT = B00000000;

/** Right - Pin9 + Pin 6 **/
static const int8_t CVJ_RIGHT = B00000101;

/** Fire1 - Pin9 + Pin3 **/
static const int8_t CVJ_FIRE1 = B00000010;

/** Fire2 - Pin10 + Pin3 **/
static const int8_t CVJ_FIRE2 = B00001010;

/** South East - Additional pin **/
static const int8_t CVJ_D_RIGHT = B00000111;

/** South West - Additional pin **/
static const int8_t CVJ_D_LEFT = B00000001;

/** North East - Additional pin **/
static const int8_t CVJ_U_RIGHT = B00000001;

/** North West - Additional pin **/
static const int8_t CVJ_U_LEFT = B00000011;

Re: Simple Atari-Style Joystick to Creativision adaptor

Posted: Sun Mar 19, 2023 1:31 pm
by kevgal
Hmmm.... that's a bit confusing, not sure what the static constants mean.
You mentioned that the diagonals work for Basic but not some games. Surely there's only one value for any direction?
What values did you get for diagonals in the basic program?
Cheers
Kev

Re: Simple Atari-Style Joystick to Creativision adaptor

Posted: Sun Mar 19, 2023 2:43 pm
by Scouter3d
You are right, that snippet from the arduino-sketch was confusing... Sorry...

the whole keyboard / joystick reading IS very confusing :0)

I guess the difference lies somewhere deep within how the BASIC command handles/calculates the values it gets to differentiate its (only) 8 Directions
and how other games try match the values to 4, 8 or 16 possible directions

With 16 possible directions on the joystick the matching to 8 directions is not "easy"
for instance: if you assign all major directions (UP, DOWN, LEFT, RIGHT) to their correct value and (+-) 22.5deg to surely "catch" them
that adds up to 4x3=12 and you have only 1 direction for each of the 4 diagonals left... and hitting the perfect diagonal on the stick becomes nearly impossible...

Then there is how games quickly calculate the correct direction...

i hope this is a bit "clearer" and not even more confusing its been a while since i dabbled with the joysticks...

PS: You don´t know how often i wished, they used simple 8-way joysticks and a "normal" keyboard matrix...like in the LASER 2001 / SALORA MANAGER

maybe @username@ can shed some more light on this issue?

Cheers, TOM:0)

Re: Simple Atari-Style Joystick to Creativision adaptor

Posted: Sun Mar 19, 2023 7:47 pm
by @username@
Not sure if this will help, but here's the breakdown of how the CV gets joystick input.

BIOS reads from the PIA and inverts the value with EOR #$FF.

This value is then doubled (ASL).

The result is then the element of the matching value in the BIOS lookup table at $FBB1.

BASIC differs by just dropping the LSB, shift right 1 (LSR) and increment by one.

Hopefully this table makes it clearer.

Code: Select all

+----------------------------------------+
|          JOYSTICK MAPPY THING          |
+-----+------+------+-----+-------+------+
| PIA | BIOS | ELEM | DIR | BASIC | BDIR |
+-----+------+------+-----+-------+------+
|  42 |   84 |   0  | SSW |   1   |   S  |
|  02 |   04 |   1  |  S  |   1   |   S  |
|  03 |   06 |   2  | SSE |   2   |  SE  |
|  07 |   0E |   3  | SE  |   2   |  SE  |
|  05 |   0A |   4  | ESE |   3   |   E  |
|  04 |   08 |   5  | E   |   3   |   E  |
|  44 |   88 |   6  | ENE |   4   |  NE  |
|  4C |   98 |   7  | NE  |   4   |  NE  |
|  48 |   90 |   8  | NNE |   5   |   N  |
|  08 |   10 |   9  | N   |   5   |   N  |
|  18 |   30 |   A  | NNW |   6   |  NW  |
|  38 |   70 |   B  | NW  |   6   |  NW  |
|  30 |   60 |   C  | WNW |   7   |   W  |
|  20 |   40 |   D  | W   |   7   |   W  |
|  60 |   C0 |   E  | WSW |   8   |  SW  |
|  62 |   C4 |   F  | SW  |   8   |  SW  |
+-----+------+------+-----+-------+------+
Note that the PIA value is already inverted.

Games tend to just take the result, then and off the lower nibble - so the BIOS EOR #$C0 is just thrown away.

For example SONIC Invaders just tests for value 8, if it's above going left, otherwise going right.

Re: Simple Atari-Style Joystick to Creativision adaptor

Posted: Mon Mar 20, 2023 1:24 am
by kevgal
Wow that's quite impressive. Funny how they go to the trouble of making a 16 way joystick only for the Basic program to have to convert back to an 8 way!
is there any game that uses the minor diagonals anyway?
Given that there's no way for an 8 way Atari type stick to recreate a 16 way why not just ignore the minor diagonals?
All games would have to use the major diagonals anyway other wise there would be dead spots on the original controller?
I don't get how the Atari type adaptor would work with Basic but not some games, whatever jiggery-pokery a game uses to determine diagonals if it creates the same byte as the original it should behave exactly like the original?
I'm assuming the above adaptor creates proper diagonal codes e.g. left controller major diagonals UR-$4c, DR-$7, DL-$62 and UL-$38.
Which game doesn't work with these ?
What am I missing?

Re: Simple Atari-Style Joystick to Creativision adaptor

Posted: Mon Mar 20, 2023 1:59 am
by kevgal
Scouter3d wrote:
Fri Sep 17, 2021 6:47 am
Hi,



Also: some games need a keypress ("6" or "B" / "7" or "N") on the pad to start! You would need to simulate one of this Keys also... I used my adapter in combination with the original CV moving keyboard...


Cheers, TOM:0)
Gday Tom, I just tried out 14 different games and they all start with either "6","T","G" or "B".
Every game also seems to behave the same way i.e power on goes into demo mode, press reset button goes into game select mode then press any of the 4 start buttons to start the game.
Also Tank Attack seems to be the only game that uses "T" and "G" for "Swap Tank" buttons but this also works on "6" and "B"!
Is there any game that doesn't start on any of these 4 buttons?
Cheers
Kev

Re: Simple Atari-Style Joystick to Creativision adaptor

Posted: Mon Mar 20, 2023 7:12 am
by Scouter3d
Hi,

yes, the adaptor creates the correct diagonal codes and should work with all carts correctly.

Yes, all games can be started with "6" or "B" (i have not tried "T" or "G" on all games)
Some Games start with any key from the LEFT Pad, some (like Astro pinball) even start with any key on LEFT or RIGHT Pad.

Cheers, TOM:0)

Re: Simple Atari-Style Joystick to Creativision adaptor

Posted: Mon Mar 20, 2023 12:24 pm
by @username@
Referring to the diagram here viewtopic.php?f=10&t=378&p=3708&hilit=joystick#p3708

If you swap PIN 1 and PIN3 - and accept that the BLUE boxes should be set - then you match up with the PIA values which are expected.

The raw data is stored at memory location $18-$1B - so a little BASIC program can confirm if you have the correct pins / values.

Code: Select all

10 FOR X=24 TO 27
20 PRINT PEEK(X);" ";
30 NEXT
40 PRINT
50 GOTO 10
I agree, if the values are the same, there is no logical reason any game would not work, other than a malfunction.

Good luck!

Re: Simple Atari-Style Joystick to Creativision adaptor

Posted: Mon Mar 20, 2023 12:26 pm
by Mobsie
Hi, i think my games ( the finished ones) start with just press fire. But i am not sure 😂 The Galaxy Ranger ( demo only) use the original vtech way