C8c

submited by
Style Pass
2024-09-29 04:00:06

Chip8 is a rather obscure virtual machine written for the long forgotten COSMAC VIP. The virtual machine has 35 opcodes making it an ideal first emulation project.

Chip8 reserves address space 0x000 - 0x1FF for the interpreter on the COSMAC VIP system. The first 80 bytes of this address range is reserved for 16 sprite fonts (0-F, including F), allowing the following set of opcodes to store general purpose registers V0-VE (including VE) right after the sprite fonts:

A beasty yet plausible solution to function calls on the chip8’s extremely limited platform. Unfortunately this does not work for all data types other that word size of chip8 (one byte) which makes a full fitting B-Implementation (not including pointers) feasible. Have you an actual COSMAC running the chip8 virtual machine with this code beware that the stack frames may clobber the virtual machine itself.

Nevertheless, check out c8c - a single portable single source compiler for the chip8 platform. Included is a virtual machine mock-up and assembler to test it out.

Leave a Comment
Related Posts