Turn live register updates OFF by default (gives browsers less reason to bog down)

This commit is contained in:
Jeff Parsons 2014-11-16 11:16:56 -08:00 committed by jeffpar
commit c2c387a06d
11 changed files with 170 additions and 146 deletions

View file

@ -2054,13 +2054,13 @@ ChipSet.prototype.updateSwitchDesc = function()
3: "Monochrome"
};
if (controlDesc != null) {
var sHTML = "";
sHTML += this.getSWMemorySize(true) + "Kb";
sHTML += ", " + asMonitorTypes[this.getSWVideoMonitor(true)] + " Monitor";
sHTML += ", " + this.getSWFloppyDrives(true) + " Floppy Drives";
var sText = "";
sText += this.getSWMemorySize(true) + "Kb";
sText += ", " + asMonitorTypes[this.getSWVideoMonitor(true)] + " Monitor";
sText += ", " + this.getSWFloppyDrives(true) + " Floppy Drives";
if (this.sw1 != null && this.sw1 != this.sw1Init || this.sw2 != null && this.sw2 != this.sw2Init)
sHTML += " (Reset required)";
controlDesc.innerHTML = sHTML;
sText += " (Reset required)";
controlDesc.textContent = sText;
}
};
@ -4087,7 +4087,7 @@ ChipSet.prototype.out8042InBuffCmd = function(port, bOut, addrFrom)
default:
if (DEBUG && DEBUGGER && this.dbg) {
this.dbg.message("unrecognized 8042 command: " + str.toHexByte(this.b8042InBuff));
this.cpu.haltCPU();
this.cpu.stopCPU();
}
break;
}
@ -4164,7 +4164,7 @@ ChipSet.prototype.set8042OutPort = function(b)
*/
if (DEBUG && DEBUGGER && this.dbg) {
this.dbg.message("unexpected 8042 output port reset: " + str.toHexByte(b));
this.cpu.haltCPU();
this.cpu.stopCPU();
}
this.cpu.resetRegs();
}

View file

@ -743,7 +743,7 @@ Computer.prototype.powerOff = function(fSave, fShutdown)
* components to do anything after they're no longer ready.
*/
if (this.cpu && this.cpu.powerDown) {
if (fShutdown) this.cpu.haltCPU();
if (fShutdown) this.cpu.stopCPU();
data = this.cpu.powerDown(fSave, fShutdown);
if (typeof data === "object") stateComputer.set(this.cpu.id, data);
if (fShutdown) {

View file

@ -100,6 +100,11 @@ function CPU(parmsCPU, nCyclesDefault)
this.aFlags.fRunning = false;
this.aFlags.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"
@ -404,7 +409,7 @@ CPU.prototype.updateChecksum = function(nCycles)
if (this.aCounts.nCyclesChecksumStop <= this.getCycles()) {
this.aCounts.nCyclesChecksumInterval = this.aCounts.nCyclesChecksumStop = -1;
this.resetChecksum();
this.haltCPU();
this.stopCPU();
fDisplay = true;
}
}
@ -436,20 +441,25 @@ CPU.prototype.displayChecksum = function()
*/
CPU.prototype.displayReg = function(sReg, nVal, cch)
{
if (this.bindings[sReg] !== undefined) {
if (this.bindings[sReg]) {
if (cch === undefined) cch = 4;
if (nVal === undefined) {
this.setError("Register " + sReg + " is invalid");
this.haltCPU();
this.stopCPU();
}
var sVal;
if (!this.aFlags.fRunning || this.aFlags.fDisplayLiveRegs) {
sVal = str.toHex(nVal, cch);
} else {
sVal = "----".substr(0, cch);
}
var sVal = str.toHex(nVal, cch);
/*
* TODO: Determine if this test actually avoids any redrawing when a register hasn't changed, and/or if
* we should maintain our own (numeric) cache of displayed register values (to avoid creating these temporary
* string values that will have to garbage-collected), and/or if this is actually slower, and/or if I'm being
* too obsessive.
*/
if (this.bindings[sReg].innerHTML != sVal) this.bindings[sReg].innerHTML = sVal;
if (this.bindings[sReg].textContent != sVal) this.bindings[sReg].textContent = sVal;
}
};
@ -459,8 +469,9 @@ CPU.prototype.displayReg = function(sReg, nVal, cch)
* This will be implemented by the X86CPU component.
*
* @this {CPU}
* @param {boolean} [fForce]
*/
CPU.prototype.displayStatus = function()
CPU.prototype.displayStatus = function(fForce)
{
};
@ -496,7 +507,7 @@ CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
if (!cpu.aFlags.fRunning)
cpu.runCPU(true);
else
cpu.haltCPU(true);
cpu.stopCPU(true);
};
fBound = true;
break;
@ -524,7 +535,7 @@ CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
control.onclick = function onClickSetSpeed() {
cpu.setSpeed(cpu.aCounts.nCyclesMultiplier << 1, true);
};
control.innerHTML = this.getSpeedTarget();
control.textContent = this.getSpeedTarget();
fBound = true;
break;
@ -534,6 +545,34 @@ CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
return fBound;
};
/**
* setBurstCycles(nCycles)
*
* This function is used by the ChipSet component whenever a very low timer count is set,
* in anticipation of the timer requiring an update sooner than the normal nCyclesPerYield
* period in runCPU() would normally provide.
*
* @this {CPU}
* @param {number} nCycles is the target number of cycles to drop the current burst to
* @return {boolean}
*/
CPU.prototype.setBurstCycles = function(nCycles)
{
if (this.aFlags.fRunning) {
var nDelta = this.nStepCycles - nCycles;
/*
* NOTE: If nDelta is negative, we will actually be increasing nStepCycles and nBurstCycles.
* Which is OK, but if we're also taking snapshots of the cycle counts, to make sure that instruction
* costs are being properly assessed, then we need to update nSnapCycles as well.
*/
if (DEBUG) this.nSnapCycles -= nDelta;
this.nStepCycles -= nDelta;
this.nBurstCycles -= nDelta;
return true;
}
return false;
};
/**
* setBurstDivisor(nDivisor)
*
@ -764,7 +803,7 @@ CPU.prototype.setSpeed = function(nMultiplier, fOnClick)
this.aCounts.mhzTarget = mhz;
var sSpeed = this.getSpeedTarget();
var controlSpeed = this.bindings["setSpeed"];
if (controlSpeed) controlSpeed.innerHTML = sSpeed;
if (controlSpeed) controlSpeed.textContent = sSpeed;
this.println("target speed: " + sSpeed);
}
if (fOnClick) this.setFocus();
@ -936,21 +975,9 @@ CPU.prototype.runCPU = function(fOnClick)
if (this.cmp) this.cmp.stop(usr.getTime(), this.getCycles());
return;
}
if (!this.aFlags.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
* of cycles for each burst based on the last known effective CPU speed, and resets the nCyclesRecalc
* threshold counter.
*/
this.setSpeed();
if (this.cmp) this.cmp.start(this.aCounts.msStartRun, this.getCycles());
this.aFlags.fRunning = true;
if (this.chipset) this.chipset.setSpeaker();
var controlRun = this.bindings["run"];
if (controlRun) controlRun.innerHTML = "Halt";
if (fOnClick) this.setFocus();
}
this.startCPU(fOnClick);
/*
* calcStartTime() initializes the cycle counter and timestamp for this runCPU() invocation, and optionally
* recalculates the the maximum number of cycles for each burst if the nCyclesRecalc threshold has been reached.
@ -1009,7 +1036,7 @@ CPU.prototype.runCPU = function(fOnClick)
} while (this.aFlags.fRunning);
}
catch (e) {
this.haltCPU();
this.stopCPU();
this.updateCPU();
if (this.cmp) this.cmp.stop(usr.getTime(), this.getCycles());
this.setBusy(false);
@ -1020,56 +1047,30 @@ CPU.prototype.runCPU = function(fOnClick)
};
/**
* setBurstCycles(nCycles)
* startCPU(fSetFocus)
*
* This function is used by the ChipSet component whenever a very low timer count is set,
* in anticipation of the timer requiring an update sooner than the normal nCyclesPerYield
* period in runCPU() would normally provide.
* WARNING: Other components must use runCPU() to get the CPU running; this is a runCPU() helper function only.
*
* @this {CPU}
* @param {number} nCycles is the target number of cycles to drop the current burst to
* @return {boolean}
* @param {boolean} [fSetFocus]
*/
CPU.prototype.setBurstCycles = function(nCycles)
CPU.prototype.startCPU = function(fSetFocus)
{
if (this.aFlags.fRunning) {
var nDelta = this.nStepCycles - nCycles;
if (!this.aFlags.fRunning) {
/*
* NOTE: If nDelta is negative, we will actually be increasing nStepCycles and nBurstCycles.
* Which is OK, but if we're also taking snapshots of the cycle counts, to make sure that instruction
* costs are being properly assessed, then we need to update nSnapCycles as well.
* 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
* of cycles for each burst based on the last known effective CPU speed, and resets the nCyclesRecalc
* threshold counter.
*/
if (DEBUG) this.nSnapCycles -= nDelta;
this.nStepCycles -= nDelta;
this.nBurstCycles -= nDelta;
return true;
}
return false;
};
/**
* haltCPU(fComplete)
*
* This similar to yieldCPU(), but it doesn't need to zero nCyclesNextYield to break out of runCPU();
* it simply needs to clear fRunning (well, "simply" may be oversimplifying a bit....)
*
* @this {CPU}
* @param {boolean} [fComplete]
*/
CPU.prototype.haltCPU = function(fComplete)
{
this.isBusy(true);
this.nBurstCycles -= this.nStepCycles;
this.nStepCycles = 0;
this.addCycles(this.nRunCycles);
this.nRunCycles = 0;
if (this.aFlags.fRunning) {
this.aFlags.fRunning = false;
this.setSpeed();
if (this.cmp) this.cmp.start(this.aCounts.msStartRun, this.getCycles());
this.aFlags.fRunning = true;
if (this.chipset) this.chipset.setSpeaker();
var controlRun = this.bindings["run"];
if (controlRun) controlRun.innerHTML = "Run";
if (controlRun) controlRun.textContent = "Halt";
this.displayStatus(true);
if (fSetFocus) this.setFocus();
}
this.aFlags.fComplete = fComplete;
};
/**
@ -1086,6 +1087,33 @@ CPU.prototype.stepCPU = function(nMinCycles)
return 0;
};
/**
* stopCPU(fComplete)
*
* For use by any component that wants to stop the CPU.
*
* This similar to yieldCPU(), but it doesn't need to zero nCyclesNextYield to break out of runCPU();
* it simply needs to clear fRunning (well, "simply" may be oversimplifying a bit....)
*
* @this {CPU}
* @param {boolean} [fComplete]
*/
CPU.prototype.stopCPU = function(fComplete)
{
this.isBusy(true);
this.nBurstCycles -= this.nStepCycles;
this.nStepCycles = 0;
this.addCycles(this.nRunCycles);
this.nRunCycles = 0;
if (this.aFlags.fRunning) {
this.aFlags.fRunning = false;
if (this.chipset) this.chipset.setSpeaker();
var controlRun = this.bindings["run"];
if (controlRun) controlRun.textContent = "Run";
}
this.aFlags.fComplete = fComplete;
};
/**
* updateCPU()
*
@ -1105,7 +1133,7 @@ CPU.prototype.updateCPU = function()
/**
* yieldCPU()
*
* Similar to haltCPU() with regard to how it resets various cycle countdown values, but the CPU
* Similar to stopCPU() with regard to how it resets various cycle countdown values, but the CPU
* remains in a "running" state.
*
* @this {CPU}

View file

@ -1548,7 +1548,7 @@ if (DEBUGGER) {
if (this.cpu) {
if (this.bitsMessageEnabled & Debugger.MESSAGE.HALT) {
this.cpu.haltCPU();
this.cpu.stopCPU();
}
/*
* We have no idea what the frequency of println() calls might be; all we know is that they easily
@ -1727,19 +1727,6 @@ if (DEBUGGER) {
return (this.nCycles > 0);
};
/**
* haltCPU()
*
* @this {Debugger}
*/
Debugger.prototype.haltCPU = function()
{
/*
* We ask the CPU to halt, but we can't assume it's stopped until it calls stop()
*/
this.cpu.haltCPU();
};
/**
* updateStatus(fRegs, fCompact)
*
@ -2054,7 +2041,7 @@ if (DEBUGGER) {
Debugger.prototype.checkMemoryRead = function(addr)
{
if (this.checkBreakpoint(addr, this.aBreakRead)) {
this.cpu.haltCPU(true);
this.cpu.stopCPU(true);
return true;
}
return false;
@ -2073,7 +2060,7 @@ if (DEBUGGER) {
Debugger.prototype.checkMemoryWrite = function(addr)
{
if (this.checkBreakpoint(addr, this.aBreakWrite)) {
this.cpu.haltCPU(true);
this.cpu.stopCPU(true);
return true;
}
return false;
@ -2095,7 +2082,7 @@ if (DEBUGGER) {
* We trust that the Bus component won't call us unless we told it to, so we halt unconditionally
*/
this.println("break on input from port " + str.toHexWord(port) + ": " + str.toHexByte(bIn));
this.cpu.haltCPU(true);
this.cpu.stopCPU(true);
return true;
};
@ -2115,7 +2102,7 @@ if (DEBUGGER) {
* We trust that the Bus component won't call us unless we told it to, so we halt unconditionally
*/
this.println("break on output to port " + str.toHexWord(port) + ": " + str.toHexByte(bOut));
this.cpu.haltCPU(true);
this.cpu.stopCPU(true);
return true;
};
@ -3685,7 +3672,7 @@ if (DEBUGGER) {
Debugger.prototype.doHalt = function(sCount)
{
if (this.aFlags.fRunning && sCount === undefined) {
this.haltCPU();
this.cpu.stopCPU();
return;
}
var sMore = "";

View file

@ -437,11 +437,11 @@ FDC.prototype.setBinding = function(sHTMLType, sBinding, control)
Component.error("FDC option error: " + e.message);
}
}
var sDesc = dataValue['desc'];
if (sDesc === undefined) sDesc = "";
var sHTML = dataValue['desc'];
if (sHTML === undefined) sHTML = "";
var sHRef = dataValue['href'];
if (sHRef !== undefined) sDesc = "<a href=\"" + sHRef + "\" target=\"_blank\">" + sDesc + "</a>";
controlDesc.innerHTML = sDesc;
if (sHRef !== undefined) sHTML = "<a href=\"" + sHRef + "\" target=\"_blank\">" + sHTML + "</a>";
controlDesc.innerHTML = sHTML;
}
};
return true;
@ -583,7 +583,7 @@ FDC.prototype.powerUp = function(data, fRepower)
while (controlDrives.firstChild) {
controlDrives.removeChild(controlDrives.firstChild);
}
controlDrives.innerHTML = "";
controlDrives.textContent = "";
for (var iDrive = 0; iDrive < this.nDrives; iDrive++) {
var controlOption = window.document.createElement("option");
controlOption['value'] = iDrive;
@ -592,7 +592,7 @@ FDC.prototype.powerUp = function(data, fRepower)
* and will NOT match the drive mappings that DOS ultimately uses. We'll need to spiff this up at
* some point.
*/
controlOption.innerHTML = String.fromCharCode(0x41 + iDrive) + ":";
controlOption.textContent = String.fromCharCode(0x41 + iDrive) + ":";
controlDrives.appendChild(controlOption);
}
if (this.nDrives > 0) {
@ -1404,7 +1404,7 @@ FDC.prototype.addDiskette = function(sName, sPath)
}
var controlOption = window.document.createElement("option");
controlOption['value'] = sPath;
controlOption.innerHTML = sName;
controlOption.textContent = sName;
controlDisks.appendChild(controlOption);
}
};
@ -1705,7 +1705,7 @@ FDC.prototype.outFDCData = function(port, bOut, addrFrom)
}
if (DEBUG) {
this.messageDebugger("unsupported FDC command: " + str.toHexByte(bCmd));
if (DEBUGGER) this.cpu.haltCPU();
if (DEBUGGER) this.cpu.stopCPU();
}
};
@ -1934,7 +1934,7 @@ FDC.prototype.doCmd = function()
default:
if (DEBUG) {
this.messageDebugger("FDC operation unsupported (command=0x: " + str.toHexByte(bCmd) + ")");
if (DEBUGGER) this.cpu.haltCPU();
if (DEBUGGER) this.cpu.stopCPU();
}
break;
}

View file

@ -1877,7 +1877,7 @@ HDC.prototype.doATCommand = function()
default:
if (DEBUG) this.messageDebugger("HDC.doATCommand(" + str.toHexByte(this.regCommand) + "): " + (bCmd < 0? ("invalid drive (" + iDrive + ")") : "unsupported operation"));
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.HDC) && bCmd >= 0) this.cpu.haltCPU();
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.HDC) && bCmd >= 0) this.cpu.stopCPU();
break;
}
@ -2046,7 +2046,7 @@ HDC.prototype.doXTCommand = function()
default:
if (DEBUG) this.messageDebugger("HDC.doXTCommand(" + str.toHexByte(bCmdOrig) + "): " + (bCmd < 0? ("invalid drive (" + iDrive + ")") : "unsupported operation"));
this.beginResult(HDC.XTC.DATA.STATUS_ERROR | bDrive);
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.HDC) && bCmd >= 0) this.cpu.haltCPU();
if (DEBUG && DEBUGGER && this.dbg && this.dbg.messageEnabled(Debugger.MESSAGE.HDC) && bCmd >= 0) this.cpu.stopCPU();
break;
}
}

View file

@ -543,7 +543,7 @@ Mouse.prototype.sendPacket = function(sDiag, xDiag, yDiag)
var b1 = 0x40 | (this.fButton1? 0x20 : 0) | (this.fButton2? 0x10 : 0) | ((this.yDelta & 0xC0) >> 4) | ((this.xDelta & 0xC0) >> 6);
var b2 = this.xDelta & 0x3F;
var b3 = this.yDelta & 0x3F;
this.messageDebugger((sDiag? (sDiag + ": ") : "") + (yDiag !== undefined? ("mouse (" + xDiag + "," + yDiag + "): ") : "") + "serial packet [" + str.toHexByte(b1) + "," + str.toHexByte(b2) + "," + str.toHexByte(b3) + "]");
this.messageDebugger((sDiag? (sDiag + ": ") : "") + (yDiag !== undefined? ("mouse (" + xDiag + "," + yDiag + "): ") : "") + "serial packet [" + str.toHexByte(b1) + "," + str.toHexByte(b2) + "," + str.toHexByte(b3) + "]", Debugger.MESSAGE.SERIAL);
this.componentAdapter.sendRBR([b1, b2, b3]);
this.xDelta = this.yDelta = 0;
};
@ -637,11 +637,17 @@ Mouse.prototype.notifyMCR = function(bMCR)
*
* @this {Mouse}
* @param {string} sMessage is any caller-defined message string
* @param {number} [bitsMessage] is one or more Debugger MESSAGE_* category flag(s)
*/
Mouse.prototype.messageDebugger = function(sMessage)
Mouse.prototype.messageDebugger = function(sMessage, bitsMessage)
{
if (DEBUGGER && this.dbg) {
if (this.dbg.messageEnabled(Debugger.MESSAGE.MOUSE)) {
if (bitsMessage == null) {
bitsMessage = Debugger.MESSAGE.MOUSE;
} else {
bitsMessage |= Debugger.MESSAGE.MOUSE;
}
if (this.dbg.messageEnabled(bitsMessage)) {
this.dbg.message(sMessage + " @" + str.toHexAddr(this.cpu.regIP, this.cpu.segCS.sel));
}
}

View file

@ -2022,7 +2022,7 @@ Video.prototype.setBinding = function(sHTMLType, sBinding, control)
switch (sBinding) {
case "lockPointer":
this.sLockMessage = control.innerHTML;
this.sLockMessage = control.textContent;
if (this.canvasScreen && this.canvasScreen.lockPointer) {
control.onclick = function onClickLockPointer() {
if (DEBUG) video.messageDebugger("lockPointer()");
@ -2128,7 +2128,7 @@ Video.prototype.notifyPointerLocked = function(fLocked)
if (this.kbd) this.kbd.notifyEscape(fLocked);
}
var control = this.bindings["lockPointer"];
if (control) control.innerHTML = (fLocked? "Press Esc to Unlock Pointer" : this.sLockMessage);
if (control) control.textContent = (fLocked? "Press Esc to Unlock Pointer" : this.sLockMessage);
};
/**

View file

@ -728,7 +728,7 @@ X86CPU.prototype.initProcessor = function()
*/
X86CPU.prototype.reset = function()
{
if (this.aFlags.fRunning) this.haltCPU();
if (this.aFlags.fRunning) this.stopCPU();
this.resetRegs();
this.resetCycles();
this.clearError(); // clear any fatal error/exception that setError() may have flagged
@ -1717,7 +1717,7 @@ X86CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
case "T":
case "I":
case "D":
case "O":
case "V":
this.bindings[sBinding] = control;
fBound = true;
break;
@ -2371,35 +2371,38 @@ X86CPU.prototype.delayINTR = function()
* displayStatus()
*
* @this {X86CPU}
* @param {boolean} [fForce]
*/
X86CPU.prototype.displayStatus = function()
X86CPU.prototype.displayStatus = function(fForce)
{
this.displayReg("AX", this.regAX);
this.displayReg("BX", this.regBX);
this.displayReg("CX", this.regCX);
this.displayReg("DX", this.regDX);
this.displayReg("SP", this.regSP);
this.displayReg("BP", this.regBP);
this.displayReg("SI", this.regSI);
this.displayReg("DI", this.regDI);
this.displayReg("CS", this.segCS.sel);
this.displayReg("DS", this.segDS.sel);
this.displayReg("SS", this.segSS.sel);
this.displayReg("ES", this.segES.sel);
this.displayReg("IP", this.regIP);
var regPS = this.getPS();
this.displayReg("PS", regPS);
this.displayReg("C", (regPS & X86.PS.CF)? 1 : 0, 1);
this.displayReg("P", (regPS & X86.PS.PF)? 1 : 0, 1);
this.displayReg("A", (regPS & X86.PS.AF)? 1 : 0, 1);
this.displayReg("Z", (regPS & X86.PS.ZF)? 1 : 0, 1);
this.displayReg("S", (regPS & X86.PS.SF)? 1 : 0, 1);
this.displayReg("T", (regPS & X86.PS.TF)? 1 : 0, 1);
this.displayReg("I", (regPS & X86.PS.IF)? 1 : 0, 1);
this.displayReg("D", (regPS & X86.PS.DF)? 1 : 0, 1);
this.displayReg("O", (regPS & X86.PS.OF)? 1 : 0, 1);
if (fForce || !this.aFlags.fRunning || this.aFlags.fDisplayLiveRegs) {
this.displayReg("AX", this.regAX);
this.displayReg("BX", this.regBX);
this.displayReg("CX", this.regCX);
this.displayReg("DX", this.regDX);
this.displayReg("SP", this.regSP);
this.displayReg("BP", this.regBP);
this.displayReg("SI", this.regSI);
this.displayReg("DI", this.regDI);
this.displayReg("CS", this.segCS.sel);
this.displayReg("DS", this.segDS.sel);
this.displayReg("SS", this.segSS.sel);
this.displayReg("ES", this.segES.sel);
this.displayReg("IP", this.regIP);
var regPS = this.getPS();
this.displayReg("PS", regPS);
this.displayReg("C", (regPS & X86.PS.CF)? 1 : 0, 1);
this.displayReg("P", (regPS & X86.PS.PF)? 1 : 0, 1);
this.displayReg("A", (regPS & X86.PS.AF)? 1 : 0, 1);
this.displayReg("Z", (regPS & X86.PS.ZF)? 1 : 0, 1);
this.displayReg("S", (regPS & X86.PS.SF)? 1 : 0, 1);
this.displayReg("T", (regPS & X86.PS.TF)? 1 : 0, 1);
this.displayReg("I", (regPS & X86.PS.IF)? 1 : 0, 1);
this.displayReg("D", (regPS & X86.PS.DF)? 1 : 0, 1);
this.displayReg("V", (regPS & X86.PS.OF)? 1 : 0, 1);
}
var controlSpeed = this.bindings["speed"];
if (controlSpeed) controlSpeed.innerHTML = this.getSpeedCurrent();
if (controlSpeed) controlSpeed.textContent = this.getSpeedCurrent();
};
/**
@ -2430,10 +2433,10 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
* by a breakpoint or some other exceptional condition (false). NOTE: this does NOT include thrown
* exceptions, which stepCPU() expects the caller to catch using its own exception handler.
*
* The CPU relies on the use of haltCPU() rather than fComplete, because the CPU never single-steps
* The CPU relies on the use of stopCPU() rather than fComplete, because the CPU never single-steps
* (ie, nMinCycles is always some large number), whereas the Debugger does. And conversely, when the
* Debugger is single-stepping (even when performing multiple single-steps), fRunning is never set,
* so haltCPU() would have no effect as far as the Debugger is concerned.
* so stopCPU() would have no effect as far as the Debugger is concerned.
*/
this.aFlags.fComplete = true;
@ -2456,7 +2459,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
/*
* We move the minimum cycle count to nStepCycles (the number of cycles left to step), so that other
* functions have the ability to force that number to zero (eg, haltCPU()), and thus we don't have to check
* functions have the ability to force that number to zero (eg, stopCPU()), and thus we don't have to check
* any other criteria to determine whether we should continue stepping or not.
*/
this.nBurstCycles = this.nStepCycles = nMinCycles;
@ -2535,7 +2538,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
}
if (DEBUGGER && fDebugCheck && this.dbg.checkInstruction(this.regEIP)) {
this.haltCPU();
this.stopCPU();
break;
}
@ -2574,7 +2577,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
if (this.nStepCycles >= this.nSnapCycles && !(this.opFlags & X86.OPFLAG.PREFIXES)) {
this.println("cycle miscount: " + (this.nSnapCycles - this.nStepCycles));
this.setIP(this.opEA - this.segCS.base);
this.haltCPU();
this.stopCPU();
break;
}
}

View file

@ -478,7 +478,7 @@ var X86Help = {
if (this.dbg.messageEnabled(Debugger.MESSAGE.CPU)) {
this.dbg.message("Fault 0x" + str.toHexByte(nFault) + (nError != null? " (0x" + str.toHexWord(nError) + ")" : "") + " on opcode 0x" + str.toHexByte(this.bus.getByteDirect(this.regEIP)) + " at " + str.toHexAddr(this.regIP, this.segCS.sel));
}
if (fHalt) this.haltCPU();
if (fHalt) this.stopCPU();
}
if (this.model >= X86.MODEL_80186) {
this.setIP(this.opEA - this.segCS.base);
@ -490,7 +490,7 @@ var X86Help = {
*/
opInvalid: function() {
X86Help.opHelpFault.call(this, X86.EXCEPTION.UD_FAULT);
this.haltCPU();
this.stopCPU();
},
/**
* @this {X86CPU}
@ -498,7 +498,7 @@ var X86Help = {
opUndefined: function() {
this.setIP(this.opEA - this.segCS.base);
this.setError("Undefined opcode 0x" + str.toHexByte(this.bus.getByteDirect(this.regEIP)) + " at " + str.toHexAddr(this.regIP, this.segCS.sel));
this.haltCPU();
this.stopCPU();
}
};

View file

@ -52,7 +52,7 @@ var X86OpXX = {
/*
* Look for common *potentially* bogus opcodes in DEBUG
*/
if (DEBUG && !b) this.haltCPU();
if (DEBUG && !b) this.stopCPU();
X86Mods.aOpModsMemByte[b].call(this, X86Grps.opGrpADDb);
},
/**
@ -3207,7 +3207,7 @@ var X86OpXX = {
*/
if (DEBUGGER && this.dbg && this.dbg.checksEnabled(true)) {
this.advanceIP(-1); // this is purely for the Debugger's benefit, to show the HLT
this.haltCPU();
this.stopCPU();
return;
}
/*
@ -3216,7 +3216,7 @@ var X86OpXX = {
*/
if (!this.getIF()) {
if (DEBUGGER && this.dbg) this.advanceIP(-1);
this.haltCPU();
this.stopCPU();
// return;
}
},