Worked example · Building

Emulator accuracy with WDD and test ROMs

Emulator developers have long-standing test programs that report exactly which instructions or timings are wrong. That makes emulator accuracy an ideal WDD target: run the test programs, fix the first failure, repeat.

The goal

Make a hobby emulator pass a standard set of CPU instruction and timing test programs.

The verifier

A headless runner that executes each test program and reads its pass or fail result from the screen or serial output.

Why this check: The test programs were written by people who know the hardware; they are precise and impartial.

The set-up

  • Headless mode in the emulator.
  • The test programs and their expected results in the repository.
  • A per-test round cap.

The kickoff prompt

Kickoff

Make every test program in tests/roms pass in headless mode. Run them all, take the first failing one, read its output, fix the emulation, run them all again (no regressions allowed). Keep going until all pass.

How the rounds went

Rounds 1 to 10
Instruction tests: flags and edge cases of a dozen instructions. 9 of 11 programs pass.
Rounds 11 to 30
Timing tests are harder; the agent is pushed to "step back" twice and instruments the cycle counter. 11 of 11.

What worked

  • Running the whole set each round, so a fix that broke an earlier test was caught at once.

What to watch for

  • Timing work can churn; keep each round to one hypothesis.

Build a kit for a task like this

A worked example written to show the method, not a report of a specific project.

Questions people ask

Do I need hardware knowledge for this?

Less than you would by hand: the test programs carry the knowledge. You still need to read the final changes.

More examples