|
libc8
CHIP-8 utility library
|
#include "chip8.h"#include "font.h"#include "private/debug.h"#include "private/exception.h"#include "private/instruction.h"#include "private/util.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include <unistd.h>Macros | |
| #define | DEBUG(c) (c->flags & C8_FLAG_DEBUG) |
Functions | |
| void | c8_deinit (C8 *c8) |
| Deinitialize graphics and free c8. | |
| C8 * | c8_init (const char *path, int flags) |
Initialize and return a C8 with the given flags. | |
| int | c8_load_palette_s (C8 *c8, char *s) |
Load palette from the given string into colors. | |
| int | c8_load_palette_f (C8 *c8, const char *path) |
Load palette from the given path into colors. | |
| void | c8_load_quirks (C8 *c8, const char *s) |
| Load quirk flags from string. | |
| int | c8_load_rom (C8 *c8, const char *addr) |
Load a ROM to c8->mem at path addr. | |
| void | c8_simulate (C8 *c8) |
Main interpreter simulation loop. Exits when c8->running is 0. | |
| const char * | c8_version (void) |
| Get the version of libc8. | |
Stuff for simulating and modifying C8s.
| #define DEBUG | ( | c | ) | (c->flags & C8_FLAG_DEBUG) |
| C8 * c8_init | ( | const char * | path, |
| int | flags | ||
| ) |
Initialize and return a C8 with the given flags.
This function allocates memory for a new C8 with all values set to 0 or their default values, adds the font to memory, inititializes the graphics system, and returns a pointer to the C8.
| path | path to ROM file |
| flags | flags |
C8. | int c8_load_palette_f | ( | C8 * | c8, |
| const char * | path | ||
| ) |
Load palette from the given path into colors.
| c8 | where to store the color codes |
| path | palette file location |
| int c8_load_palette_s | ( | C8 * | c8, |
| char * | s | ||
| ) |
Load palette from the given string into colors.
| c8 | where to store the color codes |
| s | string to load |
| void c8_load_quirks | ( | C8 * | c8, |
| const char * | s | ||
| ) |
Load quirk flags from string.
| c8 | where to store flags |
| s | string to get quirks from |
| int c8_load_rom | ( | C8 * | c8, |
| const char * | addr | ||
| ) |
Load a ROM to c8->mem at path addr.
| c8 | C8 to store the ROM's contents |
| addr | path to the ROM |
| void c8_simulate | ( | C8 * | c8 | ) |
Main interpreter simulation loop. Exits when c8->running is 0.
| c8 | the C8 to simulate |
| const char * c8_version | ( | void | ) |
Get the version of libc8.