From 1fc576e72f5ce1856886b3b0132cf5f6dcc8f80d Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Sun, 2 Aug 2009 21:37:45 +0000 Subject: [PATCH] From: hoge hoge Date: Sat, 25 Jul 2009 11:57:29 -0700 To: submit@mamedev.org Subject: 68k cpu reset eat cycles fix Hello, Attached is a diff for 0133 that fixes a bug related to eating cycles during 68k cpu reset. Previously, initial_cycles had a wrong value after reset, and if cycles were < 0, it'd always return 0, .. check the diff to see what I mean. This change also happens to fix a scrolling bug in Fantasy Zone, introduced when that cycle eating thing was added. Greets, hap --- src/emu/cpu/m68000/m68kcpu.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index fbf4a52dcc7..4c4b6faee8b 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -540,15 +540,19 @@ static CPU_EXECUTE( m68k ) { m68ki_cpu_core *m68k = get_safe_token(device); + m68k->initial_cycles = cycles; + /* eat up any reset cycles */ - cycles -= m68k->reset_cycles; - m68k->reset_cycles = 0; - if (cycles <= 0) - return m68k->reset_cycles; + if (m68k->reset_cycles) { + int rc = m68k->reset_cycles; + m68k->reset_cycles = 0; + cycles -= rc; + + if (cycles <= 0) return rc; + } /* Set our pool of clock cycles available */ m68k->remaining_cycles = cycles; - m68k->initial_cycles = cycles; /* See if interrupts came in */ m68ki_check_interrupts(m68k);