Starting on v1.21.7 (with live register display fixes)
This commit is contained in:
parent
fd80ab3812
commit
84d3f0da00
206 changed files with 286 additions and 260 deletions
|
|
@ -1478,13 +1478,38 @@ Computer.prototype.updateFocus = function(fScroll)
|
|||
};
|
||||
|
||||
/**
|
||||
* updateStatus()
|
||||
* updateStatus(fForce)
|
||||
*
|
||||
* If any DOM controls were bound to the CPU, then we need to call its updateStatus() handler; if there are no
|
||||
* such bindings, then cpu.updateStatus() does nothing.
|
||||
*
|
||||
* Similarly, if there's a Panel, then we need to call its updateStatus() handler, in case it created its own canvas
|
||||
* and implemented its own register display (eg, dumpRegisters()); if not, then panel.updateStatus() also does nothing.
|
||||
*
|
||||
* In practice, there will *either* be a Panel with a custom canvas *or* a set of DOM controls bound to the CPU *or*
|
||||
* neither. In theory, there could be BOTH, but that would be unusual.
|
||||
*
|
||||
* TODO: Consider alternate approaches to these largely register-oriented display updates. Ordinarily, we like to
|
||||
* separate logic from presentation, and currently the X86CPU contains both, since it's the component that intimately
|
||||
* knows the names, number, sizes, etc, of all the active registers. The Panel component is the logical candidate,
|
||||
* but Panel is an optional component; generally, only machines that include Debugger also include Panel.
|
||||
*
|
||||
* @this {Computer}
|
||||
*/
|
||||
Computer.prototype.updateStatus = function()
|
||||
* @param {boolean} [fForce] (true will display registers even if the CPU is running and "live" registers are not enabled)
|
||||
*/
|
||||
Computer.prototype.updateStatus = function(fForce)
|
||||
{
|
||||
if (this.panel) this.panel.updateStatus();
|
||||
/*
|
||||
* fForce is generally set to true whenever the CPU is transitioning to/from a running state, in which case
|
||||
* cpu.updateStatus() will definitely want to hide/show register contents; however, at other times, when the
|
||||
* CPU is running, constantly updating the DOM controls too frequently can adversely impact overall performance.
|
||||
*
|
||||
* So fForce serves as a hint to help cpu.updateStatus() make a more informed decision. panel.updateStatus()
|
||||
* currently doesn't care, on the theory that canvas updates should be significantly faster than DOM updates,
|
||||
* but we still pass fForce on.
|
||||
*/
|
||||
if (this.cpu) this.cpu.updateStatus(fForce);
|
||||
if (this.panel) this.panel.updateStatus(fForce);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1056,7 +1056,7 @@ CPU.prototype.startCPU = function(fUpdateFocus)
|
|||
var controlRun = this.bindings["run"];
|
||||
if (controlRun) controlRun.textContent = "Halt";
|
||||
if (this.cmp) {
|
||||
this.cmp.updateStatus();
|
||||
this.cmp.updateStatus(true);
|
||||
if (fUpdateFocus) this.cmp.updateFocus(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1118,7 +1118,7 @@ CPU.prototype.updateCPU = function(fForce)
|
|||
{
|
||||
if (this.cmp) {
|
||||
this.cmp.updateVideo(fForce);
|
||||
this.cmp.updateStatus();
|
||||
this.cmp.updateStatus(fForce);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -582,19 +582,21 @@ Panel.prototype.updateAnimation = function()
|
|||
};
|
||||
|
||||
/**
|
||||
* updateStatus()
|
||||
* updateStatus(fForce)
|
||||
*
|
||||
* Update function for Control Panels containing DOM elements with low-frequencyxt display requirements.
|
||||
* Update function for Panels containing elements with high-frequency display requirements.
|
||||
*
|
||||
* For the time being, the X86CPU component has its own updateStatus() handler, and displays all CPU registers itself.
|
||||
* For older (and slower) DOM-based display elements, those are sill being managed by the X86CPU component,
|
||||
* so it has its own updateStatus() handler.
|
||||
*
|
||||
* The Computer's updateStatus() handler is currently responsible for calling both our handler and the CPU's handler.
|
||||
*
|
||||
* @this {Panel}
|
||||
* @param {boolean} [fForce] (true will display registers even if the CPU is running and "live" registers are not enabled)
|
||||
*/
|
||||
Panel.prototype.updateStatus = function()
|
||||
Panel.prototype.updateStatus = function(fForce)
|
||||
{
|
||||
if (this.canvas) {
|
||||
this.dumpRegisters();
|
||||
}
|
||||
if (this.canvas) this.dumpRegisters();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -684,6 +686,7 @@ Panel.prototype.dumpRegisters = function()
|
|||
{
|
||||
if (this.context && this.canvasLiveRegs && this.contextLiveRegs) {
|
||||
|
||||
var cpu = this.cpu;
|
||||
var x = 0, y = 0, cx = this.canvasLiveRegs.width, cy = this.canvasLiveRegs.height;
|
||||
|
||||
this.contextLiveRegs.fillStyle = Panel.LIVEREGS.COLOR;
|
||||
|
|
@ -695,32 +698,32 @@ Panel.prototype.dumpRegisters = function()
|
|||
this.drawText("Target");
|
||||
this.drawText("Current");
|
||||
this.skipLines();
|
||||
this.drawText(this.cpu.model);
|
||||
this.drawText(this.cpu.getSpeedTarget());
|
||||
this.drawText(this.cpu.getSpeedCurrent());
|
||||
this.drawText(cpu.model);
|
||||
this.drawText(cpu.getSpeedTarget());
|
||||
this.drawText(cpu.getSpeedCurrent());
|
||||
this.skipLines(2);
|
||||
this.initCols(8);
|
||||
this.initNumberFormat(16, this.cpu.model < X86.MODEL_80386? 4 : 8);
|
||||
this.drawText("AX", this.cpu.regEAX, 2);
|
||||
this.drawText("DS", this.cpu.getDS(), 0, 1);
|
||||
this.drawText("DX", this.cpu.regEDX, 2);
|
||||
this.drawText("SI", this.cpu.regESI, 0, 1.5);
|
||||
this.drawText("BX", this.cpu.regEBX, 2);
|
||||
this.drawText("ES", this.cpu.getES(), 0, 1);
|
||||
this.drawText("CX", this.cpu.regECX, 2);
|
||||
this.drawText("DI", this.cpu.regEDI, 0, 1.5);
|
||||
this.drawText("CS", this.cpu.getCS(), 2);
|
||||
this.drawText("SS", this.cpu.getSS(), 0, 1);
|
||||
this.drawText("IP", this.cpu.getIP(), 2);
|
||||
this.drawText("SP", this.cpu.getSP(), 0, 1.5);
|
||||
this.initNumberFormat(16, cpu.model < X86.MODEL_80386? 4 : 8);
|
||||
this.drawText("AX", cpu.regEAX, 2);
|
||||
this.drawText("DS", cpu.getDS(), 0, 1);
|
||||
this.drawText("DX", cpu.regEDX, 2);
|
||||
this.drawText("SI", cpu.regESI, 0, 1.5);
|
||||
this.drawText("BX", cpu.regEBX, 2);
|
||||
this.drawText("ES", cpu.getES(), 0, 1);
|
||||
this.drawText("CX", cpu.regECX, 2);
|
||||
this.drawText("DI", cpu.regEDI, 0, 1.5);
|
||||
this.drawText("CS", cpu.getCS(), 2);
|
||||
this.drawText("SS", cpu.getSS(), 0, 1);
|
||||
this.drawText("IP", cpu.getIP(), 2);
|
||||
this.drawText("SP", cpu.getSP(), 0, 1.5);
|
||||
var regPS;
|
||||
this.drawText("PS", regPS = this.cpu.getPS(), 2);
|
||||
this.drawText("BP", this.cpu.regEBP, 0, 1.5);
|
||||
if (this.cpu.model >= X86.MODEL_80386) {
|
||||
this.drawText("FS", this.cpu.getFS(), 2);
|
||||
this.drawText("CR0", this.cpu.regCR0, 0, 1);
|
||||
this.drawText("GS", this.cpu.getGS(), 2);
|
||||
this.drawText("CR3", this.cpu.regCR3, 0, 1.5);
|
||||
this.drawText("PS", regPS = cpu.getPS(), 2);
|
||||
this.drawText("BP", cpu.regEBP, 0, 1.5);
|
||||
if (cpu.model >= X86.MODEL_80386) {
|
||||
this.drawText("FS", cpu.getFS(), 2);
|
||||
this.drawText("CR0", cpu.regCR0, 0, 1);
|
||||
this.drawText("GS", cpu.getGS(), 2);
|
||||
this.drawText("CR3", cpu.regCR3, 0, 1.5);
|
||||
}
|
||||
this.initCols(9);
|
||||
this.drawText("V" + ((regPS & X86.PS.OF)? 1 : 0));
|
||||
|
|
|
|||
|
|
@ -4145,7 +4145,7 @@ X86CPU.prototype.updateReg = function(sReg, nValue)
|
|||
};
|
||||
|
||||
/**
|
||||
* updateStatus()
|
||||
* updateStatus(fForce)
|
||||
*
|
||||
* This provides periodic Control Panel updates (eg, a few times per second; see STATUS_UPDATES_PER_SECOND).
|
||||
* this is where we take care of any DOM updates (eg, register values) while the CPU is running.
|
||||
|
|
@ -4196,8 +4196,6 @@ X86CPU.prototype.updateStatus = function(fForce)
|
|||
|
||||
var controlSpeed = this.bindings["speed"];
|
||||
if (controlSpeed) controlSpeed.textContent = this.getSpeedCurrent();
|
||||
|
||||
this.parent.updateStatus.call(this, fForce);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue