Skip to content

gb_rom_read()

Mr-PauI edited this page Dec 21, 2025 · 3 revisions

This function isn't defined by walnut-cgb. Each implementation must provide this function to gb_init(). The precise name of the function doesn't matter of course, but for consistency in this example the same name as the internal function pointer is used.

uint8_t* rom_data; // for this example a pointer to rom_data in ram, flash or psram data
uint8_t gb_rom_read(struct gb_s *gb, const uint_fast32_t addr)
{
    return rom_data[addr];
}

Access to the priv structure can be used to organize rom data, available through the passed struct gb_s structure.

Clone this wiki locally