# Domains, channels and speed ## Domains | Domain | Clock | What is in it | | --- | --- | --- | | **SoC** | 12.288 MHz master, four 3.072 MHz quadrants | the V30MZ, display, sound, palette fetch, interrupt controller, timers, DMA, keypad scan, UART, internal EEPROM controller, internal RAM, the cartridge bus as seen by the CPU quadrant | | **RTC** (2003 carts) | its own 32,768 Hz crystal | the S-3511A's counters and alarm | | **EEPROMs** | none of their own: shifted by the SoC's controller at the cartridge clock | state only | | **Link** (optional) | the far end's | whatever is on the UART socket | The SoC is one domain, not four: its quadrants are slots of one clock (WSDEV "Timing"), the display and sound read the same RAM the CPU writes in the same cycle frame, and the sprite table copy, sound DMA's CPU cycles and the palette quadrant are fixed in that frame (WSDEV "Frame timing", "DMA"). The order of record inside it is per master-clock group of four: CPU, display, sound, palette, as the frame timing table lays them out. ## Channels | Channel | Between | Kind | | --- | --- | --- | | RTC serial (ports CAh/CBh) and /IRQ | SoC and RTC | a byte port and an interrupt line; the RTC's time advances by real or emulated seconds, converted at the channel | | Microwire (BAh-BFh, C4h-C9h) | SoC and EEPROMs | a command/data port; completion polled | | UART (B1h, B3h) and its interrupts | SoC and link | a byte FIFO of one | | Audio out | SoC to host | 24 kHz samples: a pure producer | | Video out | SoC to host | one 224 x 144 picture per frame plus the icon state: a pure producer | Sync points: every CPU instruction boundary (interrupts are sampled there), every I/O access, line starts (line-match and VBlank interrupts, HBlank timer), the sound DMA slot (cycle 117 of each 128). ## Memory kinds (for a later cached interpreter) | Range | Kind | Who writes it | | --- | --- | --- | | internal RAM 00000-0FFFF | RAM | CPU, general DMA | | cartridge ROM 20000-FFFFF | ROM, bank-switched by ports C0h-C3h (CFh-D4h) | nobody, except a flash cart (WonderWitch, 2003 self-flash) through the RAM window | | cartridge RAM 10000-1FFFF | SRAM or flash | CPU | | boot ROM | ROM until lockout | nobody | Code runs from ROM almost always, so a block cache keyed by (bank registers, address) is invalidated by bank writes and flash commands only; but no target needs one (below). ## Instructions per second The V30MZ runs at 3.072 MHz. MAME's boot-ROM frame: 7,148 instructions in 40,703 clocks; without its one 24,579-clock `rep`, 7,147 instructions in 16,124 clocks = 2.26 clocks per instruction, so typical code is about **1.36 M instructions/s**, the ceiling **3.07 M/s**. Beside it the display produces 224 x 144 x 75.47 = **2.43 M pixels/s** and the sound unit **24,000** stereo samples/s (each the sum of four channels clocked at up to 3.072 MHz). ## The no-JIT path | Target | Verdict | | --- | --- | | Python (reference) | below real time, as reference boards are (Aubrey: correct, not fast); test ROMs and short scripted runs are the use | | Desktop, `wonderswan-rust` / `-fast` | real time with a wide margin (an era-1 load: 1.4-3 M simple instructions and 2.4 M pixels per second) | | Phone, `-fast` | real time expected, with room for 1-2 frames of run-ahead (Aubrey uses 1, sometimes 2) | | Browser, wasm `-fast` | real time expected | `recompile: none` on every target; no cached interpreter is expected to be needed. Threads help only for the pure producers (picture from a register-write log, audio from register state) if a phone measurement asks for them. All to be measured when the Rust tiers exist; none of this is measured yet.