From 30dfba4966ae7469beb72228bf8abb2a9e67a04b Mon Sep 17 00:00:00 2001 From: ekeeke Date: Mon, 19 Feb 2024 21:47:32 +0100 Subject: [PATCH] [Core/CD] fixed potential edge case with CDC DMA halting --- core/cd_hw/scd.c | 8 ++++---- core/mem68k.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/cd_hw/scd.c b/core/cd_hw/scd.c index 0e3411a..f0a061b 100644 --- a/core/cd_hw/scd.c +++ b/core/cd_hw/scd.c @@ -1003,9 +1003,9 @@ static void scd_write_byte(unsigned int address, unsigned int data) /* synchronize CDC DMA with SUB-CPU */ cdc_dma_update(s68k.cycles); - /* halt CDC DMA to 2M Word-RAM */ + /* halt CDC DMA to 2M Word-RAM (if still running) */ + cdc.halted_dma_w = cdc.dma_w; cdc.dma_w = 0; - cdc.halted_dma_w = word_ram_2M_dma_w; } /* Word-RAM is returned to MAIN-CPU */ @@ -1341,9 +1341,9 @@ static void scd_write_word(unsigned int address, unsigned int data) /* synchronize CDC DMA with SUB-CPU */ cdc_dma_update(s68k.cycles); - /* halt CDC DMA to 2M Word-RAM */ + /* halt CDC DMA to 2M Word-RAM (if still running) */ + cdc.halted_dma_w = cdc.dma_w; cdc.dma_w = 0; - cdc.halted_dma_w = word_ram_2M_dma_w; } /* Word-RAM is returned to MAIN-CPU */ diff --git a/core/mem68k.c b/core/mem68k.c index b060040..81e9d80 100644 --- a/core/mem68k.c +++ b/core/mem68k.c @@ -763,9 +763,9 @@ void ctrl_io_write_byte(unsigned int address, unsigned int data) /* synchronize CDC DMA with MAIN-CPU */ cdc_dma_update((m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE); - /* halt CDC DMA to PRG-RAM */ + /* halt CDC DMA to PRG-RAM (if still running) */ + cdc.halted_dma_w = cdc.dma_w; cdc.dma_w = 0; - cdc.halted_dma_w = prg_ram_dma_w; } } else @@ -1092,9 +1092,9 @@ void ctrl_io_write_word(unsigned int address, unsigned int data) /* synchronize CDC DMA with MAIN-CPU */ cdc_dma_update((m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE); - /* halt CDC DMA to PRG-RAM */ + /* halt CDC DMA to PRG-RAM (if still running) */ + cdc.halted_dma_w = cdc.dma_w; cdc.dma_w = 0; - cdc.halted_dma_w = prg_ram_dma_w; } } else