# What this core claims, and on what evidence **Tier.** There is no hardware oracle and no instruction-set datasheet. The Samsung SSP1601 sheet (`reference/SSP1601.pdf`, five pages, 1996) lists the pins, the clock (25 MHz at 5 V, 40 ns minimum cycle) and the block diagram: two 256-word RAM banks, eight 8-bit pointer registers, a 16 x 16 multiplier, a 32-bit ALU, a six-level stack, 64K words of program space. It does not list a single opcode. The instruction set was reverse-engineered from *Virtua Racing* (Tasco Deluxe; notaz, `reference/svpdoc.txt`) and the disassembler Pierpaolo Prazzoli wrote from Samsung's assembler samples. So this core is **a transcription of MAME 0.285's `ssp1601.cpp`** (BSD-3-Clause; of the SSP1601 cores the family has met, the only one whose licence lets code be taken: Genesis Plus GX and Picodrive are non-commercial, jgenesis and BlastEm GPL-3.0, all closed box only), and the claim is exactly that: it behaves as MAME's core does on every opcode MAME implements, including its cycle counts. MAME is a *detector, not a judge* here as everywhere in this family, but nothing better exists for this chip. ## What is modelled - All of `ld`, `ldi`, `ld ... ((ri))`, `ld d, (A)`, the six ALU operations (`sub cmp add and or eor`) in their seven addressing forms, `call`, `bra`, `mod` (`shr shl neg abs`), `mld`, `mpya`, `mpys`, and `ret` (which is `ld PC, STACK`). - The pointer registers with their modifiers (`+!`, `-`, `+`, the fixed r3/r7 words), RPL (ST bits 0-2) as a modulo on a *read* through `-` and `+`. - Z and N from the full 32-bit accumulator. P is always X * Y * 2, signed, and `ld A, P` moves all 32 bits. - Reading or writing `AL` drives the external bus (EXT7) as well as moving the accumulator's low word: "VR depends on that" (MAME). - Cycle counts as MAME's: one per instruction, plus one for `ldi`, `call`, `bra` and a write to PC, two for `((ri))` and `ld d, (A)`. ## What is not modelled (as in MAME) - Conditions other than *always*, Z and N (the data sheet names L, OV, GPI0-3 and DIOF); one is treated as false and recorded in :attr:`SSP1601.unhandled`. - `mod` operations `ror rol inc dec`, and the flag opcodes `set/res l ie op` (group `$94xx`): recorded, no effect. - L and OV, and ST bits 3-4 and 7-9 beyond being stored and read back whole. - Interrupts (INT0-2), the single-step pin, USR0-1 and ST5/ST6 as output pins. ST5 and ST6 are stored in ST, and the board reads them to choose between a register's status and programmable-memory personalities. - RPL on a *write* through `-`/`+`, on `ld d, ri` forms and on `((ri))` with a modifier ("loop repeat mode ... is ignored"). Not checked against hardware. - The multiply's third operand (the `b` bit) and the real stack's over/underflow (it wraps). - The internal ROM at program words $FC00-$FFFF (see megadrive-python `docs/mappers-plan.md`). ## Corners worth knowing - **ST.** MAME and this core store all 16 bits written. (This section used to compare other emulators' handling, read in their GPL source during Phase 0; that is no longer cited: docs/provenance.md, 2026-11-25.) - **`mld`** clears every flag bit (`ST &= $0FFF`) and sets Z; `mpya`/`mpys` update only Z and N. - **`ld d, s` with `s` = A/P.** Only `ld A, P` is 32 bits; `ld X, A` is the high word.