ID ?

For anything related to IO (joypad, serial, XE...)

Moderator: BigEvilCorporation

Post Reply
KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

ID ?

Post by KanedaFr » Tue Jun 27, 2017 10:56 pm

It's probably a newb-level question but I should ask it ;)

As you know, every input device has its own ID, which make it possible to detect what is connected to each port.
What I never understood is how this Peripheral ID is "set" inside the device.

By this, I mean there isn't a complex µC or CPLD (or GAL) inside the device no ?
So how Sega handled to code the Peripheral ID AND the peripheral logic ?

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Re: ID ?

Post by Mask of Destiny » Tue Jun 27, 2017 11:54 pm

How the device implements it sort of depends on the device in question. For 3-button controllers it relies on both the fact that opposite directions can't physically be pressed at the same time combined with some of the inputs to the mux IC being tied to ground. So when TH is 1, D3-D0 represents the state of RLDU respectively. Since R and L are mutually exclusive, at least one will be set and the result of ORing them together will be 1. Same thing with D and U. When TH is 0 D3-D0 will be 00DU. The bit formed from ORing D1 and D0 will once again be 1 due to the mutually exclusive nature of D and U, but D3 and D2 will be zero. Arrange these bits together and you get the controller ID for a standard controller. The six-button controller is similar, but a bit more complicated. Instead of a 74-series mux, it has what looks like a 22V10 GAL. The controller ID is the same, but there is an internal counter that increments as you toggle TH and will eventually produce a state with all zeroes on D3-D0 (useful for identification) followed by the state of the XYZ and Mode buttons.

The 10-key pad is probably a combination of a mux, a counter and a decoder. It's possible this is implemented in something like a GAL as well, but I have never seen a picture of the PCB so I can't really say.

Peripherals that use the 3-wire handshake protocol (mouse, Sega multi-tap, most Saturn peripherals except the digital pad) generally contain a microcontroller.

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: ID ?

Post by Sik » Wed Jun 28, 2017 12:14 am

Master System controller has RLDU regardless of TH so it returns %1111.

Mega Anser doesn't check for the Ten Key Pad (it just assumes it's always there) so I'm not sure if it actually has an ID. I recall hearing that some of the other stuff with modem support can use the Ten Key Pad for dialing, I would need to check if any of them does. The printer actually has an ID though (and seems to be the only way to detect it): if I recall correctly it's %1010. No idea how that one works, seeing as its interface is a glorified shift register.

The overall tl;dr is that Sega just relied on the particular behavior of each circuit to get an ID. Devices made by third parties usually can't be properly detected this way and need to be handled their own way.
Sik is pronounced as "seek", not as "sick".

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Re: ID ?

Post by Mask of Destiny » Wed Jun 28, 2017 7:40 am

Sik wrote:Mega Anser doesn't check for the Ten Key Pad (it just assumes it's always there) so I'm not sure if it actually has an ID.
That's a good point. It's unclear whether it can produce a useful controller ID the way it's setup.
Sik wrote:The overall tl;dr is that Sega just relied on the particular behavior of each circuit to get an ID.
I think that's understating it a bit. 3-button controller seems to have been clearly designed to be detectable and the microcontroller based devices explicitly support the controller ID protocol. I would agree that it's unclear whether they had the full algorithm in mind when they were designing the 3-button controller though.

Post Reply