Question, what made it easier to build this in Rust than other languages? I know the advantages of Rust, but what exactly was the experience in this context?
It seems that unsafe references were used, so the advantages of Rust appear to have been somewhat relinquished in this case.
Implementing a NES Emulator in Rust
11–20 of 93 posts
Re: Implementing a NES Emulator in Rust
#12Earlier quoted context omitted.
It seems that unsafe references were used, so the advantages of Rust appear to have been somewhat relinquished in this case.
I am not sure you can not use `unsafe` in an embedded type of project. `unsafe` isn't necessarily bad, but when used at least makes it very clear where extra attention should be paid.
Re: Implementing a NES Emulator in Rust
#13Question, what made it easier to build this in Rust than other languages? I know the advantages of Rust, but what exactly was the experience in this context?
It seems that unsafe references were used, so the advantages of Rust appear to have been somewhat relinquished in this case.
The times when unsafe is poorly used are when it’s being abused to ignore safety related compilation issues, like lifetimes and/or mutability. Though, even in those cases it might be ok if you’re using lower level concurrency primitives to enforce those guarantees.
unsafe does not remove all advantages of Rust, it only removes a few restrictions. It should be avoided unless necessary.
Re: Implementing a NES Emulator in Rust
#14Re: Implementing a NES Emulator in Rust
#15He stream is development of a Nintendo 64 and Virtual Boy emulator in Rust.
Re: Implementing a NES Emulator in Rust
#16Re: Implementing a NES Emulator in Rust
#17Earlier quoted context omitted.
I am not sure you can not use `unsafe` in an embedded type of project. `unsafe` isn't necessarily bad, but when used at least makes it very clear where extra attention should be paid.
I also wrote a NES emulator in Rust, and managed to do it without using a single unsafe block. I used SDL bindings for graphics, if that counts, but it can also run in headless mode (for testing) without SDL perfectly well.
Re: Implementing a NES Emulator in Rust
#18Earlier quoted context omitted.
Implementing an NES emulator is a great way to learn more about a language and the internals of the NES (which is well documented). It's sorta like a rite of passage and has been done in most of the "newer" languages like Nim ( https://github.com/def-/nimes ) , Go ( https://github.com/fogleman/nes )
Well-documented, but many sources are contradictory. For such well researched hardware, there is a lot to be confused about when researching this topic by yourself.
Re: Implementing a NES Emulator in Rust
#19What was the most challenging part for you in building this emulator?
The PPU took 7 days, the CPU took 5 days, the APU took 1 day, and there's a spare day for everything else.
The CPU was easy to make: Its natural unit of output is a single CPU instruction. Even if there are many details, it's a straightforward process to compare an instruction-by-instruction log with a reference log until there are no differences.
The PPU was harder because the natural unit of output is an entire frame: It's not any easier to get the first pixel correct, than to get them all correct. So almost everything needs to be in place before you can validate its output.
Re: Implementing a NES Emulator in Rust
#20Earlier quoted context omitted.
I also wrote a NES emulator in Rust, and managed to do it without using a single unsafe block. I used SDL bindings for graphics, if that counts, but it can also run in headless mode (for testing) without SDL perfectly well.
Do you have a link? I'd like to see how yours compares with OPs