{"slug": "show-hn-arcade-js-decompiling-mame-roms-into-idiomatic-javascript-with-llms", "title": "Show HN: Arcade.js – Decompiling MAME ROMs into Idiomatic JavaScript with LLMs", "summary": "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.", "body_md": "arcade-js is an experiment in using an agentic harness to decompile ROM machine code.\n\nA 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.\n\nTo get from machine code to readable JavaScript, we go through several stages:\n\n1) Disassembly — pull the raw bytes apart into instructions and data.\n\n2) 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.\n\n3) 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.\n\n4) Decompilation — rewrite that assembly-JavaScript into real, idiomatic JavaScript.\n\n5) Pixel testing — the idiomatic code no longer tracks registers or cycles, so we check the only thing that ultimately matters: the output.\n\n6) Clarification — the surprise, where an LLM reasons about the code and its behavior to create human-readable JavaScript.\n\nWe 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.\n\n[https://github.com/qarl/arcade-js/blob/main/games/dkong/idio...](https://github.com/qarl/arcade-js/blob/main/games/dkong/idiomatic/snapYToGirder.js)\n\n[https://github.com/qarl/arcade-js/blob/main/games/thepit/idi...](https://github.com/qarl/arcade-js/blob/main/games/thepit/idiomatic/collectLootTile.js)\n\nNote: 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.\n\nComments URL: [https://news.ycombinator.com/item?id=49069383](https://news.ycombinator.com/item?id=49069383)\n\nPoints: 1\n\n# Comments: 0", "url": "https://wpnews.pro/news/show-hn-arcade-js-decompiling-mame-roms-into-idiomatic-javascript-with-llms", "canonical_source": "https://github.com/qarl/arcade-js", "published_at": "2026-07-27 13:23:48+00:00", "updated_at": "2026-07-27 13:53:00.324400+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-agents", "developer-tools", "ai-research"], "entities": ["Arcade.js", "qarl", "MAME", "Donkey Kong", "The Pit", "LLM"], "alternates": {"html": "https://wpnews.pro/news/show-hn-arcade-js-decompiling-mame-roms-into-idiomatic-javascript-with-llms", "markdown": "https://wpnews.pro/news/show-hn-arcade-js-decompiling-mame-roms-into-idiomatic-javascript-with-llms.md", "text": "https://wpnews.pro/news/show-hn-arcade-js-decompiling-mame-roms-into-idiomatic-javascript-with-llms.txt", "jsonld": "https://wpnews.pro/news/show-hn-arcade-js-decompiling-mame-roms-into-idiomatic-javascript-with-llms.jsonld"}}