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:
Jeff Parsons 2016-09-13 15:33:16 -07:00
commit 3bd02c7e19
298 changed files with 16473 additions and 3885 deletions

View file

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

View file

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

View file

@ -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));
};
/**

View file

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