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:
parent
367d466fe1
commit
5edbdcdce2
33 changed files with 1754 additions and 1615 deletions
|
|
@ -72,7 +72,7 @@ class Bus8080 extends Component {
|
|||
*/
|
||||
constructor(parmsBus, cpu, dbg)
|
||||
{
|
||||
super("Bus", parmsBus, Bus8080);
|
||||
super("Bus", parmsBus);
|
||||
|
||||
this.cpu = cpu;
|
||||
this.dbg = dbg;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class ChipSet8080 extends Component {
|
|||
*/
|
||||
constructor(parmsChipSet)
|
||||
{
|
||||
super("ChipSet", parmsChipSet, ChipSet8080, Messages8080.CHIPSET);
|
||||
super("ChipSet", parmsChipSet, Messages8080.CHIPSET);
|
||||
|
||||
var model = parmsChipSet['model'];
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class Computer8080 extends Component {
|
|||
*/
|
||||
constructor(parmsComputer, parmsMachine, fSuspended)
|
||||
{
|
||||
super("Computer", parmsComputer, Computer8080, Messages8080.COMPUTER);
|
||||
super("Computer", parmsComputer, Messages8080.COMPUTER);
|
||||
|
||||
this.flags.powered = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class CPU8080 extends Component {
|
|||
*/
|
||||
constructor(parmsCPU, nCyclesDefault)
|
||||
{
|
||||
super("CPU", parmsCPU, CPU8080, Messages8080.CPU);
|
||||
super("CPU", parmsCPU, Messages8080.CPU);
|
||||
|
||||
var nCycles = parmsCPU['cycles'] || nCyclesDefault;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Keyboard8080 extends Component {
|
|||
*/
|
||||
constructor(parmsKbd)
|
||||
{
|
||||
super("Keyboard", parmsKbd, Keyboard8080, Messages8080.KEYBOARD);
|
||||
super("Keyboard", parmsKbd, Messages8080.KEYBOARD);
|
||||
|
||||
var model = parmsKbd['model'];
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class Panel8080 extends Component {
|
|||
*/
|
||||
constructor(parmsPanel)
|
||||
{
|
||||
super("Panel", parmsPanel, Panel8080);
|
||||
super("Panel", parmsPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class RAM8080 extends Component {
|
|||
*/
|
||||
constructor(parmsRAM)
|
||||
{
|
||||
super("RAM", parmsRAM, RAM8080);
|
||||
super("RAM", parmsRAM);
|
||||
|
||||
this.abInit = null;
|
||||
this.aSymbols = null;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class ROM8080 extends Component {
|
|||
*/
|
||||
constructor(parmsROM)
|
||||
{
|
||||
super("ROM", parmsROM, ROM8080);
|
||||
super("ROM", parmsROM);
|
||||
|
||||
this.abROM = null;
|
||||
this.addrROM = parmsROM['addr'];
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class SerialPort8080 extends Component {
|
|||
*/
|
||||
constructor(parmsSerial)
|
||||
{
|
||||
super("SerialPort", parmsSerial, SerialPort8080, Messages8080.SERIAL);
|
||||
super("SerialPort", parmsSerial, Messages8080.SERIAL);
|
||||
|
||||
this.iAdapter = +parmsSerial['adapter'];
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class Video8080 extends Component {
|
|||
*/
|
||||
constructor(parmsVideo, canvas, context, textarea, container)
|
||||
{
|
||||
super("Video", parmsVideo, Video8080, Messages8080.VIDEO);
|
||||
super("Video", parmsVideo, Messages8080.VIDEO);
|
||||
|
||||
var video = this;
|
||||
this.fGecko = Web.isUserAgent("Gecko/");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ if (NODE) {
|
|||
* nBase:(number|undefined),
|
||||
* sCmd:(string|undefined),
|
||||
* aCmds:(Array.<string>|undefined)
|
||||
* }} DbgAddrPDP11
|
||||
* }}
|
||||
*/
|
||||
var DbgAddrPDP11;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
1093
modules/pdp11/lib/drive.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -43,7 +43,7 @@ class KeyboardPDP11 extends Component {
|
|||
*/
|
||||
constructor(parmsKbd)
|
||||
{
|
||||
super("Keyboard", parmsKbd, KeyboardPDP11, MessagesPDP11.KEYBOARD);
|
||||
super("Keyboard", parmsKbd, MessagesPDP11.KEYBOARD);
|
||||
|
||||
this.setReady();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
*/
|
||||
class Component {
|
||||
/**
|
||||
* Component(type, parms, constructor, bitsMessage)
|
||||
* Component(type, parms, bitsMessage)
|
||||
*
|
||||
* A Component object requires:
|
||||
*
|
||||
|
|
@ -88,14 +88,13 @@ class Component {
|
|||
* name: component name (default is ""; if blank, toString() will use the type name only)
|
||||
* comment: component comment string (default is undefined)
|
||||
*
|
||||
* Subclasses that use Component.subclass() to extend Component will likely have additional (parms) properties.
|
||||
* Component subclasses will usually have additional (parms) properties.
|
||||
*
|
||||
* @param {string} type
|
||||
* @param {Object} [parms]
|
||||
* @param {Object} [constructor]
|
||||
* @param {number} [bitsMessage] selects message(s) that the component wants to enable (default is 0)
|
||||
*/
|
||||
constructor(type, parms, constructor, bitsMessage)
|
||||
constructor(type, parms, bitsMessage)
|
||||
{
|
||||
this.type = type;
|
||||
|
||||
|
|
@ -153,8 +152,8 @@ class Component {
|
|||
/*
|
||||
* TODO: Consider adding another parameter to the Component() constructor that allows components to tell
|
||||
* us if they support single or multiple instances per machine. For example, there can be multiple SerialPort
|
||||
* components per machine, but only one CPU component (well, OK, an FPU is also supported, but that's considered
|
||||
* a different component).
|
||||
* components per machine, but only one CPU component (some machines also support an FPU, but that component
|
||||
* is considered separate from the CPU).
|
||||
*
|
||||
* It's not critical, but it would help catch machine configuration errors; for example, a machine that mistakenly
|
||||
* includes two CPU components may, aside from wasting memory, end up with odd side-effects, like unresponsive
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ if (NODE) {
|
|||
* fTemporary:(boolean|undefined),
|
||||
* sCmd:(string|undefined),
|
||||
* aCmds:(Array.<string>|undefined)
|
||||
* }} DbgAddr
|
||||
* }}
|
||||
*/
|
||||
var DbgAddr;
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ class Debugger extends Component {
|
|||
constructor(parmsDbg) {
|
||||
if (DEBUGGER) {
|
||||
|
||||
super("Debugger", parmsDbg, Debugger);
|
||||
super("Debugger", parmsDbg);
|
||||
|
||||
/*
|
||||
* Default base used to display all values; modified with the "s base" command.
|
||||
|
|
|
|||
Loading…
Reference in a new issue