Module dma

Module dma 

Source
Expand description

The VDC’s two DMAs and burst mode: VRAM -> VRAM, and VRAM -> sprite attribute table (vdc/dma.py).

[hw: pcetech 5.4; mfr: Hudson HuC6270 manual DCR/SOUR/DESR/LENR/DVSSR]

VRAM -> VRAM: starts when LENR’s MSB is written; one word per two dots (read, then write); SOUR and DESR step up or down by DCR D2/D3 (not by the CR increment), LENR counts down and ends at $FFFF; MAWR, MARR, the read buffer and the write latch are untouched. A transfer that is running when the display period starts is paused and resumes once the VDC is free again (C7: MacDonald, tier 2, and Mesen2 say so; Hudson’s manual says the remainder is not transferred and Mednafen cancels it; resume = false selects that reading). Time: 2 dots per word is Mednafen’s and Mesen2’s.

VRAM -> SAT: armed by a write to DVSSR, started when the display period ends (or every frame with DCR D4); the 256 words are copied at the start and the VDC is busy for 1024 dots, which is three lines at 5 MHz, “four lines after the last active line” as pcetech says (U2). The done interrupt (DCR D0) follows.

Burst mode (CR D6 and D7 clear when the frame starts) is held by the sequencer; the SAT transfer and VRAM DMA are allowed whenever the display is not drawing.

While either runs, CPU VRAM accesses wait (BSY).

Differences forced by Rust: DmaEngine is the state; its methods are impl Vdc here, with the reference’s names behind dma_.

Structs§

DmaEngine

Constants§

DMA_DOTS_PER_WORD
SAT_DOTS
[emu: Mednafen “1024 VDC cycles”; Mesen2 the same]