Save/restore of PDP-11 diagnostic works even when the MMU is enabled

This commit is contained in:
Jeff Parsons 2017-01-26 15:09:08 -08:00 committed by Jeff Parsons
commit 367d466fe1
5 changed files with 537 additions and 552 deletions

View file

@ -649,14 +649,8 @@ class CPUStatePDP11 extends CPUPDP11 {
this.regMBR,
this.regPIR,
this.regSLR,
this.regMMR0,
this.regMMR1,
this.regMMR2,
this.regMMR3,
this.mmuEnable,
this.mmuLastMode,
this.mmuLastPage,
this.mmuMask,
this.addrLast,
this.opFlags,
this.opLast,
@ -664,7 +658,7 @@ class CPUStatePDP11 extends CPUPDP11 {
this.trapReason,
this.trapVector
]);
state.set(1, [this.getPSW()]);
state.set(1, [this.getPSW(),this.getMMR0(),this.getMMR1(),this.getMMR2(),this.getMMR3()]);
state.set(2, [this.nTotalCycles, this.getSpeed(), this.flags.autoStart]);
state.set(3, this.saveIRQs());
state.set(4, this.saveTimers());
@ -696,14 +690,8 @@ class CPUStatePDP11 extends CPUPDP11 {
this.regMBR,
this.regPIR,
this.regSLR,
this.regMMR0,
this.regMMR1,
this.regMMR2,
this.regMMR3,
this.mmuEnable,
this.mmuLastMode,
this.mmuLastPage,
this.mmuMask,
this.addrLast,
this.opFlags,
this.opLast,
@ -714,6 +702,10 @@ class CPUStatePDP11 extends CPUPDP11 {
var a = data[1];
this.setPSW(a[0]);
this.setMMR0(a[1]);
this.regMMR1 = a[2];
this.regMMR2 = a[3];
this.setMMR3(a[4]);
a = data[2];
this.nTotalCycles = a[0];
@ -2876,6 +2868,7 @@ class CPUStatePDP11 extends CPUPDP11 {
fnFlags.call(this, data << 8);
} else {
var addr = this.getAddr(mode, reg, PDP11.ACCESS.WRITE_BYTE);
//noinspection JSUnresolvedFunction
fnFlags.call(this, (data = data < 0? (this.regsGen[-data-1] & 0xff) : data) << 8);
this.setByte(addr, data);
if (addr & 1) this.nStepCycles--;

View file

@ -1658,6 +1658,7 @@ class DebuggerPDP11 extends Debugger {
* requires reading memory that triggers more memory reads, which triggers more breakpoint checks.
*/
this.nSuppressBreaks = 0;
this.nBreakInstructions = 0;
}
/**
@ -2702,25 +2703,16 @@ class DebuggerPDP11 extends Debugger {
*
* As the "help" output below indicates, the following breakpoint commands are supported:
*
* bp [a] set exec breakpoint on linear addr [a]
* br [a] set read breakpoint on linear addr [a]
* bw [a] set write breakpoint on linear addr [a]
* bc [a] clear breakpoint on linear addr [a] (use "*" for all breakpoints)
* bl list breakpoints
* bp # set exec breakpoint
* br # set read breakpoint
* bw # set write breakpoint
* bc # clear breakpoint (* to clear all)
* bl list all breakpoints
* bn [#] break after # instruction(s)
*
* to which we have recently added the following I/O breakpoint commands:
*
* bi [p] toggle input breakpoint on port [p] (use "*" for all input ports)
* bo [p] toggle output breakpoint on port [p] (use "*" for all output ports)
*
* These two new commands operate as toggles so that if "*" is used to trap all input (or output),
* you can also use these commands to NOT trap specific ports.
*
* bn [n] break after [n] instructions
*
* TODO: Update the "bl" command to include any/all I/O breakpoints, and the "bc" command to
* clear them. Because "bi" and "bo" commands are piggy-backing on Bus functions, those breakpoints
* are currently outside the realm of what the "bl" and "bc" commands are aware of.
* The "bn" command, like the "dh" command and all other commands that use an instruction count,
* assumes a decimal value, regardless of the current base. Use "bn" without an argument to display
* the break count, and use "bn 0" to clear the break count.
*
* @this {DebuggerPDP11}
* @param {string} sCmd
@ -2731,10 +2723,10 @@ class DebuggerPDP11 extends Debugger {
{
if (sAddr == '?') {
this.println("breakpoint commands:");
this.println("\tbp [#]\tset exec breakpoint at addr #");
this.println("\tbr [#]\tset read breakpoint at addr #");
this.println("\tbw [#]\tset write breakpoint at addr #");
this.println("\tbc [#]\tclear breakpoint at addr #");
this.println("\tbp #\tset exec breakpoint");
this.println("\tbr #\tset read breakpoint");
this.println("\tbw #\tset write breakpoint");
this.println("\tbc #\tclear breakpoint (* to clear all)");
this.println("\tbl\tlist all breakpoints");
this.println("\tbn [#]\tbreak after # instruction(s)");
return;
@ -2751,10 +2743,9 @@ class DebuggerPDP11 extends Debugger {
}
if (sParm == 'n') {
this.nBreakInstructions = this.parseValue(sAddr);
if (this.nBreakInstructions != null) {
this.println("break after " + this.nBreakInstructions + " instruction(s)");
}
var n = +sAddr || 0;
if (sAddr) this.nBreakInstructions = n;
this.println("break after " + n + " instruction(s)");
return;
}

View file

@ -234,21 +234,22 @@ class PanelPDP11 extends Component {
}
/**
* reset()
* reset(fPowerUp)
*
* NOTE: Since we've registered our handler with the Bus component, we will be called twice whenever
* the entire machine is reset: once when the Computer's reset() handler calls the Bus's reset() handler,
* and again when the Computer's reset() handler calls us directly. Multiple resets should be harmless.
*
* @this {PanelPDP11}
* @param {boolean} [fPowerUp]
*/
reset()
reset(fPowerUp)
{
/*
* Simulate a call to our stop() handler, to update the panel's ADDRESS register with the current PC.
*/
this.stop();
this.setDR(0);
if (fPowerUp) this.setDR(0);
}
/**
@ -400,7 +401,7 @@ class PanelPDP11 extends Component {
if (this.fBindings) PanelPDP11.init();
if (!data) {
this.reset();
this.reset(true);
} else {
if (!this.restore(data)) return false;
}