larttyler / gb-rs Goto Github PK
View Code? Open in Web Editor NEWA work-in-progress Gameboy / Gameboy Color emulator, written in Rust
A work-in-progress Gameboy / Gameboy Color emulator, written in Rust
Currently, binary instructions (those that have a left- and right-hand side) are being implemented to follow a specific pattern: The target
field matches the type named by the struct (e.g. Pair
for Load::Pair
), and the source is an enum listing all possible source variants. For example:
pub struct PairLoad {
pub target: Pair,
pub source: PairLoadSource,
}
pub enum PairLoadSource {
Register(Register),
Data(Data<u8>),
// etc...
}
However, for some instructions (such as Load::DataPointerLoad
), there's really only two possible source variants: either Register::A
or Pair::SP
. The CPU doesn't include opcodes for any other variants of a data-pointer load.
Which raises the question: is it better to stick with the established pattern for a consistent API, and implement the Load::DataPointerLoad
instruction's source as follows, despite the fact that most inner values for each variant will never be used:
pub enum DataPointerLoadSource {
Register(Register),
Pair(Pair),
}
Or, does it make more sense to implement it as follows:
pub enum DataPointerLoadSource {
SP,
A,
}
Which would clearly indicate that there cannot possibly be any other sources aside from those two.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.