From b074a2b5b604c14a9828d7f6737dd3c01dee2ed3 Mon Sep 17 00:00:00 2001 From: kub Date: Thu, 13 Oct 2022 19:25:25 +0000 Subject: [PATCH] mcd, minor optimization for poll detection --- pico/cd/mcd.c | 4 +++- pico/cd/memory.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pico/cd/mcd.c b/pico/cd/mcd.c index 732a4299..223d1f2f 100644 --- a/pico/cd/mcd.c +++ b/pico/cd/mcd.c @@ -345,8 +345,10 @@ void pcd_run_cpus_normal(int m68k_cycles) if (Pico_mcd->m.m68k_poll_cnt >= 16) { int s68k_left; // main CPU is polling, (wake and) run sub only - if (SekIsStoppedS68k()) + if (SekIsStoppedS68k()) { SekSetStopS68k(0); + Pico_mcd->m.s68k_poll_cnt = 0; + } s68k_left = pcd_sync_s68k(Pico.t.m68c_aim, 1); Pico.t.m68c_cnt = Pico.t.m68c_aim; diff --git a/pico/cd/memory.c b/pico/cd/memory.c index 0a84f782..fc677501 100644 --- a/pico/cd/memory.c +++ b/pico/cd/memory.c @@ -85,7 +85,7 @@ void m68k_comm_check(u32 a) return; } Pico_mcd->m.m68k_poll_cnt++; - if(Pico_mcd->m.m68k_poll_cnt == POLL_LIMIT) + if(Pico_mcd->m.m68k_poll_cnt >= POLL_LIMIT) SekEndRun(0); } @@ -231,7 +231,7 @@ void m68k_reg_write8(u32 a, u32 d) return; write_comm: - if (d == Pico_mcd->s68k_regs[a]) + if (Pico_mcd->s68k_regs[a] == (u8)d) return; pcd_sync_s68k(SekCyclesDone(), 0); @@ -490,6 +490,9 @@ void s68k_reg_write8(u32 a, u32 d) return; write_comm: + if (Pico_mcd->s68k_regs[a] == (u8)d) + return; + Pico_mcd->s68k_regs[a] = (u8) d; if (Pico_mcd->m.m68k_poll_cnt) SekEndRunS68k(0); @@ -550,6 +553,9 @@ void s68k_reg_write16(u32 a, u32 d) return; write_comm: + if (r[a] == (u8)(d >> 8) && r[a + 1] == (u8)d) + return; + r[a] = d >> 8; r[a + 1] = d; if (Pico_mcd->m.m68k_poll_cnt) -- 2.39.5