[Core/CD] minor Main-CPU/Sub-CPU synchronization optimization

This commit is contained in:
ekeeke
2026-09-23 22:54:08 +02:00
parent fdab4a4ed7
commit 50fc4091f7
2 changed files with 12 additions and 8 deletions
+6 -4
View File
@@ -504,14 +504,16 @@ static void s68k_poll_sync(unsigned int reg_mask)
static void m68k_sync(void)
{
/* check MAIN-CPU is still running */
if (!m68k.stopped)
{
/* relative MAIN-CPU cycle counter */
unsigned int cycles = (s68k.cycles * MCYCLES_PER_LINE) / SCYCLES_PER_LINE;
/* sync MAIN-CPU with SUB-CPU (only if MAIN-CPU execution frame is finished, to prevent recursive execution) */
/* check MAIN-CPU execution frame is finished (to prevent recursive execution) */
if (!m68k.cycle_end)
{
/* relative MAIN-CPU cycle counter */
unsigned int cycles = (s68k.cycles * MCYCLES_PER_LINE) / SCYCLES_PER_LINE;
/* sync MAIN-CPU with SUB-CPU */
m68k_run(cycles);
}
}
+6 -4
View File
@@ -302,14 +302,16 @@ static void m68k_poll_sync(unsigned int reg_mask)
static void s68k_sync(void)
{
/* check SUB-CPU is still running */
if (!s68k.stopped)
{
/* relative SUB-CPU cycle counter */
unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE;
/* sync SUB-CPU with MAIN-CPU (only if SUB-CPU execution frame is finished, to prevent recursive execution) */
/* check SUB-CPU execution frame is finished (to prevent recursive execution) */
if (!s68k.cycle_end)
{
/* relative SUB-CPU cycle counter */
unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE;
/* sync SUB-CPU with MAIN-CPU */
s68k_run(cycles);
}
}