summaryrefslogtreecommitdiff
path: root/gb.h
diff options
context:
space:
mode:
Diffstat (limited to 'gb.h')
-rw-r--r--gb.h14
1 files changed, 11 insertions, 3 deletions
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 */