Repository navigation
A complete SPC700 in dampf's emulator, with its timers and I/O registers - #97
Merged
Merged
Conversation
The emulator ran the 17 opcodes of the kit's forwarding driver and stopped on any other, so Krautrecker's music driver (ADR-6FYT4Z4T) could not run in it. Spc700 now runs all 256 opcodes cycle by cycle, every bus cycle in the chip's order, dummy reads included; Spc700SingleStepTest checks it against the SingleStepTests SPC700 suite with -PcpuTests (161,095 tests pass with -PcpuTests=1000: registers, flags, memory and every cycle). Apu adds the I/O registers a driver uses: CONTROL ($F1: timers, port clears, the boot ROM), timers 0-2 with their targets and counters, and the registers the boot ROM leaves at its jump. The boot ROM stays behaviour; a read of it stops with a message. The examples' sound logs are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Small programs uploaded through the boot protocol check what the SPC700 suite does not: timer 0 counts at its target, a register write lands in the RAM too, the boot code jumps with SP $EF, Y 0 and the address in $00-$01, CONTROL clears the ports from the CPU, and a read of the boot ROM stops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
skerkewitz
approved these changes
Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
dampf's emulator gets a complete SPC700. Until now it ran only the 17 opcodes of the kit's 21-byte forwarding driver and stopped on any other, so Krautrecker's music driver could not run in it. This is the first step towards SNES music from Krautrecker's zips; the decision that the music driver is our own and lives in Krautrecker is ADR-6FYT4Z4T.
The examples behave exactly as before: the forwarding driver takes the same cycles.
How
dampf/emu/Spc700.java: all 256 opcodes, cycle by cycle. Every bus call is one cycle (a read, a write or an idle cycle) in the chip's order, dummy reads included. Those matter, because reading a timer counter clears it. The cycle sequences follow ares's; the suite confirms them.dampf/emu/Apu.javauses it in place of the old subset, and adds the I/O registers a driver uses:$F1): timers on or off, port clears, the boot ROM mapping;$EF, A, X and Y 0, the address in$00-$01.Verified
Spc700SingleStepTestagainst the SingleStepTests SPC700 suite (MIT): with-PcpuTests=1000, all 161,095 tests in the first 200 KB of each opcode's file pass: registers, flags, memory, and every bus cycle with its kind and address. Like the 65816 test it only runs with-PcpuTests(300 per opcode by default), so CI doesn't download the suite.[d]+Yreads,movw ya,d,sleep/stop).ApuTest: timer 0 counts at its target, writes to the registers land in the RAM too, the boot code's registers at the jump, CONTROL clears the ports, and reading the boot ROM stops../gradlew build: 1,273 tests, 2 failed, 14 skipped. Both failures are today's random loop programs, seeds 20787012 and 20787028 ("PC vs SNES from MIR"). They fail ondeveloptoo, with the oldApu.javaput back, so they are miscompiles already in dampf, not caused by this change. I'll fix them in separate pull requests; CI here will fail on them until then. Everything that runs the emulator passes,ExamplesTestincluded, with unchanged sound logs.What follows
StyleGuideTest, the game: unaffected.docs/testing.mddescribes the SPC700 and its validation.🤖 Generated with Claude Code