Crate sst

Crate sst 

Source
Expand description

Rung 2: the SingleStepTests huc6280 corpus (Mesen-generated; emulator tier), every case run and judged as the reference’s tests/single_step.py judges it, mask for mask.

sst CORPUS_DIR [--limit N] [--formula mesen|mednafen] [--jobs N]
    [--verdicts DIR] [--opcode XX]

CORPUS_DIR holds XX.json.bin (the corpus’s v1/). The binary layout is the one the reference’s scripts/sst_reader.py reads: little-endian, u32 count, then per test i32 size, 50-byte name, u32 opcode, initial state, final state, u32 num_cycles, u32 recorded, recorded x u32; a state is i32 size, A X Y S P, u16 PC, 8 MPR bytes, i32 n, n x (u32 address, u8 value); a cycle word is RD | WR << 1 | dummy << 2 | address << 3 (21 bits) | data << 24.

The readings, each counted as a mask (the reference’s module docstring gives the reasons): st_write (C1: the corpus records ST0-ST2’s write cycle as an internal one), truncated (a block transfer of which the corpus kept 500 cycles and 500 RAM pairs), block_unknown (a transfer that read an address the case does not list: A, X, Y are not compared and what a tainted byte feeds is not), block_self_overlap (a transfer over its own bytes or stack cells), block_final_unexplained, tma_latch (TMA #$00 returns a register the corpus does not initialise), tsb_z (C12) and decimal_formula (C13: a decimal ADC or SBC that differs under the core’s default formula and passes under Mesen’s).

--verdicts DIR writes one line per case, index verdict masks, into DIR/XX.txt: what scripts/reference_sst.py writes for the reference, so the two cores are compared case for case (scripts/compare_sst.py).

Structs§

Case 🔒
Problem 🔒
A difference, and whether it is one of the final-state ones (A, X, Y or a RAM cell) that block_final_unexplained covers.
Ram 🔒
The case’s sparse RAM over the flat 2 MB, and the bookkeeping the reference keeps in dicts and sets.
State 🔒
Totals 🔒

Constants§

BLOCK_OPCODES 🔒
DECIMAL_ARITHMETIC 🔒
SIZE 🔒
ST_OPCODES 🔒
TMA 🔒
TSB_TRB 🔒

Functions§

load_cases 🔒
Every test in one XX.json.bin file.
main 🔒
own_cells 🔒
The physical cells of a block transfer’s own opcode and operand bytes and the three stack bytes it pushes.
physical 🔒
run_case 🔒
Run one case; return the differences (empty: it passes) and the masks it used.
run_once 🔒
state 🔒
tma_latch 🔒
TMA #$00 returns the hidden latch: the operand byte is the case’s second code byte.
u32_at 🔒

Type Aliases§

Masks 🔒