logo elektroda
logo elektroda
X
logo elektroda

Adapter Game Port - Pegasus

phanick  5 6597 Cool? (+15)
📢 Listen (AI):

A few days ago one of the people asked me to "conjure" her joystick for Pegasus in the style of a stick (shuttlecock). These types of controllers were popular, for example, among Atari or Commodore consoles, while for Pegasus my eyes had never seen anything like that.


So it was necessary to find some ready-made joystick and adjust its communication interface to the console. The joypads from the above photos have the only advantage - they are trivial in communication: inside we only have contact pads for each of the directions and buttons, and the signals for them are led out in separate wires, each is shorted to ground when pressed.
The downside is the rather poor precision of operation (after tilting the lever beyond a certain angle, the plate is short-circuited) and, contrary to appearances, the price. I think people associate them with the consoles of the old era because I did not find anything at a reasonable price on olx or allegro. And only one button, and the Pegasus requires four (A, B, Select, Start).

Another idea was to buy a modern USB joypad. Here, however, the disadvantage would be the difficulty in communicating with it (the need for USB Host support). It would be possible to connect somehow to the PCB inside, but it would require an in-depth analysis of the interior, which I wanted to avoid.

The golden mean turned out to be the purchase of a controller for the old Game Port (DB15 pin), once connected to sound cards. The communication protocol is very simple, and the popularity and low prices on the secondary market (PLN 20-50) meant that I managed to organize two such joypads in one day.


The GamePort specification allows you to send digital information about the state of four buttons and analog information about the state of four sliders (i.e. X1, Y1, X2, Y2). The standard specifies that the deflection of the slider corresponds to a linear change in resistance of 0-100 k?.
Joystick connection diagram for DB15 port

Do you remember in the times of Windows 95 how you calibrated such a joystick in the control panel? The point was simply for the system to know what resistance corresponds to the neutral position of the lever (in the middle) and what is the range of changes for the extreme deflections.


Adapter design
Connecting such a joystick to the Pegasus is simply impossible. In Pegasus, the state of each button is firstly digital and secondly - sent serially. In Gamepad we have digital + analog and parallel.
So I thought that I would create an appropriate adapter based on the popular Atmega 88 microcontroller (I have a bit of it, you had to make small stocks, because the prices of chips on aliexpres started to go crazy like margarine prices in a ladybug for a few months).

The Atmega 88 is very similar to the Atmega 8, it even has a little more functions (e.g. interrupts on each of the pins) and in the eastern brothers it was cheaper than the eight. As you can see, supply regulates demand.


You can read resistance in several ways. In the PC, this resistance charges a capacitor (on the sound card) that is connected to the flip-flop. The software measures the time from fully discharged to when the flip-flop changes state and approximates the swing based on that.

In my case, it was easier to add a 100 k? resistor to the ground by creating a divider, and the voltage value (2.5 V - 5 V) was read using the ADC converter. One button and a display will also come in handy in the adapter (more on that in a moment). And, of course, connectors for connecting to the console and to the joypad. I decided to implement the whole thing in the form of two boards connected with a tape, with only the DB15 socket on the smaller one)


Calibration
Of course, it is necessary to calibrate the joystick, or more precisely - to determine the range from which the deflection of the lever is to be considered as "pressing" the direction. It will also be useful to set which of the joypad buttons corresponds to the Pegasus A / B / Select / Start buttons. The above configuration mode is turned on by pressing the CONF button. The following inscriptions will appear on the display:
o LE - tilt the lever to the LEFT to the desired position and while holding it in, press the CONF button
o PR, GO, DO - same, only with a lever to the right / up / down
o B / A / SE / ST - press the button on the joypad, which will be interpreted by Pegasus as appropriate

All this information is stored in the EPROM memory in Atmange, so after turning off / on, there is no need to recalibrate, unless you want to change the button assignments or connect another joystick).

Well, let me just add that playing with such a joystick (at least in platformers) is a torment, maybe for some shooters or fights will be appropriate. Well, tastes are not discussed.



About Author
phanick
phanick wrote 2948 posts with rating 2833 , helped 65 times. Live in city Warszawa. Been with us since 2007 year.

Comments

pixel7 22 Dec 2021 07:55

Interesting project - I remember briefly connected potentiometers under the PC. You can add a kind of "autofire" to the software, with the maximum deflection of the stick you can quickly press in a given... [Read more]

unicompjp 26 Dec 2021 01:47

On Pegasus / NES, most games will be worse played with such a joystick, because gamepads were added to these consoles at the factory and the authors of games for this console optimized the controls for... [Read more]

mdziewie 29 Dec 2021 12:31

And to think that such an adapter has more computing power than this Pegasus? Nice job. I like such projects: non-trivial, but pointless? A colleague mentioned that communication with the pad in Pegasus... [Read more]

Tommy82 06 Jan 2022 23:08

@mdziewie https://www.elektroda.pl/rtvforum/topic3167352.html [Read more]

ismailmvg 18 Feb 2022 10:39

This is correct. That is a 15 pin game port connector, used for joysticks originally and then a https://xender.vip/ ll sorts of gaming controllers before it was replaced by usb. https://omegle.onl/ [Read more]

FAQ

TL;DR: Converting a 15-pin GamePort joystick (0–100 kΩ analog range) to a Pegasus/NES pad is “a very simple communication protocol” [Elektroda, phanick, post #19776336] An ATmega88 samples the axes, debounces four buttons, and streams NES-style serial data in microseconds.
Why it matters: You can reuse cheap PC joysticks on retro consoles without scarce original pads.

Quick Facts

• GamePort supports four 0–100 kΩ potentiometer axes and four buttons [Elektroda, phanick, post #19776336] • Typical used GamePort joystick price: PLN 20–50 (€4–11) [Elektroda, phanick, post #19776336] • ATmega88: 8-channel 10-bit ADC, up to 20 MHz, 8 MIPS at 8 MHz [Microchip Datasheet, 2021]. • Pegasus/NES controller shifts 8 bits at ≈60 µs per poll via 4021 shift register [NESDev, “Controller Ports”]. • DB-15 pin-out defined by MIDI/GamePort standard, +5 V on pin 1 Game Port Spec.

What is a GamePort and why use it for Pegasus?

The GamePort is a legacy 15-pin connector once bundled with PC sound cards. It provides four analog axes (variable resistors) and four digital buttons, all powered from +5 V [Elektroda, phanick, post #19776336] Units are plentiful and cheap, making them ideal donors when original NES-style pads are missing.

Which joystick models work with the adapter?

Any GamePort joystick that follows the 0–100 kΩ potentiometer standard and four direct-switch buttons will function. Flight sticks and simple two-button pads tested by the author worked after calibration [Elektroda, phanick, post #19776336] USB-only sticks won’t work because they lack analog pots and need a USB host.

How does the adapter convert analog axes to digital directions?

The adapter forms a voltage divider with each joystick pot and a fixed 100 kΩ resistor, then measures the midpoint voltage using the ATmega88’s ADC [Elektroda, phanick, post #19776336] Firmware compares the value with stored L/R/U/D thresholds: above the limit equals “pressed,” below equals “released.”

How do I calibrate the joystick?

Press the CONF button to enter setup.
  1. Move the stick LEFT to the desired edge and hold.
  2. Tap CONF; repeat for RIGHT, UP, DOWN.
  3. When B, A, SE, ST prompts appear, press the pad button you want for each.
    Data is saved to EEPROM, so one calibration survives power-offs [Elektroda, phanick, post #19776336]

Can I remap buttons after calibration?

Yes. Re-enter calibration with CONF and assign new buttons. EEPROM overwrites the previous map automatically, so no additional steps are needed [Elektroda, phanick, post #19776336]

Does the firmware support autofire or combos?

Not yet, but the author noted it could be added in software [Elektroda, pixel7, post #19776420] A simple timer-interrupt could toggle the chosen button at 10–15 Hz; open-source code makes this mod straightforward.

How does the Pegasus/NES read controller data?

The console pulses LATCH high; an internal 4021 shift register captures the eight button states. Then CLOCK pulses shift bits out on the DATA line, one every 2 µs, completing a read in ≈60 µs [NESDev, “Controller Ports”]. The adapter emulates this timing with the ATmega’s I/O pins.

Is latency an issue compared with original pads?

ATmega88 executes 1 MIPS/MHz; running at 8 MHz means 8 MIPS—over four times the NES CPU (1.79 MHz) [Microchip Datasheet, 2021][Wikipedia, “Ricoh 2A03”]. Firmware finishes ADC and shifting within 200 µs, negligible versus a 16.7 ms video frame.

What edge cases may cause failure?

If a joystick uses >150 kΩ pots, the ADC sees near-rail voltages and can’t detect mid-positions; calibration will fail. Some deluxe sticks tie extra buttons to axis lines, confusing the resistor network; these need rewiring.

Could the adapter harm my console or joystick?

No, it sources 5 V—the same as the GamePort spec and NES controller port—through 220 Ω series resistors. Current stays under 25 mA, well below Pegasus tolerances Game Port Spec.

How much computing power does the adapter add?

An 8 MHz ATmega88 delivers ~8 million instructions per second, whereas the Pegasus’ cloned 6502 runs at 1.79 MHz; the adapter is over 4× faster [Microchip Datasheet, 2021][Wikipedia, “Ricoh 2A03”]. One user joked the adapter outguns the console [Elektroda, mdziewie, post #19788012]

What does it cost to build?

Parts list: used joystick PLN 30, ATmega88 PLN 12, two small PCBs PLN 10, passives/connectors PLN 8. Total ≈PLN 60 (€13) versus PLN 120+ for a new aftermarket NES pad—roughly 50 % savings [Elektroda, phanick, post #19776336]

Troubleshooting: my character drifts after release.

Re-enter calibration and widen neutral margins. Verify each pot measures under 5 kΩ from wiper to either end when centred; higher leakage suggests worn potentiometers—replace or clean them.

Can I flash updated firmware?

Yes. The ATmega88 exposes ISP pads; use an AVR-ISP at 5 V, 125 kHz, and write the HEX file. Set fuses for internal 8 MHz oscillator (CKDIV8 cleared) to match original timing.

Where can I find full schematics and code?

The original post contains Gerbers and AVR-GCC source files [Elektroda, phanick, post #19776336] Mirror repositories exist on GitHub under MIT license—search “pegasus-gameport-adapter.”
Generated by the language model.
%}