Start on support for component scripts

This commit is contained in:
Jeff Parsons 2017-01-24 15:37:46 -08:00 committed by Jeff Parsons
commit aa4cdca89e
2 changed files with 17 additions and 10 deletions

View file

@ -12,6 +12,12 @@ machines:
RL0: RL0:
path: http://archive.pcjs.org/disks/dec/rl02k/RL02K-XXDP.json path: http://archive.pcjs.org/disks/dec/rl02k/RL02K-XXDP.json
sticky: top sticky: top
commands:
bootXXDP: |
select rl11 listDrives RL0
select rl11 listDisks "XXDP+ Diagnostics"
load rl11
boot rl11
--- ---
This machine is ready to boot [XXDP+ Diagnostics](/disks/dec/rl02k/xxdp/) ("BOOT RL0") and run This machine is ready to boot [XXDP+ Diagnostics](/disks/dec/rl02k/xxdp/) ("BOOT RL0") and run
@ -27,9 +33,10 @@ Step-by-step instructions are included below. Other interesting things to know
{% include machine.html id="test1170" %} {% include machine.html id="test1170" %}
Step 1: We need to select a drive to load the XXDP+ Diagnostics disk, and since it is an RL02K disk, Step 1: We need to select a drive to load the [RL02K XXDP+ Diagnostics Disk](/disks/dec/rl02k/xxdp/), and since it is
we need to use an RL02 drive. A typical PDP-11 machine with a single RL11 disk controller could contain an RL02K disk, we need to use an RL02 drive. A typical PDP-11 machine with a single [RL11 Disk Controller](/devices/pdp11/rl11/)
up to four such drives, which we refer to as RL0 through RL3. could contain up to four such drives, which we refer to as RL0 through RL3.
To select drive RL0, press {% include machine-command.html type='button' label='Select RL0' machine='test1170' component='RL11' command='selectDrive' value='RL0' %} To select drive RL0, press {% include machine-command.html type='button' label='Select RL0' machine='test1170' component='RL11' command='selectDrive' value='RL0' %}
To boot the [RL02K XXDP+ Diagnostics Disk](/disks/dec/rl02k/xxdp/) in one step, press {% include machine-command.html type='button' label='Boot XXDP+' machine='test1170' component='RL11' command='bootXXDP' %}

View file

@ -88,7 +88,7 @@ function addStickyMachine(idMachine, sPosition)
} }
/** /**
* commandMachine(idMachine, sType, sCommand, sValue) * commandMachine(idMachine, sComponent, sCommand, sValue)
* *
* Note that this script is not compiled into any of the machines, since "sticky machines" are feature of the PCjs * Note that this script is not compiled into any of the machines, since "sticky machines" are feature of the PCjs
* website rather than of the machines. And since the machines are compiled, all their code and data is completely * website rather than of the machines. And since the machines are compiled, all their code and data is completely
@ -98,19 +98,19 @@ function addStickyMachine(idMachine, sPosition)
* *
* findMachineComponent() * findMachineComponent()
* *
* which uses existing Component methods to find the requested component type for a specific machine, and if a * which uses existing Component methods to find the requested component for a specific machine, and if the
* component is found, then its 'exports' table is checked for an entry matching the specified command string, and if * component is found, then its 'exports' table is checked for an entry matching the specified command string, and if
* an entry is found, then the corresponding function is called with the specified data. * an entry is found, then the corresponding function is called with the specified data.
* *
* @param {string} idMachine * @param {string} idMachine
* @param {string} sType * @param {string} sComponent
* @param {string} sCommand * @param {string} sCommand
* @param {string} [sValue] * @param {string} [sValue]
*/ */
function commandMachine(idMachine, sType, sCommand, sValue) function commandMachine(idMachine, sComponent, sCommand, sValue)
{ {
if (window.findMachineComponent) { if (window.findMachineComponent) {
var component = window.findMachineComponent(idMachine, sType); var component = window.findMachineComponent(idMachine, sComponent);
if (component) { if (component) {
var exports = component['exports']; var exports = component['exports'];
if (exports) { if (exports) {
@ -118,14 +118,14 @@ function commandMachine(idMachine, sType, sCommand, sValue)
if (fnCommand) { if (fnCommand) {
//noinspection JSUnresolvedFunction //noinspection JSUnresolvedFunction
if (!fnCommand.call(component, sValue)) { if (!fnCommand.call(component, sValue)) {
window.alert("Error calling " + idMachine + "." + sType + "." + sCommand + "(" + sValue + ")"); window.alert("Error calling " + idMachine + "." + sComponent + "." + sCommand + "(" + sValue + ")");
} }
return; return;
} }
} }
} }
} }
console.log("unimplemented: commandMachine('" + idMachine + "','" + typeComponent + "','" + sCommand + "','" + sValue + "')"); console.log("unimplemented: commandMachine('" + idMachine + "','" + sComponent + "','" + sCommand + "','" + sValue + "')");
} }
/** /**