6 ms·
RBoy: A Gameboy Emulator in Rust
- thristian 5y agoSee also https://github.com/Gekkio/mooneye-gb https://github.com/Gekkio/mooneye-gb which is more famous for its exhaustive test suite than its emulation accuracy.
- jan_Inkepa 5y agoOh that's a really cool approach. I'm not much into the world of emulators - people probably have done this a bunch before, but I guess I've never thought about it - nice to see it presented here so systematically!
- underdeserver 5y agoEven just collecting that set of devices shows commitment.
- mlang23 5y agoA rust port for the gameboy, that would have been impressive...
- busterarm 5y agothere's only a barely working, undocumented backend for LLVM on the z80. You could probably do this with mrustc.
- pjmlp 5y agoYou could, but given that even C and Pascal hardly take advantage of Z80, and have to be used as some kind of fancy macro Assembler, better just deal with Z80 Assembly directly. But then I am biased, having the Z80 opcodes burned in my brain due to the Speccy days.
- flatiron 5y agoI believe it also tosses everything on the stack which is certainly not optimal for the z80
- pdw 5y agoThe Game Boy doesn't use a Z80 though. It's based on a SM83 core, an obscure Sharp design.
- detaro 5y agoTrue, but the instruction set is very close, so a Z80 implementation is a good starting point.
- flohofwoe 5y agoIt's essentially a stripped Z80 without the DD-, ED- and FD-prefix instruction ranges. The core instruction block and CB-prefix range is (nearly) the same.
- busterarm 5y agoSee the other responses, but my comment was really suggesting that if LLVM barely supports Z80 then the GameBoy CPU is a hopeless lost cause.
- nicoburns 5y agoThere is a rust port for the game boy advance https://github.com/rust-console/gba https://github.com/rust-console/gba
- zozbot234 5y agoThere's some ongoing work on a LLVM whole-program backend for the MOS 6502, which can already compile some Rust code (discussed https://news.ycombinator.com/item?id=28581812 https://news.ycombinator.com/item?id=28581812 ). If that's successful (it does require lots of new optimization passes to match the effectiveness of hand-written code), it would be quite easy to have a backend for the Z80 as well.
- deleted 5y ago[deleted]
- deleted 5y ago[deleted]
- mysterymath 5y agoA Z80 backend could probably reuse our static stack allocation, but that's about it. It's definitely useful, but the time-consuming part of writing LLVM-MOS's code generator has ended up being... writing LLVM-MOS's code generator. The static stack stuff is maybe like 250 lines of code, and I haven't had to touch it in months.
- agent327 5y agoWhy must every new rust project be reported here? Are there any other languages for which every new thing is being reported as if it were some major milestone? Is it true that this happens because Amazon is astroturfing rust like mad (as suggested on this website the other day)?
- p1necone 5y agoDoes every new rust project really get reported here, or do you just only feel the need to post about your annoyance when the projects posted here happen to be written in rust?
- Arnavion 5y agoIt's not even a "new" project. If the multiple "6-8 years ago" files in the root of the repo didn't give it away, a tiny bit of clicking will reveal the first code commit was in 2014. Not only did the project start before Rust 1.0, it started before cargo.
- agent327 5y agoI wouldn't know, I hardly ever see such posts about other languages. Weird, isn't it, that only rust gets that treatment?
- ben-schaaf 5y agoAs of writing this the font page has the following: * Slacktyping: I'm typing when you're typing (2018) * The world's worst Linux kernel module * Show HN: Go playground powered by WASM that runs in the browser * Elk: A low footprint JavaScript engine for embedded systems
- littlestymaar 5y agoAmusingly enough, the said “Go playground” is actually written in Rust under the hood.
- 5y ago
- Aissen 5y agoI had a quick look at the big match expressions, and this does not look like this project has been through cargo fmt (it would add +2000 lines of code for the whole project). Which is probably a good choice, but as someone who's been looking at this, I wonder if the tradeoffs made in rustfmt are the right ones (note: I have no idea how I would make this better for the general case).
- josephg 5y agoI can’t speak for the author, but personally I hate tools like go fmt, es-prettify and cargo fmt. I’d never use this stuff by choice because they delete the work I do to make my code easier for me to read. For example, I use extra blank lines to separate different parts of a function, or separate groups of functions visually. These sort of tools like to delete vertical white space, which hurts readability. In javascript I’ve seen plenty of very readable ternary operators (possible with the correct layout) replaced with unreadable junk by the prettifier. It’s soulless to make all code look like bland corporate cardboard. It appeals to our OCD perfectionist tendencies but in my experience provides very little real value. Software is like writing. It can’t help but express how the author thinks about their code. These tools try to iron that personality out - and for what reason? Who cares in javascript if some files use semicolons and some don’t? Who cares if my where clause is on the same line or the next? The compiler doesn’t care, and neither do I. (I will grant that all files in a project should have consistent white space, but you don’t need cargo fmt for that.)
- rhooke 5y agoI enforce formatters wherever possible after working on codebases with 20+ years of people imposing their own unique opinion on where spaces and braces should go. Worse, arguing about what the spacing should be, and making noisy diffs because people change previous peoples styling. The formatter has no opinion. It follows rules. It doesn't work perfectly everywhere. It works enough. I would argue caring about exact bespoke spacing of all code is the perfectionism you mention.
- childintime 5y ago
- lbj 5y agoRust really shines on this kind of job. Code is clean, simple and modulated. Where do I find games to test this out?
- chaozznl 5y agohttps://itch.io/games/tag-gameboy-rom https://itch.io/games/tag-gameboy-rom
- deleted 5y ago[deleted]
- averbahn 5y agoDid you create this as your side project or spend your time creating this emulator full time?
- percentcer 5y agoI'm working on one too! Just got to the milestone of being able to scroll the Nintendo® logo. I refer to rboy a lot, it's been helpful to see another implementation. https://github.com/percentcer/cerboy https://github.com/percentcer/cerboy