Palm OS 3.1 runs on an ESP32 at 87% of real time, and the pen path is not emulated
Dragonfruit does not put a Palm OS wallpaper on an e-paper panel. It models the Motorola MC68EZ328, the DragonBall EZ system-on-chip inside the Palm IIIx, closely enough to boot a stock Palm OS 3.1 ROM and run it. The 68000 interpreter, the interrupt controller, the timer, the RTC, the GPIO block, the SPI master, the UART and the LCD controller are written from scratch in portable C, and the same core runs headless on a PC and on the board.
The reference target is M5Paper, an ESP32 board with an e-ink panel and a capacitive touchscreen. On it the emulator reaches the launcher, walks the first-boot wizard, calibrates the digitizer, and accepts Graffiti handwriting. Two artifacts of that journey are worth more than the retro angle: how the speed budget was actually closed, and the one place where fidelity was deliberately dropped.
What the board has to supply
| Part | M5Paper specification | Role in the emulator |
|---|---|---|
| SoC | ESP32-D0WDQ6-V3, dual core at 240 MHz, 16 MB flash | CPU thread plus a second core for the JIT compiler |
| PSRAM | 8 MB, quad | Holds 2 MB of emulated RAM and the 2 MB ROM image |
| Panel | 540 x 960 e-ink, ED047TC1, 16 grey levels | Shows a 160 x 160 1-bit framebuffer |
| Controller | IT8951E over SPI | Refreshes the panel from the composited frame |
| Touch | GT911 capacitive over I2C | Replaces the Palm's resistive panel and stylus |
Two of those are hard requirements rather than nice-to-haves. The emulated RAM and the ROM image must live in external PSRAM, and the JIT compiler needs a second core. Between them they rule out single-core parts without PSRAM, which the project names explicitly: the ESP32-C3 cannot host this.
The reference board is end-of-life. M5Stack's own documentation page for Paper, SKU K049, carries an EOL banner, so the board this build is tuned for is no longer in production. The core is board-agnostic by design, but anyone reproducing the result is buying from the second-hand market.
The machine being modelled
| Item | Palm IIIx as shipped | Modelled by Dragonfruit |
|---|---|---|
| CPU | Motorola MC68EZ328 DragonBall EZ, 68000 core | Same part, interpreted |
| Clock | 16.58 MHz in the project's own comparison, 16 MHz in most spec sheets | 16.58 MHz reference for the speed ratio |
| RAM | 4 MB EDO DRAM | 2 MB at address 0x0 |
| ROM | 2 MB flash, Palm OS 3.1 | 2 MB image loaded from the SD card |
| Display | 160 x 160 | 160 x 160, 1 bit per pixel |
The RAM row is the one to read twice. The bus models 2 MB, which is half of what the IIIx shipped with, and it happens to be exactly what the earlier Palm III carried. Whether that is a deliberate target or an unfinished corner is not stated, but the consequence is concrete: the emulated device is a memory-poorer machine than the one whose ROM it runs, so any application that expects the full 4 MB will find less.
The bus itself is a 24-bit address space with three regions a driver writer would recognise: emulated RAM at 0x0, the ROM window at 0x10C08000, and the DragonBall register block at 0xFFFFF000. The DragonBall model supplies vectored interrupts, a 100 Hz system tick, the real-time clock, GPIO, an SPI master shared by the digitizer and the battery ADC, a UART, and the LCD controller that publishes the framebuffer address.
The tick and the clock are driven from wall-clock time rather than from counted emulated cycles, so both stay correct whether the emulator is running at full speed or crawling through cold code. That is a small design decision with a large effect on usability: Palm OS applications schedule against the tick, and a tick that slows down with the emulator would make every timing-dependent path behave differently from the hardware.
Where the speed goes
There are two performance backends and the project reports both.
The pure interpreter executes the 68000 at roughly 8 MHz. The burst JIT, which translates hot ROM blocks into Xtensa code and caches it in executable memory, brings a settled screen to about 87% of real time. Cold code that runs only a few times is not worth compiling and stays at the interpreter floor, and the project is explicit that closing the remaining gap is a cold-path problem rather than a matter of more JIT tuning.
One number in that section does not reconcile. The README states that the interpreter runs at roughly 8 MHz, about 58% of the real IIIx's 16.58 MHz. Eight divided by 16.58 is 48.3%, and 58% of 16.58 MHz is 9.62 MHz. Taking the more common 16 MHz figure for the IIIx does not rescue it either, since 8 MHz would then be 50%. The raw throughput and the percentage describe machines about 1.6 MHz apart, and a reader planning a port should treat the megahertz figure as the harder of the two.
Two details make the JIT cheaper than a general-purpose one. It compiles ROM only, never RAM, so there is no self-modifying-code invalidation to handle; and its code generator sits behind a backend interface chosen at build time, so a new instruction set is a new backend rather than a rewrite. The Xtensa backend is complete. An ESP32-P4 build links and runs, but interpreter-only, because its RISC-V backend is still to be written.
The one place fidelity is dropped
Everything above is faithful. The pen path is not, and the reason is concrete: injecting touch points through the emulated digitizer hardware fatal-errors on the IIIx. The emulator therefore bypasses its own digitizer model and enqueues pen points through the ROM's EvtEnqueuePenPoint syscall, the device-independent route the project notes other Palm emulators also take.
The observable behaviour survives that substitution. Taps, the silkscreen buttons for Apps, Menu, Calc and Find, and Graffiti handwriting all work over one continuous digitizer surface that the ROM handles natively. What changes is the mechanism: the guest never sees the hardware path it would have seen on real silicon, so any software that pokes the digitizer registers directly is outside what this port has exercised.
This is the general shape of a peripheral port that has to ship. The CPU model can be exact and still be useless if the one peripheral the operating system talks to directly cannot be modelled without faulting, and the workaround is often a system call rather than a hardware register. It is worth reading as a boundary marker rather than a defect.
What goes on the SD card
The ROM is not distributed. Palm OS is copyrighted, so the firmware ships without it and the user supplies an image dumped from a device they own. The card is read from its root at boot, and only one file is mandatory.
| Path | Required | Purpose |
|---|---|---|
| palm.rom | yes | Palm IIIx ROM image, read into PSRAM at boot |
| palm.cfg | no | On-screen layout: relocate, rotate or magnify the silkscreen, plus serial-bridge settings |
| digitizer.cfg | no | Touch sensitivity; written from the panel's current values on first boot if absent |
| install/ | no | .prc, .pdb and .pqa files installed into RAM on every boot |
| backup/ | no | Database backups; hold the UP side button for a second to back up, DOWN to restore |
Two behaviours follow from that design. Emulated RAM is volatile, so anything in install/ is reinstalled on every cold start rather than persisted; and if the card or palm.rom is missing or invalid, the device prints the reason on the e-paper panel and halts rather than booting to an empty screen. Holding the side buttons for a second to back up is a hardware gesture passed through to a guest-side operation, which is a neat demonstration that the keyboard matrix model is real.
Building it
The host build compiles the same core with a shim standing in for ESP-IDF, and is the fast loop: it runs headless, writes a PNG whenever the screen changes, and can open an SDL window.
cmake -S src/host -B build-host
cmake --build build-host
./build-host/dragonfruit -r Palm-IIIx-3.1.rom -c 150000000
The device build runs ESP-IDF inside a reproducible Docker container, while flashing happens on the host, because Docker Desktop on Windows cannot pass COM ports through. Build and flash are two scripts, and the monitor flag opens the serial log at 115200 baud.
./build.ps1
./flash.ps1 -Port COM5 -Monitor
What the repository state says
Dragonfruit is MIT licensed and, as of 2026-10-24, sits at 51 stars and 5 forks. The commit history is a single commit, titled Initial public commit, pushed at 17:45 on 2026-06-08 into a repository created at 17:30 the same day, and nothing has been pushed since. Whatever iteration happened, happened before publication.
That matters for anyone evaluating it: a project with one commit and no follow-up has no public record of the bugs that were fixed after release, so the issues list is empty by absence rather than by resolution. The repository does document its own debts. A reference directory holds three third-party Palm emulators and vendor driver examples, consulted to understand hardware behaviour and explicitly not committed.
Why it is more than a curiosity
Running a fixed-rate 1998 handheld on a modern microcontroller is a small, complete version of a problem that shows up whenever a legacy system has to move onto new silicon. The budget is computable before any code is written: the guest needs 4 MB of its 8 MB PSRAM for RAM and ROM, the interpreter floor is roughly half the guest's real clock, the translator ceiling is about 87% of real time, and the translator needs a whole core to itself.
The fidelity boundary is predictable too. It sits at the peripheral the operating system drives directly, not at the instruction set. On this port that was the digitizer, solved with a syscall; on the next port it will be whatever the ROM touches without a device-independent path, and the fix will be similarly asymmetric.
The emulator itself is at github.com/megabytefisher/Dragonfruit.