From 3cdd222f5146805c4feb351586c603636bc91dda Mon Sep 17 00:00:00 2001 From: beirich Date: Thu, 17 Mar 2011 05:54:21 +0000 Subject: [PATCH] HuC6280: Fix glitch in low-speed mode --- BizHawk.Emulation/CPUs/HuC6280/Execute.cs | 3 +++ CpuCoreGenerator/HuC6280/CoreGenerator.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/BizHawk.Emulation/CPUs/HuC6280/Execute.cs b/BizHawk.Emulation/CPUs/HuC6280/Execute.cs index 3fcf367eea..84a911b428 100644 --- a/BizHawk.Emulation/CPUs/HuC6280/Execute.cs +++ b/BizHawk.Emulation/CPUs/HuC6280/Execute.cs @@ -2116,7 +2116,10 @@ throw new Exception("break"); AfterClearTFlag: // SET command jumps here int delta = lastCycles - PendingCycles; if (LowSpeed) + { delta *= 4; + PendingCycles = lastCycles - delta; + } TotalExecutedCycles += delta; if (TimerEnabled) diff --git a/CpuCoreGenerator/HuC6280/CoreGenerator.cs b/CpuCoreGenerator/HuC6280/CoreGenerator.cs index 3b65561b8e..f2e11df9b0 100644 --- a/CpuCoreGenerator/HuC6280/CoreGenerator.cs +++ b/CpuCoreGenerator/HuC6280/CoreGenerator.cs @@ -501,7 +501,10 @@ namespace HuC6280 w.WriteLine(" AfterClearTFlag: // SET command jumps here"); w.WriteLine(" int delta = lastCycles - PendingCycles;"); w.WriteLine(" if (LowSpeed)"); + w.WriteLine(" {"); w.WriteLine(" delta *= 4;"); + w.WriteLine(" PendingCycles = lastCycles - delta;"); + w.WriteLine(" }"); w.WriteLine(" TotalExecutedCycles += delta;"); w.WriteLine(); w.WriteLine(" if (TimerEnabled)");