Skip to content
This repository has been archived by the owner on Dec 24, 2020. It is now read-only.

Commit

Permalink
Debugger commands work with known IOPAGE symbols now
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffpar committed Dec 5, 2016
1 parent 571484c commit 3b3948e
Show file tree
Hide file tree
Showing 8 changed files with 243 additions and 185 deletions.
2 changes: 1 addition & 1 deletion docs/pcx86/examples/pcx86-dbg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 32 additions & 7 deletions modules/pdp11/lib/bus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
*
Expand Down
14 changes: 14 additions & 0 deletions modules/pdp11/lib/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
Expand Down
21 changes: 20 additions & 1 deletion modules/shared/lib/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion versions/pc8080/1.30.6/pc8080-dbg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion versions/pcx86/1.30.6/pcx86-dbg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3b3948e

Please sign in to comment.