# HG changeset patch # User Michael Pavone # Date 1741463158 28800 # Node ID c6bc66b163923ebde3bcd789fe026b5b7cf0e735 # Parent b0b6c604210300c775fa84145ef0b7395f5fa664 Less broken Sega CD emulation with new 68K core diff -r b0b6c6042103 -r c6bc66b16392 segacd.c --- a/segacd.c Sat Mar 08 11:45:25 2025 -0800 +++ b/segacd.c Sat Mar 08 11:45:58 2025 -0800 @@ -17,6 +17,10 @@ #define REFRESH_INTERVAL 259 #define REFRESH_DELAY 2 +#ifdef NEW_CORE +#define int_num int_priority +#endif + enum { GA_SUB_CPU_CTRL, GA_MEM_MODE, @@ -592,6 +596,12 @@ if (mask < 5) { if (cd->gate_array[GA_INT_MASK] & BIT_MASK_IEN5) { cdc_cycle = lc8951_next_interrupt(&cd->cdc); +#ifdef NEW_CORE + //should this maybe happen with the old core too? + if (cdc_cycle == cd->cdc.cycle) { + cdc_cycle = context->cycles; + } +#endif //CDC interrupts only generated on falling edge of !INT signal if (cd->cdc_int_ack) { if (cdc_cycle > cd->cdc.cycle) { @@ -643,11 +653,11 @@ } if (context->cycles >= context->sync_cycle) { context->should_return = 1; - context->target_cycle = context->cycles; + context->target_cycle = context->cycles + 1; return; } if (context->status & M68K_STATUS_TRACE || context->trace_pending) { - context->target_cycle = context->cycles; + context->target_cycle = context->cycles + 1; return; } context->target_cycle = context->sync_cycle < context->int_cycle ? context->sync_cycle : context->int_cycle; @@ -662,6 +672,9 @@ } } } + if (context->target_cycle <= context->cycles) { + context->target_cycle = context->cycles + 1; + } } static uint16_t sub_gate_read16(uint32_t address, void *vcontext)