Zerk Zone

Pages for the Creations of Ryan Armstrong

Sega Genesis to Gameport Converter

Posted on January 1st, 2017 @ 1:43 pm by Zerker

Hurray, more hardware projects. This one is a bit esoteric, and probably won’t appeal to any but the most dedicated retro gamer.

But that’s OK with me.

It started when I was getting frustrated with the quality of gamepads available for DOS games. Analog Joysticks are easy, but quality gamepads are few and far between. I had two criteria for a gamepad:

  1. It had to have a good D-pad
  2. It had to support both 2 and 4 button games, with reasonable button arrangements for each

The ‘classic’ Gravis Gamepad passes on the second point with the 2 to 4 button switch, but fails quite dramatically on the first one. Most other gamepads I looked up mirrored the Gravis pad’s four button arrangement, but unfortunately this is absolutely terrible for 2-button games.

So I made an adaptor. I picked the Sega Genesis (3 button) gamepad as my source, because, if you count the start button, it has exactly four buttons. And I recently made my Genesis arcade stick, so I’d like to use that for DOS games too.

This is certainly not a new idea; Retoconnection has a good general topic on adaptors, and epanorama has a great discussion on interfacing with Gameport. While it’s possible to make a completely passive adaptor for simpler pads like the master system or Atari/Commodore/etc joysticks, the multiplexer puts a bit of a wrench in the Genesis converter idea.

So I just used a simple microprocessor. I decided on the Arduino Pro Mini (5 V logic version) due to its size and ease of use. The form factor lets me easily incorporate it in my adaptor box once I solder everything together.

The only other concern was simulating the analog axes with the Genesis digital commands. Since PC joysticks typically use a 100 kOhm potentiometer which isn’t something I had a direct way to simulate. The original approach was to create a voltage divider to drive either 0 V, 2.5 V or 5 V to the PC… which really didn’t work at all. The PC uses a rather different method of reading the potentiometer than a regular ADC, so it completely misinterpreted what I was attempting to send it.

So I needed to make the PC ‘look’ like it sees either 0 ohms, 50 kOhms or 100 kOhms at will, which required some rewiring of my resistors and an extra discrete line from the CPU. Here’s my eventual circuit:
genesis-gameport-adaptor
(original Eagle schematic file)

Each axis has a pair of 50 kOhm resistors with a discrete out connected to either the near, middle or far position from the gameport pin. To simulate a specific wiper position, one of the three discretes is configured as an output and drives 5 V/high. The other two discretes are switched to input mode to act as high impedence to avoid affecting the circuit. The end result is the PC sees either 0 ohms, 50 kOhms or 100 kOhms between the port and where the 5V is injected.

For the rest of the wiring, the gameport power powers the Arduino and the downstream Genesis pad, while ground is connected appropriately. Each pin from the Genesis pad is wired directly to a discrete in or out of the Arduino to be read, or in the case of the mux, periodically toggled. Similarly, four discretes are used to drive the four gameport buttons (A0-A3 lines in my setup).

Coding is dead simple: read half of the genesis directions/buttons; switch the mux and wait for them to settle, then read the other half. Then drive the gameport to match, and repeat. Here is the Arduino project code if anyone is curious.

And finally, here are pictures of how it turned out:
dsc_0231dsc_0233

Yes, I need to pick up more flexable wiring…

Comments (2)

Filed under: Hardware |

2 Comments »

  1. Hello my friend. How can i do the gameport to sega genesis?:) Its the same code and wiring? Thank you

    Comment by Jansen — July 31, 2017 @ 12:39 am

  2. Err, no, it isn’t. And it’s a bit more challenging, but certainly possible if you spend some time at it. Here are some notable differences:

    1. The Gameport joystick axis are analog, so you will need to read them using an analog input line on your microcontroller and convert to center/left/right or center/up/down determination. You will also have to deal with calibration in some manner, since exact resistance can vary for certain controllers. Finally, the far side of the POT is not grounded, so you may not see enough difference in voltage unless you actually toggle the excitation voltage for the axis and read after a set time.
    2. The Genesis side will be continually cycling the switch line on what it assumes is a multiplexer to switch between two sets of two buttons. You will need to monitor this and respond by switching the button output quickly enough so the Genesis does not read the wrong buttons. In this scenario, it may be simpler to wire up the Gameport buttons directly through through an actual MUX chip and skip the microprocessor for buttons entirely, but most micros should be fast enough to handle this.
    3. Last time I tried to power an Arduino from the 5V line on the Genesis, the power LED dimmed and it wouldn’t boot. Either I was doing something very odd, or you’ll need to use a lower powered microprocessor.

    Comment by Zerker — August 1, 2017 @ 6:29 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment