With BareMach I wanted to find out whether I could take a PC emulator to the Raspberry Pi.
In principle it shouldn’t be very hard if I managed to compile it: I had already worked with Circle, a library for programming the Raspberry Pi with no operating system. But I also had to sort out the environment the emulation would run in: the display, the keyboard, access to the media and the Pi’s own boot.
First attempt: BluMach and the PCS 286
I started with the machine I had developed in BluMach, the Olivetti PCS 286. The first problem was the processor: in PCem, 86Box and BluMach the 286 shares code with the 386; they’re so tightly coupled that I had to drag in a pile of dependencies. So I went straight to MAME’s 286 implementation; after all, this was a proof of concept. It did boot in the Docker environment I was using to simulate the Raspberry Pi, but I couldn’t get it to boot on the physical Raspberry Pi, and I stopped there.
Second attempt: CoreMach and the PCS 86
How hard it was to separate what was needed from 86Box and BluMach was one of the reasons for working on CoreMach, the portable engine. BareMach uses the complete portable core: the engine, emulated time, the CPU, the devices and the PCS 86 machine. What BareMach provides is the Pi-specific part: the emulation frequency, the USB keyboard, the HDMI display and the SD card. Split up like that, the core has far fewer dependencies and is much easier to bring to the Pi.
The emulated machine changed too. At that point CoreMach didn’t have the 286 yet, so I used the Olivetti PCS 86. Another machine and another engine, which I thought would be simpler. How naive of me: the V30 is no picnic. (For CoreMach I rewrote the 8088 and the NEC V30 with AI, starting from the interpreter inherited from 86Box, and later the 80286, largely new, from Intel’s documentation. They’re all driven by the clock signal and use the documented timings for each instruction. It’s realistic, yes, but it eats CPU, a lot of CPU.)
This time I did get it to boot on a physical Raspberry Pi 3. It was progress, although the performance isn’t there: on the Pi 3 it runs at 20% of the real PC’s speed, and on a Pi 4 at 50%. I don’t have a Pi 5 to try. The emulation uses a single core and three are left free, but parallelising it doesn’t look easy.
This is what sits underneath, compared with BluMach on a PC:
Booting is nice, but if you can’t use it…
So that’s where it stands: now it’s time to find out what’s holding it back and how to make it faster. And there’s already a clue: in one measurement on the Pi 3 during boot, drawing the image and sending it out over HDMI took close to 60% of the time, and emulating, less than 40%. Even removing all the video, according to that measurement, it wouldn’t go above 31% speed: both need speeding up.
There will be a third attempt, for sure, and a fourth, and a fifth…
The code for BluMach and CoreMach is on GitHub. BareMach’s is still private; I’ll link it when I publish it.
Sources and licences
- Circle, by Rene Stange: the library for programming the Raspberry Pi with no operating system (GPL-3.0 or later). BareMach’s boot code starts from two of its examples.
- First attempt: the 286 came from MAME; the rest from BluMach, derived from 86Box (GPL-2.0 or later).
- Second attempt: BluMach’s portable core, copied unchanged from 23 September 2026, four days before that code was split off as CoreMach. The origin of each part is in the sources section of the CoreMach post.
- BareMach: its own code is GPL-3.0 or later. It doesn’t include BIOS files, disk images or the Pi’s boot firmware.
No BIOS or ROM is distributed. Olivetti and the names of its machines are trademarks of their owners; this project isn’t affiliated with Olivetti.