Live data from Hacker News

Statically Recompiling NES Games into Native Executables with LLVM and Go

andrewkelley.me

11–20 of 103 posts

Re: Statically Recompiling NES Games into Native Executables with LLVM and Go

#12
post #4

... while it's not really useful for the NES, which is so old that emulating it does not strain even the crudest modern processor, I'd be excited to see this technique applied to newer consoles for lightweight mobile processors.

While not completely static, some modern emulators do use dynamic recompilation (essentially JIT) instead, which gives you more information to work with and lets you generate more optimized code. You can always fall back to interpreted code as the author does in this article, too.

Re: Statically Recompiling NES Games into Native Executables with LLVM and Go

#15

Modern PS2 emulators - which is to say, pcsx2 - uses dynamic recompilation to execute games at useful speed. Static recompilation might not be a useful technique, but did you consider a dynamic version? What caveats are there?

About halfway through the project I realized that static recompilation is pointless and that dynamic is the way to go. I felt like it was worthwhile to at least get to the "able to play super mario 1" checkpoint before quitting. I did not do any investigation into dynamic recompilation other than pondering about it and concluding that it is more practical than static.

Re: Statically Recompiling NES Games into Native Executables with LLVM and Go

#16
post #14

This is interesting. If this project can output LLVM byte code, then you could also codegen to javascript with emscripten and make a web based version of a NES game.

That thought occurred to me as well, although I did not actually try it.

Re: Statically Recompiling NES Games into Native Executables with LLVM and Go

#17
This is amazing. Also, this is the Dark Magic of programming that I don't think I'll 100% grok in 20 years, but its good to try!

edit: now that I think of it, I really need to keep expanding my knowledge. I'm going to go through this post in my terminal and try to at least make the stuff work, so I can start understanding this process. I've been trying to learn Go and C better anyway. Thanks for providing a ground to learn more.

Re: Statically Recompiling NES Games into Native Executables with LLVM and Go

#18
post #14

This is interesting. If this project can output LLVM byte code, then you could also codegen to javascript with emscripten and make a web based version of a NES game.

That thought occurred to me as well, although I did not actually try it.

Cool, no need to reply to my email then :)

I've been messing around with emscripten lately myself. Maybe I'll try it some time.

Re: Statically Recompiling NES Games into Native Executables with LLVM and Go

#20
post #14

This is interesting. If this project can output LLVM byte code, then you could also codegen to javascript with emscripten and make a web based version of a NES game.

That thought occurred to me as well, although I did not actually try it.

Seems like a good followup post. I'd read that.

I mean essentially it would make NES games running natively in the browser with no emulator right?

Post reply on HN