Hacker News new | ask | show | jobs
by zackangelo 1155 days ago
"runs WASM" made me wonder: is transpiling a ROM to WASM an effective strategy for emulating something like a GameBoy? You'd still have many issues to solve, not least of which mapping the hardware onto a runtime layer, but you'd benefit from all of the innovation happening in the WASM ecosystem.
2 comments

It could give you JIT for free, but I don't think it's a silver bullet.

It would be hard to implement. ROM is unstructured data, interpreted however the game wants. You'd need some heuristics or instrumentation to find which parts are code, and where the code jumps to.

You still need the hardware emulated, and emulation ideally should be cycle accurate, so the generated WASM would be tightly coupled to the emulator. Resulting binary likely would be larger, as I expect 8-bit Thumb code to be more compact than 32-bit WASM.