Crate replay

Crate replay 

Source
Expand description

Rung 5: replay MAME 0.285’s trace of a real game through the core, as the reference’s tests/mame_replay.py does, and print the same report.

replay TRACE_DIR [--limit N]

TRACE_DIR holds cart.pce and error.log (one line per instruction before it runs, PC A X Y S P totalcycles, then M MPR0 ... MPR7, then the hardware-page reads that instruction made, [luaengine] R address value). The core runs in the reference’s minimal harness (harness.py, the part a replay uses: a HuCard, work RAM, a stubbed hardware page, master-clock accounting) from the same reset and is answered from the log, so it sees what MAME’s board gave MAME’s CPU. MAME is a detector here, not a judge: the rung passes when this binary prints what scripts/reference_replay.py prints for the reference core, the report and a digest of the core after every step.

Structs§

Board 🔒
The reference’s minimal harness with MAME’s board behind its hardware-page reads (Harness and Replay).
Counter 🔒
A counter that remembers the order its keys arrived in, as Python’s does.
Divergence 🔒
Line 🔒
One instruction of MAME’s trace: the registers before it, the 7.16 MHz cycle count before it, and the hardware-page reads it made.
Log 🔒
MAME’s trace lines with their reads, lazily, from an error.log.
Replay 🔒
The core and the digest of it after every step the replay makes.
Report 🔒

Constants§

BLOCK_OPCODES 🔒
B_FLAG 🔒
HARDWARE_PAGE 🔒
REGISTERS 🔒
VDC_VCE_MASK 🔒
VECTORS 🔒

Functions§

bank_offsets 🔒
Where in the ROM (in 8 KB banks) each sixteenth of the 128 ROM pages starts (the reference’s harness.bank_offsets, 6ce348e).
commas 🔒
An integer with thousands separators (Python’s {:,}).
hex 🔒
main 🔒
named 🔒
or_else 🔒
replay 🔒