Fixed conditions required for RSTS/E boot code to work

This commit is contained in:
Jeff Parsons 2016-12-03 16:12:25 -08:00 committed by Jeff Parsons
commit 2b8ea8ddee
4 changed files with 37 additions and 17 deletions

View file

@ -496,7 +496,14 @@ CPUStatePDP11.prototype.setReset = function(addr, fStart)
this.setPSW(0);
if (fStart) {
this.autoStart();
/*
* TODO: Review. I'm zeroing R2-R5 in the fStart case (ie, for boot code) simply because that's what I
* saw the PDP-11 Boot Monitor doing (see /apps/pdp11/boot/monitor/BOOTMON.mac).
*/
for (var i = 2; i <= 5; i++) {
this.regsGen[i] = 0;
}
if (!this.isRunning()) this.startCPU();
}
else {
if (this.dbg) {
@ -515,6 +522,7 @@ CPUStatePDP11.prototype.setReset = function(addr, fStart)
this.stopCPU();
}
}
if (!this.isRunning() && this.panel) this.panel.stop();
};
/**

View file

@ -1437,7 +1437,7 @@ if (DEBUGGER) {
* is calling us in a loop, in which case it will perform its own updateDisplays() when it's done.
*/
if (fUpdateDisplays !== false) {
if (this.panel && this.panel.stop) this.panel.stop();
if (this.panel) this.panel.stop();
this.cmp.updateDisplays(-1);
}
@ -3924,7 +3924,7 @@ if (DEBUGGER) {
* displayLiveRegs enabled, so once the repeat count has been exhausted, we must perform
* a final updateDisplays().
*/
if (dbg.panel && dbg.panel.stop) dbg.panel.stop();
if (dbg.panel) dbg.panel.stop();
dbg.cmp.updateDisplays(-1);
dbg.setBusy(false);
}

View file

@ -133,7 +133,7 @@ RK11.prototype.setBinding = function(sType, sBinding, control, sValue)
control.onchange = function onChangeListDisks(event) {
var controlDesc = rk11.bindings["descDisk"];
var controlOption = control.options[control.selectedIndex];
var controlOption = control.options && control.options[control.selectedIndex];
if (controlDesc && controlOption) {
var dataValue = {};
var sValue = controlOption.getAttribute("data-value");
@ -172,7 +172,7 @@ RK11.prototype.setBinding = function(sType, sBinding, control, sValue)
control.onclick = function onClickLoadDrive(event) {
var controlDisks = rk11.bindings["listDisks"];
if (controlDisks) {
if (controlDisks && controlDisks.options) {
var sDiskName = controlDisks.options[controlDisks.selectedIndex].text;
var sDiskPath = controlDisks.value;
rk11.loadSelectedDrive(sDiskName, sDiskPath);
@ -561,15 +561,21 @@ RK11.prototype.bootSelectedDisk = function()
return;
}
if (!drive.disk) {
this.notice("No disk loaded in the selected drive");
this.notice("Load a disk into the drive first");
return;
}
var err = this.readData(drive, 0, 0, 0, drive.cbSector >> 1, 0);
/*
* NOTE: We're calling setReset() BEFORE reading the boot code in order to eliminate any side-effects
* of the previous state of either the controller OR the CPU; for example, we don't want any previous MMU
* or UNIBUS Map registers affecting the simulated readData() call. Also, some boot code (eg, RSTS/E)
* expects the controller to be in a READY state; since setReset() triggers a call to our reset() handler,
* a READY state is assured, and the readData() call shouldn't do anything to change that.
*/
this.cpu.setReset(0, true);
var err = this.readData(drive, 0, 0, 0, 512, 0);
if (err) {
this.notice("Unable to read the boot sector (" + err + ")");
return;
}
this.cpu.setReset(0, true);
};
/**

View file

@ -135,7 +135,7 @@ RL11.prototype.setBinding = function(sType, sBinding, control, sValue)
control.onchange = function onChangeListDisks(event) {
var controlDesc = rl11.bindings["descDisk"];
var controlOption = control.options[control.selectedIndex];
var controlOption = control.options && control.options[control.selectedIndex];
if (controlDesc && controlOption) {
var dataValue = {};
var sValue = controlOption.getAttribute("data-value");
@ -174,7 +174,7 @@ RL11.prototype.setBinding = function(sType, sBinding, control, sValue)
control.onclick = function onClickLoadDrive(event) {
var controlDisks = rl11.bindings["listDisks"];
if (controlDisks) {
if (controlDisks && controlDisks.options) {
var sDiskName = controlDisks.options[controlDisks.selectedIndex].text;
var sDiskPath = controlDisks.value;
rl11.loadSelectedDrive(sDiskName, sDiskPath);
@ -563,15 +563,21 @@ RL11.prototype.bootSelectedDisk = function()
return;
}
if (!drive.disk) {
this.notice("No disk loaded in the selected drive");
this.notice("Load a disk into the drive first");
return;
}
var err = this.readData(drive, 0, 0, 0, drive.cbSector >> 1, 0);
/*
* NOTE: We're calling setReset() BEFORE reading the boot code in order to eliminate any side-effects
* of the previous state of either the controller OR the CPU; for example, we don't want any previous MMU
* or UNIBUS Map registers affecting the simulated readData() call. Also, some boot code (eg, RSTS/E)
* expects the controller to be in a READY state; since setReset() triggers a call to our reset() handler,
* a READY state is assured, and the readData() call shouldn't do anything to change that.
*/
this.cpu.setReset(0, true);
var err = this.readData(drive, 0, 0, 0, 512, 0);
if (err) {
this.notice("Unable to read the boot sector (" + err + ")");
return;
}
this.cpu.setReset(0, true);
};
/**
@ -862,7 +868,7 @@ RL11.prototype.initController = function(data)
{
var i = 0;
if (!data) data = [];
this.regRLCS = data[i++] || 0;
this.regRLCS = data[i++] || (PDP11.RL11.RLCS.DRDY | PDP11.RL11.RLCS.CRDY);
this.regRLBA = data[i++] || 0;
this.regRLDA = data[i++] || 0;
this.tmpRLDA = data[i++] || 0;
@ -958,7 +964,7 @@ RL11.prototype.processCommand = function()
*
* 1) Normally both set
* 2) CRDY is cleared to process a command
* 3) DRDY is cleared to command is in process
* 3) DRDY is cleared to indicate a command in process
*/
this.regRLCS &= ~PDP11.RL11.RLCS.DRDY;