TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Porting a NES Emulator from Go to Nim

158 pointsby def-about 10 years ago

10 comments

foglemanabout 10 years ago
&gt; As I really liked fogleman&#x27;s NES emulator in Go I ended up mostly porting it to Nim. The source code is so clean that it&#x27;s often easier to understand the internals of the NES by reading the source code than by reading documentation about it.<p>Win!
评论 #9475598 未加载
habermanabout 10 years ago
Let me get this straight. We have an emulator for 1985 hardware that was written in a pretty new language (Go), ported to a language that isn&#x27;t even 1.0 (Nim), compiled to C, then compiled to JavaScript? And the damn thing actually <i>works</i>? That&#x27;s kind of amazing.
评论 #9475517 未加载
评论 #9474555 未加载
评论 #9474296 未加载
评论 #9474090 未加载
allendoerferabout 10 years ago
This title covers the essence of hacker news pretty well.
评论 #9474824 未加载
shurcooLabout 10 years ago
Did you port from Go to Nim by hand, or was it automated in any way?<p>I thought that Go would be the last language I&#x27;d write by hand. Previously I wrote C++, which was a dead end in that I could never use tools to parse it and translate to a new language. But with Go it should be much easier to do that if&#x2F;when I ever decide to switch to something else.<p>The performance of the emulator in browser (compiled via emscrimpten) is very impressive! It felt like solid 60 FPS to me. I wonder how the Go version compiled via GopherJS would compare? Have you tried?
评论 #9474023 未加载
评论 #9474562 未加载
warmwafflesabout 10 years ago
Well this is new. I&#x27;ve never seen Nim before. What does it offer that Rust, Haskell, Erlang, etc... do not?
评论 #9473931 未加载
评论 #9474119 未加载
评论 #9473922 未加载
评论 #9474307 未加载
mwcampbellabout 10 years ago
The binary size difference is quite striking. Linux distro packagers are going to like Nim, I think.
评论 #9474053 未加载
beagle3about 10 years ago
Ubercool.<p>Question about nim: from looking at <a href="https:&#x2F;&#x2F;github.com&#x2F;def-&#x2F;nimes&#x2F;blob&#x2F;master&#x2F;src&#x2F;nes&#x2F;cpu.nim" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;def-&#x2F;nimes&#x2F;blob&#x2F;master&#x2F;src&#x2F;nes&#x2F;cpu.nim</a> , I wonder: is there way to give the no. of cycles and instruction encoding with the &quot;op&quot; template, so those 256 byte arrays get built automatically?
评论 #9476767 未加载
评论 #9476585 未加载
lqdc13about 10 years ago
Any plans to do let people call Nim functions from Python with Python standard objects like strings&#x2F;dicts&#x2F;lists as arguments? This would let people write the fast parts in Nim and slow parts in Python.
评论 #9476221 未加载
评论 #9476172 未加载
评论 #9494201 未加载
mhdabout 10 years ago
I&#x27;m quite impressed about the small amount of code required for a NES emulator. I thought they&#x27;d have to do all kinds of special casing for cartridge-specific stuff…
评论 #9474515 未加载
评论 #9475714 未加载
doomroboabout 10 years ago
For anyone who was wondering what I was: porting from libSDL calls to drawing on an html canvas is done automatically by emscripten