Factored PDP-11 drive controller logic into a device-independent superclass (drive.js) and a device-dependent subclass (rk11.js); the RL11 controller is ready to be factored next

This commit is contained in:
Jeff Parsons 2017-01-28 13:39:19 -08:00 committed by Jeff Parsons
commit 5edbdcdce2
33 changed files with 1754 additions and 1615 deletions

View file

@ -54,7 +54,7 @@ if (NODE) {
* count: BitField,
* btmod: BitField,
* type: BitField
* }} BlockInfoPDP11
* }}
*/
var BlockInfoPDP11 = Usr.defineBitFields({num:20, count:8, btmod:1, type:3});
@ -69,7 +69,7 @@ var BlockInfoPDP11 = Usr.defineBitFields({num:20, count:8, btmod:1, type:3});
* cbTotal: number,
* cBlocks: number,
* aBlocks: Array.<BlockInfoPDP11>
* }} BusInfoPDP11
* }}
*/
var BusInfoPDP11;
@ -95,7 +95,7 @@ class BusPDP11 extends Component {
*/
constructor(parmsBus, cpu, dbg)
{
super("Bus", parmsBus, BusPDP11, MessagesPDP11.BUS);
super("Bus", parmsBus, MessagesPDP11.BUS);
this.cpu = cpu;
this.dbg = dbg;

View file

@ -104,7 +104,7 @@ class ComputerPDP11 extends Component {
*/
constructor(parmsComputer, parmsMachine, fSuspended)
{
super("Computer", parmsComputer, ComputerPDP11, MessagesPDP11.COMPUTER);
super("Computer", parmsComputer, MessagesPDP11.COMPUTER);
this.flags.powered = false;

View file

@ -93,7 +93,7 @@ class CPUPDP11 extends Component {
*/
constructor(parmsCPU, nCyclesDefault)
{
super("CPU", parmsCPU, CPUPDP11, MessagesPDP11.CPU);
super("CPU", parmsCPU, MessagesPDP11.CPU);
var nCycles = +parmsCPU['cycles'] || nCyclesDefault;

View file

@ -74,7 +74,7 @@ if (NODE) {
* priority: number,
* message: number,
* next: (IRQ|null)
* }} IRQ
* }}
*/
var IRQ;
@ -675,8 +675,8 @@ class CPUStatePDP11 extends CPUPDP11 {
restore(data)
{
/*
* ES6 ALERT: Love these destructuring assignments, which make it easy to perform the
* inverse of what save() does when it collects a bunch of object properties into an array.
* ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse
* of what save() does when it collects a bunch of object properties into an array.
*/
[
this.regsGen,

View file

@ -59,7 +59,7 @@ if (NODE) {
* nBase:(number|undefined),
* sCmd:(string|undefined),
* aCmds:(Array.<string>|undefined)
* }} DbgAddrPDP11
* }}
*/
var DbgAddrPDP11;

View file

@ -690,6 +690,7 @@ var PDP11 = {
RK11: { // RK11 Disk Controller
PRI: 5,
VEC: 0o220,
DRIVES: 8, // maximum of 8 drives
RKDS: { // 177400: Drive Status Register
SC: 0x000F, // (000017) Sector Counter
SCESA: 0x0010, // (000020) Sector Counter Equals Sector Address
@ -874,6 +875,8 @@ var PDP11 = {
}
};
PDP11.RK11.RK05 = [203, 2, 12, 512, PDP11.RK11.RKDS.RK05 | PDP11.RK11.RKDS.SOK | PDP11.RK11.RKDS.RRDY];
PDP11.ACCESS.READ_WORD = PDP11.ACCESS.WORD | PDP11.ACCESS.READ; // formerly READ_MODE (2)
PDP11.ACCESS.READ_BYTE = PDP11.ACCESS.BYTE | PDP11.ACCESS.READ; // formerly READ_MODE (2) | BYTE_MODE (1)
PDP11.ACCESS.WRITE_WORD = PDP11.ACCESS.WORD | PDP11.ACCESS.WRITE; // formerly WRITE_MODE (4)

View file

@ -60,7 +60,7 @@ class DevicePDP11 extends Component {
*/
constructor(parmsDevice)
{
super("Device", parmsDevice, DevicePDP11, MessagesPDP11.DEVICE);
super("Device", parmsDevice, MessagesPDP11.DEVICE);
this.kw11 = { // KW11 registers
lks: PDP11.KW11.LKS.MON,
@ -241,8 +241,8 @@ class DevicePDP11 extends Component {
restore(data)
{
/*
* ES6 ALERT: Love these destructuring assignments, which make it easy to perform the
* inverse of what save() does when it collects a bunch of object properties into an array.
* ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse
* of what save() does when it collects a bunch of object properties into an array.
*/
[
this.kw11.lks

View file

@ -103,13 +103,13 @@ class DiskPDP11 extends Component {
* This means, for example, that all references to "track[iSector].data" must actually appear as
* "track[iSector]['data']".
*
* @param {RK11|RL11} controller
* @param {DriveController|RK11|RL11} controller
* @param {Object} drive
* @param {string} mode
*/
constructor(controller, drive, mode)
{
super("Disk", {'id': controller.idMachine + ".disk" + Str.toHex(++DiskPDP11.nDisks, 4)}, DiskPDP11, MessagesPDP11.DISK);
super("Disk", {'id': controller.idMachine + ".disk" + Str.toHex(++DiskPDP11.nDisks, 4)}, MessagesPDP11.DISK);
/*
* Route all non-Debugger messages (eg, notice() and println() calls) through
@ -371,6 +371,7 @@ class DiskPDP11 extends Component {
}
if (this.fnNotify) {
//noinspection JSUnresolvedFunction
this.fnNotify.call(this.controller, this.drive, disk, this.sDiskName, this.sDiskPath);
this.fnNotify = null;
}
@ -590,6 +591,7 @@ class DiskPDP11 extends Component {
}
if (this.fnNotify) {
//noinspection JSUnresolvedFunction
this.fnNotify.call(this.controllerNotify, this.drive, disk, this.sDiskName, this.sDiskPath);
this.fnNotify = null;
}

1093
modules/pdp11/lib/drive.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -43,7 +43,7 @@ class KeyboardPDP11 extends Component {
*/
constructor(parmsKbd)
{
super("Keyboard", parmsKbd, KeyboardPDP11, MessagesPDP11.KEYBOARD);
super("Keyboard", parmsKbd, MessagesPDP11.KEYBOARD);
this.setReady();
}

View file

@ -53,7 +53,7 @@ class PanelPDP11 extends Component {
*/
constructor(parmsPanel, fBindings)
{
super("Panel", parmsPanel, PanelPDP11, MessagesPDP11.PANEL);
super("Panel", parmsPanel, MessagesPDP11.PANEL);
/*
* If there are any live registers, LEDs, etc, to display, this will provide a count.

View file

@ -64,7 +64,7 @@ class PC11 extends Component {
*/
constructor(parms)
{
super("PC11", parms, PC11);
super("PC11", parms);
this.sDevice = "PTR"; // TODO: Make the device name configurable

View file

@ -62,7 +62,7 @@ class RAMPDP11 extends Component {
*/
constructor(parmsRAM)
{
super("RAM", parmsRAM, RAMPDP11);
super("RAM", parmsRAM);
this.abInit = null;
this.aSymbols = null;

File diff suppressed because it is too large Load diff

View file

@ -89,7 +89,7 @@ class RL11 extends Component {
*/
constructor(parms)
{
super("RL11", parms, RL11, MessagesPDP11.RL11);
super("RL11", parms, MessagesPDP11.RL11);
/*
* We preliminarily parse and record any 'autoMount' object now, but we no longer process it

View file

@ -60,7 +60,7 @@ class ROMPDP11 extends Component {
*/
constructor(parmsROM)
{
super("ROM", parmsROM, ROMPDP11, MessagesPDP11.ROM);
super("ROM", parmsROM, MessagesPDP11.ROM);
this.abInit = null;
this.aSymbols = null;

View file

@ -100,7 +100,7 @@ class SerialPortPDP11 extends Component {
*/
constructor(parmsSerial)
{
super("SerialPort", parmsSerial, SerialPortPDP11, MessagesPDP11.SERIAL);
super("SerialPort", parmsSerial, MessagesPDP11.SERIAL);
this.iAdapter = +parmsSerial['adapter'];
this.nBaudReceive = +parmsSerial['baudReceive'] || PDP11.DL11.RCSR.BAUD;
@ -498,8 +498,8 @@ class SerialPortPDP11 extends Component {
}
/*
* ES6 ALERT: Love these destructuring assignments, which make it easy to perform the
* inverse of what save() does when it collects a bunch of object properties into an array.
* ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse
* of what saveRegisters() does when it collects a bunch of object properties into an array.
*/
[
this.regRBUF,