From 2fe81791ef7426adc3124d62e2d7761891e61e8b Mon Sep 17 00:00:00 2001 From: EkeEke Date: Mon, 21 Oct 2013 00:20:28 +0200 Subject: [PATCH] [Core/MCD] improved Sub-CPU synchronization with Main-CPU (fixes "Soul Star") --- core/mem68k.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/mem68k.c b/core/mem68k.c index 0004d03..60f0763 100644 --- a/core/mem68k.c +++ b/core/mem68k.c @@ -498,6 +498,15 @@ unsigned int ctrl_io_read_word(unsigned int address) /* default registers */ if (index < 0x30) { + /* relative SUB-CPU cycle counter */ + unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE; + + /* sync SUB-CPU with MAIN-CPU (Soul Star) */ + if (!s68k.stopped && (s68k.cycles < cycles)) + { + s68k_run(cycles); + } + /* SUB-CPU communication words */ if (index >= 0x20) {