mcd, minor optimization for poll detection

This commit is contained in:
kub 2022-10-13 19:25:25 +00:00
parent fdaf9d10bd
commit b074a2b5b6
2 changed files with 11 additions and 3 deletions

View file

@ -345,8 +345,10 @@ void pcd_run_cpus_normal(int m68k_cycles)
if (Pico_mcd->m.m68k_poll_cnt >= 16) { if (Pico_mcd->m.m68k_poll_cnt >= 16) {
int s68k_left; int s68k_left;
// main CPU is polling, (wake and) run sub only // main CPU is polling, (wake and) run sub only
if (SekIsStoppedS68k()) if (SekIsStoppedS68k()) {
SekSetStopS68k(0); SekSetStopS68k(0);
Pico_mcd->m.s68k_poll_cnt = 0;
}
s68k_left = pcd_sync_s68k(Pico.t.m68c_aim, 1); s68k_left = pcd_sync_s68k(Pico.t.m68c_aim, 1);
Pico.t.m68c_cnt = Pico.t.m68c_aim; Pico.t.m68c_cnt = Pico.t.m68c_aim;

View file

@ -85,7 +85,7 @@ void m68k_comm_check(u32 a)
return; return;
} }
Pico_mcd->m.m68k_poll_cnt++; 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); SekEndRun(0);
} }
@ -231,7 +231,7 @@ void m68k_reg_write8(u32 a, u32 d)
return; return;
write_comm: write_comm:
if (d == Pico_mcd->s68k_regs[a]) if (Pico_mcd->s68k_regs[a] == (u8)d)
return; return;
pcd_sync_s68k(SekCyclesDone(), 0); pcd_sync_s68k(SekCyclesDone(), 0);
@ -490,6 +490,9 @@ void s68k_reg_write8(u32 a, u32 d)
return; return;
write_comm: write_comm:
if (Pico_mcd->s68k_regs[a] == (u8)d)
return;
Pico_mcd->s68k_regs[a] = (u8) d; Pico_mcd->s68k_regs[a] = (u8) d;
if (Pico_mcd->m.m68k_poll_cnt) if (Pico_mcd->m.m68k_poll_cnt)
SekEndRunS68k(0); SekEndRunS68k(0);
@ -550,6 +553,9 @@ void s68k_reg_write16(u32 a, u32 d)
return; return;
write_comm: write_comm:
if (r[a] == (u8)(d >> 8) && r[a + 1] == (u8)d)
return;
r[a] = d >> 8; r[a] = d >> 8;
r[a + 1] = d; r[a + 1] = d;
if (Pico_mcd->m.m68k_poll_cnt) if (Pico_mcd->m.m68k_poll_cnt)