Ghost in the machine: a BBC Micro on an FPGA

The BBC Micro was the machine that really got me hooked. The Sinclair Spectrum was the gateway micro, but it was the Beeb that got programming into my veins.

So much so, indeed, that not long ago I finally gave into temptation and bought a BBC Master Turbo on eBay. It didn’t last long. Although fully refurbished, any machine of that age is likely to develop faults, and so it proved. It’s now a repair project.

I can always get my Beeb fix with the BeebEm emulation running on my Windows 10 VM. And it does pretty much everything I’d want to do with a real machine except stutter out hard copy on my Epson dot matrix printer (which is also awaiting repair. -=sigh=-).

And yet… how wonderful would it be to have a physical BBC Micro but using modern components? Well, now I have one. Sorta. And it’s all thanks to that modern marvel, the Field Programmable Gate Array (FPGA).

We’ve been down this road before. I built my own copy of Grant Searle’s CP/M computer where the Z80 processor and all its support chips (bar the RAM) were replicated in an FPGA chip. That time I just followed the instructions and put it in a pretty (well, beige) box.

Then I heard about the BlackIce board from MyStorm. This is yet another FPGA development board supported by a small but enthusiastic community (check out the forum). It’s built around the Lattice Ice40HX4K FPGA chip and if you’re into FPGAs is probably worth checking out, although availability can be sporadic. This is very much an experimental platform, so expect to have to do some work to make stuff happen – it’s not quite plug’n’play.

What got my attention is that some fine chap who goes by the GitHub handle of hoglet67 (aka Dave) has created Acorn Atom and BBC Micro implementations to run on the board. Download, install, plug in a keyboard and monitor and away you go. (Or not.) Better yet, the implementation supports the MMB filesystem meaning that you can have all the floppy disk images you could possibly want on one SD card. It’s an amazingly complete system and you can be running Elite before you know it, assuming you can get peripherals to cooperate.

The BlackIce board has female sockets that support Digilent Pmod modules, so adding VGA display and PS/2 keyboard sockets was as easy as buying a couple of cheap modules and plugging in.

One issue, though, is that you need a monitor that supports a 50Hz vertical refresh rate and very few LCD panels do. I tried pretty much all of mine without luck. I could sometimes get an image but very jumpy. In the end I found that a cheap Samsung LCD monitor works okay-ish via VGA. The image is still a little jittery, though, and I wouldn’t want to use it for long periods. It makes me wonder if it’s time to buy a CRT display from eBay, although I’m not sure how I’ll get that past my More Significant Other. Some people have reported success using VGA-to-HDMI converters.

The other issue is the keyboard. The BlackIce is read-only through the Digilent PS/2 adapter, so any keyboard expecting some kind of signal to wake it up is not going to work. The first time I played with this system I know I found a USB keyboard that worked via an adapter. But when the time came to take some pictures, none of my many boards wanted to play ball.

Following advice on the forum, I hooked up the scope to the Digilent adapter lines C1 (clock) and D1 (data) to see if key presses resulted in signals on those lines. I tried it with an old and somewhat disreputable Dell PS/2 keyboard. Sure enough, there were signals.

Hmm. Just to confirm that the keyboard was nonetheless non-functional, I plugged the board back into the monitor, rebooted and … huh, it works. I hate it when that happens.

It’s alive!

Of course, the keyboard mapping is all to cock, but that’s what sticky labels are for.

Forum members report that using a logic level shifter – from the BlackIce’s 3V3 to 5V for the keyboard – greatly improves keyboard compatibility, so I might give that a go, as an adapter is a fairly simple thing. To be continued…

Still, I now have a working Beeb. One of the BlackIce’s buttons operates as a ‘Break’ key. If you hold down shift and press it, the emulated Beeb will auto-boot the current disk drive. And the MMB image Dave provides boots into a menu offering every game you could possibly want for the BBC Micro, courtesy of the Stairway to Hell collection. And yes, Elite is in there.

The MMB filesystem allows you to copy files to ‘blank disks’ too. So I used the MMBImager utility on my Windows VM to copy some of my favourite ROM images over (including Wordwise, Lisp and Basic Editor).

Yes, it’s Elite … inevitably. The slight blurring is because of a slow shutter speed.

So I’m having fun reacquainting myself with the Beeb. And perhaps, more importantly, I have a system that will help me learn more about FPGAs, something that’s very much on my to-do list.

I often find it’s easier to start with a working solution and play with it than starting something from scratch. Working with FPGAs is not like tinkering with a programming language – you can’t start with ‘Hello world’ and then go from there. There’s a fair bit of work to put in before you get anything testable. So my plan is to take Dave’s BBC Micro solution and break it – but in interesting and educational ways. Thanks Dave.


3 thoughts on “Ghost in the machine: a BBC Micro on an FPGA

  1. Ed

    > So my plan is to take Dave’s BBC Micro solution and break it – but in interesting and educational ways.

    Looking forward to the results!

  2. Mark Kotyk

    I found learning HDL a bit easier using vunit and gtk-wave to build up a large test suite. Too many FPGA projects don’t follow good software practices, which make learning and experimenting difficult.

    Also the round-trip time of vunit is seconds vs 15-20min using vendor toolchains.

    1. Olof Kindgren

      If you’re into best practices learned from SW, I invite you to use FuseSoC for dependency management and coherent EDA tool interfaces. It can be used together with VUnit too. 🙂


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.