Fixed PCx86 to recover from situations where a page entered an "unloaded" state but wasn't actually unloaded.

This commit is contained in:
Jeff Parsons 2017-07-19 14:57:19 -07:00 committed by Jeff Parsons
commit 6c6f28c1ef
9 changed files with 2698 additions and 2630 deletions

View file

@ -472,11 +472,20 @@ class CPU extends Component {
case "run":
this.bindings[sBinding] = control;
control.onclick = function onClickRun() {
var fRunning = cpu.flags.running;
if (!cpu.cmp || !cpu.cmp.checkPower()) return;
if (!cpu.flags.running)
cpu.runCPU(true);
else
cpu.stopCPU(true);
/*
* We snapped the CPU's running flag before calling checkPower() because there are rare (REPOWER)
* situations where checkPower() will have started the CPU as well. So toggle the CPU state ONLY
* if the running flag remains unchanged.
*/
if (fRunning == cpu.flags.running) {
if (!cpu.flags.running) {
cpu.runCPU(true);
} else {
cpu.stopCPU(true);
}
}
};
fBound = true;
break;