This is my CHIP-8 emulator written in Haskell. Since I've become interested in emulation, I decided a CHIP-8 emulator would be a good starting project. I also used this project to teach myself Haskell, and to get used to a TDD approch to software development.
While developing this project, I used this tutorial to help me understand the basics of building a CHIP-8 emulator. I also used this wikipedia page which contains helpful documentation on each CHIP-8 opcode.
You will need to have Stack setup first before you can run this project. Read this documentation to learn how to setup Stack.
Note that this project has been developed and tested in Linux. I have not tested this project in either the Windows or Mac operating systems.
The following command will build the project and move the executable to the ~/.local/bin
folder:
$ stack install
You can then easily run the emulator from any directory:
$ lazy-chip8 "the/path/to/your/rom"
While developing locally, you can build and run the executable using the following stack commands:
$ stack build
$ stack exec lazy-chip8 "the/path/to/your/rom"
This project contains a test suite that tests all of the CPU opcodes and logic. You can run unit tests using the following command:
$ stack test
- Add some validation when we load ROMs that will check to make sure the ROM isn't too big to fit into memory.
- Try testing this emulator on Mac and Windows operating systems and document the steps needed to install it.
- Implement a config setting that allows you to toggle whether graphics should wrap around to the other side of the screen when drawing near the edge of it. This could be set using a command line argument. Currently the emulator always wraps and there's no way to turn it off.
- Implement two config settings that will toggle the load store quirk and shift quirk as documented here. These could be set using command line arguments.
- Implement Super Chip opcodes.
- Make it easier to load games so you don't necessarily have to do it through the comamnd line. Maybe a file menu that allows you to pick from a selection of games?