Step 1 of 5 · Reading · ~2 min
Read
Production
Quirks: COSMAC vs Modern
If you write CHIP-8 emulators, you will be asked exactly one question: "why does game X work on Octo but not yours?" The answer is almost always a quirk.
CHIP-8 was implemented and re-implemented over four decades, and at each step the implementors had different ideas about edge cases. ROMs were written against specific interpreters and now depend on those quirks. There is no "right" behavior — there are programmable defaults.
The four big quirks
| Opcode | COSMAC (original) | Modern (SCHIP / CHIP-48) |
|---|---|---|
| 8XY6 | shift VY right, store in VX | shift VX right in place |
| 8XYE | shift VY left, store in VX | shift VX left in place |
| FX55 | store V0..VX, then I += X+1 | store V0..VX, I unchanged |
| FX65 | load V0..VX, then I += X+1 | load V0..VX, I unchanged |
| DXYN | wraps in-sprite (some impls) | clips in-sprite, wraps coords |
| BNNN | pc = NNN + V0 | (SCHIP) BXNN: pc = XNN + V[X] |
How to expose them
Then in your opcode handlers:
How to debug a failing ROM
When a ROM fails on your emulator but works on Octo:
- Visual glitch (sprites in the wrong place, ghosting on the edges)
- DXYN wrap vs clip.
- Score / arithmetic wrong
- Shift quirk. Test with
LD V0, 0x80; SHR V0, V1and see if V0 becomes 0 or 64 depending on V1.
- Shift quirk. Test with
- Game corrupts memory after a save/load
- FX55/FX65 increment-I quirk.
- Game jumps to nonsense address after a 'select level' menu
- BNNN vs BXNN.
Three sources for finding the right setting:
- Timendus' chip8-test-suite ROM prints a quirks scorecard to the display.
- Octo's compatibility database tags well-known ROMs with their required quirks.
- Game-specific forums and emulator README files.
The takeaway
A CHIP-8 emulator that ships only one quirk set runs maybe 60% of the library. A toggleable emulator with COSMAC/SCHIP presets runs ~99%. The toggle is the feature.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…