From: notaz Date: Wed, 4 Sep 2013 22:09:17 +0000 (+0300) Subject: cd: tweak the poll code further X-Git-Tag: v1.90~20 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30e8aac43f1a7afbc3ac8a4b0b13c80d1a7243d2;p=picodrive.git cd: tweak the poll code further --- diff --git a/pico/cd/mcd.c b/pico/cd/mcd.c index 0157bb56..0824ec0d 100644 --- a/pico/cd/mcd.c +++ b/pico/cd/mcd.c @@ -82,6 +82,9 @@ static __inline void SekRunS68k(unsigned int to) if ((cyc_do = SekCycleAimS68k - SekCycleCntS68k) <= 0) return; + if (SekShouldInterrupt()) + Pico_mcd->m.s68k_poll_a = 0; + SekCycleCntS68k += cyc_do; #if defined(EMU_C68K) PicoCpuCS68k.cycles = cyc_do; @@ -263,7 +266,7 @@ static void SekSyncM68k(void); static inline void pcd_run_cpus_normal(int m68k_cycles) { SekCycleAim += m68k_cycles; - if (SekShouldInterrupt()) + if (SekShouldInterrupt() || Pico_mcd->m.m68k_poll_cnt < 12) Pico_mcd->m.m68k_poll_cnt = 0; else if (Pico_mcd->m.m68k_poll_cnt >= 16) { int s68k_left = pcd_sync_s68k(SekCycleAim, 1); diff --git a/pico/cd/memory.c b/pico/cd/memory.c index 4b4c18f8..2d8cc764 100644 --- a/pico/cd/memory.c +++ b/pico/cd/memory.c @@ -70,7 +70,7 @@ static void remap_word_ram(u32 r3); // poller detection #define POLL_LIMIT 16 -#define POLL_CYCLES 124 +#define POLL_CYCLES 64 void m68k_comm_check(u32 a) { @@ -143,9 +143,6 @@ void m68k_reg_write8(u32 a, u32 d) u32 dold; a &= 0x3f; - Pico_mcd->m.m68k_poll_a = - Pico_mcd->m.m68k_poll_cnt = 0; - switch (a) { case 0: d &= 1; @@ -230,18 +227,17 @@ write_comm: if (d == Pico_mcd->s68k_regs[a]) return; - Pico_mcd->s68k_regs[a] = d; pcd_sync_s68k(SekCyclesDone(), 0); - if (Pico_mcd->m.s68k_poll_a == a && Pico_mcd->m.s68k_poll_cnt > POLL_LIMIT) { + Pico_mcd->s68k_regs[a] = d; + if (Pico_mcd->m.s68k_poll_a == (a & ~1) + && Pico_mcd->m.s68k_poll_cnt > POLL_LIMIT) + { SekSetStopS68k(0); Pico_mcd->m.s68k_poll_a = 0; elprintf(EL_CDPOLL, "s68k poll release, a=%02x", a); } } -#ifndef _ASM_CD_MEMORY_C -static -#endif u32 s68k_poll_detect(u32 a, u32 d) { #ifdef USE_POLL_DETECT @@ -807,7 +803,7 @@ static u32 PicoReadS68k8_pr(u32 a) a &= 0x1ff; if (a >= 0x0e && a < 0x30) { d = Pico_mcd->s68k_regs[a]; - s68k_poll_detect(a, d); + s68k_poll_detect(a & ~1, d); goto regs_done; } else if (a >= 0x58 && a < 0x68)