Improved debugger messages for bus and memory accesses
This commit is contained in:
parent
8a78eb7d6b
commit
7923529aee
7 changed files with 457 additions and 391 deletions
|
|
@ -9,5 +9,5 @@
|
|||
<ram id="ram" addr="0x10000" size="0x34000"/>
|
||||
<device id="unibus" name="unibus"/>
|
||||
<panel ref="/devices/pdp11/panel/1170/wide.xml"/>
|
||||
<debugger id="debugger" base="8" messages="bus|trap" commands="bp 140270"/>
|
||||
<debugger id="debugger" base="8" messages="bus|mem|trap" commands="bp 140270"/>
|
||||
</machine>
|
||||
|
|
|
|||
|
|
@ -3,15 +3,22 @@
|
|||
; REBASE HIGHER LINK/BOT:140000
|
||||
; WANT PERFORMANCE COUNTER - CLOCK TICKS TO DO SOMETHING?
|
||||
|
||||
PSW = 177776
|
||||
DL11_XCSR = 177564
|
||||
DL11_VEC = 64
|
||||
|
||||
KW11_LKS = 177546
|
||||
KW11_VEC = 100
|
||||
|
||||
START: RESET ; 140000
|
||||
CLR @#177776
|
||||
CLR @#PSW
|
||||
MOV #START,SP
|
||||
CLR @#177564
|
||||
CLR @#DL11_XCSR ; CLEAR THE XCSR
|
||||
MOV #BANNER,R0
|
||||
JSR PC,PRINT
|
||||
MOV #CLKAST,@#100
|
||||
MOV #340,@#102
|
||||
BIS #100,@#177546 ; SET CLOCK TICKING
|
||||
MOV #CLKAST,@#KW11_VEC
|
||||
MOV #340,@#KW11_VEC+2
|
||||
BIS #100,@#KW11_LKS ; SET CLOCK TICKING
|
||||
|
||||
MOV #PROMPT,R0
|
||||
JSR PC,PRINT
|
||||
|
|
@ -35,20 +42,20 @@ CLKAST: ; 140124
|
|||
RTT
|
||||
|
||||
ONECHR:
|
||||
TSTB @#177564 ; 140132
|
||||
TSTB @#DL11_XCSR ; 140132
|
||||
BPL ONECHR
|
||||
MOVB R0,@#177566
|
||||
RTS PC
|
||||
|
||||
PRTPTR: .WORD 0
|
||||
PRTPTR: .WORD 0 ; 140146
|
||||
|
||||
PRINT: ; 140150
|
||||
BITB #100,@#177564
|
||||
BITB #100,@#DL11_XCSR
|
||||
BNE PRINT
|
||||
MOV R0,PRTPTR
|
||||
MOV #PRTAST,@#64
|
||||
MOV #200,@#66
|
||||
BISB #100,@#177564
|
||||
MOV #PRTAST,@#DL11_VEC
|
||||
MOV #200,@#DL11_VEC+2
|
||||
BISB #100,@#DL11_XCSR
|
||||
RTS PC
|
||||
|
||||
PRTAST: ; 140210
|
||||
|
|
|
|||
|
|
@ -187,30 +187,38 @@ BusPDP11.IOController = {
|
|||
*/
|
||||
readByte: function(off, addr)
|
||||
{
|
||||
var b = -1;
|
||||
var bus = this.controller;
|
||||
var afn = bus.aIOHandlers[off];
|
||||
if (afn) {
|
||||
if (bus.messageEnabled()) bus.printMessage(afn[5] + ".readByte(" + str.toOct(addr) + ")", 0, true);
|
||||
if (afn[0]) {
|
||||
return afn[0](addr);
|
||||
b = afn[0](addr);
|
||||
} else if (afn[2]) {
|
||||
if (!(addr & 0x1)) {
|
||||
return afn[2](addr) & 0xff;
|
||||
b = afn[2](addr) & 0xff;
|
||||
} else {
|
||||
return afn[2](addr & ~0x1) >> 8;
|
||||
b = afn[2](addr & ~0x1) >> 8;
|
||||
}
|
||||
}
|
||||
} else if (addr & 0x1) {
|
||||
afn = bus.aIOHandlers[off & ~0x1];
|
||||
if (afn) {
|
||||
if (bus.messageEnabled()) bus.printMessage(afn[5] + ".readByte(" + str.toOct(addr) + ")", 0, true);
|
||||
if (afn[2]) {
|
||||
return afn[2](addr & ~0x1) >> 8;
|
||||
b = afn[2](addr & ~0x1) >> 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
bus.println("warning: unconverted read access to byte @" + str.toOct(addr));
|
||||
return bus.fnAccess(addr, -1, 1);
|
||||
if (b >= 0) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message(afn[5] + ".readByte(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(b), true);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
b = bus.fnAccess(addr, -1, 1);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message("warning: unconverted read access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b));
|
||||
}
|
||||
return b;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -224,29 +232,30 @@ BusPDP11.IOController = {
|
|||
writeByte: function(off, b, addr)
|
||||
{
|
||||
var w;
|
||||
var fWrite = false;
|
||||
var bus = this.controller;
|
||||
var afn = bus.aIOHandlers[off];
|
||||
if (afn) {
|
||||
if (bus.messageEnabled()) bus.printMessage(afn[5] + ".writeByte(" + str.toOct(addr) + "," + str.toOct(b) + ")", 0, true);
|
||||
/*
|
||||
* If a writeByte() handler exists, call it; we're done
|
||||
*/
|
||||
if (afn[1]) {
|
||||
afn[1](b, addr);
|
||||
return;
|
||||
fWrite = true;
|
||||
}
|
||||
/*
|
||||
* If a writeWord() handler exists, call the readWord() handler first to get the original data,
|
||||
* then call writeWord() with the new data pre-inserted into the original data.
|
||||
*/
|
||||
if (afn[3]) {
|
||||
else if (afn[3]) {
|
||||
w = afn[2]? afn[2](addr) : 0;
|
||||
if (!(addr & 0x1)) {
|
||||
afn[3]((w & ~0xff) | b, addr)
|
||||
afn[3]((w & ~0xff) | b, addr);
|
||||
fWrite = true;
|
||||
} else {
|
||||
afn[3]((w & 0xff) | (b << 8), addr & ~0x1);
|
||||
fWrite = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else if (addr & 0x1) {
|
||||
/*
|
||||
|
|
@ -256,17 +265,24 @@ BusPDP11.IOController = {
|
|||
*/
|
||||
afn = bus.aIOHandlers[off & ~0x1];
|
||||
if (afn) {
|
||||
if (bus.messageEnabled()) bus.printMessage(afn[5] + ".writeByte(" + str.toOct(addr) + "," + str.toOct(b) + ")", 0, true);
|
||||
if (afn[3]) {
|
||||
addr &= ~0x1;
|
||||
w = afn[2]? afn[2](addr) : 0;
|
||||
afn[3]((w & 0xff) | (b << 8), addr);
|
||||
fWrite = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fWrite) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message(afn[5] + ".writeByte(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(b) + ")", true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
bus.println("warning: unconverted write access to byte @" + str.toOct(addr));
|
||||
bus.fnAccess(addr, b, 1);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message("warning: unconverted write access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -279,19 +295,28 @@ BusPDP11.IOController = {
|
|||
*/
|
||||
readWord: function(off, addr)
|
||||
{
|
||||
var w = -1;
|
||||
var bus = this.controller;
|
||||
Component.assert(!(addr & 1)); // unaligned addresses should be getting trapped at a higher level
|
||||
var afn = bus.aIOHandlers[off];
|
||||
if (afn) {
|
||||
if (bus.messageEnabled()) bus.printMessage(afn[5] + ".readWord(" + str.toOct(addr) + ")", 0, true);
|
||||
if (afn[2]) {
|
||||
return afn[2](addr);
|
||||
w = afn[2](addr);
|
||||
} else if (afn[0]) {
|
||||
return afn[0](addr) | (afn[0](addr + 1) << 8);
|
||||
w = afn[0](addr) | (afn[0](addr + 1) << 8);
|
||||
}
|
||||
}
|
||||
bus.println("warning: unconverted read access to word @" + str.toOct(addr));
|
||||
return bus.fnAccess(addr, -1, 0);
|
||||
if (w >= 0) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message(afn[5] + ".readWord(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(w), true);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
w = bus.fnAccess(addr, -1, 0);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message("warning: unconverted read access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w));
|
||||
}
|
||||
return w;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -304,22 +329,30 @@ BusPDP11.IOController = {
|
|||
*/
|
||||
writeWord: function(off, w, addr)
|
||||
{
|
||||
var fWrite = false;
|
||||
var bus = this.controller;
|
||||
Component.assert(!(addr & 1)); // unaligned addresses should be getting trapped at a higher level
|
||||
var afn = bus.aIOHandlers[off];
|
||||
if (afn) {
|
||||
if (bus.messageEnabled()) bus.printMessage(afn[5] + ".writeWord(" + str.toOct(addr) + "," + str.toOct(w) + ")", 0, true);
|
||||
if (afn[3]) {
|
||||
afn[3](w, addr);
|
||||
return;
|
||||
fWrite = true;
|
||||
} else if (afn[1]) {
|
||||
afn[1](w & 0xff, addr);
|
||||
afn[1](w >> 8, addr + 1);
|
||||
fWrite = true;
|
||||
}
|
||||
}
|
||||
if (fWrite) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message(afn[5] + ".writeWord(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(w) + ")", true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
bus.println("warning: unconverted write access to word @" + str.toOct(addr));
|
||||
bus.fnAccess(addr, w, 0);
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
|
||||
this.dbg.message("warning: unconverted write access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -588,7 +588,9 @@ if (DEBUGGER) {
|
|||
var b = 0xff;
|
||||
var addr = this.getAddr(dbgAddr, false, 1);
|
||||
if (addr !== PDP11.ADDR_INVALID) {
|
||||
this.nDisableMessages++;
|
||||
b = this.bus.getByteDirect(addr);
|
||||
this.nDisableMessages--;
|
||||
if (inc) this.incAddr(dbgAddr, inc);
|
||||
}
|
||||
return b;
|
||||
|
|
@ -607,7 +609,9 @@ if (DEBUGGER) {
|
|||
var w = 0xffff;
|
||||
var addr = this.getAddr(dbgAddr, false, 2);
|
||||
if (addr !== PDP11.ADDR_INVALID) {
|
||||
this.nDisableMessages++;
|
||||
w = this.bus.getWordDirect(addr);
|
||||
this.nDisableMessages--;
|
||||
if (inc) this.incAddr(dbgAddr, inc);
|
||||
}
|
||||
return w;
|
||||
|
|
@ -625,7 +629,9 @@ if (DEBUGGER) {
|
|||
{
|
||||
var addr = this.getAddr(dbgAddr, true, 1);
|
||||
if (addr !== PDP11.ADDR_INVALID) {
|
||||
this.nDisableMessages++;
|
||||
this.bus.setByteDirect(addr, b);
|
||||
this.nDisableMessages--;
|
||||
if (inc) this.incAddr(dbgAddr, inc);
|
||||
this.cpu.updateCPU(true); // we set fForce to true in case video memory was the target
|
||||
}
|
||||
|
|
@ -643,7 +649,9 @@ if (DEBUGGER) {
|
|||
{
|
||||
var addr = this.getAddr(dbgAddr, true, 2);
|
||||
if (addr !== PDP11.ADDR_INVALID) {
|
||||
this.nDisableMessages++;
|
||||
this.bus.setWordDirect(addr, w);
|
||||
this.nDisableMessages--;
|
||||
if (inc) this.incAddr(dbgAddr, inc);
|
||||
this.cpu.updateCPU(true); // we set fForce to true in case video memory was the target
|
||||
}
|
||||
|
|
@ -1007,6 +1015,7 @@ if (DEBUGGER) {
|
|||
this.bitsMessage = this.bitsWarning = MessagesPDP11.WARN;
|
||||
this.sMessagePrev = null;
|
||||
this.aMessageBuffer = [];
|
||||
this.nDisableMessages = 0;
|
||||
/*
|
||||
* Internally, we use "key" instead of "keys", since the latter is a method on JavasScript objects,
|
||||
* but externally, we allow the user to specify "keys"; "kbd" is also allowed as shorthand for "keyboard".
|
||||
|
|
@ -1135,6 +1144,8 @@ if (DEBUGGER) {
|
|||
*/
|
||||
DebuggerPDP11.prototype.message = function(sMessage, fAddress)
|
||||
{
|
||||
if (this.nDisableMessages) return;
|
||||
|
||||
if (fAddress) {
|
||||
sMessage += " at " + this.toStrAddr(this.newAddr(this.cpu.getPC()));
|
||||
}
|
||||
|
|
@ -1582,7 +1593,9 @@ if (DEBUGGER) {
|
|||
*/
|
||||
if (nState >= 0 && this.aaOpcodeCounts.length) {
|
||||
this.cOpcodes++;
|
||||
this.nDisableMessages++;
|
||||
var opCode = this.bus.getWordDirect(addr);
|
||||
this.nDisableMessages--;
|
||||
if (opCode != null) {
|
||||
var dbgAddr = this.aOpcodeHistory[this.iOpcodeHistory];
|
||||
this.setAddr(dbgAddr, cpu.getPC());
|
||||
|
|
|
|||
|
|
@ -556,7 +556,7 @@ MemoryPDP11.prototype = {
|
|||
* @return {number}
|
||||
*/
|
||||
readNone: function readNone(off, addr) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.CPU | MessagesPDP11.MEM) /* && !off */) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM) /* && !off */) {
|
||||
this.dbg.message("attempt to read invalid block %" + str.toHex(this.addr), true);
|
||||
}
|
||||
return 0xff;
|
||||
|
|
@ -570,7 +570,7 @@ MemoryPDP11.prototype = {
|
|||
* @param {number} addr
|
||||
*/
|
||||
writeNone: function writeNone(off, v, addr) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.CPU | MessagesPDP11.MEM) /* && !off */) {
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM) /* && !off */) {
|
||||
this.dbg.message("attempt to write " + str.toHexWord(v) + " to invalid block %" + str.toHex(this.addr), true);
|
||||
}
|
||||
},
|
||||
|
|
@ -753,7 +753,11 @@ MemoryPDP11.prototype = {
|
|||
* @return {number}
|
||||
*/
|
||||
readByteLE: function readByteLE(off, addr) {
|
||||
return this.ab[off];
|
||||
var b = this.ab[off];
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM)) {
|
||||
this.dbg.message("Memory.readByteLE(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(b), true);
|
||||
}
|
||||
return b;
|
||||
},
|
||||
/**
|
||||
* readWordBE(off, addr)
|
||||
|
|
@ -779,7 +783,11 @@ MemoryPDP11.prototype = {
|
|||
* TODO: It remains to be seen if there's any advantage to checking the offset for an aligned read
|
||||
* vs. always reading the bytes separately.
|
||||
*/
|
||||
return (off & 0x1)? (this.ab[off] | (this.ab[off+1] << 8)) : this.aw[off >> 1];
|
||||
var w = (off & 0x1)? (this.ab[off] | (this.ab[off+1] << 8)) : this.aw[off >> 1];
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM)) {
|
||||
this.dbg.message("Memory.readWordLE(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(w), true);
|
||||
}
|
||||
return w;
|
||||
},
|
||||
/**
|
||||
* writeByteBE(off, b, addr)
|
||||
|
|
@ -804,6 +812,9 @@ MemoryPDP11.prototype = {
|
|||
writeByteLE: function writeByteLE(off, b, addr) {
|
||||
this.ab[off] = b;
|
||||
this.fDirty = true;
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM)) {
|
||||
this.dbg.message("Memory.writeByteLE(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(b) + ")", true);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* writeWordBE(off, w, addr)
|
||||
|
|
@ -837,6 +848,9 @@ MemoryPDP11.prototype = {
|
|||
this.aw[off >> 1] = w;
|
||||
}
|
||||
this.fDirty = true;
|
||||
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.MEM)) {
|
||||
this.dbg.message("Memory.writeWordLE(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(w) + ")", true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue