From 6fb2f02b133506c7e946f201f61db1bf7e6f3bb8 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 6 Sep 2016 11:08:01 -0700 Subject: [PATCH] Try the same calRemainingTime() anomaly-detection code in PCx86 that we've already implemented in PC8080 --- modules/pcx86/lib/computer.js | 4 +++- modules/pcx86/lib/cpu.js | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/pcx86/lib/computer.js b/modules/pcx86/lib/computer.js index c4cd06ace..56eef9b79 100644 --- a/modules/pcx86/lib/computer.js +++ b/modules/pcx86/lib/computer.js @@ -1425,7 +1425,9 @@ Computer.prototype.getMachineComponent = function(sType, componentPrev) } if (component.type == sType) return component; } - if (!componentLast) Component.log("Machine component type '" + sType + "' not found", "warning"); + if (!componentLast && sType != "FPU") { + Component.log("Machine component type '" + sType + "' not found", "warning"); + } return null; }; diff --git a/modules/pcx86/lib/cpu.js b/modules/pcx86/lib/cpu.js index 0b72fd934..685aed82f 100644 --- a/modules/pcx86/lib/cpu.js +++ b/modules/pcx86/lib/cpu.js @@ -917,6 +917,14 @@ CPU.prototype.calcRemainingTime = function() this.calcSpeed(nCycles, msElapsed); if (msRemainsThisRun < 0 || this.aCounts.mhz < this.aCounts.mhzTarget) { + /* + * Try "throwing out" the effects of large anomalies, by moving the overall run start time up; + * ordinarily, this should only happen when the someone is using an external Debugger or some other + * tool or feature that is interfering with our overall execution. + */ + if (msRemainsThisRun < -1000) { + this.aCounts.msStartRun -= msRemainsThisRun; + } /* * If the last burst took MORE time than we allotted (ie, it's taking more than 1 second to simulate * nCyclesPerSecond), all we can do is yield for as little time as possible (ie, 0ms) and hope that the