From 33a828a75b3fa0166ab1583a0651fe0bcaf7d5ae Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Wed, 16 Mar 2016 11:37:17 -0700 Subject: [PATCH] Make autoStart a proper (overridable) machine property --- _includes/machine-engines.html | 39 +++++++------ modules/c1pjs/lib/cpu.js | 26 ++++----- modules/c1pjs/lib/debugger.js | 4 +- modules/c1pjs/lib/disk.js | 6 +- modules/c1pjs/lib/keyboard.js | 6 +- modules/c1pjs/lib/panel.js | 6 +- modules/c1pjs/lib/rom.js | 4 +- modules/c1pjs/lib/serial.js | 6 +- modules/c1pjs/lib/video.js | 10 ++-- modules/markout/lib/markout.js | 4 +- modules/pcjs/lib/computer.js | 54 ++++++++++-------- modules/pcjs/lib/cpu.js | 80 +++++++++++++-------------- modules/pcjs/lib/debugger.js | 14 ++--- modules/pcjs/lib/disk.js | 2 +- modules/pcjs/lib/video.js | 2 +- modules/pcjs/lib/x86cpu.js | 20 +++---- modules/pcjs/lib/x86help.js | 4 +- modules/pcjs/lib/x86ops.js | 2 +- modules/pcjs/lib/x86seg.js | 9 ++- modules/pcjs/templates/components.xsl | 2 +- modules/shared/lib/component.js | 42 +++++++------- 21 files changed, 180 insertions(+), 162 deletions(-) diff --git a/_includes/machine-engines.html b/_includes/machine-engines.html index d1738adca..e96296571 100644 --- a/_includes/machine-engines.html +++ b/_includes/machine-engines.html @@ -24,7 +24,7 @@ here and in markout.js. Examples include 'autopower' ('autoPower') and 'automou {% endcomment %} {% for machine in page.machines %} - {% capture machine_type %}{{ machine.type | remove:'-dbg' }}{% endcapture %} + {% capture machine_type %}{{ machine.type | remove:"-dbg" }}{% endcapture %} {% if machine.debugger %} {% capture machine_file %}{{ machine_type }}-dbg{% endcapture %} {% else %} @@ -32,24 +32,31 @@ here and in markout.js. Examples include 'autopower' ('autoPower') and 'automou {% endif %} {% capture machine_embed %}embed{{ machine_type | upcase }}{% endcapture %} {% if machine.automount != nil %} - {% if machine.automount == '' %} - {% assign machine_autoMount = '{}' %} + {% if machine.automount == "" %} + {% assign machine_autoMount = "{}" %} {% else %} {% capture machine_autoMount %}{{ machine.automount|jsonify }}{% endcapture %} {% endif %} {% else %} - {% if machine.autoMount == '' %} - {% assign machine_autoMount = '{}' %} + {% if machine.autoMount == "" %} + {% assign machine_autoMount = "{}" %} {% else %} {% capture machine_autoMount %}{{ machine.autoMount|jsonify }}{% endcapture %} {% endif %} {% endif %} {% if machine.autopower != nil %} - {% capture machine_autoPower %}{{ machine.autopower }}{% endcapture %} + {% capture machine_autoPower %},autoPower:{{ machine.autopower }}{% endcapture %} {% elsif machine.autoPower != nil %} - {% capture machine_autoPower %}{{ machine.autoPower }}{% endcapture %} + {% capture machine_autoPower %},autoPower:{{ machine.autoPower }}{% endcapture %} {% else %} - {% assign machine_autoPower = "true" %} + {% assign machine_autoPower = "" %} + {% endif %} + {% if machine.autostart != nil %} + {% capture machine_autoStart %},autoStart:{{ machine.autostart }}{% endcapture %} + {% elsif machine.autoStart != nil %} + {% capture machine_autoStart %},autoStart:{{ machine.autoStart }}{% endcapture %} + {% else %} + {% assign machine_autoStart = "" %} {% endif %} {% unless machine.config %} {% assign machine_config = "machine.xml" %} @@ -57,27 +64,27 @@ here and in markout.js. Examples include 'autopower' ('autoPower') and 'automou {% assign machine_config = machine.config %} {% endunless %} {% if machine.drives != nil %} - {% if machine.drives == '' %} - {% assign machine_drives = '[]' %} + {% if machine.drives == "" %} + {% assign machine_drives = ",drives:[]" %} {% else %} - {% capture machine_drives %}{{ machine.drives }}{% endcapture %} + {% capture machine_drives %},drives:{{ machine.drives }}{% endcapture %} {% endif %} {% else %} - {% capture machine_drives %}null{% endcapture %} + {% assign machine_drives = "" %} {% endif %} {% unless machine.template %} - {% assign machine_template = '' %} + {% assign machine_template = "" %} {% else %} {% assign machine_template = machine.template %} {% endunless %} - {% capture machine_parms %}{{ site.left_brace }}autoMount:{{ machine_autoMount }},autoPower:{{ machine_autoPower }},drives:{{ machine_drives }},state:"{{ machine.state }}",messages:"{{ machine.messages }}"{{ site.right_brace }}{% endcapture %} + {% capture machine_parms %}{{ site.left_brace }}autoMount:{{ machine_autoMount }}{{ machine_autoPower }}{{ machine_autoStart }}{{ machine_drives }},state:"{{ machine.state }}",messages:"{{ machine.messages }}"{{ site.right_brace }}{% endcapture %} {% if site.pcjs.compiled == true and machine.uncompiled != true %} {% capture machine_script %}{% endcapture %} {% unless machine_scripts contains machine_script %} {{ machine_script }} {% endunless %} {% capture machine_scripts %}{{ machine_scripts }}{{ machine_script }}{% endcapture %} - {% if machine_template == '' %} + {% if machine_template == "" %} {% capture machine_template %}{{ site.baseurl }}/versions/{{ machine_type }}js/{{ site.pcjs.version }}/components.xsl{% endcapture %} {% endif %} {% else %} @@ -90,7 +97,7 @@ here and in markout.js. Examples include 'autopower' ('autoPower') and 'automou {% endunless %} {% capture machine_scripts %}{{ machine_scripts }}{{ machine_script }}{% endcapture %} {% endfor %} - {% if machine_template == '' %} + {% if machine_template == "" %} {% capture machine_template %}{{ site.baseurl }}/modules/{{ machine_type }}js/templates/components.xsl{% endcapture %} {% endif %} {% endif %} diff --git a/modules/c1pjs/lib/cpu.js b/modules/c1pjs/lib/cpu.js index d99d4b07c..6359be2d5 100644 --- a/modules/c1pjs/lib/cpu.js +++ b/modules/c1pjs/lib/cpu.js @@ -64,8 +64,8 @@ function C1PCPU(parmsCPU) Component.call(this, "C1PCPU", parmsCPU); this.clearRegs(); - this.aFlags.fPowered = false; - this.aFlags.fRunning = false; + this.flags.fPowered = false; + this.flags.fRunning = false; this.fAutoStart = parmsCPU["autoStart"]; /* @@ -489,7 +489,7 @@ Component.subclass(C1PCPU); */ C1PCPU.prototype.reset = function(fPowerOn) { - if (this.aFlags.fRunning) { + if (this.flags.fRunning) { this.halt(); } this.clearRegs(); @@ -524,7 +524,7 @@ C1PCPU.prototype.setBinding = function(sHTMLType, sBinding, control, sValue) this.bindings[sBinding] = control; control.onclick = function(cpu) { return function() { - if (!cpu.aFlags.fRunning) { + if (!cpu.flags.fRunning) { cpu.run(); } else { cpu.halt(); @@ -588,7 +588,7 @@ C1PCPU.prototype.setBuffer = function(abMemory, start, end) */ C1PCPU.prototype.setPower = function(fOn, cmp) { - if (fOn && !this.aFlags.fPowered) { + if (fOn && !this.flags.fPowered) { this.cmp = cmp; /* * Attach the Debugger, if any, to the CPU, so that the CPU can periodically @@ -616,7 +616,7 @@ C1PCPU.prototype.setPower = function(fOn, cmp) }; }(video); } - this.aFlags.fPowered = true; + this.flags.fPowered = true; this.reset(true); this.update(); } @@ -889,7 +889,7 @@ C1PCPU.prototype.displayStatus = function() */ C1PCPU.prototype.isRunning = function() { - return this.aFlags.fRunning; + return this.flags.fRunning; }; /** @@ -1060,7 +1060,7 @@ C1PCPU.prototype.run = function() if (this.cmp) this.cmp.stop(this.msRunStart, this.nRunCycles); return; } - if (!this.aFlags.fRunning) { + if (!this.flags.fRunning) { /* * 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 @@ -1069,7 +1069,7 @@ C1PCPU.prototype.run = function() */ this.setSpeed(); if (this.cmp) this.cmp.start(); - this.aFlags.fRunning = true; + this.flags.fRunning = true; if (this.bindings["run"]) this.bindings["run"].innerHTML = "Halt"; this.setFocus(); } @@ -1116,7 +1116,7 @@ C1PCPU.prototype.run = function() this.nCyclesNextYield += this.nCyclesPerYield; break; } - } while (this.aFlags.fRunning); + } while (this.flags.fRunning); } catch (e) { this.halt(); @@ -1277,8 +1277,8 @@ C1PCPU.prototype.halt = function() this.isBusy(true); this.nBurstCycles -= this.nStepCycles; this.nStepCycles = 0; - if (this.aFlags.fRunning) { - this.aFlags.fRunning = false; + if (this.flags.fRunning) { + this.flags.fRunning = false; if (this.bindings["run"]) this.bindings["run"].innerHTML = "Run"; } }; @@ -1312,7 +1312,7 @@ C1PCPU.prototype.update = function() */ C1PCPU.prototype.getCycles = function() { - return (this.aFlags.fRunning? this.nRunCycles + this.nBurstCycles - this.nStepCycles : 0); + return (this.flags.fRunning? this.nRunCycles + this.nBurstCycles - this.nStepCycles : 0); }; /** diff --git a/modules/c1pjs/lib/debugger.js b/modules/c1pjs/lib/debugger.js index 0477eb6f0..7cbddca5c 100644 --- a/modules/c1pjs/lib/debugger.js +++ b/modules/c1pjs/lib/debugger.js @@ -587,8 +587,8 @@ if (DEBUGGER) { */ C1PDebugger.prototype.setPower = function(fOn, cmp) { - if (fOn && !this.aFlags.fPowered) { - this.aFlags.fPowered = true; + if (fOn && !this.flags.fPowered) { + this.flags.fPowered = true; this.cpu = cmp.getComponentByType("cpu"); } }; diff --git a/modules/c1pjs/lib/disk.js b/modules/c1pjs/lib/disk.js index e15595a64..5eef53ed5 100644 --- a/modules/c1pjs/lib/disk.js +++ b/modules/c1pjs/lib/disk.js @@ -223,7 +223,7 @@ function C1PDiskController(parmsDC) { Component.call(this, "C1PDiskController", parmsDC); - this.aFlags.fPowered = false; + this.flags.fPowered = false; /* * Our DiskController simulates the combination of an MC6820 PIA and an MC6850 ACIA. @@ -744,8 +744,8 @@ C1PDiskController.prototype.setBuffer = function(abMemory, start, end, cpu) */ C1PDiskController.prototype.setPower = function(fOn, cmp) { - if (fOn && !this.aFlags.fPowered) { - this.aFlags.fPowered = true; + if (fOn && !this.flags.fPowered) { + this.flags.fPowered = true; if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger"); } }; diff --git a/modules/c1pjs/lib/keyboard.js b/modules/c1pjs/lib/keyboard.js index 80d3a5153..88c7e4dc2 100644 --- a/modules/c1pjs/lib/keyboard.js +++ b/modules/c1pjs/lib/keyboard.js @@ -128,7 +128,7 @@ function C1PKeyboard(parmsKbd) { Component.call(this, "C1PKeyboard", parmsKbd); - this.aFlags.fPowered = false; + this.flags.fPowered = false; this.nDefaultModel = parmsKbd['model']; /* @@ -522,8 +522,8 @@ C1PKeyboard.prototype.setModel = function(nModel) */ C1PKeyboard.prototype.setPower = function(fOn, cmp) { - if (fOn && !this.aFlags.fPowered) { - this.aFlags.fPowered = true; + if (fOn && !this.flags.fPowered) { + this.flags.fPowered = true; this.cmp = cmp; if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger"); } diff --git a/modules/c1pjs/lib/panel.js b/modules/c1pjs/lib/panel.js index 207e09835..87a512145 100644 --- a/modules/c1pjs/lib/panel.js +++ b/modules/c1pjs/lib/panel.js @@ -49,7 +49,7 @@ function C1PPanel(parmsPanel) { Component.call(this, "C1PPanel", parmsPanel); - this.aFlags.fPowered = false; + this.flags.fPowered = false; } Component.subclass(C1PPanel); @@ -82,8 +82,8 @@ C1PPanel.prototype.setBinding = function(sHTMLType, sBinding, control, sValue) */ C1PPanel.prototype.setPower = function(fOn, cmp) { - if (fOn && !this.aFlags.fPowered) { - this.aFlags.fPowered = true; + if (fOn && !this.flags.fPowered) { + this.flags.fPowered = true; this.cmp = cmp; this.cpu = cmp.getComponentByType("cpu"); this.kbd = cmp.getComponentByType("keyboard"); diff --git a/modules/c1pjs/lib/rom.js b/modules/c1pjs/lib/rom.js index e58836a2b..31c35c5eb 100644 --- a/modules/c1pjs/lib/rom.js +++ b/modules/c1pjs/lib/rom.js @@ -119,8 +119,8 @@ C1PROM.prototype.setBuffer = function(abMemory, start, end, cpu) */ C1PROM.prototype.setPower = function(fOn, cmp) { - if (fOn && !this.aFlags.fPowered) { - this.aFlags.fPowered = true; + if (fOn && !this.flags.fPowered) { + this.flags.fPowered = true; if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger"); } }; diff --git a/modules/c1pjs/lib/serial.js b/modules/c1pjs/lib/serial.js index 36a3bde52..629cf8122 100644 --- a/modules/c1pjs/lib/serial.js +++ b/modules/c1pjs/lib/serial.js @@ -50,7 +50,7 @@ function C1PSerialPort(parmsSerial) { Component.call(this, "C1PSerialPort", parmsSerial); - this.aFlags.fPowered = false; + this.flags.fPowered = false; this.fDemo = parmsSerial['demo']; this.STATUS_NONE = 0x00; @@ -211,8 +211,8 @@ C1PSerialPort.prototype.setBuffer = function(abMemory, start, end, cpu) */ C1PSerialPort.prototype.setPower = function(fOn, cmp) { - if (fOn && !this.aFlags.fPowered) { - this.aFlags.fPowered = true; + if (fOn && !this.flags.fPowered) { + this.flags.fPowered = true; this.cmp = cmp; this.kbd = cmp.getComponentByType("keyboard"); if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger"); diff --git a/modules/c1pjs/lib/video.js b/modules/c1pjs/lib/video.js index 7b22d6d25..2d6fa267d 100644 --- a/modules/c1pjs/lib/video.js +++ b/modules/c1pjs/lib/video.js @@ -321,8 +321,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.aFlags.fPowered && this.isReady()) { - this.aFlags.fPowered = true; + if (fOn && !this.flags.fPowered && this.isReady()) { + this.flags.fPowered = true; if (DEBUGGER) this.dbg = cmp.getComponentByType("debugger"); /* * If we have an associated keyboard, then ensure that the keyboard will be notified whenever @@ -341,8 +341,8 @@ C1PVideo.prototype.setPower = function(fOn, cmp) } } else - if (!fOn && this.aFlags.fPowered) { - this.aFlags.fPowered = false; + if (!fOn && this.flags.fPowered) { + this.flags.fPowered = 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. @@ -456,7 +456,7 @@ C1PVideo.prototype.initScreen = function() C1PVideo.prototype.updateScreen = function() { var offset = 0; - if (this.aFlags.fPowered) { + if (this.flags.fPowered) { while (offset < this.cbScreen) { var b = this.abMem[this.offVideo + offset]; if (this.abScreen[offset] != b) { diff --git a/modules/markout/lib/markout.js b/modules/markout/lib/markout.js index 8ebca528c..3cb26e256 100644 --- a/modules/markout/lib/markout.js +++ b/modules/markout/lib/markout.js @@ -341,6 +341,7 @@ MarkOut.aHTMLEntities = { * 'state' (eg, "state.json") * 'messages' (eg, "disk") * 'autopower' (eg, true) + * 'autostart' (eg, true) * * and any other string-based property you wish to pass through to PCjs (via the embedPC() sParms parameter). * @@ -355,7 +356,8 @@ MarkOut.aHTMLEntities = { * which are then converted to camelCase prior to calling the JavaScript components. */ MarkOut.aFMBooleanMachineProps = { - 'autopower': "autoPower" + 'autopower': "autoPower", + 'autostart': "autoStart" }; MarkOut.aFMReservedMachineProps = ['id', 'name', 'type', 'debugger', 'config', 'template', 'uncompiled', 'autoMount', 'drives', 'parms']; diff --git a/modules/pcjs/lib/computer.js b/modules/pcjs/lib/computer.js index ebcba1f48..cb673d983 100644 --- a/modules/pcjs/lib/computer.js +++ b/modules/pcjs/lib/computer.js @@ -139,7 +139,7 @@ function Computer(parmsComputer, parmsMachine, fSuspended) { Component.call(this, "Computer", parmsComputer, Computer, Messages.COMPUTER); - this.aFlags.fPowered = false; + this.flags.fPowered = false; this.setMachineParms(parmsMachine); @@ -250,7 +250,7 @@ function Computer(parmsComputer, parmsMachine, fSuspended) { * localStorage (in other words, it prevents fAllowResume from being true, and forcing resume off). */ var fAllowResume; - var sState = Component.parmsURL && Component.parmsURL['state'] || this.getMachineParm('state') || (fAllowResume = true) && parmsComputer['state']; + var sState = this.getMachineParm('state') || (fAllowResume = true) && parmsComputer['state']; if (sState) { sStatePath = this.sStatePath = sState; @@ -379,8 +379,16 @@ Computer.prototype.setMachineParms = function(parmsMachine) */ Computer.prototype.getMachineParm = function(sParm, parmsComponent) { - var value; - if (this.parmsMachine) { + /* + * When checking parmsURL, the check is allowed be a bit looser, because URL parameters are + * user-supplied, whereas most other parameters are developer-supplied. Granted, a developer + * may also be sloppy and neglect to use correct case (eg, 'automount' instead of 'autoMount'), + * but there are limits to my paranoia. + */ + var sParmLC = sParm.toLowerCase(); + var value = Component.parmsURL && (Component.parmsURL[sParm] || Component.parmsURL[sParmLC]); + + if (value === undefined && this.parmsMachine) { value = this.parmsMachine[sParm]; } if (value === undefined && parmsComponent) { @@ -653,9 +661,9 @@ Computer.prototype.powerOn = function(resume) */ Computer.prototype.powerRestore = function(component, stateComputer, fRepower, fRestore) { - if (!component.aFlags.fPowered) { + if (!component.flags.fPowered) { - component.aFlags.fPowered = true; + component.flags.fPowered = true; if (component.powerUp) { @@ -758,11 +766,11 @@ Computer.prototype.donePowerOn = function(aParms) var fRepower = (aParms[1] < 0); var fRestore = aParms[2]; - if (DEBUG && this.aFlags.fPowered && this.messageEnabled()) { + if (DEBUG && this.flags.fPowered && this.messageEnabled()) { this.printMessage("Computer.donePowerOn(): redundant"); } - this.aFlags.fPowered = true; + this.flags.fPowered = true; var controlPower = this.bindings["power"]; if (controlPower) controlPower.textContent = "Shutdown"; @@ -808,22 +816,22 @@ Computer.prototype.donePowerOn = function(aParms) */ Computer.prototype.checkPower = function() { - if (this.aFlags.fPowered) return true; + if (this.flags.fPowered) 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.aFlags.fReady) break; + if (component !== this && !component.flags.fReady) break; } if (iComponent == aComponents.length) { for (iComponent = 0; iComponent < aComponents.length; iComponent++) { component = aComponents[iComponent]; - if (component !== this && !component.aFlags.fPowered) break; + if (component !== this && !component.flags.fPowered) break; } } if (iComponent == aComponents.length) component = this; - var s = "The " + component.type + " component (" + component.id + ") is not " + (!component.aFlags.fReady? "ready yet" + (component.fnReady? " (waiting for notification)" : "") : "powered yet") + "."; + var s = "The " + component.type + " component (" + component.id + ") is not " + (!component.flags.fReady? "ready yet" + (component.fnReady? " (waiting for notification)" : "") : "powered yet") + "."; web.alertUser(s); return false; }; @@ -905,7 +913,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.aFlags.fPowered = false; + this.cpu.flags.fPowered = false; if (data === false) sState = null; } } @@ -913,13 +921,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.aFlags.fPowered) { + if (component.flags.fPowered) { if (component.powerDown) { data = component.powerDown(fSave, fShutdown); if (typeof data === "object") stateComputer.set(component.id, data); } if (fShutdown) { - component.aFlags.fPowered = false; + component.flags.fPowered = false; if (data === false) sState = null; } } @@ -972,7 +980,7 @@ Computer.prototype.powerOff = function(fSave, fShutdown) } if (fShutdown) { - this.aFlags.fPowered = false; + this.flags.fPowered = false; var controlPower = this.bindings["power"]; if (controlPower) controlPower.textContent = "Power"; } @@ -1343,7 +1351,7 @@ Computer.prototype.storeServerState = function(sUserID, sState, fSync) Computer.prototype.onPower = function() { if (!this.nPowerChange) { - if (!this.aFlags.fPowered) { + if (!this.flags.fPowered) { this.wait(this.powerOn); } else { this.powerOff(false, true); @@ -1364,7 +1372,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.aFlags.fPowered || this.nPowerChange) return; + if (!this.flags.fPowered || this.nPowerChange) return; /* * If this is a "resumable" machine (and it's not using a predefined state), then we overload the reset @@ -1465,7 +1473,7 @@ Computer.init = function() var computer = new Computer(parmsComputer, parmsMachine, true); if (DEBUG && computer.messageEnabled()) { - computer.printMessage("onInit(" + computer.aFlags.fPowered + ")"); + computer.printMessage("onInit(" + computer.flags.fPowered + ")"); } /* @@ -1502,10 +1510,10 @@ Computer.show = function() if (computer) { if (DEBUG && computer.messageEnabled()) { - computer.printMessage("onShow(" + computer.fInitialized + "," + computer.aFlags.fPowered + ")"); + computer.printMessage("onShow(" + computer.fInitialized + "," + computer.flags.fPowered + ")"); } - if (computer.fInitialized && !computer.aFlags.fPowered) { + if (computer.fInitialized && !computer.flags.fPowered) { /** * Repower the computer, notifying every component to continue running as-is. */ @@ -1551,10 +1559,10 @@ Computer.exit = function() if (computer) { if (DEBUG && computer.messageEnabled()) { - computer.printMessage("onExit(" + computer.aFlags.fPowered + ")"); + computer.printMessage("onExit(" + computer.flags.fPowered + ")"); } - if (computer.aFlags.fPowered) { + if (computer.flags.fPowered) { /** * 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 diff --git a/modules/pcjs/lib/cpu.js b/modules/pcjs/lib/cpu.js index 00ccf5ee5..2352a4240 100644 --- a/modules/pcjs/lib/cpu.js +++ b/modules/pcjs/lib/cpu.js @@ -45,14 +45,13 @@ if (NODE) { * The CPU class supports the following (parmsCPU) properties: * * cycles: the machine's base cycles per second; the X86CPU constructor will - * provide us with a default (based on the CPU model) to use as a fallback + * provide us with a default (based on the CPU model) to use as a fallback. * - * multiplier: base cycle multiplier; default is 1 + * multiplier: base cycle multiplier; default is 1. * - * autoStart: true to automatically start, false to not, or null (default) - * to make the autoStart decision based on whether or not a Debugger is - * installed (if there's no Debugger AND no "Run" button, then auto-start, - * otherwise don't) + * autoStart: true to automatically start, false to not (default); however, + * in the latter case, we make the final autoStart decision based on whether + * or not a Debugger is installed and/or a "Run" button is present. * * csStart: the number of cycles that runCPU() must wait before generating * checksum records; -1 if disabled. checksum records are a diagnostic aid @@ -99,24 +98,14 @@ function CPU(parmsCPU, nCyclesDefault) /* * We add a number of flags to the set initialized by Component */ - this.aFlags.fRunning = false; - this.aFlags.fStarting = false; - this.aFlags.fAutoStart = parmsCPU['autoStart']; + this.flags.fRunning = false; + this.flags.fStarting = false; + this.flags.fAutoStart = parmsCPU['autoStart']; /* * TODO: Add some UI for fDisplayLiveRegs (either an XML property, or a UI checkbox, or both) */ - this.aFlags.fDisplayLiveRegs = false; - - /* - * Provide a power-saving URL-based way of overriding the 'autoStart' setting; - * if an "autoStart" parameter is specified on the URL, anything other than "true" - * or "false" is treated as the null setting (see above for details). - */ - var sAutoStart = Component.parmsURL['autostart'] || Component.parmsURL['autoStart']; - if (sAutoStart !== undefined) { - this.aFlags.fAutoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : null)); - } + this.flags.fDisplayLiveRegs = false; /* * Get checksum parameters, if any. runCPU() behavior is not affected until fChecksum @@ -127,7 +116,7 @@ function CPU(parmsCPU, nCyclesDefault) * command ("x"); for example, "x cs int 5000" will set nCyclesChecksumInterval to 5000 * and call resetChecksum(). */ - this.aFlags.fChecksum = false; + this.flags.fChecksum = false; this.aCounts.nChecksum = this.aCounts.nCyclesChecksumNext = 0; this.aCounts.nCyclesChecksumStart = parmsCPU["csStart"]; this.aCounts.nCyclesChecksumInterval = parmsCPU["csInterval"]; @@ -206,6 +195,15 @@ CPU.prototype.initBus = function(cmp, bus, cpu, dbg) * We must also call chipset.updateAllTimers() periodically; stepCPU() takes care of that. */ this.chipset = cmp.getMachineComponent("ChipSet"); + + /* + * We've already saved the parmsCPU 'autoStart' setting, but there may be a machine (or URL) override. + */ + var sAutoStart = cmp.getMachineParm('autoStart'); + if (sAutoStart !== undefined) { + this.flags.fAutoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : !!sAutoStart)); + } + this.setReady(); }; @@ -287,7 +285,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.aFlags.fPowered = true; + * this.flags.fPowered = true; */ this.updateCPU(); return true; @@ -307,7 +305,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.aFlags.fPowered = false; + * this.flags.fPowered = false; */ return fSave? this.save() : true; }; @@ -323,7 +321,7 @@ CPU.prototype.autoStart = function() /* * Start running automatically on power-up, assuming there's no Debugger and no "Run" button */ - if (this.aFlags.fAutoStart === true || this.aFlags.fAutoStart === null && (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) { + if (this.flags.fAutoStart || (!DEBUGGER || !this.dbg) && this.bindings["run"] === undefined) { /* * Now we ALSO set fSetFocus when calling runCPU(), on the assumption that in the "auto-starting" context, * a machine without focus is like a day without sunshine. @@ -342,7 +340,7 @@ CPU.prototype.autoStart = function() */ CPU.prototype.isPowered = function() { - if (!this.aFlags.fPowered) { + if (!this.flags.fPowered) { this.println(this.toString() + " not powered"); return false; } @@ -357,7 +355,7 @@ CPU.prototype.isPowered = function() */ CPU.prototype.isRunning = function() { - return this.aFlags.fRunning; + return this.flags.fRunning; }; /** @@ -388,8 +386,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.aFlags.fChecksum = (this.aCounts.nCyclesChecksumStart >= 0 && this.aCounts.nCyclesChecksumInterval > 0); - if (this.aFlags.fChecksum) { + this.flags.fChecksum = (this.aCounts.nCyclesChecksumStart >= 0 && this.aCounts.nCyclesChecksumInterval > 0); + if (this.flags.fChecksum) { this.aCounts.nChecksum = 0; this.aCounts.nCyclesChecksumNext = this.aCounts.nCyclesChecksumStart - this.nTotalCycles; /* @@ -414,7 +412,7 @@ CPU.prototype.resetChecksum = function() */ CPU.prototype.updateChecksum = function(nCycles) { - if (this.aFlags.fChecksum) { + if (this.flags.fChecksum) { /* * Get a 32-bit summation of the current CPU state and add it to our running 32-bit checksum */ @@ -470,7 +468,7 @@ CPU.prototype.displayValue = function(sLabel, nValue, cch) this.stopCPU(); } var sVal; - if (!this.aFlags.fRunning || this.aFlags.fDisplayLiveRegs) { + if (!this.flags.fRunning || this.flags.fDisplayLiveRegs) { sVal = str.toHex(nValue, cch); } else { sVal = "--------".substr(0, cch); @@ -576,7 +574,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.aFlags.fRunning) + if (!cpu.flags.fRunning) cpu.runCPU(true); else cpu.stopCPU(true); @@ -617,7 +615,7 @@ CPU.prototype.setBinding = function(sHTMLType, sBinding, control, sValue) */ CPU.prototype.setBurstCycles = function(nCycles) { - if (this.aFlags.fRunning) { + if (this.flags.fRunning) { var nDelta = this.nStepCycles - nCycles; /* * NOTE: If nDelta is negative, we will actually be increasing nStepCycles and nBurstCycles. @@ -807,7 +805,7 @@ CPU.prototype.getSpeedCurrent = function() /* * TODO: Has toFixed() been "fixed" in all browsers (eg, IE) to return a rounded value now? */ - return ((this.aFlags.fRunning && this.aCounts.mhz)? (this.aCounts.mhz.toFixed(2) + "Mhz") : "Stopped"); + return ((this.flags.fRunning && this.aCounts.mhz)? (this.aCounts.mhz.toFixed(2) + "Mhz") : "Stopped"); }; /** @@ -1038,7 +1036,7 @@ CPU.prototype.runCPU = function(fSetFocus) this.calcStartTime(); try { do { - var nCyclesPerBurst = (this.aFlags.fChecksum? 1 : this.aCounts.nCyclesPerBurst); + var nCyclesPerBurst = (this.flags.fChecksum? 1 : this.aCounts.nCyclesPerBurst); if (this.chipset) { this.chipset.updateAllTimers(); @@ -1094,7 +1092,7 @@ CPU.prototype.runCPU = function(fSetFocus) this.aCounts.nCyclesNextYield += this.aCounts.nCyclesPerYield; break; } - } while (this.aFlags.fRunning); + } while (this.flags.fRunning); } catch (e) { this.stopCPU(); @@ -1116,7 +1114,7 @@ CPU.prototype.runCPU = function(fSetFocus) */ CPU.prototype.startCPU = function(fSetFocus) { - if (!this.aFlags.fRunning) { + if (!this.flags.fRunning) { /* * 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 @@ -1125,8 +1123,8 @@ CPU.prototype.startCPU = function(fSetFocus) */ this.setSpeed(); if (this.cmp) this.cmp.start(this.aCounts.msStartRun, this.getCycles()); - this.aFlags.fRunning = true; - this.aFlags.fStarting = true; + this.flags.fRunning = true; + this.flags.fStarting = true; if (this.chipset) this.chipset.setSpeaker(); var controlRun = this.bindings["run"]; if (controlRun) controlRun.textContent = "Halt"; @@ -1167,13 +1165,13 @@ CPU.prototype.stopCPU = function(fComplete) this.nStepCycles = 0; this.addCycles(this.nRunCycles); this.nRunCycles = 0; - if (this.aFlags.fRunning) { - this.aFlags.fRunning = false; + if (this.flags.fRunning) { + this.flags.fRunning = false; if (this.chipset) this.chipset.setSpeaker(); var controlRun = this.bindings["run"]; if (controlRun) controlRun.textContent = "Run"; } - this.aFlags.fComplete = fComplete; + this.flags.fComplete = fComplete; }; /** diff --git a/modules/pcjs/lib/debugger.js b/modules/pcjs/lib/debugger.js index 4ead7db3a..123df6b10 100644 --- a/modules/pcjs/lib/debugger.js +++ b/modules/pcjs/lib/debugger.js @@ -4087,7 +4087,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.aFlags.fRunning = false; + this.flags.fRunning = false; this.clearTempBreakpoint(); if (!fQuiet) this.updateStatus(); }; @@ -4146,7 +4146,7 @@ if (DEBUGGER) { Debugger.prototype.start = function(ms, nCycles) { if (!this.nStep) this.println("running"); - this.aFlags.fRunning = true; + this.flags.fRunning = true; this.msStart = ms; this.nCyclesStart = nCycles; }; @@ -4162,8 +4162,8 @@ if (DEBUGGER) { */ Debugger.prototype.stop = function(ms, nCycles) { - if (this.aFlags.fRunning) { - this.aFlags.fRunning = false; + if (this.flags.fRunning) { + this.flags.fRunning = false; this.nCycles = nCycles - this.nCyclesStart; if (!this.nStep) { var sStopped = "stopped"; @@ -4966,7 +4966,7 @@ if (DEBUGGER) { if (sComment && fComplete) { sLine = str.pad(sLine, dbgAddrIns.fAddr32? 74 : 56) + ';' + sComment; - if (!this.cpu.aFlags.fChecksum) { + if (!this.cpu.flags.fChecksum) { sLine += (nSequence != null? '=' + nSequence.toString() : ""); } else { var nCycles = this.cpu.getCycles(); @@ -6613,7 +6613,7 @@ if (DEBUGGER) { Debugger.prototype.doHalt = function(fQuiet) { var sMsg; - if (this.aFlags.fRunning) { + if (this.flags.fRunning) { sMsg = "halting"; this.stopCPU(); } else { @@ -7082,7 +7082,7 @@ if (DEBUGGER) { if (nCycles !== undefined) { this.cpu.resetChecksum(); } - this.println("checksums " + (this.cpu.aFlags.fChecksum? "enabled" : "disabled")); + this.println("checksums " + (this.cpu.flags.fChecksum? "enabled" : "disabled")); break; case "sp": if (asArgs[2] !== undefined) { diff --git a/modules/pcjs/lib/disk.js b/modules/pcjs/lib/disk.js index 70fb0c9a1..427b57731 100644 --- a/modules/pcjs/lib/disk.js +++ b/modules/pcjs/lib/disk.js @@ -1175,7 +1175,7 @@ Disk.prototype.doneLoad = function(sURL, sDiskData, nErrorCode) { var disk = null; this.fWriteProtected = false; - var fPrintOnly = (nErrorCode < 0 && this.cmp && !this.cmp.aFlags.fPowered); + var fPrintOnly = (nErrorCode < 0 && this.cmp && !this.cmp.flags.fPowered); if (this.fOnDemand) { if (!nErrorCode) { diff --git a/modules/pcjs/lib/video.js b/modules/pcjs/lib/video.js index 022cd144d..3eb0d30e5 100644 --- a/modules/pcjs/lib/video.js +++ b/modules/pcjs/lib/video.js @@ -5317,7 +5317,7 @@ Video.prototype.updateScreen = function(fForce) /* * The Computer component maintains the fPowered setting on our behalf, so we use it. */ - if (!this.aFlags.fPowered) return; + if (!this.flags.fPowered) return; /* * If the card's video signal is disabled (eg, during a mode change), then skip the update, diff --git a/modules/pcjs/lib/x86cpu.js b/modules/pcjs/lib/x86cpu.js index d3cb99eff..fa6d15f2e 100644 --- a/modules/pcjs/lib/x86cpu.js +++ b/modules/pcjs/lib/x86cpu.js @@ -149,7 +149,7 @@ function X86CPU(parmsCPU) * stepCPU() call, but it's good form to do so. */ this.resetCycles(); - this.aFlags.fComplete = this.aFlags.fDebugCheck = false; + this.flags.fComplete = this.flags.fDebugCheck = false; /* * If there are no live registers to display, then updateStatus() can skip a bit.... @@ -898,7 +898,7 @@ X86CPU.prototype.initProcessor = function() */ X86CPU.prototype.reset = function() { - if (this.aFlags.fRunning) this.stopCPU(); + if (this.flags.fRunning) this.stopCPU(); this.resetRegs(); this.resetCycles(); this.clearError(); // clear any fatal error/exception that setError() may have flagged @@ -1554,7 +1554,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.aFlags.fDebugCheck) { + if (DEBUGGER && this.flags.fDebugCheck) { if (this.messageEnabled(Messages.INT) && this.dbg.messageInt(nInt, this.regLIP) && MAXDEBUG) { this.addIntReturn(this.regLIP, function(cpu, nCycles) { return function onIntReturn(nLevel) { @@ -4151,7 +4151,7 @@ X86CPU.prototype.updateReg = function(sReg, nValue) X86CPU.prototype.updateStatus = function(fForce) { if (this.cLiveRegs) { - if (fForce || !this.aFlags.fRunning || this.aFlags.fDisplayLiveRegs) { + if (fForce || !this.flags.fRunning || this.flags.fDisplayLiveRegs) { this.updateReg("EAX", this.regEAX); this.updateReg("EBX", this.regEBX); this.updateReg("ECX", this.regECX); @@ -4225,12 +4225,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.aFlags.fComplete = true; + this.flags.fComplete = true; /* * fDebugCheck is true if we need to "check" every instruction with the Debugger. */ - var fDebugCheck = this.aFlags.fDebugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled()); + var fDebugCheck = this.flags.fDebugCheck = (DEBUGGER && this.dbg && this.dbg.checksEnabled()); /* * nDebugState is checked only when fDebugCheck is true, and its sole purpose is to tell the first call @@ -4240,8 +4240,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.aFlags.fStarting? 0 : 1); - this.aFlags.fStarting = false; + var nDebugState = (!nMinCycles)? -1 : (this.flags.fStarting? 0 : 1); + this.flags.fStarting = false; /* * We move the minimum cycle count to nStepCycles (the number of cycles left to step), so that other @@ -4367,7 +4367,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.aFlags.fComplete && this.nStepCycles >= this.nSnapCycles && !(this.opFlags & X86.OPFLAG_PREFIXES)) { + if (this.flags.fComplete && 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(); @@ -4378,7 +4378,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles) } while (this.nStepCycles > 0); - return (this.aFlags.fComplete? this.nBurstCycles - this.nStepCycles : (this.aFlags.fComplete === undefined? 0 : -1)); + return (this.flags.fComplete? this.nBurstCycles - this.nStepCycles : (this.flags.fComplete === undefined? 0 : -1)); }; /** diff --git a/modules/pcjs/lib/x86help.js b/modules/pcjs/lib/x86help.js index 5ae39ebcc..97c369eb6 100644 --- a/modules/pcjs/lib/x86help.js +++ b/modules/pcjs/lib/x86help.js @@ -738,7 +738,7 @@ X86.helpFault = function(nFault, nError, nCycles, fHalt) { var fDispatch = false; - if (!this.aFlags.fComplete) { + if (!this.flags.fComplete) { /* * 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. @@ -958,7 +958,7 @@ X86.helpCheckFault = function(nFault, nError, fHalt) if (this.messageEnabled(bitsMessage) || fHalt) { - var fRunning = this.aFlags.fRunning; + var fRunning = this.flags.fRunning; var sMessage = "Fault " + str.toHexByte(nFault) + (nError != null? " (" + str.toHexWord(nError) + ")" : "") + " on opcode " + str.toHexByte(bOpcode); if (fHalt && fRunning) sMessage += " (blocked)"; diff --git a/modules/pcjs/lib/x86ops.js b/modules/pcjs/lib/x86ops.js index a7b079738..87c8c8861 100644 --- a/modules/pcjs/lib/x86ops.js +++ b/modules/pcjs/lib/x86ops.js @@ -54,7 +54,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.aFlags.fRunning) { + if (DEBUG && !this.bModRM && this.flags.fRunning) { this.printMessage("suspicious opcode: 0x00 0x00", DEBUGGER || this.bitsMessage); if (DEBUGGER && this.dbg) this.dbg.stopCPU(); } diff --git a/modules/pcjs/lib/x86seg.js b/modules/pcjs/lib/x86seg.js index 40fa1f6b2..7b9b02a02 100644 --- a/modules/pcjs/lib/x86seg.js +++ b/modules/pcjs/lib/x86seg.js @@ -762,19 +762,22 @@ X86Seg.prototype.loadDesc8 = function(addrDesc, sel, fProbe) if (type >= X86.DESC.ACC.TYPE.CODE_EXECONLY) { /* - * There are three basic ways a new code segment can be loaded (ignoring special cases like LOADALL): + * There are three basic ways to load a new code segment (ignoring special cases like LOADALL): * * 1) CALLF (fCall is true) * 2) RETF (fCall is false) * 3) JMPF (fCall is undefined) + * + * Also, note that if fProbe is set, we're being called on behalf of a gate, in which case the + * gate logic will examine the relative privileges. */ if (fProbe != null) { sizeGate = 0; } else if (fCall !== false) { /* - * We deal with CALLF/JMPF first. We've already ascertained that the selector type refers to - * a segment, not a gate, so the next important distinction is CONFORMING vs. non-CONFORMING. + * We deal with CALLF/JMPF first. We've already ascertained that the selector type is a + * segment, not a gate, so the next important distinction is CONFORMING vs. non-CONFORMING. * * For a CONFORMING target, we must verify that its DPL <= CPL. For a non-CONFORMING target, * we must verify that RPL <= CPL and DPL == CPL. Assuming both those tests pass, we must also diff --git a/modules/pcjs/templates/components.xsl b/modules/pcjs/templates/components.xsl index 281b2cdf1..3c0a9cdfd 100644 --- a/modules/pcjs/templates/components.xsl +++ b/modules/pcjs/templates/components.xsl @@ -565,7 +565,7 @@ - null + false diff --git a/modules/shared/lib/component.js b/modules/shared/lib/component.js index 9b4f590a6..f507dbed7 100644 --- a/modules/shared/lib/component.js +++ b/modules/shared/lib/component.js @@ -111,7 +111,7 @@ function Component(type, parms, constructor, bitsMessage) * Gather all the various component flags (booleans) into a single "flags" object, and encourage * subclasses to do the same, to reduce the property clutter we have to wade through while debugging. */ - this.aFlags = { + this.flags = { fReady: false, fBusy: false, fBusyCancel: false, @@ -848,7 +848,7 @@ Component.prototype = { * @param {string} s describes a fatal error condition */ setError: function(s) { - this.aFlags.fError = true; + this.flags.fError = true; this.notice(s); // TODO: Any cases where we should still prefix this string with "Fatal error: "? }, /** @@ -859,7 +859,7 @@ Component.prototype = { * @this {Component} */ clearError: function() { - this.aFlags.fError = false; + this.flags.fError = false; }, /** * isError() @@ -870,7 +870,7 @@ Component.prototype = { * @return {boolean} true if a fatal error condition exists, false if not */ isError: function() { - if (this.aFlags.fError) { + if (this.flags.fError) { this.println(this.toString() + " error"); return true; } @@ -891,14 +891,14 @@ Component.prototype = { */ isReady: function(fnReady) { if (fnReady) { - if (this.aFlags.fReady) { + if (this.flags.fReady) { fnReady(); } else { if (MAXDEBUG) this.log("NOT ready"); this.fnReady = fnReady; } } - return this.aFlags.fReady; + return this.flags.fReady; }, /** * setReady(fReady) @@ -909,9 +909,9 @@ Component.prototype = { * @param {boolean} [fReady] is assumed to indicate "ready" unless EXPLICITLY set to false */ setReady: function(fReady) { - if (!this.aFlags.fError) { - this.aFlags.fReady = (fReady !== false); - if (this.aFlags.fReady) { + if (!this.flags.fError) { + this.flags.fReady = (fReady !== false); + if (this.flags.fReady) { if (MAXDEBUG /* || this.name */) this.log("ready"); var fnReady = this.fnReady; this.fnReady = null; @@ -929,14 +929,14 @@ Component.prototype = { * @return {boolean} true if "busy", false if not */ isBusy: function(fCancel) { - if (this.aFlags.fBusy) { + if (this.flags.fBusy) { if (fCancel) { - this.aFlags.fBusyCancel = true; + this.flags.fBusyCancel = true; } else if (fCancel === undefined) { this.println(this.toString() + " busy"); } } - return this.aFlags.fBusy; + return this.flags.fBusy; }, /** * setBusy(fBusy) @@ -948,19 +948,19 @@ Component.prototype = { * @return {boolean} */ setBusy: function(fBusy) { - if (this.aFlags.fBusyCancel) { - if (this.aFlags.fBusy) { - this.aFlags.fBusy = false; + if (this.flags.fBusyCancel) { + if (this.flags.fBusy) { + this.flags.fBusy = false; } - this.aFlags.fBusyCancel = false; + this.flags.fBusyCancel = false; return false; } - if (this.aFlags.fError) { + if (this.flags.fError) { this.println(this.toString() + " error"); return false; } - this.aFlags.fBusy = fBusy; - return this.aFlags.fBusy; + this.flags.fBusy = fBusy; + return this.flags.fBusy; }, /** * powerUp(fSave) @@ -971,7 +971,7 @@ Component.prototype = { * @return {boolean} true if successful, false if failure */ powerUp: function(data, fRepower) { - this.aFlags.fPowered = true; + this.flags.fPowered = true; return true; }, /** @@ -983,7 +983,7 @@ Component.prototype = { * @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure */ powerDown: function(fSave, fShutdown) { - if (fShutdown) this.aFlags.fPowered = false; + if (fShutdown) this.flags.fPowered = false; return true; }, /**