Table of Contents

About

While MorphOS runs m68k software seamlessly, it becomes interesting to plug-in real Amiga hardware game controllers in order for MorphOS to become a complete substitute for an Amiga. MorphOS benefits from an USB stack, implemented by a port of Poseidon, the same software that provides USB to the real Amiga. Many game controllers are thus compatible, ranging from generic ones, Sega Megadrive / Genesis controllers and up to perhaps the most famous of them all, the XBox controller.

Obviously, the platforms that MorphOS runs on do not have a DB9 connector, one that is to be found on a real Amiga and that allows plugging in mice and joysticks, such that real Amiga game controllers cannot be directly plugged in. Even if there would be a DB9 port, standard PC hardware that runs MorphOS does not have the necessary CIA controller to be able to interpret the hardware interrupts. Then again, MorphOS runs on standard PC hardware without a CIA such that the controls will be interpreted from the USB port via USB classes.

The Plan

In order to understand how this is going to work, we're going to make an Amiga game controller compatible with standard USB hardware such that it will be recognized by a PC, either under Windows or Linux. Then, the controller will be connected via USB to the machine running MorphOS where it will be picked up like a standard controller by Poseidon. In other words, we'll convert from the Amiga, to a standard PC and then back to the Amiga.

The Build

Fortunately, traditional game controllers are pretty simple in what regards their operation. Specifically, gamepads or D-Pads are really just a large circuit where each button is grounded when the user presses the button and the level shift from high to low is then interpreted by a controller as an action. The older gamepads do not carry any particular chips or macro-technology such that they are literally glorified momentary switches.

The requirements are as follows:

As a game controller, we obtained two paired TenoPLUS gamepads, mostly because of their Amiga-matching color and because they satisfy Amiga controller requirements for most games.

On that note, it should be said that traditionally the Amiga only really recognized up to three buttons yet most of the time just one. Amiga games, the ones that were played with a controller and not with the keyboard and mouse, followed an "Arcade"-like gaming pattern. When 3D games came along, the incredibly famous WSAD-key-mapping was extremely counter-intuitive because gamers expected to be able to use a joystick.

We weren't able to procure an original Waveshare Zero but there are plenty of RP2040 clones that are compatible with the Waveshare Zero.

A circuit was created by mapping the DB9 connector to GPIO pins on the Waveshare Zero RP2040 controller. Generally speaking, we followed the Retro32 guide when the GPIO pins were mapped to the DB9 port but as it turned out, any exact mapping is not necessary as long as the pins of the DB9 connector lead to GPIO pins.

In other words, the pins on the DB9 connector can be mapped to any GPIO pins, except pin number 7 on the DB9 connector that is either connected to $5V$ on the RP2040 or left floating. Similarly, GPIO 0 and GPIO 2, due to software requirements need to be left unmapped to any DB9 pin - these pins will be used to set the software in "configuration mode" in order to setup the RP2040. Generally speaking, Amiga game controllers did not need any power, but were just simple switches, such that the safest option is to let pin 7 on the DB9 controller floating.

A switch is added between GPIO 1 on the Waveshare Zero and ground to allow configuring the software.

The software itself that is used is the GP2040 project that is a generic driver for mapping switches to PC controllers. In this case, the installation instructions are followed, first by flashing the RP2040 with flash_nuke.uf2 to wipe out any firmware remnants, and then by flashing with the firmware at the current date GP2040-CE_0.7.12_WaveshareZero.uf2 that will turn the RP2040 into a game controller. It's easy to enter flash mode with the RP2040 - one just needs to hold down BOOT and then connect to a PC. Similarly, flashing does not require any special environment; the RP2040 will mount as an USB hard-drive once connected in firmware flashing mode and the .uf2 files can just be dragged and dropped into the drive which will make the device flash the firmware automatically.

The button is added to facilitate sending the software into web-configuration mode where the controller will be accessible via a web browser and various settings as well as button mappings can be made. Other projects use a momentary switch - GPIO 1 is usually connected to the game controller "Select" button such that if the gamepad had more buttons then no button the case would have been needed. The rocker switch is a better solution however because it offers some ease of mind when connecting the controller to the PC without having to time holding down a momentary switch with connecting the USB cable.

Software Configuration

With that said, the switch is toggled on and the RP2040 is connected to the PC. The computer will display something about RNDIS drivers being installed, after which the user should visit http://192.168.7.1 in a browser in order to access the web interface that will help configuring the controller.

The first thing to do perhaps is to go to Configuration -> GPIO Pin Mapping using the menu in order to actually map the controller buttons to GPIOs.

Here we advise to clear the entire configuration by clicking the X button next to every pin mapping in order to start cleanly. After that, one option is to press the "Map buttons with ..." button at the bottom of the screen, which will start a wizard that will ask the user to press a button for each function it displays. We actually recommend doing this a different way, scrolling up in order to press the "GPIO Pin viewer ..." button and manually determine which button on the controller corresponds to which GPIO pin and then filling in the mapping form. The wizard does not work so well in case the game controller misses a feature such that mapping manually might even be faster and safer.

The next step is to click Settings on the menu in order to make the following changes:

Submenu Option Setting
Input Mode Settings Current Input Mode XInput
Gamepad Settings D-Pad Mode Left Analog

Note that the tutorial by Retro32 would set D-Pad instead of Left Analog and the result was that the direction pad did not work at all. In case there are any issues, playing with the "D-Pad Mode" settings might lead to different results.

With these changes made, the "Save" button is clicked and the web interface advises restarting the controller. At this point the controller can be plugged into the MorphOS machine and everything should work fine.

Troubleshooting

Here are some tips based on what we noticed and what went wrong that might provide a hint to others trying to reproduce the project: