The linked firmware
Nearly everything a Neo6502 program does goes through the firmware API. Rather than rewrite it, Phosphoneo compiles it.
The choice: compile, don’t rewrite
The API (console, drawing, sprites, sound, files, keyboard, mouse, blitter, Trinity’s toolbox) is written in C++ in the firmware’s firmware/common/ folder, shared between the board and the official emulator. Rewriting that API in C inside Phosphoneo would guarantee drifting apart some day. ADR-01 therefore chose: compile firmware/common/ as is (MIT licence, by its contributors), with -DIBMPC, and write only what surrounds it.
What is ours
A host layer (src/neo/neo_host.cpp), derived from the official emulator’s, gives the firmware what it expects from the hardware: storage (FIS*), clock (TMRRead), frame counter, keyboard queue, sound, USB serial. The processor, the main loop, screenshots, logs and save states are ours too.
Consequences
- When a 5,2 call draws a line, it is the board’s own code that draws it.
- Firmware news arrives by recompiling: each Trinity version is integrated, and reference screenshots are redone after being looked at.
- One firmware version is pinned in the reference screenshots’ manifest; version lines (the banner) are masked in the fingerprints, so a mere version-number change does not break everything.
Floppy mode
With --floppy, file calls go through the firmware’s FatFs and a POSIX disk layer down to the device: the board’s stack, down to the last link.