# Memory maps: the 68000 side, the Z80 side, and who decodes what Sources, with their tier ([validation.md](validation.md)): **[SNK]** the Neo-Geo Hardware Specification (`reference/docs/manuals/NG.pdf`, tier 2, page numbers given), **[CM]** Charles MacDonald's `mvstech.txt` (tier 3; every test on an NTSC MV2F), **[MAME]** MAME 0.285 `src/mame/neogeo/neogeo.cpp` with line numbers (tier 5, a detector). **[HYPOTHESIS: was wiki Page]**: taken in Phase 0 from that Neo Geo Development Wiki page, which was set aside on 2026-11-26 out of respect for its main author's objection to AI use; no other source read here states it, so it needs new evidence ([provenance.md](provenance.md), "Author respect"). Where sources disagree the conflict number points into the brief's C-list. ## 68000 (12 MHz, cartridge systems) | Range | Size | What | Wait states | Source | | --- | --- | --- | --- | --- | | `$000000-$0FFFFF` | 1 MiB | P1 ROM (cartridge). `$000000-$00007F` is the system ROM's vectors until `$3A0013` is written ("vector swap") | 1 measured on one cartridge [CM:278]; 0 or 1 by a cartridge ROMWAIT pin is [HYPOTHESIS: was wiki Wait cycle] | [CM:179-180, 294], [MAME 1730] | | `$100000-$10FFFF` | 64 KiB | work RAM; `$10F300-$10FFFF` belongs to the system ROM | 0 | [SNK p26], [MAME 1731] | | `$110000-$1FFFFF` | | work RAM mirror | 0 | [CM:295], [MAME 1731 `mirror(0x0f0000)`] | | `$200000-$2FFFFF` | 1 MiB | the "port" zone: P2 ROM bank, bank register, protection chips (see [cartridges.md](cartridges.md)) | 0 measured on one cartridge [CM:280]; 0-3 by PWAIT0/1, "as long as PDTACK is high" for 0/0, is [HYPOTHESIS: was wiki Wait cycle] | [CM:296] | | `$300000-$3FFFFF` | | I/O, the table below | 0 | [CM:281, 297-304], [SNK pp. 9-10] | | `$400000-$401FFF` | 8 KiB | palette RAM, one of two banks (`$3A000F`/`$3A001F`) | 0 | [CM:282, 305], [MAME 1723] | | `$402000-$7FFFFF` | | palette mirror | 0 | [MAME 1723 `mirror(0x3fe000)`] | | `$800000-$BFFFFF` | up to 8 MiB through the bank register | memory card, **8-bit on D15-D8** (MAME: "enabled by /UDS") | 2 (fixed) | [CM:283], [MAME memcard_r 1068-1087] | | `$C00000-$C1FFFF` | 128 KiB | system ROM | 0 | [CM:307], [MAME 1738] | | `$C20000-$CFFFFF` | | system ROM mirror | 0 | [MAME 1738 `mirror(0x0e0000)`] | | `$D00000-$D0FFFF` | 64 KiB | backup RAM, **MVS only**, write lock `$3A000D`/`$3A001D` | 0 | [CM:29, 175, 308], [MAME 1739, save_ram_w 1049] | | `$D10000-$DFFFFF` | | backup RAM mirror (MVS) | | [MAME 1739] | | `$E00000-$FFFFFF` | | nothing | | [MAME 1740] | The AES map differs in three places [MAME 1756-1771]: no backup RAM (`$D00000-$FFFFFF` reads open bus), the memory card is mapped for reads and writes on `$800000-$BFFFFF`, and the input reads at `$300000`/`$340000` go through the controller-port devices (the AES has no DIP switches or coin inputs). The full list of AES/MVS differences is in [aes-vs-mvs.md](aes-vs-mvs.md). **Open bus.** Unmapped reads return "the last word on the data bus, which is almost always the opcode of the next instruction due to prefetch" [MAME 1016-1031]; MacDonald saw `$4E71` (NOP) in his test program for the same reason [CM]. The board must model it as the last bus value, not a constant: the 68000 core's prefetch makes "the last word" well defined if the board records every bus word. `m68000-python` hands every access to the board, so this costs a variable write per access. **Wait states.** `m68000-python` models no wait states; the host adds stall clocks inside the access using `step_clocks` (core README, `cpu.py` `step_clocks`). The board needs a per-cartridge ROMWAIT/PWAIT pair; MAME inserts only the memory card's 2 [MAME 1074, 1086] and lists the ROM-zone waits as a to-do [MAME 32]; MacDonald measured 1 wait on the ROM zone and 0 on the port zone with his test cartridge [CM:278-280]. That "some games rely on wait cycles to perform sufficiently spaced VRAM accesses" (no game named) is [HYPOTHESIS: was wiki Wait cycle] (U-list). **No source gives the ROMWAIT/PWAIT setting per game**: the MAME software list has no field for it. The default should be MacDonald's measured 1/0 until a per-game source is found. ### The I/O area, `$300000-$3FFFFF` The register names, the "Mask" values and the "Chip" column are [HYPOTHESIS: was wiki Memory mapped registers] except where a row cites another source; the wiki itself marked its masks unverified. A `$FE0001` mask means the register repeats every 2 bytes through `$31FFFF` on the same byte lane; MacDonald's coarser decode is 128 KiB blocks [CM:297-305], and MAME's mirrors are in its map [MAME 1715-1740]. | Address | Read | Write | Chip | Notes | | --- | --- | --- | --- | --- | | `$300000` | P1 controller (active low: D C B A right left down up) | | NEO-C1 | mask `$FE0001`; [SNK p11] | | `$300001` | hardware DIP switches (MVS; active low) | any value kicks the watchdog | NEO-F0 / NEO-B1 | C5: which writes kick it; [CM:153-158], [SNK p12] | | `$300081` | bit 7 test button, bit 6 slot-count type; reads DSW2 on MV4 | | NEO-F0 | [MAME 1734 port `TEST`] | | `$320000` | Z80's reply (port `$0C`) | command to the Z80 (raises its NMI) | NEO-C1 | [SNK p12], [MAME 1715] | | `$320001` | bit 7 RTC data, 6 RTC time pulse, 5 4/6-slot, 4-3 coins 4/3, 2 service, 1-0 coins 2/1 | | NEO-F0 | [MAME port `AUDIO_COIN` 1849-1857] | | `$340000` | P2 controller | | NEO-C1 | [SNK p11] | | `$360000-$37FFFF` | open bus | | | [MAME 1716] | | `$380000` | bit 7 0 = AES 1 = MVS, bit 6 memory card write protect, 5-4 card inserted (00 = yes), 3-0 select/start P2/P1 | | NEO-C1 | CD systems differ; [SNK p11-12] | | `$380001` | | controller outputs (P2 bits 5-3, P1 bits 2-0) | NEO-D0 | mask `$FE0071`; [SNK p11], [MAME 929-946] | | `$380011` | | memory card bank (bits 2-0) | NEO-D0 | [SNK p11-12], [MAME 1068-1090] | | `$380021` | | slot number (bits 2-0); on the AES a mirror of `$380001` | NEO-F0 | [MAME mvs_state::io_control_w 976-997] | | `$380031` | | LED latch strobes (1 to 0 latches) | NEO-F0 | MVS LED boards; [MAME 985-990] | | `$380041` | | LED data | NEO-F0 | [MAME 992-993] | | `$380051` | | uPD4990A strobe, clock, data in (bits 2-0) | NEO-F0 | [MAME 957-961]; [system-rom.md](system-rom.md) | | `$380061-$380067` | | coin counters 1/2 and lockouts 1/2 released ("float") | NEO-I0 | write any value; [MAME 963-969] | | `$3800E1-$3800E7` | | coin counters 1/2 and lockouts 1/2 driven ("sink") | NEO-I0 | write any value; [MAME 963-969] | | `$3A0001-$3A001F` | open bus | the system latch, below | 74HC259 | odd byte writes; data ignored; [CM:164-166], [MAME 1719] | | `$3C0000-$3C000E` | LSPC | LSPC | LSPC2-A2 | [video.md](video.md) | | `$3E0000-$3FFFFF` | open bus | | | [MAME 1722] | **The system latch** is a 74HC259 addressable latch: address bits 3-1 pick one of eight bits and address bit 4 is the value written; the data bus is ignored [CM:164-166], [MAME 1719 `write_a3`]. All eight bits are 0 after reset [CM:139-141]. | Bit (A3-A1) | Write `$3A00x1` (bit = 0) | Write `$3A001x` (bit = 1) | | --- | --- | --- | | 0 | `$3A0001` normal video | `$3A0011` shadow (darken) | | 1 | `$3A0003` system ROM vectors | `$3A0013` cartridge vectors | | 2 | `$3A0005` memory card write enable 1 | `$3A0015` card lock 1 | | 3 | `$3A0007` card lock 2 | `$3A0017` card write enable 2 | | 4 | `$3A0009` card "register select" | `$3A0019` card normal | | 5 | `$3A000B` board fix (SFIX) and board Z80 ROM (SM1) | `$3A001B` cartridge S1 and M1 | | 6 | `$3A000D` backup RAM locked | `$3A001D` backup RAM writable | | 7 | `$3A000F` palette bank 0 | `$3A001F` palette bank 1 | Two board consequences: bit 5 swaps **both** the fix-layer ROM and the Z80's ROM at once, so the Z80 must be parked in RAM before the switch (command `$01`, [sound.md](sound.md)); bit 1 swaps `$000000-$00007F` [CM:179-180]; that the cartridge's first `$80` bytes then appear at `$C00000-$C0007F` is [HYPOTHESIS: was wiki Vector table swap], which MAME does not emulate (C10, **provisional**, open). **Vector swap.** After reset the 68000 fetches its SSP and PC from the system ROM's copy at `$000000` [CM:139-141, 179-180] (the latch resets to "BIOS" vectors). MAME traces the first instruction at `$C00404` with SSP `$10F300` for the `euro` system ROM (`sp-s2.sp1`) ([mame-oracle.md](mame-oracle.md)). ## Z80 (4 MHz) | Range | What | Source | | --- | --- | --- | | `$0000-$7FFF` | fixed: the first 32 KiB of M1 (cartridge) or SM1 (board), by latch bit 5 | [MAME 1783, 1135-1137] | | `$8000-$BFFF` | window 3, 16 KiB, bank = port `$0B`'s high byte (8 bits) | [MAME 1784] | | `$C000-$DFFF` | window 2, 8 KiB, port `$0A` | | | `$E000-$EFFF` | window 1, 4 KiB, port `$09` | | | `$F000-$F7FF` | window 0, 2 KiB, port `$08` | | | `$F800-$FFFF` | 2 KiB RAM | [MAME 1788] | Bank numbers are undefined at power-on; the program sets them [HYPOTHESIS: was wiki Z80 bankswitching] (MAME forces values at reset as a hack, C32). The banking chip (NEO-ZMC, or NEO-ZMC2 on later boards) is **on the cartridge** [HYPOTHESIS: was wiki Z80 bankswitching; MAME's chip list, neogeo.cpp:189-199, puts NEO-ZMC on the CHA board but credits the wiki; MacDonald lists a NEO-ZMC2 on the MV2F itself, CM:53], so on the board's side the windows belong to the cartridge object; the board offers the Z80's address bus and the bank-set strobe (a port read of `$08-$0B`; the name `SDRD0` and the `A3-A2 = 10` decode are [HYPOTHESIS: was wiki Z80 port map]). With bit 5 of the system latch at 0 the board's SM1 answers `$0000-$7FFF`; whether the windows still reach the cartridge's M1 then is not stated by any source read (U-list); MAME switches only the fixed bank [MAME 1135-1137]. ### Z80 ports The Z80 puts the whole 16-bit address on the bus for `IN`/`OUT` (B or A in the high byte). `z80-python` passes the 16-bit port address to `read_port`/`write_port` (its `_io.py`). The Decode column (masks) is [HYPOTHESIS: was wiki Z80 port map] where it does not name MAME. | Port (low byte) | Read | Write | Decode | | --- | --- | --- | --- | | `$00` | the 68000's command byte; clears the NMI request | clear the command latch to `$00` | hypothesis: mask `$0C`; MAME: `$00` only, mirror `$FF00` (C11) | | `$04-$07` | YM2610 (A1-A0 to the chip) | YM2610 | mask `$0C` | | `$08-$0B` | **sets a bank**: window = A1-A0, bank = A15-A8; the value read is not defined | `$08`: NMI enable | read mask `$0C`; write mask `$1C` | | `$0C` | (SDRD1; no known use) | reply byte to the 68000 | mask `$0C` | | `$18` | same as `$08-$0B` | NMI disable | write mask `$1C` | Sources: [SNK p12] (the port list), [MAME 1799-1806, 885-889]. That only address bits 3-2 decode the ports (and bit 4 for the NMI pair), so that port `$C0` is a mirror of `$00`, is [HYPOTHESIS: was wiki Z80 port map]; MAME maps `$00` with mirror `$FF00` only and logs the write the puzzledp sound driver makes to port `$C0` (at PC `$0104`) as unmapped. Conflict C11: **provisional**, open for Aubrey (until 2026-11-26 the wiki was followed because it names the decode signals; the puzzledp write is the test case). ## Who decodes what (the board/cartridge line) The board owns everything above except: P ROM and the `$2xxxxx` port zone, the Z80 bank windows, the fix (S) and sprite (C) ROM buses, the ADPCM (V) ROM buses, and the ROMWAIT/PWAIT pins. Those are the cartridge's, through the slot ([sockets.md](sockets.md)). Special chips (SMA, PVC, the KOF98 overlay, the early security chips) sit on those buses and need nothing more from the board, except the per-slot selection on multi-slot machines.