# The analog path: DAC to beam, what each emulator models, the output contract Source tags as in [start-here.md](start-here.md). Extra tags here: **[mister]** the MiSTer core's `rtl/vectrex.vhd` and `rtl/vectrex_analog_frontend.vhd` (tier 4, pin `33a8299`), **[inf]** our own inference from component values, not sourced and not measured. Every number below names its source. **No hardware-tier source for any timing on this page exists in hand**: no oscilloscope capture, no published measurement. Everything that is a time constant or a delay is either arithmetic from the parts list ([inf]) or an emulator's tuned constant (tier 5). ## 1. The circuit, as drawn Read from the KiCad redraw (tier 3: a community redraw of the factory drawing, CC BY-SA 4.0) and the Service Manual's theory of operation (tier 2, pages 8-9 of its own numbering). The two agree on every point below; the redraw supplies the component values, the manual the intent. ``` VIA PA0-7 --> MC1408 DAC (MSB inverted by Q303) --> LF353 I-to-V (IC304A) --> "DAC" voltage (VOUT) | +---------------------------------------------------------------------------+ | | | (no switch, no hold) CD4052B half X, enabled by PB0 = 0, v channel chosen by PB2:PB1 RAMP switch IC305C --> R319 10k 1% --> X integrator ch 0 -> C304 10 nF -> buffer IC303B -> RAMP switch IC305B IC303D, C313 10 nF -> R316 10k 1% -> Y integrator IC303A, C312 10 nF ZERO switch IC305D + R320 220 ohm ch 1 -> C305 10 nF, unbuffered -> + input of BOTH integrators offset trim R335 via R334 3.3M ("zero reference") ch 2 -> C306 10 nF -> buffer IC303C -> D302 -> Z (brightness) /BLANK (CB2) pulls Z down through R315 2.2k ch 3 -> R329 6.8k / R330 3.3k divider -> R327 33k -> audio (no capacitor: see sound.md) Y integrator: ZERO switch IC305A + R317 220 ohm across C312; offset trim R333 via R332 3.3M. /RAMP = PB7 (via Q301, 2N3905, 3.3k base, 15k to -5 V); /ZERO = CA2 (via Q302, same parts). Integrator outputs -> 75 ohm (R318, R321) -> the monitor board's deflection amplifiers (LM379). ``` Checked on 2026-11-12 by viewing the redraw at 300 dpi (`trash/sch/`, not committed): - **X has no sample-and-hold.** The X integrator's input is the DAC voltage itself, through the RAMP switch. The manual: "This same voltage (designated 'DAC' on the schematic) is the X-axis drive signal" [sm]. So every write to port A moves the X velocity at once, including the bytes the program sends to the PSG (port A is the PSG's bus too). A program that talks to the PSG while RAMP is low bends the line it is drawing. - **Y is sampled**: the DAC reaches C304 only while the multiplexer is enabled on channel 0. - **The zero reference** (channel 1, C305) sets the + input of both integrators: the voltage the beam returns to under ZERO and the voltage both integrators integrate against. The manual calls it 'The "0" reference charge capacitor' [sm]. - **Brightness** is held on C306 and gated by /BLANK. - **Sound** is the fourth channel and has no hold capacitor (the manual: "MPU sound resistive matrix") [sm], [sch]. - The CD4052's other half routes the joystick pots to the comparator ([controllers.md](controllers.md)). ### Naming trap The programmer's "Y" (written first, held) is the schematic's Y and the manual's Y. MAME's `vectrex_v.cpp` stores the live DAC in a slot it calls `A_Y` and mux channel 0 in `A_X` (its comment "DAC output always goes to Y integrator"), the opposite naming; its screen orientation compensates. Not a behavioural conflict; do not copy the names. ## 2. What the component values say ([inf] unless marked) | Quantity | Value | How | | --- | --- | --- | | Integrator time constant | R C = 10 kohm x 10 nF = **100 us = 150 E cycles** | R316/R319, C312/C313 [sch]; Wilkins gives R = 10000, C = 0.01 uF [kw] | | Integrator slope | (V_dac - V_ref) / 100 us | ideal inverting integrator | | ZERO discharge | 220 ohm x 10 nF = **2.2 us = 3.3 cycles**, plus the 4066's on-resistance (not read from its data sheet) | R317/R320 [sch]. Zeroing is not instantaneous: a short ZERO pulse leaves a residue | | DAC swing | about **+/-3.3 V** | MC1408 with 2.7k reference resistor and 3.6k feedback, assuming a 5 V reference (not read). Wilkins **assumes +/-5 V** [kw]: conflict C3 | | Full-scale vector | 3.3 V x (255 cycles / 150 cycles) = about 5.6 V at scale 255, code 127 | above two rows; the LF347 runs on +/-5 V [sch], so long full-scale vectors may reach the op-amp's output limit: **integrator saturation is plausible and unmeasured** (U4) | | Drift | offset trims through 3.3 Mohm from a pot across +/-5 V: at most 1.5 uA against about 330 uA full-scale through 10k, i.e. **up to ~0.5 % of full-scale velocity**, set to near zero by the factory adjustment | R332-R335 [sch]; the manual's "Integrator Off-Set" adjustment [sm, logic board adjustments, pp. 13-15] | | Hold acquisition | C304-C306 10 nF charged through the CD4052's on-resistance (not read) | [sch]; [mister] models the zero-reference channel with a 0.624 us time constant, the others as instant | | RAMP/ZERO asymmetry | the PNP level shifters Q301/Q302 with 15k pull-downs to -5 V switch on faster than off | [inf]; [mister] says the same thing ("the extra 1 us models Q301's release tail") | The monitor side (LM379 deflection amplifiers, yoke, the J-FET deflection-protect switches that cut the drive when the Y output stays near zero) is on the monitor board, not the logic board, and is described in prose only [sm, p. 9, and the "Beam Cut Off" check, p. 16]; Johannsen's experiments (tier 3) say the screen dims and then blanks after "20/50 seconds" without Y deflection and recovers after roughly a (127,0) move for 32 cycles ("vaguely suggest"). The board does not model the monitor; the rasteriser may (open decision 5). ## 3. Delays: what each emulator assumes Between a VIA pin changing and the integrators responding there is propagation and settling. Games are tuned to it (MAME: "Getting this right is important for text placement, the maze in Clean Sweep and many other games"). The five readings below, all in E cycles (666.67 ns): | Signal | MAME 0.285 | Vide (HYPOTHESIS: read from its source) | Vectrexy | vecx / libretro-vecx / VecXGL (HYPOTHESIS) | MiSTer (Videodr0me 2026-10; HYPOTHESIS) | | --- | --- | --- | --- | --- | --- | | port A -> X velocity | 12.75 | XSH 11 | 6 | 0 | about 12 (8 us, with mux and ZERO) | | mux -> Y hold | 12.75 | YSH 11 | 0 | 0 | about 12 | | mux -> zero reference | 12.75 | RSH 0 | 0 | 0 | about 12, then 0.624 us acquisition | | mux -> Z hold | 12.75 | ZSH 0 | 0 | 0 | about 12 | | RAMP on (PB7 falls) | 12.75 | 11 + 0.8 | 5 | 0 | 12.75 (8.5 us) | | RAMP off (PB7 rises) | 12.75 | 14 + 0.9 | 10 | 0 | 14.25 (9.5 us) | | ZERO on (CA2 falls) | 12.75, then an instant reset | 5 | 0 | 0 | about 12 | | BLANK on/off (CB2) | 0 | 0 / 0 (plus `blankOn/OffDelay` 1.0 fractional) | 0 | 0 | 1.5 (1 us) each | | shift register first bit | (VIA model) | SHIFT 2 | (VIA model) | (VIA model) | (VIA model) | | T1 / T2 | (VIA model) | T1 2, T2 1 | | | | | mux select (PB1-2) | | MUX_SEL 2 | | | | Sources: MAME `vectrex_v.cpp` `#define ANALOG_DELAY 8500` (ns) applied by `timer_set` to port A, mux and PB7 changes and to CA2 falling; CB2 through `adjust(attotime::zero)`. Vide: its configuration's per-signal delay table and two fractional ramp offsets, read from its source in Phase 0 (no licence stated, vecx-derived; not fetched since 2026-11-24): the numbers in the column are HYPOTHESIS until seen in Vide's own settings dialog or a run. Vectrexy (MIT) `libs/emulator/src/Screen.cpp`: `RampUpDelay = 5`, `RampDownDelay = 10`, `VelocityXDelay = 6`, `LineDrawScale = 0.85` (a fudge "to make it fit within the grid again"); `DelayedValueStore` defaults to 0, so Y has none. vecx: no delay anywhere (a search of its GPL source in Phase 0; HYPOTHESIS). The MiSTer core's comments call its delay values approximations to the real hardware's propagation, charge and discharge delays (read from its source in Phase 0; HYPOTHESIS; not fetched since 2026-11-24). **None of the five says how its numbers were measured.** Malban's (Vide's author) delay measurements are often cited as "published"; three searches (2026-11-11 twice, 2026-11-12 once) found no such publication, and `vectrex.malban.de` refused TLS. Videodr0me's notes for the MiSTer rebuild (`buymeacoffee.com/videodr0me/vectrex`) describe "calibrated" timing without numbers we could fetch. Treat every column as a **tuned constant, tier 5**: a detector's setting, not a judge. Three shapes of model exist and the board must be able to express all three: 1. one uniform delay on everything analog (MAME, and roughly MiSTer); 2. per-signal integer countdowns with fractional extras (Vide); 3. per-signal delays with RAMP on and off different (Vectrexy, Vide, MiSTer). Other modelled effects: Vide's drift (`drift_x = .09`, `drift_y = -.04`), "efficiency" (a slower beam at high velocity: `efficiency = 5.0`, thresholds 0.91/1.80), noise, optional integrator overflow; MiSTer's saturating integrators and zero-reference acquisition; Vectrexy's `LineDrawScale`. MAME has none of these; its integrator gain is `INT_PER_CLOCK 550` screen units per DAC count per cycle. ## 4. The model the board should implement A discrete-time model stepped once per E cycle, with every constant a named parameter: | Parameter | Meaning | Unit | | --- | --- | --- | | `dac_delay` | port A change -> DAC voltage seen downstream | cycles (float) | | `x_delay`, `y_hold_delay`, `ref_hold_delay`, `z_hold_delay` | per destination | cycles | | `ramp_on_delay`, `ramp_off_delay` | PB7 edge -> integrator switch | cycles | | `zero_on_delay`, `zero_off_delay` | CA2 edge -> ZERO switch | cycles | | `blank_on_delay`, `blank_off_delay` | CB2 edge -> beam | cycles | | `zero_tau` | discharge time constant under ZERO (0 = instant) | cycles | | `hold_tau`, `ref_tau` | sample-and-hold acquisition (0 = instant) | cycles | | `gain` | integrator units per DAC count per cycle | units | | `drift_x`, `drift_y` | constant velocity added while integrating | units per cycle | | `rail` | integrator saturation (None = unbounded) | units | State: the DAC code, the three held values, X and Y integrator outputs (floats), RAMP/ZERO/BLANK as seen by the switches. Fractional delays are applied by splitting the cycle in which the switch acts (Vide's fractional extras show why integer cycles are not enough). Presets, each labelled with its source and tier: **`mame`** (12.75 uniform, BLANK 0, no drift), **`vide`** (the table above), **`vectrexy`**, **`ideal`** (all zero: vecx), and a **`schematic`** preset that fills only what the parts list gives (`zero_tau` 3.3 cycles, everything else from a detector) and says so. Which preset is the default is open decision 5. ## 5. The output contract The board's video output is **timed beam segments**, not pixels: ```python @dataclass(frozen=True, slots=True) class Segment: t0: int # E cycle the segment starts t1: int # E cycle it ends (exclusive) x0: float; y0: float # integrator outputs, in DAC-count x cycles units, origin at the zero reference x1: float; y1: float z: int # the held brightness code, 0-127 (0 = dark) blank: bool # /BLANK low for the whole segment ``` A new segment starts whenever the beam's velocity, brightness or blank state changes; a stationary lit beam (a dot) is a segment with equal ends and a duration. The board appends to a list the host drains; it never decides what a "frame" is (the program does: [start-here.md](start-here.md) "Time"). Coordinates are integrator units, never screen pixels; the rasteriser owns the scale, rotation (the tube is mounted portrait), phosphor persistence, the overlay and the deflection-protect dimming. `raster.py` (optional, not imported by the board) turns segments into an image for a window and for eyeball comparisons with MAME snapshots. ## 6. How two emulators are compared Layered, exact where the hardware is digital, tolerant where it is not: | Layer | What | Comparison | Available from | | --- | --- | --- | --- | | L0 | instruction stream: PC, registers, cycle at each instruction | **exact** | MAME trace ([mame-oracle.md](mame-oracle.md)); the board's CPU | | L1 | VIA register accesses: cycle, R/W, register, value | **exact** | MAME `via.log` (cycle-stamped inside the instruction); the board | | L2 | VIA pin streams: PA, PB (with PB7 from T1), CA2, CB2, IRQ, each change with its cycle | **exact**, given one VIA model | the board; MAME only indirectly (its pin callbacks are not reachable from Lua: not tried further) | | L3 | analog inputs as codes: DAC code, mux state, held Y/ref/Z codes, RAMP/ZERO/BLANK as the switches see them | **exact for a given delay preset** | the board; a detector instrumented the same way | | L4 | segments | **with tolerance**, preset matched to the detector (`mame` preset against MAME, `vide` against Vide) | the board; Vide and Vectrexy keep vector lists internally; MAME cannot export its list (see mame-oracle.md) | | L5 | rasterised picture | by eye, or a coarse image distance | MAME `snapshot()` PNG; our rasteriser | The rule that follows: **a difference in L0-L2 is a bug** (one side's CPU or VIA is wrong, and the data sheets decide); a difference in L3-L5 under the matched preset is a modelling difference to be named, not fixed toward the detector. Matching MAME's picture is evidence that our digital side and our port of MAME's analog assumptions agree, not that either is the hardware. ## 7. What cannot be settled here U1 (real per-signal delays), U2 (gain and screen scale), U3 (drift as shipped), U4 (saturation), U5 (hold acquisition), U6 (ZERO discharge with the 4066's resistance) in [handoff-brief.md](handoff-brief.md). Each would take a console and an oscilloscope; the family has no Vectrex. The factory Test Cartridge Rev 4 (in the library, SHA-1 `e3418055...`) has the "Integrator Off-Set", "DAC Zero", linearity and "Beam Cut Off" patterns the manual's adjustments use: the right programs to run through the model, but their pass criteria are a technician's eyes.