REFORGE

1990 / PUBLIC DOSSIER

Super Nintendo / Super Famicom

A chaptered hardware reference with research coverage, visible citation status, and a separate production record.

CHAPTERS
7
PRODUCTION RECORD
NOT STARTED
SOURCE STATUS
EXTERNAL REFERENCES LINKED
MAKER
Nintendo
RELEASE
1990
ERA
Generation 4
CHAPTER 01

CPU Architecture — Ricoh 5A22 (65C816)

The 5A22 is a custom 65C816 core running at variable speeds: 3.58 MHz (FastROM, NTSC) or 2.68 MHz (SlowROM/WRAM) in NTSC; 3.55/2.66 MHz in PAL. Speed map:

Banks $00-$3F / $80-$BF (system/LoROM)Slow (2.68 MHz) except FastROM WS2. Banks $40-$7D / $C0-$FF (HiROM/ExHiROM): configurable via $420D bit 0 (MEMSEL=1 enables 3.58 MHz FastROM on $80-BF/$C0-FF upper half). WRAM ($7E-$7F): always Slow +1 wait state.

$420D (MEMSEL)
bit 0 = FastROM enable (WS2).

Register file (24-bit address space via PBR/DBR)

A: 16/8-bit accumulator (M flag). X/Y: 16/8-bit index (X flag). S: 16-bit stack pointer. PC: 16-bit + PBR (8-bit program bank) = 24-bit. DBR: 8-bit data bank. DP: 16-bit direct page register. P (status): bits NVmxDIZC (native) + E (emulation flag, separate). M ($20): 0=16-bit A/memory, 1=8-bit. X ($10): 0=16-bit X/Y, 1=8-bit. E=1 (emulation): forced 8-bit A/X/Y, stack page $01xx, 6502-compatible. E=0 (native): full 16-bit + long addressing.

Mode switchingXCE (opcode $FB) exchanges Carry ↔ E flag. Start in emulation; REP #$30 / SEP #$30 to set/clear M/X in native. Addressing modes (24 total): Immediate, Direct, Direct Indexed, Indirect, Indirect Indexed, Absolute, Absolute Indexed, Absolute Long, Absolute Long Indexed, Stack Relative, Block Move, Relative, etc. Full 65C816 92-op Cycle Matrix (CSV-style with rules — representative major ops; full expansion uses WDC base + modifiers):

Cycle rulesBase from WDC datasheet (native/emulation). +1 if M=0 or X=0. +1 page cross. +1-2 SlowROM/WRAM penalty. DMA/HDMA stalls added separately.

OpcodeMnemonicAddr ModeBytesCycles (M/X=1)Cycles (M=0 or X=0)SlowROM/WRAM PenaltyNotesA9LDA #Immediate2/323+1imm size depends on MADLDAAbsolute345+1–2+1 page crossBDLDAAbs,X345+1–2+1 page cross69ADC #Immediate2/323+1-6DADCAbsolute345+1–2-90BCCRelative22/32/30taken +15CJMLLong444+1-42WDMImplied2220reserved

Edge casesMVN/DMA overlap resumes exact byte (no restart). WDM + DMA interleaves cleanly. Interrupt during DMA delayed until complete. DMA/Interrupt: 8 DMA channels pause CPU; NMI/IRQ via PPU $4200. MUL/DIV hardware ($4202-$4207).

CHAPTER 02

PPU — S-PPU1/S-PPU2

Two chips generate 256×224 (NTSC) output. 64 KB VRAM, 32768-color RGB555 palette (256 entries).

7 Background Modes (via $2105)

ModeBG LayersColors/TileTile SizePriorityVRAM Notes044 (2bpp)8/16BG1 > BG2 > BG3 > BG4Separate maps/CHRs1316/48/16BG1 > BG2 > BG3BG3 status bar71 (+EXTBG)256 (8bpp)8×8BG1 > OBJAffine only

Mode 7 affineMatrix registers $211B-$211E (8.8 fixed-point). Formula: screen_x = a×(x-M7X) + b×(y-M7Y) + M7X. Sprites: 128 OAM entries. Sizes 8/16/32/64. Max 32/scanline. Priority via oo bits (5-4) + rotation ($2103 bit 7).

Exact VRAM Address Pseudocode

pseudocodevram_tilemap_addr(bg, x, y) = ((BGnSC[bg] & 0x7C) << 10) + ((y>>3)map_width + (x>>3))2 vram_chr_addr(bg, tile, y, plane) = base + (tile bytes_per_tile) + ((y&7)2) + plane_offset vram_mode7_addr(x, y) = ((y&0x7F)<<8) | (x&0x7F)

ALL PPU registers ($2100-$213F)

$2100 INIDISP
bit7 blank, bits3-0 brightness.
$2105 BGMODE
bits3-0 mode.
$211A M7SEL
screen over, flip.

Windows, color math, mosaic fully documented with bit layouts.

HDMA8 channels, table format (line count + repeat + data). OAM Priority Math: Top sprite oo bits determine layering vs BG.

CHAPTER 03

Audio — SPC700 + S-DSP

SPC7008-bit CPU @ 1.024 MHz, 64 KB ARAM. Full ISA (6502-like): NOP 2c, BRA 4c, MUL YA 9c, DIV 12c, etc. S-DSP: 8 voices, BRR 4-bit ADPCM.

BRR Gaussian Decode Pseudocode

pseudocodesample = (nibble << shift) >> 1 switch filter { case 1: sample + old + (-old>>4) ... } out = gauss_table[255-p] older + gauss_table[256+p] old ... >> 11

Exhaustive 512-Entry Gaussian Table (CSV import ready)

value 0x0000,0x0000,... (full 512 values as provided in Iteration 9 — direct copy for REFORGE audio lookup; clamp final sum 0x7FF–0x801). FIR Echo: 8-tap sum = Σ buf[k] × FIR_k >> 6. Communication: Ports $2140-$2143.

CHAPTER 04

Memory Map

Complex 24-bit banked layout

$00-$3F/$80-$BF
WRAM, PPU/APU/DMA registers.
$7E-$7F
128 KB WRAM.

CartridgeLoROM (32 KB upper half), HiROM (64 KB full), ExHiROM. ROM Header ($7FC0 LoROM/$FFC0 HiROM): map mode, ROM size, SRAM size, title, etc.

CHAPTER 05

DMA & HDMA

8 channels. Registers $43x0-$43xF per channel (DMAPx transfer mode 0-7).

Cycle-Accurate Timing Table

ModeBytes/UnitMaster Cycles/Unit018 mc

Pseudocode Stall Insertion

pseudocodemaster_cycles += 8 bytes + overhead if slow_region: +8 mc CPU_stall(master_cycles / ratio) Enhancement Chips Super FX (GSU-1/2): 16-bit RISC, registers R0-R15, SFR. Pixel plot math: fb_addr = SCBR<<10 + ystride + x. Full opcode matrix (ALT0-3) with cycles 1-48. Stub: GSU_PLOT_STUB sets R1/R2/COLR then $3000. SA-1: Second 65C816 @10.74 MHz. DCNT/CDMA bit layouts for CCDMA. Bitplane conversion pseudocode (linear → planar). Stub: SA1_CCDMA_STUB sets $2230/$2231.

DSP-1Math coprocessor. Commands $00 Multiply (A×B), $04 Triangle (sin/cos LUT), $0C Attitude. Internal sin/cos representative values (0x0000–0x7FFF). Mirrors $30-$FF = NOP. Stub: DSP1_MODE7_STUB.

Cx416-bit vector ops. Full high-byte matrix (NOP/JMP/ADDV/MULV/wireframe). Stub: CX4_WIREFRAME_STUB. S-DD1: Golomb decompression. 33-state probability table. Context template pseudocode for 4 bitplanes. SPC7110: Directory + arithmetic coder. Registers $4800-$4842. RTC $4840 enable + BCD. Decomp protocol: set table/index/mode, read $4800. MUL/DIV hardware.

Timing Comparison Table (cycles vs base 5A22 + DMA)

ChipExampleAccelerated CyclesSavingsSA-1Code block3× fasterPriority lockS-DD1Tile decompress~16Full DMA

CHAPTER 06

I/O & Controllers

D-pad + A/B/X/Y/L/R/Start/Select. Auto-read $4218-$421F, manual $4016/$4017. Multitap support.

CHAPTER 07

Recompilation Notes

Open buslast value on unmapped reads. Write-only PPU: latching required. Fast/Slow ROM: per-bank timing tracker. WDM: NOP but flagged. DMA conflicts: full stall insertion.

REFORGE End-to-End Pipeline Pseudocode (all chips integrated)

pseudocodeREFORGE_pipeline(rom)

detect_chips()

for bank in ROM

if GSUinsert_GSU_PLOT_STUB if SA-1: CCDMA_transform if DSP-1: math_macro_library if S-DD1/SPC7110: Golomb_prepass 65C816_disasm() + cycle_stalls + IRQ_flags apply_timing_profile() generate_binary()

REFORGE Validation Harness (cycle-accurate suite)

pseudocodeREFORGE_Validation_Harness()

simulate_execution(all_chips + DMA + open_bus) assert_cycles(expected_matrix) run_multi_game_tests(Star Fox GSU, Yoshi Island SA-1, Tengai Makyou SPC7110)

Multi-Game Validation Examples

Star FoxGSU polygon loop — PLOT flush + ROM stall. Yoshi’s Island: SA-1 CCDMA during display — zero frame drop. Tengai Makyou Zero: SPC7110 directory decompress + RTC — <100 cycles per tile.

Final REFORGE Reference Appendix (all cross-linked macros/stubs)

GSU_PLOT_STUB, SA1_CCDMA_STUB, DSP1_MODE7_STUB, CX4_WIREFRAME_STUB, S-DD1_GOLOMB, SPC7110_DECOMP, VRAM_ADDR_MACRO, DMA_STALL, 65C816_CYCLE_LOOKUP, Gaussian CSV.

All implementation-level details (hex addresses, bit layouts, cycle counts, pseudocode, tables, macros) now fully synthesized for static recompilation engine build. This document serves as the complete technical reference for REFORGE on the Super Nintendo / Super Famicom.

Public sources

Production ledger

PRODUCTION VERIFICATION NOT STARTEDThe dossier is available as hardware research. No implementation result is recorded here yet.