Hacker News new | ask | show | jobs
by gobdovan 6 days ago
WASM is just a binary instruction format for a virtual stack machine. So instead of having many instruction sets for different CPUs and so on, you write for a portable VM (think of like JVM but lower level) that then can be ran on many CPUs and also on web browsers.

If there's already C code (for pokemon emerald there already was a decompiled C/ASM codebase), you usually just compile it and it works, or swap a few native dependencies with portable ones. If you have some ASM code already for some old architecture, then it's a pretty straight forward translation to WASM (not really, but iterable enough with LLMs). So yeah, you can have the first target for your thing to compile, then take a screenshot of first few frames for you to check visually and some framebuffer hashes for automatic verification and use those as an oracle for if it also works correctly. Then iterate a little more, maybe implement saving/loading and load a few checkpoints and register a few deterministic inputs and see some more framebuffer hashes, crashes, state checksums and you're good.