SameBoy/Core/memory.h

21 lines
894 B
C
Raw Permalink Normal View History

2016-03-30 20:07:55 +00:00
#ifndef memory_h
#define memory_h
#include "defs.h"
2018-05-27 16:30:23 +00:00
#include <stdint.h>
2016-03-30 20:07:55 +00:00
2019-08-16 14:38:43 +00:00
typedef uint8_t (*GB_read_memory_callback_t)(GB_gameboy_t *gb, uint16_t addr, uint8_t data);
typedef bool (*GB_write_memory_callback_t)(GB_gameboy_t *gb, uint16_t addr, uint8_t data); // Return false to prevent the write
2019-08-16 14:38:43 +00:00
void GB_set_read_memory_callback(GB_gameboy_t *gb, GB_read_memory_callback_t callback);
void GB_set_write_memory_callback(GB_gameboy_t *gb, GB_write_memory_callback_t callback);
2019-08-16 14:38:43 +00:00
uint8_t GB_read_memory(GB_gameboy_t *gb, uint16_t addr);
2021-11-26 11:54:28 +00:00
uint8_t GB_safe_read_memory(GB_gameboy_t *gb, uint16_t addr); // Without side effects
void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value);
#ifdef GB_INTERNAL
internal void GB_dma_run(GB_gameboy_t *gb);
internal void GB_hdma_run(GB_gameboy_t *gb);
internal void GB_trigger_oam_bug(GB_gameboy_t *gb, uint16_t address);
#endif
2016-03-30 20:07:55 +00:00
#endif /* memory_h */