Skip to content

Instantly share code, notes, and snippets.

@drgomesp
Last active April 26, 2018 10:18
Show Gist options
  • Save drgomesp/5dc8f32cb7998fb9c44c1323c45f7719 to your computer and use it in GitHub Desktop.
Save drgomesp/5dc8f32cb7998fb9c44c1323c45f7719 to your computer and use it in GitHub Desktop.

Hello!

I've been trying to come up with a nice design for the component architecture of a GameBoy emulator I'm working on. I have been facing a few challenges in regards to having clear dependency boundaries and what owns what. Particularly, I'm writing the emulator in Rust, which kind of forces me to think about the design of the components before hand, due to the ownership and mutability model.

Here are a few questions that I have unanswered:

Does it make sense to have a Motherboard/Board component that will hold a reference to all hardware components in the system, including the CPU, Memory, etc?

Where should the reference to the bootrom be stored, ideally? Should the CPU know about it, or when need be, just read from a given address from a different component (Bus, or something like that)?

What component should be responsible for decoding the instructions? And what component should be responsible for fetching the instruction in the first place?

Those are a few questions. I'm not sure I'm being clear, or if it's still in a too abstract level for any kind of solid discussion we can have, but any help is greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment