Module chip

Module chip 

Source
Expand description

The HuC6270 VDC as the CPU sees it: the bus port, VRAM access, status, IRQ1 (vdc/chip.py).

Instances, not module state: a SuperGrafx has two, a PC-FX may one day pin this module.

Bus ($FF:0000-03FF, 4-byte mirror) [hw: pcetech 5]:

$0  write: register select (low 5 bits); read: status
$1  unused, reads 0
$2  data LSB     $3  data MSB

Provisional (U1, tier 5): the VDC’s CPU access schedule in active display. Hudson’s table and MacDonald’s give the mode-0 slot order (CPU, BAT, CPU, ?, CPU, CG0, CPU, CG1) but not the phase against the line. A VRAM data access made during the display width is accepted at once and committed at the next CPU slot of an 8-dot cycle counted from the display start; BSY (status bit 6) is set until then; a second data access while one is pending holds the CPU (RDY) until the first commits. Mednafen instead charges a statistical 1-cycle penalty (C4).

Differences forced by Rust: the reference’s hold callable (the board’s) is an accumulator here, held, which the board takes when the access returns (take_hold): the reference’s board applies its own sum at the same point.

The board’s wait (issue 0004): the reference’s serve callable, which runs the whole board from inside an access until this chip’s pending access is served, cannot be called here: the board owns this chip and is borrowed for the access (and the device that made it, the SuperGrafx’s VPC, is called again by the board during the wait, to mix a line). serve is a flag instead (wiring, not state: the board sets it on its VDCs). An access that would wait, with the flag set, stops where the reference’s _data_access would call serve, having done only what the reference has done by then, and raises serve_wanted. The board then serves the chip (Board::serve_vram), holds the CPU for served - mclk, and makes the whole decode again; sockets::VdcAccess hands back the results of the VDC accesses made before the stop, makes the stopped one at max(served, mclk), where nothing is pending and it runs through as the reference’s continues, and makes the later ones as the reference does after its wait.

Structs§

Vdc

Constants§

CPU_SLOTS
[hw: pcetech 5.1 register $09] CPU slots within the 8-dot cycle, by VRAM access mode (MWR D1-D0): mode 0 “CPU BAT CPU ??? CPU CG0 CPU CG1”, modes 1 and 2 “BAT CPU CG0 CG1” over two dots each, mode 3 none for the CPU (four-dot accesses, BAT then CG).
VRAM_WORDS
[hw: pcetech 5] 64 KiB; the upper half of the 128 KiB space mirrors it