Every peripheral ID?

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

Moderator: BigEvilCorporation

Post Reply
Sik
Very interested
Posts: 889
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Every peripheral ID?

Post by Sik » Mon Dec 10, 2018 9:31 am

Trying to build a list of every peripheral ID we can figure out (and a list of peripherals that can't be detected this way).

So far what I could collect:
  • 1111 (15): undetectable
  • 1101 (13): Mega Drive controller
  • 1100 (12): Mega Drive controller*
  • 1011 (11): Saturn controller
  • 1010 (10): Mega Anser printer
  • 0111 (7): Sega multitap
  • 0101 (5): Saturn peripheral (other)
  • 0011 (3): Mega Drive Mouse
  • 0001 (1): Justifier
  • 0000 (0): Menacer
*This one can happen if the console is reset in the middle of reading a 6-button controller and you try to detect the peripheral during the moment it'd return the extra buttons… You can't proceed to read the controller this frame in this case, but you can tell that it's a controller.

Does anybody know what the Activator reports? Looking at Genesis Plus GX's code it seems like it'd return 1010 (because that value is returned also when TH is high?) but that means there's a conflict with the printer… but on the other hand, DATA0 is an output to the Activator, but during detection the console sets that pin to input, meaning that neither console nor Activator are driving it, so it'd show up as 1 but then the ID would be 1111 (15) which sounds like a bad idea?

What's the proper way to detect the Activator?

Also there's a page in the docs that says that 1110 (14) belongs to a "RAM disk". That ID isn't assigned to anything else, but so far we never saw anything try to use it either and that mention seems to be the only trace left from its existence. Dunno if it's worth including in the list.
Sik is pronounced as "seek", not as "sick".

Chilly Willy
Very interested
Posts: 2782
Joined: Fri Aug 17, 2007 9:33 pm

Re: Every peripheral ID?

Post by Chilly Willy » Tue Dec 11, 2018 11:54 pm

If I had an activator, I'd try it. I'd guess that if it's not driving the line, it should float high since 1111 is what you get when nothing is plugged into a port, which means all the inputs are floating.

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

Re: Every peripheral ID?

Post by Sik » Wed Dec 12, 2018 6:00 am

There's also the possibility of DATA0 being pulled either up or down, which is how the printer adapter is likely doing its peripheral ID (since it also has the issue of DATA lines being output).

From what I gather, Activator has TH and DATA0 as output, and the rest as input (unlike just about every other Sega peripheral). Specifically it seems every line has these functions going by that code:
  • TH (output): start/stop packet
  • TR (input): nibble bit 3
  • TL (input): nibble bit 2
  • DATA3 (input): nibble bit 1
  • DATA2 (input): nibble bit 0
  • DATA1 (input): confirms data is ready
  • DATA0 (output): toggle for next nibble
But this is incomplete, since the Activator demo ROM lets you change the height levels the Activator tries to detect (I haven't gotten to that part of the code yet), which isn't handled in GPGX at all (if it even works in the released device?). Also it seems to detect the Activator by seeing if DATA1 responds to DATA0's toggling, peripheral ID is never probed (・_・) I'd need to check if any game tries to retrieve it by ID, but so far we have no confirmation there either.

I'm not even sure what's going on from GPGX's code anyway, it lists the bits for each of the eight panels but there's no indication of which panel is which.
Sik is pronounced as "seek", not as "sick".

Chilly Willy
Very interested
Posts: 2782
Joined: Fri Aug 17, 2007 9:33 pm

Re: Every peripheral ID?

Post by Chilly Willy » Thu Dec 13, 2018 1:59 am

The GPGX code is fairly easy to read...

Code: Select all

INLINE unsigned char activator_read(int index)
{
  /* IR sensors 1-16 data (active low) */
  uint16 data = ~input.pad[index << 2];

  /* D1 = D0 (data is ready) */
  uint8 temp = (activator[index].State & 0x01) << 1;

  switch (activator[index].Counter)
  {
    case 0: /* x x x x 0 1 0 0 */
      temp |= 0x04;
      break;

    case 1: /* x x l1 l2 l3 l4 1 1 */
      temp |= ((data << 2) & 0x3C);
      break;

    case 2: /* x x l5 l6 l7 l8 0 0 */
      temp |= ((data >> 2) & 0x3C);
      break;

    case 3: /* x x h1 h2 h3 h4 1 1 */
      temp |= ((data >> 6) & 0x3C);
      break;

    case 4: /* x x h5 h6 h7 h8 0 0 */
      temp |= ((data >> 10) & 0x3C);
      break;
  }

  return temp;
}
It's returning the sensor state for all 16 sensors in one packet. First the 8 low sensors for kicks, and then the 8 high sensors for punches. The only thing you can't tell from the code is which way the sensors go around the octagon.

Since sensors are active low, assuming you aren't kicking in the exact wrong part of the octagon during reset, the ID will be 1011. At least, it will be on GPGX.

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

Re: Every peripheral ID?

Post by Sik » Thu Dec 13, 2018 2:43 am

Chilly Willy wrote:
Thu Dec 13, 2018 1:59 am
It's returning the sensor state for all 16 sensors in one packet. First the 8 low sensors for kicks, and then the 8 high sensors for punches. The only thing you can't tell from the code is which way the sensors go around the octagon.
That last part is what I can't figure out :​O) (although not relevant to peripheral ID)

In fact is there even any documentation on the Activator? Because other than that file I can't find anything.
Chilly Willy wrote:
Thu Dec 13, 2018 1:59 am
Since sensors are active low, assuming you aren't kicking in the exact wrong part of the octagon during reset, the ID will be 1011. At least, it will be on GPGX.
Don't forget that DATA0 will be set to input during ID retrieval and the Activator won't be actively driving it either, and we don't know if it's being pulled up or down. Going by the code, toggling TH causes sequence to reset to 0, and DATA0 toggling causes it to advance. That means it'll be stuck on the xxx0100 case, which should result in ID 1010… but that assumes DATA0 is being pulled down.

I guess the only way to make sure will be to get an actual Activator *looks at prices on eBay* what the fuck

And here I was hoping I could get a more or less complete list of peripheral IDs. Guess I'll just look what other games do (if none of them tries to detect it by ID then there's a high chance it was never intended to have one)


EDIT: welp, turns out there's actually more to it and you can actually write back to the Activator (just found the code responsible for this). I guess I'll open a thread for the Activator once I figure out how it tells apart reads from writes.
Sik is pronounced as "seek", not as "sick".

Eke
Very interested
Posts: 856
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Re: Every peripheral ID?

Post by Eke » Thu Dec 13, 2018 6:25 am

The numbers (1-8) actually refer to panel number in Activator manuals: 1 corresponds to the panel in front of the player then, in clock order, 2, 3, etc

One of the manuals can actually be still found here: http://www.segakore.fr/media/segakore/d ... uide_u.pdf

From my old notes (the only thing left I have is that badly formatted page which was exported from googlecode issues pages back then: https://bitbucket.org/eke/genesis-plus- ... or-support), it looks like activator also has a 3-button compatible mode.

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

Re: Every peripheral ID?

Post by Sik » Thu Dec 13, 2018 7:48 am

Ugh, I thought it used some switch or something (you can tell I never had an Activator :​v), I thought I had figured out what was going on but that throws me off again. This thing is doing something really weird with the direction of the pins. I guess it determines whether to stay in compatibility mode or not based on whether the Mega Drive is driving DATA0 low or not - but the problem is that in compatibility mode, it also needs to drive DATA0 low by itself (to return an Up press). Maybe there's a timing threshold and it starts pretending it's a controller if DATA0 doesn't go low after a while? (EDIT: or maybe it's relying on how long it takes before it drives DATA0 low when TH toggles…)

EDIT: dedicated thread for Activator.

Also it hits me that compatibility mode means that it probably has no usable peripheral ID (because it'd pretend to be a controller). The implication in that case would be that the only way to detect the Activator is by trying to use it.
Sik is pronounced as "seek", not as "sick".

Post Reply