cd /news/artificial-intelligence/show-hn-arcade-js-decompiling-mame-r… · home topics artificial-intelligence article
[ARTICLE · art-75410] src=github.com ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

Show HN: Arcade.js – Decompiling MAME ROMs into Idiomatic JavaScript with LLMs

Arcade.js, an experimental project by developer qarl, uses an agentic harness with LLMs to decompile MAME ROMs into idiomatic JavaScript, demonstrated with Donkey Kong (1981) and The Pit (1982). The multi-stage process includes disassembly, translation, state testing, decompilation, pixel testing, and clarification to produce human-readable code that matches original game output.

read1 min views1 publishedJul 27, 2026

arcade-js is an experiment in using an agentic harness to decompile ROM machine code.

A MAME ROM is a good candidate for porting — you can run it perfectly and capture its state. It is also a challenge — pure machine code running on odd hardware.

To get from machine code to readable JavaScript, we go through several stages:

  1. Disassembly — pull the raw bytes apart into instructions and data.

  2. Translation — rewrite it one instruction at a time into JavaScript that's provably identical to the original. We call this "assembly-JavaScript": it's JavaScript, but its shape is the assembly's.

  3. State testing — run the assembly-JavaScript next to MAME and check that every register, every byte of memory, and the cycle count all track it. Not bit-perfect (real hardware has a CPU-vs-video-beam race we don't chase, etc.) but close enough to catch errors.

  4. Decompilation — rewrite that assembly-JavaScript into real, idiomatic JavaScript.

  5. Pixel testing — the idiomatic code no longer tracks registers or cycles, so we check the only thing that ultimately matters: the output.

  6. Clarification — the surprise, where an LLM reasons about the code and its behavior to create human-readable JavaScript.

We point to two good examples of the technique: Donkey Kong (1981), because everyone has heard of it; and The Pit (1982), because no one has.

[https://github.com/qarl/arcade-js/blob/main/games/dkong/idio...](https://github.com/qarl/arcade-js/blob/main/games/dkong/idiomatic/snapYToGirder.js)

[https://github.com/qarl/arcade-js/blob/main/games/thepit/idi...](https://github.com/qarl/arcade-js/blob/main/games/thepit/idiomatic/collectLootTile.js)

Note: the repo does not hold the original ROMs (which contain copyrighted artwork). If you want to actually play the games, you must provide your own.

Comments URL: [https://news.ycombinator.com/item?id=49069383](https://news.ycombinator.com/item?id=49069383)

Points: 1

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @arcade.js 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/show-hn-arcade-js-de…] indexed:0 read:1min 2026-07-27 ·