This project is my take on a CHIP-8 emulator implemented in Rust. While not complex at all, I had never really tried to make an emulator before so I figured this would be a good place to start. It is hardware accelerated and fully safe with deny unwrap/expect/panic. It also passes (to my knowledge) the Timendus CHIP-8 Test Suite. I've also tried to make it as efficient as I could by using 1D arrays and trying to allocate memory as few times as possible. It took me about 9 1/2 hours to full complete, including documentation/cleanup of the code.
This project makes use of winit and pixels for the rendering, and rodio for the cross-platform audio. Sound support can be optionally compiled out with the audio feature flag.
This emulator supports the following list of quirks taken from Timendus' test suite:
- vF Reset - The AND, OR and XOR opcodes (
8xy1,8xy2, and8xy3) reset the flags register to zero - Memory - The save and load opcodes (
Fx55andFx65) increment the index register - Display Wait - Drawing sprites to the display waits for the vertical blank interrupt, limiting their speed to max 60 sprites per second
- Clipping - Sprites drawn at the bottom edge of the screen get clipped instead of wrapping around to the top of the screen
- Shifting - The shift opcodes (
8xy6and8xyE) only operate onvXinstead of storing the shifted version ofvYinvX - Jumping - The "jump to some address plus
v0" instruction (Bnnn) doesn't usev0, butvXinstead whereXis the highest nibble ofnnn
AI was used for a few documentation fragments and for improving logging within the crate.