Overview
Here is how I decided and built a Silverlight Chip8 emulator.Download ChipGr8 Source Code
What is Special About Chip8?
Chip-8 is a small interpreter created in the early 70's that has these nice features:- Is very easy to emulate (in 4 or 5 hours you can have a working emulator!)
- Has 2d sprite drawing and pixel-perfect collision detection
- Has sound and keyboard support
How to Create Your Own Computer Emulator
- Decide on a programming language. C++ is fast. C# is cool and is working with Silverlight!
- Decide what you want to emulate.
At first I started with x86 (8086) emulation - wanted to play Digger badly :)
It turned out to be more time consuming, because of all the peripherals: PCI bus, VGA adaptor, Keyboard, Interrupt Controller, etc, etc.
This sounds very promising!
Source Code Architecture
This is pretty easy:- Make a big array for the memory. In Chip8-s case I used 65536 bytes array, since this was the chip's address space
- Add a C# class for screen manipulation.
Chip8 contains several screen commands: PutPixel() (always XOR-ed), scroll left, scroll right, scroll down.
I decided it makes sense to put these in separate class. - Create the class for the chip
This is the class that contains the main variables: InstructionPointer (shows the next instruction to execute), stack, CPU registers and such.
Chip Architecture
For a very good explanation about the Chip8 architecture click here.Back to ChipGr8