Slack is great. Many smarter people than me also think that Slack is great. Slack is great because its simple and easier to deal with than emails. With all the time it saves me on emails, I relax go the beach write more code send messages via Slack instead.
But while Slack might be great, it does not have a great native client for the Commodore 64. In fact, they have no client for Commodore 64 at all!
Reasoning that “a pull request is better than a complaint”, I’m happy to present the first (and most likely only) Slack client for Commodore 64!
“Team communication for the 21st century” … now backwards compatible with 1985!
The C64 has an extension port called the Userport which, via an adapter, can communicate over RS-232 serial. I connected the Userport to a Raspberry Pi with a artisanal, locally sourced, homemade cable with the UserPort connector on one end, and a usb TTL-RS-232 converter on the other. The fastest I have been able to run this reliably is a solid 1200 baud / 150 bytes per second.
On the Commodore, I wrote an application in 6502 assembly. It uses built-in Kernal ROM functions to read and write the serial port and update the screen.
On the Pi, I wrote a NodeJS app which talks to the Slack RTM API. It is reponsible for translating a simple RPC protocol between the C64 and itself and connecting to the outside world (in this case, Slack). It uses serialport to talk to the USB serial driver.
A simple RPC message format is defined between the C64 and Pi. The description below is all C-style, but of course on the C64 this is all implemented in 6502 assembly.
When the Pi gets a connection to Slack’s RTM api, it kicks off communication with the C64. The protocol follows like this:
When the channel data has finished streaming, we switch to the Channels screen. This shows a scrollable list of all channels and groups, ordered by unread_count, name
.
Hitting [RETURN]
on a channel name sends channel_id
to the Pi and switches to the Messages screen.
When a channel is joined, the Pi app sends the last couple of messages in the channel to the C64. Subsequently, whenever a message for that channel is recieved via the Slack websocket connection, it gets converted into a multiple lines of C64-compatible characters and sent across the serial connection.
Slash commands work too! We use the undocumented chat.command
API found with help from Chrome dev tools :)
Heres an example of the kind of code running on the C64. This is the top level processing loop:
Hardware needed:
Software:
git clone https://github.com/jeff-1amstudios/c64-slack-client && vim c64-slack-client/README.md
It goes without saying (surely?!) that the company named ‘Slack’ is not affiliated in any way with this project. I’m not sure if they would be happy or horrified to see this creation.