Modern In-Circuit Emulator for the 6809 [Hackaday]

View Article on Hackaday

The Motorola 6809, released in 1978, was the follow-up to their 6800 from four years earlier. It’s a powerful little chip with many 16-bit features, although it’s an 8-bit micro at heart. Despite its great improvements over the 6800, and even technical superiority over the Z80 and 6502 (hardware multiply, for example!), it never reached the same levels of success that those chips did. However, there are still some famous systems, such as the TRS-80 Colour Computer, which utilized the chip and are still being hacked on today. [Ted] is clearly a fan of the 6809, as he used a Teensy 4.1 to create a cycle-exact, drop-in 6809 emulator!

A small interposer board rearranges the Teensy pinout to match the 6809, as well as translating voltage levels from 3.3V to 5V. With careful design, the Teensy matches the cycle diagrams in the Motorola datasheet precisely, and so should be able to run any applications written for the chip! A great test was booting Extended Colour BASIC for the TRS-80 CoCo 2 and running some test BASIC programs. Any issues with opcode decoding or timing would certainly be exposed while running an interpreted language like BASIC. After this successful test, it was time to let the Teensy’s ARM Cortex-M7 rip and see what it could do.

Simply removing the dummy cycles between opcode fetches (necessary in the original chip) led to an immediate speedup of almost 100%. For many computers that used the 6809, this effectively doubles the clock speed from a typical ~1MHz to 2MHz, which is a noticeable and welcome speedup. Mirroring the ROM and RAM inside the Teensy (apparently overclocked to 800MHz!) led to a ridiculous 800% improvement, making many applications and games essentially unusable – though probably breaking the record for the world’s fastest CoCo in the process.

The Teensy emulator plugged into a CoCo 2

The real power of in-circuit emulators is for debugging both software and hardware. In-circuit emulators were essential tools back in the day of 8- and even 16-/32-bit microprocessors. Being able to control the processor from an external machine allows you to view the internal state of the chip while stepping a single cycle at a time if needed. This can help expose issues with hardware surrounding the MCU, although many engineers would also use a large, multi-channel logic analyzer at the same time. Common emulators back then would consist of a large box full of many boards packed with circuitry, all connected to a card inserted into an IBM PC or similar. This could also remove the slow process of burning EPROMs and then having to wait for them to be UV erased during prototyping, as many emulators would include SRAM to act as ROM.

All in all, we think [Ted] did a terrific job and we are hoping to see the project expand, possibly with PC software to control the emulator and show the internal state, just like back in the 80s!



Leave a Reply