git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit ec6612d445f1c1a779efaffca6cf4aeece8dec8a
parent 90b3e1ff38b4b9b0f252b66f0bde3cf5e4c56cfa
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sat, 15 Oct 2022 21:31:13 +0300

Fix DMA restart regression

Diffstat:
MCore/gb.h1+
MCore/memory.c3++-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Core/gb.h b/Core/gb.h @@ -453,6 +453,7 @@ struct GB_gameboy_internal_s { uint16_t dma_ppu_vram_conflict_addr; uint8_t hdma_open_bus; /* Required to emulate HDMA reads from Exxx */ bool allow_hdma_on_wake; + bool dma_restarting; ) /* MBC */ diff --git a/Core/memory.c b/Core/memory.c @@ -533,7 +533,7 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr) return 0xFF; } - if (GB_is_dma_active(gb) && gb->dma_current_dest != 0) { + if (GB_is_dma_active(gb) && (gb->dma_current_dest != 0 || gb->dma_restarting)) { /* Todo: Does reading from OAM during DMA causes the OAM bug? */ return 0xFF; } @@ -1536,6 +1536,7 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value) return; case GB_IO_DMA: + gb->dma_restarting = (gb->dma_current_dest != 0xA1 && gb->dma_current_dest != 0xA0); gb->dma_cycles = 0; gb->dma_cycles_modulo = 2; gb->dma_current_dest = 0xFF;

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.