Added some RK11 fixes for the 11/70 CPU EXERCISER, and some Debugger improvements for dumping address info ("da")

This commit is contained in:
Jeff Parsons 2016-12-08 17:05:03 -08:00 committed by Jeff Parsons
commit ba8771adf1
18 changed files with 847 additions and 793 deletions

View file

@ -55,6 +55,7 @@ if (DEBUGGER) {
* addr address
* fPhysical true if this is a physical address
* fTemporary true if this is a temporary breakpoint address
* nBase set if the address contained an explicit base (eg, 16, 10, 8, etc)
* sCmd set for breakpoint addresses if there's an associated command string
* aCmds preprocessed commands (from sCmd)
*
@ -62,6 +63,7 @@ if (DEBUGGER) {
* addr:(number|undefined),
* fPhysical:(boolean|undefined),
* fTemporary:(boolean|undefined),
* nBase:(number|undefined),
* sCmd:(string|undefined),
* aCmds:(Array.<string>|undefined)
* }} DbgAddrPDP11
@ -266,14 +268,14 @@ if (DEBUGGER) {
/*
* Register numbers 0-7 are reserved for cpu.regsGen, 8-15 are reserved for cpu.regsAlt, and 16-19 for cpu.regsStack.
*/
DebuggerPDP11.REG_PSW = 20;
DebuggerPDP11.REG_PIR = 21;
DebuggerPDP11.REG_ERR = 22;
DebuggerPDP11.REG_PS = 20;
DebuggerPDP11.REG_PI = 21;
DebuggerPDP11.REG_ER = 22;
DebuggerPDP11.REG_SL = 23;
DebuggerPDP11.REG_MMR0 = 24;
DebuggerPDP11.REG_MMR1 = 25;
DebuggerPDP11.REG_MMR2 = 26;
DebuggerPDP11.REG_MMR3 = 27;
DebuggerPDP11.REG_M0 = 24;
DebuggerPDP11.REG_M1 = 25;
DebuggerPDP11.REG_M2 = 26;
DebuggerPDP11.REG_M3 = 27;
DebuggerPDP11.REG_AR = 28; // ADDRESS register; see Panel's getAR() and setAR()
DebuggerPDP11.REG_DR = 29; // DISPLAY/DATA register; see Panel's getDR() and setDR()
DebuggerPDP11.REG_SR = 30; // SWITCH register; see Panel's getSR() and setSR()
@ -281,14 +283,14 @@ if (DEBUGGER) {
DebuggerPDP11.REGS = {
"SP": 6,
"PC": 7,
"PS": DebuggerPDP11.REG_PSW,
"IR": DebuggerPDP11.REG_PIR,
"ER": DebuggerPDP11.REG_ERR,
"PS": DebuggerPDP11.REG_PS,
"PI": DebuggerPDP11.REG_PI,
"ER": DebuggerPDP11.REG_ER,
"SL": DebuggerPDP11.REG_SL,
"MMR0": DebuggerPDP11.REG_MMR0,
"MMR1": DebuggerPDP11.REG_MMR1,
"MMR2": DebuggerPDP11.REG_MMR2,
"MMR3": DebuggerPDP11.REG_MMR3,
"M0": DebuggerPDP11.REG_M0,
"M1": DebuggerPDP11.REG_M1,
"M2": DebuggerPDP11.REG_M2,
"M3": DebuggerPDP11.REG_M3,
"AR": DebuggerPDP11.REG_AR,
"DR": DebuggerPDP11.REG_DR,
"SR": DebuggerPDP11.REG_SR
@ -656,7 +658,7 @@ if (DEBUGGER) {
*/
DebuggerPDP11.prototype.mapUnibus = function(addr)
{
return (addr >= BusPDP11.UNIBUS_22BIT)? this.cpu.mapUnibus(addr) : addr;
return this.cpu.mapUnibus(addr);
};
/**
@ -825,7 +827,7 @@ if (DEBUGGER) {
var dbgAddr;
var dbgAddrNext = (fCode? this.dbgAddrNextCode : this.dbgAddrNextData);
var addr = dbgAddrNext.addr;
var fPhysical = false;
var fPhysical = false, nBase;
if (sAddr !== undefined) {
sAddr = this.parseReference(sAddr);
var ch = sAddr.charAt(0);
@ -835,10 +837,18 @@ if (DEBUGGER) {
}
dbgAddr = this.findSymbolAddr(sAddr);
if (dbgAddr) return dbgAddr;
if (sAddr.indexOf("0x") >= 0) {
nBase = 16
} else if (sAddr.indexOf("0o") >= 0) {
nBase = 8;
} else if (sAddr.indexOf('.') >= 0) {
nBase = 10;
}
addr = this.parseExpression(sAddr, fPrint);
}
if (addr != null) {
dbgAddr = this.newAddr(addr, fPhysical);
dbgAddr.nBase = nBase;
}
return dbgAddr;
};
@ -1209,28 +1219,28 @@ if (DEBUGGER) {
var cpu = this.cpu;
var panel = this.panel;
switch(iReg) {
case DebuggerPDP11.REG_PSW:
case DebuggerPDP11.REG_PS:
value = this.cpu.getPSW();
break;
case DebuggerPDP11.REG_PIR:
value = cpu.regPIR;
case DebuggerPDP11.REG_PI:
value = cpu.getPIR();
break;
case DebuggerPDP11.REG_ERR:
case DebuggerPDP11.REG_ER:
value = cpu.regErr;
break;
case DebuggerPDP11.REG_SL:
value = cpu.regSL;
value = cpu.getSLR();
break;
case DebuggerPDP11.REG_MMR0:
case DebuggerPDP11.REG_M0:
value = cpu.getMMR0();
break;
case DebuggerPDP11.REG_MMR1:
case DebuggerPDP11.REG_M1:
value = cpu.getMMR1();
break;
case DebuggerPDP11.REG_MMR2:
case DebuggerPDP11.REG_M2:
value = cpu.getMMR2();
break;
case DebuggerPDP11.REG_MMR3:
case DebuggerPDP11.REG_M3:
value = cpu.getMMR3();
break;
case DebuggerPDP11.REG_AR:
@ -1250,20 +1260,6 @@ 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)
*
@ -2563,29 +2559,29 @@ if (DEBUGGER) {
}
else {
switch(iReg) {
case DebuggerPDP11.REG_PSW:
case DebuggerPDP11.REG_PS:
sReg = "PS=" + this.toStrBase(cpu.getPSW());
break;
case DebuggerPDP11.REG_PIR:
sReg = "IR=" + this.toStrBase(cpu.regPIR);
case DebuggerPDP11.REG_PI:
sReg = "PI=" + this.toStrBase(cpu.getPIR());
break;
case DebuggerPDP11.REG_ERR:
case DebuggerPDP11.REG_ER:
sReg = "ER=" + this.toStrBase(cpu.regErr);
break;
case DebuggerPDP11.REG_SL:
sReg = "SL=" + this.toStrBase(cpu.regSL);
sReg = "SL=" + this.toStrBase(cpu.getSLR());
break;
case DebuggerPDP11.REG_MMR0:
sReg = "MMR0=" + this.toStrBase(cpu.getMMR0());
case DebuggerPDP11.REG_M0:
sReg = "M0=" + this.toStrBase(cpu.getMMR0());
break;
case DebuggerPDP11.REG_MMR1:
sReg = "MMR1=" + this.toStrBase(cpu.getMMR1());
case DebuggerPDP11.REG_M1:
sReg = "M1=" + this.toStrBase(cpu.getMMR1());
break;
case DebuggerPDP11.REG_MMR2:
sReg = "MMR2=" + this.toStrBase(cpu.getMMR2());
case DebuggerPDP11.REG_M2:
sReg = "M2=" + this.toStrBase(cpu.getMMR2());
break;
case DebuggerPDP11.REG_MMR3:
sReg = "MMR3=" + this.toStrBase(cpu.getMMR3());
case DebuggerPDP11.REG_M3:
sReg = "M3=" + this.toStrBase(cpu.getMMR3());
break;
case DebuggerPDP11.REG_AR:
if (this.panel) {
@ -2613,7 +2609,7 @@ if (DEBUGGER) {
*
* Sample register dump:
*
* MMR0=xxxxxx MMR1=xxxxxx MMR2=xxxxxx MMR3=xxxxxx ER=xxxxxx
* M0=xxxxxx M1=xxxxxx M2=xxxxxx M3=xxxxxx ER=xxxxxx
*
* @this {DebuggerPDP11}
* @return {string}
@ -2621,8 +2617,8 @@ if (DEBUGGER) {
DebuggerPDP11.prototype.getMiscDump = function()
{
var sDump = "";
sDump += this.getRegOutput(DebuggerPDP11.REG_MMR0) + this.getRegOutput(DebuggerPDP11.REG_MMR1);
sDump += this.getRegOutput(DebuggerPDP11.REG_MMR2) + this.getRegOutput(DebuggerPDP11.REG_MMR3) + this.getRegOutput(DebuggerPDP11.REG_ERR);
sDump += this.getRegOutput(DebuggerPDP11.REG_M0) + this.getRegOutput(DebuggerPDP11.REG_M1);
sDump += this.getRegOutput(DebuggerPDP11.REG_M2) + this.getRegOutput(DebuggerPDP11.REG_M3) + this.getRegOutput(DebuggerPDP11.REG_ER);
sDump += '\n';
sDump += this.getRegOutput(DebuggerPDP11.REG_SR) + this.getRegOutput(DebuggerPDP11.REG_AR) + this.getRegOutput(DebuggerPDP11.REG_DR);
return sDump;
@ -2634,7 +2630,7 @@ if (DEBUGGER) {
* Sample register dump:
*
* R0=xxxxxx R1=xxxxxx R2=xxxxxx R3=xxxxxx R4=xxxxxx R5=xxxxxx
* SP=xxxxxx PC=xxxxxx PS=xxxxxx IR=xxxxxx SL=xxxxxx T0 N0 Z0 V0 C0
* SP=xxxxxx PC=xxxxxx PS=xxxxxx PI=xxxxxx SL=xxxxxx T0 N0 Z0 V0 C0
*
* @this {DebuggerPDP11}
* @param {boolean} [fMisc] (true to include misc registers)
@ -2649,7 +2645,7 @@ if (DEBUGGER) {
}
sDump += '\n';
sDump += this.getRegOutput(PDP11.REG.SP) + this.getRegOutput(PDP11.REG.PC);
sDump += this.getRegOutput(DebuggerPDP11.REG_PSW) + this.getRegOutput(DebuggerPDP11.REG_PIR) + this.getRegOutput(DebuggerPDP11.REG_SL);
sDump += this.getRegOutput(DebuggerPDP11.REG_PS) + this.getRegOutput(DebuggerPDP11.REG_PI) + this.getRegOutput(DebuggerPDP11.REG_SL);
sDump += this.getFlagOutput('T') + this.getFlagOutput('N') + this.getFlagOutput('Z') + this.getFlagOutput('V') + this.getFlagOutput('C');
if (fMisc) sDump += '\n' + this.getMiscDump();
return sDump;
@ -2836,7 +2832,7 @@ if (DEBUGGER) {
/**
* findSymbolAddr(sSymbol)
*
* Search aSymbolTable for sSymbol, and if found, return a dbgAddr (same as parseAddr())
* Search our symbol tables for sSymbol, and if found, return a dbgAddr (same as parseAddr()).
*
* @this {DebuggerPDP11}
* @param {string} sSymbol
@ -2845,30 +2841,31 @@ if (DEBUGGER) {
DebuggerPDP11.prototype.findSymbolAddr = function(sSymbol)
{
var dbgAddr;
if (sSymbol.match(/^[a-z_][a-z0-9_]*$/i)) {
var offSymbol = this.bus.getAddrByName(sSymbol);
if (offSymbol == null && sSymbol.match(/^[a-z_][a-z0-9_]*$/i)) {
var sUpperCase = sSymbol.toUpperCase();
for (var iTable = 0; iTable < this.aSymbolTable.length; iTable++) {
var symbolTable = this.aSymbolTable[iTable];
var symbol = symbolTable.aSymbols[sUpperCase];
if (symbol !== undefined) {
var offSymbol = symbol['o'];
if (offSymbol !== undefined) {
/*
* We assume that every ROM is ORG'ed at 0x0000, and therefore unless the symbol has an
* explicitly-defined segment, we return the segment associated with the entire group; for
* a ROM, that segment is normally "addrROM >>> 4". Down the road, we may want/need to
* support a special symbol entry (eg, ".ORG") that defines an alternate origin.
*/
dbgAddr = this.newAddr(offSymbol);
}
if (symbol != null) {
offSymbol = symbol['o'];
/*
* The symbol matched, but it wasn't for an address (no 'o' offset), and there's no point
* looking any farther, since each symbol appears only once, so we indicate it's an unknown symbol.
* If the symbol matched but there's no 'o' offset (ie, it wasn't for an address), there's
* no point looking any farther, since each symbol appears only once.
*
* NOTE: We assume that every ROM is ORG'ed at 0x0000, and therefore unless the symbol has an
* explicitly-defined segment, we return the segment associated with the entire group; for a ROM,
* that segment is normally "addrROM >>> 4". Down the road, we may want/need to support a special
* symbol entry (eg, ".ORG") that defines an alternate origin.
*/
break;
}
}
}
if (offSymbol != null) {
dbgAddr = this.newAddr(offSymbol);
}
return dbgAddr;
};
@ -3191,9 +3188,15 @@ if (DEBUGGER) {
* & MMUMASK: 1,111,111,111,111,111,111,111 00017777777
* = PHYSICAL: 0,000,001,110,010,010,100,010 00000162242
*/
var a = this.cpu.getAddrInfo(dbgAddr.addr);
var a = this.cpu.getAddrInfo(dbgAddr.addr, dbgAddr.fPhysical || dbgAddr.addr > 0xffff);
this.println(str.pad("", 19) + str.toBin(dbgAddr.addr, 17, 3) + " " + str.toOct(dbgAddr.addr, 8));
if (a.length > 1) {
if (a.length < 6) {
if (a.length > 2) {
this.println("UNIMAP[" + str.toDec(a[1], 2) + "]: " + str.toBin(a[2], 22, 3) + " " + str.toOct(a[2], 8));
this.println(" OFFSET: " + str.toBin(a[3], 13, 3) + " " + str.toOct(a[3], 8));
}
this.println(" PHYSICAL: " + str.toBin(a[0], 22, 3) + " " + str.toOct(a[0], 8))
} else {
this.println(str.pad("", 24) + str.toBin(a[1], 13, 3) + " " + str.toOct(a[1], 8));
this.println("+ " + DebuggerPDP11.MODES[a[2]] + "PAR" + a[3] + ": " + str.toBin(a[4], 22, 3) + " " + str.toOct(a[4], 8));
this.println("& MMUMASK: " + str.toBin(a[5], 22, 3) + " " + str.toOct(a[5], 8));
@ -3218,6 +3221,9 @@ if (DEBUGGER) {
if (len > 0x10000) len = 0x10000;
}
var nBase = this.nBase;
if (dbgAddr.nBase) this.nBase = dbgAddr.nBase;
/*
* I've changed the code below to effectively make "dw" the default if only "d" is specified,
* since this is primarily a word-oriented machine.
@ -3273,7 +3279,9 @@ if (DEBUGGER) {
}
if (sDump) this.println(sDump);
this.dbgAddrNextData = dbgAddr;
this.nBase = nBase;
};
/**
@ -3702,7 +3710,7 @@ if (DEBUGGER) {
case "PS":
cpu.setPSW(w);
break;
case "IR":
case "PI":
cpu.setPIR(w);
break;
case "ER":
@ -3710,13 +3718,13 @@ if (DEBUGGER) {
fMisc = true;
break;
case "SL":
cpu.setSL(w);
cpu.setSLR(w);
break;
case "MMR0":
case "M0":
cpu.setMMR0(w);
fMisc = true;
break;
case "MMR3":
case "M3":
cpu.setMMR3(w);
fMisc = true;
break;
@ -3836,6 +3844,7 @@ if (DEBUGGER) {
if (opCode == PDP11.OPCODE.BPT || opCode == PDP11.OPCODE.IOT ||
(opCode & PDP11.OPCODE.EMT_MASK) == PDP11.OPCODE.EMT_OP ||
(opCode & PDP11.OPCODE.SOB_MASK) == PDP11.OPCODE.SOB_OP ||
(opCode & PDP11.OPCODE.TRAP_MASK) == PDP11.OPCODE.TRAP_OP) {
if (fCallStep) {
this.nStep = nStep;
@ -3889,10 +3898,10 @@ if (DEBUGGER) {
var s = this.getInstruction(dbgAddr);
if (s.indexOf("JSR") >= 0) {
/*
* Verify that the length of this CALL (or INT), when added to the address of the CALL (or INT),
* matches the original return address. We do this by getting the string index of the opcode bytes,
* subtracting that from the string index of the next space, and dividing that difference by two,
* to yield the length of the CALL (or INT) instruction, in bytes.
* Verify that the length of this call, when added to the address of the call, matches
* the original return address. We do this by getting the string index of the opcode bytes,
* subtracting that from the string index of the next space, and dividing that difference
* by two, to yield the length of the CALL (or INT) instruction, in bytes.
*/
var i = s.indexOf(' ');
var j = s.indexOf(' ', i+1);