-
-
Notifications
You must be signed in to change notification settings - Fork 212
GB_read_memory
uint8_t GB_read_memory(GB_gameboy_t *gb, uint16_t addr);
In memory.h
Performs a memory read on a 16-bit address on the emulator instance, as if it were performed by the SM83 CPU, and returns the 8-bit read value.
GB_read_memory
must not be called if the instance is being run in another thread, but may be called from the current one (via a callback).
To read data outside of a currently mapped bank, or to read from a memory region that might not be currently readable (e.g., VRAM during mode 3), you can use GB_get_direct_access.
Because this function goes through the same routines used by a CPU memory read, it will trigger any side effect caused by a memory read, including, for example, OAM corruption. If you wish to avoid this behavior, you can use either GB_safe_read_memory or GB_get_direct_access.