Improved Debugger focus handling, added a new zeroMemory() Bus interface, and updated the RAM component's reset() function to re-zero RAM and then restore any predefined contents

This commit is contained in:
Jeff Parsons 2016-10-21 12:15:02 -07:00 committed by Jeff Parsons
commit 3db1439b40
11 changed files with 498 additions and 406 deletions

View file

@ -151,7 +151,7 @@ function BusPDP11(parmsBus, cpu, dbg)
*/
this.aIOHandlers = [];
this.fIOBreakAll = false;
this.nDisableTraps = 0;
this.nDisableFaults = 0;
/*
* Array of RESET notification handlers registered by Device components.
@ -558,7 +558,7 @@ BusPDP11.prototype.unknownAccess = function(addr, fByte, data)
this.dbg.printMessage("warning: unknown I/O access (" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(data, fByte?1:2) + ")", true, true);
if (this.dbg.stopInstruction()) return 0;
}
if (!this.nDisableTraps) {
if (!this.nDisableFaults) {
this.cpu.trap(PDP11.TRAP.BUS_ERROR, addr);
}
return 0;
@ -700,6 +700,25 @@ BusPDP11.prototype.cleanMemory = function(addr, size)
return fClean;
};
/**
* zeroMemory(addr, size)
*
* @this {BusPDP11}
* @param {number} addr
* @param {number} size
*/
BusPDP11.prototype.zeroMemory = function(addr, size)
{
var off = addr & this.nBlockLimit;
var iBlock = addr >>> this.nBlockShift;
while (size > 0 && iBlock < this.aMemBlocks.length) {
this.aMemBlocks[iBlock].zero(off, size);
size -= this.nBlockSize;
iBlock++;
off = 0;
}
};
/*
* Data types used by scanMemory()
*/
@ -906,9 +925,9 @@ BusPDP11.prototype.getByte = function(addr)
*/
BusPDP11.prototype.getByteDirect = function(addr)
{
this.nDisableTraps++;
this.nDisableFaults++;
var b = this.aMemBlocks[(addr & this.nBusMask) >>> this.nBlockShift].readByteDirect(addr & this.nBlockLimit, addr);
this.nDisableTraps--;
this.nDisableFaults--;
return b;
};
@ -943,13 +962,13 @@ BusPDP11.prototype.getWordDirect = function(addr)
var w;
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
this.nDisableTraps++;
this.nDisableFaults++;
if (!PDP11.WORDBUS && off == this.nBlockLimit) {
w = this.aMemBlocks[iBlock++].readByteDirect(off, addr) | (this.aMemBlocks[iBlock & this.nBlockMask].readByteDirect(0, addr + 1) << 8);
} else {
w = this.aMemBlocks[iBlock].readWordDirect(off, addr);
}
this.nDisableTraps--;
this.nDisableFaults--;
return w;
};
@ -977,9 +996,9 @@ BusPDP11.prototype.setByte = function(addr, b)
*/
BusPDP11.prototype.setByteDirect = function(addr, b)
{
this.nDisableTraps++;
this.nDisableFaults++;
this.aMemBlocks[(addr & this.nBusMask) >>> this.nBlockShift].writeByteDirect(addr & this.nBlockLimit, b & 0xff, addr);
this.nDisableTraps--;
this.nDisableFaults--;
};
/**
@ -1015,14 +1034,14 @@ BusPDP11.prototype.setWordDirect = function(addr, w)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
this.nDisableTraps++;
this.nDisableFaults++;
if (!PDP11.WORDBUS && off == this.nBlockLimit) {
this.aMemBlocks[iBlock++].writeByteDirect(off, w & 0xff, addr);
this.aMemBlocks[iBlock & this.nBlockMask].writeByteDirect(0, (w >> 8) & 0xff, addr + 1);
} else {
this.aMemBlocks[iBlock].writeWordDirect(off, w & 0xffff, addr);
}
this.nDisableTraps--;
this.nDisableFaults--;
};
/**
@ -1245,7 +1264,7 @@ BusPDP11.prototype.addResetHandler = function(fnReset)
*/
BusPDP11.prototype.fault = function(addr)
{
if (!this.nDisableTraps) {
if (!this.nDisableFaults) {
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.WARN)) {
this.dbg.printMessage("memory fault on address " + this.dbg.toStrBase(addr), true, true);
}