# The 8259A pair, the 8253 and the 8237A, and the shared-core question Sources: UND `io_pic`, `io_tcu`, `io_dma`; TDB86 chapter on the 8259A (OCR lines ~6880-7080); NEC's own data sheets for the uPD8259A, uPD8253 and uPD8237A in the 1982 NEC Microcomputer Catalog (**NEC82**, pinned; the PC-98's parts are NEC second sources: TDB86 names the slave "uPD8259A"); Intel's 1983 handbook as ibmpc-python pins it (not fetched here: the same parts, cited through ibmpc-python's pin when the core is written). MAME device names in brackets (tier 5). ## 8259A x 2 [pic8259] - **Master** at 00h/02h, **slave** at 08h/0Ah, cascaded on the master's **IR7** (UND `io_pic` head; TDB86's level table lists the slave as uPD8259A IR8-IR15). The LT, HA and DB-P1 use the V50's ICU with no slave (UND). - EOI is the **non-specific EOI** (20h to 00h; UND `io_pic` 0000h). - Vectors: IR0-IR7 = INT 08h-0Fh, IR8-IR15 = INT 10h-17h (UND `io_pic` diagram); the BIOS's ICW2 values follow (MAME VM run, 32 emulated seconds: 607 writes to 00h, of which 606 are 20h, the non-specific EOI, and one is ICW1 = 11h: edge-triggered, cascade, ICW4 needed). - Levels (DOC unless tagged): | Level | Vector | Source of the request | Source | | --- | --- | --- | --- | | IR0 | 08h | 8253 counter 0, the interval timer (100 Hz under the BIOS) | UND `io_tcu` 0071h | | IR1 | 09h | keyboard 8251 | UND `io_kb` | | IR2 | 0Ah | CRT VSYNC, armed by a write to 64h | UND `io_disp` 0064h | | IR3, IR5, IR6 | 0Bh, 0Dh, 0Eh | expansion INT0, INT1, INT2 (the -26's INT0 option) | UND `io_sound` (INT0 among the -26's choices); assignment of IR3/5/6 to INT0/1/2: HYPOTHESIS (U9) | | IR4 | 0Ch | RS-232C 8251 | HYPOTHESIS (U9: UND `io_rs` relates INT 0Bh and IMR bit 3 to an extended RS-232C register; TDB86's master half did not survive OCR) | | IR8 | 10h | printer | UND `io_prn` (IR8); TDB86 ("8 セントロプリンタ") | | IR9 | 11h | expansion INT3 (hard disk) | TDB86 | | IR10 | 12h | expansion INT41 (640 KB FDD) | TDB86 | | IR11 | 13h | expansion INT42 (1 MB FDD) | TDB86 | | IR12 | 14h | expansion INT5 | TDB86 | | IR13 | 15h | expansion INT6 (mouse) | TDB86 | | IR14 | 16h | NDP (8087) | TDB86 | | IR15 | 17h | (reserved) | | ## 8253 [pit8253] - Ports 71h, 73h, 75h, 77h (UND `io_tcu`); later models also answer at 3FD9h-3FDFh, added when counter 1 became the beeper so that a program setting the beep does not touch the original's refresh (UND `io_tcu` table note). - **All three counters share one input clock: 2.4576 MHz on the 5/10 MHz series, 1.9968 MHz on the 8 MHz series** (UND `memsys` 0501h; UND `io_prn` 0042h bit 5). UND `io_tcu`'s own summary table states the opposite pairing; its baud-rate table agrees with `memsys` (9600 baud at 1/16 is a divisor of 16 on the 5 MHz series: 16 x 16 x 9600 = 2.4576 MHz; 13 on the 8 MHz series: 13 x 16 x 9600 = 1.9968 MHz). Contradiction C1, settled by arithmetic. - Counter 0: the interval timer, IR0, mode 3 under the BIOS (UND `io_tcu` 0071h). - Counter 1: **memory refresh on the original, E, F, M** ("must not be changed"); the **beeper frequency** (default 2 kHz, mode 3) on later models (UND `io_tcu` 0073h). - Counter 2: the RS-232C baud clock (UND `io_tcu` 0075h). - On uPD71054 models the 8253 is the 71054 (an 8254-compatible part) inside an ASIC (UND `io_tcu` head): the VM era and later read back counters with the 8254's commands? (U10) ## 8237A [am9517a] - Ports: address and count registers at 01h-0Fh (odd), command/status 11h, request 13h, single mask 15h, mode 17h, clear flip-flop 19h, temporary/master clear 1Bh, clear mask 1Dh, all-mask 1Fh; **bank (page) registers at 21h, 23h, 25h, 27h**; the bank auto-increment mode register at 29h on later models (UND `io_dma`). - Channels on the original, E, F, M, VM2, VF, U, UV (UND `io_dma` first table): | Channel | Built-in use | Expansion | | --- | --- | --- | | 0 | none (the F3, M3 and VM4's SASI) | DRQ00/DACK00 | | **1** | **memory refresh** | none | | 2 | FD interface in 1 MB mode | DRQ20 (last slot only) | | 3 | FD interface in 640 KB mode | DRQ30 | The original-era PC-98 refreshes RAM **with both** an 8253 counter (counter 1 sets the rate) **and** a DMA channel (channel 1 does the cycles): the counter paces, the DMA steals the bus. This matters for timing exactness (U11: the refresh cycle's length and how often it takes the bus). - Clock: MAME runs its 8237 at the CPU clock on the original (5 MHz) and at 15.9744 MHz on the VM and later (`-listxml`, tier 5); the real DMA clock is U12. ## Other small chips (board) 8255A x 2 (system port 31h-37h; printer 40h-46h) [i8255], 8251A x 2 (keyboard 41h/43h, RS-232C 30h/32h) [i8251], uPD1990A / uPD4990A calendar [upd1990a, upd4990a]. See [machines.md](machines.md). ## The shared-core question (with ibmpc-python and the others) | Chip | PC-98 | Other family users (Phase 0 briefs, 2026-11-26) | ibmpc-python's proposal | This Phase 0's proposal | | --- | --- | --- | --- | --- | | 8259A | two, cascaded | ibmpc-python (one 8259A; the AT's pair later), irem-python (uPD71059C) | in-board; extract `i8259-python` when irem-python reaches its interrupt milestone (its decision 3) | **agree, and name the trigger generally: the second family board to reach its interrupt milestone extracts it.** The PC-98 adds what the PC/XT lacks: **cascade** (master IR7, slave INTA sequence, special fully nested mode questions) and the slave's own ICW3. Those belong in the core from the start. | | 8253 | one | ibmpc-python (8253), pc88-python (MAME's `pc8801mk2sr` lists a `pit8253`; Phase 0 running tonight) | in-board, "no second user" (its decision 3) | **the PC-98 is the second user, the PC-88 a likely third: extract `i8253-python` (8253 and 8254/uPD71054 rows)** when the second of these boards needs it, with history from whichever board wrote it first. Open decision 5. | | 8237A | one | ibmpc-python | in-board, "no second user" | **the PC-98 is the second user: same rule, `i8237-python`.** The PC-98 adds the four bank registers as a board concern (outside the chip) and channel 1 refresh. Open decision 5. | | 8255A | two | sms-python's PPI8255 exists; msx, cpc, system16, x68000, ibmpc support extracting `i8255-python` | support the extraction | **support** (the PC-98 needs mode 0; the 320 KB drive link uses port C handshake bits: see fdc.md) | | 8251A | two | none found in the family's briefs | | in-board | | uPD1990A/4990A | one | none found | | in-board | The interface each core needs from the PC-98 side (proposed, provisional): the 8259A's `inta()` returning the vector byte sequence (8086 mode: one byte), its `cas` lines between master and slave as an explicit channel; the 8253's `gate(n, level)`, `out(n)` callbacks and a `clock(ticks)` that the board drives in bulk between observations; the 8237A's `dreq(ch)`, `dack`, `tc` and a memory/I-O callback per transfer, with the bank register supplied by the board.