# Video: the 2001's discrete logic and the CRTC boards The PET draws characters only: screen codes from screen RAM index a character ROM (8 x 8 cells, two sets selected by the VIA's CA2 "GRAPHIC" line, io.md), shifted out as one bit per dot to the built-in monochrome monitor. Bit 7 of a screen code selects reverse video. There is no bitmap mode, no colour, no sprites. Pictures are judged as dots per line per frame against the timing below. ## The static board (PET 2001) (DOC: SCH-2001 sheet 3, drawing 320026 for board 320008) - **Clock:** an 8 MHz crystal (Y1); a 74LS93 divides it to the CPU's phi0 (1 MHz). The dot clock is 8 MHz, eight dots per character, so one character per CPU cycle. - **Screen RAM:** 1K in two 6550 (1K x 4) static RAMs (C3, C4). Its address comes through 74LS157 multiplexers (D2-D4) either from the CPU (BA0-BA9) or from the video counters (SA0-SA9); its data reaches the CPU through 74LS244 buffers (B3, B4). - **Character ROM:** a 6540 (A2), address = screen code bits 0-6, the row counter's three bits and GRAPHIC; SD7 drives the reverse-video flip-flop (74LS74 C1); a 74LS165 (B2) is the dot shift register. - **Vertical states** (the sheet's own legend, two 74LS107 flip-flops): 00 vertical drive, 01 top blank, 11 video on, 10 bottom blank. VIDEO ON is the screen interrupt's source. - **Monitor:** the service display circuit takes TTL video, vertical drive and a horizontal drive marked "64 uS" (DOC: SCH-2001 `video-1.gif`, "Schematic, Service, Display Circuit"): a 15.625 kHz line, 64 CPU cycles a line. - **The CPU and the video share screen RAM without arbitration** on this sheet: the mux selects the CPU whenever it addresses the screen, so a CPU access during the visible part of a line replaces the character being fetched. That is the 2001's "snow", and the reason its KERNAL and well-behaved programs write the screen during retrace (HYPOTHESIS for the exact cycle and the pixel effect: the sheet shows the mux but the select timing needs sheet 1 (U1) and a timing reading of sheet 3; the VICE `PET/hi-res` demo depends on this timing, but its own readme says it was tuned "by hacking on VICE", so it is a detector). - **Lines per frame:** not yet read off the counters (U2). OBSERVED: in MAME's `pet2001n` the KERNAL re-arms PIA1 every 16,666-16,667 cycles (60.0 Hz); 16,666 / 64 = 260.4 lines, so the real count is likely 260 or 261 with a frame of 16,640 or 16,704 cycles (FITTED candidates, to settle from SCH-320349 sheet 7 or SCH-2001 sheet 3's counters). ## The dynamic board (2001-N, 3000, 4000 9") (DOC: SCH-320349 sheets 6-8) - **Clock:** a 16 MHz crystal (Y1, sheet 6) into a 74191 counter giving CLK8 (8 MHz, the dot clock) and CLK1 (1 MHz, the CPU); a 74164 makes "8 phases of CLK1" (BPHI2A-H) that time the DRAM's RAS/CAS and the video latch, so the CPU and the video take turns within each microsecond. - A 6-bit counter (RA1-RA6, 74LS93 + flip-flop) runs at 1 MHz and doubles as the DRAM refresh address: 64 counts, consistent with the 64 us line (DOC, sheet 6). - HORZ DISP ON/OFF, VIDEO ON, VERT DRIVE and HORZ DRIVE come from sheet 6's flip-flops; VIDEO ON goes to PIA1 CB1 (sheet 3). - Whether the dynamic board shows snow: the phase interleave suggests not (HYPOTHESIS; to read off sheets 6-8 at milestone M2). ## The CRTC boards (4000 12", 8000, 8296) - **The chip:** MOS/Synertek 6545-1 (MAME `ub13`, "Synertek SY6545-1" on `cbm8032`, "Motorola MC6845" on `pet4032f`: OBSERVED), clocked at **1 MHz** on 80-column machines, with two characters fetched per CRTC address by external logic (Wolfgang Guenther, 1997, zimmers `6545-english.txt`: "at pin 21 (CLK) of the CRT, only a clock of 1 MHz can be measured, but 2 characters per usec are produced"; a third-party measurement, tier 3). R1 (characters displayed) is 40 on 40- and 80-column machines alike (same source). - **Timing per editor ROM** (zimmers `PET_CRTC.csv`, no author: a detector, checked here against MAME's watchpoints and Fachat's readme): | Editor ROM | R0+1 (us per line) | lines per frame (text) | cycles per frame | Hz | | --- | --- | --- | --- | --- | | 901499-01 (4000, 40 col, 60 Hz), 901474-03 (8032, 60 Hz) | 50 | 333 | 16,650 | 60.06 | | 901474-04 (8032, 50 Hz) | 51 | 392 | 19,992 | 50.02 | | 8296 (European) | 59 | 339 | 20,001 | 50.0 | OBSERVED, MAME `cbm8032` (editor 901474-04): the editor writes R17 down to R0 with R0=$32, R1=$28, R4=$26, R5=$02, R6=$19, R7=$20, R9=$09, R12=$10: the CSV's 901474-04 row exactly, and PIA1's control register is re-armed every 19,992 cycles. MAME's `pet8032` screen (800 x 333 at 16 MHz, 60.06 Hz) agrees with the 60 Hz row. André Fachat's CRTC readme: his 8296D runs "59 cycles/rasterline and 339 rasterlines, which makes 20001 cycles/frame" (tier 3; matches MAME's `cbm8296` 944 x 339 at 16 MHz). - **The retrace interrupt on CRTC boards.** Fachat's CRTC readme (8296D): "The PET standard mode sets PIA1, CA1 to trigger the IRQ at the high-low transistion of the vertical drive signal. This is the inverted CRTC VSync signal", and gives the IRQ's cycle as (R0+1) x (R9+1) x R7 from the first screen cycle (tier 3, one machine). The dynamic board wires VIDEO ON to PIA1 **CB1** (SCH-320349 sheet 3), and in MAME's `cbm8032` trace the KERNAL re-arms PIA1's control register **B** ($E813) at every interrupt (OBSERVED). CA1 or CB1 on the CRTC boards: C3, to settle on SCH-8032029. - Each editor has two register sets (graphics mode: 10 lines per row; text mode: 8), so the frame changes when software switches character set through the editor. - The 50 Hz editors patch the IRQ routine to add one jiffy every 5 interrupts (ROMNOTES): software-visible, nothing for the board to do. - Wrong CRTC values could damage the real monitor (Fachat: "DO NOT RUN those programs!"). An emulator has no such risk; the board draws whatever the registers make, and the host shows a "no sync" picture for values the real monitor could not lock. ## What the board owns The board owns the counters (or the CRTC's outputs), the character ROM lookup, reverse video, the CPU/video sharing of screen RAM, and the dot stream. `crtc6845-python` (if decision 4) owns the CRTC's registers and its MA/RA/DE/HSYNC/VSYNC outputs per character clock. Phosphor colour: two levels, the colour a host choice (no measured phosphor data: no claim).