Added command to select RL11 drive

This commit is contained in:
Jeff Parsons 2017-01-08 23:16:38 -08:00 committed by Jeff Parsons
commit edf22928b9
3 changed files with 62 additions and 15 deletions

View file

@ -11,6 +11,7 @@ machines:
autoMount:
RL0:
path: http://archive.pcjs.org/disks/dec/rl02k/RL02K-XXDP.json
sticky: top
---
This machine is ready to boot [XXDP+ Diagnostics](/disks/dec/rl02k/xxdp/) ("BOOT RL0") and run
@ -20,10 +21,14 @@ diagnostics (e.g., "R EKBEE1"):
- [EKBBF0: 11/70 CPU DIAGNOSTIC (PART 2)](/disks/dec/rl02k/xxdp/ekbbf0/)
- [EKBEE1: 11/70 MEMORY MANAGEMENT DIAGNOSTIC](/disks/dec/rl02k/xxdp/ekbee1/)
For more information about booting and running these diagnostics, see [XXDP+ Diagnostics](/disks/dec/rl02k/xxdp/).
Step-by-step instructions are included below. Other interesting things to know about this machine:
* It includes an [M9312 ROM](/devices/pdp11/rom/M9312/) at address 165000. The exact ROM is [23-616F1](/devices/pdp11/rom/M9312/23-616F1.txt).
{% include machine.html id="test1170" %}
Other interesting things to know about this machine:
Step 1: We need to select a drive to load the XXDP+ Diagnostics disk, and since it is an RL02K disk,
we need to use an RL02 drive. A typical PDP-11 machine with a single RL11 disk controller could contain
up to four such drives, which we refer to as RL0 through RL3.
* It includes an [M9312 ROM](/devices/pdp11/rom/M9312/) at address 165000. The exact ROM is [23-616F1](/devices/pdp11/rom/M9312/23-616F1.txt).
To select drive RL0, press {% include machine-command.html type='button' label='Select RL0' machine='test1170' component='RL11' command='selectDrive' value='RL0' %}

View file

@ -83,6 +83,10 @@ class RL11 extends Component {
* Define all the properties to be initialized by initController()
*/
this.regRLCS = this.regRLBA = this.regRLDA = this.tmpRLDA = this.regRLMP = this.regRLBE = 0;
this['exports'] = {
'selectDrive': this.selectDrive
};
}
/**
@ -756,15 +760,20 @@ class RL11 extends Component {
/**
* displayDisk(iDrive, fUpdateDrive)
*
* This ensures that the selected disk matches the drive's sDiskPath property, and if fUpdateDrive is set,
* it also ensures that the selected drive matches the specified drive number.
*
* @this {RL11}
* @param {number} iDrive (unvalidated)
* @param {number} iDrive
* @param {boolean} [fUpdateDrive] is true to update the drive list to match the specified drive (eg, the auto-mount case)
* @return {boolean} true if successful, false if not
*/
displayDisk(iDrive, fUpdateDrive)
{
/*
* First things first: validate iDrive.
*/
var fSuccess = false;
if (iDrive >= 0 && iDrive < this.aDrives.length) {
var drive = this.aDrives[iDrive];
var controlDisks = this.bindings["listDisks"];
@ -774,9 +783,24 @@ class RL11 extends Component {
*/
if (controlDisks && controlDrives && controlDisks.options && controlDrives.options) {
/*
* Next, make sure the drive whose disk we're updating is the currently selected drive.
* Next, update the drive if the caller has requested it.
*/
var i;
if (fUpdateDrive) {
this.assert(iDrive == drive.iDrive);
for (i = 0; i < controlDrives.options.length; i++) {
if (Str.parseInt(controlDrives.options[i].value, 10) == drive.iDrive) {
if (controlDrives.selectedIndex != i) {
controlDrives.selectedIndex = i;
}
fSuccess = true;
break;
}
}
}
/*
* Next, make sure the drive whose disk we're updating is the currently selected drive.
*/
var iDriveSelected = Str.parseInt(controlDrives.value, 10);
var sTargetPath = (drive.fLocal? RL11.SOURCE.LOCAL : drive.sDiskPath);
if (!isNaN(iDriveSelected) && iDriveSelected == iDrive) {
@ -785,23 +809,39 @@ class RL11 extends Component {
if (controlDisks.selectedIndex != i) {
controlDisks.selectedIndex = i;
}
fSuccess = true;
break;
}
}
if (i == controlDisks.options.length) controlDisks.selectedIndex = 0;
}
if (fUpdateDrive) {
for (i = 0; i < controlDrives.options.length; i++) {
if (Str.parseInt(controlDrives.options[i].value, 10) == drive.iDrive) {
if (controlDrives.selectedIndex != i) {
controlDrives.selectedIndex = i;
}
break;
}
}
}
}
return fSuccess;
}
/**
* selectDrive(sDrive)
*
* Used to programmatically select a drive by name.
*
* @this {RL11}
* @param {number} sDrive
* @return {boolean} true if successful, false if not
*/
selectDrive(sDrive)
{
var controlDrives = this.bindings["listDrives"];
if (controlDrives && controlDrives.options) {
var nDrives = controlDrives.options.length;
for (var i = 0; i < nDrives; i++) {
if (controlDrives.options[i].innerHTML == sDrive) {
var iDrive = Str.parseInt(controlDrives.options[i].value, 10);
return this.displayDisk(iDrive, true);
}
}
}
return false;
}
/**

View file

@ -117,7 +117,9 @@ function commandMachine(idMachine, sType, sCommand, sValue)
var fnCommand = exports[sCommand];
if (fnCommand) {
//noinspection JSUnresolvedFunction
fnCommand.call(component, sValue);
if (!fnCommand.call(component, sValue)) {
window.alert("Error calling " + idMachine + "." + sType + "." + sCommand + "(" + sValue + ")");
}
return;
}
}