Try the same calRemainingTime() anomaly-detection code in PCx86 that we've already implemented in PC8080

This commit is contained in:
Jeff Parsons 2016-09-06 11:08:01 -07:00
commit 6fb2f02b13
2 changed files with 11 additions and 1 deletions

View file

@ -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;
};

View file

@ -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