# The V30MZ on one page Sources are cited by the short names in [sources.md](sources.md): PUM (NEC's V30MZ hardware manual), NECUM (the V20/V30 manual, for NEC mnemonics), WSDEV (the WSdev wiki at the pinned revisions), WSCPU and WSTIME (FluBBa's test programs), WSMAN, STSWS. ## What it is A CMOS 16-bit CPU core NEC sold as a cell for gate arrays (PUM, introduction: "the CPU core of CBIC functions"). Bandai's SoCs embed it: ASWAN (WonderSwan, Pocket Challenge V2), SPHINX (WonderSwan Color), SPHINX2 (SwanCrystal), all clocked at 3.072 MHz (WSDEV "Timing": 12.288 MHz master clock split into four quadrants; the CPU owns one). | Item | V30MZ | Source | | --- | --- | --- | | Instruction set | 8086 + 80186 additions (PUSH imm, PUSHA/POPA, IMUL imm, shifts by imm, ENTER/LEAVE, BOUND, INS/OUTS); **no** V20/V30 extensions | PUM 1.3 (list of removed instructions), WSDEV "NEC V30MZ" | | FPO1 (D8-DF, the 8087 escape) | executes as a NOP | PUM 1.3; WSCPU README (2-byte NOPs); WSTIME README | | FPO2 and other undefined opcodes | "undefined result" (PUM); one- or two-byte NOPs on hardware (WSCPU, WSTIME) | C3 below | | 8080 emulation mode (BRKEM/RETEM, MD flag) | not provided | PUM 1.3 | | Prefetch | 8 words (16 bytes); conditional branches prefetch their target once even when not taken | PUM 3.3 | | Bus | separate address (A19-A0) and data in/out buses, 1 M of memory, 64 K of I/O | PUM 1.3, 2.1, 3.2 | | Prefixes | up to 7 per instruction work, including across interrupts of string instructions; more is undefined | PUM 1.3 | | Interrupts not taken | after MOV/POP SS, after a segment prefix, after REP prefixes, after BUSLOCK; after EI/RETI/POP PSW that set IE (maskable only); NMI held pending | PUM 5.3 | | Undefined flags | may differ from V30HL/V30MX, "especially ... multiply and divide" | PUM 1.3 | | Clocks | Appendix A: 1 clock for most register and immediate ALU forms, MUL 3-4, DIVU 15/23, DIV 17/24, far BR 7, taken Bcc 4, IN/OUT 6, HALT 9 | PUM Table A-1 | Register names: the core uses Intel's names in code (AX, CX, ..., CS, DS, ES, SS, IP, FLAGS) with NEC's beside them in docstrings (AW, CW, ..., PS, DS0, DS1, SS, PC, PSW), as WSDEV and every WonderSwan toolchain do; MAME's debugger uses NEC's (mame-oracle.md). ## Against the family's other x86-shaped work [i8086-python](../i8086-python) is **Phase 0 only** (2026-09-12, documents and oracles, no code; its README's plan is "8086 first, then V30" for Irem M72 and Seibu boards). Read it for the 8086 execution model, ModR/M and prefix rules; it is the closest relative. What differs: | | i8086-python's targets | V30MZ | | --- | --- | --- | | ISA | 8086/8088, then V20/V30 with NEC extensions and 8080 mode | 80186 subset, no NEC extensions, no 8080 mode | | Timing | Intel tables 2-20/2-21 with a 4- or 6-byte queue and EU/BIU overlap; V30 has its own NEC table | PUM Appendix A: a pipelined core, mostly 1-clock, a 16-byte queue, penalties for odd words, EA registers written by the previous instruction, two-register EAs and odd branch targets | | Undefined flags | judged by the SingleStepTests 8088/8086/V20 hardware corpora | judged by WSCPU (run on WS/WSC hardware by its author); no corpus | | Shifts by CL | 8086 does not mask; V20 (per its corpus) does not mask | masks to 5 bits (WSCPU: "argument & 0x1F") | | Hosts | arcade boards at 5-16 MHz | WonderSwan at 3.072 MHz | So the V30MZ is a different chip that happens to share a decode map with the 80186: a variant of a core that does not exist yet would mean designing two cores at once. The proposal (open decision 1) is a repository of its own that **reads** i8086-python's documents and later, if both cores exist, shares nothing but conventions. ## Modelling level Cycle level, with the bus contract the family's 8- and 16-bit cores use: every memory and I/O access is a callback with the clock it happens on. The V30MZ's prefetch makes "which cycle" hard: the SoC's CPU quadrant is the only one that reaches the cartridge bus (WSDEV "Timing"), DMA stalls the CPU, and the cartridge ROM can be 1 or 2 cycles per access and 8 or 16 bits wide (WSDEV "Memory map", "SoC" port A0). The first rungs model instruction timing from PUM Appendix A plus its seven conditions; a prefetch-queue model is a later rung, driven by WSTIME and the board's needs (timing.md). ## Interrupts and the SoC The core has an INT input, an NMI input and an interrupt-acknowledge callback that returns the vector; the WonderSwan's interrupt controller (ports B0-B7) lives in the board, and supplies the vector from its base register (WSDEV "Interrupts"). HALT stops until an interrupt (PUM chapter 6, standby). Reset: CS = FFFFh, IP = 0, FLAGS = F002h (WSDEV "Boot ROM", console power-on state, FluBBa's measurements; MAME 0.285's trace starts in the same state, mame-oracle.md).