Gamepad rumble support for the Commodore 64

I discovered a way to send 1-bit of data from the Commodore 64 to the Joysticks. And I use this one-bit of data to turn on/off the rumble in the gamepads through the Unijoysticle.

(Note: Spanish version of the video is here)

How does it work

I strongly suggest to view the video (see above) which contains technical info starting at 1:24

As a summary it works like this:

  • The SID generates pulses that goes from 0 to ~1.3v every ~520us
  • Those pulses go to the Joystick POT lines
  • The pulses can be filtered from the CIA #1, Port A, Pins 6 and 7.
  • The Unijoysticle receives the pulses and with the help of a timer and pull-up resistors it does the following:
    • If the line is High, turn on Rumble. Otherwise turn it off.

So, in order to turn on/off the rumble, we just need to do this in our games:

;
; Example that shows all 4 possible combinations
;
lda #%00000000   ;turn off rumble in both ports
sta $dc00

lda #%01000000   ;turn on rumble in port 1. Port #2 is Off
sta $dc00

lda #%10000000   ;turn on rumble in port 2. Port #1 is Off
sta $dc00

lda #%10000000   ;turn on rumble in both ports
sta $dc00

Note: What this discovery is about, is that by combining different well-known C64 features, we can now use to send 1-bit of data to the Joystick ports. For those who are curious about how the ADC works, read this article: Commo Pad, or just Google “Mouse 1351 internals”.

The different parts

The project consist of three parts:

Unijoysticle 2 Flashparty edition

This board is based on the original Unijoysticle 2 board, and includes the following changes:

  • Lines that connects to the POT lines
  • Some external pull-up resistors
  • Improved layout

Schematic and Layout files can be found here: unijoysticle2_flashparty2022

Bluepad32 v3.5.1

This is the firmware that runs in the Unijoysticle device.

  • Includes the code needed to read the POT lines and turn on/off the rumble accordingly.

Pre-compiled binary can be found here: bluepad32-unijoysticle_v3.5.1

Rambo: First Blood, Part II

Things that I did to the game:

  • Took the NTSC (ThunderMountain) version and cracked it
  • Disassembled the game and added comments to it
  • Patched it to support rumble
  • Make it easier to switch weapons (Put Unijoysticle in “Enhanced” mode!). Works by pressing space as well.
  • Added intro and converted it to a single-file game

While doing it I discovered Martin Galway’s Music Debug routine that can be accessed by pressing ‘P’ in the intro. While in the Music Debug routine, press letters A to Z to turn on the different songs. ‘1’ and ‘2’ switches the different music bank songs.

The complete disassembled code can be found here:

Lemans

Things that I did to the game:

  • Took the original cartridge binary, disassembled it and fully commented it
  • Patched it to support rumble
  • Patched other things like: Use joystick instead of paddle, fixed typo in message and other minor things
  • Added intro

The complete disassembled code can be found here:

Flashparty

This project was presented at Flashparty 2022 (a demoscene event), where it got 2nd place in the Wild category.

Many thanks for the organizers, who also setup a Commodore 64 with the Unijoysticle Flashparty edition so that the public can try it.

The “Retro Station” at Flashparty with a C64 + Unijoysticle

Published by ricardoquesada

cocos2d, unicyclist, commodore 8-bit

3 thoughts on “Gamepad rumble support for the Commodore 64

  1. Muy buena la demo locooooooo (la tuya en la FLASH en la categoria WILD!)
    Es mas al final creo que me gane un Unijoysticle (bah no se, en un momento dijeron los que ganaron premios en su categoria pasen a retirar su premio…yo sali 3ero en dos categorias pero como vi que regalaban esos anteojos VR que ni pensaba usar dije ahhh, bueno, nahh, si total no lo voy a usar…bueno tambien habia una gaseosa marca DIA% pero justo habia llevado Naranjus caseros y lo que menos queria era una gaseosa…te hablo siendo esto las 7AM casi…) Bueno y despues no se como o donde escuche que habia UNIJOYSTICLES ! Jaaa, y ahora vi que si, que habia una edicion especial FLASHPARTY2022 de tu hardware ! Jodeeeeeeeeeer ! JAJAJAJA…
    A vos que te copa toda la escena C64 y dar vuelta todo, ahora en la EKOPARTY 2022 va a estar ROBERTO FRESCA, nuestro amigo DEV de MAME una vez mas mostrando todo el laburo que hay para rescatar y revivir juegos cuasi olvidades para preservarlos para las generaciones futuras…si podes ir a la Ekoparty 2022 bien, y si no nos ves por STREAM 2 3 y 4 de Noviembre por twitch o ves despues las charlas en el canal de iutu de la EKO. Abrazo grande loco, segui dandole para adelante maaan !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: