Homebrew computing

Computers today are designed, by and large, with one purpose in mind: to abstract away the inherent complexity of a black box filled with billions upon billions of electronic switches into something that you can point at, click on, and have your social media feeds pop up, or a game load, or your favourite tunes blare out, and so on.

The earliest computers, by contrast, were built with little to no abstraction: fans of vintage computing will easily recall devices like the MITS Altair 8800, and its multitudinous Altair-bus clones, which dominated early ‘personal’ computing. These boxy machines were programmed by toggling physical switches on their face plates in order to set individual bits of memory to their zero or one (on or off, true or false) states, introducing the program bit-by-bit and word-by-word until there was enough in the machine’s memory to achieve something useful.

Go back still further and the desktop Altair becomes the room-filling Manchester Small Scale Experimental Machine (SSEM), also known as the Manchester Baby. Barely recognisable as a computer to anyone used to modern machines, its 32-bit by 32-word vacuum-tube design is by modern standards laughably limited – but served as inspiration for Daniel Bailey, who decided to create a modern version which would take up less room.


“I wanted to start slow, to make the simplest thing I could, and then continue from there,” Daniel explains of his creations, unique desktop devices dominated by two-dimensional LED displays. “I was inspired by the Manchester Baby. I think it was the beautiful simplicity of it, that the entire state of the system is visible on the ‘screen.’ I just thought ‘that makes things so much easier, you can see exactly what’s going on.’ It’s a great way to introduce someone to how a computer works.

“I thought, ‘I could do that, but I’m not going to go for a big 32 × 32 grid straight away,’ found these little 8 × 8 LED matrix things, thought ‘yeah, I could do that, a few switches, should be fairly easy.”

That 8 × 8 LED matrix, typically found in hobbyist electronics kits for simple animations or scrolling text, forms the equivalent of the wall-sized 32 × 32 matrix of vacuum tubes that powered the Manchester Baby. Each individual LED corresponds to an individual bit – the smallest unit of computing, equal to a zero or a one – in the computer’s memory. Where the Manchester Baby has 32 words of 32 bits each for a total of 1,024 bits of memory – a kilobit – Daniel’s first machine, the C88, has just eight words of eight bits each for a total of just 64 bits.


Taking the first byte

In modern computing, where a mid-range smartphone family might start at a gigabyte of memory – eight billion bits – a computer with 64 bits is a true marvel, and doubly so for the fact it can achieve functional results. “I made this as a hobby project, mostly just to prove to myself that I knew how to build a computer,” Daniel explains. “It’s the simplest possible computer that I could come up with that can do something, well… perhaps not useful, but meaningful.”

The heart of the C88 is a field-programmable gate array (FPGA), a chip whose function is not set in concrete like its mass-produced equivalent the application-specific integrated circuit (ASIC), but with internals that can be connected together like logical building blocks. Using these, an FPGA can be told to act as almost any other type of chip – including the central processing unit (CPU) needed to drive the C88. Programming an FPGA isn’t like programming a normal computer: the chip itself is modified using a hardware description language, and when you’re finished there’s still the software to write.


Having designed a processor for the C88 complete with its own very simple instruction set – an ambitious project for someone who had never worked with FPGAs before – Daniel was faced with using that processor to achieve something. With 64 bits of memory total that’s a challenge, but one to which Daniel proved the equal: programs available for the C88 include a simple calculator, animations which display on the LED matrix, a dice rolling system, and even programs for interacting with external hardware connected to a general-purpose input-output (GPIO) port. Each of these must be entered into the computer by hand, one at a time, by toggling wonderfully tactile metal switches to alter the contents of individual memory locations.

“Then I decided that’s not big enough, I’m going to do a bigger one, and that’s why I made the 32-bit one,” Daniel laughs, referring to the C88’s bigger brother the C3232 and its hefty laser-cut wooden housing. “It was pretty much just scaling up what I had, but I wanted to try some different things. I thought, if I’ve got a 32 × 32 grid I can definitely emulate the Manchester Baby, but I wanted my own CPU in there, and I thought while I’m at it I can have an emulation of the C88 in there, so the 32-bit one can emulate the C88. I thought I might as well, I’ve got space, chuck ‘em all in!”

Like the C88, the C3232 is programmed by hand using toggle switches to alter memory locations one bit at a time. Unlike the C88, the C3232’s impressive LED matrix display shines in rainbow colours – a great crowd puller at the events Daniel tours as a member of the York Hackspace – while it runs a wider range of programs, up to and including anything written for the original Manchester Baby.


“An FPGA is the ultimately flexible piece of hardware,” Daniel explains. “Unfortunately, at the moment, it is a lot harder to get into FPGAs, but I certainly think it’s something hobbyists should be able to do. It means you can do things like this, and do it properly, and you end up with something, usually, that works more efficiently than a microcontroller or other CPU.”
There’s another way to build your own CPU, though, and with FPGAs ticked off his to-do list Daniel has created a third machine: the Mini C88. Inspired by a clone of the C88 built onto an Espruino microcontroller for his younger brother to take to his school’s show-and-tell event, the Mini C88 swaps the relatively expensive FPGA which powers the original design for an Arduino Zero.

Typically, the way to run software written for one computer on a different computer is to use emulation, a software trick which requires significantly more processing power than the original design and which is often less than perfect. For Daniel, “less than perfect” isn’t something worth aiming for, so he took a different approach: Dynamic Binary Translation (DBT), a clever technique for running software from one architecture on hardware using another, to which he was introduced while working at Arm.

Getting right to the core

“Instead of simulating every state change that a real C88 would encounter as it executes a program, we translate – convert – the program from C88 machine code and execute it directly on the Arduino’s Arm Cortex-M0+ processor,” he explains of the technical trickery required to build the Mini C88. “This means we can make better use of the hardware. Instead of storing the current C88 register value in memory somewhere, like an emulator would, we just use the Arm R0 register to store the register value. We don’t need to store the program counter anywhere either, since the Arm architecture has is own program counter to keep track of where it is in the program.

“We are, in essence, hijacking the hardware built into the M0+ for fetching, decoding, and executing a program by giving it a program in the format that it expects but which happens to be equivalent to the C88 program we want to run.” A neat trick, but one with its own particular challenges – including handling C88 instructions for which the Arm instruction set has no equivalent and introducing the ability to alter the speed of execution so you can actually see the program being run step-by-step.

The result is a machine which is as close to the original C88 as possible, yet costs less to build. Built into a smaller, laser-cut acrylic housing – the original C88 being built into the largest project box available at Daniel’s nearest high-street hobbyist electronics outlet, having “bought the biggest project box that I could find and thought ‘right, I’ll make it fit in there,’ then just drilled a few holes and thought ‘that actually looks pretty good!’” – the major features are still there: the 8 × 8 matrix display is present and correct, as are the toggle switches which allow the user to program the Mini C88 and switch it between program entry, display, and runtime modes. Only the GPIO port is missing, a sacrifice of the shift to the Arduino microcontroller.


For Daniel, the C88 began as a simple experiment in building a simple CPU on an FPGA. Its concepts, though, could help bridge the gap between modern, abstract, high-level computing and its increasingly opaque low-level underpinnings. While toggling a program in by hand is tiresome work – especially on the C3232, which requires 1,056 individual switch activations for a program which fills its memory – it makes the way in which any binary computer of any age operates at the very lowest levels painfully obvious, in a way simply reading about transistors can never do.

“Not everyone will be interested in the low-level stuff,” Daniel admits. “There are plenty of people who just want a Raspberry Pi, but for all the people who want to get right down to the lowest level, as I did when I started learning programming and things, this sort of thing would be great, I think. I wish I’d had something like this when I started learning all this stuff!”
Daniel has considered turning the Mini C88 into a built-it-yourself kit, but at present the easiest way to play with his creation is to either find a Maker Faire or similar event to which the C88 and C3232 are being exhibited or play with the simulated version at hsmag.cc/QXPCjQ.

Those interested in its inner workings, meanwhile, can find the VHDL code which turns an FPGA into the C88 processor on hsmag.cc/oTpVBy.

More features from HackSpace magazine