From d5d0b54054f5db7cad86fc08c1a12857b2ac04ca Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Tue, 26 Jun 2018 18:51:44 -0400 Subject: s/rgb_frame/fb/, add oam_cache, fix several instructions --- gb.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'gb.h') diff --git a/gb.h b/gb.h index 15bd75e..e027ee7 100644 --- a/gb.h +++ b/gb.h @@ -25,8 +25,8 @@ 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) +// frame buffer size, in bytes +#define GB_FB_SIZE (3 * 160 * 144) typedef struct gb_t_ gb_t; @@ -116,8 +116,22 @@ struct gb_t_ { obp1, line, lyc; - uint8_t rgb[GB_FRAME_SIZE]; + + // frame buffer + uint8_t fb[GB_FB_SIZE]; + + // frame counter uint32_t frame; + + struct { + uint8_t x, y, tile; + bool priority, + y_flip, + x_flip, + palette; + } oam_cache[40]; + + bool oam_dirty; } gpu; struct { @@ -148,7 +162,7 @@ void gb_set_buttons(gb_t * const, const uint8_t); void gb_frame(gb_t * const); void gb_step(gb_t * const); _Bool gb_disasm(gb_t * const, char * const, size_t * const); -const uint8_t *gb_get_rgb_frame(const gb_t * const); +const uint8_t *gb_get_frame(const gb_t * const); #ifdef __cplusplus }; -- cgit v1.2.3