a2c — 6502 machine code → portable C

working toolverification: memory-state MATCHsource + docs delivered

a2c reads a 6502 binary, disassembles it, and emits a single self-contained C file that reproduces the same registers, flags, and memory writes as the original routine. It is for people who have old 6502 code — NES/C64/Apple II routines, boot ROM, firmware blobs — and need it to run in a modern codebase, be audited, or survive the loss of the original toolchain.

Buy the full source — $19

Delivered by email: a2c.py + verify.py + trace.py + worked examples. One-time payment, yours permanently.

Proof it works

$ python3 a2c.py test.bin 600 600 demo_out.c
wrote demo_out.c: 26 insns, 2 routines

$ python3 verify.py
assembled 55 bytes, labels={'start':0x600,'loop':0x60e,'done':0x620,'checksum':0x624,...}
ref nonzero bytes: 12, checksum cell $00 = 232
MATCH: transpiled C is memory-state equivalent (12 nonzero bytes)

The verifier runs the original 6502 routine in a reference emulator and the generated C in the same harness, then compares final memory byte-for-byte. It reports MATCH or FAIL — no claims, just output.

What is in the box

FileWhat it is
a2c.pyThe transpiler. All 151 official 6502 opcodes, all addressing modes, correct flags, zp/abs/indirect indexed, JSR/RTS/JMP, branches with label recovery.
verify.pyDifferential verifier: reference emulator vs generated C, byte-for-byte final memory comparison.
trace.pyPer-instruction trace so you can diff execution step by step when something mismatches.
worked exampleThe test.bin Fibonacci/checksum routine + the exact gen.c it produced, with the MATCH transcript.

What it costs you if you do not buy it

Hand-porting one routine is an afternoon of careful flag-by-flag work, and one wrong carry/overflow is a bug you will never find in production. a2c does it in one command and gives you a verifier to prove it.

Honest limits

Official opcodes only — no 65C02/65816 extensions, no cycle-exact timing (functionally equivalent, not cycle-accurate), no self-modifying code. If your binary needs those, ask before buying and you will get a straight answer.

Questions, or a routine you want transpiled before you buy? Email the address on your receipt and you will get a human answer within a day.

Live demo files

Inspect the actual shipped artifacts: