News for hackers. Stuff that matters.
Re:Show HN: An NES emulator written in Rust by kibwen on Saturday February 09, 2013 @04:08PM (#5194011)
Note that this project includes a makefile, though Rust will be moving away from make and friends entirely once the new rustpkg tool is merged:

https://github.com/mozilla/rust/pull/4610

Independence from external build tools is one of the coolest features of Go, so I'm really excited about seeing more languages take this route.

Re:Show HN: An NES emulator written in Rust by gnuvince on Saturday February 09, 2013 @09:12PM (#5195120)
Oh, that's really cool, I didn't know they had this project in the pipe. I agree that bundling tools with the compiler is such a great idea; a build tool built specifically for the language can assume so much more and do so much more, it's a net win.
Re:Show HN: An NES emulator written in Rust by apaprocki on Saturday February 09, 2013 @02:19PM (#5193619)
It was fun watching @pcwalton get it working in such a short time.. from the first signs of life[1] to something we all recognize[2].

  [1]: https://twitter.com/pcwalton/status/298134945531035648
  [2]: https://twitter.com/pcwalton/status/299401519890042880
Re:Show HN: An NES emulator written in Rust by sixbrx on Saturday February 09, 2013 @02:56PM (#5193775)
LOVE seeing stuff about Rust.

I'm at a junction where I've been using Scala happily, but it falls down for numerical work because it can't call C libraries using large arrays without copying, because of the different memory layout used by the JVM vs. C, which really hurts for large data.

Re:Show HN: An NES emulator written in Rust by dysoco on Saturday February 09, 2013 @04:42PM (#5194133)
I'm also a Scala fan looking fowards to Rust. Have you tried Go? I really like it too.
Re:Show HN: An NES emulator written in Rust by sixbrx on Saturday February 09, 2013 @06:13PM (#5194517)
I haven't tried it, but I've heard good things about the experience and the performance. It didn't seem very functional though when I first looked at it which is what I was interested in at the time.

There's something to be said though for being able to write programs that will already be doing real work before the pinky finger has released the return key that launched them, I like the feel of that and I've missed that with the JVM.

Re:Show HN: An NES emulator written in Rust by thristian on Saturday February 09, 2013 @06:48PM (#5194629)
So... how much of the NES does this emulate? As I understand it, it's pretty easy to get a basic 6502 core and a scanline renderer together enough to handle, say, Super Mario Bros. but if you support all the timing corner-cases and memory-map chips and such, it gets to be pretty frustratingly complicated.

EDIT: I should have looked more closely; looking into 'mapper.rs' reveals that it currently supports only the vanilla NES memory-map.

Re:Show HN: An NES emulator written in Rust by pcwalton on Saturday February 09, 2013 @06:54PM (#5194649)
It's very early. You're right that it supports only the very basic functionality.
Re:Show HN: An NES emulator written in Rust by zura on Saturday February 09, 2013 @02:45PM (#5193724)
@pcwalton

Thanks! quite interesting use case for Rust.

May I ask you - was it your side project or did you actually work on this at the office?

Re:Show HN: An NES emulator written in Rust by pcwalton on Saturday February 09, 2013 @02:50PM (#5193747)
It's a side project.
Re:Show HN: An NES emulator written in Rust by gnuvince on Saturday February 09, 2013 @09:13PM (#5195125)
Next step, rewrite Firefox in 6502 assembly, and run it in your NES emulator!
Re:Show HN: An NES emulator written in Rust by zobzu on Saturday February 09, 2013 @03:21PM (#5193860)
Looks pretty clean and concise, yet reasonably readable. Cool to see this kinds of language demos.
Re:Show HN: An NES emulator written in Rust by kibwen on Saturday February 09, 2013 @04:02PM (#5193996)
Concise indeed, only around 2,000 lines for the whole thing. Though I'm not sure if it's possible to quantify the accuracy of the emulation.
Re:Show HN: An NES emulator written in Rust by aidenn0 on Sunday February 10, 2013 @12:15AM (#5195508)
This is cool and all, but...

Since when does an NES take "decent processing power" to emulate? I emulated NES games on a 386DX40 and SNES games on a 486DX266. Certainly the emulation wasn't as accurate as what you get today, but neither is this tech-demo example.

Re:Show HN: An NES emulator written in Rust by gnuvince on Sunday February 10, 2013 @12:31AM (#5195541)
I guess it depends on how closely you want to emulate the platform. For example, there was a great article [1] about a SNES emulator that required an extremely powerful machine, because it aimed to be a 100% accurate emulator. I guess if pcwalton decides to go for a very accurate NES emulator, the CPU usage would be non-negligable.

[1] http://arstechnica.com/gaming/2011/08/accuracy-takes-power-o...

Re:Show HN: An NES emulator written in Rust by jthomp on Sunday February 10, 2013 @12:54AM (#5195584)
Nice, I was about to link the same thing.
Re:Show HN: An NES emulator written in Rust by pcwalton on Sunday February 10, 2013 @03:05AM (#5195783)
You're right, it's a silly statement. Because you don't need to run more than 60 frames per second, you won't start seeing performance degradation over native until you hit, say, 10X slower than optimized C.

What I was getting is that I think turning off the frame limiter and counting how many frames run in, say, 10 seconds would be a nice benchmark of compiler optimization.

Re:Show HN: An NES emulator written in Rust by kibwen on Sunday February 10, 2013 @12:31AM (#5195535)
I think you're missing the point. From the README:

"Its purpose is to serve as a technology demonstration to show how the Rust programming language is suitable for systems software such as emulators. [...] sprocketnes is also designed to be a relatively clean example codebase, showing off various Rust idioms."

Re:Show HN: An NES emulator written in Rust by jmgrosen on Sunday February 10, 2013 @12:37AM (#5195553)
How would you recommend I get started learning Rust? It looks really interesting, but I haven't found any reasonably good tutorials.
Re:Show HN: An NES emulator written in Rust by grayrest on Sunday February 10, 2013 @12:47AM (#5195576)
I thought the official tutorial was good enough to start reading the library code. That's probably about as good as it'll get until the language stabilizes.

* Note: Rust is my language for the year. I can read Rust, follow program flow and I understand the major ideas but I've only put together toy programs.

Re:Show HN: An NES emulator written in Rust by kibwen on Sunday February 10, 2013 @01:51AM (#5195677)
I'd recommend the official language tutorial for getting a handle on the basics:

http://static.rust-lang.org/doc/tutorial.html

From there, if you have questions I recommend you stop by the IRC channel (#rust on irc.mozilla.org, most active on weekdays).

Re:Show HN: An NES emulator written in Rust by saosebastiao on Saturday February 09, 2013 @05:52PM (#5194438)
Is there a timeline set for Rust 1.0?
Re:Show HN: An NES emulator written in Rust by pcwalton on Saturday February 09, 2013 @05:53PM (#5194443)
We're shooting for the end of the year. No guarantees of course.
Re:Show HN: An NES emulator written in Rust by fzzzy on Saturday February 09, 2013 @08:32PM (#5194990)
Love it :-) I'm really looking forward to reading the code.
Re:Show HN: An NES emulator written in Rust by drivebyacct2 on Saturday February 09, 2013 @05:04PM (#5194220)
I think it's neat that this doesn't used any managed pointers and avoids the Garbage collector. The fact that you can simply grep a codebase for '@' to find cases of managed memory is great in my opinion. I've been learning the Rust syntax a bit but am currently stuck trying to find a problem to solve with it that doesn't require me writing a bunch of libs from scratch or writing C interfaces. The Std/Core libraries are still rather lacking compared to say, the Go std lib.

I'm sure that will change, but for now it seems unfortunate. For example, there's an HTTP lib as part of Servo but according to some people in the IRC, it's not even very good.

Re:Show HN: An NES emulator written in Rust by kibwen on Sunday February 10, 2013 @12:38AM (#5195555)
Yes, the net lib was originally just intended to showcase preliminary libuv integration rather than as any sort of production library. Work is ongoing on a brand new approach to integrating libuv that will be both more efficient and more flexible. Once that's done I expect a proper, well-designed net library to emerge.
Re:Show HN: An NES emulator written in Rust by drivebyacct2 on Sunday February 10, 2013 @12:46AM (#5195572)
Fantastic to hear, I'm excited to watch Rust progress this year both in terms of libraries, language polish and tooling that has been hinted at in this thread. Some folks in the IRC gave me some pointers on another avenue involving HTTP so I've got something to play around with for a while when I get bored of writing Go :)