Debugger commands work with known IOPAGE symbols now

This commit is contained in:
Jeff Parsons 2016-12-05 15:38:46 -08:00 committed by Jeff Parsons
commit 9746891780
8 changed files with 243 additions and 185 deletions

View file

@ -177,7 +177,7 @@ BusPDP11.IOHANDLER = {
WRITE_BYTE: 1,
READ_WORD: 2,
WRITE_WORD: 3,
NAME: 4,
REG_NAME: 4,
MSG_CATEGORY: 5,
DBG_BREAK: 6
};
@ -272,7 +272,7 @@ BusPDP11.IOController = {
}
if (b >= 0) {
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS | afn[BusPDP11.IOHANDLER.MSG_CATEGORY])) {
this.dbg.printMessage(afn[BusPDP11.IOHANDLER.NAME] + ".readByte(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(b), true, !bus.nDisableFaults);
this.dbg.printMessage(afn[BusPDP11.IOHANDLER.REG_NAME] + ".readByte(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(b), true, !bus.nDisableFaults);
}
return b;
}
@ -357,7 +357,7 @@ BusPDP11.IOController = {
}
if (fWrite) {
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS | afn[BusPDP11.IOHANDLER.MSG_CATEGORY])) {
this.dbg.printMessage(afn[BusPDP11.IOHANDLER.NAME] + ".writeByte(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(b) + ")", true, !bus.nDisableFaults);
this.dbg.printMessage(afn[BusPDP11.IOHANDLER.REG_NAME] + ".writeByte(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(b) + ")", true, !bus.nDisableFaults);
}
return;
}
@ -400,7 +400,7 @@ BusPDP11.IOController = {
}
if (w >= 0) {
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS | afn[BusPDP11.IOHANDLER.MSG_CATEGORY])) {
this.dbg.printMessage(afn[BusPDP11.IOHANDLER.NAME] + ".readWord(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(w), true, !bus.nDisableFaults);
this.dbg.printMessage(afn[BusPDP11.IOHANDLER.REG_NAME] + ".readWord(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(w), true, !bus.nDisableFaults);
}
return w;
}
@ -448,7 +448,7 @@ BusPDP11.IOController = {
}
if (fWrite) {
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS | afn[BusPDP11.IOHANDLER.MSG_CATEGORY])) {
this.dbg.printMessage(afn[BusPDP11.IOHANDLER.NAME] + ".writeWord(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(w) + ")", true, !bus.nDisableFaults);
this.dbg.printMessage(afn[BusPDP11.IOHANDLER.REG_NAME] + ".writeWord(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(w) + ")", true, !bus.nDisableFaults);
}
return;
}
@ -1243,13 +1243,16 @@ BusPDP11.prototype.getMemoryLimit = function(type)
*/
BusPDP11.prototype.addIOHandlers = function(start, end, fnReadByte, fnWriteByte, fnReadWord, fnWriteWord, message, sName)
{
var index = (start == end? -1 : 0);
for (var addr = start; addr <= end; addr += 2) {
var off = addr & BusPDP11.IOPAGE_MASK;
if (this.aIOHandlers[off] !== undefined) {
Component.warning("I/O address already registered: " + str.toHexLong(addr));
return false;
}
this.aIOHandlers[off] = [fnReadByte, fnWriteByte, fnReadWord, fnWriteWord, sName || "unknown", message || MessagesPDP11.BUS, false];
var s = sName || "unknown";
if (s && index >= 0) s += index++;
this.aIOHandlers[off] = [fnReadByte, fnWriteByte, fnReadWord, fnWriteWord, s, message || MessagesPDP11.BUS, false];
if (MAXDEBUG) this.log("addIOHandlers(" + str.toHexLong(addr) + ")");
}
return true;
@ -1332,11 +1335,33 @@ BusPDP11.prototype.getAddrInfo = function(addr)
if (addr >= this.addrIOPage) {
var off = addr & BusPDP11.IOPAGE_MASK;
var afn = this.aIOHandlers[off];
if (afn) sName = afn[BusPDP11.IOHANDLER.NAME];
if (afn) sName = afn[BusPDP11.IOHANDLER.REG_NAME];
}
return sName;
};
/**
* getAddrByName(sName)
*
* Determine if the specified name has a corresponding physical address.
*
* @this {BusPDP11}
* @param {string} sName
* @return {number|null}
*/
BusPDP11.prototype.getAddrByName = function(sName)
{
sName = sName.toUpperCase();
for (var i in this.aIOHandlers) {
var off = +i;
var afn = this.aIOHandlers[off];
if (afn[BusPDP11.IOHANDLER.REG_NAME] == sName) {
return off + this.addrIOPage;
}
}
return null;
};
/**
* addResetHandler(fnReset)
*

View file

@ -1250,6 +1250,20 @@ if (DEBUGGER) {
return value;
};
/**
* getSymbolValue(sSymbol)
*
* NOTE: At this time, the only symbols we support are those IOPAGE symbols that the Bus component knows about.
*
* @this {DebuggerPDP11}
* @param {string} sSymbol
* @return {number|undefined|null}
*/
DebuggerPDP11.prototype.getSymbolValue = function(sSymbol)
{
return this.bus.getAddrByName(sSymbol);
};
/**
* replaceRegs(s)
*

View file

@ -179,6 +179,20 @@ if (DEBUGGER) {
return undefined;
};
/**
* getSymbolValue(sSymbol)
*
* NOTE: This must be implemented by the individual debuggers.
*
* @this {Debugger}
* @param {string} sSymbol
* @return {number|undefined|null}
*/
Debugger.prototype.getSymbolValue = function(sSymbol)
{
return undefined;
};
/**
* parseAddrReference(s, sAddr)
*
@ -577,7 +591,12 @@ if (DEBUGGER) {
value = this.getRegValue(iReg);
} else {
value = this.getVariable(sValue);
if (value == null) value = str.parseInt(sValue, this.nBase);
if (value == null) {
value = this.getSymbolValue(sValue);
if (value == null) {
value = str.parseInt(sValue, this.nBase);
}
}
}
if (value == null && !fQuiet) this.println("invalid " + (sName? sName : "value") + ": " + sValue);
} else {