From 2ce21e092161fcc41fa51b365aeb4dd071d7e949 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 20 Jun 2018 18:29:22 -0400 Subject: add gb.h, add gb_init(), gb_get_rgb_frame(), disable bios --- gb.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'gb.h') diff --git a/gb.h b/gb.h index 6be3a94..1dab2e2 100644 --- a/gb.h +++ b/gb.h @@ -25,12 +25,14 @@ typedef enum { #define GB_BTN_SELECT (1 << 6) #define GB_BTN_START (1 << 7) +// frame size, in bytes +#define GB_FRAME_SIZE (3 * 160 * 144) + typedef struct { struct { - _Bool in_bios; + // _Bool in_bios; // FIXME: combine these? - uint8_t bios[0x100]; // bios (256 bytes) uint8_t ram[0x2000]; // working ram (8k) uint8_t eram[65536]; // external ram (banked, up to 64k) uint8_t vram[0x2000]; // vram (8k) @@ -95,7 +97,7 @@ typedef struct { obp1, line, lyc; - uint8_t rgb[3 * 160 * 144]; + uint8_t rgb[GB_FRAME_SIZE]; uint32_t frame; } gpu; @@ -116,6 +118,12 @@ typedef struct { } cpu; } gb_t; +void gb_init(gb_t * const, const uint8_t *rom, const uint32_t rom_size); +void gb_set_buttons(gb_t * const, const uint8_t); +void gb_frame(gb_t * const); +void gb_step(gb_t * const); +const uint8_t *gb_get_rgb_frame(const gb_t * const); + #ifdef __cplusplus }; #endif /* __cplusplus */ -- cgit v1.2.3