Expand description
The sockets: narrow traits an add-on crate implements to plug into this
board (sockets.py; the reference’s docs/sockets.md).
pcenginecd-rust and supergrafx-rust depend on this crate and never copy
from it, as the reference’s add-ons pin the Python board. Test-only fakes
for each socket live in src/fake_devices.rs; the base board implements
only what it uses.
Numbering follows docs/sockets.md.
CardSlot/Cardthe HuCard slotPortDevicethe expansion port (EXT BUS)PageHandlerone decode for every bus master (the page table is in pagetable.rs)BoardPins::holdbus timing: wait states go through the boardPortDevice::catch_upclock domains: run up tomclk, callable inside an accessIrqLineinterrupt levels, one bit per source, wired-ORPixelPathper-line 9-bit pixels between the VDC(s) and the VCEVideoTimingone record per lineAudioSourcea source with a changeable rate and gainResetKindreset eventsControllerPortthe pad port- Instances
Vdc,Vce,Psghold no module state
Differences forced by Rust:
BoardPinsis handed to a device at every call, not once bybind. The reference’s devices keep the board’s IRQ2 line and itsholdcallable; a Rust device cannot hold a reference into the board that owns it, so each access,catch_upandresetgets&mut BoardPins: the IRQ2 line,hold, the VDC instances (the SuperGrafx’s VPC decodes their page and steers to either), the opcode of the instruction being run (the VPC steers onlyST0-ST2) and, for the port device and the pixel path, the card in the slot (a CD unit answers a Super System Card’s id registers from the card). The reference’s add-ons reach the same things through references they were built with.- A device that is two things in the reference is one trait object
here. The reference’s
VideoPageandVpcshare state by reference (one claims the VDC pages, the other is the pixel path); herePixelPathmay also claim pages. The CD unit’s CD-DA and ADPCM players, appended toboard.audio_sourcesin the reference, are answered byPortDevice::audio_sources, mixed after the PSG and before the board’s own list, which is the reference’s order (PSG, CD-DA, ADPCM). - Save states cannot walk an object graph: every socket trait carries
DeviceState(bytes out, bytes in, an identity for media), which the reference gets fromregister_package. - Pad input: the reference’s host keeps the pad object and sets
pad.pressed; here the board owns the device, soControllerPorthasset_pressed(port, mask).
Structs§
- Board
Pins - What the board hands a card, a port device or the pixel path with every call.
- Card
Slot - The slot. Empty is a real state: it answers $FF, does not ground /CD, and the I/O port’s CD-sense bit follows the expansion port, not the slot (docs/sockets.md).
- Detached
Pins - A
BoardPinswith no board behind it: for a device’s own tests (this crate’s and an add-on’s), which call itsread,writeandcatch_updirectly. - Direct
Path - VDC 1 straight into the VCE.
- IrqLine
- A wired-OR level with one bit per source (never a max).
- Video
Timing - One record per line, handed to anything that mixes or captures video.
Enums§
- Reset
Kind - The PC Engine has no reset button or reset instruction on the console itself; a
CD unit is reset by a register write inside the add-on (docs/sockets.md).
Buttonexists for the Duo/Shuttle-class consoles (unverified).
Traits§
- Audio
Source - A mixer input with a changeable rate and gain. The PSG is board-owned and first in the list; the CD adds CD-DA (44.1 kHz) and ADPCM (variable).
- Card
- A HuCard: standard ROM, SF2, Populous, Tennokoe, a System Card, …
- Controller
Port - What plugs into the pad port: a 2-button pad, a multitap, a 6-button pad, a mouse.
- Device
State - What a save state needs of a socket’s device (the reference walks the object graph).
- Page
Handler - Anything a range of 256-byte pages can be claimed by.
- Pixel
Path - Where the VDC(s) meet the VCE. The default is VDC 1 straight into the VCE; the SuperGrafx’s VPC replaces it, mixing two VDC lines. Line granularity, not dot.
- Port
Device - The EXT BUS device: A0-A20, D0-D7, /RD, /WR, IRQ2, audio in, K7 (I/O port bit 7).