does the protovision 4 player adapter work with the vic?

Basic and Machine Language

Moderator: Moderators

User avatar
aitsch
Vic 20 Amateur
Posts: 51
Joined: Sun Mar 08, 2020 12:54 pm
Location: Germany NS

does the protovision 4 player adapter work with the vic?

Post by aitsch »

hi everyone,

for my current project it would be nice to have multi joystick support for 2 players.
i have the protovision 4 player interface here. so it is my prefered device to solve this wish.
in the description there is no compatibility with the vic-20 mentioned but "hope dies last!" :P (it is a german phrase).

in v.i.c.e. i've activated the adapter,
Unbenannt.png
configured the key sets for joy 2&3 and tried to use the code snippets from this page:
https://www.protovision.games/hardw/bui ... =de#codeit

but i had no success to read input from the register $dd01 :cry: .
I suspect if it would work, this register is absolutely wrong but i'm not familiar with the CIAs :oops: .

is the adapter usable with the vic-20 and if yes --> how ??

aitsch
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: does the protovision 4 player adapter work with the vic?

Post by Mike »

Are there no clear instructions on the Protovision homepage how to read out the adapter with a VIC-20?
aitsch wrote:i had no success to read input from the register $dd01 :cry: .
No wonders. The VIC-20 has its I/O chips located at some other place (not $Dxxx as in the C64).

I'd presume the Protovision adapter uses the 8 free port pins of the user port. The corresponding port data register on the VIC-20 is port B of VIA #1 ($9110 ^= 37136), and the data direction register of port B is located at $9112 ^= 37138.

With the 4 (or on the VIC-20, 3) player adapter in the user port, check what you see in the port data register 37136. If there is a selection of the joystick, which requires you to set one of the port bits to output: bits set to 1 in the data direction register 37138 set the corresponding port bit to output. Per default, all bits in that register are 0, i.e. all port pins are input. If you change a port pin to output, be sure you don't short circuit that port pin with either +5 V or ground.
User avatar
aitsch
Vic 20 Amateur
Posts: 51
Joined: Sun Mar 08, 2020 12:54 pm
Location: Germany NS

Re: does the protovision 4 player adapter work with the vic?

Post by aitsch »

hi mike,
why did I know you would answer :mrgreen: ??
but many thanks for that :P .

i've replaced $DD03 with $9112 and $DD01 with $9110 from the protovision code but without success.
The registers did nothing in the emulator in combination with the (emulated) adapter.

i am supprised that google finds more or less nothing usefull about my problem.

now it's family time.
I will have a new try later on.

aitsch
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: does the protovision 4 player adapter work with the vic?

Post by groepaz »

check this: http://wiki.icomp.de/wiki/4_Player_Adapter#Sample_Code

"If you change a port pin to output, be sure you don't short circuit that port pin with either +5 V or ground."
connecting an output to GND is safe, btw - and you should never actively drive any pins to 5V :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: does the protovision 4 player adapter work with the vic?

Post by Mike »

groepaz wrote:connecting an output to GND is safe, btw
This is *not* a good idea with port B of the 6522 VIA:

Image

Here there's not only a current limiting FET to +5 V, but also another actively driven FET parallel to it.

If the output is shorted to GND, I won't place any bet on how long the output will endure this.
User avatar
aitsch
Vic 20 Amateur
Posts: 51
Joined: Sun Mar 08, 2020 12:54 pm
Location: Germany NS

Re: does the protovision 4 player adapter work with the vic?

Post by aitsch »

groepaz wrote: Mon Jul 20, 2020 11:23 am check this: http://wiki.icomp.de/wiki/4_Player_Adapter#Sample_Code
...
I've checked this code and it works well!

thx

aitsch
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: does the protovision 4 player adapter work with the vic?

Post by groepaz »

Here there's not only a current limiting FET to +5 V
There has to be - i have proven it by measurements a while ago (It would be kinda fatal if not, you'd have a killerpoke right there).
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
brain
Vic 20 Nerd
Posts: 538
Joined: Sun Jul 04, 2004 10:12 pm

Re: does the protovision 4 player adapter work with the vic?

Post by brain »

Wonder why they put the two different fire buttons on separate data pins? The sample code doesn't take advantage of that at all. Is there a use case where knowing the state of both fire buttons at the same time is important but the direction of the joyport is not?

Jim
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: does the protovision 4 player adapter work with the vic?

Post by Mike »

The adapter uses a 74HCT157 quad 2-input multiplexer, and there are enough free I/O pins on the user port so 4 multiplexed directions + 2 fire buttons + 1 bit to select the joystick happen to work out. There's the CBT3384 with 2x 5 bit analogue switches, which would allow to multiplex all signals, but then I think the Protovision adapter has been long around already to establish a standard ...
groepaz
Vic 20 Scientist
Posts: 1187
Joined: Wed Aug 25, 2010 5:30 pm

Re: does the protovision 4 player adapter work with the vic?

Post by groepaz »

Yeah, no specific reason, i guess. Guess they just had a 74157 in the drawer when they made that thing (It was first used by "Classical Games" for "Bombmania"). I like the various variants of the "Starbyte" Adapter better myself, because those can be made without needing an IC at all. No idea if those would also work on the VIC20 though.
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
brain
Vic 20 Nerd
Posts: 538
Joined: Sun Jul 04, 2004 10:12 pm

Re: does the protovision 4 player adapter work with the vic?

Post by brain »

As do I, and especially the Hitmen one:
http://hitmen.c02.at/files/hardware/4player/4player.txt

No idea why the others put the directions on placesmother than 0-3/4-7, as that makes the most sense and take the least code. You can't tell me routing 8 IO lines forced their hand.

Jim
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: does the protovision 4 player adapter work with the vic?

Post by Mike »

brain wrote:No idea why the others put the directions on placesmother than 0-3/4-7, as that makes the most sense and take the least code.
The designers of the Protovision adapter likely wanted to map the register bits the same way as with the C64 standard joystick ports, the sole exception being fire of the second extra joystick. Any difference regarding code size is hardly worth mentioning here.
brain
Vic 20 Nerd
Posts: 538
Joined: Sun Jul 04, 2004 10:12 pm

Re: does the protovision 4 player adapter work with the vic?

Post by brain »

Mike wrote: Wed Aug 05, 2020 11:20 pm
brain wrote:No idea why the others put the directions on placesmother than 0-3/4-7, as that makes the most sense and take the least code.
The designers of the Protovision adapter likely wanted to map the register bits the same way as with the C64 standard joysticks, the sole exception being fire of the second extra joystick. Any difference regarding code size is hardly worth mentioning here.
Well, I meant of the ones that are only wires. All of them except the Hitmen one put the direction lines all over the CIA PORT, with some of them putting the direction buttons on PA2 or SP2, etc. I'm just wondering why they went to all the trouble to mangle the order so badly. The reasonable all wire approach would be joystick directions on 0-3 in the same order as on the joyports, and the second joyport at 4-7, in the same order, but shifted up 4 bits. Both fire buttons would then be on SP2, PA2, meaning pulling the data would be loading the #3 joyport directly, masking off the top 4 bits, shifting the top 4 bits down and ptting that in #4. And then oring in the SP2 and PA2 lines for bit 4 of each joyport. It's not so much the code size for size sake, but the code to read is overly complicated for many of these other options (and thus prone to get wrong).

Routing on the user port PCB is the only reason I can think to make such a mess of the mappings, but routing 10 lines to a 24 pin connector can't possibly be that tough (maybe they only wanted to use a single side clad board, like they used to use in TV PCBs, but that's the only reason I can see to move them around so badly)

Jim
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: does the protovision 4 player adapter work with the vic?

Post by Mike »

brain wrote:[...] the code to read is overly complicated for many of these other options (and thus prone to get wrong).
You are somewhat overestimating the difficulty level of writing a joystick routine and getting it right. Once the mapping has been fixed, any self-respecting coder gets that done in 5 minutes.
brain
Vic 20 Nerd
Posts: 538
Joined: Sun Jul 04, 2004 10:12 pm

Re: does the protovision 4 player adapter work with the vic?

Post by brain »

Mike, with all due respect, you're missing my point. I am wondering why the HW designers felt the need to rearrange the mappings in such a haphazard way. Yes, I understand that it's 10 binary values, and no matter how messed up they are, at most it takes 10 reads and 10 writes to correctly assemble the results. My query is around whether there is some CIA reason they purposefully moved them all around on the HW side, because I can't see a SW value to it, and I also don't see a HW value to it. Perhaps there is a hidden reason why, and if so, is that reason relevant to the VIC VIA?

Jim
Post Reply