Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
For those looking to see an example of the match expressions:
https://github.com/mvdnes/rboy/blob/9f6b3bc47311ba687326bfff...
This process of matching on opcode and doing a marginally different version of the same basic few operations on one of a set of registers is something that is _much_ easier to do when you're able to see all the opcodes and activities in a densely packed set of lines like this.
(The start of the opcodes that I linked are not the best example of this, but they get more regular the further down the file you go. See https://github.com/mvdnes/rboy/blob/9f6b3bc47311ba687326bfff... )
Beyond knowing that they exist, I haven't explored macros in rust, but I'm curious if they could be of help here. But using cargo fmt, and spreading each of those lines into 3-10 lines would be awful, and would definitely lead to me making mistakes and not noticing typos.
There is a rust port for the game boy advance https://github.com/rust-console/gba
I think the core issue here is mainly that a giant match isn't the best way to express opcode tables, and jump tables are just a bit more idiomatic here as in other languages. I've also been working on an emulator for the gameboy in Rust (https://github.com/jawline/Mimic, I wanted to be able to draw gameboy games to the command line) and I think the use of a jump table made it a bunch simpler / easier to refactor (https://github.com/jawline/Mimic/blob/9463b658ebf006b2369d2b...).
I'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.
Related posts
- Finished building a working Game Boy Color emulator using Rust and WebAssembly 🎮🕹️
- Finished building a working Game Boy Color emulator using Rust and WebAssembly 🎮🕹️
- Boytacean: Fast Web Game Boy Emulator Written in Rust
- [Rust] Un émulateur de garçon de jeu écrit en rouille
- Tips on cleanly separating the UI code from the actual emulation code?