2018-11-10 23:16:32 +00:00
|
|
|
#ifndef sgb_h
|
|
|
|
#define sgb_h
|
2018-11-15 23:53:01 +00:00
|
|
|
#include "gb_struct_def.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2018-11-10 23:16:32 +00:00
|
|
|
|
|
|
|
#ifdef GB_INTERNAL
|
2018-11-15 23:53:01 +00:00
|
|
|
typedef struct {
|
|
|
|
uint8_t command[16 * 7];
|
|
|
|
uint16_t command_write_index;
|
|
|
|
bool ready_for_pulse;
|
|
|
|
bool ready_for_write;
|
|
|
|
bool ready_for_stop;
|
|
|
|
bool disable_commands;
|
|
|
|
|
|
|
|
/* Screen buffer */
|
2018-11-16 10:42:52 +00:00
|
|
|
uint8_t screen_buffer[160 * 144]; // Live image from the Game Boy
|
|
|
|
uint8_t effective_screen_buffer[160 * 144]; // Image actually rendered to the screen
|
|
|
|
|
2018-11-15 23:53:01 +00:00
|
|
|
/* Multiplayer Input */
|
|
|
|
uint8_t player_count, current_player;
|
2018-11-16 10:42:52 +00:00
|
|
|
|
|
|
|
/* Mask */
|
|
|
|
uint8_t mask_mode;
|
2018-11-16 14:04:40 +00:00
|
|
|
|
|
|
|
/* Border */
|
|
|
|
uint8_t vram_transfer_countdown;
|
|
|
|
bool tile_transfer, tile_transfer_high, data_transfer;
|
2018-11-16 15:36:21 +00:00
|
|
|
struct {
|
|
|
|
uint8_t tiles[0x100 * 8 * 8]; /* High nibble not used*/
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
uint16_t map[32 * 32];
|
|
|
|
uint16_t palette[16 * 4];
|
|
|
|
};
|
|
|
|
uint16_t raw_data[0x440];
|
2018-11-16 14:04:40 +00:00
|
|
|
};
|
2018-11-16 15:36:21 +00:00
|
|
|
} border, pending_border;
|
|
|
|
uint8_t border_animation;
|
2018-11-16 14:04:40 +00:00
|
|
|
|
2018-11-15 23:53:01 +00:00
|
|
|
} GB_sgb_t;
|
|
|
|
|
2018-11-10 23:16:32 +00:00
|
|
|
void GB_sgb_write(GB_gameboy_t *gb, uint8_t value);
|
2018-11-14 22:21:21 +00:00
|
|
|
void GB_sgb_render(GB_gameboy_t *gb);
|
2018-11-16 15:22:57 +00:00
|
|
|
void GB_sgb_load_default_border(GB_gameboy_t *gb);
|
2018-11-15 23:53:01 +00:00
|
|
|
|
2018-11-10 23:16:32 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|