Firstly, the goal was to implement a Chip-8 emulator. But there was a couple things I wanted to take a look at in rust regarding project structure.
- Rust recommends "small crates"
- Use traits to see what the dependency injection story is like in Rust when you want to build up a largish code base.
- cargo allows for workspaces for multi crate projects.
Each crate builds an important part of the emulator.
- Model defines all the behavior of various components through traits.
- Instruction Defines the instruction parsing.
- Data is a bunch of wrapper objects around
u8
andu16
. - Vm is the main machine that brings everything together.
- Emulator is an example that constructs a
vm
from all the parts. It provides the interpretation layer between the host and the vm by mapping the framebuffer output, and key input. - RomLibrary is a library of games that can be played.
- Everything else is a component that the vm requires to be able to run.
- Build a web emulator frontend for the vm.
- Host a blob database for storing the roms.