Slack on the Commodore 64 thanks to Raspberry Pi

We use Slack all the time at Pi Towers. Granted, we often use it for sharing animated cat GIFs and the latest hacks for the office coffee machine, but we are definitely big fans.

Imagine our delight, then, when we heard about a Slack client for the Commodore 64 (another long-standing flame of ours). Our love for the C64 knows few bounds: along with the Sinclair Spectrum and the BBC Micro, it gave many of us here at the Raspberry Pi Foundation a coding kick-start.

The only thing that could make this better is the Raspberry Pi. And guess what’s sitting slap-bang in the middle between Slack and the C64? Only our favourite single-board computer.

This amazing trinity of tech brings our favourite things together for a text messaging party. We just had to figure out how it worked.

Raspberry Pi Slack

The Raspberry Pi accesses the Slack API

It turns out that bringing Slack to the C64 was no easy matter. Jeff Harris is a software engineer and hobbyist game developer in San Francisco. He’s responsible for developing Slack for the C64.

Much as we love it, the C64 is a little long in the tooth, so it needs a little help connecting to Slack’s API. Jeff’s ingenious result is to hook a Raspberry Pi up to it. “The C64 has an extension port called the user port which, via an adapter, can communicate over RS-232 serial,” Jeff says. The solution was to connect the user port on a Commodore 64 to a USB port on the Raspberry Pi, and Jeff created a homemade cable to do just that.

“The fastest I have been able to run this reliably is a solid 1200 baud or 150 bytes per second,” explains Jeff. At 0.00015 MB, it’s not likely to be much use at a LAN party, but it’s good enough for transferring text messages.

Slack client for Commodore64

What is one thing that Slack is missing? A native client for Commodore64! I built this client in 6502 assembly on the C64 side, and a NodeJS app running on a Raspberry Pi, connected to the C64 via a serial connection. More details here: http://1amstudios.com/2016/11/27/c64-slack-client/

Coding Slack in 6502 Assembly

With the hardware hooked up, Jeff set about writing a Slack client for the Commodore 64. “On the Raspberry Pi, I wrote a NodeJS app which talks to the Slack RTM API,” he says.

The Raspberry Pi connects to the Slack API. It then uses the serial port to talk to the USB serial driver.

“On the Commodore, I wrote an application in 6502 Assembly,” says Jeff. “It uses built-in KERNAL ROM functions to read and write the serial port and update the screen.”

In this blog post, Jeff shows how the C64 client code works using C as a demonstration language. If you want to try recreating the project, all the code is available on Jeff’s GitHub page.

It’s great to see the Commodore 64 still being hacked and kept in use after all these years.