A free, clean-room implementation of the DSP-2, the NEC coprocessor in Dungeon Master, under the GPL. It answers the chip's commands with the same results as the original, so emulators can run the game without the original chip's program, which is the console maker's code.
Every read Dungeon Master made of the original chip in two recordings (over 12 million) is the same here; every command but one is exact on random input too (docs/exactness.md).
#include "dsp2/Dsp2.h"
dsp2::Dsp2 chip;
chip.writeData(byte); // the data register: commands, inputs (all transfers are bytes)
uint8_t b = chip.readData();
uint8_t s = chip.readStatus(); // always 84h: ready, 8-bit transfers
auto state = chip.saveState(); // for save states: a small blob, the same on every platform
chip.loadState(state.data(), state.size());Map the data and status registers where the cartridge board puts them. The class answers at once.
cmake -S . -B build && cmake --build build && (cd build && ctest)
build/dsp2_check RECORDING... # replay traffic recorded with the original chipMade by StackBlender for Super Apollo, an emulator that plays SNES games fast with their music at normal speed. Its other chips are published the same way: snes-dsp1, snes-cx4, snes-dsp4.
Clean room: written from the public list of the chip's commands (their names only) and from measuring what the original answers, never from the original program's bytes or a disassembly of it, which nobody on this project reads. It is checked against the original running in the ares emulator, answer for answer; the tests take the original from the emulator at run time, and it is never in this repository. The rules: docs/clean-room.md.
GNU General Public License, version 3 or (at your option) any later version; see LICENSE. For other terms, contact StackBlender.