18#define C8_TICK_SPEED (12 * 60)
23#define C8_STACK_SIZE 16
28#define C8_MODE_CHIP8 0
33#define C8_MODE_SCHIP 1
38#define C8_MODE_XOCHIP 2
43#define C8_FLAG_DEBUG 0x1
48#define C8_FLAG_VERBOSE 0x2
53#define C8_FLAG_QUIRK_VF_RESET 0x4
58#define C8_FLAG_QUIRK_MEMORY 0x8
63#define C8_FLAG_QUIRK_CLIPPING 0x10
68#define C8_FLAG_QUIRK_SHIFTING 0x20
73#define C8_FLAG_QUIRK_JUMPING 0x40
78#define C8_FLAG_QUIRK_VBLANK 0x80
C8 * c8_init(const char *, int)
Initialize and return a C8 with the given flags.
Definition: chip8.c:51
void c8_deinit(C8 *)
Deinitialize graphics and free c8.
Definition: chip8.c:34
int c8_load_palette_s(C8 *, char *)
Load palette from the given string into colors.
Definition: chip8.c:81
#define C8_STACK_SIZE
Maximum stack size.
Definition: chip8.h:23
int c8_simulate(C8 *)
Main interpreter simulation loop. Exits when c8->running is 0.
Definition: chip8.c:229
int c8_load_quirks(C8 *, const char *)
Load quirk flags from string.
Definition: chip8.c:156
int c8_load_palette_f(C8 *, const char *)
Load palette from the given path into colors.
Definition: chip8.c:116
int c8_validate(const C8 *)
Validate the state of the chip8 emulator.
Definition: chip8.c:348
int c8_load_rom(C8 *, const char *)
Load a ROM to c8->mem at path addr.
Definition: chip8.c:193
const char * c8_version(void)
Get the version of libc8.
Definition: chip8.c:391
#define C8_MEMSIZE
Total memory size.
Definition: common.h:74
Represents a graphics display.
Definition: graphics.h:60
Represents current state of the CHIP-8 interpreter.
Definition: chip8.h:84
uint16_t I
Address register.
Definition: chip8.h:93
int mode
Interpreter mode (C8_MODE_CHIP8, C8_MODE_SCHIP, C8_MODE_XOCHIP)
Definition: chip8.h:105
int waitingForDraw
Waiting for draw? (For r quirk)
Definition: chip8.h:98
int waitingForKey
Waiting for keypress?
Definition: chip8.h:97
C8_Display display
Graphics display.
Definition: chip8.h:100
int running
Interpreter running state.
Definition: chip8.h:99
int VK
Register to store next keypress.
Definition: chip8.h:95
int flags
CLI flags.
Definition: chip8.h:101
int tickSpeed
Instructions to execute per second.
Definition: chip8.h:96
uint8_t dt
Delay timer.
Definition: chip8.h:89
uint8_t sp
Stack pointer.
Definition: chip8.h:88
uint16_t pc
Program counter.
Definition: chip8.h:92
uint8_t st
Sound timer.
Definition: chip8.h:90