2016-03-30 20:07:55 +00:00
|
|
|
#ifndef memory_h
|
|
|
|
#define memory_h
|
2021-11-07 11:39:18 +00:00
|
|
|
#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);
|
2021-11-26 12:09:41 +00:00
|
|
|
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);
|
2021-11-26 12:09:41 +00:00
|
|
|
void GB_set_write_memory_callback(GB_gameboy_t *gb, GB_write_memory_callback_t callback);
|
2019-08-16 14:38:43 +00:00
|
|
|
|
2016-06-18 17:29:11 +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
|
2016-06-18 17:29:11 +00:00
|
|
|
void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value);
|
2017-04-17 17:16:17 +00:00
|
|
|
#ifdef GB_INTERNAL
|
2021-11-07 12:13:52 +00:00
|
|
|
internal void GB_dma_run(GB_gameboy_t *gb);
|
2022-01-11 22:26:18 +00:00
|
|
|
internal bool GB_is_dma_active(GB_gameboy_t *gb);
|
2021-11-07 12:13:52 +00:00
|
|
|
internal void GB_hdma_run(GB_gameboy_t *gb);
|
|
|
|
internal void GB_trigger_oam_bug(GB_gameboy_t *gb, uint16_t address);
|
2022-02-05 12:52:09 +00:00
|
|
|
internal uint8_t GB_read_oam(GB_gameboy_t *gb, uint8_t addr);
|
2017-04-17 17:16:17 +00:00
|
|
|
#endif
|
2016-03-30 20:07:55 +00:00
|
|
|
|
|
|
|
#endif /* memory_h */
|