From 312478e5090714414450ab41e77d958462e16a27 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Mon, 14 Jan 2019 22:22:46 +0200 Subject: [PATCH] CGB palettes are not accessible during Mode 3, closes #84 --- Core/memory.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Core/memory.c b/Core/memory.c index ce25b04..a3010b0 100644 --- a/Core/memory.c +++ b/Core/memory.c @@ -357,6 +357,10 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr) if (!gb->cgb_mode && gb->boot_rom_finished) { return 0xFF; } + /* TODO: Verify actual access timing */ + if (gb->vram_read_blocked) { + return 0xFF; + } uint8_t index_reg = (addr & 0xFF) - 1; return ((addr & 0xFF) == GB_IO_BGPD? gb->background_palettes_data : @@ -788,6 +792,10 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value) is required. */ return; } + /* TODO: Verify actual access timing */ + if (gb->vram_write_blocked) { + return; + } uint8_t index_reg = (addr & 0xFF) - 1; ((addr & 0xFF) == GB_IO_BGPD? gb->background_palettes_data :