Cleaned up debugger message handling
This commit is contained in:
parent
6248972684
commit
2ff339f190
31 changed files with 640 additions and 735 deletions
|
|
@ -32,8 +32,10 @@
|
|||
"global": true,
|
||||
"module": true,
|
||||
"require": true,
|
||||
"FileReader": false,
|
||||
"setTimeout": false,
|
||||
"clearTimeout": false,
|
||||
"Image": false
|
||||
"Image": false,
|
||||
"DumpAPI": false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ function C1PDebugger(parmsDbg)
|
|||
|
||||
Component.call(this, "C1PDebugger", parmsDbg);
|
||||
|
||||
this.dbg = this;
|
||||
/*
|
||||
* This keeps track of instruction activity, but only when tracing or when
|
||||
* Debugger checks have been enabled (eg, one or more breakpoints have been set).
|
||||
|
|
@ -122,7 +123,7 @@ function C1PDebugger(parmsDbg)
|
|||
this.MESSAGE_SERIAL = 0x80;
|
||||
this.MESSAGE_NONE = 0x00;
|
||||
// this.MESSAGE_ALL = 0xff;
|
||||
this.bMessages = this.MESSAGE_NONE;
|
||||
this.bitsMessage = this.MESSAGE_NONE;
|
||||
this.aMessageCategories = {
|
||||
'port': this.MESSAGE_PORT,
|
||||
'kbd': this.MESSAGE_KBD,
|
||||
|
|
@ -694,7 +695,7 @@ if (DEBUGGER) {
|
|||
];
|
||||
for (iMode=0; iMode < this.aOpModes.length; iMode++) {
|
||||
sMode = this.aOpModes[iMode];
|
||||
sRegEx += "(" + sMode.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/nnnn/g, "[0-9A-F][0-9A-F][0-9A-F][0-9A-F]?").replace(/nn/g, "[0-9A-F][0-9A-F]?").replace(/\+/g, "\\+") + "|)";
|
||||
sRegEx += "(" + sMode.replace(/\[/g, "\\[").replace(/]/g, "\\]").replace(/nnnn/g, "[0-9A-F][0-9A-F][0-9A-F][0-9A-F]?").replace(/nn/g, "[0-9A-F][0-9A-F]?").replace(/\+/g, "\\+") + "|)";
|
||||
}
|
||||
this.regexOpModes = new RegExp(sRegEx);
|
||||
}
|
||||
|
|
@ -732,31 +733,18 @@ if (DEBUGGER) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @this {C1PDebugger}
|
||||
* @param {number} bMessage is one or more Debugger MESSAGE_* category flag(s)
|
||||
* @return {boolean} true if message category is enabled, false if not
|
||||
*
|
||||
* NOTE: If the caller specifies MULTIPLE category flags, then ALL the corresponding flags
|
||||
* in the Debugger's bMessages variable must be enabled as well, else the result will be false
|
||||
*/
|
||||
C1PDebugger.prototype.messageEnabled = function(bMessage)
|
||||
{
|
||||
return ((this.bMessages & bMessage) === bMessage);
|
||||
};
|
||||
|
||||
/**
|
||||
* @this {C1PDebugger}
|
||||
* @param {Component} component
|
||||
* @param {number} addr
|
||||
* @param {number|undefined} addrFrom
|
||||
* @param {boolean} bMessage is a Debugger MESSAGE_* category flag
|
||||
* @param {boolean} bitsMessage is a Debugger MESSAGE_* category flag
|
||||
* @param {boolean|undefined} [fWrite] is true if this was a write, false (or undefined) if read
|
||||
* @param {string|undefined} [name] of the port, if any
|
||||
*/
|
||||
C1PDebugger.prototype.messagePort = function(component, addr, addrFrom, bMessage, fWrite, name)
|
||||
C1PDebugger.prototype.messageIO = function(component, addr, addrFrom, bitsMessage, fWrite, name)
|
||||
{
|
||||
if ((this.bMessages & bMessage) == bMessage) {
|
||||
if ((this.bitsMessage & bitsMessage) == bitsMessage) {
|
||||
var b = this.cpu.getByte(addr);
|
||||
this.message(component.id + "." + (fWrite? "setByte":"getByte") + "(" + str.toHexWord(addr) + ")" + (addrFrom !== undefined? (" @" + str.toHexWord(addrFrom)) : "") + ": " + (name? (name + "=") : "") + str.toHexByte(b));
|
||||
}
|
||||
|
|
@ -1947,25 +1935,25 @@ if (DEBUGGER) {
|
|||
this.println("modern syntax enabled");
|
||||
break;
|
||||
case "msg":
|
||||
var bMessage = 0;
|
||||
var bitsMessage = 0;
|
||||
if (asArgs[2] !== undefined) {
|
||||
if (asArgs[2] == "all")
|
||||
bMessage = 0xff;
|
||||
bitsMessage = 0xff;
|
||||
else if (this.aMessageCategories[asArgs[2]] !== undefined)
|
||||
bMessage = this.aMessageCategories[asArgs[2]];
|
||||
if (bMessage) {
|
||||
bitsMessage = this.aMessageCategories[asArgs[2]];
|
||||
if (bitsMessage) {
|
||||
if (asArgs[3] == "on") {
|
||||
this.bMessages |= bMessage;
|
||||
this.bitsMessage |= bitsMessage;
|
||||
}
|
||||
else if (asArgs[3] == "off") {
|
||||
this.bMessages &= ~bMessage;
|
||||
this.bitsMessage &= ~bitsMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var sCategory in this.aMessageCategories) {
|
||||
if (asArgs[2] !== undefined && (asArgs[2] != "all" && asArgs[2] != sCategory)) continue;
|
||||
bMessage = this.aMessageCategories[sCategory];
|
||||
this.println(sCategory + " messages: " + ((this.bMessages & bMessage)? "on" : "off"));
|
||||
bitsMessage = this.aMessageCategories[sCategory];
|
||||
this.println(sCategory + " messages: " + ((this.bitsMessage & bitsMessage)? "on" : "off"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -970,7 +970,7 @@ C1PDiskController.prototype.getByte = function(addr, addrFrom)
|
|||
if (addrFrom !== undefined) {
|
||||
var port = addr - this.addrController;
|
||||
var reg = this.getReg(port, false);
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, addr, addrFrom, this.dbg.MESSAGE_DISK, false, reg.sName);
|
||||
if (DEBUGGER && this.dbg) this.dbg.messageIO(this, addr, addrFrom, this.dbg.MESSAGE_DISK, false, reg.sName);
|
||||
reg.read();
|
||||
}
|
||||
};
|
||||
|
|
@ -991,7 +991,7 @@ C1PDiskController.prototype.setByte = function(addr, addrFrom)
|
|||
var port = addr - this.addrController;
|
||||
var reg = this.getReg(port, true);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(this.dbg.MESSAGE_DISK | this.dbg.MESSAGE_PORT)) {
|
||||
this.dbg.messagePort(this, addr, addrFrom, this.dbg.MESSAGE_DISK, true, reg.sName);
|
||||
this.dbg.messageIO(this, addr, addrFrom, this.dbg.MESSAGE_DISK, true, reg.sName);
|
||||
if (reg.aBitIDs) {
|
||||
var bTest = 0x80;
|
||||
var bChanged = reg.bits ^ b;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ C1PROM.prototype.setByte = function(addr, addrFrom)
|
|||
* we need to allow the Debugger to modify ROM contents).
|
||||
*/
|
||||
if (addrFrom !== undefined) {
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, addr, addrFrom, this.dbg.MESSAGE_PORT, true);
|
||||
if (DEBUGGER && this.dbg) this.dbg.messageIO(this, addr, addrFrom, this.dbg.MESSAGE_PORT, true);
|
||||
var offset = (addr - this.offROM);
|
||||
Component.assert(offset >= 0 && offset < this.cbROM);
|
||||
if (!this.abImage)
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ C1PSerialPort.prototype.setBinding = function(sHTMLType, sBinding, control)
|
|||
var fieldset = control.children[0];
|
||||
var files = fieldset.children[0].files;
|
||||
var submit = fieldset.children[1];
|
||||
submit.disabled = (files.length == 0);
|
||||
submit.disabled = !files.length;
|
||||
});
|
||||
|
||||
control.onsubmit = function(event) {
|
||||
|
|
@ -321,7 +321,7 @@ C1PSerialPort.prototype.setByte = function(addr, addrFrom)
|
|||
* the Debugger performed this write (need a special Debugger I/O command if/when you really want to do that).
|
||||
*/
|
||||
if (addrFrom !== undefined) {
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, addr, addrFrom, this.dbg.MESSAGE_SERIAL, true);
|
||||
if (DEBUGGER && this.dbg) this.dbg.messageIO(this, addr, addrFrom, this.dbg.MESSAGE_SERIAL, true);
|
||||
/*
|
||||
* WARNING: I don't yet care what state the CPU puts the port into. When it's time to support serial output,
|
||||
* obviously that will become an issue.
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ C1PVideo.prototype.getByte = function(addr, addrFrom)
|
|||
{
|
||||
var b = this.cpu.getByte(addr);
|
||||
if (addrFrom !== undefined) {
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, addr, addrFrom, this.dbg.MESSAGE_VIDEO);
|
||||
if (DEBUGGER && this.dbg) this.dbg.messageIO(this, addr, addrFrom, this.dbg.MESSAGE_VIDEO);
|
||||
}
|
||||
/*
|
||||
* The only documented READ bit in addrVideoPort is bit 7, which is supposed to alternate between
|
||||
|
|
@ -388,7 +388,7 @@ C1PVideo.prototype.getByte = function(addr, addrFrom)
|
|||
C1PVideo.prototype.setByte = function(addr, addrFrom)
|
||||
{
|
||||
if (addrFrom !== undefined) {
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, addr, addrFrom, this.dbg.MESSAGE_VIDEO);
|
||||
if (DEBUGGER && this.dbg) this.dbg.messageIO(this, addr, addrFrom, this.dbg.MESSAGE_VIDEO);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -404,7 +404,7 @@ C1PVideo.prototype.tripGuard = function(addr, addrFrom)
|
|||
* the Debugger performed this read (need a special Debugger I/O command if/when you really want to do that).
|
||||
*/
|
||||
if (addrFrom !== undefined) {
|
||||
if (DEBUGGER && this.dbg) this.dbg.messagePort(this, addr, addrFrom, this.dbg.MESSAGE_VIDEO, true);
|
||||
if (DEBUGGER && this.dbg) this.dbg.messageIO(this, addr, addrFrom, this.dbg.MESSAGE_VIDEO, true);
|
||||
/*
|
||||
* The CPU has just written to the guard address we established just beyond the video buffer's 1K boundary,
|
||||
* implying that the system thinks we have a 2K buffer instead. So we bump our model to 540, bump the
|
||||
|
|
|
|||
Loading…
Reference in a new issue