From: kub Date: Tue, 9 May 2023 10:04:40 +0000 (+0000) Subject: mcd, improve cpu scheduling X-Git-Tag: v2.00~233 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02db230830b9370f7720da16201b8f61d6eec342;p=picodrive.git mcd, improve cpu scheduling --- diff --git a/pico/cd/mcd.c b/pico/cd/mcd.c index 223d1f2f..abe3c4a6 100644 --- a/pico/cd/mcd.c +++ b/pico/cd/mcd.c @@ -283,7 +283,7 @@ void pcd_irq_s68k(int irq, int state) SekInterruptS68k(irq); if (SekIsStoppedS68k()) SekSetStopS68k(0); - Pico_mcd->m.s68k_poll_a = 0; + Pico_mcd->m.s68k_poll_cnt = 0; } else SekInterruptClearS68k(irq); } diff --git a/pico/cd/memory.c b/pico/cd/memory.c index fc677501..72dadfe3 100644 --- a/pico/cd/memory.c +++ b/pico/cd/memory.c @@ -71,9 +71,9 @@ void m68k_comm_check(u32 a) u32 cycles = SekCyclesDone(); u32 clkdiff = cycles - Pico_mcd->m.m68k_poll_clk; pcd_sync_s68k(cycles, 0); - if (a >= 0x0e && !Pico_mcd->m.need_sync) { + if (a == 0x0e && !Pico_mcd->m.need_sync && (Pico_mcd->s68k_regs[3]&0x4)) { // there are cases when slave updates comm and only switches RAM - // over after that (mcd1b), so there must be a resync.. + // over after that (mcd1 bios), so there must be a resync.. SekEndRun(64); Pico_mcd->m.need_sync = 1; } @@ -86,7 +86,7 @@ void m68k_comm_check(u32 a) } Pico_mcd->m.m68k_poll_cnt++; if(Pico_mcd->m.m68k_poll_cnt >= POLL_LIMIT) - SekEndRun(0); + SekEndRun(8); } #ifndef _ASM_CD_MEMORY_C @@ -241,7 +241,7 @@ write_comm: // slave. This can produce race conditions where slave switches RAM back to // master while master is delayed by interrupt before the check executes. // Delay slave a bit to make sure master can check before slave changes. - SekCycleCntS68k += 24; + SekCycleCntS68k += 24; // Silpheed } if (Pico_mcd->m.s68k_poll_a == (a & ~1)) { @@ -249,7 +249,7 @@ write_comm: elprintf(EL_CDPOLL, "s68k poll release, a=%02x", a); SekSetStopS68k(0); } - Pico_mcd->m.s68k_poll_a = 0; + Pico_mcd->m.s68k_poll_cnt = 0; } } @@ -259,6 +259,7 @@ u32 s68k_poll_detect(u32 a, u32 d) u32 cycles, cnt = 0; if (SekIsStoppedS68k()) return d; + SekEndRunS68k(8); cycles = SekCyclesDoneS68k(); if (!SekNotPollingS68k && a == Pico_mcd->m.s68k_poll_a) { @@ -266,7 +267,7 @@ u32 s68k_poll_detect(u32 a, u32 d) if (clkdiff <= POLL_CYCLES) { cnt = Pico_mcd->m.s68k_poll_cnt + 1; //printf("-- diff: %u, cnt = %i\n", clkdiff, cnt); - if (Pico_mcd->m.s68k_poll_cnt > POLL_LIMIT) { + if (cnt > POLL_LIMIT) { SekSetStopS68k(1); elprintf(EL_CDPOLL, "s68k poll detected @%06x, a=%02x", SekPcS68k, a); @@ -495,7 +496,7 @@ write_comm: Pico_mcd->s68k_regs[a] = (u8) d; if (Pico_mcd->m.m68k_poll_cnt) - SekEndRunS68k(0); + SekEndRunS68k(8); Pico_mcd->m.m68k_poll_cnt = 0; } @@ -559,7 +560,7 @@ write_comm: r[a] = d >> 8; r[a + 1] = d; if (Pico_mcd->m.m68k_poll_cnt) - SekEndRunS68k(0); + SekEndRunS68k(8); Pico_mcd->m.m68k_poll_cnt = 0; }