Skip to content

GB_write_memory

Lior Halphon edited this page Nov 30, 2024 · 3 revisions

Definition

void GB_write_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value);

In memory.h

Description

Performs an 8-bit memory write on a 16-bit address on the emulator instance, as if it were performed by the SM83 CPU.

Thread Safety

GB_write_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).

Notes

The ROM is not writable, as the CPU is unable to perform a ROM write. Attempting to write to the ROM will perform an MBC register write, just as if the write was performed by the CPU. To dynamically modify the ROM, use GB_get_direct_access.

To write data outside of a currently mapped bank, or to write to a memory region that might not be currently writable (e.g., VRAM during mode 3), you can use GB_get_direct_access.

See Also

Clone this wiki locally