Expand description
Test devices for the sockets (the reference’s docs/sockets.md): every trait is exercised without any add-on.
The first group is the reference’s tests/fake_devices.py, name for name (FakeCard,
FakePort, FakeAudioSource, FakeController, FakePixelPath, ScriptedCpu), used by
tests/sockets.rs as the reference’s tests/test_sockets.py uses them.
The second group (LockstepCard, LockstepPort, LockstepPath) are devices a real game
can run on, so that each socket is driven in lockstep with the same device on the
reference’s side (scripts/pce_trace.py defines them again in Python, line for line): a
card whose RAM replaces the work RAM and that holds the CPU now and then, a port device
with an IRQ2 source of its own and an audio source at another rate, and a pixel path that
decodes the VDC page for two VDCs and mixes their rows. They are not models of any hardware.
Differences forced by Rust: a device gets BoardPins with each call (sockets.rs), so
FakePort::set_irq2 takes them; the reference’s Alarm subclass of FakePort is its
alarm_due field; ScriptedCpu owns the board and a Pins of its own, and what it was
told of the interrupt lines is pins.irq_lines().
Structs§
- Fake
Audio Source - Fake
Card - A card claiming arbitrary page ranges; every access is recorded.
- Fake
Controller - Records SEL/CLR and answers a fixed nibble.
- Fake
Pixel Path - Replaces ‘VDC 1 straight into the VCE’ by mixing two rows: the second wins where its pixel is non-zero (a stand-in for the SuperGrafx’s VPC).
- Fake
Port - An expansion-port device: grounds nothing, but its presence pulls the I/O port’s D7 low and it can hold IRQ2.
- Lockstep
Card - Socket 1 (and 3, 4): a ROM card that also claims banks $F8-$FB, so the work RAM is the card’s, and that holds the CPU for 3 master clocks on every 4096th write to it.
- Lockstep
Path - Sockets 3, 7, 8 and 12, on a machine row with two VDCs: the path claims the VDC pages; a
write made by
ST0-ST2goes to both VDCs, any other write to the first only; a read is the first VDC’s, and a status read also reads (and so acknowledges) the second’s. The mix isFakePixelPath’s: the second VDC’s pixel wins where it is not zero. - Lockstep
Port - Sockets 2, 5, 6 and 9: a port device that claims
$FF:1800-18FF(one register), is present (the I/O port’s D7 reads low), raises IRQ2 by itself forWIDTHmaster clocks everyPERIOD, and owns an audio source. - Lockstep
Tone - Socket 9: a source at 32 kHz with a gain the mixer applies, a fixed pattern.
- Scripted
Cpu - Drives a board’s bus the way the core does: one callback per CPU cycle.
Constants§
- ST_
OPCODES - [hw: HuC6280 hardware manual] ST0, ST1, ST2 are opcodes $03, $13, $23.