Meet the Motorola MC6809

The MC6809 was an 8 bit microprocessor designed by Motorola in the late 70’s. It holds a special place for me because when I was first working in the software industry it represented the pinnacle of microprocessor design for that era. It was never used much, 16 bit processors came out soon after and the world never looked back. But with its clever architecture and instruction set, the 6809 will always be my favorite.

The 70’s was the era of microprocessors. It started in 1971 with the Intel 4004. It was a 4 bit processor and not very capable. But still it was powerful enough to drive early calculators and pinball machines and more significantly it lead to 8 bit, then 16 and 32 bit processors and finally the 64 bit processors that are everywhere today. By the mid-70s, 8 bit processors started to become common. Leading the way was the Intel 8080, the Motorola 6800 and the MOS Technology 6502 (famously used in the Apple II).

The 3 processors dominated the hobby computers of the day, with the 8080 leading the way because Gary Kildall created CP/M to run on it and this gave hobbyists a powerful operating system to run on their shiny new hardware. The 6502 was doing fine because the Apple II was flying off the shelves. The 6800 was left as a niche product. Plenty of 6800 designs were available from MITS (maker of the extremely popular MITS Altair 8800) and others. But none ever gained a foothold.

In the late 70’s Motorola decided to do a major upgrade to the 6800, called the MC6809. This was a total redesign but stayed source level compatible with the 6800. The result was fast and efficient and a pleasure to write code for. Unlike other 8 bit processors the 6809 had extensive addressing modes that made it easy to work with the full 64KB address range. We upgraded the system we were designing at work to use the 6809 and it was a very simple design change from the 6800 we had been using.

Vintage Computing for Today

So 45 years later I resurrected my interest and started to work with the 6809 again. I first took a look at what was available, and there was a lot. Boards, emulators, software tools and plenty of 6809 enthusiast sites. I decided to start with an emulator. There were plenty already written, but I wanted to code up my own. There are tons of fiddly bits when writing an emulator for a microprocessor. Not only do you have to decode the instructions, determine the addressing modes and registers used, and then execute the result. You also have to keep the condition codes updated to be able to branch on the resulting conditions.

Add to this the fact that the Motorola manual for the 6809 is not particularly accurate. I was lucky to find a fellow enthusiast, Matthias “Maddes” Bücher. He maintains a GitHub repository with a live copy of the manual in HTML format. He’s been kind enough to take change requests from me as I find errors in the document. The current copy of the manual can be found here.

So far the emulator runs on a Mac and the ESP8266/ESP32 embedded processors. Thanks to all the 6809 code available around the web, my emulator passes many tests written in assembly. I’ve also incorporated cycle counting so I can know how fast the emulator runs relative to a real 6809. On the Mac it runs hundreds of times faster and on the ESP32 it gets about twice the speed of a 2MHz 6809, the fastest version ever produced.

I’ve also incorporated a “ROM” monitor. It’s currently running as part of the emulator code so it doesn’t take up any of the 6809 address space. But I’m planning on making a version that can be burned into an actual ROM. It can load S-Record files (the binary format used to upload code to the processor), run, single step, and examine registers and memory. It also shows the disassembled version of the current instruction, which is nice for following along.

All this is available in a GitHub repository here.

Coding in Clover

Another project I’ve done is my C-like language, Clover. This language has a long history, starting way back when I wrote m8rscript. Clover started out as a language for tiny embedded microcontrollers, like the Arduino Nano. But more recently I’ve written a back-end targeting native 6809 assembly. Now I can write 6809 code in a high level language. My first plan is to rewrite my BOSS9 monitor in Clover so I can run it on the 6809 natively.

6809 Hardware

It’s cool to be able to run 6809 code on a tiny ESP32 based microcontroller. It outperforms a real 6809 in a postage stamp size package. You just plug it into a USB port on your computer, start up a terminal emulator and you’re talking to the BOSS9 monitor. Plus it has WiFi so you can attach to it remotely as needed. It’s pretty nice.

But nothing beats real hardware for that vintage feel. So I’ve started building a board from scratch. It’s based on a pretty simple design from Jeff Tranter. My biggest concern is getting working 6809 and 6850 parts. These are out of production vintage parts and buying them on eBay can be a sketchy proposition. I’m planning on doing some extensive breadboard testing (if and when the parts come in). Wish me luck.

I’ve recently found a source that seems more reliable for these obsolete parts here. Since I got 5 boards from the PCB fab, I’ll probably buy some of these to see how they are. I’ll write an entire article on the build when I get to it. Stay tuned.


Leave a Reply

Your email address will not be published. Required fields are marked *