Make autoStart a proper (overridable) machine property
This commit is contained in:
parent
410bcb60c9
commit
33a828a75b
21 changed files with 180 additions and 162 deletions
|
|
@ -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 %}<script type="text/javascript" src="{{ site.baseurl }}/versions/{{ machine_type }}js/{{ site.pcjs.version }}/{{ machine_file }}.js"></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 %}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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'];
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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)";
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@
|
|||
<xsl:choose>
|
||||
<xsl:when test="@autostart"><xsl:value-of select="@autostart"/></xsl:when>
|
||||
<xsl:when test="@autoStart"><xsl:value-of select="@autoStart"/></xsl:when>
|
||||
<xsl:otherwise>null</xsl:otherwise>
|
||||
<xsl:otherwise>false</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="csStart">
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
},
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue