This is a CHIP-8 interpreter written in OCaml, writing a CHIP-8 interpreter is the "Hello world" of emulator development. There are some attempts for this interpreter to be a COSMAC VIP emulator -- it uses its instruction times in its clock loop, but only to a degree, and it has the modern behavior of newer CHIP-8 interpreters for instructions implemented.
Instructions pass general tests found online, though some CHIP-8 games are still not playbale.
Selecting the rom to run can be done with --rom
(e.g. --rom=roms/my_rom.ch8
)
Keys 1-4, Q-R, A-F, and Z-V are mapped to each row of the original COSMAC VIP keypad (1 = 1, 2 = 2, 3 = 3, 4 = C, Q = 4, W = 5, E = 6, R = D, A = 7, S = 8, D = 9, F = E, Z = A, X = 0, C = B, V = F).
The program can be exited with ESC
.
Running with --debug
allows for pausing the program with SPACE
. Instruction breakpoints are supported with --breakpoints
(e.g. --breakpoints=FX55
), stepping is done with RET
, and continuing is done with SPACE
(note that you must step out of the breakpoint first).
Cycle time is configurable with --frequency
, the default is 600 Hz (time of 1 cycle = 1 s / 60).