2016-03-30 23:07:55 +03:00
|
|
|
#ifndef memory_h
|
|
|
|
#define memory_h
|
2021-11-07 13:39:18 +02:00
|
|
|
#include "defs.h"
|
2018-05-27 19:30:23 +03:00
|
|
|
#include <stdint.h>
|
2016-03-30 23:07:55 +03:00
|
|
|
|
2019-08-16 17:38:43 +03:00
|
|
|
typedef uint8_t (*GB_read_memory_callback_t)(GB_gameboy_t *gb, uint16_t addr, uint8_t data);
|
2021-11-26 14:09:41 +02: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 17:38:43 +03:00
|
|
|
void GB_set_read_memory_callback(GB_gameboy_t *gb, GB_read_memory_callback_t callback);
|
2021-11-26 14:09:41 +02:00
|
|
|
void GB_set_write_memory_callback(GB_gameboy_t *gb, GB_write_memory_callback_t callback);
|
2019-08-16 17:38:43 +03:00
|
|
|
|
2016-06-18 20:29:11 +03:00
|
|
|
uint8_t GB_read_memory(GB_gameboy_t *gb, uint16_t addr);
|
2021-11-26 13:54:28 +02:00
|
|
|
uint8_t GB_safe_read_memory(GB_gameboy_t *gb, uint16_t addr); // Without side effects
|
2016-06-18 20:29:11 +03:00
|
|
|
void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value);
|
2017-04-17 20:16:17 +03:00
|
|
|
#ifdef GB_INTERNAL
|
2021-11-07 14:13:52 +02:00
|
|
|
internal void GB_dma_run(GB_gameboy_t *gb);
|
2022-01-12 00:26:18 +02:00
|
|
|
internal bool GB_is_dma_active(GB_gameboy_t *gb);
|
2021-11-07 14:13:52 +02: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 14:52:09 +02:00
|
|
|
internal uint8_t GB_read_oam(GB_gameboy_t *gb, uint8_t addr);
|
2017-04-17 20:16:17 +03:00
|
|
|
#endif
|
2016-03-30 23:07:55 +03:00
|
|
|
|
|
|
|
#endif /* memory_h */
|