SPC-700 instruction set

The Sony SPC-700 CPU is part of the S-SMP sound processor of the SNES. It runs at 2.048 MHz, and behaves similarly to a 6502 at 1.024 MHz with some extensions.

Architecture
The SPC-700 has a 16-bit address space, and a similar set of registers to the 6502.

Registers

 * A - 8-bit accumulator
 * X - 8-bit index
 * Y - 8-bit index
 * YA - 16-bit pair of A (lsb) and Y (msb).
 * PC - program counter
 * SP - stack pointer
 * PSW - program status word: NVPBHIZC
 * N - negative flag (high bit of result was set)
 * V - overflow flag (signed overflow indication)
 * P - direct page flag (moves the direct page to $0100 if set)
 * H - half-carry flag (carry between low and high nibble)
 * I - interrupt enable (unused: the S-SMP has no attached interrupts)
 * Z - zero flag (set if last result was zero)
 * C - carry flag

Addressing Modes

 * imm - 8-bit immediate value
 * dp - 8-bit direct page offset ($0000+dp or $01000+dp)
 * !abs - 16-bit absolute address
 * rel - relative offset in two's complement
 * (i) - direct-page relative index (P * $100 + i)
 * (i)+ - direct-page relative index with post-increment (i is incremented after read)
 * [addr]+i - indirect indexed (add index after 16-bit lookup)
 * [addr+i] - indexed indirect (add index before 16-bit lookup)

Differences from the 6502

 * A 16-bit combined YA register is available for some operations.
 * The direct page can be moved to $0100. (Rarely used.)
 * No decimal mode, instead provides DAA and DAS instructions which use the added half-carry flag.
 * Iterrupt status flag is enable, not disable. (Not important for SNES.)
 * Some operations allow direct page as a register-like destination, e.g. MOV dp, #imm or ADC dp, dp.
 * X or Y can be sometimes be used as an index to the direct page, possibly with an automatic post-increment, e.g. MOV (X)+ or ADC (X), (Y).
 * Multiply and divide instructions MUL and DIV</tt>.
 * Loop instructions CBNE</tt> and DBNZ</tt>.
 * Abbreviated call instructions the high page of memory PCALL</tt> and TCALL</tt>.
 * Memory bit operations SET1</tt>, NOT1</tt>, MOV1</tt>, that can target individual bits of memory.

Instructions
Official instruction names and syntax for SPC-700 instruction were provided by Sony. However, because of its architectural similarity to 6502, some prefer to rename and remap them using a 6502 style syntax. Both are provided here.

Sony instruction convention puts the destination on the left, source on the right (Intel syntax).

Cycles in this table are 1.024 MHz CPU cycles. Each one is equal to 2 clocks of the 2.048 Mhz S-SMP.

Links

 * SPC700 Reference - CPU Instruction Set at superfamicom.org wiki