TBD function no longer needed

This commit is contained in:
Jeff Parsons 2015-04-30 14:08:10 -07:00 committed by jeffpar
commit f822efe1f0
4 changed files with 23 additions and 43 deletions

View file

@ -1031,7 +1031,7 @@ CPU.prototype.runCPU = function(fOnClick)
this.updateCPU(); this.updateCPU();
if (this.cmp) this.cmp.stop(usr.getTime(), this.getCycles()); if (this.cmp) this.cmp.stop(usr.getTime(), this.getCycles());
this.setBusy(false); this.setBusy(false);
this.setError(e.message); this.setError(e.stack || e.message);
return; return;
} }
setTimeout(this.onRunTimeout, this.calcRemainingTime()); setTimeout(this.onRunTimeout, this.calcRemainingTime());

View file

@ -1873,7 +1873,7 @@ if (DEBUGGER) {
if (this.cpu) { if (this.cpu) {
if (this.bitsMessage & Messages.HALT) { if (this.bitsMessage & Messages.HALT) {
this.cpu.stopCPU(); this.stopCPU();
} }
/* /*
* We have no idea what the frequency of println() calls might be; all we know is that they easily * We have no idea what the frequency of println() calls might be; all we know is that they easily
@ -2121,7 +2121,7 @@ if (DEBUGGER) {
} }
catch (e) { catch (e) {
this.nCycles = 0; this.nCycles = 0;
this.cpu.setError(e.message || e); this.cpu.setError(e.stack || e.message);
} }
} while (this.cpu.opFlags & X86.OPFLAG_PREFIXES); } while (this.cpu.opFlags & X86.OPFLAG_PREFIXES);
@ -2137,16 +2137,14 @@ if (DEBUGGER) {
}; };
/** /**
* stopCPU(s) * stopCPU()
* *
* @this {Debugger} * @this {Debugger}
* @param {string} [s] * @param {boolean} [fComplete]
* @param {boolean} [fBlockFaults]
*/ */
Debugger.prototype.stopCPU = function(s, fBlockFaults) Debugger.prototype.stopCPU = function(fComplete)
{ {
if (s) this.println(s); if (this.cpu) this.cpu.stopCPU(fComplete);
if (this.cpu) this.cpu.stopCPU(!fBlockFaults);
}; };
/** /**
@ -2461,7 +2459,7 @@ if (DEBUGGER) {
Debugger.prototype.checkMemoryRead = function(addr) Debugger.prototype.checkMemoryRead = function(addr)
{ {
if (this.checkBreakpoint(addr, this.aBreakRead)) { if (this.checkBreakpoint(addr, this.aBreakRead)) {
this.cpu.stopCPU(true); this.stopCPU(true);
return true; return true;
} }
return false; return false;
@ -2480,7 +2478,7 @@ if (DEBUGGER) {
Debugger.prototype.checkMemoryWrite = function(addr) Debugger.prototype.checkMemoryWrite = function(addr)
{ {
if (this.checkBreakpoint(addr, this.aBreakWrite)) { if (this.checkBreakpoint(addr, this.aBreakWrite)) {
this.cpu.stopCPU(true); this.stopCPU(true);
return true; return true;
} }
return false; return false;
@ -2502,7 +2500,7 @@ if (DEBUGGER) {
* We trust that the Bus component won't call us unless we told it to, so we halt unconditionally * 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.println("break on input from port " + str.toHexWord(port) + ": " + str.toHexByte(bIn));
this.cpu.stopCPU(true); this.stopCPU(true);
return true; return true;
}; };
@ -2522,7 +2520,7 @@ if (DEBUGGER) {
* We trust that the Bus component won't call us unless we told it to, so we halt unconditionally * 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.println("break on output to port " + str.toHexWord(port) + ": " + str.toHexByte(bOut));
this.cpu.stopCPU(true); this.stopCPU(true);
return true; return true;
}; };
@ -4204,7 +4202,7 @@ if (DEBUGGER) {
{ {
if (this.aFlags.fRunning && sCount === undefined) { if (this.aFlags.fRunning && sCount === undefined) {
this.println("halting"); this.println("halting");
this.cpu.stopCPU(); this.stopCPU();
return; return;
} }
var sMore = ""; var sMore = "";

View file

@ -3379,22 +3379,6 @@ X86.fnXORw = function XORw(dst, src)
return this.setLogicResult(dst ^ src, this.dataType); return this.setLogicResult(dst ^ src, this.dataType);
}; };
/**
* fnTBD(dst, src)
*
* @this {X86CPU}
* @param {number} dst
* @param {number} src
* @return {number}
*/
X86.fnTBD = function TBD(dst, src)
{
this.setIP(this.opLIP - this.segCS.base);
this.printMessage("unimplemented 80386 opcode", true);
this.stopCPU();
return dst;
};
/** /**
* fnGRPFault(dst, src) * fnGRPFault(dst, src)
* *

View file

@ -261,7 +261,7 @@ Component.log = function(s, type)
* *
* The Closure Compiler should automatically remove all references to Component.assert() in non-DEBUG builds. * The Closure Compiler should automatically remove all references to Component.assert() in non-DEBUG builds.
* *
* TODO: Add a task to the build process that "asserts" there are no occurrences of "assertion failure" in the final code. * TODO: Add a task to the build process that "asserts" there are no instances of "assertion failure" in RELEASE builds.
* *
* @param {boolean} f is the expression we are asserting to be true * @param {boolean} f is the expression we are asserting to be true
* @param {string} [s] is description of the assertion on failure * @param {string} [s] is description of the assertion on failure
@ -270,9 +270,6 @@ Component.assert = function(f, s)
{ {
if (DEBUG) { if (DEBUG) {
if (!f) { if (!f) {
/*
* TODO: An accompanying source file/line number/function call (eg, stack trace) would be nice.
*/
if (!s) s = "assertion failure"; if (!s) s = "assertion failure";
Component.log(s); Component.log(s);
throw new Error(s); throw new Error(s);
@ -705,7 +702,7 @@ Component.prototype = {
* the Closure Compiler can't be sure that this instance method hasn't been overridden, so it refuses to treat it as * the Closure Compiler can't be sure that this instance method hasn't been overridden, so it refuses to treat it as
* dead code in non-DEBUG builds. * dead code in non-DEBUG builds.
* *
* TODO: Add a task to the build process that "asserts" there are no occurrences of "assertion failure" in the final code. * TODO: Add a task to the build process that "asserts" there are no instances of "assertion failure" in RELEASE builds.
* *
* @param {boolean} f is the expression we are asserting to be true * @param {boolean} f is the expression we are asserting to be true
* @param {string} [s] is description of the assertion on failure * @param {string} [s] is description of the assertion on failure
@ -713,28 +710,29 @@ Component.prototype = {
assert: function(f, s) { assert: function(f, s) {
if (DEBUG) { if (DEBUG) {
if (!f) { if (!f) {
/*
* TODO: An accompanying source file/line number/function call (eg, stack trace) would be nice.
*/
s = "assertion failure in " + (this.id || this.type) + (s? ": " + s : ""); s = "assertion failure in " + (this.id || this.type) + (s? ": " + s : "");
if (DEBUGGER && this.dbg) { if (DEBUGGER && this.dbg) {
this.dbg.stopCPU(s, true); this.dbg.stopCPU();
/* /*
* Why do we throw an Error only to immediately catch and ignore it? Simply to give * Why do we throw an Error only to immediately catch and ignore it? Simply to give
* any IDE the opportunity to inspect the application's state. Even when the IDE has * any IDE the opportunity to inspect the application's state. Even when the IDE has
* control, you should still be able to invoke Debugger commands from the IDE's REPL, * control, you should still be able to invoke Debugger commands from the IDE's REPL,
* using the '$' global function that the Debugger constructor sets up; eg: * using the '$' global function that the Debugger constructor defines; eg:
* *
* $('r') * $('r')
* $('dw 0:0') * $('dw 0:0')
* $('h') * $('h')
* ... * ...
* *
* If you have no desire to stop on assertions, consider this a no-op. * If you have no desire to stop on assertions, consider this a no-op. However, another
* potential benefit of creating an Error object is that, for browsers like Chrome, we get
* a stack trace, too.
*/ */
try { try {
throw new Error(s); throw new Error(s);
} catch(e) {} } catch(e) {
this.println(e.stack || e.message);
}
return; return;
} }
this.log(s); this.log(s);
@ -794,7 +792,7 @@ Component.prototype = {
*/ */
setError: function(s) { setError: function(s) {
this.aFlags.fError = true; this.aFlags.fError = true;
this.notice("Fatal error: " + s); this.notice(s); // TODO: Any cases where we should still prefix this string with "Fatal error: "?
}, },
/** /**
* clearError() * clearError()