Skip to content

Speed, quirks and screenshots ​

Most ROMs run with the defaults. When one runs too slowly, misbehaves or needs a bigger window, change it with an option on the command line. Options go before or after the ROM name.

Change the speed ​

CHIP-8 has no fixed CPU speed. chip8 runs 540 instructions per second by default, close to the original COSMAC VIP. ROMs tuned for other interpreters may want 700 to 1000.

bash
./build/chip8 --ips 800 game.ch8

The delay and sound timers always count down 60 times a second, whatever --ips is. A faster setting makes the program logic run faster without making timers or beeps shorter. Values below 60 are raised to 60.

Pick a quirk profile ​

"Quirks" are the instructions where the original COSMAC VIP interpreter and later SUPER-CHIP-era interpreters behave differently. A ROM written for one family can draw garbage or hang on the other.

chip8 starts in the vip profile. If a ROM misbehaves, try modern:

bash
./build/chip8 --profile modern game.ch8
Behaviourvip (default)modern
8XY1, 8XY2, 8XY3Reset VF to 0Leave VF alone
8XY6, 8XYEShift VY into VXShift VX in place
FX55, FX65Leave I = I + X + 1Leave I unchanged
BNNNJump to NNN + V0Jump to NNN + VX
DXYN timingWaits for the 60 Hz tickNo wait

Both profiles wrap a sprite's starting position and clip its pixels at the right and bottom edges. In both, FX0A (wait for a key) completes when the key is released.

Good to know

Only the vip profile is checked by the test suite. modern is a convenience for ROMs written against SUPER-CHIP-style interpreters.

Why drawing is slower in the vip profile ​

On the VIP, a sprite draw waited for the display's 60 Hz tick. chip8 copies this: each frame allows one DXYN draw, and a second draw in the same frame pauses the CPU until the next tick. A ROM that draws a lot runs at no more than about 60 draws a second in vip, however high you set --ips. The modern profile removes the wait.

Resize the window ​

The CHIP-8 screen is 64×32 pixels. --scale multiplies it. The default is 12, which gives a 768×384 window.

bash
./build/chip8 --scale 20 game.ch8

Values below 1 are raised to 1.

Turn off the sound ​

bash
./build/chip8 --mute game.ch8

With --mute, chip8 does not open an audio device at all.

Save a screenshot ​

--screenshot saves the screen as a BMP file when chip8 exits. Pair it with --frames to exit on its own after a number of 60 Hz frames:

bash
./build/chip8 --frames 180 --screenshot logo.bmp tests/roms/2-ibm-logo.ch8

This runs for three seconds, saves logo.bmp and quits. Without --frames, the screenshot is saved when you press Esc or close the window.

To get a picture without opening a window at all, use the headless runner:

bash
./build/chip8_run_rom tests/roms/2-ibm-logo.ch8 --frames 120 --bmp logo.bmp

Next steps ​