# The Z80 sync bus controller and the interrupt vector latch (IM 2) ## What the program does Pac-Man runs the Z80 in interrupt mode 2. It loads I with the high byte of a vector table, writes the low byte to an I/O port (`OUT (0),A` in LOM's example), enables the vertical blank interrupt at 5000, and on each interrupt the Z80 reads a 16-bit handler address from (I x 256 + the latched byte) (LOM). Observed in MAME's start-up trace (mame-oracle.md): `OUT` to port 0 with 0xFA, I = 0x3F, the first interrupt entering 0x3000 (the vector at 3FFA); after 10 s the program runs with interrupts every frame at line 224 (three in three frames). ## Who holds the byte: the NVC285 The Namco **NVC285** custom, "Z80 sync buss controller", sits between the Z80 and the board bus; Midway's manual gives a TTL plug-in replacement, A082-91383-B000 ("Z80 SYNC BUS CONTROLLER (285)", drawn 1980-11-21), with its schematic and layout (PMM pp. 36-37, PDF pages 42-43; DOC). Read from that sheet at 300 dpi: - The 28-pin footprint: GND, 1H, 2H, the board data bus BD0-BD7, CK, R/W, GND on one side; VCC, CS, INT, the Z80 data bus D0-D7, MREQ (the overline reads "WREQ" in the scan; MREQ is the only Z80 signal that fits), RD, IORQ on the other. - A **74LS374** octal latch (U6) on the data bus: the vector latch, loaded by an I/O write and driven onto the Z80's data bus during the interrupt acknowledge (M1 with IORQ). HYPOTHESIS for the exact strobes until the sheet's lower half is traced (U1). - **74LS74** flip-flops clocked against 1H and 2H, and 74LS02 gates: the CPU's accesses are synchronised to the video's 1H/2H phases so the CPU and the video can share the RAMs. **No WAIT line appears on the footprint.** So the controller does not stall the Z80 through WAIT; whether CPU accesses are delayed in some other way (or simply timed into a free slot of the 6.144 MHz video cycle, which the 2:1 clock ratio would allow) is the open question U2. MAME's Z80 runs without waits on this board (its trace's state counts follow Zilog's table); if the schematic shows no stall, MAME and the hardware agree. ## What the board specification needs from z80-python - `request_maskable_interrupt(vector_byte)`: z80-python already takes the byte placed on the bus at acknowledge. The board calls it with the latch's current value at vertical blank when 5000 bit 0 is set, and clears it when the program clears the enable (the enable gates the request; LOM). IM 2 vector fetch is the core's. - Which I/O ports load the latch: every port (the address is not decoded) or port 0 only. LOM says port 0; the 374's clock decode decides (U1). MAME's start-up trace caught one I/O write, to port 0 (`wpiset 0,100,w`), so it cannot decide. - Any I/O read: what the data bus holds (no input port exists): to be read off the sheet; default 0xFF (open bus), FITTED. ## Siblings Pengo (Sega) runs the same arrangement on its own board (PGS, to read). Ms. Pac-Man's auxiliary board plugs into the Z80 socket and carries the Z80 itself ([mspacman-aux.md](mspacman-aux.md)), so the latch stays on the main board.