First stab at RK11 support

This commit is contained in:
Jeff Parsons 2016-11-21 18:10:20 -08:00 committed by Jeff Parsons
commit dcea4fb905
22 changed files with 1468 additions and 17 deletions

View file

@ -31,6 +31,7 @@ PDPjs is currently comprised of the following non-shared components, as listed i
* [serialport.js](/modules/pdp11/lib/serialport.js)
* [pc11.js](/modules/pdp11/lib/pc11.js)
* [disk.js](/modules/pdp11/lib/disk.js)
* [rk11.js](/modules/pdp11/lib/rk11.js)
* [rl11.js](/modules/pdp11/lib/rl11.js)
* [debugger.js](/modules/pdp11/lib/debugger.js)
* [computer.js](/modules/pdp11/lib/computer.js)

View file

@ -476,6 +476,15 @@ var PDP11 = {
RLMP: 0o174406, // RL11 Multi-Purpose Register
RLBE: 0o174410, // RL11 Bus (Address) Extension Register (RLV12 controller only)
RKDS: 0o177400, // RK11 Drive Status Register
RKER: 0o177402, // RK11 Error Register
RKCS: 0o177404, // RK11 Control Status Register
RKWC: 0o177406, // RK11 Word Count Register
RKBA: 0o177410, // RK11 Bus Address Register
RKDA: 0o177412, // RK11 Disk Address Register
// NOTE: 177414 is unused
RKDB: 0o177416, // RK11 Data Buffer Register
LKS: 0o177546, // KW11-L Clock Status
PRS: 0o177550, // PC11 (and PR11) Reader Status Register
@ -644,6 +653,84 @@ var PDP11 = {
BAUD: 600
},
},
RK11: { // RK11 Disk Controller
PRI: 5,
VEC: 0o220,
RKDS: { // 177400: Drive Status Register
SC: 0x000F, // Sector Counter
SCESA: 0x0010, // Sector Counter Equals Sector Address
WPS: 0x0020, // Write Protected Status (set if write-protected)
RRDY: 0x0040, // Read/Write/Seek Ready
DRDY: 0x0080, // Drive Ready
SOK: 0x0100, // Sector Counter OK
SIN: 0x0200, // Seek Incomplete
DRU: 0x0400, // Drive Unsafe
RK05: 0x0800, // RK05 is the selected disk drive (always set)
DPL: 0x1000, // Drive Power Low
ID: 0xE000, // Drive ID (logical drive number of an interrupting drive)
SHIFT: {
ID: 13
}
},
RKER: { // 177402: Error Register
WCE: 0x0001, // Write Check Error
CSE: 0x0002, // Checksum Error
UNUSED: 0x001C, // unused (returns zero)
NXS: 0x0020, // Non-Existent Sector
NXC: 0x0040, // Non-Existent Cylinder
NXD: 0x0080, // Non-Existent Disk
TE: 0x0100, // Timing Error
DLT: 0x0200, // Date Late
NXM: 0x0400, // Non-Existent Memory
PGE: 0x0800, // Programming Error
SKE: 0x1000, // Seek Error
WLO: 0x2000, // Write Lock-Out Violation
OVR: 0x4000, // Overrun
DRE: 0x8000 // Drive Error
},
RKCS: { // 177404: Control Status Register
GO: 0x0001, // Go (W/O)
FUNC: 0x000E, // Function Code (F2,F1,F0) (R/W)
MEX: 0x0030, // Memory Extension (R/W)
IE: 0x0040, // Interrupt Enable (R/W)
CRDY: 0x0080, // Controller Ready (R/O)
SSE: 0x0100, // Stop on Soft Error (R/W)
EXB: 0x0200, // Extra Bit (R/W)
FMT: 0x0400, // Format (R/W)
IBA: 0x0800, // Inhibit RKBA Increment (R/W)
SCP: 0x2000, // Search Complete (R/O)
HE: 0x4000, // Hard Error (R/O)
ERR: 0x8000, // Composite Error (R/O) (set when any RKER bit is set)
UNUSED: 0x1200, // unused
RMASK: 0xEFFE, // bits readable
WMASK: 0x0F7F, // bits writable
SHIFT: {
FUNC: 1,
MEX: 4
}
},
RKDA: { // 177412: Disk Address Register
SA: 0x000F, // Sector Address
HS: 0x0010, // Head Select (aka SUR: clear for upper disk head, set for lower)
CA: 0x1FE0, // Cylinder Address (aka CYL ADDR)
DS: 0xE000, // Drive Select (aka DR SEL)
SHIFT: {
HS: 4,
CA: 5,
DS: 13
}
},
FUNC: { // NOTE: These function codes are pre-shifted to read/write directly from/to RKCS.FUNC
CRESET: 0b0000, // Controller Reset
WRITE: 0b0010, // Write
READ: 0b0100, // Read
WCHK: 0b0110, // Write Check
SEEK: 0b1000, // Seek
RCHK: 0b1010, // Read Check
DRESET: 0b1100, // Drive Reset
WLOCK: 0b1110 // Write Lock
}
},
RL11: { // RL11 Disk Controller
PRI: 5,
VEC: 0o160,
@ -663,6 +750,7 @@ var PDP11 = {
WMASK: 0x03FE, // bits writable
SHIFT: {
FUNC: 1,
BAE: 4,
DS: 8
}
},

View file

@ -1167,6 +1167,10 @@ DevicePDP11.init = function()
device = new RL11(parmsDevice);
Component.bindComponentControls(device, eDevice, PDP11.APPCLASS);
break;
case 'rk11':
device = new RK11(parmsDevice);
Component.bindComponentControls(device, eDevice, PDP11.APPCLASS);
break;
}
}
};

View file

@ -73,7 +73,7 @@ if (NODE) {
*
* @constructor
* @extends Component
* @param {RL11} controller
* @param {RK11|RL11} controller
* @param {Object} drive
* @param {string} mode
*/

View file

@ -45,7 +45,8 @@ var MessagesPDP11 = {
KEYBOARD: 0x00010000,
KEYS: 0x00020000,
PAPER: 0x00100000,
DISK: 0x00400000,
DISK: 0x00200000,
RK11: 0x00400000,
RL11: 0x00800000,
SERIAL: 0x01000000,
SPEAKER: 0x02000000,
@ -84,6 +85,7 @@ MessagesPDP11.CATEGORIES = {
"key": MessagesPDP11.KEYS, // using "key" instead of "keys", since the latter is a method on JavasScript objects
"paper": MessagesPDP11.PAPER,
"disk": MessagesPDP11.DISK,
"rk11": MessagesPDP11.RK11,
"rl11": MessagesPDP11.RL11,
"serial": MessagesPDP11.SERIAL,
"speaker": MessagesPDP11.SPEAKER,

1281
modules/pdp11/lib/rk11.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -980,7 +980,7 @@ RL11.prototype.processCommand = function()
RL11.prototype.endReadWrite = function(err, iCylinder, iHead, iSector, nWords, addr)
{
this.bar = addr & 0xffff;
this.csr = (this.csr & ~PDP11.RL11.RLCS.BAE) | ((addr >> 12) & PDP11.RL11.RLCS.BAE);
this.csr = (this.csr & ~PDP11.RL11.RLCS.BAE) | ((addr >> (16 - PDP11.RL11.RLCS.SHIFT.BAE)) & PDP11.RL11.RLCS.BAE);
this.ber = (addr >> 16) & PDP11.RL11.RLBE.MASK; // 22 bit mode
this.dar = (iCylinder << PDP11.RL11.RLDA.SHIFT.RW_CA) | (iHead? PDP11.RL11.RLDA.RW_HS : 0) | (iSector & PDP11.RL11.RLDA.RW_SA);
this.darInternal = this.dar;

View file

@ -95,6 +95,7 @@ DiskAPI.DISK_FORMATS = {
/*
* Assorted DEC disk pack formats.
*/
2494464: [203,2,12,512], // RK03 single-platter disk cartridge: 203 tracks, 2 heads, 12 sectors/track, 512 bytes/sector, for a total of 2494464 bytes
5242880: [256,2,40,256], // RL01K single-platter disk cartridge: 256 tracks, 2 heads, 40 sectors/track, 256 bytes/sector, for a total of 5242880 bytes
10485760:[512,2,40,256] // RL02K single-platter disk cartridge: 512 tracks, 2 heads, 40 sectors/track, 256 bytes/sector, for a total of 10485760 bytes
};