# The 6522 VIA: what the Vectrex uses, where it should live, what judges it Source tags as in [start-here.md](start-here.md); **[ds]** is the Rockwell R6522 data sheet (text layer read here), **[vice]** VICE's `viacore.c` at the pinned revision. ## How the Vectrex programs it From `Init_VIA` and the drawing routines [bt], confirmed in the MAME access log [ran]: | Register | Value | Meaning | | --- | --- | --- | | `DDRB` (2) | `$9F` | PB7, PB4-PB0 outputs; **PB6 and PB5 inputs** | | `DDRA` (3) | `$FF` | port A all outputs; cleared to `$00` while reading the PSG (`Read_Btns`), then restored | | `ACR` (B) | `$98` | T1 one-shot **with PB7 output**; T2 one-shot timed; shift register mode 6 (shift out under the system clock); no latching | | `PCR` (C) | `$CC` / `$CE` | CA2 manual low / high (ZERO on / off), CB2 manual low (BLANK on); CA1 negative edge. Other values follow from what a routine needs | | `IER` (E) | **never written by the Executive**: /RES "clears all internal registers (except T1 and T2 counters and latches, and the Shift Register)" [ds], so every source is disabled | games that use IRQ enable their own (`$82` CA1 in the light-pen titles, `$A0` T2 in Bedlam, `$C0` T1 in Spike: [cartridge.md](cartridge.md)) | | `T1C-L` (4) | the **scale factor**: `$7F` at reset | latched; a write to `T1C-H` (5), nearly always `CLR