Skip to content
Phosphoneowiki
Contents

The two backends

A built-in second opinion: the same program can go through the compiled API code, or through the real firmware on an emulated RP2040.

Phosphoneo's two backendsThe same program can take two paths. By default, the linked behaviour: the firmware's API code is compiled into the emulator and answers directly. With --neo-emu, co-simulation: the firmware's real ELF file runs on an RP2040 emulator, and the 65C02 is served on the bus as on the board. The same screenshots and logs come out of both; the reference cases must agree..neo programLinked behaviour (default)API compiled into the emulatorfast, every logcall latency: 0 cyclesCo-simulation (--neo-emu)firmware ELF on emulated RP2040bus served as on the boardlatencies measured in ARM stepsSame outputsPPM, text screenshotsvideo, WAVcomparable statesReference cases are replayed in both backends and must agree.
Two paths for the same program; the outputs are of the same nature and must agree.

The linked behaviour (default)

The API code is compiled into Phosphoneo and answers directly when the 65C02 writes to $FF00. It is fast, and it is the only backend offering every log (--api-log, the trace with effective addresses, stops on an API call). Call latency there is 0 cycles, unless --api-latency.

Co-simulation (--neo-emu)

The firmware’s real ELF file runs on an RP2040 emulator (Cortex-M0+, PIO, DMA, USB, snapshots): the PIO program that serves the 65C02’s bus is the board’s, and DSPHandler runs on ARM. This gives:

  • call latencies in ARM steps (--api-latency-out writes the table);
  • a second opinion: some of the reference cases are replayed in both backends and must agree;
  • the “reload” firmwares (BBC Micro, Oric) that take the bus in bit-bang mode.

Its limits are written in the accuracy page: display, USB and sound are simulated coarsely, the ROM’s floating-point library is simulated, and the API log is not available (the call runs on the emulated ARM there).

Sources in the repository : docs/ACCURACY.md, docs/adr/0001-liaison-firmware-common.md, docs/ETUDE-COSIM.md.