# Memory map, I/O map and the SoC's small units All facts are WSDEV at the pinned revisions unless another source is named; pages are named in brackets. The full I/O map is the "I/O port map" page (28 KB); this page groups it by owner so each class in the board owns a range. ## Memory (20-bit physical) | Range | Bus | Width, speed | Access | | --- | --- | --- | --- | | 00000-0FFFF | internal RAM (16 KiB on mono, 64 KiB on colour: WSMAN "quadrupling the RAM"; what mono reads above 3FFFh is U5) | 16-bit, 1 cycle | RW | | 10000-1FFFF | cartridge, mapper's RAM bank (SRAM, or flash on 2003 with port CEh) | 8-bit, 1 (colour) or 2 cycles, port 60h bit 1 | RW | | 20000-2FFFF, 30000-3FFFF | cartridge ROM banks 0 and 1 | 8/16-bit, 1/2 cycles (port A0h bits 2-3) | R | | 40000-FFFFF | cartridge ROM linear (EX) bank, top 768 KiB of a 1 MiB bank | as above | R | | FF000-FFFFF (mono), FE000-FFFFF (colour) | boot ROM, until locked out (port A0h bit 0) | internal | R | ["Memory map", "SoC", "Boot ROM"] Internal RAM layout: vectors at 0000h, tile data from 2000h (2bpp) or 4000h (4bpp), palette at FE00h-FFFFh (colour); screen maps on 2 KiB boundaries, sprite table on 512 B, wave table on 64 B. STSWS has an "Open Bus" section to read when settling U5. ## I/O ports by owner | Range | Owner (board class) | Page | | --- | --- | --- | | 00h-3Fh | display: control, scroll, windows, sprite table, LCD, mono shades and palettes | "Display/IO Ports" | | 40h-52h | general DMA (40h-48h), sound DMA (4Ah-52h), colour only | "DMA" | | 60h, 62h | system control 2 and 3 (colour mode, 4bpp, wait states, power off, SC id) | "SoC" | | 64h-6Bh | Hyper Voice (colour) | "Hyper Voice" | | 70h-77h | SwanCrystal TFT configuration, writable only before boot ROM lockout | "Display/IO Ports" | | 80h-9Fh | sound | "Sound" | | A0h | system control (boot ROM lockout, colour flag, ROM width and wait, cartridge test OK) | "SoC" | | A2h-ABh | timers (HBlank, VBlank: control, reload, counters) | "Timers" | | B0h-B7h | interrupt controller (vector base, enable, status, acknowledge, NMI control) | "Interrupts" | | B1h, B3h | UART (9600/38400 baud on the EXT port) | "UART" | | B5h | keypad scan | "Keypad" | | BAh-BFh | internal EEPROM | "EEPROM" | | C0h-FFh | cartridge mapper (C0h-C3h common, C4h-C8h 2001's EEPROM, CAh-D4h 2003's RTC, GPO, self-flash and wide banks) | "Mapper", "Bandai 2001", "Bandai 2003", "KARNAK" | ## Interrupts Eight hardware sources at vector base V (port B0h) + 0..7: UART send ready (level), key pressed (edge), cartridge IRQ (level), UART receive ready (level), line match (edge), VBlank timer (edge), VBlank (edge), HBlank timer (edge) ["Interrupts"]. WSHW adds what the hardware does: requests are latched until acknowledged through B6h, disabling a source in B2h does not clear its latch, level sources cannot be acknowledged while asserted, INT stays asserted while any bit of B4h is set, and the vector is always the highest enabled one. The six CPU interrupts (0-5) are the V30MZ's. ## Timers Two down-counters clocked by HBlank and VBlank ["Timers"]. WSHW describes the order of operations: count down whenever non-zero, raise the interrupt on reaching zero, reload if repeat is set, and write back only when the timer is on; so a stopped timer at 1 still interrupts once. Writing a reload value updates the counter at once; toggling on/off does not reload. Port A3h's test bits split the counters (["SoC"], "exact behaviour still unknown": U6). ## DMA (colour) General DMA: the CPU stalls at once; 5 + 2 x words cycles; only 16-bit, zero-wait sources; an SRAM or slow-ROM source ends the transfer at once; invalid or zero-length requests cost nothing ["DMA"]. Sound DMA: byte-wise, any source including SRAM, takes 6 + N CPU cycles every 128, starting at cycle 117 mod 128 ["DMA"]. ## Keypad and UART Keypad: a 3 x 4 matrix scanned through B5h; the PCV2 has a different layout and matrix ["Keypad"]. UART: one channel on the EXT port, 9600 or 38400 baud, a 192,000-baud test mode ["UART", "SoC" A3h]. The board offers the UART as a socket (link cable, WonderGate) with a null device by default.