IronFrame OuterFortress (Cart) 01 Decomp
Clean-room 6502 decompilation research, binary format specifications, and portable .decomp recipe work for NES-ME-USA (iNES Mapper 2 / UNROM).
Beta (Pre-1.0 Research): Active clean-room research repository (v0.4.1, Execution Lockstep) verifying 650-frame / 5-scene C11 NesBus execution lockstep (mismatchedFrames: 0 against Mesen 2.1.1 with $0100-$01FF hardware stack masked, reCart InterpreterOracle differential witness, and 8/8 linked clean C11 checkpoints), 4 clean-room Bank 1..4 and BANK_06 table decoders (unresolvedFieldCount: 0), 4 Dev/docs/specifications/*.md chapters, 26 warning-free zero-tell C11 modules (507 symbols across 34 C/header files, 36 files in Corpus/readable/, 10/10 host subsystem parity assertions under -Wall -Wextra -Wno-unused-parameter), a verified 1:1 6502 assembler, a BYO-ROM unpacker, a strict 55-entry .decomp bundle (IronFrame-OuterFortress-Cart-01.decomp) targeting reCart (0.1.x), 27/27 offline unit tests (-W error), and 17/17 full (11/11 synthetic) integrity checks—advancing toward the v1.0.0 Archival Gold Reference.
6502 Assembly 1:1 ROM Match: 8 / 8 PRG banks (131,088 / 131,088 bytes, 0 mismatched bytes, CRC32=25BA3D04) · Clean Idiomatic C11 (Execution Lockstep): 26 / 26 domain modules (507 symbols, 0 tells, 0 warnings under -Wall -Wextra -Wno-unused-parameter, 10/10 subsystem parity assertions) · Execution Lockstep: 650 / 650 frames across 5 scenes (mismatchedFrames: 0 vs. Mesen 2.1.1 + reCart InterpreterOracle witness + 8/8 clean C11 checkpoints) · Bank Decoders: 4 scripts + 4 spec spokes (unresolvedFieldCount: 0)
- 6502 Assembly Byte-Exact Reassembly & Symbol Catalog — Clean-room two-pass 6502 assembler matching all 8 PRG banks (
131,088bytes) alongside499 / 499indexed functions,2,324 / 2,324mapped globals,22structs, and22enums. - Portable
.decompBundle, Offline Tests & Clean-Room Tooling (v0.1.0) — Self-contained BYO-ROM unpacker (nes_unrom_unpack.py),reCart(0.1.x) validatedIronFrame-OuterFortress-Cart-01.decomp, modulard4_harness/C parity runner, offlineunittestsuite, and static documentation site. - Cohesive Domain C Modules, Resolved Symbols & Multi-Tier Snapshots (
v0.2.0) — Replaced all68line-split fragments with26cohesive domain C modules (10fixed-bank core +16switchable-bank overlay modules), resolved all299raw symbol aliases and44raw cross-bank declarations (0remaining raw tokens), synthesized8bank/signature adapters, preserved raw/sliced/mapped local tier snapshots, and verified18/18offlineunittestcases,14/14integrity checks,10/10host parity checks,8/8ROM banks (CRC32=25BA3D04), and the strict clean-roomv0.2.0.decompbundle. - Clean Idiomatic C & Zero-Warning Parity (
v0.3.0) — AST-normalized all26C modules and8headers (34C/header files,507symbols,0decompiler tells), removed.clangddiagnostic suppressions, compiled26/26modules with0errors and0warnings under-Wall -Wextra -Wno-unused-parameter, verified10/10host subsystem parity assertions,20/20offlineunittestcases,15/15verify_track_d5.pychecks (9/9synthetic),8/8ROM banks (CRC32=25BA3D04),36files inCorpus/readable/,5zero-body rewrite shards, and the strict47-entryv0.3.0.decompbundle. - Execution Lockstep, Bank Decoders & Specification Spokes (
v0.4.0) — Verified650-frame /5-scene C11NesBusexecution lockstep (mismatchedFrames: 0against Mesen 2.1.1 with$0100-$01FFhardware stack masked,reCartInterpreterOracledifferential witness, and8/8linked clean C11 checkpoints), delivered4clean-room Bank1..4andBANK_06decoders (unresolvedFieldCount: 0) alongside4Dev/docs/specifications/*.mdchapters, and passed25/25offlineunittestcases (-W error),17/17full (11/11synthetic)verify_track_d5.pychecks, and the strict55-entryv0.4.0.decompbundle. - Byte-Exact & Archival Gold Reference (
v1.0.0) — Certify fresh-clone clean-room BYO-ROM archival Gold verification (CRC32=25BA3D04), finalize technical manuals, and publish the non-prerelease Gold release.
About
This repository documents the binary layout, hardware interfaces, and bank-switched program structure of North American NES-ME-USA using strictly clean-room reverse engineering. It pairs typed C headers, JSON module maps, symbol overrides, zero-body rewrite shards, and call-graph catalogs, a clean-room two-pass MOS 6502 assembler, a BYO-ROM UNROM unpacker, deterministic cohesive C coalescing and zero-tell C11 normalization pipelines, a C11 NesBus execution-lockstep harness, clean-room ROM table decoders, and technical reference manuals without distributing copyrighted ROM images, game assets, or compiled binaries.
In v0.4.1 (Execution Lockstep), the repository verifies 650 frames across 5 deterministic gameplay scenes in clean-room C11 NesBus against Mesen 2.1.1 (mismatchedFrames: 0 with $0100-$01FF hardware stack masked), cross-checks a read-only reCart InterpreterOracle differential witness (650 frames, 649 transitions, boot WRAM CRC32 f1e8ba9e) and 8/8 live linked clean C11 subsystem checkpoints, delivers 4 clean-room Bank 1..4 and BANK_06 table decoders (unresolvedFieldCount: 0) alongside 4 Dev/docs/specifications/*.md chapters, passes 27/27 offline unittest cases (-W error) and 17/17 full (11/11 synthetic) integrity checks, and exports a strict clean-room 55-entry v0.4.1 .decomp recipe (IronFrame-OuterFortress-Cart-01.decomp) targeting reCart (0.1.x), alongside the Documentation Site published from Dev/docs/, .github/, and root documentation.
Key Features
- C11
NesBusRuntime & Execution Lockstep:Dev/scripts/d4_harness/(nes_bus.h/c,nes_ppu_apu.c,nes_cpu_ops.c,nes_cpu_exec.c,d4b_lockstep_scenes.c) pairs withd4b_oracle_bridges.pyandrun_d4b_lockstep.pyto execute650frames across5gameplay scenes ($0100-$01FFhardware stack masked,mismatchedFrames: 0against Mesen 2.1.1), cross-check read-onlyreCart.Core.dllInterpreterOracleand8/8clean C11 linked checkpoints, and emit digest-onlyDev/schemas/d4b_lockstep_report.json(0raw RAM dumps). - Clean-Room Bank
1..4&BANK_06Table Decoders:decode_rooms_and_metatiles.py,decode_guards_and_weapons.py,decode_codec_and_audio.py, and orchestratordecode_all_bank_tables.pydecode rooms (256/165unique), metatiles/adjacency (6tilesets,256vectors), CHR headers (51), patrols (123), dialog offsets (160metadata-only,0retail strings), room spawns (217), weapon tables (7), password layouts (4), codec calls (255tables /116entries), andBANK_06audio tables (5envelopes,12note periods,132descriptors,dmc[0]) strictly into gitignored--out-dir(Corpus/work/decoded_tables/) withunresolvedFieldCount: 0(Dev/schemas/spec_coverage.json). - Clean Idiomatic C11 Normalizer & Rewrite Shards:
craftsmanship_d4_helpers.py,craftsmanship_d4_ast_cleaner.py, andcraftsmanship_d4_normalizer.pyeliminate all decompiler idioms across34C/header files and507symbols (0tells), unroll69comma-operatorifconditions, emit fixed-widths8..u64headers and zero-suppression.clangd/compile_commands.json(-Wall -Wextra -Wno-unused-parameter), and export5zero-body JSON shards underDev/schemas/d4_rewrites/. - Cohesive Domain C Coalescer & Multi-Tier Snapshots:
coalesce_d4_modules.pyandmaterialize_decomp_tiers.pymerge68legacy line-split C slices into26bank-aware domain C modules (10core +16overlay modules), resolve all299raw global aliases and44raw cross-bank calls with8synthesized bank/signature adapters, preserve raw, sliced, mapped, and clean C11 snapshot tiers, and sync36files intoCorpus/readable/. - Clean-Room 6502 Assembler & BYO-ROM Unpacker:
asm6502_d5.pysupports all56official MOS 6502 mnemonics and151opcodes (13addressing modes plusa:absolute override), paired withnes_unrom_unpack.pyandnes_6502_cfg.pyfor SHA-256-verified.nesbank extraction (8/8banks,CRC32=25BA3D04) and synthetic offline verification. - Portable
.decompBundle & Release Packager:export_decomp_bundle.pyandpackage_release.pyproduce deterministic, clean-roomv0.4.1IronFrame-OuterFortress-Cart-01.decomppackages (55entries includingd4_build_report.json,d4b_lockstep_report.json, decoder scripts, and5d4_rewrites/*.jsonshards) and staged release archives validated againstreCart(0.1.x) clean-room rules. - Modular Host Parity, Schema Validators & Offline Tests:
Dev/scripts/d4_harness/compiles10.c/.hfiles cleanly without pointer-cast suppressions (10/10host subsystem assertions plus--lockstep), paired withd4b_validation_helpers.py,27offlineunittesttests (-W error) underDev/scripts/tests/, and17/17unified integrity checks (verify_track_d5.py,11/11offline synthetic). - Complete Memory, Module & Symbol Catalog: Indexes all
499functions across26modules (8bank domains),2,324mapped hardware/RAM/ROM globals (2,344header externs including20deduplicated synthetic overrides),39entry anchors,22C structs, and22enums (0unresolved fields). - Technical Manual Shelf & Specification Spokes: Four linked manuals plus four
Dev/docs/specifications/*.mdchapters covering bank architecture, room/metatile/guard/weapon/password/codec/audio binary specifications, reverse-engineering and lockstep findings, and clean-room operations.
Getting Started
Prerequisites
- Python 3.12+ on your
PATH - Optional:
zig(0.17+) andclangdif you want to compile freestanding / host C parity modules locally - Optional: Mesen
2.1.1(--testRunner) and.NET 8SDK (for read-onlyreCart.Core.dlldifferential witness) if running live multi-scene lockstep locally - Optional:
7z(7-Zip) when creating.7zrelease bundles withpackage_release.py
Quick Try (No ROM Required)
Clone the repository and run the offline unit test suite or smoke-test the 6502 assembler without any cartridge media:
git clone https://github.com/StreamResearch/IronFrame-OuterFortress-Cart-01-Decomp.git
cd IronFrame-OuterFortress-Cart-01-Decomp
# Run all 27 offline unit tests (validates unpacker, assembler, coalescer, AST normalizer, tier builder, lockstep/decoder gates, doc links, and .decomp bundle)
python -B -W error -m unittest discover -s Dev/scripts/tests -v
# Smoke-test the clean-room two-pass 6502 assembler directly
python -B -c "import sys; sys.path.insert(0, 'Dev/scripts'); import asm6502_d5; raw, org, _ = asm6502_d5.assemble_text('.org 0xC000\nLDA #0x01\nSTA 0x00\nRTS\n'); print(f'Opcodes={sum(len(v) for v in asm6502_d5.OPCODES.values())} Bytes={raw.hex()} Origin=${org:04X}')"
Developer verification, `--offline-synthetic` CLI flags, `.decomp` packaging, and local BYO-ROM commands
# Offline synthetic modes (zero ROM required; optional --out-dir, --rewrites-dir, and --log-dir overrides)
python -B Dev/scripts/nes_unrom_unpack.py --offline-synthetic --out-dir Corpus/work/synth_unpacked
python -B Dev/scripts/coalesce_d4_modules.py --offline-synthetic
python -B Dev/scripts/craftsmanship_d4_normalizer.py --offline-synthetic
python -B Dev/scripts/materialize_decomp_tiers.py --offline-synthetic
python -B Dev/scripts/build_and_verify_d5.py --offline-synthetic
python -B Dev/scripts/build_and_verify_d4.py --offline-synthetic
python -B Dev/scripts/run_d4b_lockstep.py --offline-synthetic
python -B Dev/scripts/decode_all_bank_tables.py --offline-synthetic
python -B Dev/scripts/gen_d4_globals_and_lifts.py --verify-only
python -B Dev/scripts/verify_track_d5.py --offline-synthetic
# Build and strictly validate the clean-room .decomp bundle and release stage
python -B Dev/scripts/export_decomp_bundle.py --verify-cleanroom --strict
python -B Dev/scripts/package_release.py --out-dir ./release_stage --no-7z
# Full local verification with your own legally obtained NES-ME-USA ROM in Corpus/
python -B Dev/scripts/nes_unrom_unpack.py --rom path/to/NES-ME-USA.nes --out-dir Corpus/work/unpacked
python -B Dev/scripts/materialize_decomp_tiers.py
python -B Dev/scripts/build_and_verify_d5.py
python -B Dev/scripts/build_and_verify_d4.py
python -B Dev/scripts/run_d4b_lockstep.py --oracle both
python -B Dev/scripts/decode_all_bank_tables.py --write-spec-coverage
python -B Dev/scripts/verify_track_d5.py
All verification CLIs support --data-dir, --out-dir, --log-dir, and --offline-synthetic, returning exit code 2 with structured MISSING_CORPUS_MEDIA JSON when local ROM extracts are absent. See Dev/schemas/decomp_local.example.json and Operations for all overrides (--zig-exe, --mesen-exe, --recart-dir, --tools-dir, --host-target, --tier, --rewrites-dir).
Project Structure
Dev/— Python assemblers, UNROM unpacker, cohesive module coalescer, AST C11 normalizer, multi-tier snapshot builder, Bank1..4andBANK_06table decoders, oracle lockstep runner,.decompexporter, offlineunittestsuite, modulard4_harness/CNesBusand parity runner, typed C headers, JSON schemas (includingd4_rewrites/*.jsonandd4b_lockstep_report.json), clean-room SVG/PNG/ICO emblems, and technical manuals + specification spokesIronFrame-OuterFortress-Cart-01.decomp— Deterministic clean-roomv0.4.1.decomprecipe bundle (55entries) targetingreCart(0.1.x)Corpus/— Local working directory for your own verified ROM extracts, preserved local decompilation snapshot tiers,36-filereadable/C11 tree, and gitignoredwork/decoded_tables/output (gitignored; never committed)Archive/— Compressed local clean-room source snapshots
Documentation
- Documentation Site — Published GitHub Pages manuals and reference views
- Features — Current capabilities and module status
- Roadmap — Active goals and upcoming milestones through
v1.0.0 - Changelog — Version history
- Contributing — Clean-room contribution guidelines and PR checklist
- Security Policy — Vulnerability reporting and asset isolation rules
- Architecture —
iNES Mapper 2 / UNROMbank topology,26cohesive modules,NesBusruntime, and decoder layout - Specifications — C11 types, 6502 memory map, Bank
1..4&BANK_06format spokes, and verification schemas - Findings — Bus-conflict LUT analysis, audio sequencer recovery, timing lockstep, and 6502 assembly match
- Operations — Local workspace layout, CLI overrides, tier materialization, lockstep execution, table decoding, and
.decomppackaging
License & Legal
Distributed under the MIT License (LICENSE) for all clean-room Python tooling, JSON schemas, C headers, and documentation in this repository. See SECURITY.md for clean-room boundaries and private vulnerability reporting.
No Copyrighted Assets: This repository contains zero retail ROM images, extracted game graphics, audio data, or proprietary binaries. Any local verification against cartridge media requires a legally obtained North American NES-ME-USA image supplied by the user inside the gitignored Corpus/ directory.
This independent clean-room research project is not affiliated with, endorsed by, or connected to the original cartridge hardware manufacturer, publisher, or rights holders.