diff --git a/builds/genesis_plus_gx_libretro.dll b/builds/genesis_plus_gx_libretro.dll index 09bd350d8..0d5000dcd 100644 Binary files a/builds/genesis_plus_gx_libretro.dll and b/builds/genesis_plus_gx_libretro.dll differ diff --git a/builds/genplus_cube.dol b/builds/genplus_cube.dol index 30576188c..edbdaf772 100644 Binary files a/builds/genplus_cube.dol and b/builds/genplus_cube.dol differ diff --git a/builds/genplus_wii.dol b/builds/genplus_wii.dol index 5f7d60cb2..27445bbc5 100644 Binary files a/builds/genplus_wii.dol and b/builds/genplus_wii.dol differ diff --git a/core/vdp_ctrl.c b/core/vdp_ctrl.c index 2c0394095..bce394bfe 100644 --- a/core/vdp_ctrl.c +++ b/core/vdp_ctrl.c @@ -625,7 +625,7 @@ int vdp_context_load(uint8 *state) void vdp_dma_update(unsigned int cycles) { - unsigned int dma_cycles, dma_bytes; + int dma_cycles, dma_bytes; /* DMA transfer rate (bytes per line) @@ -662,6 +662,12 @@ void vdp_dma_update(unsigned int cycles) else if (rate == 204) rate = 198; /* 6 refresh slots per line in H40 mode when display is off */ } + /* Adjust DMA start cycle for DMA fill to take in account intial data port write */ + else if (dmafill) + { + cycles += (2 * (MCYCLES_PER_LINE / rate)); + } + /* Available DMA cycles */ if (status & 8) { @@ -724,7 +730,7 @@ void vdp_dma_update(unsigned int cycles) } /* Process DMA */ - if (dma_bytes) + if (dma_bytes > 0) { /* Update DMA length */ dma_length -= dma_bytes; @@ -2487,9 +2493,6 @@ static void vdp_68k_data_w_m5(unsigned int data) /* Check if DMA Fill is pending */ if (dmafill) { - /* Clear DMA Fill pending flag */ - dmafill = 0; - /* DMA length */ dma_length = (reg[20] << 8) | reg[19]; @@ -2499,11 +2502,11 @@ static void vdp_68k_data_w_m5(unsigned int data) dma_length = 0x10000; } - /* Take into account initial data word processing */ - dma_length += 2; - /* Trigger DMA */ vdp_dma_update(m68k.cycles); + + /* Clear DMA Fill pending flag */ + dmafill = 0; } }