Module sequencer

Module sequencer 

Source
Expand description

The VDC’s vertical state machine and the horizontal events of one line (vdc/sequencer.py).

Provisional, emulator tier 5 (U19): no tier 1-3 source gives the dot at which the vblank flag rises or the raster compare fires. This is Mednafen’s huc6270/vdc.cpp (HSync/VSync/IncRCR and the HPHASE machine), restated in master clocks so that it runs from the board’s one timeline. What is published: the frame layout and “VDS+VSW lines before the first active line”, [hw: pcetech 7]; the flag rules of status bit 5 [hw: pcetech 5]; the RCR range $40-$146 counted from the first active line [hw: pcetech 5.1].

Vertical phases run VSW -> VDS -> VDW -> VCR -> VSW, counted once per line at the end of the displayed width (4 dots before it ends: Mednafen’s HDW_FINAL). The VCE starts the VSW phase at the vertical sync, which is the last three lines of its frame, so with VSW = $02 and VDS = $17 the first line of the display period is frame line 25, as pcetech 7 says.

Horizontal events within a line (dot = the VCE’s dot divider in master clocks, measured from the VCE’s hsync start at the line’s origin):

origin + 237            hsync ends (`HSYNC_CLOCKS`, emu)
+ 8 dots                HDS: the display-start phase begins; a pending line counter step
                        from the previous line is taken here if not yet done
+ (HDS + 1) * 8 dots    HDW: the display width begins; vblank flag test, sprite scan (M3)
+ (HDW + 1) * 8 - 4     HDW final: the line counter steps (RCR compare, phase counters)

Differences forced by Rust: Sequencer is the state; its methods are impl Vdc here, with the reference’s names behind seq_ (the reference’s sequencer calls back into the chip through a reference). The event kinds are an enum where the reference has strings; the list is kept sorted by time with a stable sort, as the reference’s list.sort is.

Structs§

Sequencer
State and events only; the chip owns the registers.

Enums§

Event
VPhase

Constants§

FINAL_DOTS
[emu: Mednafen Cycles_Between_RCRIRQ_And_HDWEnd = 4]
HSW_DOTS
[emu: Mednafen HSW phase counter 8 after leaving hsync]