In the 1980s, instead of Arduino and Raspberry Pi, there were the 8-bit micros such as the Vic 20, the Commodore 64, the BBC, and the Apple II. A generation of electronics and robotics inventors got their start with these machines.
While I mainly do electronics over on my Maker Hacks site, I asked the community if anyone was interested in retro hardware programming and there was enough interest that I thought it was worth testing the waters!
1980s Electronics Tinkering Versus Today
It’s worth pointing out that the generation of computer nerds before mine got into computers either at University or by building kits. For many, electronics skills came first.
With my generation, things were a little different. Our computers were sold as “easy to use”, and were paid for by our parents. That meant a lot of kids, including me, didn’t dare wire anything up to our computers even though many were meant to be played with in this way. So we read the occasional article or flicked through the books in the library and learned about it, but not by doing anything practical.
That said, a lot of people did use their computers this way, doing everything from hacking the telephone system to rigging up smart homes before “the internet of things” had an internet to connect to.
In particular, the Commodore PET had a thriving cottage industry of sound and joystick interfaces seeing as the computer originally came with neither as standard.
Commodore User Port
Commodore PET and Vic 20
Like the Arduino and Raspberry Pi, the Commodore series of computers have a “general purpose input and output” expansion. This means there are several pins that can be written to at address 56577 (using POKE) or read (using PEEK).
We can connect directly to the user port but that is not wise, so instead grab yourself some user port adapters. They are cheap even for good quality ones from reliable vendors such as Future Was 8 Bit.
You will see the top row of pins are numbered, the bottom row are lettered from A to N. Beware the top pins has a 5v DC pin toward the left and even 9v +/- AC on the far right!
The “Data Direction” is set by the register (DDR) on the 6526 chip and you can set each pin individually as input (0) or output (1). The pins we are most interested in right now are the bottom set, and they are controlled by a byte from 0 to 255
POKEd to the memory address 56579 on the C64/128.
As usual, a good reference is the C64 Programmer’s Reference guide.
Protect Your Retro Machine!
We don’t want to damage our beloved machines by drawing excessive current (in total devices attached to the C64 can draw 450mA but each individual pin is ~100mA) so I am using a tiny LED and an over-spec resistor (1k).
Even so, this is one of the reasons behind me owning an Ultimate 64 rather than doing this kind of thing on my actual Commodores.
You might want to do initial experimentation using a Raspberry Pi and BMC64, which supports an emulated user port, plus allows you to switch between different Commodore models.
Simple User Port LED Blink Example
You will notice, as soon as you wire up an LED as in this most simple of examples, the LED lights up. Don’t worry, you probably don’t have a short, it’s just that the default state of the user port pins!
We are using the Ground and Pin PB0, found on the adapter at location “C”. As you can see in the photographs, I have marked the top of my adapter and the ground and 5v pins to ensure I don’t wire up the wrong inputs and outputs.
These labels are helpful because a lot of the projects out there tend to switch between referencing the back of the machine and the pins on the adapter, so it is good to ensure you are orienting correctly.
Rather than solder, for this simple project I have a couple of nice alligator clip jumper wires and a breadboard. When we get to my project where I connect my C64 to the internet I do solder just to ensure good signal integrity.
We connect Ground from the bottom far-left pin on the user port to the breadboard and bridge from that wire to the shorter leg of our LED with the 1k resistor. The long pin of the resistor is then connected to PB0/”C” on the adapter.
When the pin is turned on or off using
POKE 56577,1 or
POKE 56577,0 we see the LED turn on or off accordingly. While BASIC isn’t super fast, it is fast enough that we need to slow the situation with empty