X16Community / x16-docs

Commander X16 Documentation (CC BY-SA)
95 stars 34 forks source link

SNES joypad controler port correct? #58

Closed zarutian closed 1 year ago

zarutian commented 1 year ago

Using Super Famicom Developement wiki Controler port pinout as reference pin 5 and pin 6 should be connected to Data2 and IObit respectively.

Those two pins are used by non-joypad periperials such as lightguns (unlikely to work with todays lcd monitors) and multitaps. The latter allows for four joypads to be connected via it to the controler port. For Commander X16 this means that with four multitaps connected to the four SNES controler ports you can have a local 16 player games.

Only came across this potential issue recently when starting to dig into the documentation in earnest.

mooinglemur commented 1 year ago

Unfortunately, neither of these two pins are connected on the X16 hardware. Multitap accessories and such will not work.

These are the pins that are connected to the physical ports on X16 hardware

image

The clock and latch are each common to all 4 ports, which with the Data 1 pin for each controller adds up to the 6 pins designated for gamepads on port A of VIA 1.

zarutian commented 1 year ago

Well that is rather unfortunate then. However, if yellow wiring (old IBM term) to mitigate this is required then these pins can be wired to the X16 user i/o port.

zarutian commented 1 year ago

Regarding aforesaid yellow wiring here is what I am thinking:

joy1.data2 is connected to PA0 in Userport (Versitile Interface Adapter #2)
joy2.data2 is connected to PA1
joy3.data2 is connected to PA2
joy4.data2 is connected to PA3
joy1.iobit is connected to PA4
joy2.iobit is connected to PA5
joy3.iobit is connected to PA6
joy4.iobit is connected to PA7

This is done preferably by soldering these yellow wires to an female/male header that plugs into the userport.

I am still looking into how to rewrite joystick.s to support Multitap so 17 players (one via the ps2 keyboard) can play together locally.

mooinglemur commented 1 year ago

For something like this, I think it'd much cleaner to build a custom harness that only connects to the user port and talks to the mega multitap spaghetti tree on VIA#2. Games with such support can include their own joystick scanning routine.

Either way, I think it's out of scope for the base X16 hardware and ROM.

zarutian commented 1 year ago

You are probably right about the multitap but I was looking at VIA#1 and there are unused pins there that could have been, for at least controler port 1 and 2, connected to data2 and iobit in those ports.

zarutian commented 1 year ago

After thorough mulling I have come up with a better bodge for the two externally accessible SNES controller ports so the full gammut of SNES periperials could be supported: on VIA1 the data pins for controler ports 3 and 4 are yellow wired to data2 on controlers ports 1 and 2 respectively. PB0 and PB1 on VIA1 are connected to iobit in controlers ports 1 and 2 respectively. PB2 is connected to GND or VCC, that is opposite to which ever way its connected without the bodge. This is to factiliate detection of the bodge through software.