Emanuele Laface's Espressif ESP32-Powered Adapter Gives Your Commodore 64 USB Joystick, Mouse Powers

Play joystick games with a mouse, mouse games with a joystick — or just stick with the normal inputs, it's your choice.

Gareth Halfacree
1 month agoRetro Tech / HW101

Maker and vintage computing enthusiast Emanuele Laface has designed an adapter that lets you use modern USB joysticks and mice with the classic Commodore 64 — even using a joystick to play a mouse-only game or vice versa: the USBtoC64.

"This adapter interfaces a USB device with the CONTROL Port of the C64, allowing it to be used as a mouse or joystick," Laface explains. "The joystick connects via pins 1, 2, 3, 4, and 6 of the CONTROL port, with the GPIOs [General-Purpose Input/Output pins] simply set as open circuits or shorted to ground when a joystick direction is pressed. The mouse uses the analog part of the port (Pot X and Pot Y)."

The way the Commodore 64 family interfaced with a mouse is worth a second-look, as it's a relatively tricky thing to emulate. The microcomputers included two analog inputs on the nine-pin joystick ports, which were used to evaluate an analog resistor that charges an internal capacitor; by sending a pulse at exactly the right time, the C64 believes the capacitor is fully charged — allowing a microcontroller to stand in for the analog circuitry of a classic mouse.

That microcontroller is an Espressif ESP32, which includes in its firmware the ability to switch between two modes. In joystick mode, any USB input device is interpreted as a joystick — meaning modern joysticks can be used to play games on an original, unmodified Commodore 64 but also that a USB mouse can be convinced to do the same. In mouse mode, the opposite is true: either a joystick or a mouse can be used to controller Commodore 64 software that expects a mouse exclusively.

"Some controllers may use the USB port to charge a battery (especially if they are also Bluetooth), and this could draw more than 100mA from the C64, potentially shutting down the Commodore (and possibly damaging it)," Laface warns of those looking to build their own adapters. "If you use a controller with a battery, you should remove the battery before connecting it or disable the charging functionality if possible."

Schematics, PCB design files, Gerbers, and source code are available on GitHub under an unspecified license; assembled units are available on Tindie at $18.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles