💾 Archived View for tilde.pink › ~nagi › tinychip.gmi captured on 2024-03-21 at 16:09:43. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-02-05)
-=-=-=-=-=-=-
I wanted to learn the basics of emulator development and emulation in general. So I decided to make a CHIP-8 emulator.
In fact it's a misuse of language to say that it's an "emulator" because CHIP-8 is a language, so we should rather say "interpreter".
So, basically there are three main components that make it works. The CPU, the API and the Core (kernel).
The API polls the keyboard inputs and send them to the CPU that put them in the right memory location.
The CPU fetch, decode and execute an instruction from a ROM (program or game), it can change the VRAM and the CPU registers, etc .. Depending of the CPU state, the window draw the VRAM throught the API.
There are approximately n instructions executed per second for a frequency of n hz (n is 500 by default). The sound and delay timers are managed with 60hz.
As I said, it supports some quirks for specific instructions, because according to some old documents,fx55, fx65, 8xy6 and 8xye dont have the same semantic depending of the machine they were implemeneted on.
I implemented the 36 instructions + the 4 I was taking before to be compatible with more ROM.