Bumped version to 1.30 in honor of the PDP11 module that's being integrated, along with my first attempt to use a newer version of the Closure Compiler (ie, the JavaScript version), as well as giving Gulp a try -- although Gulp leaves just as bad a taste in my mouth as Grunt did
This commit is contained in:
parent
bbaf0d141f
commit
3bd02c7e19
298 changed files with 16473 additions and 3885 deletions
|
|
@ -15,7 +15,7 @@ The project currently includes these emulation modules:
|
|||
* [C1Pjs](c1pjs/): 6502 emulation module for the [Challenger 1P](/devices/c1p/)
|
||||
* [PCx86](pcx86/): x86 emulation module for [IBM PC machines](/devices/pcx86/)
|
||||
* [PC8080](pc8080/): 8080 emulation module for [8080-based machines](/devices/pc8080/)
|
||||
* [PDP11](pdp11/): PDP-11 emulation module for [PDP-11 machines](/devices/pdp11/) (eg, PDP-11/45, PDP-11/70)
|
||||
* [PDP11js](pdp11/): PDP-11 emulation module for [PDP-11 machines](/devices/pdp11/) (eg, PDP-11/45, PDP-11/70)
|
||||
|
||||
along with variety of Node support modules, such as:
|
||||
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ function C1PCPU(parmsCPU)
|
|||
Component.call(this, "C1PCPU", parmsCPU);
|
||||
|
||||
this.clearRegs();
|
||||
this.flags.fPowered = false;
|
||||
this.flags.fRunning = false;
|
||||
this.flags.powered = false;
|
||||
this.flags.running = false;
|
||||
this.fAutoStart = parmsCPU["autoStart"];
|
||||
|
||||
/*
|
||||
|
|
@ -488,7 +488,7 @@ Component.subclass(C1PCPU);
|
|||
*/
|
||||
C1PCPU.prototype.reset = function(fPowerOn)
|
||||
{
|
||||
if (this.flags.fRunning) {
|
||||
if (this.flags.running) {
|
||||
this.halt();
|
||||
}
|
||||
this.clearRegs();
|
||||
|
|
@ -523,7 +523,7 @@ C1PCPU.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
this.bindings[sBinding] = control;
|
||||
control.onclick = function(cpu) {
|
||||
return function() {
|
||||
if (!cpu.flags.fRunning) {
|
||||
if (!cpu.flags.running) {
|
||||
cpu.run();
|
||||
} else {
|
||||
cpu.halt();
|
||||
|
|
@ -587,7 +587,7 @@ C1PCPU.prototype.setBuffer = function(abMemory, start, end)
|
|||
*/
|
||||
C1PCPU.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.flags.fPowered) {
|
||||
if (fOn && !this.flags.powered) {
|
||||
this.cmp = cmp;
|
||||
/*
|
||||
* Attach the Debugger, if any, to the CPU, so that the CPU can periodically
|
||||
|
|
@ -615,7 +615,7 @@ C1PCPU.prototype.setPower = function(fOn, cmp)
|
|||
};
|
||||
}(video);
|
||||
}
|
||||
this.flags.fPowered = true;
|
||||
this.flags.powered = true;
|
||||
this.reset(true);
|
||||
this.update();
|
||||
}
|
||||
|
|
@ -888,7 +888,7 @@ C1PCPU.prototype.displayStatus = function()
|
|||
*/
|
||||
C1PCPU.prototype.isRunning = function()
|
||||
{
|
||||
return this.flags.fRunning;
|
||||
return this.flags.running;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1059,7 +1059,7 @@ C1PCPU.prototype.run = function()
|
|||
if (this.cmp) this.cmp.stop(this.msRunStart, this.nRunCycles);
|
||||
return;
|
||||
}
|
||||
if (!this.flags.fRunning) {
|
||||
if (!this.flags.running) {
|
||||
/*
|
||||
* setSpeed() without a speed parameter leaves the selected speed in place, but also resets the
|
||||
* cycle counter and timestamp for the current series of run() calls, calculates the maximum number
|
||||
|
|
@ -1068,7 +1068,7 @@ C1PCPU.prototype.run = function()
|
|||
*/
|
||||
this.setSpeed();
|
||||
if (this.cmp) this.cmp.start();
|
||||
this.flags.fRunning = true;
|
||||
this.flags.running = true;
|
||||
if (this.bindings["run"]) this.bindings["run"].innerHTML = "Halt";
|
||||
this.setFocus();
|
||||
}
|
||||
|
|
@ -1115,7 +1115,7 @@ C1PCPU.prototype.run = function()
|
|||
this.nCyclesNextYield += this.nCyclesPerYield;
|
||||
break;
|
||||
}
|
||||
} while (this.flags.fRunning);
|
||||
} while (this.flags.running);
|
||||
}
|
||||
catch (e) {
|
||||
this.halt();
|
||||
|
|
@ -1276,8 +1276,8 @@ C1PCPU.prototype.halt = function()
|
|||
this.isBusy(true);
|
||||
this.nBurstCycles -= this.nStepCycles;
|
||||
this.nStepCycles = 0;
|
||||
if (this.flags.fRunning) {
|
||||
this.flags.fRunning = false;
|
||||
if (this.flags.running) {
|
||||
this.flags.running = false;
|
||||
if (this.bindings["run"]) this.bindings["run"].innerHTML = "Run";
|
||||
}
|
||||
};
|
||||
|
|
@ -1311,7 +1311,7 @@ C1PCPU.prototype.update = function()
|
|||
*/
|
||||
C1PCPU.prototype.getCycles = function()
|
||||
{
|
||||
return (this.flags.fRunning? this.nRunCycles + this.nBurstCycles - this.nStepCycles : 0);
|
||||
return (this.flags.running? this.nRunCycles + this.nBurstCycles - this.nStepCycles : 0);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -586,8 +586,8 @@ if (DEBUGGER) {
|
|||
*/
|
||||
C1PDebugger.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.flags.fPowered) {
|
||||
this.flags.fPowered = true;
|
||||
if (fOn && !this.flags.powered) {
|
||||
this.flags.powered = true;
|
||||
this.cpu = cmp.getComponentByType("cpu");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ function C1PDiskController(parmsDC)
|
|||
{
|
||||
Component.call(this, "C1PDiskController", parmsDC);
|
||||
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
|
||||
/*
|
||||
* Our DiskController simulates the combination of an MC6820 PIA and an MC6850 ACIA.
|
||||
|
|
@ -743,8 +743,8 @@ C1PDiskController.prototype.setBuffer = function(abMemory, start, end, cpu)
|
|||
*/
|
||||
C1PDiskController.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.flags.fPowered) {
|
||||
this.flags.fPowered = true;
|
||||
if (fOn && !this.flags.powered) {
|
||||
this.flags.powered = true;
|
||||
if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ function C1PKeyboard(parmsKbd)
|
|||
{
|
||||
Component.call(this, "C1PKeyboard", parmsKbd);
|
||||
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
this.nDefaultModel = parmsKbd['model'];
|
||||
|
||||
/*
|
||||
|
|
@ -521,8 +521,8 @@ C1PKeyboard.prototype.setModel = function(nModel)
|
|||
*/
|
||||
C1PKeyboard.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.flags.fPowered) {
|
||||
this.flags.fPowered = true;
|
||||
if (fOn && !this.flags.powered) {
|
||||
this.flags.powered = true;
|
||||
this.cmp = cmp;
|
||||
if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function C1PPanel(parmsPanel)
|
|||
{
|
||||
Component.call(this, "C1PPanel", parmsPanel);
|
||||
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
}
|
||||
|
||||
Component.subclass(C1PPanel);
|
||||
|
|
@ -81,8 +81,8 @@ C1PPanel.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
*/
|
||||
C1PPanel.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.flags.fPowered) {
|
||||
this.flags.fPowered = true;
|
||||
if (fOn && !this.flags.powered) {
|
||||
this.flags.powered = true;
|
||||
this.cmp = cmp;
|
||||
this.cpu = cmp.getComponentByType("cpu");
|
||||
this.kbd = cmp.getComponentByType("keyboard");
|
||||
|
|
|
|||
|
|
@ -118,8 +118,8 @@ C1PROM.prototype.setBuffer = function(abMemory, start, end, cpu)
|
|||
*/
|
||||
C1PROM.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.flags.fPowered) {
|
||||
this.flags.fPowered = true;
|
||||
if (fOn && !this.flags.powered) {
|
||||
this.flags.powered = true;
|
||||
if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ function C1PSerialPort(parmsSerial)
|
|||
{
|
||||
Component.call(this, "C1PSerialPort", parmsSerial);
|
||||
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
this.fDemo = parmsSerial['demo'];
|
||||
|
||||
this.reset(true);
|
||||
|
|
@ -217,8 +217,8 @@ C1PSerialPort.prototype.setBuffer = function(abMemory, start, end, cpu)
|
|||
*/
|
||||
C1PSerialPort.prototype.setPower = function(fOn, cmp)
|
||||
{
|
||||
if (fOn && !this.flags.fPowered) {
|
||||
this.flags.fPowered = true;
|
||||
if (fOn && !this.flags.powered) {
|
||||
this.flags.powered = true;
|
||||
this.cmp = cmp;
|
||||
this.kbd = cmp.getComponentByType("keyboard");
|
||||
if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger");
|
||||
|
|
|
|||
|
|
@ -346,8 +346,8 @@ C1PVideo.prototype.setPower = function(fOn, cmp)
|
|||
* it ourselves, too. This also means that updateScreen() need check only fPower and not isReady(),
|
||||
* since we guarantee that the former implies the latter.
|
||||
*/
|
||||
if (fOn && !this.flags.fPowered && this.isReady()) {
|
||||
this.flags.fPowered = true;
|
||||
if (fOn && !this.flags.powered && this.isReady()) {
|
||||
this.flags.powered = true;
|
||||
if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger");
|
||||
/*
|
||||
* If we have an associated keyboard, then ensure that the keyboard will be notified whenever
|
||||
|
|
@ -366,8 +366,8 @@ C1PVideo.prototype.setPower = function(fOn, cmp)
|
|||
}
|
||||
}
|
||||
else
|
||||
if (!fOn && this.flags.fPowered) {
|
||||
this.flags.fPowered = false;
|
||||
if (!fOn && this.flags.powered) {
|
||||
this.flags.powered = false;
|
||||
/*
|
||||
* This is where we would add some method of blanking the display, without the disturbing the video
|
||||
* buffer contents, and blocking all further updates to the display.
|
||||
|
|
@ -481,7 +481,7 @@ C1PVideo.prototype.initScreen = function()
|
|||
C1PVideo.prototype.updateScreen = function()
|
||||
{
|
||||
var offset = 0;
|
||||
if (this.flags.fPowered) {
|
||||
if (this.flags.powered) {
|
||||
while (offset < this.cbScreen) {
|
||||
var b = this.abMem[this.offVideo + offset];
|
||||
if (this.abScreen[offset] != b) {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ function Computer(parmsComputer, parmsMachine, fSuspended) {
|
|||
|
||||
Component.call(this, "Computer", parmsComputer, Computer, Messages.COMPUTER);
|
||||
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
|
||||
this.setMachineParms(parmsMachine);
|
||||
|
||||
|
|
@ -635,9 +635,9 @@ Computer.prototype.powerOn = function(resume)
|
|||
*/
|
||||
Computer.prototype.powerRestore = function(component, stateComputer, fRepower, fRestore)
|
||||
{
|
||||
if (!component.flags.fPowered) {
|
||||
if (!component.flags.powered) {
|
||||
|
||||
component.flags.fPowered = true;
|
||||
component.flags.powered = true;
|
||||
|
||||
if (component.powerUp) {
|
||||
|
||||
|
|
@ -740,12 +740,12 @@ Computer.prototype.donePowerOn = function(aParms)
|
|||
var fRepower = (aParms[1] < 0);
|
||||
var fRestore = aParms[2];
|
||||
|
||||
if (DEBUG && this.flags.fPowered && this.messageEnabled()) {
|
||||
if (DEBUG && this.flags.powered && this.messageEnabled()) {
|
||||
this.printMessage("Computer.donePowerOn(): redundant");
|
||||
}
|
||||
|
||||
this.fInitialized = true;
|
||||
this.flags.fPowered = true;
|
||||
this.flags.powered = true;
|
||||
var controlPower = this.bindings["power"];
|
||||
if (controlPower) controlPower.textContent = "Shutdown";
|
||||
|
||||
|
|
@ -786,22 +786,22 @@ Computer.prototype.donePowerOn = function(aParms)
|
|||
*/
|
||||
Computer.prototype.checkPower = function()
|
||||
{
|
||||
if (this.flags.fPowered) return true;
|
||||
if (this.flags.powered) return true;
|
||||
|
||||
var component = null, iComponent;
|
||||
var aComponents = Component.getComponents(this.id);
|
||||
for (iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
component = aComponents[iComponent];
|
||||
if (component !== this && !component.flags.fReady) break;
|
||||
if (component !== this && !component.flags.ready) break;
|
||||
}
|
||||
if (iComponent == aComponents.length) {
|
||||
for (iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
component = aComponents[iComponent];
|
||||
if (component !== this && !component.flags.fPowered) break;
|
||||
if (component !== this && !component.flags.powered) break;
|
||||
}
|
||||
}
|
||||
if (iComponent == aComponents.length) component = this;
|
||||
var s = "The " + component.type + " component (" + component.id + ") is not " + (!component.flags.fReady? "ready yet" + (component.fnReady? " (waiting for notification)" : "") : "powered yet") + ".";
|
||||
var s = "The " + component.type + " component (" + component.id + ") is not " + (!component.flags.ready? "ready yet" + (component.fnReady? " (waiting for notification)" : "") : "powered yet") + ".";
|
||||
web.alertUser(s);
|
||||
return false;
|
||||
};
|
||||
|
|
@ -883,7 +883,7 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
|||
data = this.cpu.powerDown(fSave, fShutdown);
|
||||
if (typeof data === "object") stateComputer.set(this.cpu.id, data);
|
||||
if (fShutdown) {
|
||||
this.cpu.flags.fPowered = false;
|
||||
this.cpu.flags.powered = false;
|
||||
if (data === false) sState = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -891,13 +891,13 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
|||
var aComponents = Component.getComponents(this.id);
|
||||
for (var iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
var component = aComponents[iComponent];
|
||||
if (component.flags.fPowered) {
|
||||
if (component.flags.powered) {
|
||||
if (component.powerDown) {
|
||||
data = component.powerDown(fSave, fShutdown);
|
||||
if (typeof data === "object") stateComputer.set(component.id, data);
|
||||
}
|
||||
if (fShutdown) {
|
||||
component.flags.fPowered = false;
|
||||
component.flags.powered = false;
|
||||
if (data === false) sState = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -950,7 +950,7 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
|||
}
|
||||
|
||||
if (fShutdown) {
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
var controlPower = this.bindings["power"];
|
||||
if (controlPower) controlPower.textContent = "Power";
|
||||
}
|
||||
|
|
@ -1321,7 +1321,7 @@ Computer.prototype.storeServerState = function(sUserID, sState, fSync)
|
|||
Computer.prototype.onPower = function()
|
||||
{
|
||||
if (!this.nPowerChange) {
|
||||
if (!this.flags.fPowered) {
|
||||
if (!this.flags.powered) {
|
||||
this.wait(this.powerOn);
|
||||
} else {
|
||||
this.powerOff(false, true);
|
||||
|
|
@ -1342,7 +1342,7 @@ Computer.prototype.onReset = function()
|
|||
* I'm going to start with the presumption that it makes little sense for an "unpowered" computer to be "reset";
|
||||
* ditto if the power state is currently being changed.
|
||||
*/
|
||||
if (!this.flags.fPowered || this.nPowerChange) return;
|
||||
if (!this.flags.powered || this.nPowerChange) return;
|
||||
|
||||
/*
|
||||
* If this is a "resumable" machine (and it's not using a predefined state), then we overload the reset
|
||||
|
|
@ -1526,7 +1526,7 @@ Computer.init = function()
|
|||
var computer = new Computer(parmsComputer, parmsMachine, true);
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onInit(" + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onInit(" + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1563,10 +1563,10 @@ Computer.show = function()
|
|||
if (computer) {
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onShow(" + computer.fInitialized + "," + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onShow(" + computer.fInitialized + "," + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
if (computer.fInitialized && !computer.flags.fPowered) {
|
||||
if (computer.fInitialized && !computer.flags.powered) {
|
||||
/**
|
||||
* Repower the computer, notifying every component to continue running as-is.
|
||||
*/
|
||||
|
|
@ -1612,10 +1612,10 @@ Computer.exit = function()
|
|||
if (computer) {
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onExit(" + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onExit(" + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
if (computer.flags.fPowered) {
|
||||
if (computer.flags.powered) {
|
||||
/**
|
||||
* Power off the computer, giving every component an opportunity to save its state,
|
||||
* but only if 'resume' has been set AND there is no valid resume path (because if a valid resume
|
||||
|
|
|
|||
|
|
@ -98,14 +98,14 @@ function CPU(parmsCPU, nCyclesDefault)
|
|||
/*
|
||||
* We add a number of flags to the set initialized by Component
|
||||
*/
|
||||
this.flags.fRunning = false;
|
||||
this.flags.fStarting = false;
|
||||
this.flags.fAutoStart = parmsCPU['autoStart'];
|
||||
this.flags.running = false;
|
||||
this.flags.starting = false;
|
||||
this.flags.autoStart = parmsCPU['autoStart'];
|
||||
|
||||
/*
|
||||
* TODO: Add some UI for fDisplayLiveRegs (either an XML property, or a UI checkbox, or both)
|
||||
*/
|
||||
this.flags.fDisplayLiveRegs = false;
|
||||
this.flags.displayLiveRegs = false;
|
||||
|
||||
/*
|
||||
* Get checksum parameters, if any. runCPU() behavior is not affected until fChecksum
|
||||
|
|
@ -116,7 +116,7 @@ function CPU(parmsCPU, nCyclesDefault)
|
|||
* command ("x"); for example, "x cs int 5000" will set nCyclesChecksumInterval to 5000
|
||||
* and call resetChecksum().
|
||||
*/
|
||||
this.flags.fChecksum = false;
|
||||
this.flags.checksum = false;
|
||||
this.aCounts.nChecksum = this.aCounts.nCyclesChecksumNext = 0;
|
||||
this.aCounts.nCyclesChecksumStart = parmsCPU["csStart"];
|
||||
this.aCounts.nCyclesChecksumInterval = parmsCPU["csInterval"];
|
||||
|
|
@ -189,7 +189,7 @@ CPU.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
*/
|
||||
var sAutoStart = cmp.getMachineParm('autoStart');
|
||||
if (sAutoStart != null) {
|
||||
this.flags.fAutoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : !!sAutoStart));
|
||||
this.flags.autoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : !!sAutoStart));
|
||||
}
|
||||
|
||||
this.setReady();
|
||||
|
|
@ -272,7 +272,7 @@ CPU.prototype.powerUp = function(data, fRepower)
|
|||
* The Computer component (which is responsible for all powerDown and powerUp notifications)
|
||||
* is now responsible for managing a component's fPowered flag, not us.
|
||||
*
|
||||
* this.flags.fPowered = true;
|
||||
* this.flags.powered = true;
|
||||
*/
|
||||
this.updateCPU();
|
||||
return true;
|
||||
|
|
@ -292,7 +292,7 @@ CPU.prototype.powerDown = function(fSave, fShutdown)
|
|||
* The Computer component (which is responsible for all powerDown and powerUp notifications)
|
||||
* is now responsible for managing a component's fPowered flag, not us.
|
||||
*
|
||||
* this.flags.fPowered = false;
|
||||
* this.flags.powered = false;
|
||||
*/
|
||||
return fSave? this.save() : true;
|
||||
};
|
||||
|
|
@ -308,7 +308,7 @@ CPU.prototype.autoStart = function()
|
|||
/*
|
||||
* Start running automatically on power-up, assuming there's no Debugger and no "Run" button
|
||||
*/
|
||||
if (this.flags.fAutoStart || (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) {
|
||||
if (this.flags.autoStart || (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) {
|
||||
/*
|
||||
* Now we ALSO set fUpdateFocus when calling runCPU(), on the assumption that in the "auto-starting" context,
|
||||
* a machine without focus is like a day without sunshine.
|
||||
|
|
@ -327,7 +327,7 @@ CPU.prototype.autoStart = function()
|
|||
*/
|
||||
CPU.prototype.isPowered = function()
|
||||
{
|
||||
if (!this.flags.fPowered) {
|
||||
if (!this.flags.powered) {
|
||||
this.println(this.toString() + " not powered");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -342,7 +342,7 @@ CPU.prototype.isPowered = function()
|
|||
*/
|
||||
CPU.prototype.isRunning = function()
|
||||
{
|
||||
return this.flags.fRunning;
|
||||
return this.flags.running;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -373,8 +373,8 @@ CPU.prototype.resetChecksum = function()
|
|||
if (this.aCounts.nCyclesChecksumStart === undefined) this.aCounts.nCyclesChecksumStart = 0;
|
||||
if (this.aCounts.nCyclesChecksumInterval === undefined) this.aCounts.nCyclesChecksumInterval = -1;
|
||||
if (this.aCounts.nCyclesChecksumStop === undefined) this.aCounts.nCyclesChecksumStop = -1;
|
||||
this.flags.fChecksum = (this.aCounts.nCyclesChecksumStart >= 0 && this.aCounts.nCyclesChecksumInterval > 0);
|
||||
if (this.flags.fChecksum) {
|
||||
this.flags.checksum = (this.aCounts.nCyclesChecksumStart >= 0 && this.aCounts.nCyclesChecksumInterval > 0);
|
||||
if (this.flags.checksum) {
|
||||
this.aCounts.nChecksum = 0;
|
||||
this.aCounts.nCyclesChecksumNext = this.aCounts.nCyclesChecksumStart - this.nTotalCycles;
|
||||
/*
|
||||
|
|
@ -399,7 +399,7 @@ CPU.prototype.resetChecksum = function()
|
|||
*/
|
||||
CPU.prototype.updateChecksum = function(nCycles)
|
||||
{
|
||||
if (this.flags.fChecksum) {
|
||||
if (this.flags.checksum) {
|
||||
/*
|
||||
* Get a 32-bit summation of the current CPU state and add it to our running 32-bit checksum
|
||||
*/
|
||||
|
|
@ -455,7 +455,7 @@ CPU.prototype.displayValue = function(sLabel, nValue, cch)
|
|||
this.stopCPU();
|
||||
}
|
||||
var sVal;
|
||||
if (!this.flags.fRunning || this.flags.fDisplayLiveRegs) {
|
||||
if (!this.flags.running || this.flags.displayLiveRegs) {
|
||||
sVal = str.toHex(nValue, cch);
|
||||
} else {
|
||||
sVal = "--------".substr(0, cch);
|
||||
|
|
@ -501,7 +501,7 @@ CPU.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
this.bindings[sBinding] = control;
|
||||
control.onclick = function onClickRun() {
|
||||
if (!cpu.cmp || !cpu.cmp.checkPower()) return;
|
||||
if (!cpu.flags.fRunning)
|
||||
if (!cpu.flags.running)
|
||||
cpu.runCPU(true);
|
||||
else
|
||||
cpu.stopCPU(true);
|
||||
|
|
@ -542,7 +542,7 @@ CPU.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
*/
|
||||
CPU.prototype.setBurstCycles = function(nCycles)
|
||||
{
|
||||
if (this.flags.fRunning) {
|
||||
if (this.flags.running) {
|
||||
var nDelta = this.nStepCycles - nCycles;
|
||||
/*
|
||||
* NOTE: If nDelta is negative, we will actually be increasing nStepCycles and nBurstCycles.
|
||||
|
|
@ -732,7 +732,7 @@ CPU.prototype.getSpeedCurrent = function()
|
|||
/*
|
||||
* TODO: Has toFixed() been "fixed" in all browsers (eg, IE) to return a rounded value now?
|
||||
*/
|
||||
return ((this.flags.fRunning && this.aCounts.mhz)? (this.aCounts.mhz.toFixed(2) + "Mhz") : "Stopped");
|
||||
return ((this.flags.running && this.aCounts.mhz)? (this.aCounts.mhz.toFixed(2) + "Mhz") : "Stopped");
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -962,7 +962,7 @@ CPU.prototype.runCPU = function(fUpdateFocus)
|
|||
this.calcStartTime();
|
||||
try {
|
||||
do {
|
||||
var nCyclesPerBurst = (this.flags.fChecksum? 1 : this.aCounts.nCyclesPerBurst);
|
||||
var nCyclesPerBurst = (this.flags.checksum? 1 : this.aCounts.nCyclesPerBurst);
|
||||
|
||||
/*
|
||||
* nCyclesPerBurst is how many cycles we WANT to run on each iteration of stepCPU(), but it may run
|
||||
|
|
@ -999,7 +999,7 @@ CPU.prototype.runCPU = function(fUpdateFocus)
|
|||
this.aCounts.nCyclesNextYield += this.aCounts.nCyclesPerYield;
|
||||
break;
|
||||
}
|
||||
} while (this.flags.fRunning);
|
||||
} while (this.flags.running);
|
||||
}
|
||||
catch (e) {
|
||||
this.stopCPU();
|
||||
|
|
@ -1021,7 +1021,7 @@ CPU.prototype.runCPU = function(fUpdateFocus)
|
|||
*/
|
||||
CPU.prototype.startCPU = function(fUpdateFocus)
|
||||
{
|
||||
if (!this.flags.fRunning) {
|
||||
if (!this.flags.running) {
|
||||
/*
|
||||
* setSpeed() without a speed parameter leaves the selected speed in place, but also resets the
|
||||
* cycle counter and timestamp for the current series of runCPU() calls, calculates the maximum number
|
||||
|
|
@ -1030,8 +1030,8 @@ CPU.prototype.startCPU = function(fUpdateFocus)
|
|||
*/
|
||||
this.setSpeed();
|
||||
if (this.cmp) this.cmp.start(this.aCounts.msStartRun, this.getCycles());
|
||||
this.flags.fRunning = true;
|
||||
this.flags.fStarting = true;
|
||||
this.flags.running = true;
|
||||
this.flags.starting = true;
|
||||
if (this.chipset) this.chipset.start();
|
||||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Halt";
|
||||
|
|
@ -1074,13 +1074,13 @@ CPU.prototype.stopCPU = function(fComplete)
|
|||
this.nStepCycles = 0;
|
||||
this.addCycles(this.nRunCycles);
|
||||
this.nRunCycles = 0;
|
||||
if (this.flags.fRunning) {
|
||||
this.flags.fRunning = false;
|
||||
if (this.flags.running) {
|
||||
this.flags.running = false;
|
||||
if (this.chipset) this.chipset.stop();
|
||||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Run";
|
||||
}
|
||||
this.flags.fComplete = fComplete;
|
||||
this.flags.complete = fComplete;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ function CPUState(parmsCPU)
|
|||
* stepCPU() call, but it's good form to do so.
|
||||
*/
|
||||
this.resetCycles();
|
||||
this.flags.fComplete = this.flags.fDebugCheck = false;
|
||||
this.flags.complete = this.flags.debugCheck = false;
|
||||
|
||||
/*
|
||||
* If there are no live registers to display, then updateStatus() can skip a bit....
|
||||
|
|
@ -406,7 +406,7 @@ CPUState.prototype.initProcessor = function()
|
|||
*/
|
||||
CPUState.prototype.reset = function()
|
||||
{
|
||||
if (this.flags.fRunning) this.stopCPU();
|
||||
if (this.flags.running) this.stopCPU();
|
||||
this.resetRegs();
|
||||
this.resetCycles();
|
||||
this.clearError(); // clear any fatal error/exception that setError() may have flagged
|
||||
|
|
@ -1276,7 +1276,7 @@ CPUState.prototype.updateReg = function(sReg, nValue, cch)
|
|||
CPUState.prototype.updateStatus = function(fForce)
|
||||
{
|
||||
if (this.cLiveRegs) {
|
||||
if (fForce || !this.flags.fRunning || this.flags.fDisplayLiveRegs) {
|
||||
if (fForce || !this.flags.running || this.flags.displayLiveRegs) {
|
||||
this.updateReg("A", this.regA);
|
||||
this.updateReg("B", this.regB);
|
||||
this.updateReg("C", this.regC);
|
||||
|
|
@ -1333,12 +1333,12 @@ CPUState.prototype.stepCPU = function(nMinCycles)
|
|||
* Debugger is single-stepping (even when performing multiple single-steps), fRunning is never set,
|
||||
* so stopCPU() would have no effect as far as the Debugger is concerned.
|
||||
*/
|
||||
this.flags.fComplete = true;
|
||||
this.flags.complete = true;
|
||||
|
||||
/*
|
||||
* fDebugCheck is true if we need to "check" every instruction with the Debugger.
|
||||
*/
|
||||
var fDebugCheck = this.flags.fDebugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled());
|
||||
var fDebugCheck = this.flags.debugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled());
|
||||
|
||||
/*
|
||||
* nDebugState is checked only when fDebugCheck is true, and its sole purpose is to tell the first call
|
||||
|
|
@ -1348,8 +1348,8 @@ CPUState.prototype.stepCPU = function(nMinCycles)
|
|||
* Once we snap fStarting, we clear it, because technically, we've moved beyond "starting" and have
|
||||
* officially "started" now.
|
||||
*/
|
||||
var nDebugState = (!nMinCycles)? -1 : (this.flags.fStarting? 0 : 1);
|
||||
this.flags.fStarting = false;
|
||||
var nDebugState = (!nMinCycles)? -1 : (this.flags.starting? 0 : 1);
|
||||
this.flags.starting = false;
|
||||
|
||||
/*
|
||||
* We move the minimum cycle count to nStepCycles (the number of cycles left to step), so that other
|
||||
|
|
@ -1402,7 +1402,7 @@ CPUState.prototype.stepCPU = function(nMinCycles)
|
|||
|
||||
} while (this.nStepCycles > 0);
|
||||
|
||||
return (this.flags.fComplete? this.nBurstCycles - this.nStepCycles : (this.flags.fComplete === undefined? 0 : -1));
|
||||
return (this.flags.complete? this.nBurstCycles - this.nStepCycles : (this.flags.complete === undefined? 0 : -1));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1836,7 +1836,7 @@ if (DEBUGGER) {
|
|||
* it here, so that if the CPU is reset while running, we can prevent stop()
|
||||
* from unnecessarily dumping the CPU state.
|
||||
*/
|
||||
this.flags.fRunning = false;
|
||||
this.flags.running = false;
|
||||
this.clearTempBreakpoint();
|
||||
if (!fQuiet) this.updateStatus();
|
||||
};
|
||||
|
|
@ -1895,7 +1895,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.start = function(ms, nCycles)
|
||||
{
|
||||
if (!this.nStep) this.println("running");
|
||||
this.flags.fRunning = true;
|
||||
this.flags.running = true;
|
||||
this.msStart = ms;
|
||||
this.nCyclesStart = nCycles;
|
||||
};
|
||||
|
|
@ -1911,8 +1911,8 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.stop = function(ms, nCycles)
|
||||
{
|
||||
if (this.flags.fRunning) {
|
||||
this.flags.fRunning = false;
|
||||
if (this.flags.running) {
|
||||
this.flags.running = false;
|
||||
this.nCycles = nCycles - this.nCyclesStart;
|
||||
if (!this.nStep) {
|
||||
var sStopped = "stopped";
|
||||
|
|
@ -2490,7 +2490,7 @@ if (DEBUGGER) {
|
|||
|
||||
if (sComment) {
|
||||
sLine = str.pad(sLine, 40) + ';' + sComment;
|
||||
if (!this.cpu.flags.fChecksum) {
|
||||
if (!this.cpu.flags.checksum) {
|
||||
sLine += (nSequence != null? '=' + nSequence.toString() : "");
|
||||
} else {
|
||||
var nCycles = this.cpu.getCycles();
|
||||
|
|
@ -3702,7 +3702,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.doHalt = function(fQuiet)
|
||||
{
|
||||
var sMsg;
|
||||
if (this.flags.fRunning) {
|
||||
if (this.flags.running) {
|
||||
sMsg = "halting";
|
||||
this.stopCPU();
|
||||
} else {
|
||||
|
|
@ -3992,7 +3992,7 @@ if (DEBUGGER) {
|
|||
if (nCycles !== undefined) {
|
||||
this.cpu.resetChecksum();
|
||||
}
|
||||
this.println("checksums " + (this.cpu.flags.fChecksum? "enabled" : "disabled"));
|
||||
this.println("checksums " + (this.cpu.flags.checksum? "enabled" : "disabled"));
|
||||
return;
|
||||
|
||||
case "sp":
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ function Computer8080(parmsComputer, parmsMachine, fSuspended) {
|
|||
|
||||
Component.call(this, "Computer", parmsComputer, Computer8080, Messages8080.COMPUTER);
|
||||
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
|
||||
this.setMachineParms(parmsMachine);
|
||||
|
||||
|
|
@ -626,9 +626,9 @@ Computer8080.prototype.powerOn = function(resume)
|
|||
*/
|
||||
Computer8080.prototype.powerRestore = function(component, stateComputer, fRepower, fRestore)
|
||||
{
|
||||
if (!component.flags.fPowered) {
|
||||
if (!component.flags.powered) {
|
||||
|
||||
component.flags.fPowered = true;
|
||||
component.flags.powered = true;
|
||||
|
||||
if (component.powerUp) {
|
||||
|
||||
|
|
@ -731,12 +731,12 @@ Computer8080.prototype.donePowerOn = function(aParms)
|
|||
var fRepower = (aParms[1] < 0);
|
||||
var fRestore = aParms[2];
|
||||
|
||||
if (DEBUG && this.flags.fPowered && this.messageEnabled()) {
|
||||
if (DEBUG && this.flags.powered && this.messageEnabled()) {
|
||||
this.printMessage("Computer8080.donePowerOn(): redundant");
|
||||
}
|
||||
|
||||
this.fInitialized = true;
|
||||
this.flags.fPowered = true;
|
||||
this.flags.powered = true;
|
||||
var controlPower = this.bindings["power"];
|
||||
if (controlPower) controlPower.textContent = "Shutdown";
|
||||
|
||||
|
|
@ -777,22 +777,22 @@ Computer8080.prototype.donePowerOn = function(aParms)
|
|||
*/
|
||||
Computer8080.prototype.checkPower = function()
|
||||
{
|
||||
if (this.flags.fPowered) return true;
|
||||
if (this.flags.powered) return true;
|
||||
|
||||
var component = null, iComponent;
|
||||
var aComponents = Component.getComponents(this.id);
|
||||
for (iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
component = aComponents[iComponent];
|
||||
if (component !== this && !component.flags.fReady) break;
|
||||
if (component !== this && !component.flags.ready) break;
|
||||
}
|
||||
if (iComponent == aComponents.length) {
|
||||
for (iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
component = aComponents[iComponent];
|
||||
if (component !== this && !component.flags.fPowered) break;
|
||||
if (component !== this && !component.flags.powered) break;
|
||||
}
|
||||
}
|
||||
if (iComponent == aComponents.length) component = this;
|
||||
var s = "The " + component.type + " component (" + component.id + ") is not " + (!component.flags.fReady? "ready yet" + (component.fnReady? " (waiting for notification)" : "") : "powered yet") + ".";
|
||||
var s = "The " + component.type + " component (" + component.id + ") is not " + (!component.flags.ready? "ready yet" + (component.fnReady? " (waiting for notification)" : "") : "powered yet") + ".";
|
||||
web.alertUser(s);
|
||||
return false;
|
||||
};
|
||||
|
|
@ -874,7 +874,7 @@ Computer8080.prototype.powerOff = function(fSave, fShutdown)
|
|||
data = this.cpu.powerDown(fSave, fShutdown);
|
||||
if (typeof data === "object") stateComputer.set(this.cpu.id, data);
|
||||
if (fShutdown) {
|
||||
this.cpu.flags.fPowered = false;
|
||||
this.cpu.flags.powered = false;
|
||||
if (data === false) sState = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -882,13 +882,13 @@ Computer8080.prototype.powerOff = function(fSave, fShutdown)
|
|||
var aComponents = Component.getComponents(this.id);
|
||||
for (var iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
var component = aComponents[iComponent];
|
||||
if (component.flags.fPowered) {
|
||||
if (component.flags.powered) {
|
||||
if (component.powerDown) {
|
||||
data = component.powerDown(fSave, fShutdown);
|
||||
if (typeof data === "object") stateComputer.set(component.id, data);
|
||||
}
|
||||
if (fShutdown) {
|
||||
component.flags.fPowered = false;
|
||||
component.flags.powered = false;
|
||||
if (data === false) sState = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -941,7 +941,7 @@ Computer8080.prototype.powerOff = function(fSave, fShutdown)
|
|||
}
|
||||
|
||||
if (fShutdown) {
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
var controlPower = this.bindings["power"];
|
||||
if (controlPower) controlPower.textContent = "Power";
|
||||
}
|
||||
|
|
@ -1312,7 +1312,7 @@ Computer8080.prototype.storeServerState = function(sUserID, sState, fSync)
|
|||
Computer8080.prototype.onPower = function()
|
||||
{
|
||||
if (!this.nPowerChange) {
|
||||
if (!this.flags.fPowered) {
|
||||
if (!this.flags.powered) {
|
||||
this.wait(this.powerOn);
|
||||
} else {
|
||||
this.powerOff(false, true);
|
||||
|
|
@ -1333,7 +1333,7 @@ Computer8080.prototype.onReset = function()
|
|||
* I'm going to start with the presumption that it makes little sense for an "unpowered" computer to be "reset";
|
||||
* ditto if the power state is currently being changed.
|
||||
*/
|
||||
if (!this.flags.fPowered || this.nPowerChange) return;
|
||||
if (!this.flags.powered || this.nPowerChange) return;
|
||||
|
||||
/*
|
||||
* If this is a "resumable" machine (and it's not using a predefined state), then we overload the reset
|
||||
|
|
@ -1521,7 +1521,7 @@ Computer8080.init = function()
|
|||
var computer = new Computer8080(parmsComputer, parmsMachine, true);
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onInit(" + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onInit(" + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1558,7 +1558,7 @@ Computer8080.show = function()
|
|||
if (computer) {
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onShow(" + computer.fInitialized + "," + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onShow(" + computer.fInitialized + "," + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1566,7 +1566,7 @@ Computer8080.show = function()
|
|||
* AFTER the the initial 'onload' event, and at that point in time, fInitialized will not be set yet.
|
||||
* So, practically speaking, the first show() callback isn't all that useful.
|
||||
*/
|
||||
if (computer.fInitialized && !computer.flags.fPowered) {
|
||||
if (computer.fInitialized && !computer.flags.powered) {
|
||||
/**
|
||||
* Repower the computer, notifying every component to continue running as-is.
|
||||
*/
|
||||
|
|
@ -1612,10 +1612,10 @@ Computer8080.exit = function()
|
|||
if (computer) {
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onExit(" + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onExit(" + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
if (computer.flags.fPowered) {
|
||||
if (computer.flags.powered) {
|
||||
/**
|
||||
* Power off the computer, giving every component an opportunity to save its state,
|
||||
* but only if 'resume' has been set AND there is no valid resume path (because if a valid resume
|
||||
|
|
|
|||
|
|
@ -96,14 +96,14 @@ function CPU8080(parmsCPU, nCyclesDefault)
|
|||
/*
|
||||
* We add a number of flags to the set initialized by Component
|
||||
*/
|
||||
this.flags.fRunning = false;
|
||||
this.flags.fStarting = false;
|
||||
this.flags.fAutoStart = parmsCPU['autoStart'];
|
||||
this.flags.running = false;
|
||||
this.flags.starting = false;
|
||||
this.flags.autoStart = parmsCPU['autoStart'];
|
||||
|
||||
/*
|
||||
* TODO: Add some UI for fDisplayLiveRegs (either an XML property, or a UI checkbox, or both)
|
||||
*/
|
||||
this.flags.fDisplayLiveRegs = false;
|
||||
this.flags.displayLiveRegs = false;
|
||||
|
||||
/*
|
||||
* Get checksum parameters, if any. runCPU() behavior is not affected until fChecksum
|
||||
|
|
@ -114,7 +114,7 @@ function CPU8080(parmsCPU, nCyclesDefault)
|
|||
* command ("x"); for example, "x cs int 5000" will set nCyclesChecksumInterval to 5000
|
||||
* and call resetChecksum().
|
||||
*/
|
||||
this.flags.fChecksum = false;
|
||||
this.flags.checksum = false;
|
||||
this.nChecksum = this.nCyclesChecksumNext = 0;
|
||||
this.nCyclesChecksumStart = parmsCPU["csStart"];
|
||||
this.nCyclesChecksumInterval = parmsCPU["csInterval"];
|
||||
|
|
@ -181,7 +181,7 @@ CPU8080.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
*/
|
||||
var sAutoStart = cmp.getMachineParm('autoStart');
|
||||
if (sAutoStart != null) {
|
||||
this.flags.fAutoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : !!sAutoStart));
|
||||
this.flags.autoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : !!sAutoStart));
|
||||
}
|
||||
|
||||
this.setReady();
|
||||
|
|
@ -263,7 +263,7 @@ CPU8080.prototype.powerUp = function(data, fRepower)
|
|||
* The Computer component (which is responsible for all powerDown and powerUp notifications)
|
||||
* is now responsible for managing a component's fPowered flag, not us.
|
||||
*
|
||||
* this.flags.fPowered = true;
|
||||
* this.flags.powered = true;
|
||||
*/
|
||||
this.updateCPU();
|
||||
return true;
|
||||
|
|
@ -283,7 +283,7 @@ CPU8080.prototype.powerDown = function(fSave, fShutdown)
|
|||
* The Computer component (which is responsible for all powerDown and powerUp notifications)
|
||||
* is now responsible for managing a component's fPowered flag, not us.
|
||||
*
|
||||
* this.flags.fPowered = false;
|
||||
* this.flags.powered = false;
|
||||
*/
|
||||
return fSave? this.save() : true;
|
||||
};
|
||||
|
|
@ -299,7 +299,7 @@ CPU8080.prototype.autoStart = function()
|
|||
/*
|
||||
* Start running automatically on power-up, assuming there's no Debugger and no "Run" button
|
||||
*/
|
||||
if (this.flags.fAutoStart || (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) {
|
||||
if (this.flags.autoStart || (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) {
|
||||
/*
|
||||
* Now we ALSO set fUpdateFocus when calling runCPU(), on the assumption that in the "auto-starting" context,
|
||||
* a machine without focus is like a day without sunshine.
|
||||
|
|
@ -318,7 +318,7 @@ CPU8080.prototype.autoStart = function()
|
|||
*/
|
||||
CPU8080.prototype.isPowered = function()
|
||||
{
|
||||
if (!this.flags.fPowered) {
|
||||
if (!this.flags.powered) {
|
||||
this.println(this.toString() + " not powered");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -333,7 +333,7 @@ CPU8080.prototype.isPowered = function()
|
|||
*/
|
||||
CPU8080.prototype.isRunning = function()
|
||||
{
|
||||
return this.flags.fRunning;
|
||||
return this.flags.running;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -364,8 +364,8 @@ CPU8080.prototype.resetChecksum = function()
|
|||
if (this.nCyclesChecksumStart === undefined) this.nCyclesChecksumStart = 0;
|
||||
if (this.nCyclesChecksumInterval === undefined) this.nCyclesChecksumInterval = -1;
|
||||
if (this.nCyclesChecksumStop === undefined) this.nCyclesChecksumStop = -1;
|
||||
this.flags.fChecksum = (this.nCyclesChecksumStart >= 0 && this.nCyclesChecksumInterval > 0);
|
||||
if (this.flags.fChecksum) {
|
||||
this.flags.checksum = (this.nCyclesChecksumStart >= 0 && this.nCyclesChecksumInterval > 0);
|
||||
if (this.flags.checksum) {
|
||||
this.nChecksum = 0;
|
||||
this.nCyclesChecksumNext = this.nCyclesChecksumStart - this.nTotalCycles;
|
||||
/*
|
||||
|
|
@ -390,7 +390,7 @@ CPU8080.prototype.resetChecksum = function()
|
|||
*/
|
||||
CPU8080.prototype.updateChecksum = function(nCycles)
|
||||
{
|
||||
if (this.flags.fChecksum) {
|
||||
if (this.flags.checksum) {
|
||||
/*
|
||||
* Get a 32-bit summation of the current CPU state and add it to our running 32-bit checksum
|
||||
*/
|
||||
|
|
@ -446,7 +446,7 @@ CPU8080.prototype.displayValue = function(sLabel, nValue, cch)
|
|||
this.stopCPU();
|
||||
}
|
||||
var sVal;
|
||||
if (!this.flags.fRunning || this.flags.fDisplayLiveRegs) {
|
||||
if (!this.flags.running || this.flags.displayLiveRegs) {
|
||||
sVal = str.toHex(nValue, cch);
|
||||
} else {
|
||||
sVal = "--------".substr(0, cch);
|
||||
|
|
@ -497,7 +497,7 @@ CPU8080.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
* control is visible, then the computer is probably sufficiently visible as well; the problem
|
||||
* with setting fUpdateFocus to true is that it can jerk the web page around in annoying ways.
|
||||
*/
|
||||
if (!cpu.flags.fRunning)
|
||||
if (!cpu.flags.running)
|
||||
cpu.runCPU();
|
||||
else
|
||||
cpu.stopCPU();
|
||||
|
|
@ -541,7 +541,7 @@ CPU8080.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
*/
|
||||
CPU8080.prototype.setBurstCycles = function(nCycles)
|
||||
{
|
||||
if (this.flags.fRunning) {
|
||||
if (this.flags.running) {
|
||||
var nDelta = this.nStepCycles - nCycles;
|
||||
/*
|
||||
* NOTE: If nDelta is negative, we will actually be increasing nStepCycles and nBurstCycles.
|
||||
|
|
@ -710,7 +710,7 @@ CPU8080.prototype.getSpeedCurrent = function()
|
|||
/*
|
||||
* TODO: Has toFixed() been "fixed" in all browsers (eg, IE) to return a rounded value now?
|
||||
*/
|
||||
return ((this.flags.fRunning && this.mhz)? (this.mhz.toFixed(2) + "Mhz") : "Stopped");
|
||||
return ((this.flags.running && this.mhz)? (this.mhz.toFixed(2) + "Mhz") : "Stopped");
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1075,7 +1075,7 @@ CPU8080.prototype.runCPU = function(fUpdateFocus)
|
|||
* be as HIGH as nCyclesPerYield, but it may be significantly less. getBurstCycles() will adjust
|
||||
* nCyclesPerBurst downward if any CPU timers need to fire during the next burst.
|
||||
*/
|
||||
var nCyclesPerBurst = this.getBurstCycles(this.flags.fChecksum? 1 : this.nCyclesPerYield);
|
||||
var nCyclesPerBurst = this.getBurstCycles(this.flags.checksum? 1 : this.nCyclesPerYield);
|
||||
|
||||
/*
|
||||
* Execute the burst.
|
||||
|
|
@ -1109,7 +1109,7 @@ CPU8080.prototype.runCPU = function(fUpdateFocus)
|
|||
}
|
||||
break;
|
||||
}
|
||||
} while (this.flags.fRunning);
|
||||
} while (this.flags.running);
|
||||
}
|
||||
catch (e) {
|
||||
this.stopCPU();
|
||||
|
|
@ -1132,7 +1132,7 @@ CPU8080.prototype.runCPU = function(fUpdateFocus)
|
|||
*/
|
||||
CPU8080.prototype.startCPU = function(fUpdateFocus)
|
||||
{
|
||||
if (!this.flags.fRunning) {
|
||||
if (!this.flags.running) {
|
||||
/*
|
||||
* setSpeed() without a speed parameter leaves the selected speed in place, but also resets the
|
||||
* cycle counter and timestamp for the current series of runCPU() calls, calculates the maximum number
|
||||
|
|
@ -1141,8 +1141,8 @@ CPU8080.prototype.startCPU = function(fUpdateFocus)
|
|||
*/
|
||||
this.setSpeed();
|
||||
if (this.cmp) this.cmp.start(this.msStartRun, this.getCycles());
|
||||
this.flags.fRunning = true;
|
||||
this.flags.fStarting = true;
|
||||
this.flags.running = true;
|
||||
this.flags.starting = true;
|
||||
if (this.chipset) this.chipset.start();
|
||||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Halt";
|
||||
|
|
@ -1184,13 +1184,13 @@ CPU8080.prototype.stopCPU = function(fComplete)
|
|||
this.endBurst();
|
||||
this.addCycles(this.nRunCycles);
|
||||
this.nRunCycles = 0;
|
||||
if (this.flags.fRunning) {
|
||||
this.flags.fRunning = false;
|
||||
if (this.flags.running) {
|
||||
this.flags.running = false;
|
||||
if (this.chipset) this.chipset.stop();
|
||||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Run";
|
||||
}
|
||||
this.flags.fComplete = fComplete;
|
||||
this.flags.complete = fComplete;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ function CPUState8080(parmsCPU)
|
|||
* stepCPU() call, but it's good form to do so.
|
||||
*/
|
||||
this.resetCycles();
|
||||
this.flags.fComplete = this.flags.fDebugCheck = false;
|
||||
this.flags.complete = this.flags.debugCheck = false;
|
||||
|
||||
/*
|
||||
* If there are no live registers to display, then updateStatus() can skip a bit....
|
||||
|
|
@ -143,7 +143,7 @@ CPUState8080.prototype.initProcessor = function()
|
|||
*/
|
||||
CPUState8080.prototype.reset = function()
|
||||
{
|
||||
if (this.flags.fRunning) this.stopCPU();
|
||||
if (this.flags.running) this.stopCPU();
|
||||
this.resetRegs();
|
||||
this.resetCycles();
|
||||
this.clearError(); // clear any fatal error/exception that setError() may have flagged
|
||||
|
|
@ -1049,7 +1049,7 @@ CPUState8080.prototype.updateReg = function(sReg, nValue, cch)
|
|||
CPUState8080.prototype.updateStatus = function(fForce)
|
||||
{
|
||||
if (this.cLiveRegs) {
|
||||
if (fForce || !this.flags.fRunning || this.flags.fDisplayLiveRegs) {
|
||||
if (fForce || !this.flags.running || this.flags.displayLiveRegs) {
|
||||
this.updateReg("A", this.regA);
|
||||
this.updateReg("B", this.regB);
|
||||
this.updateReg("C", this.regC);
|
||||
|
|
@ -1103,12 +1103,12 @@ CPUState8080.prototype.stepCPU = function(nMinCycles)
|
|||
* Debugger is single-stepping (even when performing multiple single-steps), fRunning is never set,
|
||||
* so stopCPU() would have no effect as far as the Debugger is concerned.
|
||||
*/
|
||||
this.flags.fComplete = true;
|
||||
this.flags.complete = true;
|
||||
|
||||
/*
|
||||
* fDebugCheck is true if we need to "check" every instruction with the Debugger.
|
||||
*/
|
||||
var fDebugCheck = this.flags.fDebugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled());
|
||||
var fDebugCheck = this.flags.debugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled());
|
||||
|
||||
/*
|
||||
* nDebugState is checked only when fDebugCheck is true, and its sole purpose is to tell the first call
|
||||
|
|
@ -1118,8 +1118,8 @@ CPUState8080.prototype.stepCPU = function(nMinCycles)
|
|||
* Once we snap fStarting, we clear it, because technically, we've moved beyond "starting" and have
|
||||
* officially "started" now.
|
||||
*/
|
||||
var nDebugState = (!nMinCycles)? -1 : (this.flags.fStarting? 0 : 1);
|
||||
this.flags.fStarting = false;
|
||||
var nDebugState = (!nMinCycles)? -1 : (this.flags.starting? 0 : 1);
|
||||
this.flags.starting = false;
|
||||
|
||||
/*
|
||||
* We move the minimum cycle count to nStepCycles (the number of cycles left to step), so that other
|
||||
|
|
@ -1145,7 +1145,7 @@ CPUState8080.prototype.stepCPU = function(nMinCycles)
|
|||
} while (this.nStepCycles > 0);
|
||||
}
|
||||
|
||||
return (this.flags.fComplete? this.nBurstCycles - this.nStepCycles : (this.flags.fComplete === undefined? 0 : -1));
|
||||
return (this.flags.complete? this.nBurstCycles - this.nStepCycles : (this.flags.complete === undefined? 0 : -1));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ if (DEBUGGER) {
|
|||
* really clutters the code. I wish the Closure Compiler had a way to annotate every definition with a given
|
||||
* section with a single annotation....
|
||||
*
|
||||
* Bugs can slip through the cracks without those annotations; for example, I unthinkingly redefined TYPE_SI
|
||||
* Bugs can slip through the cracks without those annotations; for example, I unthinkingly redefined TYPE_SIZE
|
||||
* at one point, and if all the definitions had been preceded by an "@const", that mistake would have been
|
||||
* caught at compile-time.
|
||||
*/
|
||||
|
|
@ -1807,7 +1807,7 @@ if (DEBUGGER) {
|
|||
* it here, so that if the CPU is reset while running, we can prevent stop()
|
||||
* from unnecessarily dumping the CPU state.
|
||||
*/
|
||||
this.flags.fRunning = false;
|
||||
this.flags.running = false;
|
||||
this.clearTempBreakpoint();
|
||||
if (!fQuiet) this.updateStatus();
|
||||
};
|
||||
|
|
@ -1866,7 +1866,7 @@ if (DEBUGGER) {
|
|||
Debugger8080.prototype.start = function(ms, nCycles)
|
||||
{
|
||||
if (!this.nStep) this.println("running");
|
||||
this.flags.fRunning = true;
|
||||
this.flags.running = true;
|
||||
this.msStart = ms;
|
||||
this.nCyclesStart = nCycles;
|
||||
};
|
||||
|
|
@ -1882,8 +1882,8 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger8080.prototype.stop = function(ms, nCycles)
|
||||
{
|
||||
if (this.flags.fRunning) {
|
||||
this.flags.fRunning = false;
|
||||
if (this.flags.running) {
|
||||
this.flags.running = false;
|
||||
this.nCycles = nCycles - this.nCyclesStart;
|
||||
if (!this.nStep) {
|
||||
var sStopped = "stopped";
|
||||
|
|
@ -2461,7 +2461,7 @@ if (DEBUGGER) {
|
|||
|
||||
if (sComment) {
|
||||
sLine = str.pad(sLine, 40) + ';' + sComment;
|
||||
if (!this.cpu.flags.fChecksum) {
|
||||
if (!this.cpu.flags.checksum) {
|
||||
sLine += (nSequence != null? '=' + nSequence.toString() : "");
|
||||
} else {
|
||||
var nCycles = this.cpu.getCycles();
|
||||
|
|
@ -3673,7 +3673,7 @@ if (DEBUGGER) {
|
|||
Debugger8080.prototype.doHalt = function(fQuiet)
|
||||
{
|
||||
var sMsg;
|
||||
if (this.flags.fRunning) {
|
||||
if (this.flags.running) {
|
||||
sMsg = "halting";
|
||||
this.stopCPU();
|
||||
} else {
|
||||
|
|
@ -3986,7 +3986,7 @@ if (DEBUGGER) {
|
|||
if (nCycles !== undefined) {
|
||||
this.cpu.resetChecksum();
|
||||
}
|
||||
this.println("checksums " + (this.cpu.flags.fChecksum? "enabled" : "disabled"));
|
||||
this.println("checksums " + (this.cpu.flags.checksum? "enabled" : "disabled"));
|
||||
return;
|
||||
|
||||
case "sp":
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ function Computer(parmsComputer, parmsMachine, fSuspended) {
|
|||
|
||||
Component.call(this, "Computer", parmsComputer, Computer, Messages.COMPUTER);
|
||||
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
|
||||
this.setMachineParms(parmsMachine);
|
||||
|
||||
|
|
@ -655,9 +655,9 @@ Computer.prototype.powerOn = function(resume)
|
|||
*/
|
||||
Computer.prototype.powerRestore = function(component, stateComputer, fRepower, fRestore)
|
||||
{
|
||||
if (!component.flags.fPowered) {
|
||||
if (!component.flags.powered) {
|
||||
|
||||
component.flags.fPowered = true;
|
||||
component.flags.powered = true;
|
||||
|
||||
if (component.powerUp) {
|
||||
|
||||
|
|
@ -760,12 +760,12 @@ Computer.prototype.donePowerOn = function(aParms)
|
|||
var fRepower = (aParms[1] < 0);
|
||||
var fRestore = aParms[2];
|
||||
|
||||
if (DEBUG && this.flags.fPowered && this.messageEnabled()) {
|
||||
if (DEBUG && this.flags.powered && this.messageEnabled()) {
|
||||
this.printMessage("Computer.donePowerOn(): redundant");
|
||||
}
|
||||
|
||||
this.fInitialized = true;
|
||||
this.flags.fPowered = true;
|
||||
this.flags.powered = true;
|
||||
var controlPower = this.bindings["power"];
|
||||
if (controlPower) controlPower.textContent = "Shutdown";
|
||||
|
||||
|
|
@ -806,22 +806,22 @@ Computer.prototype.donePowerOn = function(aParms)
|
|||
*/
|
||||
Computer.prototype.checkPower = function()
|
||||
{
|
||||
if (this.flags.fPowered) return true;
|
||||
if (this.flags.powered) return true;
|
||||
|
||||
var component = null, iComponent;
|
||||
var aComponents = Component.getComponents(this.id);
|
||||
for (iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
component = aComponents[iComponent];
|
||||
if (component !== this && !component.flags.fReady) break;
|
||||
if (component !== this && !component.flags.ready) break;
|
||||
}
|
||||
if (iComponent == aComponents.length) {
|
||||
for (iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
component = aComponents[iComponent];
|
||||
if (component !== this && !component.flags.fPowered) break;
|
||||
if (component !== this && !component.flags.powered) break;
|
||||
}
|
||||
}
|
||||
if (iComponent == aComponents.length) component = this;
|
||||
var s = "The " + component.type + " component (" + component.id + ") is not " + (!component.flags.fReady? "ready yet" + (component.fnReady? " (waiting for notification)" : "") : "powered yet") + ".";
|
||||
var s = "The " + component.type + " component (" + component.id + ") is not " + (!component.flags.ready? "ready yet" + (component.fnReady? " (waiting for notification)" : "") : "powered yet") + ".";
|
||||
web.alertUser(s);
|
||||
return false;
|
||||
};
|
||||
|
|
@ -903,7 +903,7 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
|||
data = this.cpu.powerDown(fSave, fShutdown);
|
||||
if (typeof data === "object") stateComputer.set(this.cpu.id, data);
|
||||
if (fShutdown) {
|
||||
this.cpu.flags.fPowered = false;
|
||||
this.cpu.flags.powered = false;
|
||||
if (data === false) sState = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -911,13 +911,13 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
|||
var aComponents = Component.getComponents(this.id);
|
||||
for (var iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
var component = aComponents[iComponent];
|
||||
if (component.flags.fPowered) {
|
||||
if (component.flags.powered) {
|
||||
if (component.powerDown) {
|
||||
data = component.powerDown(fSave, fShutdown);
|
||||
if (typeof data === "object") stateComputer.set(component.id, data);
|
||||
}
|
||||
if (fShutdown) {
|
||||
component.flags.fPowered = false;
|
||||
component.flags.powered = false;
|
||||
if (data === false) sState = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -970,7 +970,7 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
|
|||
}
|
||||
|
||||
if (fShutdown) {
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
var controlPower = this.bindings["power"];
|
||||
if (controlPower) controlPower.textContent = "Power";
|
||||
}
|
||||
|
|
@ -1341,7 +1341,7 @@ Computer.prototype.storeServerState = function(sUserID, sState, fSync)
|
|||
Computer.prototype.onPower = function()
|
||||
{
|
||||
if (!this.nPowerChange) {
|
||||
if (!this.flags.fPowered) {
|
||||
if (!this.flags.powered) {
|
||||
this.wait(this.powerOn);
|
||||
} else {
|
||||
this.powerOff(false, true);
|
||||
|
|
@ -1362,7 +1362,7 @@ Computer.prototype.onReset = function()
|
|||
* I'm going to start with the presumption that it makes little sense for an "unpowered" computer to be "reset";
|
||||
* ditto if the power state is currently being changed.
|
||||
*/
|
||||
if (!this.flags.fPowered || this.nPowerChange) return;
|
||||
if (!this.flags.powered || this.nPowerChange) return;
|
||||
|
||||
/*
|
||||
* If this is a "resumable" machine (and it's not using a predefined state), then we overload the reset
|
||||
|
|
@ -1551,7 +1551,7 @@ Computer.init = function()
|
|||
var computer = new Computer(parmsComputer, parmsMachine, true);
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onInit(" + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onInit(" + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1588,10 +1588,10 @@ Computer.show = function()
|
|||
if (computer) {
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onShow(" + computer.fInitialized + "," + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onShow(" + computer.fInitialized + "," + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
if (computer.fInitialized && !computer.flags.fPowered) {
|
||||
if (computer.fInitialized && !computer.flags.powered) {
|
||||
/**
|
||||
* Repower the computer, notifying every component to continue running as-is.
|
||||
*/
|
||||
|
|
@ -1637,10 +1637,10 @@ Computer.exit = function()
|
|||
if (computer) {
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onExit(" + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onExit(" + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
if (computer.flags.fPowered) {
|
||||
if (computer.flags.powered) {
|
||||
/**
|
||||
* Power off the computer, giving every component an opportunity to save its state,
|
||||
* but only if 'resume' has been set AND there is no valid resume path (because if a valid resume
|
||||
|
|
|
|||
|
|
@ -97,14 +97,14 @@ function CPU(parmsCPU, nCyclesDefault)
|
|||
/*
|
||||
* We add a number of flags to the set initialized by Component
|
||||
*/
|
||||
this.flags.fRunning = false;
|
||||
this.flags.fStarting = false;
|
||||
this.flags.fAutoStart = parmsCPU['autoStart'];
|
||||
this.flags.running = false;
|
||||
this.flags.starting = false;
|
||||
this.flags.autoStart = parmsCPU['autoStart'];
|
||||
|
||||
/*
|
||||
* TODO: Add some UI for fDisplayLiveRegs (either an XML property, or a UI checkbox, or both)
|
||||
*/
|
||||
this.flags.fDisplayLiveRegs = false;
|
||||
this.flags.displayLiveRegs = false;
|
||||
|
||||
/*
|
||||
* Get checksum parameters, if any. runCPU() behavior is not affected until fChecksum
|
||||
|
|
@ -115,7 +115,7 @@ function CPU(parmsCPU, nCyclesDefault)
|
|||
* command ("x"); for example, "x cs int 5000" will set nCyclesChecksumInterval to 5000
|
||||
* and call resetChecksum().
|
||||
*/
|
||||
this.flags.fChecksum = false;
|
||||
this.flags.checksum = false;
|
||||
this.aCounts.nChecksum = this.aCounts.nCyclesChecksumNext = 0;
|
||||
this.aCounts.nCyclesChecksumStart = parmsCPU["csStart"];
|
||||
this.aCounts.nCyclesChecksumInterval = parmsCPU["csInterval"];
|
||||
|
|
@ -187,7 +187,7 @@ CPU.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
*/
|
||||
var sAutoStart = cmp.getMachineParm('autoStart');
|
||||
if (sAutoStart != null) {
|
||||
this.flags.fAutoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : !!sAutoStart));
|
||||
this.flags.autoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : !!sAutoStart));
|
||||
}
|
||||
|
||||
this.setReady();
|
||||
|
|
@ -271,7 +271,7 @@ CPU.prototype.powerUp = function(data, fRepower)
|
|||
* The Computer component (which is responsible for all powerDown and powerUp notifications)
|
||||
* is now responsible for managing a component's fPowered flag, not us.
|
||||
*
|
||||
* this.flags.fPowered = true;
|
||||
* this.flags.powered = true;
|
||||
*/
|
||||
this.updateCPU();
|
||||
return true;
|
||||
|
|
@ -291,7 +291,7 @@ CPU.prototype.powerDown = function(fSave, fShutdown)
|
|||
* The Computer component (which is responsible for all powerDown and powerUp notifications)
|
||||
* is now responsible for managing a component's fPowered flag, not us.
|
||||
*
|
||||
* this.flags.fPowered = false;
|
||||
* this.flags.powered = false;
|
||||
*/
|
||||
return fSave? this.save() : true;
|
||||
};
|
||||
|
|
@ -307,7 +307,7 @@ CPU.prototype.autoStart = function()
|
|||
/*
|
||||
* Start running automatically on power-up, assuming there's no Debugger and no "Run" button
|
||||
*/
|
||||
if (this.flags.fAutoStart || (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) {
|
||||
if (this.flags.autoStart || (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) {
|
||||
/*
|
||||
* Now we ALSO set fUpdateFocus when calling runCPU(), on the assumption that in the "auto-starting" context,
|
||||
* a machine without focus is like a day without sunshine.
|
||||
|
|
@ -326,7 +326,7 @@ CPU.prototype.autoStart = function()
|
|||
*/
|
||||
CPU.prototype.isPowered = function()
|
||||
{
|
||||
if (!this.flags.fPowered) {
|
||||
if (!this.flags.powered) {
|
||||
this.println(this.toString() + " not powered");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -341,7 +341,7 @@ CPU.prototype.isPowered = function()
|
|||
*/
|
||||
CPU.prototype.isRunning = function()
|
||||
{
|
||||
return this.flags.fRunning;
|
||||
return this.flags.running;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -372,8 +372,8 @@ CPU.prototype.resetChecksum = function()
|
|||
if (this.aCounts.nCyclesChecksumStart === undefined) this.aCounts.nCyclesChecksumStart = 0;
|
||||
if (this.aCounts.nCyclesChecksumInterval === undefined) this.aCounts.nCyclesChecksumInterval = -1;
|
||||
if (this.aCounts.nCyclesChecksumStop === undefined) this.aCounts.nCyclesChecksumStop = -1;
|
||||
this.flags.fChecksum = (this.aCounts.nCyclesChecksumStart >= 0 && this.aCounts.nCyclesChecksumInterval > 0);
|
||||
if (this.flags.fChecksum) {
|
||||
this.flags.checksum = (this.aCounts.nCyclesChecksumStart >= 0 && this.aCounts.nCyclesChecksumInterval > 0);
|
||||
if (this.flags.checksum) {
|
||||
this.aCounts.nChecksum = 0;
|
||||
this.aCounts.nCyclesChecksumNext = this.aCounts.nCyclesChecksumStart - this.nTotalCycles;
|
||||
/*
|
||||
|
|
@ -398,7 +398,7 @@ CPU.prototype.resetChecksum = function()
|
|||
*/
|
||||
CPU.prototype.updateChecksum = function(nCycles)
|
||||
{
|
||||
if (this.flags.fChecksum) {
|
||||
if (this.flags.checksum) {
|
||||
/*
|
||||
* Get a 32-bit summation of the current CPU state and add it to our running 32-bit checksum
|
||||
*/
|
||||
|
|
@ -454,7 +454,7 @@ CPU.prototype.displayValue = function(sLabel, nValue, cch)
|
|||
this.stopCPU();
|
||||
}
|
||||
var sVal;
|
||||
if (!this.flags.fRunning || this.flags.fDisplayLiveRegs) {
|
||||
if (!this.flags.running || this.flags.displayLiveRegs) {
|
||||
sVal = str.toHex(nValue, cch);
|
||||
} else {
|
||||
sVal = "--------".substr(0, cch);
|
||||
|
|
@ -500,7 +500,7 @@ CPU.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
this.bindings[sBinding] = control;
|
||||
control.onclick = function onClickRun() {
|
||||
if (!cpu.cmp || !cpu.cmp.checkPower()) return;
|
||||
if (!cpu.flags.fRunning)
|
||||
if (!cpu.flags.running)
|
||||
cpu.runCPU(true);
|
||||
else
|
||||
cpu.stopCPU(true);
|
||||
|
|
@ -541,7 +541,7 @@ CPU.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
*/
|
||||
CPU.prototype.setBurstCycles = function(nCycles)
|
||||
{
|
||||
if (this.flags.fRunning) {
|
||||
if (this.flags.running) {
|
||||
var nDelta = this.nStepCycles - nCycles;
|
||||
/*
|
||||
* NOTE: If nDelta is negative, we will actually be increasing nStepCycles and nBurstCycles.
|
||||
|
|
@ -731,7 +731,7 @@ CPU.prototype.getSpeedCurrent = function()
|
|||
/*
|
||||
* TODO: Has toFixed() been "fixed" in all browsers (eg, IE) to return a rounded value now?
|
||||
*/
|
||||
return ((this.flags.fRunning && this.aCounts.mhz)? (this.aCounts.mhz.toFixed(2) + "Mhz") : "Stopped");
|
||||
return ((this.flags.running && this.aCounts.mhz)? (this.aCounts.mhz.toFixed(2) + "Mhz") : "Stopped");
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -981,7 +981,7 @@ CPU.prototype.runCPU = function(fUpdateFocus)
|
|||
this.calcStartTime();
|
||||
try {
|
||||
do {
|
||||
var nCyclesPerBurst = (this.flags.fChecksum? 1 : this.aCounts.nCyclesPerBurst);
|
||||
var nCyclesPerBurst = (this.flags.checksum? 1 : this.aCounts.nCyclesPerBurst);
|
||||
|
||||
if (this.chipset) {
|
||||
this.chipset.updateAllTimers();
|
||||
|
|
@ -1037,7 +1037,7 @@ CPU.prototype.runCPU = function(fUpdateFocus)
|
|||
this.aCounts.nCyclesNextYield += this.aCounts.nCyclesPerYield;
|
||||
break;
|
||||
}
|
||||
} while (this.flags.fRunning);
|
||||
} while (this.flags.running);
|
||||
}
|
||||
catch (e) {
|
||||
this.stopCPU();
|
||||
|
|
@ -1059,7 +1059,7 @@ CPU.prototype.runCPU = function(fUpdateFocus)
|
|||
*/
|
||||
CPU.prototype.startCPU = function(fUpdateFocus)
|
||||
{
|
||||
if (!this.flags.fRunning) {
|
||||
if (!this.flags.running) {
|
||||
/*
|
||||
* setSpeed() without a speed parameter leaves the selected speed in place, but also resets the
|
||||
* cycle counter and timestamp for the current series of runCPU() calls, calculates the maximum number
|
||||
|
|
@ -1068,8 +1068,8 @@ CPU.prototype.startCPU = function(fUpdateFocus)
|
|||
*/
|
||||
this.setSpeed();
|
||||
if (this.cmp) this.cmp.start(this.aCounts.msStartRun, this.getCycles());
|
||||
this.flags.fRunning = true;
|
||||
this.flags.fStarting = true;
|
||||
this.flags.running = true;
|
||||
this.flags.starting = true;
|
||||
if (this.chipset) this.chipset.start();
|
||||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Halt";
|
||||
|
|
@ -1111,13 +1111,13 @@ CPU.prototype.stopCPU = function(fComplete)
|
|||
this.endBurst();
|
||||
this.addCycles(this.nRunCycles);
|
||||
this.nRunCycles = 0;
|
||||
if (this.flags.fRunning) {
|
||||
this.flags.fRunning = false;
|
||||
if (this.flags.running) {
|
||||
this.flags.running = false;
|
||||
if (this.chipset) this.chipset.stop();
|
||||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Run";
|
||||
}
|
||||
this.flags.fComplete = fComplete;
|
||||
this.flags.complete = fComplete;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ function Debugger(parmsDbg)
|
|||
/*
|
||||
* Initialize Debugger message support
|
||||
*/
|
||||
this.afnDumpers = [];
|
||||
this.afnDumpers = {};
|
||||
this.messageInit(parmsDbg['messages']);
|
||||
|
||||
this.sInitCommands = parmsDbg['commands'];
|
||||
|
|
@ -269,7 +269,7 @@ function Debugger(parmsDbg)
|
|||
if (window[PCX86.APPCLASS] === undefined) {
|
||||
window[PCX86.APPCLASS] = function(s) { return dbg.doCommands(s); };
|
||||
}
|
||||
} else {
|
||||
} else if (global) {
|
||||
if (global[PCX86.APPCLASS] === undefined) {
|
||||
global[PCX86.APPCLASS] = function(s) { return dbg.doCommands(s); };
|
||||
}
|
||||
|
|
@ -3324,7 +3324,7 @@ if (DEBUGGER) {
|
|||
* @this {Debugger}
|
||||
* @param {string} sModule
|
||||
* @param {number} nSegment
|
||||
* @return {Array}
|
||||
* @return {Object}
|
||||
*/
|
||||
Debugger.prototype.findModuleInfo = function(sModule, nSegment)
|
||||
{
|
||||
|
|
@ -4074,7 +4074,7 @@ if (DEBUGGER) {
|
|||
* it here, so that if the CPU is reset while running, we can prevent stop()
|
||||
* from unnecessarily dumping the CPU state.
|
||||
*/
|
||||
this.flags.fRunning = false;
|
||||
this.flags.running = false;
|
||||
this.clearTempBreakpoint();
|
||||
if (!fQuiet) this.updateStatus();
|
||||
};
|
||||
|
|
@ -4133,7 +4133,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.start = function(ms, nCycles)
|
||||
{
|
||||
if (!this.nStep) this.println("running");
|
||||
this.flags.fRunning = true;
|
||||
this.flags.running = true;
|
||||
this.msStart = ms;
|
||||
this.nCyclesStart = nCycles;
|
||||
};
|
||||
|
|
@ -4149,8 +4149,8 @@ if (DEBUGGER) {
|
|||
*/
|
||||
Debugger.prototype.stop = function(ms, nCycles)
|
||||
{
|
||||
if (this.flags.fRunning) {
|
||||
this.flags.fRunning = false;
|
||||
if (this.flags.running) {
|
||||
this.flags.running = false;
|
||||
this.nCycles = nCycles - this.nCyclesStart;
|
||||
if (!this.nStep) {
|
||||
var sStopped = "stopped";
|
||||
|
|
@ -4822,7 +4822,7 @@ if (DEBUGGER) {
|
|||
if (dbgAddr.fData32 && sOpcode.slice(-1) == 'W') sOpcode = sOpcode.slice(0, -1) + 'D';
|
||||
}
|
||||
|
||||
var typeCPU = null;
|
||||
var typeCPU = -1;
|
||||
var fComplete = true;
|
||||
|
||||
for (var iOperand = 1; iOperand <= cOperands; iOperand++) {
|
||||
|
|
@ -4832,7 +4832,7 @@ if (DEBUGGER) {
|
|||
var type = aOpDesc[iOperand];
|
||||
if (type === undefined) continue;
|
||||
|
||||
if (typeCPU == null) typeCPU = type >> Debugger.TYPE_CPU_SHIFT;
|
||||
if (typeCPU < 0) typeCPU = type >> Debugger.TYPE_CPU_SHIFT;
|
||||
|
||||
if (iIns == Debugger.INS.LOADALL) {
|
||||
if (typeCPU == Debugger.CPU_80286) {
|
||||
|
|
@ -4953,7 +4953,7 @@ if (DEBUGGER) {
|
|||
|
||||
if (sComment && fComplete) {
|
||||
sLine = str.pad(sLine, dbgAddrIns.fAddr32? 74 : 56) + ';' + sComment;
|
||||
if (!this.cpu.flags.fChecksum) {
|
||||
if (!this.cpu.flags.checksum) {
|
||||
sLine += (nSequence != null? '=' + nSequence.toString() : "");
|
||||
} else {
|
||||
var nCycles = this.cpu.getCycles();
|
||||
|
|
@ -6611,7 +6611,7 @@ if (DEBUGGER) {
|
|||
Debugger.prototype.doHalt = function(fQuiet)
|
||||
{
|
||||
var sMsg;
|
||||
if (this.flags.fRunning) {
|
||||
if (this.flags.running) {
|
||||
sMsg = "halting";
|
||||
this.stopCPU();
|
||||
} else {
|
||||
|
|
@ -7085,7 +7085,7 @@ if (DEBUGGER) {
|
|||
if (nCycles !== undefined) {
|
||||
this.cpu.resetChecksum();
|
||||
}
|
||||
this.println("checksums " + (this.cpu.flags.fChecksum? "enabled" : "disabled"));
|
||||
this.println("checksums " + (this.cpu.flags.checksum? "enabled" : "disabled"));
|
||||
break;
|
||||
case "sp":
|
||||
if (asArgs[2] !== undefined) {
|
||||
|
|
@ -8156,7 +8156,7 @@ if (DEBUGGER) {
|
|||
{
|
||||
var a = this.parseCommand(sCmds, fSave);
|
||||
for (var s in a) {
|
||||
if (!this.doCommand(a[s])) return false;
|
||||
if (!this.doCommand(a[+s])) return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1166,7 +1166,7 @@ Disk.prototype.doneLoad = function(sURL, sDiskData, nErrorCode)
|
|||
{
|
||||
var disk = null;
|
||||
this.fWriteProtected = false;
|
||||
var fPrintOnly = (nErrorCode < 0 && this.cmp && !this.cmp.flags.fPowered);
|
||||
var fPrintOnly = (nErrorCode < 0 && this.cmp && !this.cmp.flags.powered);
|
||||
|
||||
if (this.fOnDemand) {
|
||||
if (!nErrorCode) {
|
||||
|
|
@ -1594,11 +1594,11 @@ Disk.prototype.buildFileTable = function()
|
|||
* @this {Disk}
|
||||
* @param {string} sModule
|
||||
* @param {number} nSegment
|
||||
* @return {Array}
|
||||
* @return {Object}
|
||||
*/
|
||||
Disk.prototype.getModuleInfo = function(sModule, nSegment)
|
||||
{
|
||||
var aSymbols = [];
|
||||
var aSymbols = {};
|
||||
if (SYMBOLS && this.aFileTable) {
|
||||
for (var iFile = 0; iFile < this.aFileTable.length; iFile++) {
|
||||
var file = this.aFileTable[iFile];
|
||||
|
|
|
|||
|
|
@ -5419,7 +5419,7 @@ Video.prototype.updateScreen = function(fForce)
|
|||
/*
|
||||
* The Computer component maintains the fPowered setting on our behalf, so we use it.
|
||||
*/
|
||||
if (!this.flags.fPowered) return;
|
||||
if (!this.flags.powered) return;
|
||||
|
||||
/*
|
||||
* If the card's video signal is disabled (eg, during a mode change), then skip the update,
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ function X86CPU(parmsCPU)
|
|||
* stepCPU() call, but it's good form to do so.
|
||||
*/
|
||||
this.resetCycles();
|
||||
this.flags.fComplete = this.flags.fDebugCheck = false;
|
||||
this.flags.complete = this.flags.debugCheck = false;
|
||||
|
||||
/*
|
||||
* If there are no live registers to display, then updateStatus() can skip a bit....
|
||||
|
|
@ -880,7 +880,7 @@ X86CPU.prototype.initProcessor = function()
|
|||
this.aOps[X86.OPCODE.OS] = X86.opOS; // 0x66
|
||||
this.aOps[X86.OPCODE.AS] = X86.opAS; // 0x67
|
||||
for (bOpcode in X86.aOps0F386) {
|
||||
this.aOps0F[+bOpcode] = X86.aOps0F386[bOpcode];
|
||||
this.aOps0F[+bOpcode] = X86.aOps0F386[+bOpcode];
|
||||
}
|
||||
if (this.stepping >= X86.STEPPING_80386_A0 && this.stepping <= X86.STEPPING_80386_B0) {
|
||||
this.aOps0F[0xA6] = X86.opXBTS;
|
||||
|
|
@ -898,7 +898,7 @@ X86CPU.prototype.initProcessor = function()
|
|||
*/
|
||||
X86CPU.prototype.reset = function()
|
||||
{
|
||||
if (this.flags.fRunning) this.stopCPU();
|
||||
if (this.flags.running) this.stopCPU();
|
||||
this.resetRegs();
|
||||
this.resetCycles();
|
||||
this.clearError(); // clear any fatal error/exception that setError() may have flagged
|
||||
|
|
@ -1540,7 +1540,7 @@ X86CPU.prototype.checkIntNotify = function(nInt)
|
|||
* For most purposes, just having dbg.messageInt(), and the Debugger's ability to selectively turn categories
|
||||
* of messages on and off, is good enough.
|
||||
*/
|
||||
if (DEBUGGER && this.flags.fDebugCheck) {
|
||||
if (DEBUGGER && this.flags.debugCheck) {
|
||||
if (this.messageEnabled(Messages.INT) && this.dbg.messageInt(nInt, this.regLIP) && MAXDEBUG) {
|
||||
this.addIntReturn(this.regLIP, function(cpu, nCycles) {
|
||||
return function onIntReturn(nLevel) {
|
||||
|
|
@ -4159,7 +4159,7 @@ X86CPU.prototype.updateReg = function(sReg, nValue)
|
|||
X86CPU.prototype.updateStatus = function(fForce)
|
||||
{
|
||||
if (this.cLiveRegs) {
|
||||
if (fForce || !this.flags.fRunning || this.flags.fDisplayLiveRegs) {
|
||||
if (fForce || !this.flags.running || this.flags.displayLiveRegs) {
|
||||
this.updateReg("EAX", this.regEAX);
|
||||
this.updateReg("EBX", this.regEBX);
|
||||
this.updateReg("ECX", this.regECX);
|
||||
|
|
@ -4231,12 +4231,12 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
|
|||
* Debugger is single-stepping (even when performing multiple single-steps), fRunning is never set,
|
||||
* so stopCPU() would have no effect as far as the Debugger is concerned.
|
||||
*/
|
||||
this.flags.fComplete = true;
|
||||
this.flags.complete = true;
|
||||
|
||||
/*
|
||||
* fDebugCheck is true if we need to "check" every instruction with the Debugger.
|
||||
*/
|
||||
var fDebugCheck = this.flags.fDebugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled());
|
||||
var fDebugCheck = this.flags.debugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled());
|
||||
|
||||
/*
|
||||
* nDebugState is checked only when fDebugCheck is true, and its sole purpose is to tell the first call
|
||||
|
|
@ -4246,8 +4246,8 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
|
|||
* Once we snap fStarting, we clear it, because technically, we've moved beyond "starting" and have
|
||||
* officially "started" now.
|
||||
*/
|
||||
var nDebugState = (!nMinCycles)? -1 : (this.flags.fStarting? 0 : 1);
|
||||
this.flags.fStarting = false;
|
||||
var nDebugState = (!nMinCycles)? -1 : (this.flags.starting? 0 : 1);
|
||||
this.flags.starting = false;
|
||||
|
||||
/*
|
||||
* We move the minimum cycle count to nStepCycles (the number of cycles left to step), so that other
|
||||
|
|
@ -4373,7 +4373,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
|
|||
//
|
||||
// Make sure that every instruction is assessing a cycle cost, and that the cost is a net positive.
|
||||
//
|
||||
if (this.flags.fComplete && this.nStepCycles >= this.nSnapCycles && !(this.opFlags & X86.OPFLAG_PREFIXES)) {
|
||||
if (this.flags.complete && this.nStepCycles >= this.nSnapCycles && !(this.opFlags & X86.OPFLAG_PREFIXES)) {
|
||||
this.println("cycle miscount: " + (this.nSnapCycles - this.nStepCycles));
|
||||
this.setIP(this.opLIP - this.segCS.base);
|
||||
this.stopCPU();
|
||||
|
|
@ -4384,7 +4384,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
|
|||
|
||||
} while (this.nStepCycles > 0);
|
||||
|
||||
return (this.flags.fComplete? this.nBurstCycles - this.nStepCycles : (this.flags.fComplete === undefined? 0 : -1));
|
||||
return (this.flags.complete? this.nBurstCycles - this.nStepCycles : (this.flags.complete === undefined? 0 : -1));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -731,7 +731,7 @@ X86.helpFault = function(nFault, nError, nCycles, fHalt)
|
|||
{
|
||||
var fDispatch = false;
|
||||
|
||||
if (!this.flags.fComplete) {
|
||||
if (!this.flags.complete) {
|
||||
/*
|
||||
* Prior to each new burst of instructions, stepCPU() sets fComplete to true, and the only (normal) way
|
||||
* for fComplete to become false is through stopCPU(), which isn't ordinarily called, except by the Debugger.
|
||||
|
|
@ -970,7 +970,7 @@ X86.helpCheckFault = function(nFault, nError, fHalt)
|
|||
|
||||
if (this.messageEnabled(bitsMessage) || fHalt) {
|
||||
|
||||
var fRunning = this.flags.fRunning;
|
||||
var fRunning = this.flags.running;
|
||||
var sMessage = "Fault " + str.toHexByte(nFault) + (nError != null? " (" + str.toHexWord(nError) + ")" : "") + " on opcode " + str.toHexByte(bOpcode);
|
||||
if (fHalt && fRunning) sMessage += " (blocked)";
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ X86.opADDmb = function()
|
|||
* Notice that we also test fRunning: this allows the Debugger to step over the instruction,
|
||||
* because its trace ("t") command doesn't "run" the CPU; it merely "steps" the CPU.
|
||||
*/
|
||||
if (DEBUG && !this.bModRM && this.flags.fRunning) {
|
||||
if (DEBUG && !this.bModRM && this.flags.running) {
|
||||
this.printMessage("suspicious opcode: 0x00 0x00", DEBUGGER || this.bitsMessage);
|
||||
if (DEBUGGER && this.dbg) this.dbg.stopCPU();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ function ComputerPDP11(parmsComputer, parmsMachine, fSuspended) {
|
|||
|
||||
Component.call(this, "Computer", parmsComputer, ComputerPDP11, MessagesPDP11.COMPUTER);
|
||||
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
|
||||
this.setMachineParms(parmsMachine);
|
||||
|
||||
|
|
@ -622,9 +622,9 @@ ComputerPDP11.prototype.powerOn = function(resume)
|
|||
*/
|
||||
ComputerPDP11.prototype.powerRestore = function(component, stateComputer, fRepower, fRestore)
|
||||
{
|
||||
if (!component.flags.fPowered) {
|
||||
if (!component.flags.powered) {
|
||||
|
||||
component.flags.fPowered = true;
|
||||
component.flags.powered = true;
|
||||
|
||||
if (component.powerUp) {
|
||||
|
||||
|
|
@ -727,12 +727,12 @@ ComputerPDP11.prototype.donePowerOn = function(aParms)
|
|||
var fRepower = (aParms[1] < 0);
|
||||
var fRestore = aParms[2];
|
||||
|
||||
if (DEBUG && this.flags.fPowered && this.messageEnabled()) {
|
||||
if (DEBUG && this.flags.powered && this.messageEnabled()) {
|
||||
this.printMessage("ComputerPDP11.donePowerOn(): redundant");
|
||||
}
|
||||
|
||||
this.fInitialized = true;
|
||||
this.flags.fPowered = true;
|
||||
this.flags.powered = true;
|
||||
var controlPower = this.bindings["power"];
|
||||
if (controlPower) controlPower.textContent = "Shutdown";
|
||||
|
||||
|
|
@ -773,22 +773,22 @@ ComputerPDP11.prototype.donePowerOn = function(aParms)
|
|||
*/
|
||||
ComputerPDP11.prototype.checkPower = function()
|
||||
{
|
||||
if (this.flags.fPowered) return true;
|
||||
if (this.flags.powered) return true;
|
||||
|
||||
var component = null, iComponent;
|
||||
var aComponents = Component.getComponents(this.id);
|
||||
for (iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
component = aComponents[iComponent];
|
||||
if (component !== this && !component.flags.fReady) break;
|
||||
if (component !== this && !component.flags.ready) break;
|
||||
}
|
||||
if (iComponent == aComponents.length) {
|
||||
for (iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
component = aComponents[iComponent];
|
||||
if (component !== this && !component.flags.fPowered) break;
|
||||
if (component !== this && !component.flags.powered) break;
|
||||
}
|
||||
}
|
||||
if (iComponent == aComponents.length) component = this;
|
||||
var s = "The " + component.type + " component (" + component.id + ") is not " + (!component.flags.fReady? "ready yet" + (component.fnReady? " (waiting for notification)" : "") : "powered yet") + ".";
|
||||
var s = "The " + component.type + " component (" + component.id + ") is not " + (!component.flags.ready? "ready yet" + (component.fnReady? " (waiting for notification)" : "") : "powered yet") + ".";
|
||||
web.alertUser(s);
|
||||
return false;
|
||||
};
|
||||
|
|
@ -870,7 +870,7 @@ ComputerPDP11.prototype.powerOff = function(fSave, fShutdown)
|
|||
data = this.cpu.powerDown(fSave, fShutdown);
|
||||
if (typeof data === "object") stateComputer.set(this.cpu.id, data);
|
||||
if (fShutdown) {
|
||||
this.cpu.flags.fPowered = false;
|
||||
this.cpu.flags.powered = false;
|
||||
if (data === false) sState = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -878,13 +878,13 @@ ComputerPDP11.prototype.powerOff = function(fSave, fShutdown)
|
|||
var aComponents = Component.getComponents(this.id);
|
||||
for (var iComponent = 0; iComponent < aComponents.length; iComponent++) {
|
||||
var component = aComponents[iComponent];
|
||||
if (component.flags.fPowered) {
|
||||
if (component.flags.powered) {
|
||||
if (component.powerDown) {
|
||||
data = component.powerDown(fSave, fShutdown);
|
||||
if (typeof data === "object") stateComputer.set(component.id, data);
|
||||
}
|
||||
if (fShutdown) {
|
||||
component.flags.fPowered = false;
|
||||
component.flags.powered = false;
|
||||
if (data === false) sState = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -937,7 +937,7 @@ ComputerPDP11.prototype.powerOff = function(fSave, fShutdown)
|
|||
}
|
||||
|
||||
if (fShutdown) {
|
||||
this.flags.fPowered = false;
|
||||
this.flags.powered = false;
|
||||
var controlPower = this.bindings["power"];
|
||||
if (controlPower) controlPower.textContent = "Power";
|
||||
}
|
||||
|
|
@ -1308,7 +1308,7 @@ ComputerPDP11.prototype.storeServerState = function(sUserID, sState, fSync)
|
|||
ComputerPDP11.prototype.onPower = function()
|
||||
{
|
||||
if (!this.nPowerChange) {
|
||||
if (!this.flags.fPowered) {
|
||||
if (!this.flags.powered) {
|
||||
this.wait(this.powerOn);
|
||||
} else {
|
||||
this.powerOff(false, true);
|
||||
|
|
@ -1329,7 +1329,7 @@ ComputerPDP11.prototype.onReset = function()
|
|||
* I'm going to start with the presumption that it makes little sense for an "unpowered" computer to be "reset";
|
||||
* ditto if the power state is currently being changed.
|
||||
*/
|
||||
if (!this.flags.fPowered || this.nPowerChange) return;
|
||||
if (!this.flags.powered || this.nPowerChange) return;
|
||||
|
||||
/*
|
||||
* If this is a "resumable" machine (and it's not using a predefined state), then we overload the reset
|
||||
|
|
@ -1481,7 +1481,7 @@ ComputerPDP11.init = function()
|
|||
var computer = new ComputerPDP11(parmsComputer, parmsMachine, true);
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onInit(" + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onInit(" + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1518,7 +1518,7 @@ ComputerPDP11.show = function()
|
|||
if (computer) {
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onShow(" + computer.fInitialized + "," + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onShow(" + computer.fInitialized + "," + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1526,7 +1526,7 @@ ComputerPDP11.show = function()
|
|||
* AFTER the the initial 'onload' event, and at that point in time, fInitialized will not be set yet.
|
||||
* So, practically speaking, the first show() callback isn't all that useful.
|
||||
*/
|
||||
if (computer.fInitialized && !computer.flags.fPowered) {
|
||||
if (computer.fInitialized && !computer.flags.powered) {
|
||||
/**
|
||||
* Repower the computer, notifying every component to continue running as-is.
|
||||
*/
|
||||
|
|
@ -1572,10 +1572,10 @@ ComputerPDP11.exit = function()
|
|||
if (computer) {
|
||||
|
||||
if (DEBUG && computer.messageEnabled()) {
|
||||
computer.printMessage("onExit(" + computer.flags.fPowered + ")");
|
||||
computer.printMessage("onExit(" + computer.flags.powered + ")");
|
||||
}
|
||||
|
||||
if (computer.flags.fPowered) {
|
||||
if (computer.flags.powered) {
|
||||
/**
|
||||
* Power off the computer, giving every component an opportunity to save its state,
|
||||
* but only if 'resume' has been set AND there is no valid resume path (because if a valid resume
|
||||
|
|
|
|||
|
|
@ -98,14 +98,14 @@ function CPUPDP11(parmsCPU, nCyclesDefault)
|
|||
/*
|
||||
* We add a number of flags to the set initialized by Component
|
||||
*/
|
||||
this.flags.fRunning = false;
|
||||
this.flags.fStarting = false;
|
||||
this.flags.fAutoStart = parmsCPU['autoStart'];
|
||||
this.flags.running = false;
|
||||
this.flags.starting = false;
|
||||
this.flags.autoStart = parmsCPU['autoStart'];
|
||||
|
||||
/*
|
||||
* TODO: Add some UI for fDisplayLiveRegs (either an XML property, or a UI checkbox, or both)
|
||||
*/
|
||||
this.flags.fDisplayLiveRegs = false;
|
||||
this.flags.displayLiveRegs = false;
|
||||
|
||||
/*
|
||||
* Get checksum parameters, if any. runCPU() behavior is not affected until fChecksum
|
||||
|
|
@ -116,7 +116,7 @@ function CPUPDP11(parmsCPU, nCyclesDefault)
|
|||
* command ("x"); for example, "x cs int 5000" will set nCyclesChecksumInterval to 5000
|
||||
* and call resetChecksum().
|
||||
*/
|
||||
this.flags.fChecksum = false;
|
||||
this.flags.checksum = false;
|
||||
this.nChecksum = this.nCyclesChecksumNext = 0;
|
||||
this.nCyclesChecksumStart = parmsCPU["csStart"];
|
||||
this.nCyclesChecksumInterval = parmsCPU["csInterval"];
|
||||
|
|
@ -183,7 +183,7 @@ CPUPDP11.prototype.initBus = function(cmp, bus, cpu, dbg)
|
|||
*/
|
||||
var sAutoStart = cmp.getMachineParm('autoStart');
|
||||
if (sAutoStart != null) {
|
||||
this.flags.fAutoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : !!sAutoStart));
|
||||
this.flags.autoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : !!sAutoStart));
|
||||
}
|
||||
|
||||
this.setReady();
|
||||
|
|
@ -265,7 +265,7 @@ CPUPDP11.prototype.powerUp = function(data, fRepower)
|
|||
* The Computer component (which is responsible for all powerDown and powerUp notifications)
|
||||
* is now responsible for managing a component's fPowered flag, not us.
|
||||
*
|
||||
* this.flags.fPowered = true;
|
||||
* this.flags.powered = true;
|
||||
*/
|
||||
this.updateCPU();
|
||||
return true;
|
||||
|
|
@ -285,7 +285,7 @@ CPUPDP11.prototype.powerDown = function(fSave, fShutdown)
|
|||
* The Computer component (which is responsible for all powerDown and powerUp notifications)
|
||||
* is now responsible for managing a component's fPowered flag, not us.
|
||||
*
|
||||
* this.flags.fPowered = false;
|
||||
* this.flags.powered = false;
|
||||
*/
|
||||
return fSave? this.save() : true;
|
||||
};
|
||||
|
|
@ -301,7 +301,7 @@ CPUPDP11.prototype.autoStart = function()
|
|||
/*
|
||||
* Start running automatically on power-up, assuming there's no Debugger and no "Run" button
|
||||
*/
|
||||
if (this.flags.fAutoStart || (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) {
|
||||
if (this.flags.autoStart || (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) {
|
||||
/*
|
||||
* Now we ALSO set fUpdateFocus when calling runCPU(), on the assumption that in the "auto-starting" context,
|
||||
* a machine without focus is like a day without sunshine.
|
||||
|
|
@ -320,7 +320,7 @@ CPUPDP11.prototype.autoStart = function()
|
|||
*/
|
||||
CPUPDP11.prototype.isPowered = function()
|
||||
{
|
||||
if (!this.flags.fPowered) {
|
||||
if (!this.flags.powered) {
|
||||
this.println(this.toString() + " not powered");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -335,7 +335,7 @@ CPUPDP11.prototype.isPowered = function()
|
|||
*/
|
||||
CPUPDP11.prototype.isRunning = function()
|
||||
{
|
||||
return this.flags.fRunning;
|
||||
return this.flags.running;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -366,8 +366,8 @@ CPUPDP11.prototype.resetChecksum = function()
|
|||
if (this.nCyclesChecksumStart === undefined) this.nCyclesChecksumStart = 0;
|
||||
if (this.nCyclesChecksumInterval === undefined) this.nCyclesChecksumInterval = -1;
|
||||
if (this.nCyclesChecksumStop === undefined) this.nCyclesChecksumStop = -1;
|
||||
this.flags.fChecksum = (this.nCyclesChecksumStart >= 0 && this.nCyclesChecksumInterval > 0);
|
||||
if (this.flags.fChecksum) {
|
||||
this.flags.checksum = (this.nCyclesChecksumStart >= 0 && this.nCyclesChecksumInterval > 0);
|
||||
if (this.flags.checksum) {
|
||||
this.nChecksum = 0;
|
||||
this.nCyclesChecksumNext = this.nCyclesChecksumStart - this.nTotalCycles;
|
||||
/*
|
||||
|
|
@ -392,7 +392,7 @@ CPUPDP11.prototype.resetChecksum = function()
|
|||
*/
|
||||
CPUPDP11.prototype.updateChecksum = function(nCycles)
|
||||
{
|
||||
if (this.flags.fChecksum) {
|
||||
if (this.flags.checksum) {
|
||||
/*
|
||||
* Get a 32-bit summation of the current CPU state and add it to our running 32-bit checksum
|
||||
*/
|
||||
|
|
@ -448,7 +448,7 @@ CPUPDP11.prototype.displayValue = function(sLabel, nValue, cch)
|
|||
this.stopCPU();
|
||||
}
|
||||
var sVal;
|
||||
if (!this.flags.fRunning || this.flags.fDisplayLiveRegs) {
|
||||
if (!this.flags.running || this.flags.displayLiveRegs) {
|
||||
sVal = str.toHex(nValue, cch);
|
||||
} else {
|
||||
sVal = "--------".substr(0, cch);
|
||||
|
|
@ -499,7 +499,7 @@ CPUPDP11.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
* control is visible, then the computer is probably sufficiently visible as well; the problem
|
||||
* with setting fUpdateFocus to true is that it can jerk the web page around in annoying ways.
|
||||
*/
|
||||
if (!cpu.flags.fRunning)
|
||||
if (!cpu.flags.running)
|
||||
cpu.runCPU();
|
||||
else
|
||||
cpu.stopCPU();
|
||||
|
|
@ -543,7 +543,7 @@ CPUPDP11.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
|
|||
*/
|
||||
CPUPDP11.prototype.setBurstCycles = function(nCycles)
|
||||
{
|
||||
if (this.flags.fRunning) {
|
||||
if (this.flags.running) {
|
||||
var nDelta = this.nStepCycles - nCycles;
|
||||
/*
|
||||
* NOTE: If nDelta is negative, we will actually be increasing nStepCycles and nBurstCycles.
|
||||
|
|
@ -712,7 +712,7 @@ CPUPDP11.prototype.getSpeedCurrent = function()
|
|||
/*
|
||||
* TODO: Has toFixed() been "fixed" in all browsers (eg, IE) to return a rounded value now?
|
||||
*/
|
||||
return ((this.flags.fRunning && this.mhz)? (this.mhz.toFixed(2) + "Mhz") : "Stopped");
|
||||
return ((this.flags.running && this.mhz)? (this.mhz.toFixed(2) + "Mhz") : "Stopped");
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1077,7 +1077,7 @@ CPUPDP11.prototype.runCPU = function(fUpdateFocus)
|
|||
* be as HIGH as nCyclesPerYield, but it may be significantly less. getBurstCycles() will adjust
|
||||
* nCyclesPerBurst downward if any CPU timers need to fire during the next burst.
|
||||
*/
|
||||
var nCyclesPerBurst = this.getBurstCycles(this.flags.fChecksum? 1 : this.nCyclesPerYield);
|
||||
var nCyclesPerBurst = this.getBurstCycles(this.flags.checksum? 1 : this.nCyclesPerYield);
|
||||
|
||||
/*
|
||||
* Execute the burst.
|
||||
|
|
@ -1111,7 +1111,7 @@ CPUPDP11.prototype.runCPU = function(fUpdateFocus)
|
|||
}
|
||||
break;
|
||||
}
|
||||
} while (this.flags.fRunning);
|
||||
} while (this.flags.running);
|
||||
}
|
||||
catch (e) {
|
||||
this.stopCPU();
|
||||
|
|
@ -1134,7 +1134,7 @@ CPUPDP11.prototype.runCPU = function(fUpdateFocus)
|
|||
*/
|
||||
CPUPDP11.prototype.startCPU = function(fUpdateFocus)
|
||||
{
|
||||
if (!this.flags.fRunning) {
|
||||
if (!this.flags.running) {
|
||||
/*
|
||||
* setSpeed() without a speed parameter leaves the selected speed in place, but also resets the
|
||||
* cycle counter and timestamp for the current series of runCPU() calls, calculates the maximum number
|
||||
|
|
@ -1143,8 +1143,8 @@ CPUPDP11.prototype.startCPU = function(fUpdateFocus)
|
|||
*/
|
||||
this.setSpeed();
|
||||
if (this.cmp) this.cmp.start(this.msStartRun, this.getCycles());
|
||||
this.flags.fRunning = true;
|
||||
this.flags.fStarting = true;
|
||||
this.flags.running = true;
|
||||
this.flags.starting = true;
|
||||
if (this.chipset) this.chipset.start();
|
||||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Halt";
|
||||
|
|
@ -1186,13 +1186,13 @@ CPUPDP11.prototype.stopCPU = function(fComplete)
|
|||
this.endBurst();
|
||||
this.addCycles(this.nRunCycles);
|
||||
this.nRunCycles = 0;
|
||||
if (this.flags.fRunning) {
|
||||
this.flags.fRunning = false;
|
||||
if (this.flags.running) {
|
||||
this.flags.running = false;
|
||||
if (this.chipset) this.chipset.stop();
|
||||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Run";
|
||||
}
|
||||
this.flags.fComplete = fComplete;
|
||||
this.flags.complete = fComplete;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -101,12 +101,7 @@ CPUStatePDP11.prototype.initProcessor = function()
|
|||
{
|
||||
this.aOps = PDP11.aOpsPDP1170;
|
||||
this.initRegs();
|
||||
/*
|
||||
* A variety of stepCPU() state variables that don't strictly need to be initialized before the first
|
||||
* stepCPU() call, but it's good form to do so.
|
||||
*/
|
||||
this.resetCycles();
|
||||
this.flags.fComplete = this.flags.fDebugCheck = false;
|
||||
this.flags.complete = this.flags.debugCheck = false;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -116,7 +111,7 @@ CPUStatePDP11.prototype.initProcessor = function()
|
|||
*/
|
||||
CPUStatePDP11.prototype.reset = function()
|
||||
{
|
||||
if (this.flags.fRunning) this.stopCPU();
|
||||
if (this.flags.running) this.stopCPU();
|
||||
this.resetRegs();
|
||||
this.resetCycles();
|
||||
this.clearError(); // clear any fatal error/exception that setError() may have flagged
|
||||
|
|
@ -505,7 +500,7 @@ CPUStatePDP11.prototype.updateReg = function(sReg, nValue, cch)
|
|||
CPUStatePDP11.prototype.updateStatus = function(fForce)
|
||||
{
|
||||
if (this.cLiveRegs) {
|
||||
if (fForce || !this.flags.fRunning || this.flags.fDisplayLiveRegs) {
|
||||
if (fForce || !this.flags.running || this.flags.displayLiveRegs) {
|
||||
var regPSW = this.getPSW();
|
||||
this.updateReg("PSW", regPSW, 4);
|
||||
this.updateReg("SF", (regPSW & PDP11.PSW.SF)? 1 : 0, 1);
|
||||
|
|
@ -1259,12 +1254,12 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
|
|||
* Debugger is single-stepping (even when performing multiple single-steps), fRunning is never set,
|
||||
* so stopCPU() would have no effect as far as the Debugger is concerned.
|
||||
*/
|
||||
this.flags.fComplete = true;
|
||||
this.flags.complete = true;
|
||||
|
||||
/*
|
||||
* fDebugCheck is true if we need to "check" every instruction with the Debugger.
|
||||
*/
|
||||
var fDebugCheck = this.flags.fDebugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled());
|
||||
var fDebugCheck = this.flags.debugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled());
|
||||
|
||||
/*
|
||||
* nDebugState is checked only when fDebugCheck is true, and its sole purpose is to tell the first call
|
||||
|
|
@ -1274,8 +1269,8 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
|
|||
* Once we snap fStarting, we clear it, because technically, we've moved beyond "starting" and have
|
||||
* officially "started" now.
|
||||
*/
|
||||
var nDebugState = (!nMinCycles)? -1 : (this.flags.fStarting? 0 : 1);
|
||||
this.flags.fStarting = false;
|
||||
var nDebugState = (!nMinCycles)? -1 : (this.flags.starting? 0 : 1);
|
||||
this.flags.starting = false;
|
||||
|
||||
/*
|
||||
* We move the minimum cycle count to nStepCycles (the number of cycles left to step), so that other
|
||||
|
|
@ -2382,7 +2377,7 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles)
|
|||
} while (this.nStepCycles > 0);
|
||||
}
|
||||
|
||||
return (this.flags.fComplete? this.nBurstCycles - this.nStepCycles : (this.flags.fComplete === undefined? 0 : -1));
|
||||
return (this.flags.complete? this.nBurstCycles - this.nStepCycles : (this.flags.complete === undefined? 0 : -1));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -223,10 +223,6 @@ if (DEBUGGER) {
|
|||
* Technically, all of them should ALSO be preceded by a "@const" annotation, but that's a lot of work and it
|
||||
* really clutters the code. I wish the Closure Compiler had a way to annotate every definition with a given
|
||||
* section with a single annotation....
|
||||
*
|
||||
* Bugs can slip through the cracks without those annotations; for example, I unthinkingly redefined TYPE_SI
|
||||
* at one point, and if all the definitions had been preceded by an "@const", that mistake would have been
|
||||
* caught at compile-time.
|
||||
*/
|
||||
|
||||
DebuggerPDP11.COMMANDS = {
|
||||
|
|
@ -1404,7 +1400,7 @@ if (DEBUGGER) {
|
|||
* it here, so that if the CPU is reset while running, we can prevent stop()
|
||||
* from unnecessarily dumping the CPU state.
|
||||
*/
|
||||
this.flags.fRunning = false;
|
||||
this.flags.running = false;
|
||||
this.clearTempBreakpoint();
|
||||
if (!fQuiet) this.updateStatus();
|
||||
};
|
||||
|
|
@ -1463,7 +1459,7 @@ if (DEBUGGER) {
|
|||
DebuggerPDP11.prototype.start = function(ms, nCycles)
|
||||
{
|
||||
if (!this.nStep) this.println("running");
|
||||
this.flags.fRunning = true;
|
||||
this.flags.running = true;
|
||||
this.msStart = ms;
|
||||
this.nCyclesStart = nCycles;
|
||||
};
|
||||
|
|
@ -1479,8 +1475,8 @@ if (DEBUGGER) {
|
|||
*/
|
||||
DebuggerPDP11.prototype.stop = function(ms, nCycles)
|
||||
{
|
||||
if (this.flags.fRunning) {
|
||||
this.flags.fRunning = false;
|
||||
if (this.flags.running) {
|
||||
this.flags.running = false;
|
||||
this.nCycles = nCycles - this.nCyclesStart;
|
||||
if (!this.nStep) {
|
||||
var sStopped = "stopped";
|
||||
|
|
@ -2015,7 +2011,7 @@ if (DEBUGGER) {
|
|||
|
||||
if (sComment) {
|
||||
sLine = str.pad(sLine, 40) + ';' + sComment;
|
||||
if (!this.cpu.flags.fChecksum) {
|
||||
if (!this.cpu.flags.checksum) {
|
||||
sLine += (nSequence != null? '=' + nSequence.toString() : "");
|
||||
} else {
|
||||
var nCycles = this.cpu.getCycles();
|
||||
|
|
@ -3179,7 +3175,7 @@ if (DEBUGGER) {
|
|||
DebuggerPDP11.prototype.doHalt = function(fQuiet)
|
||||
{
|
||||
var sMsg;
|
||||
if (this.flags.fRunning) {
|
||||
if (this.flags.running) {
|
||||
sMsg = "halting";
|
||||
this.stopCPU();
|
||||
} else {
|
||||
|
|
@ -3433,7 +3429,7 @@ if (DEBUGGER) {
|
|||
if (nCycles !== undefined) {
|
||||
this.cpu.resetChecksum();
|
||||
}
|
||||
this.println("checksums " + (this.cpu.flags.fChecksum? "enabled" : "disabled"));
|
||||
this.println("checksums " + (this.cpu.flags.checksum? "enabled" : "disabled"));
|
||||
return;
|
||||
|
||||
case "sp":
|
||||
|
|
|
|||
|
|
@ -110,11 +110,11 @@ function Component(type, parms, constructor, bitsMessage)
|
|||
* subclasses to do the same, to reduce the property clutter we have to wade through while debugging.
|
||||
*/
|
||||
this.flags = {
|
||||
fReady: false,
|
||||
fBusy: false,
|
||||
fBusyCancel: false,
|
||||
fPowered: false,
|
||||
fError: false
|
||||
ready: false,
|
||||
busy: false,
|
||||
busyCancel: false,
|
||||
powered: false,
|
||||
error: false
|
||||
};
|
||||
|
||||
this.fnReady = null;
|
||||
|
|
@ -856,7 +856,7 @@ Component.prototype = {
|
|||
* @param {string} s describes a fatal error condition
|
||||
*/
|
||||
setError: function(s) {
|
||||
this.flags.fError = true;
|
||||
this.flags.error = true;
|
||||
this.notice(s); // TODO: Any cases where we should still prefix this string with "Fatal error: "?
|
||||
},
|
||||
/**
|
||||
|
|
@ -867,7 +867,7 @@ Component.prototype = {
|
|||
* @this {Component}
|
||||
*/
|
||||
clearError: function() {
|
||||
this.flags.fError = false;
|
||||
this.flags.error = false;
|
||||
},
|
||||
/**
|
||||
* isError()
|
||||
|
|
@ -878,7 +878,7 @@ Component.prototype = {
|
|||
* @return {boolean} true if a fatal error condition exists, false if not
|
||||
*/
|
||||
isError: function() {
|
||||
if (this.flags.fError) {
|
||||
if (this.flags.error) {
|
||||
this.println(this.toString() + " error");
|
||||
return true;
|
||||
}
|
||||
|
|
@ -899,14 +899,14 @@ Component.prototype = {
|
|||
*/
|
||||
isReady: function(fnReady) {
|
||||
if (fnReady) {
|
||||
if (this.flags.fReady) {
|
||||
if (this.flags.ready) {
|
||||
fnReady();
|
||||
} else {
|
||||
if (MAXDEBUG) this.log("NOT ready");
|
||||
this.fnReady = fnReady;
|
||||
}
|
||||
}
|
||||
return this.flags.fReady;
|
||||
return this.flags.ready;
|
||||
},
|
||||
/**
|
||||
* setReady(fReady)
|
||||
|
|
@ -917,9 +917,9 @@ Component.prototype = {
|
|||
* @param {boolean} [fReady] is assumed to indicate "ready" unless EXPLICITLY set to false
|
||||
*/
|
||||
setReady: function(fReady) {
|
||||
if (!this.flags.fError) {
|
||||
this.flags.fReady = (fReady !== false);
|
||||
if (this.flags.fReady) {
|
||||
if (!this.flags.error) {
|
||||
this.flags.ready = (fReady !== false);
|
||||
if (this.flags.ready) {
|
||||
if (MAXDEBUG /* || this.name */) this.log("ready");
|
||||
var fnReady = this.fnReady;
|
||||
this.fnReady = null;
|
||||
|
|
@ -937,14 +937,14 @@ Component.prototype = {
|
|||
* @return {boolean} true if "busy", false if not
|
||||
*/
|
||||
isBusy: function(fCancel) {
|
||||
if (this.flags.fBusy) {
|
||||
if (this.flags.busy) {
|
||||
if (fCancel) {
|
||||
this.flags.fBusyCancel = true;
|
||||
this.flags.busyCancel = true;
|
||||
} else if (fCancel === undefined) {
|
||||
this.println(this.toString() + " busy");
|
||||
}
|
||||
}
|
||||
return this.flags.fBusy;
|
||||
return this.flags.busy;
|
||||
},
|
||||
/**
|
||||
* setBusy(fBusy)
|
||||
|
|
@ -956,19 +956,19 @@ Component.prototype = {
|
|||
* @return {boolean}
|
||||
*/
|
||||
setBusy: function(fBusy) {
|
||||
if (this.flags.fBusyCancel) {
|
||||
if (this.flags.fBusy) {
|
||||
this.flags.fBusy = false;
|
||||
if (this.flags.busyCancel) {
|
||||
if (this.flags.busy) {
|
||||
this.flags.busy = false;
|
||||
}
|
||||
this.flags.fBusyCancel = false;
|
||||
this.flags.busyCancel = false;
|
||||
return false;
|
||||
}
|
||||
if (this.flags.fError) {
|
||||
if (this.flags.error) {
|
||||
this.println(this.toString() + " error");
|
||||
return false;
|
||||
}
|
||||
this.flags.fBusy = fBusy;
|
||||
return this.flags.fBusy;
|
||||
this.flags.busy = fBusy;
|
||||
return this.flags.busy;
|
||||
},
|
||||
/**
|
||||
* powerUp(fSave)
|
||||
|
|
@ -979,7 +979,7 @@ Component.prototype = {
|
|||
* @return {boolean} true if successful, false if failure
|
||||
*/
|
||||
powerUp: function(data, fRepower) {
|
||||
this.flags.fPowered = true;
|
||||
this.flags.powered = true;
|
||||
return true;
|
||||
},
|
||||
/**
|
||||
|
|
@ -991,7 +991,7 @@ Component.prototype = {
|
|||
* @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure
|
||||
*/
|
||||
powerDown: function(fSave, fShutdown) {
|
||||
if (fShutdown) this.flags.fPowered = false;
|
||||
if (fShutdown) this.flags.powered = false;
|
||||
return true;
|
||||
},
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue