From aef1b342fb9bd54dbb31f9e00396696ab137b333 Mon Sep 17 00:00:00 2001 From: EkeEke Date: Wed, 30 Oct 2013 00:37:10 +0100 Subject: [PATCH] [Core/MCD] removed redundant checking on CPU sync --- core/cd_hw/scd.c | 12 ++++++------ core/mem68k.c | 40 ++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/core/cd_hw/scd.c b/core/cd_hw/scd.c index 321d7bc..1026506 100644 --- a/core/cd_hw/scd.c +++ b/core/cd_hw/scd.c @@ -232,7 +232,7 @@ static void s68k_poll_sync(unsigned int reg_mask) unsigned int cycles = (s68k.cycles * MCYCLES_PER_LINE) / SCYCLES_PER_LINE; /* sync MAIN-CPU with SUB-CPU */ - if (!m68k.stopped && (m68k.cycles < cycles)) + if (!m68k.stopped) { m68k_run(cycles); } @@ -433,12 +433,12 @@ static unsigned int scd_read_word(unsigned int address) /* MAIN-CPU communication words */ if ((address & 0x1f0) == 0x10) { - /* relative MAIN-CPU cycle counter */ - unsigned int cycles = (s68k.cycles * MCYCLES_PER_LINE) / SCYCLES_PER_LINE; - - /* sync MAIN-CPU with SUB-CPU (Mighty Morphin Power Rangers) */ - if (!m68k.stopped && (m68k.cycles < cycles)) + 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 (Mighty Morphin Power Rangers) */ m68k_run(cycles); } diff --git a/core/mem68k.c b/core/mem68k.c index 0a31466..78f2d82 100644 --- a/core/mem68k.c +++ b/core/mem68k.c @@ -269,7 +269,7 @@ static void m68k_poll_sync(unsigned int reg_mask) unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE; /* sync SUB-CPU with MAIN-CPU */ - if (!s68k.stopped && (s68k.cycles < cycles)) + if (!s68k.stopped) { s68k_run(cycles); } @@ -345,12 +345,12 @@ unsigned int ctrl_io_read_byte(unsigned int address) /* SUB-CPU communication flags */ if (index == 0x0f) { - /* relative SUB-CPU cycle counter */ - unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE; - - /* sync SUB-CPU with MAIN-CPU (Dracula Unleashed w/ Sega CD Model 2 Boot ROM) */ - if (!s68k.stopped && (s68k.cycles < cycles)) + 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 (Dracula Unleashed w/ Sega CD Model 2 Boot ROM) */ s68k_run(cycles); } @@ -498,18 +498,18 @@ 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) { + 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 (Soul Star) */ + s68k_run(cycles); + } + m68k_poll_detect(3 << (index - 0x10)); } @@ -620,12 +620,12 @@ void ctrl_io_write_byte(unsigned int address, unsigned int data) /* level 2 interrupt enabled ? */ if (scd.regs[0x32>>1].byte.l & 0x04) { - /* relative SUB-CPU cycle counter */ - unsigned int cycles = (m68k.cycles * SCYCLES_PER_LINE) / MCYCLES_PER_LINE; - - /* sync SUB-CPU with MAIN-CPU (Earnest Evans, Fhey Area) */ - if (!s68k.stopped && (s68k.cycles < cycles)) + 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 (Earnest Evans, Fhey Area) */ s68k_run(cycles); }