# Video: the uPD3301, the uPD8257 and the graphics planes ## Text: uPD3301 fed by the uPD8257 The text screen lives in **main RAM**; the uPD8257 DMA controller's **channel 2** copies it, row by row, into the uPD3301 CRT controller's row buffers during display (KAISEKI ch. 5, the 6FD1h routine: "CRT が使う DMAC はチャネル 2", autoload mode; YK-IO 50h/51h, 60h-68h). Each row is 80 character bytes followed by attribute pairs (position, attribute), up to 20 pairs a row (KAISEKI step 8: "1 行の最大アトリビュート数"). MAME's `pc8801mk2sr` boot (OBSERVED, at 32.55 ms): `51h <- 00h` (CRTC reset command), `68h <- A0h` (8257 mode: autoload with channel 2), channel 2 address `F3C8h` (64h <- C8h, F3h), channel 2 count `8BB7h` (65h <- B7h, 8Bh: the top bits select the read transfer, 0BB7h + 1 = 3,000 bytes = 25 rows x 120 bytes), then five reset parameters `50h <- CEh, 98h, 67h, DEh, 13h`, `51h <- 43h`, `68h <- E4h`, `51h <- 20h`. The parameters match KAISEKI's list of what the ROM sets (DMA character mode, 80 characters a row, blink rates, 20/25 rows, cursor mode, scan lines per character 8/10/16/20, vertical and horizontal retrace widths, attribute mode and count). Decoding each bit belongs to the uPD3301's data sheet, which this Phase 0 did not find (U6). **The uPD3301.** No NEC data sheet was found on a host we may fetch from (NEC's US catalogs of 1982 and 1984 do not list it; it was a Japan-market part). It is widely described as an Intel 8275-compatible CRTC with extensions (the 8275 has the same structure: row buffers filled by DMA bursts, reset with parameter bytes, "visual field attributes"); I8275 is pinned as the nearest manufacturer document. Treat every 8275 fact as **HYPOTHESIS for the uPD3301** until a uPD3301 sheet (or the mkIISR Technical Map that youkan cites) is in hand (decision 7). **The uPD8257** (NEC82 p. 665): four-channel DMA, 4 MHz, autoload on channel 2 (the 8257's own feature: channel 3 reloads channel 2, which suits a frame-repeating text refresh). dkong-python keeps an 8257 in its board (its dma.md) for the same chip; extraction when a second family board needs it is decision 4's question. **The CPU pays for the DMA.** While the 8257 transfers a row, the Z80 is held (GAMEPROG: the text screen is fed by DMA, and stopping the DMA lets the CPU run faster). The timing of the bursts (the uPD3301's DMA burst mode and burst spacing, the 8257's cycles per byte) decides how many T-states per line the main CPU loses, and that is **the PC-88's chief timing unknown** (U7). Games that switch the text DMA off to gain speed exist; the rule is measurable on MAME as a detector (cycles per frame with text DMA on and off). ## Graphics Three 16 KB planes (GVRAM 0-2: blue, red, green) at C000h-FFFFh in the CPU's map, 640 x 200 (and a 640 x 400 monochrome mode on high-resolution monitors), selected: - in **independent mode** by 5Ch/5Dh/5Eh (one plane at a time) and 5Fh (back to main RAM); - in **extended mode** (SR and later, 32h bit 6) through 35h bit 7, with the ALU (34h: per plane set/reset/invert/no-op) and the multiplexer (35h: write the ALU output to all three planes, or copy the last read) and compare data (35h bits 2-0) (YK-IO). Display enables per plane and text (53h), the background colour (52h), the palette (54h-5Bh: digital 8 colours, or 512 colours in analogue mode with two writes per entry, 32h bit 5) and the 200-line, 25-line and 40/80-column bits (30h, 31h) complete the picture. In 640 x 400 mode G2DS must be set (YK-IO 53h note). ## Kanji Level-1 kanji ROM at E8h-EBh, level 2 at ECh-EDh (YK-IO; YK-KANJI): address low and high, read the right and left 8 bits of the 16 x 16 pattern, start and end. 128 KB each (`kanji1.rom`, `kanji2.rom`; census.md). ## Unknowns - U6 The uPD3301's parameter and command bits (no data sheet found). - U7 The text DMA's cost to the CPU per row and per frame (burst mode, spacing). - U8 GVRAM access waits per mode (the V1S high-speed bit, independent and extended modes).