# HG changeset patch # User Michael Pavone # Date 1647154481 28800 # Node ID 1bf30397dd4574bb32d691ea910a9912e2b223cc # Parent da1fae7d5407354f935ed333b77ad72fc7203185 Fix one more test in mcd-verificator CDC DMA1 diff -r da1fae7d5407 -r 1bf30397dd45 segacd.c --- a/segacd.c Fri Mar 11 22:41:04 2022 -0800 +++ b/segacd.c Sat Mar 12 22:54:41 2022 -0800 @@ -332,11 +332,19 @@ return vcontext; } +static void cdd_run(segacd_context *cd, uint32_t cycle) +{ + cdd_mcu_run(&cd->cdd, cycle, cd->gate_array + GA_CDD_CTRL, &cd->cdc, &cd->fader); + lc8951_run(&cd->cdc, cycle); +} + static uint8_t pcm_read8(uint32_t address, void *vcontext) { m68k_context *m68k = vcontext; segacd_context *cd = m68k->system; if (address & 1) { + //need to run CD drive because there may be a PCM DMA underway + cdd_run(cd, m68k->current_cycle); rf5c164_run(&cd->pcm, m68k->current_cycle); return rf5c164_read(&cd->pcm, address >> 1); } else { @@ -354,6 +362,8 @@ m68k_context *m68k = vcontext; segacd_context *cd = m68k->system; if (address & 1) { + //need to run CD drive because there may be a PCM DMA underway + cdd_run(cd, m68k->current_cycle); rf5c164_run(&cd->pcm, m68k->current_cycle); rf5c164_write(&cd->pcm, address >> 1, value); } @@ -392,12 +402,6 @@ } } -static void cdd_run(segacd_context *cd, uint32_t cycle) -{ - cdd_mcu_run(&cd->cdd, cycle, cd->gate_array + GA_CDD_CTRL, &cd->cdc, &cd->fader); - lc8951_run(&cd->cdc, cycle); -} - static uint32_t next_timer_int(segacd_context *cd) { if (cd->timer_pending) {