Lots of work to try to bring the new RL11 component up to snuff

This commit is contained in:
Jeff 2016-10-29 11:32:31 -07:00 committed by Jeff Parsons
commit 96ad4ec37e
6 changed files with 978 additions and 558 deletions

View file

@ -152,6 +152,7 @@ function BusPDP11(parmsBus, cpu, dbg)
this.aIOHandlers = [];
this.fIOBreakAll = false;
this.nDisableFaults = 0;
this.fFault = false;
/*
* Array of RESET notification handlers registered by Device components.
@ -552,13 +553,11 @@ BusPDP11.prototype.reset = function()
BusPDP11.prototype.unknownAccess = function(addr, fByte, data)
{
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.WARN)) {
/*
* TODO: For 22-bit machines, let's display addr as a 3-byte value (for a total of 9 octal digits)
*/
this.dbg.printMessage("warning: unknown I/O access (" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(data, fByte?1:2) + ")", true, true);
this.dbg.stopInstruction();
}
if (!this.nDisableFaults) {
this.cpu.regErr |= PDP11.CPUERR.TIMEOUT;
this.cpu.trap(PDP11.TRAP.BUS_ERROR, addr);
}
return 0;
@ -925,6 +924,7 @@ BusPDP11.prototype.getByte = function(addr)
*/
BusPDP11.prototype.getByteDirect = function(addr)
{
this.fFault = false;
this.nDisableFaults++;
var b = this.aMemBlocks[(addr & this.nBusMask) >>> this.nBlockShift].readByteDirect(addr & this.nBlockLimit, addr);
this.nDisableFaults--;
@ -962,6 +962,7 @@ BusPDP11.prototype.getWordDirect = function(addr)
var w;
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
this.fFault = false;
this.nDisableFaults++;
if (!PDP11.WORDBUS && off == this.nBlockLimit) {
w = this.aMemBlocks[iBlock++].readByteDirect(off, addr) | (this.aMemBlocks[iBlock & this.nBlockMask].readByteDirect(0, addr + 1) << 8);
@ -996,6 +997,7 @@ BusPDP11.prototype.setByte = function(addr, b)
*/
BusPDP11.prototype.setByteDirect = function(addr, b)
{
this.fFault = false;
this.nDisableFaults++;
this.aMemBlocks[(addr & this.nBusMask) >>> this.nBlockShift].writeByteDirect(addr & this.nBlockLimit, b & 0xff, addr);
this.nDisableFaults--;
@ -1034,6 +1036,7 @@ BusPDP11.prototype.setWordDirect = function(addr, w)
{
var off = addr & this.nBlockLimit;
var iBlock = (addr & this.nBusMask) >>> this.nBlockShift;
this.fFault = false;
this.nDisableFaults++;
if (!PDP11.WORDBUS && off == this.nBlockLimit) {
this.aMemBlocks[iBlock++].writeByteDirect(off, w & 0xff, addr);
@ -1272,6 +1275,22 @@ BusPDP11.prototype.fault = function(addr, access)
}
this.cpu.trap(PDP11.TRAP.BUS_ERROR, addr);
}
this.fFault = true;
};
/**
* checkFault()
*
* This also serves as a clearFault() function.
*
* @this {BusPDP11}
* @return {boolean}
*/
BusPDP11.prototype.checkFault= function()
{
var f = this.fFault;
this.fFault = false;
return f;
};
/**

View file

@ -431,10 +431,11 @@ var PDP11 = {
MMR3: 0o172516, // 772516 17772516
RLCS: 0o174400, // RL11 Control Status
RLBA: 0o174402, // RL11 Bus Address
RLDA: 0o177404, // RL11 Disk Address
RLMP: 0o177406, // RL11 Multi-Purpose
RLCS: 0o174400, // RL11 Control Status Register
RLBA: 0o174402, // RL11 Bus Address Register
RLDA: 0o177404, // RL11 Disk Address Register
RLMP: 0o177406, // RL11 Multi-Purpose Register
RLBE: 0o177410, // RL11 Bus (Address) Extension Register (RLV12 controller only)
LKS: 0o177546, // KW11-L Clock Status
@ -618,6 +619,10 @@ var PDP11 = {
SET: 0x0080, // bits set on INIT (bit 7 is set)
RMASK: 0xFFFF, // no write-only bits
WMASK: 0x03FE, // bits writable
SHIFT: {
FUNC: 1,
DS: 8
}
},
RLBA: { // Bus Address Register (174402)
WMASK: 0xFFFE // bit 0 is effectively not writable (always zero)
@ -634,20 +639,33 @@ var PDP11 = {
RW_HS: 0x0040, // Head Select
RW_CA: 0xFF80, // Cylinder Address (RL01 has 256 cylinders, RL02 has 512)
GS_CMD: 0x0003, // Get Status: bit 0 must be set, bit 1 set, and bits 2 and 4-7 clear (bits 8-15 unused)
GS_RST: 0x0008 // Reset (when set, clears error register before sending status word to controller)
GS_RST: 0x0008, // Reset (when set, clears error register before sending status word to controller)
SHIFT: {
RW_HS: 6,
RW_CA: 7
}
},
/*
* This register has 3 formats: one for Read Header, another for Read/Write, and a third for Get Status
*/
RLMP: {
GS_ST: 0x0007, // Major State Code
RLMP: { // Multi-Purpose Register (177406)
GS_ST: { // Major State Code (of the drive)
LOADC: 0x0, // Load Cartridge
SPINUP: 0x1, // Spin-Up
BRUSHC: 0x2, // Brush Cycle
LOADH: 0x3, // Load Heads
SEEK: 0x4, // Seek
LOCKON: 0x5, // Lock On
UNLOADH:0x6, // Unload Heads
SPINDN: 0x7 // Spin-Down
},
GS_BH: 0x0008, // Brushes Home
GS_HO: 0x0010, // Heads Out
GS_CO: 0x0020, // Cover Open (or dust cover is not in place)
GS_HS: 0x0040, // Head Selected (0 for upper head, 1 for lower head)
GS_DT: 0x0080, // Drive Type (0 for RL01, 1 for RL02)
GS_DSE: 0x0100, // Drive Select Error
GS_VC: 0x0200, // Volume Check
GS_VC: 0x0200, // Volume Check (Set during transition from a head load state to a head-on-track state; cleared by execution of a Get Status command with Bit 3 asserted)
GS_WGE: 0x0400, // Write Gate Error
GS_SPE: 0x0800, // Spin Error
GS_SKTO: 0x1000, // Seek Time-Out
@ -655,17 +673,10 @@ var PDP11 = {
GS_CHE: 0x4000, // Current Head Error
GS_WDE: 0x8000 // Write Data Error
},
FUNC: { // NOTE: These function codes are pre-shifted to write directly into RLCS.FUNC
NOP: 0b0000, // No-Op
WCHK: 0b0010, // Write Check
STATUS: 0b0100, // Get Status
SEEK: 0b0110, // Seek
RHDR: 0b1000, // Read Header
WDATA: 0b1010, // Write Data
RDATA: 0b1100, // Read Data
RDNC: 0b1110 // Read Data without Header Check
RLBE: { // Bus (Address) Extension Register (174410)
MASK: 0x003F // bits 5-0 correspond to bus address bits 21-16
},
ERRC: { // NOTE: These error codes are pre-shifted to read directly from RLCS.ERRC
ERRC: { // NOTE: These error codes are pre-shifted to read/write directly from/to RLCS.ERRC
OPI: 0x0400, // Operation Incomplete
DCRC: 0x0800, // Read Data CRC
WCE: 0x0800, // Write Check Error
@ -674,6 +685,16 @@ var PDP11 = {
HNF: 0x1400, // Header Not Found
NXM: 0x2000, // Non-Existent Memory
MPE: 0x2400 // Memory Parity Error (RLV12 only)
},
FUNC: { // NOTE: These function codes are pre-shifted to read/write directly from/to RLCS.FUNC
NOP: 0b0000, // No-Op
WCHK: 0b0010, // Write Check
STATUS: 0b0100, // Get Status
SEEK: 0b0110, // Seek
RHDR: 0b1000, // Read Header
WDATA: 0b1010, // Write Data
RDATA: 0b1100, // Read Data
RDNC: 0b1110 // Read Data without Header Check
}
}
};

View file

@ -93,7 +93,7 @@ function DiskPDP11(controller, drive, mode)
this.drive = drive;
/*
* We pull out a number of drive properties that we may or may not need as defaults
* We pull out a number of drive properties that we may or may not need as defaults.
*/
this.sDiskName = drive.name;
this.fRemovable = drive.fRemovable;
@ -1230,4 +1230,4 @@ DiskPDP11.prototype.dumpSector = function(sector, pba, sDesc)
return sDump;
};
if (NODE) module.exports = Disk;
if (NODE) module.exports = DiskPDP11;

View file

@ -274,13 +274,13 @@ RL11.prototype.initBus = function(cmp, bus, cpu, dbg)
}
/*
* If we didn't need auto-mount support, we could defer controller initialization until we received a powerUp() notification,
* at which point reset() would call initController(), or restore() would restore the controller; in that case, all we'd need
* to do here is call setReady().
* If we didn't need auto-mount support, we could defer controller initialization until we received
* a powerUp() notification, at which point reset() would call initController(), or restore() would restore
* the controller; in that case, all we'd need to do here is call setReady().
*/
this.initController();
this.triggerReaderInterrupt = this.cpu.addTrigger(PDP11.RL11.VEC, PDP11.RL11.PRI);
this.triggerInterrupt = this.cpu.addTrigger(PDP11.RL11.VEC, PDP11.RL11.PRI);
bus.addIOTable(this, RL11.UNIBUS_IOTABLE);
@ -417,29 +417,7 @@ RL11.prototype.save = function()
*/
RL11.prototype.restore = function(data)
{
return true; // this.initController(data[0]);
};
/**
* initController(data)
*
* @this {RL11}
* @param {Array} [data]
* @return {boolean} true if successful, false if failure
*/
RL11.prototype.initController = function(data)
{
var fSuccess = true;
for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) {
var drive = this.aDrives[iDrive];
if (drive === undefined) {
drive = this.aDrives[iDrive] = {};
}
if (!this.initDrive(drive, iDrive)) {
fSuccess = false;
}
}
return true;
return this.initController(data[0]);
};
/**
@ -453,57 +431,6 @@ RL11.prototype.saveController = function()
return [];
};
/**
* initDrive(drive, iDrive, data)
*
* TODO: Consider a separate Drive class that any drive controller can use, since there's a lot of commonality
* between the drive objects created by disk controllers. This will clean up overall drive management and allow
* us to factor out some common Drive methods.
*
* @this {RL11}
* @param {Object} drive
* @param {number} iDrive
* @param {Array|undefined} [data]
* @return {boolean} true if successful, false if failure
*/
RL11.prototype.initDrive = function(drive, iDrive, data)
{
var i = 0;
var fSuccess = true;
drive.iDrive = iDrive;
drive.fBusy = drive.fLocal = false;
drive.name = this.idComponent;
drive.nCylinders = 512;
drive.nHeads = 2;
drive.nSectors = 40;
drive.cbSector = 256;
drive.fRemovable = true;
/*
* The next group of properties are set by various controller command sequences.
*/
drive.bHead = 0;
drive.bCylinderSeek = 0;
drive.bCylinder = 0;
drive.bSector = 1;
drive.bSectorEnd = drive.nSectors; // aka EOT
drive.nBytes = drive.cbSector;
/*
* The next group of properties are managed by worker functions (eg, doRead()) to maintain state across DMA requests.
*/
drive.ibSector = 0;
drive.sector = null;
if (!drive.disk) {
drive.sDiskPath = ""; // ensure this is initialized to a default that displayDisk() can deal with
}
return fSuccess;
};
/**
* autoMount(fRemount)
*
@ -866,10 +793,446 @@ RL11.prototype.unloadAllDrives = function(fDiscard)
}
};
/**
* initController(data)
*
* @this {RL11}
* @param {Array} [data]
* @return {boolean} true if successful, false if failure
*/
RL11.prototype.initController = function(data)
{
var i = 0;
if (!data) data = [];
this.csr = data[i++] || 0;
this.bar = data[i++] || 0;
this.dar = data[i++] || 0;
this.darInternal = data[i++] || 0;
this.mpr = data[i++] || 0;
this.ber = data[i] || 0;
var fSuccess = true;
for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) {
var drive = this.aDrives[iDrive];
if (drive === undefined) {
drive = this.aDrives[iDrive] = {};
}
if (!this.initDrive(drive, iDrive)) {
fSuccess = false;
}
}
return fSuccess;
};
/**
* initDrive(drive, iDrive, data)
*
* TODO: Consider a separate Drive class that any drive controller can use, since there's a lot of commonality
* between the drive objects created by disk controllers. This will clean up overall drive management and allow
* us to factor out some common Drive methods.
*
* @this {RL11}
* @param {Object} drive
* @param {number} iDrive
* @param {Array|undefined} [data]
* @return {boolean} true if successful, false if failure
*/
RL11.prototype.initDrive = function(drive, iDrive, data)
{
var i = 0;
var fSuccess = true;
drive.iDrive = iDrive;
drive.fBusy = drive.fLocal = false;
drive.name = this.idComponent;
drive.nCylinders = 512;
drive.nHeads = 2;
drive.nSectors = 40;
drive.cbSector = 256;
drive.fRemovable = true;
/*
* The next group of properties are set by various controller command sequences.
*/
drive.bHead = 0;
drive.bCylinderSeek = 0;
drive.bCylinder = 0;
drive.bSector = 1;
drive.bSectorEnd = drive.nSectors; // aka EOT
drive.nBytes = drive.cbSector;
/*
* The next group of properties are managed by worker functions (eg, doRead()) to maintain state across DMA requests.
*/
drive.ibSector = 0;
drive.sector = null;
if (!drive.disk) {
drive.sDiskPath = ""; // ensure this is initialized to a default that displayDisk() can deal with
}
/*
* Default drive status bits returned via the controller's Get Status command via the RLMP register
*/
drive.status = PDP11.RL11.RLMP.GS_ST.LOCKON | PDP11.RL11.RLMP.GS_BH | PDP11.RL11.RLMP.GS_HO | (drive.nCylinders == 512? PDP11.RL11.RLMP.GS_DT : 0);
return fSuccess;
};
/**
* processCommand()
*
* @this {RL11}
*/
RL11.prototype.processCommand = function()
{
var fnReadWrite;
var fInterrupt = true;
var iDrive = (this.csr & PDP11.RL11.RLCS.DS) >> PDP11.RL11.RLCS.SHIFT.DS;
var drive = this.aDrives[iDrive];
var iCylinder, iHead, iSector, nWords, addr;
/*
* The typical pattern of DRDY and CRDY:
*
* 1) Normally both set
* 2) CRDY is cleared to process a command
* 3) DRDY is cleared to command is in process
*/
this.csr &= ~PDP11.RL11.RLCS.DRDY;
switch(this.csr & PDP11.RL11.RLCS.FUNC) {
case PDP11.RL11.FUNC.NOP:
case PDP11.RL11.FUNC.WCHK:
case PDP11.RL11.FUNC.RDNC:
break;
case PDP11.RL11.FUNC.STATUS:
if (this.dar & PDP11.RL11.RLDA.GS_RST) {
this.csr &= 0x3F; // TODO: Review
}
this.mpr = drive.status | (this.darInternal & PDP11.RL11.RLDA.RW_HS); // bit 6: Head Select, bit 7: Drive Type (1=RL02)
break;
case PDP11.RL11.FUNC.SEEK:
if ((this.dar & PDP11.RL11.RLDA.GS_CMD) == PDP11.RL11.RLDA.SEEK_CMD) {
var darCA = (this.dar & PDP11.RL11.RLDA.RW_CA);
var darHS = (this.dar & PDP11.RL11.RLDA.SEEK_HS) << 2;
if (this.dar & PDP11.RL11.RLDA.SEEK_DIR) {
this.darInternal += darCA;
} else {
this.darInternal -= darCA;
}
this.dar = this.darInternal = (this.darInternal & PDP11.RL11.RLDA.RW_CA) | darHS;
}
break;
case PDP11.RL11.FUNC.RHDR:
this.mpr = this.darInternal;
break;
case PDP11.RL11.FUNC.RDATA:
fnReadWrite = this.readData;
/* falls through */
case PDP11.RL11.FUNC.WDATA:
if (!fnReadWrite) fnReadWrite = this.writeData;
iCylinder = this.dar >> PDP11.RL11.RLDA.SHIFT.RW_CA;
iHead = (this.dar & PDP11.RL11.RLDA.RW_HS)? 0 : 1;
iSector = this.dar & PDP11.RL11.RLDA.RW_SA;
if (iCylinder >= drive.nCylinders || iSector >= drive.nSectors) {
this.csr |= PDP11.RL11.ERRC.HNF | PDP11.RL11.RLCS.ERR;
break;
}
addr = (((this.ber & PDP11.RL11.RLBE.MASK)) << 16) | this.bar; // 22 bit mode
nWords = (0x10000 - this.mpr) & 0xffff;
fInterrupt = fnReadWrite.call(this, drive, iCylinder, iHead, iSector, nWords, addr, this.endReadWrite.bind(this));
break;
default:
break;
}
if (fInterrupt) {
this.csr |= PDP11.RL11.RLCS.DRDY | PDP11.RL11.RLCS.CRDY;
if (this.csr & PDP11.RL11.RLCS.IE) {
this.cpu.setTrigger(this.triggerInterrupt);
}
}
};
/**
* endReadWrite(err, iCylinder, iHead, iSector, nWords, addr)
*
* @this {RL11}
* @param {number} err
* @param {number} iCylinder
* @param {number} iHead
* @param {number} iSector
* @param {number} nWords
* @param {number} addr
* @return {boolean}
*/
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.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;
this.mpr = (0x10000 - nWords) & 0xffff;
if (err) {
this.csr |= err | PDP11.RL11.RLCS.ERR;
}
return true;
};
/**
* readData(drive, iCylinder, iHead, iSector, nWords, addr, done)
*
* @this {RL11}
* @param {Object} drive
* @param {number} iCylinder
* @param {number} iHead
* @param {number} iSector
* @param {number} nWords
* @param {number} addr
* @param {function(...)} done
* @return {boolean} true if complete, false if queued
*/
RL11.prototype.readData = function(drive, iCylinder, iHead, iSector, nWords, addr, done)
{
var err = 0;
var disk = drive.disk;
var sector = null, ibSector;
while (nWords--) {
if (!sector) {
sector = drive.disk.seek(iCylinder, iHead, iSector, true);
if (!sector) {
err = PDP11.RL11.ERRC.HNF;
break;
}
ibSector = 0;
}
var b0, b1;
if ((b0 = drive.disk.read(sector, ibSector++)) < 0 || (b1 = drive.disk.read(sector, ibSector++)) < 0) {
err = PDP11.RL11.ERRC.HNF;
break;
}
var data = this.bus.setWordDirect(this.cpu.mapUnibus(addr), b0 | (b1 << 8));
if (this.bus.checkFault()) {
err = PDP11.RL11.ERRC.NXM;
break;
}
addr += 2;
if (ibSector >= disk.cbSector) {
sector = null;
if (++iSector >= disk.nSectors) {
iSector = 0;
if (++iHead >= disk.nHeads) {
iHead = 0;
if (++iCylinder >= disk.nCylinders) {
err = PDP11.RL11.ERRC.HNF;
break;
}
}
}
}
}
return done(err, iCylinder, iHead, iSector, nWords, addr);
};
/**
* writeData(drive, iCylinder, iHead, iSector, nWords, addr, done)
*
* @this {RL11}
* @param {Object} drive
* @param {number} iCylinder
* @param {number} iHead
* @param {number} iSector
* @param {number} nWords
* @param {number} addr
* @param {function(...)} done
* @return {boolean} true if complete, false if queued
*/
RL11.prototype.writeData = function(drive, iCylinder, iHead, iSector, nWords, addr, done)
{
var err = 0;
var disk = drive.disk;
var sector = null, ibSector;
while (nWords--) {
var data = this.bus.getWordDirect(this.cpu.mapUnibus(addr));
if (this.bus.checkFault()) {
err = PDP11.RL11.ERRC.NXM;
break;
}
addr += 2;
if (!sector) {
sector = drive.disk.seek(iCylinder, iHead, iSector, true);
if (!sector) {
err = PDP11.RL11.ERRC.HNF;
break;
}
ibSector = 0;
}
if (!drive.disk.write(sector, ibSector++, data & 0xff) || !drive.disk.write(sector, ibSector++, data >> 8)) {
err = PDP11.RL11.ERRC.HNF;
break;
}
if (ibSector >= disk.cbSector) {
sector = null;
if (++iSector >= disk.nSectors) {
iSector = 0;
if (++iHead >= disk.nHeads) {
iHead = 0;
if (++iCylinder >= disk.nCylinders) {
err = PDP11.RL11.ERRC.HNF;
break;
}
}
}
}
}
return done(err, iCylinder, iHead, iSector, nWords, addr);
};
/**
* readRLCS(addr)
*
* @this {RL11}
* @param {number} addr (eg, PDP11.UNIBUS.RLCS or 174400)
* @return {number}
*/
RL11.prototype.readRLCS = function(addr)
{
return this.csr & PDP11.RL11.RLCS.RMASK;
};
/**
* writeRLCS(data, addr)
*
* @this {RL11}
* @param {number} data
* @param {number} addr (eg, PDP11.UNIBUS.RLCS or 174400)
*/
RL11.prototype.writeRLCS = function(data, addr)
{
this.csr = (this.csr & ~PDP11.RL11.RLCS.WMASK) | (data & PDP11.RL11.RLCS.WMASK);
this.bae = (this.bae & ~0x3) | ((data & PDP11.RL11.RLCS.BAE) >> 4);
if (!(this.csr & PDP11.RL11.RLCS.CRDY)) this.processCommand();
};
/**
* readRLBA(addr)
*
* @this {RL11}
* @param {number} addr (eg, PDP11.UNIBUS.RLBA or 174402)
* @return {number}
*/
RL11.prototype.readRLBA = function(addr)
{
return this.bar;
};
/**
* writeRLBA(data, addr)
*
* @this {RL11}
* @param {number} data
* @param {number} addr (eg, PDP11.UNIBUS.RLBA or 174402)
*/
RL11.prototype.writeRLBA = function(data, addr)
{
this.bar = data & PDP11.RL11.RLBA.WMASK;
};
/**
* readRLDA(addr)
*
* @this {RL11}
* @param {number} addr (eg, PDP11.UNIBUS.RLDA or 174404)
* @return {number}
*/
RL11.prototype.readRLDA = function(addr)
{
return this.dar;
};
/**
* writeRLDA(data, addr)
*
* @this {RL11}
* @param {number} data
* @param {number} addr (eg, PDP11.UNIBUS.RLDA or 174404)
*/
RL11.prototype.writeRLDA = function(data, addr)
{
this.dar = data;
};
/**
* readRLMP(addr)
*
* @this {RL11}
* @param {number} addr (eg, PDP11.UNIBUS.RLMP or 174406)
* @return {number}
*/
RL11.prototype.readRLMP = function(addr)
{
return this.mpr;
};
/**
* writeRLMP(data, addr)
*
* @this {RL11}
* @param {number} data
* @param {number} addr (eg, PDP11.UNIBUS.RLMP or 174406)
*/
RL11.prototype.writeRLMP = function(data, addr)
{
this.mpr = data;
};
/**
* readRLBE(addr)
*
* @this {RL11}
* @param {number} addr (eg, PDP11.UNIBUS.RLBE or 174410)
* @return {number}
*/
RL11.prototype.readRLBE = function(addr)
{
return this.ber;
};
/**
* writeRLBE(data, addr)
*
* @this {RL11}
* @param {number} data
* @param {number} addr (eg, PDP11.UNIBUS.RLBE or 174410)
*/
RL11.prototype.writeRLBE = function(data, addr)
{
this.ber = data & PDP11.RL11.RLBE.MASK;
};
/*
* ES6 ALERT: As you can see below, I've finally started using computed property names.
*/
RL11.UNIBUS_IOTABLE = {
[PDP11.UNIBUS.RLCS]: /* 174400 */ [null, null, RL11.prototype.readRLCS, RL11.prototype.writeRLCS, "RLCS"],
[PDP11.UNIBUS.RLBA]: /* 174402 */ [null, null, RL11.prototype.readRLBA, RL11.prototype.writeRLBA, "RLBA"],
[PDP11.UNIBUS.RLDA]: /* 174404 */ [null, null, RL11.prototype.readRLDA, RL11.prototype.writeRLDA, "RLDA"],
[PDP11.UNIBUS.RLMP]: /* 174406 */ [null, null, RL11.prototype.readRLMP, RL11.prototype.writeRLMP, "RLMP"],
[PDP11.UNIBUS.RLBE]: /* 174410 */ [null, null, RL11.prototype.readRLBE, RL11.prototype.writeRLBE, "RLBE"]
};
if (NODE) module.exports = RL11;

View file

@ -31,279 +31,287 @@
http://pcjs.org/modules/pdp11/lib/computer.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016
*/
for(var k,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,ca=["Math","log2"],da=0;da<ca.length-1;da++){var fa=ca[da];fa in ba||(ba[fa]={});ba=ba[fa]}var ga=ca[ca.length-1],ha=ba[ga],ja=ha?ha:function(a){return Math.log(a)/Math.LN2};
ja!=ha&&null!=ja&&aa(ba,ga,{configurable:!0,writable:!0,value:ja});var ka={163840:[40,1,8,,254],184320:[40,1,9,,252],327680:[40,2,8,,255],368640:[40,2,9,,253],737280:[80,2,9,,249],1228800:[80,2,15,,249],1474560:[80,2,18,,240],2949120:[80,2,36,,240],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]};
function pa(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function qa(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function l(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
function ra(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function sa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ta(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ua={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function va(a){return a.replace(/[&<>"']/g,function(a){return ua[a]})}
function wa(a,b){return(a+" ").slice(0,b)}function xa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var ya={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
function za(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var Aa=Date.now||function(){return+new Date};function Ba(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function Da(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
for(var k,ba="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ca="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,da=["Math","log2"],ea=0;ea<da.length-1;ea++){var ga=da[ea];ga in ca||(ca[ga]={});ca=ca[ga]}var ha=da[da.length-1],ia=ca[ha],ka=ia?ia:function(a){return Math.log(a)/Math.LN2};
ka!=ia&&null!=ka&&ba(ca,ha,{configurable:!0,writable:!0,value:ka});var la={163840:[40,1,8,,254],184320:[40,1,9,,252],327680:[40,2,8,,255],368640:[40,2,9,,253],737280:[80,2,9,,249],1228800:[80,2,15,,249],1474560:[80,2,18,,240],2949120:[80,2,36,,240],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]};
function qa(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function ra(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function l(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
function sa(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function ta(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ua(a,b){return-1!==a.indexOf(b,a.length-b.length)}var va={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function wa(a){return a.replace(/[&<>"']/g,function(a){return va[a]})}
function xa(a,b){return(a+" ").slice(0,b)}function ya(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var za={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
function Aa(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var Ba=Date.now||function(){return+new Date};function Ca(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function Ea(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var m="",n;for(n in b)b.hasOwnProperty(n)&&(m&&(m+="&"),m+=n+"="+encodeURIComponent(b[n]));m=m.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(m)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g}
function Ea(a,b){var c,d={ea:null,ga:null,Ca:null,Ba:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Ca=g.load;d.Ba=g.exec;if(e=g.bytes)d.ea=e;else if(e=g.words)for(d.ea=Array(2*e.length),f=c=0;c<e.length;c++)d.ea[f++]=e[c]&255,d.ea[f++]=e[c]>>8&255;else if(e=g.data)for(d.ea=Array(4*e.length),f=c=0;c<e.length;c++)d.ea[f++]=
e[c]&255,d.ea[f++]=e[c]>>8&255,d.ea[f++]=e[c]>>16&255,d.ea[f++]=e[c]>>24&255;else d.ea=g;d.ga=g.symbols;d.ea.length?1==d.ea.length&&(p(d.ea[0]),d=null):(p("Empty resource: "+a),d=null)}catch(h){p("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){p("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.ea=e)}return d}
function Fa(){return"http://"+(window?window.location.host:"www.pcjs.org")}function p(a){window&&window.alert(a)}function Ga(a){var b=!1;window&&(b=window.confirm(a));return b}var Ha=null;function Ia(){if(null==Ha){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ha=a}return Ha}
function Ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Na(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Oa(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Pa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Qa(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Ra={init:[],show:[],exit:[]},Sa=!1,Ta=!1,Ua=!0;function Va(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Wa(a){Ra.init.push(a)}
function Xa(a){if(Ua)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){p(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ya(a){!Ua&&a?(Ua=!0,Sa&&Za("init"),Ta&&Za("show")):Ua=a}function Za(a){Ra[a]&&Xa(Ra[a])}Va("onload",function(){Sa=!0;Xa(Ra.init)});Va("onpageshow",function(){Ta=!0;Xa(Ra.show)});Va(Oa("Opera")||Oa("iOS")?"onunload":"onbeforeunload",function(){Xa(Ra.exit)});
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.mc=b.comment;this.Oc=b;b=this.id.indexOf(".");0>b?this.Za=this.id:(this.Ia=this.id.substr(0,b),this.Za=this.id.substr(b+1));this[a]=c;this.v={ready:!1,Qa:!1,Vb:!1,ha:!1,error:!1};this.Lb=null;this.v.error=!1;this.F={};this.i=null;this.na=d||0;t.push(this)}var $a=void 0,ab={};
if(window){$a||($a=window.location.search.substr(1));for(var hb,ib=/\+/g,jb=/([^&=]+)=?([^&]*)/g;hb=jb.exec($a);)ab[decodeURIComponent(hb[1].replace(ib," "))]=decodeURIComponent(hb[2].replace(ib," "))}function kb(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function u(a,b){b||(b=r);a.prototype=kb(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var lb=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else lb={},t=[];function mb(a,b,c){lb[a]&&b&&(lb[a][b]=c)}function nb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<t.length;b++){var d=t[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function ob(a){if(void 0!==a){var b;for(b=0;b<t.length;b++)if(t[b].id===a)return t[b]}return null}function pb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<t.length;d++)if(c)c==t[d]&&(c=null);else if(!(a!=t[d].type||b&&t[d].id.indexOf(b)))return t[d]}return null}function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){p(c.message+" ("+a+")")}return b}
function C(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),m=0;m<h.length;m++)switch(g=h[m],g){case "pdp11-binding":(g=A(f))&&g.binding&&a.qa(g.type,g.binding,f,g.value),m=h.length}}}}
function Fa(a,b){var c,d={ea:null,ha:null,Ha:null,Ga:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Ha=g.load;d.Ga=g.exec;if(e=g.bytes)d.ea=e;else if(e=g.words)for(d.ea=Array(2*e.length),f=c=0;c<e.length;c++)d.ea[f++]=e[c]&255,d.ea[f++]=e[c]>>8&255;else if(e=g.data)for(d.ea=Array(4*e.length),f=c=0;c<e.length;c++)d.ea[f++]=
e[c]&255,d.ea[f++]=e[c]>>8&255,d.ea[f++]=e[c]>>16&255,d.ea[f++]=e[c]>>24&255;else d.ea=g;d.ha=g.symbols;d.ea.length?1==d.ea.length&&(q(d.ea[0]),d=null):(q("Empty resource: "+a),d=null)}catch(h){q("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){q("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.ea=e)}return d}
function Ga(){return"http://"+(window?window.location.host:"www.pcjs.org")}function q(a){window&&window.alert(a)}function Ha(a){var b=!1;window&&(b=window.confirm(a));return b}var Ia=null;function Ka(){if(null==Ia){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ia=a}return Ia}
function Na(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Oa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Pa(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Qa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Ra(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Sa={init:[],show:[],exit:[]},Ta=!1,Ua=!1,Va=!0;function Wa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Xa(a){Sa.init.push(a)}
function Ya(a){if(Va)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){q(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Za(a){!Va&&a?(Va=!0,Ta&&$a("init"),Ua&&$a("show")):Va=a}function $a(a){Sa[a]&&Ya(Sa[a])}Wa("onload",function(){Ta=!0;Ya(Sa.init)});Wa("onpageshow",function(){Ua=!0;Ya(Sa.show)});Wa(Pa("Opera")||Pa("iOS")?"onunload":"onbeforeunload",function(){Ya(Sa.exit)});
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.nc=b.comment;this.Qc=b;b=this.id.indexOf(".");0>b?this.cb=this.id:(this.Na=this.id.substr(0,b),this.cb=this.id.substr(b+1));this[a]=c;this.A={ready:!1,Ua:!1,Wb:!1,ia:!1,error:!1};this.Ob=null;this.A.error=!1;this.G={};this.i=null;this.oa=d||0;t.push(this)}var ab=void 0,bb={};
if(window){ab||(ab=window.location.search.substr(1));for(var cb,jb=/\+/g,kb=/([^&=]+)=?([^&]*)/g;cb=kb.exec(ab);)bb[decodeURIComponent(cb[1].replace(jb," "))]=decodeURIComponent(cb[2].replace(jb," "))}function lb(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function w(a,b){b||(b=r);a.prototype=lb(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var mb=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else mb={},t=[];function nb(a,b,c){mb[a]&&b&&(mb[a][b]=c)}function ob(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<t.length;b++){var d=t[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function pb(a){if(void 0!==a){var b;for(b=0;b<t.length;b++)if(t[b].id===a)return t[b]}return null}function qb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<t.length;d++)if(c)c==t[d]&&(c=null);else if(!(a!=t[d].type||b&&t[d].id.indexOf(b)))return t[d]}return null}function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){q(c.message+" ("+a+")")}return b}
function C(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),m=0;m<h.length;m++)switch(g=h[m],g){case "pdp11-binding":(g=A(f))&&g.binding&&a.sa(g.type,g.binding,f,g.value),m=h.length}}}}
function D(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},qa:function(a,b,c){switch(b){case "clear":return this.F[b]||(this.F[b]=c,c.onclick=function(a){return function(){a.F.print&&(a.F.print.value="")}}(this)),!0;case "print":return this.F[b]||(this.Ka=this.F[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.O=function(a){this.j(a,this.Za)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.Za+": "+a)},O:function(a,b,c){c=c||this.type;b||p((c?c+": ":"")+a)},za:function(){return this.v.ha=!0},ya:function(a,b){b&&(this.v.ha=!1);return!0}};function E(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.na;var c=a.i.na&b;return!!b&&c===b||!!(c&a.i.Ic)}return!1}
function qb(a,b){if(a.v.Vb)return a.v.Qa=!1,a.v.Vb=!1;if(a.v.error)return a.j(a.toString()+" error"),!1;a.v.Qa=b;return a.v.Qa}function rb(a,b){a.v.Qa&&(b?a.v.Vb=!0:void 0===b&&a.j(a.toString()+" busy"));return a.v.Qa}function G(a,b){a.v.error||(a.v.ready=!1!==b,a.v.ready&&(b=a.Lb,a.Lb=null,b&&b()))}function sb(a,b){b&&(a.v.ready?b():a.Lb=b);return a.v.ready}function tb(a){return a.v.error?(a.j(a.toString()+" error"),!0):!1}function ub(a,b){a.v.error=!0;a.O(b)}
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},sa:function(a,b,c){switch(b){case "clear":return this.G[b]||(this.G[b]=c,c.onclick=function(a){return function(){a.G.print&&(a.G.print.value="")}}(this)),!0;case "print":return this.G[b]||(this.Oa=this.G[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.O=function(a){this.j(a,this.cb)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.cb+": "+a)},O:function(a,b,c){c=c||this.type;b||q((c?c+": ":"")+a)},Ea:function(){return this.A.ia=!0},Da:function(a,b){b&&(this.A.ia=!1);return!0}};function E(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.oa;var c=a.i.oa&b;return!!b&&c===b||!!(c&a.i.Jc)}return!1}
function rb(a,b){if(a.A.Wb)return a.A.Ua=!1,a.A.Wb=!1;if(a.A.error)return a.j(a.toString()+" error"),!1;a.A.Ua=b;return a.A.Ua}function sb(a,b){a.A.Ua&&(b?a.A.Wb=!0:void 0===b&&a.j(a.toString()+" busy"));return a.A.Ua}function G(a,b){a.A.error||(a.A.ready=!1!==b,a.A.ready&&(b=a.Ob,a.Ob=null,b&&b()))}function tb(a,b){b&&(a.A.ready?b():a.Ob=b);return a.A.ready}function ub(a){return a.A.error?(a.j(a.toString()+" error"),!0):!1}function vb(a,b){a.A.error=!0;a.O(b)}
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
var vb="undefined"!==typeof ArrayBuffer,wb={cpu:1,trap:16,bus:64,memory:128,device:256,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function xb(a){r.call(this,"Panel",a,xb);this.f=0;this.v.jc=!0}u(xb);k=xb.prototype;
k.qa=function(a,b,c,d){if(this.B&&this.B.qa(a,b,c,d)||this.b&&this.b.qa(a,b,c,d)||this.i&&this.i.qa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.F[b]=c,this.f++,!0;default:return"rled"==a?(this.F[b]=c,this.f++,!0):this.parent.qa.call(this,a,b,c,d)}};k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d};k.za=function(a,b){b||yb();return!0};k.ya=function(){return!0};
function zb(a,b,c,d){if(a.F[b]){void 0===c&&(ub(a,"Value for "+b+" is invalid"),a.b.ia());var e=a.i&&a.i.Z||8;c=!a.b.v.fa||a.v.jc?8==e?qa(c,d):l(c,d):"--------".substr(0,d||4);a.F[b].textContent!=c&&(a.F[b].textContent=c)}}function Ab(a,b,c,d){for(var e=0;e<d;e++){var f=a.F[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
k.da=function(a){if(this.f&&(a||!this.b.v.fa||this.v.jc)){for(a=0;a<this.b.u.length;a++)zb(this,"R"+a,this.b.u[a]);a=Bb(this.b);zb(this,"PS",a);zb(this,"NF",a&8?1:0,1);zb(this,"ZF",a&4?1:0,1);zb(this,"VF",a&2?1:0,1);zb(this,"CF",a&1?1:0,1);Ab(this,"D",this.b.u[0],16);Ab(this,"A",this.b.u[7],22)}};function yb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=ob(e.id);f||(a=!0,f=new xb(e));C(f,d);a&&G(f)}}Wa(yb);
function Cb(a,b,c){r.call(this,"Bus",a,Cb,64);this.b=b;this.i=c;this.L=a.busWidth||16;this.B=0;this.K=[];this.G=null;this.I=Math.pow(2,this.L);this.g=this.I-1|0;this.ua=Qb;this.ka=Math.log2(this.ua);this.J=this.ua>>2;this.w=this.ua-1;this.C=this.I/this.ua|0;this.Pa=[];this.f=0;this.A=[];this.Fc=[Rb,Sb,Tb,Ub];a=new I(this);Vb(a,this.i);this.W=Array(this.C);for(b=0;b<this.C;b++)this.W[b]=a;G(this)}u(Cb);var Qb=8192,Wb=Qb-1;
function Rb(a,b){var c=-1,d=this.controller,e=d.Pa[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.Pa[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.i&&F(this.i,64)&&E(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Xb(d,b,!0);this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
function Sb(a,b,c){var d=!1,e=this.controller,f=e.Pa[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.Pa[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d?this.i&&F(this.i,64)&&E(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Xb(e,c,!0,b),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
function Tb(a,b){var c=-1,d=this.controller;(a=d.Pa[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.i&&F(this.i,64)&&E(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Xb(d,b,!1);this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
function Ub(a,b,c){var d=!1,e=this.controller;if(a=e.Pa[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.i&&F(this.i,64)&&E(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Xb(e,c,!1,b),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
function Yb(a,b){if(b!=a.B){var c;a.B&&(c=(1<<a.B)-Qb,Zb(a,c,Qb,a.K),a.B=0);b&&(a.B=b,c=(1<<b)-Qb,a.K=$b(a,c,Qb),a.G?Zb(a,c,Qb,a.G):(ac(a,c,Qb,bc,a),a.G=$b(a,c,Qb)))}}k=Cb.prototype;k.reset=function(){for(var a=0;a<this.A.length;a++)this.A[a]();Yb(this,16)};function Xb(a,b,c,d){a.i&&F(a.i,536870912)&&(E(a.i,"warning: unknown I/O access ("+J(a.i,b)+","+J(a.i,d,c?1:2)+")",!0,!0),cc(a.i));a.f||a.b.ja(4,b);return 0}k.za=function(a,b){b||this.reset();return!0};
function ac(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ka;0<g&&h<a.W.length;){var m=a.W[h],n=h*a.ua,q=a.ua-(f-n);q>g&&(q=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.D)return m.Eb+=m.D-f,m.D=f,!0;if(f>=m.D+m.Eb){q=m.size-(f-n);q>g&&(q=g);m.Eb=f-m.D+q;f=n+a.ua;g-=q;h++;continue}}return dc(1,f,g)}f=new I(a,f,q,a.ua,d,e);Vb(f,a.i,m);a.W[h++]=f;f=n+a.ua;g-=q}if(0>=g){c/=1024;var w;e="";w?10<w&&(w=10):w=c&-65536?10:5;if(null==c||isNaN(c))for(;0<w--;)e="?"+e;else for(;0<w--;)e=String.fromCharCode(c%10+48)+e,c/=
10;a.status(e+"Kb "+ec[d]+" at "+qa(b));return!0}return dc(2,b,c)}function $b(a,b,c){var d=[];for(b>>>=a.ka;0<c&&b<a.W.length;)d.push(a.W[b++]),c-=a.ua;return d}function Zb(a,b,c,d){var e=0;for(b>>>=a.ka;0<c&&b<a.W.length;){var f=d[e++];if(!f)break;a.W[b++]=f;c-=a.ua}}k.zb=function(a){return this.W[(a&this.g)>>>this.ka].Pb(a&this.w,a)};k.Mb=function(a){this.f++;a=this.W[(a&this.g)>>>this.ka].ac(a&this.w,a);this.f--;return a};k.oa=function(a){return this.W[(a&this.g)>>>this.ka].pa(a&this.w,a)};
k.lb=function(a){var b=a&this.w,c=(a&this.g)>>>this.ka;this.f++;a=this.W[c].bc(b,a);this.f--;return a};k.Qb=function(a,b){this.W[(a&this.g)>>>this.ka].Tb(a&this.w,b&255,a)};k.fb=function(a,b){this.f++;this.W[(a&this.g)>>>this.ka].Ub(a&this.w,b&255,a);this.f--};k.hb=function(a,b){this.W[(a&this.g)>>>this.ka].Fb(a&this.w,b&65535,a)};k.Rb=function(a,b){var c=a&this.w,d=(a&this.g)>>>this.ka;this.f++;this.W[d].fc(c,b&65535,a);this.f--};
function fc(a){for(var b=0,c=[],d=0;d<a.C;d++){var e=a.W[d];if(e.La||e.Kc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,m=[];g<e.length;){for(var n=e[g],q=g+1;q<e.length&&e[q]===n;)q++;m[h++]=q-g;m[h++]=n;g=q}m.length<e.length&&(e=m)}c[f]=e}}return c}function gc(a,b,c,d,e,f,g,h){for(;b<=c;b+=2){var m=b&Wb;void 0!==a.Pa[m]?p("I/O address already registered: "+l(b,8,!0)):a.Pa[m]=[d,e,f,g,h||"unknown",!1]}}
function hc(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.b.mb)){var g=f[0]?f[0].bind(b):null,h=f[1]?f[1].bind(b):null,m=f[2]?f[2].bind(b):null,n=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&m&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!h&&n&&(h=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));gc(a,e,e,g,h,m,n,f[4])}}}function ic(a,b){a.A.push(b)}
function jc(a,b,c){a.f||(a.i&&F(a.i,64)&&(E(a.i,"memory fault ("+c+") on address "+J(a.i,b),!0,!0),cc(a.i)),a.b.ja(4,b))}function dc(a,b,c){p("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}function K(a){r.call(this,"Device",a,K,256);this.g={data:0,oe:0,Ob:20,Ed:0};this.f={se:0,ec:-1}}u(K);k=K.prototype;
k.wa=function(a,b,c,d){this.w=b;this.b=c;this.i=d;var e=this;this.f.ec=kc(c,function(){e.f.Ra|=128;e.f.Ra&64&&(lc(e.b,e.f.Fd),mc(e.b,e.f.ec,1E3/60))});this.f.Fd=nc(64,6);hc(b,this,L);ic(b,this.reset.bind(this));G(this)};k.reset=function(){this.g.Ob=this.g.Ob&-120|20;this.f.Ra=0};k.$c=function(){var a=this.f.Ra;this.f.Ra&=-129;return a};k.Od=function(a){this.f.Ra=a;a&64&&mc(this.b,this.f.ec,1E3/60);this.f.Ra=a&-129};k.Tc=function(a){return(a?this.g.Ed:this.g.data)&65535};
k.Hd=function(a){this.g.data=a};k.bd=function(){var a=this.b;return a.C&62337|a.Ea<<5|a.Fa<<1};k.Qd=function(a){var b=this.b;a&=62337;if(b.C!=a){b.C=a;b.Ea=a>>5&3;b.Fa=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Sa!=c&&(b.Sa=c,oc(b))}pc(this)};k.cd=function(){var a=this.b.Ua;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.dd=function(){return this.b.Db};k.ed=function(){return this.b.Va};
k.Rd=function(a){var b=this.b;1170>b.mb&&(a&=-49);b.Va!=a&&(b.Va=a,a&16?(b.xb=4194303,b.$a=3915776):(b.xb=262143,b.$a=253952),oc(b));pc(this)};function pc(a){a.g.Ob=a.g.Ob&-8|(a.b.Sa?a.b.Va&16?1:2:4)}k.td=function(a){return this.b.V[1][a>>1&7]};k.ee=function(a,b){this.b.V[1][b>>1&7]=a&65295};k.rd=function(a){return this.b.V[1][(a>>1&7)+8]};k.ce=function(a,b){this.b.V[1][(b>>1&7)+8]=a&65295};k.sd=function(a){return this.b.ta[1][a>>1&7]};
k.de=function(a,b){b=b>>1&7;this.b.ta[1][b]=a;this.b.V[1][b]&=65295};k.qd=function(a){return this.b.ta[1][(a>>1&7)+8]};k.be=function(a,b){b=(b>>1&7)+8;this.b.ta[1][b]=a;this.b.V[1][b]&=65295};k.Zc=function(a){return this.b.V[0][a>>1&7]};k.Nd=function(a,b){this.b.V[0][b>>1&7]=a&65295};k.Xc=function(a){return this.b.V[0][(a>>1&7)+8]};k.Ld=function(a,b){this.b.V[0][(b>>1&7)+8]=a&65295};k.Yc=function(a){return this.b.ta[0][a>>1&7]};k.Md=function(a,b){b=b>>1&7;this.b.ta[0][b]=a;this.b.V[0][b]&=65295};
k.Wc=function(a){return this.b.ta[0][(a>>1&7)+8]};k.Kd=function(a,b){b=(b>>1&7)+8;this.b.ta[0][b]=a;this.b.V[0][b]&=65295};k.zd=function(a){return this.b.V[3][a>>1&7]};k.ke=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.xd=function(a){return this.b.V[3][(a>>1&7)+8]};k.ie=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.yd=function(a){return this.b.ta[3][a>>1&7]};k.je=function(a,b){b=b>>1&7;this.b.ta[3][b]=a;this.b.V[3][b]&=65295};k.wd=function(a){return this.b.ta[3][(a>>1&7)+8]};
k.he=function(a,b){b=(b>>1&7)+8;this.b.ta[3][b]=a;this.b.V[3][b]&=65295};k.qb=function(a){a&=7;return this.b.M&2048?this.b.Na[a]:this.b.u[a]};k.ub=function(a,b){b&=7;this.b.M&2048?this.b.Na[b]=a:this.b.u[b]=a};k.kd=function(){return this.b.M&49152?this.b.Aa[0]:this.b.u[6]};k.Wd=function(a){this.b.M&49152?this.b.Aa[0]=a:this.b.u[6]=a};k.nd=function(){return this.b.u[7]};k.Zd=function(a){this.b.u[7]=a};k.rb=function(a){a&=7;return this.b.M&2048?this.b.u[a]:this.b.Na[a]};
k.vb=function(a,b){b&=7;this.b.M&2048?this.b.u[b]=a:this.b.Na[b]=a};k.ld=function(){return 1==(this.b.M&49152)>>14?this.b.u[6]:this.b.Aa[1]};k.Xd=function(a){1==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.Aa[1]=a};k.md=function(){return 3==(this.b.M&49152)>>14?this.b.u[6]:this.b.Aa[3]};k.Yd=function(a){3==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.Aa[3]=a};k.Vc=function(a){return this.b.yc[a-65504>>1]};k.Jd=function(a,b){this.b.yc[b-65504>>1]=a};k.vc=function(a){return 65520==a?61183:0};k.Cc=function(){};
k.vd=function(){return 1};k.ge=function(){};k.Uc=function(){return this.b.ca};k.Id=function(){this.b.ca=0};k.ad=function(){return this.b.xc};k.Pd=function(a,b){b&1||(a&=255);this.b.xc=a};k.fd=function(a){return a?this.b.dc:0};k.Sd=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.dc=a;b.H|=2};k.ud=function(a){return a?this.b.Wa&65280:0};k.fe=function(a){this.b.Wa=a|255};k.jd=function(){return Bb(this.b)};k.Vd=function(a){qc(this.b,a&-1809|Bb(this.b)&1808);this.b.H|=128};
k.Bc=function(a,b){F(this)&&E(this,"writeIgnored("+qa(b)+"): "+qa(a),!0,!0)};
var M={},L=(M[62592]=[null,null,K.prototype.td,K.prototype.ee,"SISDR",1145],M[62608]=[null,null,K.prototype.rd,K.prototype.ce,"SDSDR",1145],M[62624]=[null,null,K.prototype.sd,K.prototype.de,"SISAR",1145],M[62640]=[null,null,K.prototype.qd,K.prototype.be,"SDSAR",1145],M[62656]=[null,null,K.prototype.Zc,K.prototype.Nd,"KISDR",1145],M[62672]=[null,null,K.prototype.Xc,K.prototype.Ld,"KDSDR",1145],M[62688]=[null,null,K.prototype.Yc,K.prototype.Md,"KISAR",1145],M[62704]=[null,null,K.prototype.Wc,K.prototype.Kd,
"KDSAR",1145],M[62798]=[null,null,K.prototype.ed,K.prototype.Rd,"MMR3",1145],M[65382]=[null,null,K.prototype.$c,K.prototype.Od,"LKS"],M[65400]=[null,null,K.prototype.Tc,K.prototype.Hd,"CNSL"],M[65402]=[null,null,K.prototype.bd,K.prototype.Qd,"MMR0",1145],M[65404]=[null,null,K.prototype.cd,K.prototype.Bc,"MMR1",1145],M[65406]=[null,null,K.prototype.dd,K.prototype.Bc,"MMR2",1145],M[65408]=[null,null,K.prototype.zd,K.prototype.ke,"UISDR",1145],M[65424]=[null,null,K.prototype.xd,K.prototype.ie,"UDSDR",
1145],M[65440]=[null,null,K.prototype.yd,K.prototype.je,"UISAR",1145],M[65456]=[null,null,K.prototype.wd,K.prototype.he,"UDSAR",1145],M[65472]=[null,null,K.prototype.qb,K.prototype.ub,"R0SET0"],M[65473]=[null,null,K.prototype.qb,K.prototype.ub,"R1SET0"],M[65474]=[null,null,K.prototype.qb,K.prototype.ub,"R2SET0"],M[65475]=[null,null,K.prototype.qb,K.prototype.ub,"R3SET0"],M[65476]=[null,null,K.prototype.qb,K.prototype.ub,"R4SET0"],M[65477]=[null,null,K.prototype.qb,K.prototype.ub,"R5SET0"],M[65478]=
[null,null,K.prototype.kd,K.prototype.Wd,"R6KERNEL"],M[65479]=[null,null,K.prototype.nd,K.prototype.Zd,"R7KERNEL"],M[65480]=[null,null,K.prototype.rb,K.prototype.vb,"R0SET1",1145],M[65481]=[null,null,K.prototype.rb,K.prototype.vb,"R1SET1",1145],M[65482]=[null,null,K.prototype.rb,K.prototype.vb,"R2SET1",1145],M[65483]=[null,null,K.prototype.rb,K.prototype.vb,"R3SET1",1145],M[65484]=[null,null,K.prototype.rb,K.prototype.vb,"R4SET1",1145],M[65485]=[null,null,K.prototype.rb,K.prototype.vb,"R5SET1",1145],
M[65486]=[null,null,K.prototype.ld,K.prototype.Xd,"R6SUPER",1145],M[65487]=[null,null,K.prototype.md,K.prototype.Yd,"R6USER",1145],M[65504]=[null,null,K.prototype.Vc,K.prototype.Jd,"CTRL",1170],M[65520]=[null,null,K.prototype.vc,K.prototype.Cc,"LSIZE",1170],M[65522]=[null,null,K.prototype.vc,K.prototype.Cc,"HSIZE",1170],M[65524]=[null,null,K.prototype.vd,K.prototype.ge,"SYSID",1170],M[65526]=[null,null,K.prototype.Uc,K.prototype.Id,"CPUERR",1170],M[65528]=[null,null,K.prototype.ad,K.prototype.Pd,
"MB",1170],M[65530]=[null,null,K.prototype.fd,K.prototype.Sd,"PIR"],M[65532]=[null,null,K.prototype.ud,K.prototype.fe,"SL"],M[65534]=[null,null,K.prototype.jd,K.prototype.Vd,"PSW"],M);L[62594]=L[62592];L[62596]=L[62592];L[62598]=L[62592];L[62600]=L[62592];L[62602]=L[62592];L[62604]=L[62592];L[62606]=L[62592];L[62610]=L[62608];L[62612]=L[62608];L[62614]=L[62608];L[62616]=L[62608];L[62618]=L[62608];L[62620]=L[62608];L[62622]=L[62608];L[62626]=L[62624];L[62628]=L[62624];L[62630]=L[62624];L[62632]=L[62624];
var wb="undefined"!==typeof ArrayBuffer,xb={cpu:1,trap:16,bus:64,memory:128,device:256,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function yb(a){r.call(this,"Panel",a,yb);this.f=0;this.A.kc=!0}w(yb);k=yb.prototype;
k.sa=function(a,b,c,d){if(this.B&&this.B.sa(a,b,c,d)||this.b&&this.b.sa(a,b,c,d)||this.i&&this.i.sa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.G[b]=c,this.f++,!0;default:return"rled"==a?(this.G[b]=c,this.f++,!0):this.parent.sa.call(this,a,b,c,d)}};k.Ca=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d};k.Ea=function(a,b){b||zb();return!0};k.Da=function(){return!0};
function Ab(a,b,c,d){if(a.G[b]){void 0===c&&(vb(a,"Value for "+b+" is invalid"),a.b.ja());var e=a.i&&a.i.$||8;c=!a.b.A.ga||a.A.kc?8==e?ra(c,d):l(c,d):"--------".substr(0,d||4);a.G[b].textContent!=c&&(a.G[b].textContent=c)}}function Bb(a,b,c,d){for(var e=0;e<d;e++){var f=a.G[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
k.da=function(a){if(this.f&&(a||!this.b.A.ga||this.A.kc)){for(a=0;a<this.b.u.length;a++)Ab(this,"R"+a,this.b.u[a]);a=Cb(this.b);Ab(this,"PS",a);Ab(this,"NF",a&8?1:0,1);Ab(this,"ZF",a&4?1:0,1);Ab(this,"VF",a&2?1:0,1);Ab(this,"CF",a&1?1:0,1);Bb(this,"D",this.b.u[0],16);Bb(this,"A",this.b.u[7],22)}};function zb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=pb(e.id);f||(a=!0,f=new yb(e));C(f,d);a&&G(f)}}Xa(zb);
function Db(a,b,c){r.call(this,"Bus",a,Db,64);this.b=b;this.i=c;this.N=a.busWidth||16;this.v=0;this.L=[];this.I=null;this.J=Math.pow(2,this.N);this.g=this.J-1|0;this.xa=Rb;this.la=Math.log2(this.xa);this.K=this.xa>>2;this.w=this.xa-1;this.F=this.J/this.xa|0;this.Ta=[];this.f=0;this.B=!1;this.C=[];this.Gc=[Sb,Tb,Ub,Vb];a=new I(this);Wb(a,this.i);this.W=Array(this.F);for(b=0;b<this.F;b++)this.W[b]=a;G(this)}w(Db);var Rb=8192,Xb=Rb-1;
function Sb(a,b){var c=-1,d=this.controller,e=d.Ta[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.Ta[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.i&&F(this.i,64)&&E(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Yb(d,b,!0);this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
function Tb(a,b,c){var d=!1,e=this.controller,f=e.Ta[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.Ta[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d?this.i&&F(this.i,64)&&E(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Yb(e,c,!0,b),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
function Ub(a,b){var c=-1,d=this.controller;(a=d.Ta[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.i&&F(this.i,64)&&E(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Yb(d,b,!1);this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
function Vb(a,b,c){var d=!1,e=this.controller;if(a=e.Ta[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.i&&F(this.i,64)&&E(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Yb(e,c,!1,b),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
function Zb(a,b){if(b!=a.v){var c;a.v&&(c=(1<<a.v)-Rb,$b(a,c,Rb,a.L),a.v=0);b&&(a.v=b,c=(1<<b)-Rb,a.L=ac(a,c,Rb),a.I?$b(a,c,Rb,a.I):(bc(a,c,Rb,cc,a),a.I=ac(a,c,Rb)))}}k=Db.prototype;k.reset=function(){for(var a=0;a<this.C.length;a++)this.C[a]();Zb(this,16)};function Yb(a,b,c,d){a.i&&F(a.i,536870912)&&(E(a.i,"warning: unknown I/O access ("+J(a.i,b)+","+J(a.i,d,c?1:2)+")",!0,!0),dc(a.i));a.f||(a.b.Z|=16,a.b.ka(4,b));return 0}k.Ea=function(a,b){b||this.reset();return!0};
function bc(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.la;0<g&&h<a.W.length;){var m=a.W[h],n=h*a.xa,p=a.xa-(f-n);p>g&&(p=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.D)return m.Jb+=m.D-f,m.D=f,!0;if(f>=m.D+m.Jb){p=m.size-(f-n);p>g&&(p=g);m.Jb=f-m.D+p;f=n+a.xa;g-=p;h++;continue}}return ec(1,f,g)}f=new I(a,f,p,a.xa,d,e);Wb(f,a.i,m);a.W[h++]=f;f=n+a.xa;g-=p}if(0>=g){c/=1024;var u;e="";u?10<u&&(u=10):u=c&-65536?10:5;if(null==c||isNaN(c))for(;0<u--;)e="?"+e;else for(;0<u--;)e=String.fromCharCode(c%10+48)+e,c/=
10;a.status(e+"Kb "+fc[d]+" at "+ra(b));return!0}return ec(2,b,c)}function ac(a,b,c){var d=[];for(b>>>=a.la;0<c&&b<a.W.length;)d.push(a.W[b++]),c-=a.xa;return d}function $b(a,b,c,d){var e=0;for(b>>>=a.la;0<c&&b<a.W.length;){var f=d[e++];if(!f)break;a.W[b++]=f;c-=a.xa}}k.Db=function(a){return this.W[(a&this.g)>>>this.la].Rb(a&this.w,a)};k.Pb=function(a){this.B=!1;this.f++;a=this.W[(a&this.g)>>>this.la].bc(a&this.w,a);this.f--;return a};
k.pa=function(a){return this.W[(a&this.g)>>>this.la].ra(a&this.w,a)};k.ib=function(a){var b=a&this.w,c=(a&this.g)>>>this.la;this.B=!1;this.f++;a=this.W[c].cc(b,a);this.f--;return a};k.Sb=function(a,b){this.W[(a&this.g)>>>this.la].Ub(a&this.w,b&255,a)};k.kb=function(a,b){this.B=!1;this.f++;this.W[(a&this.g)>>>this.la].Vb(a&this.w,b&255,a);this.f--};k.mb=function(a,b){this.W[(a&this.g)>>>this.la].Kb(a&this.w,b&65535,a)};
k.Ib=function(a,b){var c=a&this.w,d=(a&this.g)>>>this.la;this.B=!1;this.f++;this.W[d].gc(c,b&65535,a);this.f--};function gc(a){for(var b=0,c=[],d=0;d<a.F;d++){var e=a.W[d];if(e.Pa||e.Mc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,m=[];g<e.length;){for(var n=e[g],p=g+1;p<e.length&&e[p]===n;)p++;m[h++]=p-g;m[h++]=n;g=p}m.length<e.length&&(e=m)}c[f]=e}}return c}
function hc(a,b,c,d,e,f,g,h){for(;b<=c;b+=2){var m=b&Xb;void 0!==a.Ta[m]?q("I/O address already registered: "+l(b,8,!0)):a.Ta[m]=[d,e,f,g,h||"unknown",!1]}}
function ic(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.b.qb)){var g=f[0]?f[0].bind(b):null,h=f[1]?f[1].bind(b):null,m=f[2]?f[2].bind(b):null,n=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&m&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!h&&n&&(h=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));hc(a,e,e,g,h,m,n,f[4])}}}function jc(a,b){a.C.push(b)}
function kc(a,b,c){a.f||(a.i&&F(a.i,64)&&(E(a.i,"memory fault ("+c+") on address "+J(a.i,b),!0,!0),dc(a.i)),a.b.ka(4,b));a.B=!0}function lc(a){var b=a.B;a.B=!1;return b}function ec(a,b,c){q("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}function K(a){r.call(this,"Device",a,K,256);this.g={data:0,Ce:0,Qb:20,Md:0};this.f={fa:0,fc:-1}}w(K);k=K.prototype;
k.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;var e=this;this.f.fc=mc(c,function(){e.f.Va|=128;e.f.Va&64&&(nc(e.b,e.f.Nd),oc(e.b,e.f.fc,1E3/60))});this.f.Nd=pc(64,6);ic(b,this,L);jc(b,this.reset.bind(this));G(this)};k.reset=function(){this.g.Qb=this.g.Qb&-120|20;this.f.Va=0};k.cd=function(){var a=this.f.Va;this.f.Va&=-129;return a};k.Xd=function(a){this.f.Va=a;a&64&&oc(this.b,this.f.fc,1E3/60);this.f.Va=a&-129};k.Vc=function(a){return(a?this.g.Md:this.g.data)&65535};
k.Pd=function(a){this.g.data=a};k.ed=function(){var a=this.b;return a.C&62337|a.Ja<<5|a.Ka<<1};k.Zd=function(a){var b=this.b;a&=62337;if(b.C!=a){b.C=a;b.Ja=a>>5&3;b.Ka=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Wa!=c&&(b.Wa=c,qc(b))}rc(this)};k.fd=function(){var a=this.b.Ya;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.gd=function(){return this.b.Hb};k.hd=function(){return this.b.Za};
k.$d=function(a){var b=this.b;1170>b.qb&&(a&=-49);b.Za!=a&&(b.Za=a,a&16?(b.Bb=4194303,b.eb=3915776):(b.Bb=262143,b.eb=253952),qc(b));rc(this)};function rc(a){a.g.Qb=a.g.Qb&-8|(a.b.Wa?a.b.Za&16?1:2:4)}k.Bd=function(a){return this.b.V[1][a>>1&7]};k.se=function(a,b){this.b.V[1][b>>1&7]=a&65295};k.zd=function(a){return this.b.V[1][(a>>1&7)+8]};k.qe=function(a,b){this.b.V[1][(b>>1&7)+8]=a&65295};k.Ad=function(a){return this.b.wa[1][a>>1&7]};
k.re=function(a,b){b=b>>1&7;this.b.wa[1][b]=a;this.b.V[1][b]&=65295};k.yd=function(a){return this.b.wa[1][(a>>1&7)+8]};k.pe=function(a,b){b=(b>>1&7)+8;this.b.wa[1][b]=a;this.b.V[1][b]&=65295};k.bd=function(a){return this.b.V[0][a>>1&7]};k.Wd=function(a,b){this.b.V[0][b>>1&7]=a&65295};k.$c=function(a){return this.b.V[0][(a>>1&7)+8]};k.Ud=function(a,b){this.b.V[0][(b>>1&7)+8]=a&65295};k.ad=function(a){return this.b.wa[0][a>>1&7]};k.Vd=function(a,b){b=b>>1&7;this.b.wa[0][b]=a;this.b.V[0][b]&=65295};
k.Zc=function(a){return this.b.wa[0][(a>>1&7)+8]};k.Td=function(a,b){b=(b>>1&7)+8;this.b.wa[0][b]=a;this.b.V[0][b]&=65295};k.Hd=function(a){return this.b.V[3][a>>1&7]};k.ye=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.Fd=function(a){return this.b.V[3][(a>>1&7)+8]};k.we=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.Gd=function(a){return this.b.wa[3][a>>1&7]};k.xe=function(a,b){b=b>>1&7;this.b.wa[3][b]=a;this.b.V[3][b]&=65295};k.Ed=function(a){return this.b.wa[3][(a>>1&7)+8]};
k.ve=function(a,b){b=(b>>1&7)+8;this.b.wa[3][b]=a;this.b.V[3][b]&=65295};k.ub=function(a){a&=7;return this.b.M&2048?this.b.Ra[a]:this.b.u[a]};k.yb=function(a,b){b&=7;this.b.M&2048?this.b.Ra[b]=a:this.b.u[b]=a};k.nd=function(){return this.b.M&49152?this.b.Fa[0]:this.b.u[6]};k.ee=function(a){this.b.M&49152?this.b.Fa[0]=a:this.b.u[6]=a};k.qd=function(){return this.b.u[7]};k.he=function(a){this.b.u[7]=a};k.vb=function(a){a&=7;return this.b.M&2048?this.b.u[a]:this.b.Ra[a]};
k.zb=function(a,b){b&=7;this.b.M&2048?this.b.u[b]=a:this.b.Ra[b]=a};k.od=function(){return 1==(this.b.M&49152)>>14?this.b.u[6]:this.b.Fa[1]};k.fe=function(a){1==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.Fa[1]=a};k.pd=function(){return 3==(this.b.M&49152)>>14?this.b.u[6]:this.b.Fa[3]};k.ge=function(a){3==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.Fa[3]=a};k.Xc=function(a){return this.b.zc[a-65504>>1]};k.Rd=function(a,b){this.b.zc[b-65504>>1]=a};k.wc=function(a){return 65520==a?61183:0};k.Dc=function(){};
k.Dd=function(){return 1};k.ue=function(){};k.Wc=function(){return this.b.Z};k.Qd=function(){this.b.Z=0};k.dd=function(){return this.b.yc};k.Yd=function(a,b){b&1||(a&=255);this.b.yc=a};k.jd=function(a){return a?this.b.ec:0};k.ae=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.ec=a;b.H|=2};k.Cd=function(a){return a?this.b.$a&65280:0};k.te=function(a){this.b.$a=a|255};k.md=function(){return Cb(this.b)};k.de=function(a){sc(this.b,a&-1809|Cb(this.b)&1808);this.b.H|=128};
k.Cc=function(a,b){F(this)&&E(this,"writeIgnored("+ra(b)+"): "+ra(a),!0,!0)};
var M={},L=(M[62592]=[null,null,K.prototype.Bd,K.prototype.se,"SISDR",1145],M[62608]=[null,null,K.prototype.zd,K.prototype.qe,"SDSDR",1145],M[62624]=[null,null,K.prototype.Ad,K.prototype.re,"SISAR",1145],M[62640]=[null,null,K.prototype.yd,K.prototype.pe,"SDSAR",1145],M[62656]=[null,null,K.prototype.bd,K.prototype.Wd,"KISDR",1145],M[62672]=[null,null,K.prototype.$c,K.prototype.Ud,"KDSDR",1145],M[62688]=[null,null,K.prototype.ad,K.prototype.Vd,"KISAR",1145],M[62704]=[null,null,K.prototype.Zc,K.prototype.Td,
"KDSAR",1145],M[62798]=[null,null,K.prototype.hd,K.prototype.$d,"MMR3",1145],M[65382]=[null,null,K.prototype.cd,K.prototype.Xd,"LKS"],M[65400]=[null,null,K.prototype.Vc,K.prototype.Pd,"CNSL"],M[65402]=[null,null,K.prototype.ed,K.prototype.Zd,"MMR0",1145],M[65404]=[null,null,K.prototype.fd,K.prototype.Cc,"MMR1",1145],M[65406]=[null,null,K.prototype.gd,K.prototype.Cc,"MMR2",1145],M[65408]=[null,null,K.prototype.Hd,K.prototype.ye,"UISDR",1145],M[65424]=[null,null,K.prototype.Fd,K.prototype.we,"UDSDR",
1145],M[65440]=[null,null,K.prototype.Gd,K.prototype.xe,"UISAR",1145],M[65456]=[null,null,K.prototype.Ed,K.prototype.ve,"UDSAR",1145],M[65472]=[null,null,K.prototype.ub,K.prototype.yb,"R0SET0"],M[65473]=[null,null,K.prototype.ub,K.prototype.yb,"R1SET0"],M[65474]=[null,null,K.prototype.ub,K.prototype.yb,"R2SET0"],M[65475]=[null,null,K.prototype.ub,K.prototype.yb,"R3SET0"],M[65476]=[null,null,K.prototype.ub,K.prototype.yb,"R4SET0"],M[65477]=[null,null,K.prototype.ub,K.prototype.yb,"R5SET0"],M[65478]=
[null,null,K.prototype.nd,K.prototype.ee,"R6KERNEL"],M[65479]=[null,null,K.prototype.qd,K.prototype.he,"R7KERNEL"],M[65480]=[null,null,K.prototype.vb,K.prototype.zb,"R0SET1",1145],M[65481]=[null,null,K.prototype.vb,K.prototype.zb,"R1SET1",1145],M[65482]=[null,null,K.prototype.vb,K.prototype.zb,"R2SET1",1145],M[65483]=[null,null,K.prototype.vb,K.prototype.zb,"R3SET1",1145],M[65484]=[null,null,K.prototype.vb,K.prototype.zb,"R4SET1",1145],M[65485]=[null,null,K.prototype.vb,K.prototype.zb,"R5SET1",1145],
M[65486]=[null,null,K.prototype.od,K.prototype.fe,"R6SUPER",1145],M[65487]=[null,null,K.prototype.pd,K.prototype.ge,"R6USER",1145],M[65504]=[null,null,K.prototype.Xc,K.prototype.Rd,"CTRL",1170],M[65520]=[null,null,K.prototype.wc,K.prototype.Dc,"LSIZE",1170],M[65522]=[null,null,K.prototype.wc,K.prototype.Dc,"HSIZE",1170],M[65524]=[null,null,K.prototype.Dd,K.prototype.ue,"SYSID",1170],M[65526]=[null,null,K.prototype.Wc,K.prototype.Qd,"CPUERR",1170],M[65528]=[null,null,K.prototype.dd,K.prototype.Yd,
"MB",1170],M[65530]=[null,null,K.prototype.jd,K.prototype.ae,"PIR"],M[65532]=[null,null,K.prototype.Cd,K.prototype.te,"SL"],M[65534]=[null,null,K.prototype.md,K.prototype.de,"PSW"],M);L[62594]=L[62592];L[62596]=L[62592];L[62598]=L[62592];L[62600]=L[62592];L[62602]=L[62592];L[62604]=L[62592];L[62606]=L[62592];L[62610]=L[62608];L[62612]=L[62608];L[62614]=L[62608];L[62616]=L[62608];L[62618]=L[62608];L[62620]=L[62608];L[62622]=L[62608];L[62626]=L[62624];L[62628]=L[62624];L[62630]=L[62624];L[62632]=L[62624];
L[62634]=L[62624];L[62636]=L[62624];L[62638]=L[62624];L[62642]=L[62640];L[62644]=L[62640];L[62646]=L[62640];L[62648]=L[62640];L[62650]=L[62640];L[62652]=L[62640];L[62654]=L[62640];L[62658]=L[62656];L[62660]=L[62656];L[62662]=L[62656];L[62664]=L[62656];L[62666]=L[62656];L[62668]=L[62656];L[62670]=L[62656];L[62674]=L[62672];L[62676]=L[62672];L[62678]=L[62672];L[62680]=L[62672];L[62682]=L[62672];L[62684]=L[62672];L[62686]=L[62672];L[62690]=L[62688];L[62692]=L[62688];L[62694]=L[62688];L[62696]=L[62688];
L[62698]=L[62688];L[62700]=L[62688];L[62702]=L[62688];L[62706]=L[62704];L[62708]=L[62704];L[62710]=L[62704];L[62712]=L[62704];L[62714]=L[62704];L[62716]=L[62704];L[62718]=L[62704];L[65410]=L[65408];L[65412]=L[65408];L[65414]=L[65408];L[65416]=L[65408];L[65418]=L[65408];L[65420]=L[65408];L[65422]=L[65408];L[65426]=L[65424];L[65428]=L[65424];L[65430]=L[65424];L[65432]=L[65424];L[65434]=L[65424];L[65436]=L[65424];L[65438]=L[65424];L[65442]=L[65440];L[65444]=L[65440];L[65446]=L[65440];L[65448]=L[65440];
L[65450]=L[65440];L[65452]=L[65440];L[65454]=L[65440];L[65458]=L[65456];L[65460]=L[65456];L[65462]=L[65456];L[65464]=L[65456];L[65466]=L[65456];L[65468]=L[65456];L[65470]=L[65456];L[65506]=L[65504];L[65508]=L[65504];L[65510]=L[65504];L[65512]=L[65504];L[65514]=L[65504];L[65516]=L[65504];L[65518]=L[65504];
Wa(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=A(d);switch(c.type){case "default":c=new K(c);C(c,d);break;case "pc11":c=new rc(c);C(c,d);break;case "rl11":c=new sc(c),C(c,d)}}});var tc;if(vb){var uc=new ArrayBuffer(2);(new DataView(uc)).setUint16(0,256,!0);tc=256===(new Uint16Array(uc))[0]}else tc=!1;var Ec=tc;
function I(a,b,c,d,e,f){this.w=a;this.id=Fc+=2;this.b=null;this.D=b;this.Eb=c;this.size=d||0;this.type=e||Gc;this.f=e==Hc;this.controller=null;Vb(this);this.La=this.Kc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],Ic(this,f.Fc);else if(vb)this.C=new ArrayBuffer(this.size),this.G=new DataView(this.C,0,this.size),this.F=new Uint8Array(this.C,0,this.size),this.J=new Uint16Array(this.C,0,this.size>>1),this.b=new Int32Array(this.C,0,this.size>>2),Ic(this,Ec?Jc:Kc);else{a=this.b=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;Ic(this,Lc)}else Ic(this)}var Gc=0,Hc=2,bc=4,ec=["NONE","RAM","ROM","VID","H/W"],Fc=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(vb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.G.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(vb)for(b=0;b<a.length;b++)this.G.setInt32(b<<2,a[b],!0);else this.b=a;return this.La=!0}return!1},cb:function(a,b){b?this.B++||Mc(this,Nc,!1):this.g++||Oc(this,Nc,!1)},K:function(a,b){this.i&&F(this.i,128)&&(E(this.i,
"attempt to read invalid address "+J(this.i,b),!0),cc(this.i));jc(this.w,b,2);return 255},A:function(a,b,c){this.i&&F(this.i,128)&&(E(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0),cc(this.i));jc(this.w,c,4)},L:function(a,b){return this.Pb(a++,b++)|this.Pb(a,b)<<8},I:function(a,b,c){this.Tb(a++,b&255,c++);this.Tb(a,b>>8,c)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ba:function(a,b){a&1&&jc(this.w,b,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:
c&255|(this.b[b+1]&255)<<8},sa:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.La=!0},Fa:function(a,b,c){a&1&&jc(this.w,c,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.La=!0},P:function(a,b){if(this.i&&null!=this.D){var c=this.i;Pc(c,this.D+a,1,c.L)&&c.ia(!0)}return this.ac(a,b)},Y:function(a,b){if(this.i&&null!=this.D){var c=this.i;Pc(c,this.D+a,2,c.L)&&c.ia(!0)}return this.bc(a,
b)},ma:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Pc(d,this.D+a,1,d.C)&&d.ia(!0)}this.f?this.A(a,b,c):this.Ub(a,b,c)},va:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Pc(d,this.D+a,2,d.C)&&d.ia(!0)}this.f?this.A(a,b,c):this.fc(a,b,c)},N:function(a){return this.F[a]},R:function(a,b){a=this.F[a];this.i&&F(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},Ia:function(a,b){a&1&&jc(this.w,b,2);return this.G.getUint16(a,!0)},Z:function(a,b){a&1&&jc(this.w,
b,2);a=this.J[a>>1];this.i&&F(this.i,128)&&E(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},la:function(a,b){this.F[a]=b;this.La=!0},ra:function(a,b,c){this.F[a]=b;this.La=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},Za:function(a,b,c){a&1&&jc(this.w,c,4);this.G.setUint16(a,b,!0);this.La=!0},Ea:function(a,b,c){a&1&&jc(this.w,c,4);this.J[a>>1]=b;this.La=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,
b)+")",!0)}};function Vb(a,b,c){a.i=b;a.g=a.B=0;c&&((a.g=c.g)&&Oc(a,Nc,!1),(a.B=c.B)&&Mc(a,Nc,!1))}function Qc(a,b){b?--a.B||(a.Tb=a.f?a.A:a.Ub,a.Fb=a.f?a.I:a.fc):--a.g||(a.Pb=a.ac,a.pa=a.bc)}function Mc(a,b,c){c&&a.B||(a.Tb=!a.f&&b[1]||a.A,a.Fb=!a.f&&b[3]||a.I);if(c||void 0===c)a.Ub=b[1]||a.A,a.fc=b[3]||a.I}function Oc(a,b,c){c&&a.g||(a.Pb=b[0]||a.K,a.pa=b[2]||a.L);if(c||void 0===c)a.ac=b[0]||a.K,a.bc=b[2]||a.L}function Ic(a,b){b||(b=Rc);Oc(a,b,void 0);Mc(a,b,void 0)}
var Rc=[],Lc=[I.prototype.S,I.prototype.sa,I.prototype.ba,I.prototype.Fa],Nc=[I.prototype.P,I.prototype.ma,I.prototype.Y,I.prototype.va];if(vb)var Kc=[I.prototype.N,I.prototype.la,I.prototype.Ia,I.prototype.Za],Jc=[I.prototype.R,I.prototype.ra,I.prototype.Z,I.prototype.Ea];
function Sc(a,b){r.call(this,"CPU",a,Sc,1);var c=a.multiplier||1;this.Ya=a.cycles||b;this.Ta=c;this.wb=Math.round(this.Ya/1E4)/100;this.eb=this.wb*this.Ta;this.v.fa=!1;this.v.Sb=!1;this.v.ib=a.autoStart;this.v.kb=!1;this.Ab=this.ma=0;this.Bb=a.csStart;this.nb=a.csInterval;this.ob=a.csStop;this.K=[];this.tc=this.Dd.bind(this);G(this)}u(Sc);var Tc=["power","reset"];k=Sc.prototype;
k.wa=function(a,b,c,d){this.B=a;this.w=b;this.i=d;for(b=0;b<Tc.length;b++)(c=this.F[Tc[b]])&&this.B.qa(null,Tc[b],c);a=Uc(a,"autoStart");null!=a&&(this.v.ib="true"==a?!0:"false"==a?!1:!!a);G(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.za=function(a,b){if(!b){if(a&&this.restore){Vc(this);if(!this.restore(a))return!1;Wc(this)}else this.reset();this.i?(a=this.i,b=this.v.ib,a.ab=!0,a.j("Type ? for help with PDP11 Debugger commands"),a.da(),b||a.gb(),a.Fa&&(b=a.Fa,a.Fa=null,Xc(a,b))):this.j("No debugger detected")}this.B.da();return!0};k.ya=function(a){return a?this.save():!0};k.ib=function(){return this.v.ib||!this.i&&void 0===this.F.run?(this.sb(),!0):!1};k.nc=function(){return 0};
function Wc(a){void 0===a.Bb&&(a.Bb=0);void 0===a.nb&&(a.nb=-1);void 0===a.ob&&(a.ob=-1);a.v.kb=0<=a.Bb&&0<a.nb;a.v.kb&&(a.Ab=0,a.ma=a.Bb-a.la)}function Yc(a,b){if(a.v.kb){var c=!1;a.Ab=a.Ab+a.nc()|0;a.ma-=b;0>=a.ma&&(a.ma+=a.nb,c=!0);0<=a.ob&&a.ob<=Zc(a)&&(a.nb=a.ob=-1,Wc(a),a.ia(),c=!0);c&&a.j(Zc(a)+" cycles: checksum="+l(a.Ab))}}
k.qa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.F[b]=c,!0;case "run":return this.F[b]=c,c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.v.ha)a=!0;else{var b=null,c,h=nb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.v.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.v.ha);c++);c==h.length&&(b=a);p("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.Lb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.fa?d.ia():d.sb())},
!0;case "speed":return this.F[b]=c,!0;case "setSpeed":return this.F[b]=c,c.onclick=function(){$c(d,d.Ta<<1,!0)},c.textContent=this.eb.toFixed(2)+"Mhz",!0}return!1};k.da=function(){var a=this.F.speed;a&&(a.textContent=this.v.fa&&this.Y?this.Y.toFixed(2)+"Mhz":"Stopped")};function ad(a,b,c){a.la+=b;c&&(a.ba=a.b=a.J=0)}function bd(a,b){var c=1;b&&1<a.Ta&&a.Y&&(c=a.Y/a.wb);a.qc=Math.round(1E3/30);a.bb=Math.floor(a.Ya/30*c);b||(a.ra=a.bb);a.yb=0}function Zc(a){return a.la+a.S+a.ba-a.b}
function Vc(a){a.Y=0;a.rc=0;a.la=a.S=a.ba=a.b=a.J=0;Wc(a);$c(a,1)}function $c(a,b,c){var d=!1;if(void 0!==b){.8>a.Y/a.eb?b=1:d=!0;a.Ta=b;b=a.wb*a.Ta;if(a.eb!=b){a.eb=b;b=a.eb.toFixed(2)+"Mhz";var e=a.F.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.B&&a.B.gb()}ad(a,a.S);a.S=0;a.R=Aa();a.Z=0;bd(a);return d}function kc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function mc(a,b,c){0<=b&&b<a.K.length&&0>a.K[b][0]&&(c=a.Ya*a.Ta/1E3*c|0,a.K[b][0]=c+cd(a))}
function dd(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function ed(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function cd(a,b){var c=a.ba-=a.b;a.b=a.J=0;b&&(a.ba=0);return c}
k.Dd=function(){if(this.v.fa){this.yb>=this.Ya&&bd(this,!0);this.va=0;this.ab=Aa();if(this.Z){var a=this.ab-this.Z;a>this.qc&&(this.R+=a,this.R>this.ab&&(this.R=this.ab))}try{do{var b=dd(this,this.v.kb?1:this.bb);try{this.tb(b)}catch(e){if("number"!=typeof e)throw e;}b=cd(this,!0);this.va+=b;this.S+=b;Yc(this,b);ed(this,b);this.ra-=b;if(0>=this.ra){this.ra+=this.bb;15<=++this.rc&&(this.B&&this.B.da(),this.rc=0);break}}while(this.v.fa)}catch(e){this.ia();this.B&&this.B.stop(Aa(),Zc(this));ub(this,
e.stack||e.message);return}if(this.v.fa){a=setTimeout;b=this.tc;this.Z=Aa();var c=this.qc;this.va&&(c=Math.round(c*this.va/this.bb));var c=c-(this.Z-this.ab),d=this.Z-this.R;d&&(this.Y=Math.round(this.S/(10*d))/100,864E5<=d&&(this.la=0,$c(this)));if(0>c||this.Y<this.eb)-1E3>c&&(this.R-=c),c=0;this.yb+=this.va;this.Z+=c;a(b,c)}}};
k.sb=function(a){if(tb(this))return!1;if(this.v.fa)return this.j(this.toString()+" busy"),!1;$c(this);this.v.fa=!0;this.v.Sb=!0;var b=this.F.run;b&&(b.textContent="Halt");this.B&&(a&&this.B.gb(!0),this.B.start(this.R,Zc(this)));setTimeout(this.tc,0);return!0};k.tb=function(){return 0};k.ia=function(a){var b=!1;if(this.v.fa){cd(this);ad(this,this.S);this.S=0;this.v.fa=!1;if(b=this.F.run)b.textContent="Run";this.B&&this.B.stop(Aa(),Zc(this));b=!0}this.v.complete=a;return b};
function fd(a){this.mb=+a.model||1170;this.Kb=a.addrReset||0;Sc.call(this,a,6666667);this.decode=1120==this.mb?gd.bind(this):hd.bind(this);id(this);this.L=0;this.N=null;this.v.complete=!1}u(fd,Sc);k=fd.prototype;k.reset=function(){this.status("model "+this.mb);this.v.fa&&this.ia();id(this);Vc(this);this.v.error=!1;this.parent.reset.call(this)};
function id(a){a.T=65536;a.U=32768;a.$=65535;a.X=32768;a.M=15;a.u=[0,0,0,0,0,0,0,a.Kb];a.Na=[0,0,0,0,0,0];a.Aa=[0,0,0,0];a.A=0;a.Fa=0;a.Nc=[4,2,0,1];a.V=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ta=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Sc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.yc=[0,0,0,0,0,0,0,0];a.xc=0;a.H=0;a.G=a.I=0;a.g=a.f=a.jb=0;a.sa=-1;jd(a)}function jd(a){a.Wa=255;a.ca=0;a.dc=0;a.C=0;a.Ua=0;a.Db=0;a.Va=0;a.Sa=0;a.Ea=0;a.xb=262143;a.$a=253952;a.N=null;a.w&&oc(a)}function oc(a){a.Sa?(a.P=65536,a.aa=a.Mc,a.pa=a.Ad,a.Fb=a.le,Yb(a.w,a.Va&16?22:18)):(a.P=0,a.aa=a.Lc,a.pa=a.wc,a.Fb=a.Dc,Yb(a.w,16))}function kd(a,b,c){a.Kb=b;N(a,b);!c&&a.i&&(a.ia()||a.i.da())}k.nc=function(){return 0};
k.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.la,this.Ta]);a.set(2,fc(this.w));return a.data()};k.restore=function(a){var b=a[1];this.la=b[1];$c(this,b[3]);a:{b=this.w;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.J){for(var f=0,g=Array(b.J),h=0;h<e.length-1;)for(var m=e[h++],n=e[h++];m--;)g[f++]=n;e=g}f=b.W[d];if(!f||!f.restore(e)){p("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function ld(a){return a.T&65536?1:0}
function md(a){return a.U&32768?2:0}function nd(a){return a.$&65535?0:4}k.Ma=function(){return this.X&32768?8:0};function od(a){var b=a.u[7];a.C&57344||(a.Ua=0,a.Db=b);a.u[7]=b+2&65535;return a.pa(b)}function pd(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function N(a,b){a.u[7]=b&65535}function nc(a,b){return{Gd:a,pb:b,next:null}}function lc(a,b){if(b!=a.N){var c=a.N;if(!c||c.pb<=b.pb)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.pb<=b.pb){b.next=d;c.next=b;break}c=d}while(c)}}a.H|=2}
function Bb(a){return a.M=a.M&63728|a.Ma()|nd(a)|md(a)|ld(a)}function qc(a,b){a.X=b<<12;a.$=~b&4;a.U=b<<14;a.T=b<<16;if((b^a.M)&2048)for(var c=a.Na.length;0<=--c;){var d=a.u[c];a.u[c]=a.Na[c];a.Na[c]=d}a.A=b>>14&3;c=a.M>>14&3;a.A!=c&&(a.Aa[c]=a.u[6],a.u[6]=a.Aa[a.A]);a.M=b;a.H|=2}function Q(a,b){a.H&128||(a.X=a.$=b,a.U=0)}function qd(a,b,c){a.H&128||(a.X=a.$=a.T=b,a.U=c||0)}function rd(a,b,c,d){a.H&128||(a.X=a.$=a.T=b,a.U=(c^b)&(d^b))}function sd(a,b){a.H&128||(a.X=a.$=a.T=b,a.U=a.X^a.T>>1)}
function td(a,b,c,d){a.H&128||(a.X=a.$=a.T=b,a.U=(c^d)&(d^b))}k.ja=function(a,b){if(!this.L){var c=!1;0>this.sa?this.sa=Bb(this):this.A||(a=4,c=!0);this.C&57344||(this.Ua=63222,this.Db=a);this.A=0;var d=this.pa(a|this.P),e=this.pa(a+2&65535|this.P);qc(this,e&-12289|this.sa>>2&12288);c&&(this.ca|=4,this.u[6]=4);ud(this,this.sa);ud(this,this.u[7]);N(this,d);this.H&=-113;this.sa=-1;this.H|=8;this.Rc=a;this.Qc=b;if(26!=b)throw a;}};
function Md(a){var b=Nd(a),c=Nd(a)&-1793;a.M&49152&&(c=c&-225|a.M&63712);N(a,b);qc(a,c);a.H&=-17}
function Od(a,b,c){var d,e,f,g=0;d=b>>13;a.Va&a.Nc[a.A]||(d&=7);e=a.V[a.A][d];f=(a.ta[a.A][d]<<6)+(b&8191)&a.xb;if(f<a.$a)f&1&&!(c&1)&&(a.ca|=64,a.ja(4,10));else if(a.Va&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var h=f>>13&31;31>h?a.Va&32&&(f=a.Sc[h]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.$a&&4186112>f&&(a.ca|=32,a.ja(4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&
4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.V[a.A][d]=e;if(4194170!==f||a.A)a.Ea=a.A,a.Fa=d;g&&(g&57344&&(0<=a.sa&&(g|=128),a.C&57344||(a.C=a.C|g|a.Ea<<5|a.Fa<<1),a.ja(168,16)),a.C&61440||!(4191360>f||4194239<f)||(a.C|=4096,a.C&512&&(a.H|=32)));return f}function Pd(a,b){return a.w.zb(b)}function Qd(a,b,c){b&1&&a.b--;a.w.Qb(b,c&255)}function Nd(a){var b=a.pa(a.u[6]|a.P);a.u[6]=a.u[6]+2&65535;return b}
function ud(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.C&57344||(a.Ua=a.Ua<<8|246);!a.A&&c<=a.Wa&&4<c&&(c<=a.Wa-32?(a.ca|=4,a.u[6]=4,a.ja(4,18)):(a.ca|=8,a.H|=4));a.Fb(c,b)}
function Rd(a,b,c,d){var e,f,g=d&8?0:a.P;switch(b){case 0:return a.ja(4,20),0;case 1:return 6===c&&!a.A&&d&4&&(a.u[6]<=a.Wa||65534<=a.u[6])&&(a.u[6]<=a.Wa-32||65534<=a.u[6]?(a.ca|=4,a.u[6]=4,a.ja(4,22)):(a.ca|=8,a.H|=64)),a.b-=3,7===c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!==c&&(e|=g);e=a.pa(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!==c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!==c&&(e|=g);e=a.pa(e)|
g;a.b-=8;break;case 6:return e=a.pa(pd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.pa(pd(a,2)),e=e+a.u[c]&65535,e=a.pa(e|a.P)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.C&57344||(a.Ua=a.Ua<<8|f<<3&248|c);6==c&&!a.A&&d&4&&0>=f&&(a.u[6]<=a.Wa||65534<=a.u[6])&&(a.u[6]<=a.Wa-32?(a.ca|=4,a.u[6]=4,a.ja(4,24)):(a.ca|=8,a.H|=64));return e}k.Mb=function(a){if(!this.Sa)return this.w.Mb(a);this.L++;a=Pd(this,Od(this,a,3));this.L--;return a};
k.lb=function(a){if(!this.Sa)return this.w.lb(a);this.L++;a=this.wc(Od(this,a,2));this.L--;return a};k.fb=function(a,b){this.Sa?(this.L++,Qd(this,Od(this,a,5),b),this.L--):this.w.fb(a,b)};k.Rb=function(a,b){this.Sa?(this.L++,this.Dc(Od(this,a,4),b),this.L--):this.w.Rb(a,b)};k.Lc=function(a,b,c){return Rd(this,a,b,c)};k.Mc=function(a,b,c){return Od(this,Rd(this,a,b,c),c)};k.wc=function(a){return this.w.oa(a)};k.Ad=function(a){return this.w.oa(Od(this,a,2))};k.Dc=function(a,b){this.w.hb(a,b&65535)};
k.le=function(a,b){this.w.hb(Od(this,a,4),b)};function Sd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=Rd(a,b,d,2),c&65536||61440!==(a.M&61440)&&(d&=65535),a.A=a.M>>12&3,c=a.pa(d|c&a.P),a.A=a.M>>14&3):c=6!=d||(a.M>>2&12288)===(a.M&12288)?a.u[d]:a.Aa[a.M>>12&3];return c}function Td(a,b,c,d){a.C&57344||(a.Ua=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=Rd(a,b,e,4),c&65536||(e&=65535),a.A=a.M>>12&3,e=Od(a,e|c&65536,4),a.A=a.M>>14&3,a.w.hb(e,d)):6!=e||(a.M>>2&12288)===(a.M&12288)?a.u[e]=d:a.Aa[a.M>>12&3]=d}
function Ud(a,b){b>>=6;var c=a.I=b&7;return(b=a.G=(b&56)>>3)?Pd(a,a.aa(b,c,3)):a.u[c]&255}function Vd(a,b){b>>=6;var c=a.I=b&7;return(b=a.G=(b&56)>>3)?a.w.oa(a.aa(b,c,2)):a.u[c]}function Wd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return Rd(a,b,c,8)}function Xd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?Pd(a,a.aa(b,c,3)):a.u[c]&255}function Yd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.w.oa(a.aa(b,c,2)):a.u[c]}
function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.jb=a.aa(b,e,7),Qd(a,e,d.call(a,c,Pd(a,e)))):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.aa(b,e,6),a.w.hb(e,d.call(a,c,a.w.oa(e)))):a.u[e]=d.call(a,c,a.u[e])}function Zd(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?Qd(a,a.aa(b,e,5),c):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}
function $d(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.hb(a.aa(b,d,4),c):a.u[d]=c&65535;return c}function T(a,b,c){c&&(N(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
k.tb=function(a){this.v.complete=!0;var b=this.i&&ae(this.i)?1:this.v.Sb?-1:0,c=a?this.v.Sb?0:1:-1;this.v.Sb=!1;this.ba=this.b=a;do{if(b){if(this.i&&be(this.i,this.u[7],c)){this.ia();break}c||c++;b++}if(this.H){this.H&112&&(this.H&32?this.ja(168,28):this.H&64?this.ja(4,30):this.H&16&&this.ja(12,32),this.H&=-113);if(a=this.H&7){a=!1;if(this.H&2){this.H&=-3;var d=160,e=(this.dc&224)>>5,f=this.N&&this.N.pb>e?this.N:null;f&&(d=f.Gd,e=f.pb);e>(this.M&224)>>5?(this.H&4&&(pd(this,2),this.H&=-5),this.ja(d,
26),e=!0):e=!1;if(e){if(f)if(a=f,f=this.N,f==a)this.N=a.next;else for(;f;){e=f.next;if(e==a){f.next=e.next;break}f=e}a=!0}}else this.H&1&&this.H++;a=a&&0>c}if(a)break}this.H=this.H&7|this.M&16;this.decode(od(this))}while(0<this.b);return this.v.complete?this.ba-this.b:void 0===this.v.complete?0:-1};Wa(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new fd(d);C(d,c)}});function ce(a,b){var c=b+a;rd(this,c,a,b);return c&65535}
function de(a,b){var c=b+a;rd(this,c<<8,a<<8,b<<8);return c&255}function ee(a,b){a=b<<1;sd(this,a);return a&65535}function fe(a,b){a=b<<1;sd(this,a<<8);return a&255}function ge(a,b){a=b&32768|b>>1|b<<16;sd(this,a);return a&65535}function he(a,b){a=b&2048|b>>1|b<<8;sd(this,a<<8);return a&255}function ie(a,b){a=b&~a;Q(this,a);return a}function je(a,b){a=b&~a;Q(this,a<<8);return a}function ke(a,b){a|=b;Q(this,a);return a}function le(a,b){a|=b;Q(this,a<<8);return a}
function me(a,b){a=~b|65536;qd(this,a);return a&65535}function ne(a,b){a=~b|256;qd(this,a<<8);return a&255}function oe(a,b){a=b-a;this.H&128||(this.X=this.$=a,this.U=b&(b^a));return a&65535}function pe(a,b){a=b-a;var c=a<<8;b<<=8;this.H&128||(this.X=this.$=c,this.U=b&(b^c));return a&255}function qe(a,b){a=b+a;this.H&128||(this.X=this.$=a,this.U=a&(b^a));return a&65535}function re(a,b){a=b+a;var c=a<<8;this.H&128||(this.X=this.$=c,this.U=c&(b<<8^c));return a&255}
function se(a,b){a=-b;qd(this,a,a&b&32768);return a&65535}function te(a,b){a=-b;qd(this,a<<8,(a&b&128)<<8);return a&255}function ue(a,b){a=b<<1|this.T>>16&1;sd(this,a);return a&65535}function ve(a,b){a=b<<1|this.T>>16&1;sd(this,a<<8);return a&255}function we(a,b){a=(this.T&65536|b)>>1|b<<16;sd(this,a);return a&65535}function xe(a,b){a=((this.T&65536)>>8|b)>>1|b<<8;sd(this,a<<8);return a&255}function ye(a,b){var c=b-a;td(this,c,a,b);return c&65535}
function ze(a,b){var c=b-a;td(this,c<<8,a<<8,b<<8);return c&255}function Ae(a,b){this.H&128||(this.X=this.$=b&65280,this.U=this.T=0);return(b<<8|b>>8)&65535}function Be(a,b){a^=b;Q(this,a);return a&65535}function Ce(a){S(this,a,Vd(this,a),ce);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}
function De(a){var b=Yd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.T=this.U=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.T=c<<17-b,c>>=b;else if(b)if(16<b)this.U=c,c=0;else{this.T=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.U=32768)}this.u[a]=c&65535;this.X=this.$=c;this.b-=(this.g?6:7)+b}
function Ee(a){var b=Yd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.T=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.T=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.U=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.X=d>>16;this.$=d>>16|d;this.b-=(this.g?6:7)+b}function Fe(a){T(this,a,!ld(this))}function Ge(a){T(this,a,ld(this))}
function He(a){S(this,a,Vd(this,a),ie);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}function Ie(a){R(this,a,Ud(this,a),je);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}function Je(a){S(this,a,Vd(this,a),ke);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}function Ke(a){R(this,a,Ud(this,a),le);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}
function Le(a){Q(this,Vd(this,a)&Yd(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}function Me(a){Q(this,(Ud(this,a)&Xd(this,a))<<8);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}function Ne(a){T(this,a,nd(this))}function Oe(a){T(this,a,!this.Ma()==!md(this))}function Pe(a){T(this,a,!nd(this)&&!this.Ma()==!md(this))}function Qe(a){T(this,a,!ld(this)&&!nd(this))}function Re(a){T(this,a,nd(this)||!this.Ma()!=!md(this))}
function Se(a){T(this,a,ld(this)||nd(this))}function Te(a){T(this,a,!this.Ma()!=!md(this))}function Ue(a){T(this,a,this.Ma())}function Ve(a){T(this,a,!nd(this))}function We(a){T(this,a,!this.Ma())}function Xe(){this.ja(12,1);this.b-=5}function Ye(a){T(this,a,!0)}function Ze(a){T(this,a,!md(this))}function $e(a){T(this,a,md(this))}function U(a){a&1&&(this.T=0);a&2&&(this.U=0);a&4&&(this.$=1);a&8&&(this.X=0);this.b-=5}
function af(a){var b=Vd(this,a);a=Yd(this,a);td(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}function bf(a){var b=Ud(this,a)<<8;a=Xd(this,a)<<8;td(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}
function cf(a){var b=Yd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.$=d>>16|d,this.X=d>>16):(this.U=32768,this.$=d>>15|d,this.X=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.$=this.X=0,this.U=32768,this.T=65536,this.b-=7}function df(){this.ja(24,2);this.b-=25}
function ef(){this.M&49152?(this.ca|=128,this.ja(4,3)):this.i?cc(this.i):this.ia();this.b-=7}function ff(){this.ja(16,4);this.b-=25}var gf=[0,7,7,10,7,11,9,13];function hf(a){this.J=this.b;N(this,Wd(this,a));this.b=this.J-gf[this.g]}var jf=[0,14,14,17,14,18,16,20];function kf(a){this.J=this.b;var b=Wd(this,a);a=a>>6&7;ud(this,this.u[a]);this.u[a]=this.u[7];N(this,b);this.b=this.J-jf[this.g]}var lf=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
function mf(a){var b=Vd(this,a);this.J=this.b;Q(this,$d(this,a,b));this.b=this.J-lf[(this.G?8:0)+this.g]+(7!=this.f||this.g?0:2)}function nf(a){var b=Ud(this,a);Q(this,Zd(this,a,b,1)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}var of=[7,13,13,17,14,18,17,21];
function pf(a){var b=Yd(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.H&128||(this.X=b>>16,this.$=this.X|b,this.U=0,this.T=-32768>b||32767<b?65536:0);this.b-=23}function qf(){this.b-=5}function rf(){this.M&49152||(jd(this),this.w.reset());this.b-=667}function sf(){Md(this);this.H|=this.M&16;this.b-=13}
function tf(a){if(a&8)V.call(this,a);else{var b=Nd(this);a&=7;7==a?N(this,b):(N(this,this.u[a]),this.u[a]=b);this.b-=9}}function W(a){a&1&&(this.T=65536);a&2&&(this.U=32768);a&4&&(this.$=0);a&8&&(this.X=32768);this.b-=5}function uf(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)N(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function vf(a){S(this,a,Vd(this,a),ye);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}
function wf(a){S(this,a,0,Ae);this.b-=this.g?9:3+(7==this.f?2:0)}function xf(){this.ja(28,5);this.b-=5}function yf(){this.H&4||this.B.da();this.H|=4;pd(this,-2);this.b-=3}function zf(a){S(this,a,Vd(this,a),Be);this.b-=this.g?9:3+(7==this.f?2:0)}function V(a){var b;if(b=this.i)b=this.i,E(b,"undefined opcode "+J(b,a),!0,!0),b=cc(b);b||this.ja(8,6)}function gd(a){Af[a>>12].call(this,a)}function Bf(a){Cf[a>>6&3].call(this,a)}function Df(a){Ef[a>>6&3].call(this,a)}
function Ff(a){Gf[a>>6&3].call(this,a)}function Hf(a){If[a&15].call(this,a)}function Jf(a){Kf[a&15].call(this,a)}function Lf(a){Mf[a>>6&3].call(this,a)}function Nf(a){Of[a>>6&3].call(this,a)}function Pf(a){Qf[a>>6&3].call(this,a)}
var Af=[function(a){Rf[a>>8&15].call(this,a)},mf,af,Le,He,Je,Ce,V,function(a){Sf[a>>8&15].call(this,a)},nf,bf,Me,Ie,Ke,vf,V],Rf=[function(a){Tf[a>>4&15].call(this,a)},Ye,Ve,Ne,Oe,Te,Pe,Re,kf,kf,Bf,Df,Ff,V,V,V],Cf=[function(a){qd(this,$d(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,me);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,qe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,oe);this.b-=this.g?9:3+(7==this.f?2:0)}],Ef=[function(a){S(this,a,0,
se);this.b-=this.g?11:6},function(a){S(this,a,ld(this)?1:0,ce);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,ld(this)?1:0,ye);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Yd(this,a);qd(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],Gf=[function(a){S(this,a,0,we);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ue);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ge);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ee);this.b-=this.g?9:3+(7==this.f?2:0)}],
Tf=[function(a){Uf[a&15].call(this,a)},V,V,V,hf,hf,hf,hf,tf,V,Hf,Jf,wf,wf,wf,wf],Uf=[ef,yf,sf,Xe,ff,rf,V,V,V,V,V,V,V,V,V,V],If=[qf,function(){this.T=0;this.b-=5},function(){this.U=0;this.b-=5},U,function(){this.$=1;this.b-=5},U,U,U,function(){this.X=0;this.b-=5},U,U,U,U,U,U,U],Kf=[qf,function(){this.T=65536;this.b-=5},function(){this.U=32768;this.b-=5},W,function(){this.$=0;this.b-=5},W,W,W,function(){this.X=32768;this.b-=5},W,W,W,W,W,W,W],Sf=[We,Ue,Qe,Se,Ze,$e,Fe,Ge,df,xf,Lf,Nf,Pf,V,V,V],Mf=[function(a){qd(this,
Zd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,ne);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,pe);this.b-=this.g?9:3+(7==this.f?2:0)}],Of=[function(a){R(this,a,0,te);this.b-=this.g?11:6},function(a){R(this,a,ld(this)?1:0,de);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,ld(this)?1:0,ze);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Xd(this,a);qd(this,a<<8);this.b-=this.g?4:3+(7==
this.f?2:0)}],Qf=[function(a){R(this,a,0,xe);this.b-=this.g?9+(this.jb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,he);this.b-=this.g?9+(this.jb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,fe);this.b-=this.g?9:3+(7==this.f?2:0)}];function hd(a){Vf[a>>12].call(this,a)}
var Vf=[function(a){Wf[a>>8&15].call(this,a)},mf,af,Le,He,Je,Ce,function(a){Xf[a>>8&15].call(this,a)},function(a){Yf[a>>8&15].call(this,a)},nf,bf,Me,Ie,Ke,vf,V],Wf=[function(a){Zf[a>>4&15].call(this,a)},Ye,Ve,Ne,Oe,Te,Pe,Re,kf,kf,Bf,Df,Ff,function(a){$f[a>>6&3].call(this,a)},V,V],$f=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.pa(a|this.P);N(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=Sd(this,a,0);ud(this,a);Q(this,a);this.b-=11},function(a){var b=Nd(this);this.J=
this.b;Td(this,a,0,b);Q(this,b);this.b=this.J-of[this.g]},function(a){Q(this,$d(this,a,this.Ma?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Zf=[function(a){ag[a&15].call(this,a)},V,V,V,hf,hf,hf,hf,tf,function(a){a&8?(this.M&49152||(this.M=this.M&-2017|(a&7)<<5,this.H|=1),this.b-=5):V.call(this,a)},Hf,Jf,wf,wf,wf,wf],ag=[ef,yf,sf,Xe,ff,rf,function(){Md(this);this.b-=13},V,V,V,V,V,V,V,V,V],Xf=[pf,pf,cf,cf,De,De,Ee,Ee,zf,zf,V,V,V,V,uf,uf],Yf=[We,Ue,Qe,Se,Ze,$e,Fe,Ge,df,xf,Lf,Nf,Pf,function(a){bg[a>>
6&3].call(this,a)},V,V],bg=[V,function(a){a=Sd(this,a,65536);ud(this,a);Q(this,a);this.b-=11},function(a){var b=Nd(this);this.J=this.b;Td(this,a,65536,b);Q(this,b);this.b=this.J-of[this.g]},V];
function cg(a){r.call(this,"ROM",a,cg);this.ga=this.f=null;this.C=a.addr;this.g=a.size;this.A=a.alias;this.B=a.file;this.G=ra(this.B);if(this.B){a=this.B;var b=sa(this.G);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?c.O("Unable to load ROM resource (error "+f+": "+a+")"):(mb(c.Ia,a,b),(a=Ea(a,b))?(c.f=a.ea,c.ga=a.ga):c.B=null,dg(c))})}}u(cg);cg.prototype.wa=function(a,b,c,d){this.w=b;this.b=c;this.i=d;dg(this)};
cg.prototype.za=function(){this.ga&&(this.i&&eg(this.i,this.id,this.C,this.g,this.ga),delete this.ga);return!0};cg.prototype.ya=function(){return!0};
function dg(a){if(!sb(a)){if(a.B){if(!a.f||!a.w)return;a.g||(a.g=a.f.length);if(a.f.length!=a.g)ub(a,"ROM size ("+l(a.f.length,8,!0)+") does not match specified size ("+l(a.g,8,!0)+")");else{var b;b=a.C;if(ac(a.w,b,a.g,Hc)){var c;for(c=0;c<a.f.length;c++)a.w.fb(b+c,a.f[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.A?b.push(a.A):null!=a.A&&a.A.length&&(b=a.A);for(c=0;c<b.length;c++){var d=a,e=b[c],f=$b(d.w,d.C,d.g);Zb(d.w,e,d.g,f)}delete a.f}}}G(a)}}
Wa(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new cg(d);C(d,c)}});
function fg(a){r.call(this,"RAM",a,fg);this.ga=this.g=null;this.B=a.addr;this.C=a.size;this.Ca=a.load;this.Ba=a.exec;this.A=!1;this.f=a.file;this.G=ra(this.f);if(this.f){a=this.f;var b=sa(this.G);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?c.O("Unable to load RAM resource (error "+f+": "+a+")"):(mb(c.Ia,a,b),(a=Ea(a,b))?(c.g=a.ea,c.ga=a.ga,null==c.Ca&&(c.Ca=a.Ca),null==c.Ba&&(c.Ba=a.Ba)):c.f=null,zg(c))})}}u(fg);
fg.prototype.wa=function(a,b,c,d){this.w=b;this.b=c;this.i=d;zg(this)};fg.prototype.za=function(){this.ga&&(this.i&&eg(this.i,this.id,this.B,this.C,this.ga),delete this.ga);return!0};fg.prototype.ya=function(){return!0};function zg(a){if(a.w&&(!a.A&&a.C&&ac(a.w,a.B,a.C,1)&&(a.A=!0),!sb(a))){if(!a.A)p("No RAM allocated");else if(a.f){if(!a.g||!a.w)return;Ag(a,a.g,a.Ca,a.Ba,a.B)}G(a)}}
fg.prototype.reset=function(){if(this.A){for(var a=this.w,b=this.B,c=this.C,d=b&a.w,b=b>>>a.ka;0<c&&b<a.W.length;){var e=a.W[b],f=c,g,d=d||0;void 0===f&&(f=e.size);if(vb)for(g=d;f--&&g<e.F.length;g++)e.F[g]=0;else for(g=d;f--&&g<e.size;g++)e.Ub(d,0,e.D+d);c-=a.ua;b++;d=0}this.g&&Ag(this,this.g,this.Ca,this.Ba,this.B,!0)}};
function Ag(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var m=b[h]&255|(b[h+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(h+6>=b.length)break;for(var h=h+2,n=b[h++]&255|(b[h++]&255)<<8,q=b[h++]&255|(b[h++]&255)<<8,m=m+((n&255)+(n>>8)+(q&255)+(q>>8)),w=h,v=n-=6;0<n&&h<b.length;)m+=b[h++]&255,n--;if(n||h>=b.length)break;m+=b[h++]&255;if(m&255)break;if(v)for(;v--;)a.b.fb(q++,b[w++]&255);else q&1?a.b.ia():kd(a.b,q,f);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.b.fb(c+
e,b[e]);null!=d&&kd(a.b,d,f);g=!0}return g}Wa(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new fg(d);C(d,c)}});function Bg(a){r.call(this,"Keyboard",a,Bg,65536);G(this)}u(Bg);Bg.prototype.qa=function(){return!1};Bg.prototype.wa=function(a,b,c,d){this.B=a;this.b=c;this.i=d};Wa(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Bg(d);C(d,c)}});
function X(a){this.N=a.baudReceive||9600;this.R=a.baudTransmit||9600;this.ba=a.upperCase;this.A=this.G=null;this.S=a.tabSize;this.P=a.charBOL;this.I=0;r.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.G="";else{var c;a=Cg;b&&(void 0===c&&(c="Panel"),(c=pb(c,this.id))&&(b=c.F[b])&&this.qa(null,a,b))}this.J=this.L=null;this.exports={connect:this.sc,receiveData:this.cc}}u(X);var Cg="buffer";k=X.prototype;
k.qa=function(a,b,c){var d=this;switch(b){case Cg:return this.F[b]=this.A=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.cc(b);return!0},c.onkeypress=function(a){a=a||window.event;d.cc(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;var e=this;this.la=nc(48,4);this.Y=kc(this.b,function(){e.f&128||!e.C.length||(e.K=e.C.shift()&255,e.ba&&97<=e.K&&122>e.K&&(e.K-=32),e.f|=128,e.f&64&&lc(e.b,e.la))});this.ma=nc(52,4);this.Z=kc(this.b,function(){e.g|=128;e.g&64&&lc(e.b,e.ma)});hc(b,this,Dg);G(this)};
k.sc=function(){if(!this.J){var a=Uc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=xa(b[0]);if(c!=this.Za)return;b=xa(b[1]);if(this.J=ob(b)){var d=this.J.exports;if(d){var e=d.connect;e&&e.call(this.J);if(this.L=d.receiveData){this.status(this.Ia+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.za=function(a,b){if(!b)if(this.sc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
k.ya=function(a){return a?this.save():!0};k.reset=function(){Eg(this)};k.save=function(){var a=new O(this);a.set(0,[]);return a.data()};k.restore=function(){return Eg(this)};function Eg(a){a.K=0;a.f=0;a.g=128;a.C=[];return!0}k.cc=function(a){if("number"==typeof a)this.C.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.C.push(a.charCodeAt(b));else this.C=this.C.concat(a);mc(this.b,this.Y,1E3/Math.round(this.N/10));return!0};k.pd=function(){return this.f&65534};
k.ae=function(a){this.f=this.f&-112|a&111};k.od=function(){this.f&=-129;0<this.C.length&&mc(this.b,this.Y,1E3/Math.round(this.N/10));return this.K};k.$d=function(){};k.Cd=function(){return this.g};k.ne=function(a){128==(this.g&192)&&a&64&&mc(this.b,this.Z,1E3/Math.round(this.R/10));this.g=this.g&-70|a&69};k.Bd=function(){return 0};
k.me=function(a){if(a&=255){E(this,"transmitByte("+l(a,2,!0)+")");this.L&&this.L.call(this.J,a);if(this.A)if(13==a)this.I=0;else if(8==a)this.A.value=this.A.value.slice(0,-1),0<this.I&&this.I--;else{var b;b=(b=ya[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.S||8,c=a-this.I%a,this.S&&(b=wa("",c)));this.P&&!this.I&&c&&(b=String.fromCharCode(this.P)+b);this.A.value+=b;this.A.scrollTop=this.A.scrollHeight;this.I+=c}else if(null!=this.G){if(10==a||1024<=this.G.length)this.j(this.G),
this.G="";10!=a&&(this.G+=String.fromCharCode(a))}this.g&=-129;mc(this.b,this.Z,1E3/Math.round(this.R/10))}};var Fg={},Dg=(Fg[65392]=[null,null,X.prototype.pd,X.prototype.ae,"RCSR"],Fg[65394]=[null,null,X.prototype.od,X.prototype.$d,"RBUF"],Fg[65396]=[null,null,X.prototype.Cd,X.prototype.ne,"XCSR"],Fg[65398]=[null,null,X.prototype.Bd,X.prototype.me,"XBUF"],Fg);Wa(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new X(d);C(d,c)}});
function rc(a){r.call(this,"PC11",a,rc);this.g=a.autoMount||null;this.G=0;this.Z=a.baudReceive||3600;this.K=this.L=this.f=0;this.J=[];this.I=Gg;this.A=Hg;this.N=this.C="";this.ea=this.Ca=this.Ba=null;this.S=-1;this.R=!Oa("Mobi")&&window&&"FileReader"in window}u(rc);var Gg="",Hg=0;k=rc.prototype;
k.qa=function(a,b,c){var d=this,e=Hg;switch(b){case "listTapes":return this.F[b]=c,c.onchange=function(){var a=d.F.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(m){p("PC11 option error: "+m.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.F[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.F[b]=c,c.onclick=
function(){var a=d.F.listTapes;a&&Ig(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.R){c.parentNode.removeChild(c);break}this.F[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Ig(d,ra(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.F[b]=c,!0}return!1};
k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;this.Y=Jg(a);var e=this;if((this.g=Uc(this.B,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){p("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.P=nc(56,4);this.ba=kc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.K<e.J.length&&(e.L=e.J[e.K++]&255,Kg(e,e.K/e.J.length*100),e.f|=128,e.f&=-2049,e.f&64&&lc(e.b,e.P))});hc(b,this,Lg);Mg(this,"None",Gg,!0);this.R&&Mg(this,"Local Tape",
"?");Mg(this,"Remote Tape","??");Ng(this)||G(this)};k.za=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.ya=function(a){return a?this.save():!0};k.reset=function(){this.f&=-2241;this.L=0};function Ng(a){a.G=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.F.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=ra(b,!0)}b&&c?Og(a,c,b,1,!0):Pg(a)}return!!a.G}
function Ig(a,b,c,d,e){if(c)if("?"==c)a.O('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"');a.I="??"}else a.I=c;Og(a,b,c,d,!1,e)}else Qg(a,!1)}
function Og(a,b,c,d,e,f){var g=-1;if(a.C.toLowerCase()!=c.toLowerCase()||a.A!=d)g++,Qg(a,!0),a.v.Qa?a.O("PC11 busy"):(e&&(a.G++,F(a)&&E(a,"auto-loading tape: "+b)),Rg(a,b,c,d,f)?g++:a.v.Qa=!0);g&&Sg(a,a.N,a.C,a.A,a.ea,a.Ca,a.Ba)}
function Rg(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),Sg(a,b,c,d,e),a.I="?");Pg(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=sa(c),f="json"==e||"gz"==e?encodeURI(c):Fa()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Da(f,null,!0,function(e,f,g){var h=0>g&&a.B&&!a.B.v.ha;g?a.O('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(mb(a.Ia,e,f),(e=Ea(e,f))&&Sg(a,b,c,d,e.ea,e.Ca,
e.Ba));a.v.Qa=!1;a.G&&(a.G--,a.G||G(a));Pg(a)})}function Mg(a,b,c,d){if((a=a.F.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function Pg(a){var b=a.F.listTapes;if(b&&b.options){a=a.I||a.C;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function Kg(a,b){b|=0;if(b!==a.S){var c=a.F.readProgress;c&&(c=(c=D(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.S=b}}
function Sg(a,b,c,d,e,f,g){a.N=b;a.C=c;a.A=d;a.ea=e;a.Ca=f;a.Ba=g;2==d?a.Y&&Ag(a.Y,e,f,g)?a.status("tape loaded: "+b):(a.N="",a.C="",a.I=Gg,a.A=Hg,a.O("No load address available for tape: "+b)):(a.K=0,a.J=e,a.status("tape attached: "+b),Kg(a,0))}function Qg(a,b){if(a.C||!1===b)a.N="",a.C="",b||(a.A&&a.status(1==a.A?"tape detached":"tape unloaded"),a.I=Gg,a.A=Hg,Pg(a))}k.save=function(){return(new O(this)).data()};k.restore=function(){return!0};k.hd=function(){return this.f&65534};
k.Ud=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&lc(this.b,this.P)):(this.f&=-129,this.f|=2048,this.L=0,mc(this.b,this.ba,1E3/Math.round(this.Z/10))));this.f=this.f&-66|a&65};k.gd=function(){this.f&=-129;this.f|=2048;return this.L};k.Td=function(){};var Tg={},Lg=(Tg[65384]=[null,null,rc.prototype.hd,rc.prototype.Ud,"PRS"],Tg[65386]=[null,null,rc.prototype.gd,rc.prototype.Td,"PRB"],Tg);
function Ug(a,b,c){r.call(this,"Disk",{id:a.Ia+".disk"+l(++Vg,4)},Ug,2097152);this.controller=a;this.B=a.B;this.i=a.i;this.A=b;this.Oa=b.name;this.Zb=b.Zb;Wg(this,c,b.Ha,b.Da,b.xa,b.Ja);G(this)}var Vg=0;u(Ug);Ug.prototype.wa=function(a,b,c,d){this.i=d};
function Wg(a,b,c,d,e,f){a.mode=b;a.Ha=c;a.Da=d;a.xa=e;a.Ja=f;a.b=[];if("preload"!=a.mode){b=Array(a.Ha);for(c=0;c<b.length;c++){d=Array(a.Da);for(e=0;e<d.length;e++){f=Array(a.xa);for(var g=1;g<=f.length;g++)f[g-1]=Xg(null,c,e,g,a.Ja,0);d[e]=f}b[c]=d}a.b=b}a.f=null}
function Yg(a,b,c,d,e){var f=c;if(a.w)return!0;a.Oa=b;a.Xa=c;a.Ac=ra(c);a.w=e;a.C=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ka[d];if(e){a.Ha=e[0];a.Da=e[1];a.xa=e[2];a.Ja=e[3]||512;c=a.Ja>>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.Ha);for(d=0;d<a.b.length;d++)for(var v=a.b[d]=Array(a.Da),x=0;x<v.length;x++)for(var z=v[x]=Array(a.xa),y=0;y<z.length;y++){for(var B=Xg(null,d,x,y+1,a.Ja,0),ia=B.data,Ja=0;Ja<c;Ja++,f+=4)var P=ia[Ja]=b.getInt32(f,
!0),e=e+P&-1;B.Gb=c;z[y]=B}a.f=e;c=a}else a.O("Unrecognized disk format ("+d+" bytes)");a.w&&(a.w.call(a.controller,a.A,c,a.Oa,a.Xa),a.w=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=sa(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ta(c,"/")&&(d="dir"),f=Fa()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.Zb?"":e)+"&format=json"));return!!Da(f,
null,!0,function(b,c,d){Zg(a,b,c,d)})}
function Zg(a,b,c,d){var e=null;a.g=!1;var f=0>d&&a.B&&!a.B.v.ha;if(d)a.controller.O('Unable to load disk "'+a.Oa+'" (error '+d+": "+b+")",f);else{mb(a.controller.Ia,b,c);try{if(0<ra(a.Ac,!0).toLowerCase().indexOf("-readonly"))a.g=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.g=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.Oa]:h=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(h.length)if(1==h.length)p(h[0]);else{a.Ha=h.length;a.Da=h[0].length;a.xa=h[0][0].length;var m=h[0][0][0];a.Ja=m&&m.length||512;for(d=c=0;d<a.Ha;d++)for(f=0;f<a.Da;f++)for(g=0;g<a.xa;g++)if(m=h[d][f][g]){var n=m.length;void 0===n&&(n=m.length=512);var n=n>>2,q=m.pattern;void 0===q&&(q=m.pattern=0);var w=m.data;if(void 0===w){var v=m.bytes;if(void 0!==v&&v.length){for(var x=n<<2,z=v.length;z<x;z++)v[z]=q;$g(m,v)}else w=[],q=m.pattern=q|q<<8|q<<16|q<<24,m.data=w;delete m.bytes}Xg(m,d,f);for(x=
0;x<w.length;x++)c=c+w[x]&-1}a.b=h;a.f=c;e=a}else p("Empty disk image: "+a.Oa)}catch(y){p("Disk image error ("+b+"): "+y.message)}}a.w&&(a.w.call(a.C,a.A,e,a.Oa,a.Xa),a.w=null)}function Xg(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.te=b;a.ue=c;a.Nb=a.Gb=0;a.La=!1;return a}function $g(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
function ah(a,b){var c=a.Da*a.xa,d=b/c|0;if(d<a.Ha){c=b%c;b=c/a.xa|0;var c=c%a.xa+1,e=null,f=a.A,g=a.b[d];if(g){a=g[b];if(!a&&f.Gc&&b<f.Da)for(a=g[b]=Array(f.Hc),g=0;g<a.length;g++)a[g]=Xg(null,d,b,g+1,f.uc,0);if(a){for(g=0;g<a.length;g++)if(a[g]&&a[g].sector==c){e=a[g];break}!e&&f.Gc&&9==f.hc&&(e=a[g]=Xg(null,d,b,f.hc,f.uc,0))}}return e}return null}
function bh(a,b){for(var c=1,d=0,e=0;c--;){var f;f=b++;var g=-1;if(a&&f<a.length)var g=a.data,h=f>>2,g=(h<g.length?g[h]:a.pattern)>>((f&3)<<3)&255;f=g;if(0>f)break;d|=f<<e;e+=8}return d}
Ug.prototype.save=function(){var a=0,b=[];b[a++]=[this.Xa,this.f,this.Ha,this.Da,this.xa,this.Ja];if(!this.g)for(var c=this.b,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Gb){for(var h=[],m=0,n=g.Nb,q=g.Nb+g.Gb;n<q;)h[m++]=g.data[n++];b[a++]=[d,e,f,g.Nb,h]}}return b};
Ug.prototype.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.b.length&&6<=e.length?Wg(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.f&&e[1]!=this.f&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.f+")",b=-2));for(this.b.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],h=g[f++],m=g[f++],n=g[f++];if(h>=this.b.length||m>=this.b[h].length||n>=this.b[h][m].length){c="sector (CHS="+h+":"+m+":"+n+") out of range ("+
b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(h=this.b[h][m][n]){for(m=h.data.length;m<e;)h.data[m++]=h.pattern;m=0;h.Nb=e;for(h.Gb=f.length;e<g;)h.data[e++]=f[m++];b++}}}0>b&&-2!=b&&this.controller.O("Unable to restore disk '"+this.Oa+": "+c);return b};
Ug.prototype.toJSON=function(){var a;a=0;for(var b;b=ah(this,a++);)ch(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function ch(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function sc(a){r.call(this,"RL11",a,sc,2097152);this.g=a.autoMount||null;this.A=0;this.f=Array(1);this.C=!Oa("Mobi")&&window&&"FileReader"in window}u(sc);k=sc.prototype;
k.qa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.F[b]=c,c.onchange=function(){var a=d.F.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){p("RL11 option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.F[b]=c,c.onchange=function(){var a=pa(c.value,10);null!=a&&dh(d,a)},!0;case "loadDrive":return this.F[b]=
c,c.onclick=function(){var a=d.F.listDisks;a&&eh(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.C){c.parentNode.removeChild(c);break}this.F[b]=c;c.onclick=function(){var a=d.F.listDrives;if(a&&a.options&&d.f)if(a=d.f[pa(a.value,10)||0])if(a=a.Hb){var b;b="";for(var c=0,h;h=ah(a,c++);)for(var m=0,n=h.length;m<n;m++)b+=String.fromCharCode(bh(h,m));b=btoa(b);a=a.Ac.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),"string"!=
typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");p(a)}else d.O("No disk loaded in drive.");else d.O("No disk drive selected.")};return!0;case "mountDrive":if(this.C)return this.F[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),
c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;eh(d,ra(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;if((this.g=Uc(this.B,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(e){p("RL11 auto-mount error: "+e.message+" ("+this.g+")"),this.g=null}fh(this);this.P=nc(112,5);hc(b,this,gh);hh(this,"None","",!0);this.C&&hh(this,"Local Disk","?");hh(this,"Remote Disk","??");ih(this)||G(this)};
k.za=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.B.lc){for(a=0;a<this.f.length;a++)jh(this,a,!0);ih(this,!0)}}else if(!this.restore(a))return!1;if(a=this.F.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;1>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";dh(this,0)}}return!0};k.ya=function(a){return a?this.save():!0};k.reset=function(){fh(this)};k.save=function(){return(new O(this)).data()};
k.restore=function(){return!0};function fh(a){for(var b=0;b<a.f.length;b++){var c=a.f[b];void 0===c&&(c=a.f[b]={});var d=a;c.$b=b;c.Yb=c.Ib=!1;c.name=d.Za;c.Ha=512;c.Da=2;c.xa=40;c.Ja=256;c.Zb=!0;c.re=0;c.qe=0;c.pe=0;c.hc=1;c.Hc=c.xa;c.uc=c.Ja;c.ve=0;c.xe=null;c.Hb||(c.Xa="")}}
function ih(a,b){b||(a.A=0);if(a.g)for(var c in a.g){var d=a.g[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.F.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=ra(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.f.length)){!kh(a,g,f,e,!0)&&b&&G(a,!1);continue}a.O("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.A}
function eh(a,b,c,d){var e=a.F.listDrives,e=e&&pa(e.value,10);if(void 0===e||0>e||e>=a.f.length)a.O("Unable to load the selected drive");else if(c)if("?"==c)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"')}kh(a,e,b,c,!1,d)}else jh(a,e)}
function kh(a,b,c,d,e,f){var g=-1,h=a.f[b];h.Xa.toLowerCase()!=d.toLowerCase()&&(g++,jh(a,b,!0),h.Yb?a.O("RL11 busy"):(h.Yb=!0,e&&(h.Xb=!0,a.A++,F(a)&&E(a,"auto-loading disk: "+c)),h.Ib=!!f,Yg(new Ug(a,h,"preload"),c,d,f,a.Jc)&&g++));return g}
k.Jc=function(a,b,c,d,e){var f;a.Yb=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.Ha||f[1]>a.Da)&&(this.O('Disk "'+c+'" too large for drive '+("RL"+a.$b)),b=null);b?(a.Hb=b,a.Oa=c,a.Xa=d,this.O('Mounted disk "'+c+'" in drive '+("RL"+a.$b),a.Xb||e),this.B&&this.B.gb()):a.Ib=!1;a.Xb&&(a.Xb=!1,--this.A||G(this));dh(this,a.$b)};
function hh(a,b,c,d){if((a=a.F.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function dh(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.F.listDisks;a=a.F.listDrives;if(d&&a&&d.options&&a.options&&(a=pa(a.value,10),c=c.Ib?"?":c.Xa,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function jh(a,b,c){var d=a.f[b];if(d.Hb||!1===c)d.Oa="",d.Xa="",d.Hb=null,d.Ib=!1,c||(a.O("Drive RL"+b+" unloaded",c),dh(a,b))}var gh={};
function lh(a){r.call(this,"Debugger",a,lh);this.Z=a.base||16;this.va=!1;this.J=0;this.P=!1;this.A=-1;this.g=[];this.S={}}u(lh);var mh={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};lh.prototype.oc=function(){return-1};lh.prototype.pc=function(){};
function nh(a,b,c,d){if(c)if(b){0>a.A&&a.g.length&&(a.A=0);if(0>a.A||b!=a.g[a.A])a.g.splice(0,0,b),a.A=0;a.A--}else a.P?b="end":b=a.g[a.A+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(xa(b.substring(c,f))),c=f+1}}return a}
function oh(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
Xa(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=A(d);switch(c.type){case "default":c=new K(c);C(c,d);break;case "pc11":c=new tc(c);C(c,d);break;case "rl11":c=new N(c),C(c,d)}}});var uc;if(wb){var vc=new ArrayBuffer(2);(new DataView(vc)).setUint16(0,256,!0);uc=256===(new Uint16Array(vc))[0]}else uc=!1;var Fc=uc;
function I(a,b,c,d,e,f){this.w=a;this.id=Gc+=2;this.b=null;this.D=b;this.Jb=c;this.size=d||0;this.type=e||Hc;this.f=e==Ic;this.controller=null;Wb(this);this.Pa=this.Mc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],Jc(this,f.Gc);else if(wb)this.C=new ArrayBuffer(this.size),this.F=new DataView(this.C,0,this.size),this.G=new Uint8Array(this.C,0,this.size),this.J=new Uint16Array(this.C,0,this.size>>1),this.b=new Int32Array(this.C,0,this.size>>2),Jc(this,Fc?Kc:Lc);else{a=this.b=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;Jc(this,Mc)}else Jc(this)}var Hc=0,Ic=2,cc=4,fc=["NONE","RAM","ROM","VID","H/W"],Gc=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(wb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.F.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(wb)for(b=0;b<a.length;b++)this.F.setInt32(b<<2,a[b],!0);else this.b=a;return this.Pa=!0}return!1},hb:function(a,b){b?this.B++||Nc(this,Oc,!1):this.g++||Pc(this,Oc,!1)},K:function(a,b){this.i&&F(this.i,128)&&(E(this.i,
"attempt to read invalid address "+J(this.i,b),!0),dc(this.i));kc(this.w,b,2);return 255},v:function(a,b,c){this.i&&F(this.i,128)&&(E(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0),dc(this.i));kc(this.w,c,4)},L:function(a,b){return this.Rb(a++,b++)|this.Rb(a,b)<<8},I:function(a,b,c){this.Ub(a++,b&255,c++);this.Ub(a,b>>8,c)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ca:function(a,b){a&1&&kc(this.w,b,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:
c&255|(this.b[b+1]&255)<<8},va:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Pa=!0},Ka:function(a,b,c){a&1&&kc(this.w,c,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Pa=!0},P:function(a,b){if(this.i&&null!=this.D){var c=this.i;Qc(c,this.D+a,1,c.L)&&c.ja(!0)}return this.bc(a,b)},Y:function(a,b){if(this.i&&null!=this.D){var c=this.i;Qc(c,this.D+a,2,c.L)&&c.ja(!0)}return this.cc(a,
b)},na:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Qc(d,this.D+a,1,d.C)&&d.ja(!0)}this.f?this.v(a,b,c):this.Vb(a,b,c)},za:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Qc(d,this.D+a,2,d.C)&&d.ja(!0)}this.f?this.v(a,b,c):this.gc(a,b,c)},N:function(a){return this.G[a]},R:function(a,b){a=this.G[a];this.i&&F(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},Na:function(a,b){a&1&&kc(this.w,b,2);return this.F.getUint16(a,!0)},$:function(a,b){a&1&&kc(this.w,
b,2);a=this.J[a>>1];this.i&&F(this.i,128)&&E(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ma:function(a,b){this.G[a]=b;this.Pa=!0},ua:function(a,b,c){this.G[a]=b;this.Pa=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},cb:function(a,b,c){a&1&&kc(this.w,c,4);this.F.setUint16(a,b,!0);this.Pa=!0},Ja:function(a,b,c){a&1&&kc(this.w,c,4);this.J[a>>1]=b;this.Pa=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,
b)+")",!0)}};function Wb(a,b,c){a.i=b;a.g=a.B=0;c&&((a.g=c.g)&&Pc(a,Oc,!1),(a.B=c.B)&&Nc(a,Oc,!1))}function Rc(a,b){b?--a.B||(a.Ub=a.f?a.v:a.Vb,a.Kb=a.f?a.I:a.gc):--a.g||(a.Rb=a.bc,a.ra=a.cc)}function Nc(a,b,c){c&&a.B||(a.Ub=!a.f&&b[1]||a.v,a.Kb=!a.f&&b[3]||a.I);if(c||void 0===c)a.Vb=b[1]||a.v,a.gc=b[3]||a.I}function Pc(a,b,c){c&&a.g||(a.Rb=b[0]||a.K,a.ra=b[2]||a.L);if(c||void 0===c)a.bc=b[0]||a.K,a.cc=b[2]||a.L}function Jc(a,b){b||(b=Sc);Pc(a,b,void 0);Nc(a,b,void 0)}
var Sc=[],Mc=[I.prototype.S,I.prototype.va,I.prototype.ca,I.prototype.Ka],Oc=[I.prototype.P,I.prototype.na,I.prototype.Y,I.prototype.za];if(wb)var Lc=[I.prototype.N,I.prototype.ma,I.prototype.Na,I.prototype.cb],Kc=[I.prototype.R,I.prototype.ua,I.prototype.$,I.prototype.Ja];
function Tc(a,b){r.call(this,"CPU",a,Tc,1);var c=a.multiplier||1;this.bb=a.cycles||b;this.Xa=c;this.Ab=Math.round(this.bb/1E4)/100;this.jb=this.Ab*this.Xa;this.A.ga=!1;this.A.Tb=!1;this.A.nb=a.autoStart;this.A.pb=!1;this.Eb=this.na=0;this.Fb=a.csStart;this.rb=a.csInterval;this.sb=a.csStop;this.K=[];this.uc=this.Ld.bind(this);G(this)}w(Tc);var Uc=["power","reset"];k=Tc.prototype;
k.Ca=function(a,b,c,d){this.B=a;this.w=b;this.i=d;for(b=0;b<Uc.length;b++)(c=this.G[Uc[b]])&&this.B.sa(null,Uc[b],c);a=Vc(a,"autoStart");null!=a&&(this.A.nb="true"==a?!0:"false"==a?!1:!!a);G(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.Ea=function(a,b){if(!b){if(a&&this.restore){Wc(this);if(!this.restore(a))return!1;Xc(this)}else this.reset();this.i?(a=this.i,b=this.A.nb,a.fb=!0,a.j("Type ? for help with PDP11 Debugger commands"),a.da(),b||a.lb(),a.Ka&&(b=a.Ka,a.Ka=null,Yc(a,b))):this.j("No debugger detected")}this.B.da();return!0};k.Da=function(a){return a?this.save():!0};k.nb=function(){return this.A.nb||!this.i&&void 0===this.G.run?(this.wb(),!0):!1};k.oc=function(){return 0};
function Xc(a){void 0===a.Fb&&(a.Fb=0);void 0===a.rb&&(a.rb=-1);void 0===a.sb&&(a.sb=-1);a.A.pb=0<=a.Fb&&0<a.rb;a.A.pb&&(a.Eb=0,a.na=a.Fb-a.ma)}function Zc(a,b){if(a.A.pb){var c=!1;a.Eb=a.Eb+a.oc()|0;a.na-=b;0>=a.na&&(a.na+=a.rb,c=!0);0<=a.sb&&a.sb<=$c(a)&&(a.rb=a.sb=-1,Xc(a),a.ja(),c=!0);c&&a.j($c(a)+" cycles: checksum="+l(a.Eb))}}
k.sa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.G[b]=c,!0;case "run":return this.G[b]=c,c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.A.ia)a=!0;else{var b=null,c,h=ob(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.A.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.A.ia);c++);c==h.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.A.ready?"powered yet":"ready yet"+(b.Ob?" (waiting for notification)":""))+".");a=!1}a&&(d.A.ga?d.ja():d.wb())},
!0;case "speed":return this.G[b]=c,!0;case "setSpeed":return this.G[b]=c,c.onclick=function(){ad(d,d.Xa<<1,!0)},c.textContent=this.jb.toFixed(2)+"Mhz",!0}return!1};k.da=function(){var a=this.G.speed;a&&(a.textContent=this.A.ga&&this.Y?this.Y.toFixed(2)+"Mhz":"Stopped")};function bd(a,b,c){a.ma+=b;c&&(a.ca=a.b=a.J=0)}function cd(a,b){var c=1;b&&1<a.Xa&&a.Y&&(c=a.Y/a.Ab);a.rc=Math.round(1E3/30);a.gb=Math.floor(a.bb/30*c);b||(a.ua=a.gb);a.Cb=0}function $c(a){return a.ma+a.S+a.ca-a.b}
function Wc(a){a.Y=0;a.sc=0;a.ma=a.S=a.ca=a.b=a.J=0;Xc(a);ad(a,1)}function ad(a,b,c){var d=!1;if(void 0!==b){.8>a.Y/a.jb?b=1:d=!0;a.Xa=b;b=a.Ab*a.Xa;if(a.jb!=b){a.jb=b;b=a.jb.toFixed(2)+"Mhz";var e=a.G.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.B&&a.B.lb()}bd(a,a.S);a.S=0;a.R=Ba();a.$=0;cd(a);return d}function mc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function oc(a,b,c){0<=b&&b<a.K.length&&0>a.K[b][0]&&(c=a.bb*a.Xa/1E3*c|0,a.K[b][0]=c+dd(a))}
function ed(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function fd(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function dd(a,b){var c=a.ca-=a.b;a.b=a.J=0;b&&(a.ca=0);return c}
k.Ld=function(){if(this.A.ga){this.Cb>=this.bb&&cd(this,!0);this.za=0;this.fb=Ba();if(this.$){var a=this.fb-this.$;a>this.rc&&(this.R+=a,this.R>this.fb&&(this.R=this.fb))}try{do{var b=ed(this,this.A.pb?1:this.gb);try{this.xb(b)}catch(e){if("number"!=typeof e)throw e;}b=dd(this,!0);this.za+=b;this.S+=b;Zc(this,b);fd(this,b);this.ua-=b;if(0>=this.ua){this.ua+=this.gb;15<=++this.sc&&(this.B&&this.B.da(),this.sc=0);break}}while(this.A.ga)}catch(e){this.ja();this.B&&this.B.stop(Ba(),$c(this));vb(this,
e.stack||e.message);return}if(this.A.ga){a=setTimeout;b=this.uc;this.$=Ba();var c=this.rc;this.za&&(c=Math.round(c*this.za/this.gb));var c=c-(this.$-this.fb),d=this.$-this.R;d&&(this.Y=Math.round(this.S/(10*d))/100,864E5<=d&&(this.ma=0,ad(this)));if(0>c||this.Y<this.jb)-1E3>c&&(this.R-=c),c=0;this.Cb+=this.za;this.$+=c;a(b,c)}}};
k.wb=function(a){if(ub(this))return!1;if(this.A.ga)return this.j(this.toString()+" busy"),!1;ad(this);this.A.ga=!0;this.A.Tb=!0;var b=this.G.run;b&&(b.textContent="Halt");this.B&&(a&&this.B.lb(!0),this.B.start(this.R,$c(this)));setTimeout(this.uc,0);return!0};k.xb=function(){return 0};k.ja=function(a){var b=!1;if(this.A.ga){dd(this);bd(this,this.S);this.S=0;this.A.ga=!1;if(b=this.G.run)b.textContent="Run";this.B&&this.B.stop(Ba(),$c(this));b=!0}this.A.complete=a;return b};
function gd(a){this.qb=+a.model||1170;this.Nb=a.addrReset||0;Tc.call(this,a,6666667);this.decode=1120==this.qb?hd.bind(this):id.bind(this);jd(this);this.L=0;this.N=null;this.A.complete=!1}w(gd,Tc);k=gd.prototype;k.reset=function(){this.status("model "+this.qb);this.A.ga&&this.ja();jd(this);Wc(this);this.A.error=!1;this.parent.reset.call(this)};
function jd(a){a.T=65536;a.U=32768;a.aa=65535;a.X=32768;a.M=15;a.u=[0,0,0,0,0,0,0,a.Nb];a.Ra=[0,0,0,0,0,0];a.Fa=[0,0,0,0];a.v=0;a.Ka=0;a.Pc=[4,2,0,1];a.V=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.wa=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Uc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.zc=[0,0,0,0,0,0,0,0];a.yc=0;a.H=0;a.F=a.I=0;a.g=a.f=a.ob=0;a.va=-1;kd(a)}function kd(a){a.$a=255;a.Z=0;a.ec=0;a.C=0;a.Ya=0;a.Hb=0;a.Za=0;a.Wa=0;a.Ja=0;a.Bb=262143;a.eb=253952;a.N=null;a.w&&qc(a)}function qc(a){a.Wa?(a.P=65536,a.ba=a.Oc,a.ra=a.Id,a.Kb=a.ze,Zb(a.w,a.Za&16?22:18)):(a.P=0,a.ba=a.Nc,a.ra=a.xc,a.Kb=a.Ec,Zb(a.w,16))}function ld(a,b,c){a.Nb=b;O(a,b);!c&&a.i&&(a.ja()||a.i.da())}k.oc=function(){return 0};
k.save=function(){var a=new P(this);a.set(0,[]);a.set(1,[this.ma,this.Xa]);a.set(2,gc(this.w));return a.data()};k.restore=function(a){var b=a[1];this.ma=b[1];ad(this,b[3]);a:{b=this.w;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.K){for(var f=0,g=Array(b.K),h=0;h<e.length-1;)for(var m=e[h++],n=e[h++];m--;)g[f++]=n;e=g}f=b.W[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function md(a){return a.T&65536?1:0}
function nd(a){return a.U&32768?2:0}function od(a){return a.aa&65535?0:4}k.Qa=function(){return this.X&32768?8:0};function pd(a){var b=a.u[7];a.C&57344||(a.Ya=0,a.Hb=b);a.u[7]=b+2&65535;return a.ra(b)}function qd(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function O(a,b){a.u[7]=b&65535}function pc(a,b){return{Od:a,tb:b,next:null}}function nc(a,b){if(b!=a.N){var c=a.N;if(!c||c.tb<=b.tb)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.tb<=b.tb){b.next=d;c.next=b;break}c=d}while(c)}}a.H|=2}
function Cb(a){return a.M=a.M&63728|a.Qa()|od(a)|nd(a)|md(a)}function sc(a,b){a.X=b<<12;a.aa=~b&4;a.U=b<<14;a.T=b<<16;if((b^a.M)&2048)for(var c=a.Ra.length;0<=--c;){var d=a.u[c];a.u[c]=a.Ra[c];a.Ra[c]=d}a.v=b>>14&3;c=a.M>>14&3;a.v!=c&&(a.Fa[c]=a.u[6],a.u[6]=a.Fa[a.v]);a.M=b;a.H|=2}function R(a,b){a.H&128||(a.X=a.aa=b,a.U=0)}function rd(a,b,c){a.H&128||(a.X=a.aa=a.T=b,a.U=c||0)}function sd(a,b,c,d){a.H&128||(a.X=a.aa=a.T=b,a.U=(c^b)&(d^b))}
function td(a,b){a.H&128||(a.X=a.aa=a.T=b,a.U=a.X^a.T>>1)}function ud(a,b,c,d){a.H&128||(a.X=a.aa=a.T=b,a.U=(c^d)&(d^b))}k.ka=function(a,b){if(!this.L){var c=!1;0>this.va?this.va=Cb(this):this.v||(a=4,c=!0);this.C&57344||(this.Ya=63222,this.Hb=a);this.v=0;var d=this.ra(a|this.P),e=this.ra(a+2&65535|this.P);sc(this,e&-12289|this.va>>2&12288);c&&(this.Z|=4,this.u[6]=4);vd(this,this.va);vd(this,this.u[7]);O(this,d);this.H&=-113;this.va=-1;this.H|=8;this.Tc=a;this.Sc=b;if(26!=b)throw a;}};
function wd(a){var b=xd(a),c=xd(a)&-1793;a.M&49152&&(c=c&-225|a.M&63712);O(a,b);sc(a,c);a.H&=-17}function Pd(a,b){var c=b>>13&31;31>c?a.Za&32&&(b=a.Uc[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b}
function Qd(a,b,c){var d,e,f,g=0;d=b>>13;a.Za&a.Pc[a.v]||(d&=7);e=a.V[a.v][d];f=(a.wa[a.v][d]<<6)+(b&8191)&a.Bb;f<a.eb?f&1&&!(c&1)&&(a.Z|=64,a.ka(4,10)):(a.Za&16||253952<=f&&(f|=4186112),4186112>f&&(3932160<=f&&(f=Pd(a,f&262143)),f>=a.eb&&4186112>f&&(a.Z|=32,a.ka(4,12))));switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=
16384));a.V[a.v][d]=e;if(4194170!==f||a.v)a.Ja=a.v,a.Ka=d;g&&(g&57344&&(0<=a.va&&(g|=128),a.C&57344||(a.C=a.C|g|a.Ja<<5|a.Ka<<1),a.ka(168,16)),a.C&61440||!(4191360>f||4194239<f)||(a.C|=4096,a.C&512&&(a.H|=32)));return f}function Rd(a,b){return a.w.Db(b)}function Sd(a,b,c){b&1&&a.b--;a.w.Sb(b,c&255)}function xd(a){var b=a.ra(a.u[6]|a.P);a.u[6]=a.u[6]+2&65535;return b}
function vd(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.C&57344||(a.Ya=a.Ya<<8|246);!a.v&&c<=a.$a&&4<c&&(c<=a.$a-32?(a.Z|=4,a.u[6]=4,a.ka(4,18)):(a.Z|=8,a.H|=4));a.Kb(c,b)}
function Td(a,b,c,d){var e,f,g=d&8?0:a.P;switch(b){case 0:return a.ka(4,20),0;case 1:return 6===c&&!a.v&&d&4&&(a.u[6]<=a.$a||65534<=a.u[6])&&(a.u[6]<=a.$a-32||65534<=a.u[6]?(a.Z|=4,a.u[6]=4,a.ka(4,22)):(a.Z|=8,a.H|=64)),a.b-=3,7===c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!==c&&(e|=g);e=a.ra(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!==c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!==c&&(e|=g);e=a.ra(e)|g;
a.b-=8;break;case 6:return e=a.ra(qd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.ra(qd(a,2)),e=e+a.u[c]&65535,e=a.ra(e|a.P)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.C&57344||(a.Ya=a.Ya<<8|f<<3&248|c);6==c&&!a.v&&d&4&&0>=f&&(a.u[6]<=a.$a||65534<=a.u[6])&&(a.u[6]<=a.$a-32?(a.Z|=4,a.u[6]=4,a.ka(4,24)):(a.Z|=8,a.H|=64));return e}k.Pb=function(a){if(!this.Wa)return this.w.Pb(a);this.L++;a=Rd(this,Qd(this,a,3));this.L--;return a};
k.ib=function(a){if(!this.Wa)return this.w.ib(a);this.L++;a=this.xc(Qd(this,a,2));this.L--;return a};k.kb=function(a,b){this.Wa?(this.L++,Sd(this,Qd(this,a,5),b),this.L--):this.w.kb(a,b)};k.Ib=function(a,b){this.Wa?(this.L++,this.Ec(Qd(this,a,4),b),this.L--):this.w.Ib(a,b)};k.Nc=function(a,b,c){return Td(this,a,b,c)};k.Oc=function(a,b,c){return Qd(this,Td(this,a,b,c),c)};k.xc=function(a){return this.w.pa(a)};k.Id=function(a){return this.w.pa(Qd(this,a,2))};k.Ec=function(a,b){this.w.mb(a,b&65535)};
k.ze=function(a,b){this.w.mb(Qd(this,a,4),b)};function Ud(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=Td(a,b,d,2),c&65536||61440!==(a.M&61440)&&(d&=65535),a.v=a.M>>12&3,c=a.ra(d|c&a.P),a.v=a.M>>14&3):c=6!=d||(a.M>>2&12288)===(a.M&12288)?a.u[d]:a.Fa[a.M>>12&3];return c}function Vd(a,b,c,d){a.C&57344||(a.Ya=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=Td(a,b,e,4),c&65536||(e&=65535),a.v=a.M>>12&3,e=Qd(a,e|c&65536,4),a.v=a.M>>14&3,a.w.mb(e,d)):6!=e||(a.M>>2&12288)===(a.M&12288)?a.u[e]=d:a.Fa[a.M>>12&3]=d}
function Wd(a,b){b>>=6;var c=a.I=b&7;return(b=a.F=(b&56)>>3)?Rd(a,a.ba(b,c,3)):a.u[c]&255}function Xd(a,b){b>>=6;var c=a.I=b&7;return(b=a.F=(b&56)>>3)?a.w.pa(a.ba(b,c,2)):a.u[c]}function Yd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return Td(a,b,c,8)}function Zd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?Rd(a,a.ba(b,c,3)):a.u[c]&255}function $d(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.w.pa(a.ba(b,c,2)):a.u[c]}
function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.ob=a.ba(b,e,7),Sd(a,e,d.call(a,c,Rd(a,e)))):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function T(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.ba(b,e,6),a.w.mb(e,d.call(a,c,a.w.pa(e)))):a.u[e]=d.call(a,c,a.u[e])}function ae(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?Sd(a,a.ba(b,e,5),c):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}
function be(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.mb(a.ba(b,d,4),c):a.u[d]=c&65535;return c}function U(a,b,c){c&&(O(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
k.xb=function(a){this.A.complete=!0;var b=this.i&&ce(this.i)?1:this.A.Tb?-1:0,c=a?this.A.Tb?0:1:-1;this.A.Tb=!1;this.ca=this.b=a;do{if(b){if(this.i&&de(this.i,this.u[7],c)){this.ja();break}c||c++;b++}if(this.H){this.H&112&&(this.H&32?this.ka(168,28):this.H&64?this.ka(4,30):this.H&16&&this.ka(12,32),this.H&=-113);if(a=this.H&7){a=!1;if(this.H&2){this.H&=-3;var d=160,e=(this.ec&224)>>5,f=this.N&&this.N.tb>e?this.N:null;f&&(d=f.Od,e=f.tb);e>(this.M&224)>>5?(this.H&4&&(qd(this,2),this.H&=-5),this.ka(d,
26),e=!0):e=!1;if(e){if(f)if(a=f,f=this.N,f==a)this.N=a.next;else for(;f;){e=f.next;if(e==a){f.next=e.next;break}f=e}a=!0}}else this.H&1&&this.H++;a=a&&0>c}if(a)break}this.H=this.H&7|this.M&16;this.decode(pd(this))}while(0<this.b);return this.A.complete?this.ca-this.b:void 0===this.A.complete?0:-1};Xa(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new gd(d);C(d,c)}});function ee(a,b){var c=b+a;sd(this,c,a,b);return c&65535}
function fe(a,b){var c=b+a;sd(this,c<<8,a<<8,b<<8);return c&255}function ge(a,b){a=b<<1;td(this,a);return a&65535}function he(a,b){a=b<<1;td(this,a<<8);return a&255}function ie(a,b){a=b&32768|b>>1|b<<16;td(this,a);return a&65535}function je(a,b){a=b&2048|b>>1|b<<8;td(this,a<<8);return a&255}function ke(a,b){a=b&~a;R(this,a);return a}function le(a,b){a=b&~a;R(this,a<<8);return a}function me(a,b){a|=b;R(this,a);return a}function ne(a,b){a|=b;R(this,a<<8);return a}
function oe(a,b){a=~b|65536;rd(this,a);return a&65535}function pe(a,b){a=~b|256;rd(this,a<<8);return a&255}function qe(a,b){a=b-a;this.H&128||(this.X=this.aa=a,this.U=b&(b^a));return a&65535}function re(a,b){a=b-a;var c=a<<8;b<<=8;this.H&128||(this.X=this.aa=c,this.U=b&(b^c));return a&255}function se(a,b){a=b+a;this.H&128||(this.X=this.aa=a,this.U=a&(b^a));return a&65535}function te(a,b){a=b+a;var c=a<<8;this.H&128||(this.X=this.aa=c,this.U=c&(b<<8^c));return a&255}
function ue(a,b){a=-b;rd(this,a,a&b&32768);return a&65535}function ve(a,b){a=-b;rd(this,a<<8,(a&b&128)<<8);return a&255}function we(a,b){a=b<<1|this.T>>16&1;td(this,a);return a&65535}function xe(a,b){a=b<<1|this.T>>16&1;td(this,a<<8);return a&255}function ye(a,b){a=(this.T&65536|b)>>1|b<<16;td(this,a);return a&65535}function ze(a,b){a=((this.T&65536)>>8|b)>>1|b<<8;td(this,a<<8);return a&255}function Ae(a,b){var c=b-a;ud(this,c,a,b);return c&65535}
function Be(a,b){var c=b-a;ud(this,c<<8,a<<8,b<<8);return c&255}function Ce(a,b){this.H&128||(this.X=this.aa=b&65280,this.U=this.T=0);return(b<<8|b>>8)&65535}function De(a,b){a^=b;R(this,a);return a&65535}function Ee(a){T(this,a,Xd(this,a),ee);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}
function Fe(a){var b=$d(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.T=this.U=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.T=c<<17-b,c>>=b;else if(b)if(16<b)this.U=c,c=0;else{this.T=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.U=32768)}this.u[a]=c&65535;this.X=this.aa=c;this.b-=(this.g?6:7)+b}
function Ge(a){var b=$d(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.T=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.T=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.U=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.X=d>>16;this.aa=d>>16|d;this.b-=(this.g?6:7)+b}function He(a){U(this,a,!md(this))}function Ie(a){U(this,a,md(this))}
function Je(a){T(this,a,Xd(this,a),ke);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}function Ke(a){S(this,a,Wd(this,a),le);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}function Le(a){T(this,a,Xd(this,a),me);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}function Me(a){S(this,a,Wd(this,a),ne);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}
function Ne(a){R(this,Xd(this,a)&$d(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}function Oe(a){R(this,(Wd(this,a)&Zd(this,a))<<8);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}function Pe(a){U(this,a,od(this))}function Qe(a){U(this,a,!this.Qa()==!nd(this))}function Re(a){U(this,a,!od(this)&&!this.Qa()==!nd(this))}function Se(a){U(this,a,!md(this)&&!od(this))}function Te(a){U(this,a,od(this)||!this.Qa()!=!nd(this))}
function Ue(a){U(this,a,md(this)||od(this))}function Ve(a){U(this,a,!this.Qa()!=!nd(this))}function We(a){U(this,a,this.Qa())}function Xe(a){U(this,a,!od(this))}function Ye(a){U(this,a,!this.Qa())}function Ze(){this.ka(12,1);this.b-=5}function $e(a){U(this,a,!0)}function af(a){U(this,a,!nd(this))}function bf(a){U(this,a,nd(this))}function V(a){a&1&&(this.T=0);a&2&&(this.U=0);a&4&&(this.aa=1);a&8&&(this.X=0);this.b-=5}
function cf(a){var b=Xd(this,a);a=$d(this,a);ud(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}function df(a){var b=Wd(this,a)<<8;a=Zd(this,a)<<8;ud(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}
function ef(a){var b=$d(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.aa=d>>16|d,this.X=d>>16):(this.U=32768,this.aa=d>>15|d,this.X=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.aa=this.X=0,this.U=32768,this.T=65536,this.b-=7}function ff(){this.ka(24,2);this.b-=25}
function gf(){this.M&49152?(this.Z|=128,this.ka(4,3)):this.i?dc(this.i):this.ja();this.b-=7}function hf(){this.ka(16,4);this.b-=25}var jf=[0,7,7,10,7,11,9,13];function kf(a){this.J=this.b;O(this,Yd(this,a));this.b=this.J-jf[this.g]}var lf=[0,14,14,17,14,18,16,20];function mf(a){this.J=this.b;var b=Yd(this,a);a=a>>6&7;vd(this,this.u[a]);this.u[a]=this.u[7];O(this,b);this.b=this.J-lf[this.g]}var nf=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
function of(a){var b=Xd(this,a);this.J=this.b;R(this,be(this,a,b));this.b=this.J-nf[(this.F?8:0)+this.g]+(7!=this.f||this.g?0:2)}function pf(a){var b=Wd(this,a);R(this,ae(this,a,b,1)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}var qf=[7,13,13,17,14,18,17,21];
function rf(a){var b=$d(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.H&128||(this.X=b>>16,this.aa=this.X|b,this.U=0,this.T=-32768>b||32767<b?65536:0);this.b-=23}function sf(){this.b-=5}function tf(){this.M&49152||(kd(this),this.w.reset());this.b-=667}function uf(){wd(this);this.H|=this.M&16;this.b-=13}
function vf(a){if(a&8)W.call(this,a);else{var b=xd(this);a&=7;7==a?O(this,b):(O(this,this.u[a]),this.u[a]=b);this.b-=9}}function X(a){a&1&&(this.T=65536);a&2&&(this.U=32768);a&4&&(this.aa=0);a&8&&(this.X=32768);this.b-=5}function wf(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)O(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function xf(a){T(this,a,Xd(this,a),Ae);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}
function yf(a){T(this,a,0,Ce);this.b-=this.g?9:3+(7==this.f?2:0)}function zf(){this.ka(28,5);this.b-=5}function Af(){this.H&4||this.B.da();this.H|=4;qd(this,-2);this.b-=3}function Bf(a){T(this,a,Xd(this,a),De);this.b-=this.g?9:3+(7==this.f?2:0)}function W(a){var b;if(b=this.i)b=this.i,E(b,"undefined opcode "+J(b,a),!0,!0),b=dc(b);b||this.ka(8,6)}function hd(a){Cf[a>>12].call(this,a)}function Df(a){Ef[a>>6&3].call(this,a)}function Ff(a){Gf[a>>6&3].call(this,a)}
function Hf(a){If[a>>6&3].call(this,a)}function Jf(a){Kf[a&15].call(this,a)}function Lf(a){Mf[a&15].call(this,a)}function Nf(a){Of[a>>6&3].call(this,a)}function Pf(a){Qf[a>>6&3].call(this,a)}function Rf(a){Sf[a>>6&3].call(this,a)}
var Cf=[function(a){Tf[a>>8&15].call(this,a)},of,cf,Ne,Je,Le,Ee,W,function(a){Uf[a>>8&15].call(this,a)},pf,df,Oe,Ke,Me,xf,W],Tf=[function(a){Vf[a>>4&15].call(this,a)},$e,Xe,Pe,Qe,Ve,Re,Te,mf,mf,Df,Ff,Hf,W,W,W],Ef=[function(a){rd(this,be(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,0,oe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,1,se);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,1,qe);this.b-=this.g?9:3+(7==this.f?2:0)}],Gf=[function(a){T(this,a,0,
ue);this.b-=this.g?11:6},function(a){T(this,a,md(this)?1:0,ee);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,md(this)?1:0,Ae);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=$d(this,a);rd(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],If=[function(a){T(this,a,0,ye);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,0,we);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,0,ie);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,0,ge);this.b-=this.g?9:3+(7==this.f?2:0)}],
Vf=[function(a){Wf[a&15].call(this,a)},W,W,W,kf,kf,kf,kf,vf,W,Jf,Lf,yf,yf,yf,yf],Wf=[gf,Af,uf,Ze,hf,tf,W,W,W,W,W,W,W,W,W,W],Kf=[sf,function(){this.T=0;this.b-=5},function(){this.U=0;this.b-=5},V,function(){this.aa=1;this.b-=5},V,V,V,function(){this.X=0;this.b-=5},V,V,V,V,V,V,V],Mf=[sf,function(){this.T=65536;this.b-=5},function(){this.U=32768;this.b-=5},X,function(){this.aa=0;this.b-=5},X,X,X,function(){this.X=32768;this.b-=5},X,X,X,X,X,X,X],Uf=[Ye,We,Se,Ue,af,bf,He,Ie,ff,zf,Nf,Pf,Rf,W,W,W],Of=[function(a){rd(this,
ae(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,pe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,te);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,re);this.b-=this.g?9:3+(7==this.f?2:0)}],Qf=[function(a){S(this,a,0,ve);this.b-=this.g?11:6},function(a){S(this,a,md(this)?1:0,fe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,md(this)?1:0,Be);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Zd(this,a);rd(this,a<<8);this.b-=this.g?4:3+(7==
this.f?2:0)}],Sf=[function(a){S(this,a,0,ze);this.b-=this.g?9+(this.ob&1):3+(7==this.f?2:0)},function(a){S(this,a,0,xe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,je);this.b-=this.g?9+(this.ob&1):3+(7==this.f?2:0)},function(a){S(this,a,0,he);this.b-=this.g?9:3+(7==this.f?2:0)}];function id(a){Xf[a>>12].call(this,a)}
var Xf=[function(a){Yf[a>>8&15].call(this,a)},of,cf,Ne,Je,Le,Ee,function(a){Zf[a>>8&15].call(this,a)},function(a){$f[a>>8&15].call(this,a)},pf,df,Oe,Ke,Me,xf,W],Yf=[function(a){ag[a>>4&15].call(this,a)},$e,Xe,Pe,Qe,Ve,Re,Te,mf,mf,Df,Ff,Hf,function(a){bg[a>>6&3].call(this,a)},W,W],bg=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.ra(a|this.P);O(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=Ud(this,a,0);vd(this,a);R(this,a);this.b-=11},function(a){var b=xd(this);this.J=
this.b;Vd(this,a,0,b);R(this,b);this.b=this.J-qf[this.g]},function(a){R(this,be(this,a,this.Qa?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],ag=[function(a){cg[a&15].call(this,a)},W,W,W,kf,kf,kf,kf,vf,function(a){a&8?(this.M&49152||(this.M=this.M&-2017|(a&7)<<5,this.H|=1),this.b-=5):W.call(this,a)},Jf,Lf,yf,yf,yf,yf],cg=[gf,Af,uf,Ze,hf,tf,function(){wd(this);this.b-=13},W,W,W,W,W,W,W,W,W],Zf=[rf,rf,ef,ef,Fe,Fe,Ge,Ge,Bf,Bf,W,W,W,W,wf,wf],$f=[Ye,We,Se,Ue,af,bf,He,Ie,ff,zf,Nf,Pf,Rf,function(a){dg[a>>
6&3].call(this,a)},W,W],dg=[W,function(a){a=Ud(this,a,65536);vd(this,a);R(this,a);this.b-=11},function(a){var b=xd(this);this.J=this.b;Vd(this,a,65536,b);R(this,b);this.b=this.J-qf[this.g]},W];
function eg(a){r.call(this,"ROM",a,eg);this.ha=this.f=null;this.C=a.addr;this.g=a.size;this.v=a.alias;this.B=a.file;this.F=sa(this.B);if(this.B){a=this.B;var b=ta(this.F);"json"!=b&&"hex"!=b&&(a=Ga()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var c=this;Ea(a,null,!0,function(a,b,f){f?c.O("Unable to load ROM resource (error "+f+": "+a+")"):(nb(c.Na,a,b),(a=Fa(a,b))?(c.f=a.ea,c.ha=a.ha):c.B=null,fg(c))})}}w(eg);eg.prototype.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;fg(this)};
eg.prototype.Ea=function(){this.ha&&(this.i&&gg(this.i,this.id,this.C,this.g,this.ha),delete this.ha);return!0};eg.prototype.Da=function(){return!0};
function fg(a){if(!tb(a)){if(a.B){if(!a.f||!a.w)return;a.g||(a.g=a.f.length);if(a.f.length!=a.g)vb(a,"ROM size ("+l(a.f.length,8,!0)+") does not match specified size ("+l(a.g,8,!0)+")");else{var b;b=a.C;if(bc(a.w,b,a.g,Ic)){var c;for(c=0;c<a.f.length;c++)a.w.kb(b+c,a.f[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.v?b.push(a.v):null!=a.v&&a.v.length&&(b=a.v);for(c=0;c<b.length;c++){var d=a,e=b[c],f=ac(d.w,d.C,d.g);$b(d.w,e,d.g,f)}delete a.f}}}G(a)}}
Xa(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new eg(d);C(d,c)}});
function hg(a){r.call(this,"RAM",a,hg);this.ha=this.g=null;this.B=a.addr;this.C=a.size;this.Ha=a.load;this.Ga=a.exec;this.v=!1;this.f=a.file;this.F=sa(this.f);if(this.f){a=this.f;var b=ta(this.F);"json"!=b&&"hex"!=b&&(a=Ga()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Ea(a,null,!0,function(a,b,f){f?c.O("Unable to load RAM resource (error "+f+": "+a+")"):(nb(c.Na,a,b),(a=Fa(a,b))?(c.g=a.ea,c.ha=a.ha,null==c.Ha&&(c.Ha=a.Ha),null==c.Ga&&(c.Ga=a.Ga)):c.f=null,ig(c))})}}w(hg);
hg.prototype.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;ig(this)};hg.prototype.Ea=function(){this.ha&&(this.i&&gg(this.i,this.id,this.B,this.C,this.ha),delete this.ha);return!0};hg.prototype.Da=function(){return!0};function ig(a){if(a.w&&(!a.v&&a.C&&bc(a.w,a.B,a.C,1)&&(a.v=!0),!tb(a))){if(!a.v)q("No RAM allocated");else if(a.f){if(!a.g||!a.w)return;Cg(a,a.g,a.Ha,a.Ga,a.B)}G(a)}}
hg.prototype.reset=function(){if(this.v){for(var a=this.w,b=this.B,c=this.C,d=b&a.w,b=b>>>a.la;0<c&&b<a.W.length;){var e=a.W[b],f=c,g,d=d||0;void 0===f&&(f=e.size);if(wb)for(g=d;f--&&g<e.G.length;g++)e.G[g]=0;else for(g=d;f--&&g<e.size;g++)e.Vb(d,0,e.D+d);c-=a.xa;b++;d=0}this.g&&Cg(this,this.g,this.Ha,this.Ga,this.B,!0)}};
function Cg(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var m=b[h]&255|(b[h+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(h+6>=b.length)break;for(var h=h+2,n=b[h++]&255|(b[h++]&255)<<8,p=b[h++]&255|(b[h++]&255)<<8,m=m+((n&255)+(n>>8)+(p&255)+(p>>8)),u=h,v=n-=6;0<n&&h<b.length;)m+=b[h++]&255,n--;if(n||h>=b.length)break;m+=b[h++]&255;if(m&255)break;if(v)for(;v--;)a.b.kb(p++,b[u++]&255);else p&1?a.b.ja():ld(a.b,p,f);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.b.kb(c+
e,b[e]);null!=d&&ld(a.b,d,f);g=!0}return g}Xa(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new hg(d);C(d,c)}});function Dg(a){r.call(this,"Keyboard",a,Dg,65536);G(this)}w(Dg);Dg.prototype.sa=function(){return!1};Dg.prototype.Ca=function(a,b,c,d){this.B=a;this.b=c;this.i=d};Xa(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Dg(d);C(d,c)}});
function Y(a){this.N=a.baudReceive||9600;this.R=a.baudTransmit||9600;this.ca=a.upperCase;this.v=this.F=null;this.S=a.tabSize;this.P=a.charBOL;this.I=0;r.call(this,"SerialPort",a,Y,8388608);var b=a.binding;if("console"==b)this.F="";else{var c;a=Eg;b&&(void 0===c&&(c="Panel"),(c=qb(c,this.id))&&(b=c.G[b])&&this.sa(null,a,b))}this.J=this.L=null;this.exports={connect:this.tc,receiveData:this.dc}}w(Y);var Eg="buffer";k=Y.prototype;
k.sa=function(a,b,c){var d=this;switch(b){case Eg:return this.G[b]=this.v=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.dc(b);return!0},c.onkeypress=function(a){a=a||window.event;d.dc(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
k.Ca=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;var e=this;this.ma=pc(48,4);this.Y=mc(this.b,function(){e.f&128||!e.C.length||(e.K=e.C.shift()&255,e.ca&&97<=e.K&&122>e.K&&(e.K-=32),e.f|=128,e.f&64&&nc(e.b,e.ma))});this.na=pc(52,4);this.$=mc(this.b,function(){e.g|=128;e.g&64&&nc(e.b,e.na)});ic(b,this,Fg);G(this)};
k.tc=function(){if(!this.J){var a=Vc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ya(b[0]);if(c!=this.cb)return;b=ya(b[1]);if(this.J=pb(b)){var d=this.J.exports;if(d){var e=d.connect;e&&e.call(this.J);if(this.L=d.receiveData){this.status(this.Na+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.Ea=function(a,b){if(!b)if(this.tc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
k.Da=function(a){return a?this.save():!0};k.reset=function(){Gg(this)};k.save=function(){var a=new P(this);a.set(0,[]);return a.data()};k.restore=function(){return Gg(this)};function Gg(a){a.K=0;a.f=0;a.g=128;a.C=[];return!0}k.dc=function(a){if("number"==typeof a)this.C.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.C.push(a.charCodeAt(b));else this.C=this.C.concat(a);oc(this.b,this.Y,1E3/Math.round(this.N/10));return!0};k.sd=function(){return this.f&65534};
k.je=function(a){this.f=this.f&-112|a&111};k.rd=function(){this.f&=-129;0<this.C.length&&oc(this.b,this.Y,1E3/Math.round(this.N/10));return this.K};k.ie=function(){};k.Kd=function(){return this.g};k.Be=function(a){128==(this.g&192)&&a&64&&oc(this.b,this.$,1E3/Math.round(this.R/10));this.g=this.g&-70|a&69};k.Jd=function(){return 0};
k.Ae=function(a){if(a&=255){E(this,"transmitByte("+l(a,2,!0)+")");this.L&&this.L.call(this.J,a);if(this.v)if(13==a)this.I=0;else if(8==a)this.v.value=this.v.value.slice(0,-1),0<this.I&&this.I--;else{var b;b=(b=za[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.S||8,c=a-this.I%a,this.S&&(b=xa("",c)));this.P&&!this.I&&c&&(b=String.fromCharCode(this.P)+b);this.v.value+=b;this.v.scrollTop=this.v.scrollHeight;this.I+=c}else if(null!=this.F){if(10==a||1024<=this.F.length)this.j(this.F),
this.F="";10!=a&&(this.F+=String.fromCharCode(a))}this.g&=-129;oc(this.b,this.$,1E3/Math.round(this.R/10))}};var Hg={},Fg=(Hg[65392]=[null,null,Y.prototype.sd,Y.prototype.je,"RCSR"],Hg[65394]=[null,null,Y.prototype.rd,Y.prototype.ie,"RBUF"],Hg[65396]=[null,null,Y.prototype.Kd,Y.prototype.Be,"XCSR"],Hg[65398]=[null,null,Y.prototype.Jd,Y.prototype.Ae,"XBUF"],Hg);Xa(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Y(d);C(d,c)}});
function tc(a){r.call(this,"PC11",a,tc);this.g=a.autoMount||null;this.F=0;this.$=a.baudReceive||3600;this.K=this.L=this.f=0;this.J=[];this.I=Ig;this.v=Jg;this.N=this.C="";this.ea=this.Ha=this.Ga=null;this.R=-1;this.P=!Pa("Mobi")&&window&&"FileReader"in window}w(tc);var Ig="",Jg=0;k=tc.prototype;
k.sa=function(a,b,c){var d=this,e=Jg;switch(b){case "listTapes":return this.G[b]=c,c.onchange=function(){var a=d.G.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(m){q("PC11 option error: "+m.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.G[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.G[b]=c,c.onclick=
function(){var a=d.G.listTapes;a&&Kg(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.P){c.parentNode.removeChild(c);break}this.G[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Kg(d,sa(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.G[b]=c,!0}return!1};
k.Ca=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;this.S=Lg(a);var e=this;if((this.g=Vc(this.B,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){q("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.Y=pc(56,4);this.ca=mc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.K<e.J.length&&(e.L=e.J[e.K++]&255,Mg(e,e.K/e.J.length*100),e.f|=128,e.f&=-2049,e.f&64&&nc(e.b,e.Y))});ic(b,this,Ng);Og(this,"None",Ig,!0);this.P&&Og(this,"Local Tape",
"?");Og(this,"Remote Tape","??");Pg(this)||G(this)};k.Ea=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.Da=function(a){return a?this.save():!0};k.reset=function(){this.f&=-2241;this.L=0};function Pg(a){a.F=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.G.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=sa(b,!0)}b&&c?Qg(a,c,b,1,!0):Rg(a)}return!!a.F}
function Kg(a,b,c,d,e){if(c)if("?"==c)a.O('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=sa(c);a.status("Attempting to load "+c+' as "'+b+'"');a.I="??"}else a.I=c;Qg(a,b,c,d,!1,e)}else Sg(a,!1)}
function Qg(a,b,c,d,e,f){var g=-1;if(a.C.toLowerCase()!=c.toLowerCase()||a.v!=d)g++,Sg(a,!0),a.A.Ua?a.O("PC11 busy"):(e&&(a.F++,F(a)&&E(a,"auto-loading tape: "+b)),Tg(a,b,c,d,f)?g++:a.A.Ua=!0);g&&Ug(a,a.N,a.C,a.v,a.ea,a.Ha,a.Ga)}
function Tg(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),Ug(a,b,c,d,e),a.I="?");Rg(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=ta(c),f="json"==e||"gz"==e?encodeURI(c):Ga()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Ea(f,null,!0,function(e,f,g){var h=0>g&&a.B&&!a.B.A.ia;g?a.O('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(nb(a.Na,e,f),(e=Fa(e,f))&&Ug(a,b,c,d,e.ea,e.Ha,
e.Ga));a.A.Ua=!1;a.F&&(a.F--,a.F||G(a));Rg(a)})}function Og(a,b,c,d){if((a=a.G.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function Rg(a){var b=a.G.listTapes;if(b&&b.options){a=a.I||a.C;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function Mg(a,b){b|=0;if(b!==a.R){var c=a.G.readProgress;c&&(c=(c=D(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.R=b}}
function Ug(a,b,c,d,e,f,g){a.N=b;a.C=c;a.v=d;a.ea=e;a.Ha=f;a.Ga=g;2==d?a.S&&Cg(a.S,e,f,g)?a.status("tape loaded: "+b):(a.N="",a.C="",a.I=Ig,a.v=Jg,a.O("No load address available for tape: "+b)):(a.K=0,a.J=e,a.status("tape attached: "+b),Mg(a,0))}function Sg(a,b){if(a.C||!1===b)a.N="",a.C="",b||(a.v&&a.status(1==a.v?"tape detached":"tape unloaded"),a.I=Ig,a.v=Jg,Rg(a))}k.save=function(){return(new P(this)).data()};k.restore=function(){return!0};k.ld=function(){return this.f&65534};
k.ce=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&nc(this.b,this.Y)):(this.f&=-129,this.f|=2048,this.L=0,oc(this.b,this.ca,1E3/Math.round(this.$/10))));this.f=this.f&-66|a&65};k.kd=function(){this.f&=-129;this.f|=2048;return this.L};k.be=function(){};var Vg={},Ng=(Vg[65384]=[null,null,tc.prototype.ld,tc.prototype.ce,"PRS"],Vg[65386]=[null,null,tc.prototype.kd,tc.prototype.be,"PRB"],Vg);
function Wg(a,b,c){r.call(this,"Disk",{id:a.Na+".disk"+l(++Xg,4)},Wg,2097152);this.controller=a;this.B=a.B;this.i=a.i;this.v=b;this.Sa=b.name;this.$b=b.$b;Yg(this,c,b.ta,b.ya,b.qa,b.Ia);G(this)}var Xg=0;w(Wg);k=Wg.prototype;k.Ca=function(a,b,c,d){this.i=d};
function Yg(a,b,c,d,e,f){a.mode=b;a.ta=c;a.ya=d;a.qa=e;a.Ia=f;a.b=[];if("preload"!=a.mode){b=Array(a.ta);for(c=0;c<b.length;c++){d=Array(a.ya);for(e=0;e<d.length;e++){f=Array(a.qa);for(var g=1;g<=f.length;g++)f[g-1]=Zg(null,c,e,g,a.Ia,0);d[e]=f}b[c]=d}a.b=b}a.f=null}
function $g(a,b,c,d,e){var f=c;if(a.w)return!0;a.Sa=b;a.ab=c;a.Bc=sa(c);a.w=e;a.C=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=la[d];if(e){a.ta=e[0];a.ya=e[1];a.qa=e[2];a.Ia=e[3]||512;c=a.Ia>>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.ta);for(d=0;d<a.b.length;d++)for(var v=a.b[d]=Array(a.ya),x=0;x<v.length;x++)for(var z=v[x]=Array(a.qa),y=0;y<z.length;y++){for(var B=Zg(null,d,x,y+1,a.Ia,0),ja=B.data,Ja=0;Ja<c;Ja++,f+=4)var Q=ja[Ja]=b.getInt32(f,
!0),e=e+Q&-1;B.Aa=c;z[y]=B}a.f=e;c=a}else a.O("Unrecognized disk format ("+d+" bytes)");a.w&&(a.w.call(a.controller,a.v,c,a.Sa,a.ab),a.w=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=ta(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ua(c,"/")&&(d="dir"),f=Ga()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.$b?"":e)+"&format=json"));return!!Ea(f,
null,!0,function(b,c,d){ah(a,b,c,d)})}
function ah(a,b,c,d){var e=null;a.g=!1;var f=0>d&&a.B&&!a.B.A.ia;if(d)a.controller.O('Unable to load disk "'+a.Sa+'" (error '+d+": "+b+")",f);else{nb(a.controller.Na,b,c);try{if(0<sa(a.Bc,!0).toLowerCase().indexOf("-readonly"))a.g=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.g=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.Sa]:h=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(h.length)if(1==h.length)q(h[0]);else{a.ta=h.length;a.ya=h[0].length;a.qa=h[0][0].length;var m=h[0][0][0];a.Ia=m&&m.length||512;for(d=c=0;d<a.ta;d++)for(f=0;f<a.ya;f++)for(g=0;g<a.qa;g++)if(m=h[d][f][g]){var n=m.length;void 0===n&&(n=m.length=512);var n=n>>2,p=m.pattern;void 0===p&&(p=m.pattern=0);var u=m.data;if(void 0===u){var v=m.bytes;if(void 0!==v&&v.length){for(var x=n<<2,z=v.length;z<x;z++)v[z]=p;bh(m,v)}else u=[],p=m.pattern=p|p<<8|p<<16|p<<24,m.data=u;delete m.bytes}Zg(m,d,f);for(x=
0;x<u.length;x++)c=c+u[x]&-1}a.b=h;a.f=c;e=a}else q("Empty disk image: "+a.Sa)}catch(y){q("Disk image error ("+b+"): "+y.message)}}a.w&&(a.w.call(a.C,a.v,e,a.Sa,a.ab),a.w=null)}function Zg(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.Ge=b;a.He=c;a.Ma=a.Aa=0;a.Pa=!1;return a}
k.seek=function(a,b,c,d,e){d=null;var f=this.v,g=this.b[a];if(g){var h=g[b];if(!h&&f.Hc&&b<f.ya)for(h=g[b]=Array(f.Ic),g=0;g<h.length;g++)h[g]=Zg(null,a,b,g+1,f.vc,0);if(h){for(g=0;g<h.length;g++)if(h[g]&&h[g].sector==c){d=h[g];break}!d&&f.Hc&&9==f.ic&&(d=h[g]=Zg(null,a,b,f.ic,f.vc,0))}}e&&e(d,!1);return d};function bh(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
k.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};k.write=function(a,b,c){if(this.g)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.Aa?f<a.Ma?(a.Aa+=a.Ma-f,a.Ma=f):f>=a.Ma+a.Aa&&(a.Aa+=f-(a.Ma+a.Aa)+1):(a.Ma=f,a.Aa=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
function ch(a,b){var c=a.ya*a.qa,d=b/c|0;return d<a.ta?(b%=c,a.seek(d,b/a.qa|0,b%a.qa+1)):null}function dh(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}
k.save=function(){var a=0,b=[];b[a++]=[this.ab,this.f,this.ta,this.ya,this.qa,this.Ia];if(!this.g)for(var c=this.b,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Aa){for(var h=[],m=0,n=g.Ma,p=g.Ma+g.Aa;n<p;)h[m++]=g.data[n++];b[a++]=[d,e,f,g.Ma,h]}}return b};
k.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.b.length&&6<=e.length?Yg(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.f&&e[1]!=this.f&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.f+")",b=-2));for(this.b.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],h=g[f++],m=g[f++],n=g[f++];if(h>=this.b.length||m>=this.b[h].length||n>=this.b[h][m].length){c="sector (CHS="+h+":"+m+":"+n+") out of range ("+
b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(h=this.b[h][m][n]){for(m=h.data.length;m<e;)h.data[m++]=h.pattern;m=0;h.Ma=e;for(h.Aa=f.length;e<g;)h.data[e++]=f[m++];b++}}}0>b&&-2!=b&&this.controller.O("Unable to restore disk '"+this.Sa+": "+c);return b};
k.toJSON=function(){var a;a=0;for(var b;b=ch(this,a++);)eh(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function eh(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function N(a){r.call(this,"RL11",a,N,2097152);this.v=a.autoMount||null;this.I=0;this.f=Array(1);this.L=!Pa("Mobi")&&window&&"FileReader"in window}w(N);k=N.prototype;
k.sa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.G[b]=c,c.onchange=function(){var a=d.G.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){q("RL11 option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.G[b]=c,c.onchange=function(){var a=qa(c.value,10);null!=a&&fh(d,a)},!0;case "loadDrive":return this.G[b]=
c,c.onclick=function(){var a=d.G.listDisks;a&&gh(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.L){c.parentNode.removeChild(c);break}this.G[b]=c;c.onclick=function(){var a=d.G.listDrives;if(a&&a.options&&d.f)if(a=d.f[qa(a.value,10)||0])if(a=a.Ba){var b;b="";for(var c=0,h;h=ch(a,c++);)for(var m=0,n=h.length;m<n;m++)b+=String.fromCharCode(dh(a,h,m));b=btoa(b);a=a.Bc.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),
"string"!=typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");q(a)}else d.O("No disk loaded in drive.");else d.O("No disk drive selected.")};return!0;case "mountDrive":if(this.L)return this.G[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=
!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;gh(d,sa(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
k.Ca=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;if((this.v=Vc(this.B,"autoMount")||this.v)&&"string"==typeof this.v)try{this.v=eval("("+this.v+")")}catch(e){q("RL11 auto-mount error: "+e.message+" ("+this.v+")"),this.v=null}hh(this);this.P=pc(112,5);ic(b,this,ih);jh(this,"None","",!0);this.L&&jh(this,"Local Disk","?");jh(this,"Remote Disk","??");kh(this)||G(this)};
k.Ea=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.B.mc){for(a=0;a<this.f.length;a++)lh(this,a,!0);kh(this,!0)}}else if(!this.restore(a))return!1;if(a=this.G.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;1>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";fh(this,0)}}return!0};k.Da=function(a){return a?this.save():!0};k.reset=function(){hh(this)};k.save=function(){return(new P(this)).data()};
k.restore=function(a){return hh(this,a[0])};function kh(a,b){b||(a.I=0);if(a.v)for(var c in a.v){var d=a.v[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.G.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=sa(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.f.length)){!mh(a,g,f,e,!0)&&b&&G(a,!1);continue}a.O("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.I}
function gh(a,b,c,d){var e=a.G.listDrives,e=e&&qa(e.value,10);if(void 0===e||0>e||e>=a.f.length)a.O("Unable to load the selected drive");else if(c)if("?"==c)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=sa(c);a.status("Attempting to load "+c+' as "'+b+'"')}mh(a,e,b,c,!1,d)}else lh(a,e)}
function mh(a,b,c,d,e,f){var g=-1,h=a.f[b];h.ab.toLowerCase()!=d.toLowerCase()&&(g++,lh(a,b,!0),h.Zb?a.O("RL11 busy"):(h.Zb=!0,e&&(h.Yb=!0,a.I++,F(a)&&E(a,"auto-loading disk: "+c)),h.Lb=!!f,$g(new Wg(a,h,"preload"),c,d,f,a.Kc)&&g++));return g}
k.Kc=function(a,b,c,d,e){var f;a.Zb=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.ta||f[1]>a.ya)&&(this.O('Disk "'+c+'" too large for drive '+("RL"+a.ac)),b=null);b?(a.Ba=b,a.Sa=c,a.ab=d,this.O('Mounted disk "'+c+'" in drive '+("RL"+a.ac),a.Yb||e),this.B&&this.B.lb()):a.Lb=!1;a.Yb&&(a.Yb=!1,--this.I||G(this));fh(this,a.ac)};
function jh(a,b,c,d){if((a=a.G.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function fh(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.G.listDisks;a=a.G.listDrives;if(d&&a&&d.options&&a.options&&(a=qa(a.value,10),c=c.Lb?"?":c.ab,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function lh(a,b,c){var d=a.f[b];if(d.Ba||!1===c)d.Sa="",d.ab="",d.Ba=null,d.Lb=!1,c||(a.O("Drive RL"+b+" unloaded",c),fh(a,b))}
function hh(a,b){var c=0;b||(b=[]);a.fa=b[c++]||0;a.J=b[c++]||0;a.g=b[c++]||0;a.C=b[c++]||0;a.F=b[c++]||0;a.K=b[c]||0;for(b=0;b<a.f.length;b++){var d=a.f[b];void 0===d&&(d=a.f[b]={});c=a;d.ac=b;d.Zb=d.Lb=!1;d.name=c.cb;d.ta=512;d.ya=2;d.qa=40;d.Ia=256;d.$b=!0;d.Fe=0;d.Ee=0;d.De=0;d.ic=1;d.Ic=d.qa;d.vc=d.Ia;d.Ie=0;d.Ke=null;d.Ba||(d.ab="");d.status=29|(512==d.ta?128:0)}return!0}
k.Lc=function(a,b,c,d,e,f){this.J=f&65535;this.fa=this.fa&-49|f>>12&48;this.K=f>>16&63;this.C=this.g=b<<7|(c?64:0)|d&63;this.F=65536-e&65535;a&&(this.fa=this.fa|a|32768);return!0};
k.Yc=function(a,b,c,d,e,f,g){for(var h=0,m=a.Ba,n=null,p;e--;){if(!n){n=a.Ba.seek(b,c,d,!0);if(!n){h=5120;break}p=0}var u,v;if(0>(u=a.Ba.read(n,p++))||0>(v=a.Ba.read(n,p++))){h=5120;break}this.w.Ib(Pd(this.b,f),u|v<<8);if(lc(this.w)){h=8192;break}f+=2;if(p>=m.Ia&&(n=null,++d>=m.qa&&(d=0,++c>=m.ya&&(c=0,++b>=m.ta)))){h=5120;break}}return g(h,b,c,d,e,f)};
k.Sd=function(a,b,c,d,e,f,g){for(var h=0,m=a.Ba,n=null,p;e--;){var u=this.w.ib(Pd(this.b,f));if(lc(this.w)){h=8192;break}f+=2;if(!n){n=a.Ba.seek(b,c,d,!0);if(!n){h=5120;break}p=0}if(!a.Ba.write(n,p++,u&255)||!a.Ba.write(n,p++,u>>8)){h=5120;break}if(p>=m.Ia&&(n=null,++d>=m.qa&&(d=0,++c>=m.ya&&(c=0,++b>=m.ta)))){h=5120;break}}return g(h,b,c,d,e,f)};k.vd=function(){return this.fa&65535};
k.me=function(a){this.fa=this.fa&-1023|a&1022;this.N=this.N&-4|(a&48)>>4;if(!(this.fa&128)){var b;a=!0;var c=this.f[(this.fa&768)>>8],d,e,f,g;this.fa&=-2;switch(this.fa&14){case 4:this.g&8&&(this.fa&=63);this.F=c.status|this.C&64;break;case 6:1==(this.g&3)&&(b=this.g&65408,c=(this.g&16)<<2,this.C=this.g&4?this.C+b:this.C-b,this.g=this.C=this.C&65408|c);break;case 8:this.F=this.C;break;case 12:b=this.Yc;case 10:b||(b=this.Sd),d=this.g>>7,e=this.g&64?0:1,f=this.g&63,d>=c.ta||f>=c.qa?this.fa|=37888:
(g=(this.K&63)<<16|this.J,a=65536-this.F&65535,a=b.call(this,c,d,e,f,a,g,this.Lc.bind(this)))}a&&(this.fa|=129,this.fa&64&&nc(this.b,this.P))}};k.td=function(){return this.J};k.ke=function(a){this.J=a&65534};k.wd=function(){return this.g};k.ne=function(a){this.g=a};k.xd=function(){return this.F};k.oe=function(a){this.F=a};k.ud=function(){return this.K};k.le=function(a){this.K=a&63};
var nh={},ih=(nh[63744]=[null,null,N.prototype.vd,N.prototype.me,"RLCS"],nh[63746]=[null,null,N.prototype.td,N.prototype.ke,"RLBA"],nh[65284]=[null,null,N.prototype.wd,N.prototype.ne,"RLDA"],nh[65286]=[null,null,N.prototype.xd,N.prototype.oe,"RLMP"],nh[65288]=[null,null,N.prototype.ud,N.prototype.le,"RLBE"],nh);function oh(a){r.call(this,"Debugger",a,oh);this.$=a.base||16;this.za=!1;this.J=0;this.P=!1;this.v=-1;this.g=[];this.S={}}w(oh);
var ph={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};oh.prototype.pc=function(){return-1};oh.prototype.qc=function(){};
function qh(a,b,c,d){if(c)if(b){0>a.v&&a.g.length&&(a.v=0);if(0>a.v||b!=a.g[a.v])a.g.splice(0,0,b),a.v=0;a.v--}else a.P?b="end":b=a.g[a.v+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(ya(b.substring(c,f))),c=f+1}}return a}
function rh(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
function ph(a,b,c){var d;if(b){b=qh(a,b);for(var e=0,f=!1,g=b,h=[],m=[],n=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<n.length;){var q=n[e++],w=q.length,q=xa(q);if(!q){f=!0;break}q=rh(a,q,null,!1===c);if(void 0===q){f=!0;c=!1;break}h.push(q);if(e==n.length)break;var q=n[e++],v=q.length;m.length&&mh[q]<mh[m[m.length-1]]&&oh(h,m,1);m.push(q);b=b.substr(w+v)}oh(h,m)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&sh(a,null,
d))}return d}function qh(a,b){for(var c,d=a.va?"(":"{",e=a.va?")":"}",f=new RegExp(a.va?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=ph(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
function rh(a,b,c,d){var e;null!=b?(e=a.oc(b),0<=e?e=a.pc(e):(e=a.S[b],null==e&&(e=pa(b,a.Z))),null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)):d||a.j("missing "+(c||"value"));return e}
function sh(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var m=d&255,n=8,q="";n?32<n&&(n=32):n=32;if(null==m||isNaN(m))for(;0<n--;)q="?"+q;else for(;0<n--;)q=(m&1?"1":"0")+q,m>>=1;g=q+g;d>>=8}d=l(c,0,!0)+" "+c+". "+qa(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function th(a,b){if(b)return sh(a,b,a.S[b]);var c=0;for(b in a.S)sh(a,b,a.S[b]),c++;return 0<c}
function J(a,b,c,d){switch(a.Z){case 8:a=qa(b,3*c);break;case 10:a=b.toString();break;default:a=l(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
function uh(a){lh.call(this,a);this.ab=!1;this.va=!0;this.K=Y(0);this.$a=Y(0);this.N=Y(0);this.I=[];this.f=this.L=this.C=[];vh(this);this.ma=0;wh(this);this.Ea={};xh(this,a.messages);this.Fa=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Xc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Xc(b,a)})}u(uh,lh);
var yh={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},zh=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
Ah={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
function sh(a,b,c){var d;if(b){b=th(a,b);for(var e=0,f=!1,g=b,h=[],m=[],n=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<n.length;){var p=n[e++],u=p.length,p=ya(p);if(!p){f=!0;break}p=uh(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}h.push(p);if(e==n.length)break;var p=n[e++],v=p.length;m.length&&ph[p]<ph[m[m.length-1]]&&rh(h,m,1);m.push(p);b=b.substr(u+v)}rh(h,m)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&vh(a,null,
d))}return d}function th(a,b){for(var c,d=a.za?"(":"{",e=a.za?")":"}",f=new RegExp(a.za?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=sh(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
function uh(a,b,c,d){var e;null!=b?(e=a.pc(b),0<=e?e=a.qc(e):(e=a.S[b],null==e&&(e=qa(b,a.$))),null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)):d||a.j("missing "+(c||"value"));return e}
function vh(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var m=d&255,n=8,p="";n?32<n&&(n=32):n=32;if(null==m||isNaN(m))for(;0<n--;)p="?"+p;else for(;0<n--;)p=(m&1?"1":"0")+p,m>>=1;g=p+g;d>>=8}d=l(c,0,!0)+" "+c+". "+ra(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function wh(a,b){if(b)return vh(a,b,a.S[b]);var c=0;for(b in a.S)vh(a,b,a.S[b]),c++;return 0<c}
function J(a,b,c,d){switch(a.$){case 8:a=ra(b,3*c);break;case 10:a=b.toString();break;default:a=l(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
function xh(a){oh.call(this,a);this.fb=!1;this.za=!0;this.K=Z(0);this.eb=Z(0);this.N=Z(0);this.I=[];this.f=this.L=this.C=[];yh(this);this.na=0;zh(this);this.Ja={};Ah(this,a.messages);this.Ka=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Yc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Yc(b,a)})}w(xh,oh);
var Bh={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},Ch=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
Dh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106,32768],35072:[107,32768]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,
63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},Bh=[0],Ch=
[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=uh.prototype;
k.wa=function(a,b,c,d){this.w=b;this.b=c;this.B=a;(a=Uc(a,"messages"))&&xh(this,a);this.jb=Ah;this.wb=1145>this.b.mb?Ch:[];Dh(this,function(a){a:{var b=d.w.W,c=a[0],e=a=0,m=b.length;if(c){a=d.aa(Eh(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.w.ka;m=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,n=0;m--;){var q=b[e];q.type==c?n++||d.j("..."):(c=q.type,n=ec[c],q&&d.j(l(q.id,8)+" %"+l(e<<d.w.ka,
8)+" %%"+l(q.D,8)+" "+l(q.Eb,4,!0)+" "+l(q.size,4,!0)+" "+n),c!=Gc&&(c=-1),n=0);a+=d.w.ua;e++}}});G(this)};
k.qa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.la=this.F[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Xc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.A<d.g.length-1&&(b=d.g[++d.A])):40==a.keyCode&&(0<d.A?b=d.g[--d.A]:(b="",d.A=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.F[b]=c,Qa(c,function(){if(d.la){var a=d.la.value;
d.la.value="";Xc(d,a,!0);return!0}return!1}),!0;case "step":return this.F[b]=c,Qa(c,function(a){var b=!1;rb(d,!0)||(qb(d,!0),b=d.tb(a?1:0),qb(d,!1));return b}),!0}return!1};k.gb=function(a){if(this.la){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.la.focus();!a&&window&&window.scrollTo(b,c)}};k.aa=function(a){a=a&&a.D;null==a&&(a=-1);return a};k.zb=function(a,b){var c=255,d=this.aa(a,!1,1);-1!==d&&(c=a.Jb?this.w.Mb(d):this.b.Mb(d),b&&Fh(a,b));return c};
k.oa=function(a,b){var c=65535,d=this.aa(a,!1,2);-1!==d&&(c=a.Jb?this.w.lb(d):this.b.lb(d),b&&Fh(a,b));return c};k.Qb=function(a,b,c){var d=this.aa(a,!0,1);-1!==d&&(a.Jb?this.w.fb(d,b):this.b.fb(d,b),c&&Fh(a,c),this.B.da(!0))};k.hb=function(a,b,c){var d=this.aa(a,!0,2);-1!==d&&(a.Jb?this.w.Rb(d,b):this.b.Rb(d,b),c&&Fh(a,c),this.B.da(!0))};function Y(a,b){return{D:a,Jb:b,Ga:!1}}function Gh(a){return[a.D,a.Ga]}function Hh(a){return{D:a[0],Ga:a[1]}}
function Eh(a,b,c){var d,e=(c?a.K:a.$a).D;c=!1;if(void 0!==b){b=qh(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.I.length;e++){var g=a.I[e].ga[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Y(d));break}}if(d=f)return d;e=ph(a,b,void 0)}null!=e&&(d=Y(e,c));return d}function Ih(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Ec=nh(a,b.zc=c[2]))}function Fh(a,b){null!=a.D&&(a.D+=b||1)}
function xh(a,b){a.i=a;a.na=a.Ic=536870912;a.ba=null;a.ra=[];b=nh(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in wb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.na|=wb[c],a.j(c+" messages enabled"))}}function Dh(a,b){for(var c in wb)if(64==wb[c]){a.Ea[c]=b;break}}
k.oc=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function Jh(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.pc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Na[a-8]:20>a?b=this.b.Aa[a-16]:20==a&&(b=Bb(this.b)));return b};
k.message=function(a,b){b&&(a+=" @"+J(this,Y(this.b.Db).D));this.na&1073741824?this.ra.push(a):this.ba&&a==this.ba||(this.ba=a,this.na&-2147483648&&(this.ia(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,cd(a),a.ra=0,a.B.da()))};function wh(a){var b;if(!ae(a))a.G&&a.G.length&&a.j("instruction history buffer freed"),a.Y=0,a.G=[];else if(!a.G||!a.G.length){a.G=Array(1E3);for(b=0;b<a.G.length;b++)a.G[b]=Y();a.Y=0;a.j("instruction history buffer allocated")}}
k.sb=function(a,b){if(!Kh(this,b))return!1;this.b.sb(a);return!0};k.tb=function(a,b,c){if(!Kh(this))return!1;this.J=0;a||ae(this)&&be(this,this.b.u[7],0);try{a=dd(this.b,a);var d=this.b.tb(a);0<d&&(ed(this.b,a),this.J+=d,ad(this.b,d,!0),Yc(this.b,d),this.sa++)}catch(e){"number"!=typeof e&&(this.J=0,ub(this.b,e.stack||e.message))}!1!==c&&this.B.da();this.da(b||!1);return 0<this.J};k.ia=function(a){this.b&&this.b.ia(a)};
k.da=function(a){if(this.ab){void 0===a&&(a=!0);var b;b=this.b;if(b=b.H&8?b.Rc|b.Qc<<8:0){var c=b>>8;this.j("trapped to "+J(this,b&255,1)+(c?" ("+J(this,c)+")":""))}this.K=Y(this.b.u[7]);a&&1!=this.R?Lh(this):Mh(this)}};function Kh(a,b){var c;(c=!a.b||!sb(a.b))||(c=a.b,c.v.ha?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.v.fa?(b||a.j("cpu busy or unavailable, command ignored"),!1):!tb(a.b)}k.za=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
k.ya=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){wh(this);this.sa=0;this.ba=null;this.J=0;this.K=Y(this.b.u[7]);this.v.fa=!1;Nh(this);a||this.da()};k.save=function(){var a=new O(this);a.set(0,Gh(this.K));a.set(1,Gh(this.N));a.set(2,[this.g,this.P,this.na]);a.set(3,this.I);return a.data()};
k.restore=function(a){var b=0;void 0!==a[2]&&(this.K=Hh(a[b++]),this.N=Hh(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.P=a[b][1],this.na|=a[b][2]);a[3]&&(this.I=a[3]);return!0};k.start=function(a,b){this.R||this.j("running");this.v.fa=!0;this.xb=a;this.yb=b};
k.stop=function(a,b){if(this.v.fa){this.v.fa=!1;this.J=b-this.yb;if(!this.R){b="stopped";if(this.J){a-=this.xb;var c=0<a?Math.round(1E3*this.J/a):0;b+=" (";ae(this)&&(b+=this.sa+" instructions, ",this.sa=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}this.da(!0);this.gb();Nh(this,this.b.u[7]);this.ba=null}};function ae(a){return 1<a.f.length||!!a.ma}
function be(a,b,c){var d=-1;c||(d=a.b.lb(b),0==d&&(b=pd(a.b,2)));if(0<c&&(a.ma&&!--a.ma||Pc(a,b,1,a.f)))return!0;0<=c&&a.G.length&&(a.sa++,0>d&&(d=a.b.lb(b)),65535!=(d&65535)&&(c=a.G[a.Y],c.D=b,c.Ga=!1,++a.Y==a.G.length&&(a.Y=0)));return!1}function cc(a){var b=a.b;if(b.v.fa)throw N(b,a.b.Db),a.ia(),-1;return!1}
function vh(a){var b,c;a.f=["bp"];if(a.L)for(b=1;b<a.L.length;b++){c=a.L[b];var d=a.w;c=a.aa(c);Qc(d.W[c>>>d.ka],!1)}a.L=["br"];if(a.C)for(b=1;b<a.C.length;b++)c=a.C[b],d=a.w,c=a.aa(c),Qc(d.W[c>>>d.ka],!0);a.C=["bw"];a.Ya=0}k.cb=function(a,b,c){var d=!0;c||Oh(this,a,b,!1,!0);if(a!=this.f){var e=this.aa(b);if(-1===e)this.j("invalid address: "+J(this,b.D)),d=!1;else{var f=this.w;f.W[e>>>f.ka].cb(e&f.w,a==this.C)}}d&&(a.push(b),c?b.Ga=!0:(Ph(this,a,a.length-1,"set"),wh(this)));return d};
function Oh(a,b,c,d,e){var f=!1;c=a.aa(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.aa(h)&&(!d||h.Ga)){f=!0;h.Ga||e||Ph(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.w,Qc(d.W[c>>>d.ka],b==a.C));h.Ga||wh(a);break}}return f}function Qh(a,b){for(var c=1;c<b.length;c++)Ph(a,b,c);return b.length-1}function Ph(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.D)+(d?" "+d:c.zc?' "'+c.zc+'"':""))}
function Nh(a,b){if(void 0!==b)Pc(a,b,1,a.f,!0),a.R=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ga){if(!Oh(a,a.f,c,!0))break;b=0}}}
function Pc(a,b,c,d,e){var f=!1;if(!a.Ya++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Ga)for(var m=a.aa(h),n=0;n<c;n++)if(b+n==m){var q,f=!0;h.Ga&&(Oh(a,d,h,!0),e=!0);if(q=h.Ec){for(var f=!1,w=0;w<q.length;w++)if(!Rh(a,q[w],!0)){if(q[w].indexOf("if")){f=!0;break}for(var v=w+1;v<q.length&&q[v].indexOf("else");v++)w++;if(v==q.length){f=!0;break}}a.b.v.fa||(f=!0)}if(f){e||Ph(a,d,g,"hit");break}}}a.Ya--;return f}
function Sh(a,b,c,d){var e=Y(b.D),f=a.oa(b,2),g,h;for(h in a.jb)if(g=a.jb[h][f&h])break;g||(g=Bh);var m=g[0];0<=a.wb.indexOf(m)&&(g=Bh,m=g[0]);var n=h="",q=zh[m],w=g.length-1;m||w||(h=J(a,f));for(m=1;m<=w;m++){var v=g[m];if(void 0!==v){var x;x=a;var z=v,v=b,y="",B=z&61440;if(4096==B)v=v.D+((f&255)<<24>>23)&65535,y=J(x,v);else if(8192==B)v=v.D-((f&63)<<1)&65535,y=J(x,v);else if(12288==B)y=J(x,f&7,1);else if(24576==B)y=J(x,f&63,1);else if(32768==B)y=J(x,f&255,1);else if(B=f&z,z&4032&&(B>>=6,z>>=6),
z&63)switch(z=B&7,B&56){case 0:y=Jh(z);break;case 8:y="@"+Jh(z);break;case 16:7>z?y="("+Jh(z)+")+":(B=x.oa(v,2),y="#"+J(x,B,0,!0));break;case 24:7>z?y="@("+Jh(z)+")+":(B=x.oa(v,2),y="@#"+J(x,B,0,!0));break;case 32:y="-("+Jh(z)+")";break;case 40:y="@-("+Jh(z)+")";break;case 48:B=x.oa(v,2);y=J(x,B,0,!0)+"("+Jh(z)+")";7==z&&(y=J(x,B+v.D&65535));break;case 56:B=x.oa(v,2),y="@"+J(x,B)+"("+Jh(z)+")",7==z&&(y="@"+J(x,B+v.D&65535))}x=y;if(!x||!x.length){h="INVALID";break}"string"!=typeof x&&(n=x[1],x=x[0]);
0<h.length&&(h+=",");h+=x||"???"}}f="";g=J(a,e.D)+":";if(-1!==e.D&&-1!==b.D){do if(f+=" "+J(a,a.oa(e,2)),null==e.D)break;while(e.D!=b.D)}g+=wa(f,24);g+=wa(q,5);h&&(g+=" "+h);if(c||n)g=wa(g,60)+";"+(c||""),g=a.b.v.kb?g+("cycles="+Zc(a.b).toString()+" cs="+l(a.b.Ab)):g+(null!=d?"="+d.toString():""),n&&(g+=" @"+n);return g}function Th(a,b){switch(b){case "N":a=a.b.Ma();break;case "Z":a=nd(a.b);break;case "V":a=md(a.b);break;case "C":a=ld(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function Uh(a,b){var c="",d=a.b;8>b?(c=Jh(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Na[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.Aa[b-16]):20==b&&(c="PS="+J(a,Bb(d)));c&&(c+=" ");return c}function Vh(a){var b,c="";for(b=0;6>b;b++)c+=Uh(a,b);c=c+"\n"+(Uh(a,6)+Uh(a,7)+Uh(a,20));return c+=Th(a,"T")+Th(a,"N")+Th(a,"Z")+Th(a,"V")+Th(a,"C")}k.ic=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function eg(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var m=h.o,n=h.a;if(void 0!==m){var q=f,m=[m>>>0,g],w=za(q,m,a.ic);0>w&&q.splice(-(w+1),0,m)}n&&(h.a=n.replace(/''/g,'"'))}a.I.push({we:b,D:c,Pc:d,ga:e,gc:f})}function Wh(a,b,c){var d=[],e=a.aa(b)>>>0;for(b=0;b<a.I.length;b++){var f=a.I[b],g=f.D>>>0,h=f.Pc;if(e>=g&&e<g+h){e=za(f.gc,[e-g],a.ic);0<=e?Xh(a,b,e,d):c&&(e=~e,Xh(a,b,e-1,d),Xh(a,b,e,d));break}}return d}
function Xh(a,b,c,d){var e={},f=a.I[b].gc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.I[b].ga[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function Yh(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return th(a)||a.j("no variables"),!0;if(!c[2])return th(a,c[1]);if(!c[3])return delete a.S[c[1]],!0;b=ph(a,c[3]);return void 0!==b?(a.S[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
function Zh(a,b,c){var d=null;if(b=Eh(a,b,!0)){a.aa(b);var e=Wh(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.D-e[1])&&(g=" + "+l(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.j(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.D)&&(g=" - "+l(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
function Lh(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}f=ph(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":N(d,f);a.K=Y(d.u[7]);break;case "N":d.X=f?32768:0;break;case "Z":d.$=
f?0:1;break;case "V":d.U=f?32768:0;break;case "C":d.T=f?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=f&65535;break}a.j("unknown register: "+e);return}a.B.da();a.j("updated registers:")}a.j(Vh(a));c&&(a.K=Y(d.u[7]),Mh(a,J(a,a.K.D)))}}function $h(a,b){b=xa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):sh(a,null,c[2].charCodeAt(0)):ph(a,b,!0)}
function ai(a,b,c){var d="t"!=b;c=rh(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Pa(c,function(){return qb(a,!0)&&a.tb(e,d,!1)},function(){a.B.da();qb(a,!1)})}
function Mh(a,b,c,d){if(b=Eh(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=rh(a,c.substr(1)),null!=c&&(d=c);else{d=Eh(a,c,!0);if(!d||d.D<b.D)return;e=d.D-b.D;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=rb(a,!1)||a.R?a.J:null;var g=null!=f?"cycles":null,h=Wh(a,b),m=b.D;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var n=h[0]+":";h[2]&&(n+=" "+h[2]);a.j(n)}h[3]&&(g=h[3],f=null);f=Sh(a,b,g,f);a.j(f);a.K=b;e-=b.D-m;c++}}}
function Rh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.P&&(a.j("ended assemble at "+J(a,a.N.D)),a.K=a.N,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ba=null;if(sb(a)&&0<b.length){a.P&&(b="a "+J(a,a.N.D)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],m=h.charAt(0),n=1;n<h.length;n++){var q=h.charAt(n);if("?"==m||"r"==m||"a">q||"z"<q){g[0]=h.substr(n);g.unshift(h.substr(0,n));break}}switch(g[0].charAt(0)){case "a":var w=
Eh(a,g[1],!0);if(w)if(a.N=w,void 0===g[2])a.j("begin assemble at "+J(a,w.D)),a.P=!0,a.B.da();else{var v;a.j("not supported yet");v=[];if(v.length){for(var x=0;x<v.length;x++)a.Qb(w,v[x],1);a.j(Sh(a,a.N))}}break;case "b":a:{var z=g[0],y=g[1],B=b;if("?"==y)a.j("breakpoint commands:"),a.j("\tbp [a]\tset exec breakpoint at addr [a]"),a.j("\tbr [a]\tset read breakpoint at addr [a]"),a.j("\tbw [a]\tset write breakpoint at addr [a]"),a.j("\tbc [a]\tclear breakpoint at addr [a]"),a.j("\tbl\tlist all breakpoints"),
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var ia=z.charAt(1);if("l"==ia){var Ja;Ja=0+Qh(a,a.f);Ja+=Qh(a,a.L);(Ja+=Qh(a,a.C))||a.j("no breakpoints")}else if("n"==ia)a.ma=rh(a,y),a.j("break after "+a.ma+" instruction(s)");else if(void 0===y)a.j("missing breakpoint address");else{var P=Y();if("*"!=y&&(P=Eh(a,y,!0),!P))break a;"c"==ia?null==P.D?(vh(a),a.j("all breakpoints cleared")):Oh(a,a.f,P)||Oh(a,a.L,P)||Oh(a,a.C,P)||a.j("breakpoint missing: "+J(a,P.D)):null!=P.D&&(Ih(a,P,B),"p"==ia?a.cb(a.f,
P):"r"==ia?a.cb(a.L,P):"w"==ia?a.cb(a.C,P):a.j("unknown breakpoint command: "+ia))}}}break;case "c":a.Ka&&(a.Ka.value="");break;case "d":a:{var bb,cb=g[0],la=g[1],La=g[2],ti=g[3];if("?"==la){var db="";for(bb in wb)a.Ea[bb]&&(db&&(db+=","),db+=bb);db+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
db.length&&a.j("dump extension commands:\n\t"+db)}else if("state"==la){var gg=bi(a.B,!0);"console"==La?console.log(gg):(a.Ka&&(a.Ka.value=""),a.j(gg))}else if("symbols"==la)for(var vd=0;vd<a.I.length;vd++){var wd=a.I[vd],eb;for(eb in wd.ga)if("."!=eb.charAt(0)){var hg=wd.ga[eb].o;if(void 0!==hg){var ig=wd.ga[eb].l;ig&&(eb=ig);a.j(J(a,hg)+" "+eb)}}}else{if("d"==cb){for(bb in wb)if(g[1]==bb){var jg=a.Ea[bb];jg?(g.shift(),g.shift(),jg(g)):a.j("no dump registered for "+la);break a}la||(cb=a.Kb||"db")}else a.Kb=
cb;if("dh"==cb){var kg=la,lg=La,mg="",ng=0,ea=a.Y,ma=a.G;if(ma.length){var Z=+kg||a.bb,Db=+lg||10;isNaN(Z)?Z=Db:mg="more ";Z>ma.length&&(a.j("note: only "+ma.length+" available"),Z=ma.length);ea-=Z;0>ea&&(null==ma[ma.length-1].D?(Z=ea+Z,ea=0):ea+=ma.length);var xd=[];"call"==lg&&(Db=1E5,xd=["CALL"]);for(void 0!==kg&&a.j(Z+" instructions earlier:");0<Db&&ea!=a.Y;){var og=ma[ea++];if(null==og.D)break;var Eb=Y(og.D),ui=Z--,pg=Sh(a,Eb,"history",ui);(!xd.length||0<=pg.indexOf(xd[0]))&&a.j(pg);Eb.Wb&&(ea+=
Eb.Wb,Db-=Eb.Wb,Z-=Eb.Wb);ea>=ma.length&&(ea=0);a.bb=Z;ng++;Db--}}ng||(a.j("no "+mg+"history available"),a.bb=void 0)}else{var Fb=Eh(a,la);if(Fb){var vc=0;La&&("l"==La.charAt(0)&&(La=La.substr(1)||ti),vc=rh(a,La)>>>0,65536<vc&&(vc=65536));for(var Gb="",fb="dd"==cb?4:"dw"==cb?2:1,wc=fb*vc||128,vi=wc+15>>4||1;vi--&&0<wc;){var xc=0,Hb=0,Ib,yd="",qg="",la=J(a,Fb.D);for(Ib=4==fb?16:a.Z;0<Ib&&0<wc;Ib--){var yc=1,zc=1==fb?a.zb(Fb,yc):a.oa(Fb,yc=2),xc=xc|zc<<(Hb<<3),Hb=Hb+yc;Hb==fb&&(yd+=J(a,xc,fb),yd+=1==
fb?9==Ib?"-":" ":" ",xc=Hb=0);qg+=32<=zc&&128>zc?String.fromCharCode(zc):".";wc-=yc}Gb&&(Gb+="\n");Gb+=la+" "+yd+(0==Ib?" "+qg:"")}Gb&&a.j(Gb);a.$a=Fb}}}}break;case "e":if("else"==g[0])break;var gb,zd,Ad,Bd,Cd=g[0],Dd=g[1];"eb"==Cd?(gb=1,zd=255,Ad=a.zb,Bd=a.Qb):"e"==Cd||"ew"==Cd?(gb=2,zd=65535,Ad=a.oa,Bd=a.hb):Dd=null;if(null==Dd)a.j("edit memory commands:"),a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var Ac=Eh(a,Dd);if(Ac)for(var Bc=2;Bc<g.length;Bc++){var Jb=
ph(a,g[Bc]);if(void 0===Jb){a.j("unrecognized value: "+g[Bc]);break}Jb&~zd&&a.j("warning: "+l(Jb)+" exceeds "+gb+"-byte value");var wi=Ad.call(a,Ac);a.j("changing "+J(a,Ac.D)+" from "+J(a,wi,gb)+" to "+J(a,Jb,gb));Bd.call(a,Ac,Jb,gb)}}break;case "g":a:{var rg=g[1],xi=b;if(void 0!==rg){var Ed=Eh(a,rg,!0);if(!Ed)break a;Ih(a,Ed,xi);a.cb(a.f,Ed,!0)}a.sb(!0,c)}break;case "h":a.v.fa?(c||a.j("halting"),a.ia()):rb(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var Fd;var Kb=b.substr(2),Kb=
xa(Kb);ph(a,Kb)?(c||a.j("true: "+Kb),Fd=!0):(c||a.j("false: "+Kb),Fd=!1);Fd||(d=!1);break}f=!0;break;case "k":var yi=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var Gd=0,Hd=Y(),Lb=Y(a.b.u[6]);for(a.j("stack trace for "+J(a,Lb.D));10>Gd;){for(var Ma=null,zi=256;65536>Lb.D>>>0;){Hd.D=a.oa(Lb,2);if(null==Lb.D||!zi--)break;if(!(Hd.D&1)){for(var Ai=a,Cc=Hd,sg=null,Mb=Cc.D,tg=Mb,Id=1;6>=Id&&Mb;Id++){if(2<Id){Cc.D=Mb;var Dc=Sh(Ai,
Cc);if(0<=Dc.indexOf("JSR")){var ug=Dc.indexOf(" ");if(Mb+(Dc.indexOf(" ",ug+1)-ug-1)/2==tg){sg=Dc;break}}}Mb-=2}Cc.D=tg;if(Ma=sg)break}}if(!Ma||null==Ma)break;var vg=null;if("ks"==yi){var wg=Ma.match(/[0-9A-F]+$/);wg&&(vg=Zh(a,wg[0]))}Ma=wa(Ma,50)+" ;"+(vg||"stack="+J(a,Lb.D));a.j(Ma);Gd++}Gd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){Zh(a,g[1],!0);break}f=!0;break;case "m":a:{var na,oa=null,H=g[1];"?"==H&&(H=void 0);if(void 0!==H){var Ca=0;if("all"==H)Ca=1878917119,H=null;
else if("on"==H)oa=!0,H=null;else if("off"==H)oa=!1,H=null;else{"keys"==H&&(H="key");"kbd"==H&&(H="keyboard");for(na in wb)if(H==na){Ca=wb[na];oa=!!(a.na&Ca);break}if(!Ca){a.j("unknown message category: "+H);break a}}if(Ca)if("on"==g[2])a.na|=Ca,oa=!0;else if("off"==g[2]&&(a.na&=~Ca,oa=!1,1073741824==Ca)){for(var Jd=0;Jd<a.ra.length;Jd++)a.j(a.ra[Jd]);a.ra=[]}}var Bi=0,Nb="";for(na in wb)if(!H||H==na){var Ci=!!(a.na&wb[na]);if(null===oa||oa==Ci)Nb&&(Nb+=","),++Bi%10||(Nb+="\n\t"),"key"==na&&(na="keys"),
Nb+=na}void 0===H&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==oa?oa?"messages on: ":"messages off: ":"message categories:\n\t")+(Nb||"none"));wh(a)}break;case "p":if("print"==g[0]){$h(a,b.substr(5));break}var Di="pr"==g[0]?1:0;if(a.R)a.j("step in progress");else{var xg=Y(a.b.u[7]);a.zb(xg);a.R?(a.cb(a.f,xg,!0),a.sb()||(a.B&&a.B.gb(),a.R=0)):ai(a,Di?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}Lh(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Ob=
+g[2];if(8==Ob||10==Ob||16==Ob)a.Z=Ob;else{a.j("invalid base: "+Ob);break}}a.j("default base: "+a.Z);break;case "cs":var Pb;void 0!==g[3]&&(Pb=+g[3]);switch(g[2]){case "int":a.b.nb=Pb;break;case "start":a.b.Bb=Pb;break;case "stop":a.b.ob=Pb;break;default:a.j("unknown cs option");break a}void 0!==Pb&&Wc(a.b);a.j("checksums "+(a.b.v.kb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&($c(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.eb.toFixed(2)+
"Mhz")+" ("+a.b.Ta+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":ai(a,g[0],g[1]);break;case "u":Mh(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Yh(a,b.substr(3))||(d=!1);break}if("ver"==
g[0]){a.j("PDPjs version 1.30.2 ("+a.b.mb+",RELEASE"+(vb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){$h(a,b.substr(1));break}var Kd="commands:",Ld;for(Ld in yh)Kd+="\n"+wa(Ld,9)+yh[Ld];ae(a)||(Kd+="\nnote: history disabled if no exec breakpoints");a.j(Kd);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(yg){a.j("debugger error: "+(yg.stack||yg.message)),d=!1}return d}
function Xc(a,b,c){b=nh(a,b,c);for(var d in b)if(!Rh(a,b[+d]))return!1;return!0}Wa(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new uh(d);C(d,c)}});
function ci(a,b,c){r.call(this,"Computer",a,ci,67108864);this.v.ha=!1;di(this,b);this.L=Uc(this,"autoPower",a);this.B=0;this.Y=a.busWidth||a.buswidth;this.f=ei;this.J=null;this.G=this.R=!1;this.Z=Uc(this,"url")||"";(Math.random()+.1).toString(36);this.g=fi(this);if(this.b=pb("CPU",this.id)){this.i=pb("Debugger",this.id);this.w=new Cb({id:this.Ia+".bus",busWidth:this.Y},this.b,this.i);var d,e=nb(this.id);if((this.A=pb("Panel",this.id))&&this.A.Ka)for(b=0;b<e.length;b++)d=e[b],d.O=this.A.O,d.j=this.A.j,
d.Ka=this.A.Ka;this.j("PDPjs v1.30.2\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.wa&&d.wa(this,this.w,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.I=d:this.f=parseInt(d,10));var f;if(a=Uc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.G=!0,this.f=ei),this.f&&(this.K=
new O(this,"1.30.2"),gi(this.K)?b=null:delete this.K);!b&&this.f&&(b=hi(this))&&(this.G=!0);if(b){var g=this;Da(b,null,!0,function(a,b,c){c?(g.I=null,g.G=!1,g.O("Unable to load machine state from server (error "+c+(b?": "+xa(b):"")+")")):(g.J=b,g.R=!0);G(g)})}else G(this);this.F.power||(this.L=!0);!c&&this.L&&ii(this,this.Cb)}else p("Unable to find CPU component")}u(ci);var ei=0;
function di(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){p(d.message+" ("+c+")")}}a.S=b}function Uc(a,b,c){var d=b.toLowerCase(),d=ab[b]||ab[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function ii(a,b,c){for(var d=nb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!sb(f)){sb(f,function(){ii(a,b,c)});return}}b.call(a,c)}
function ji(a,b){var c=new O(a,"1.30.2","validate");if(gi(c)&&ki(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.O("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=ci.prototype;
k.Cb=function(a){void 0===a&&(a=this.f||(this.J?1:ei));if(!this.B){this.B++;var b=!1,c=!1;this.P=!1;var d=this.K||new O(this,"1.30.2");if(-1==a)b=!0;else if(a>ei){if(gi(d,this.J)){this.C=new O(this,"1.30.2","failsafe");gi(this.C)&&(li(this,d),a=2,mi(this.C));this.C.set("timestamp",Ba());ni(this.C);var e=this.f&&!this.G;if(1==a||Ga("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=ki(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?gi(d,g):("error"==
f&&"no machine state"!=g?(this.O("Error: "+g),"unable to verify user"==g&&(Na("user",""),this.g=null)):this.j(f+": "+g),mi(d),gi(d)?(c=ki(d),e=!0):c=!1))}e&&ji(this,c?d:null)}else 2==a&&d.clear()}else ji(this);delete this.J;delete this.K}e=nb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=oi(this,g,d,b,c));b=[d,a,c];-1!=a?ii(this,this.kc,b):this.kc(b)}};
function oi(a,b,c,d,e){if(!b.v.ha){b.v.ha=!0;if(b.za){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.za(f,d)&&f&&(p("Unable to restore state for "+b.type),a.N&&!a.R?(c.clear(),a.f=ei,window&&window.location.reload()):a.P=!0,b.za(null),e=!1)}if(!d&&b.mc)for(a=b.mc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
k.kc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ba=!0;this.v.ha=!0;var d=this.F.power;d&&(d.textContent="Shutdown");this.b&&(oi(this,this.b,b,c,a),this.b.ib());this.P&&(li(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.B=0};
function li(a,b){if(Ga("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.2"};d.url=a.Z;d.user=c;d.type="bug";d.data=b;Da("http://www.pcjs.org/api/v1/report",d,!0)}}
function bi(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new O(a,"1.30.2"),g=new O(a,"1.30.2","validate"),h=Ba();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.2");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.ya&&(c&&a.b.ia(),d=a.b.ya(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.ha=!1,!1===d&&(e=null)));for(var h=nb(a.id),m=0;m<h.length;m++){var n=h[m];n.v.ha&&(n.ya&&(d=n.ya(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.v.ha=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&pi(a,a.g,f.toString()),ni(g)&&ni(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.v.ha=!1,b=a.F.power)&&(b.textContent="Power");a.B=0;return e}k.reset=function(){this.w&&this.w.reset&&(E(this,"Resetting "+this.w.type),this.w.reset());for(var a=nb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.w&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}};
k.start=function(a,b){for(var c=nb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.da(!0)};k.stop=function(a,b){for(var c=nb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.da(!0)};
k.qa=function(a,b,c){var d=this;switch(b){case "power":return this.F[b]=c,c.onclick=function(){d.B||(d.v.ha?bi(d,!1,!0):ii(d,d.Cb))},!0;case "reset":return this.F[b]=c,c.onclick=function(){if(d.v.ha&&!d.B)if(d.f&&!d.I){var a=Ga("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");bi(d,a,!0);!a&&d.N?window&&window.location.reload():(a||(d.lc=!0),d.Cb(ei),d.lc=!1)}else d.reset(),d.b&&d.b.ib()},!0;case "save":if(ta(Fa(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.F[b]=c,c.onclick=function(){var a=fi(d,!0);if(a){var b=!!(d.f&&!d.I||d.N),c=bi(d,b);b?pi(d,a,c):d.O("Resume disabled, machine state not saved")}},!0}return!1};
function fi(a,b){var c=a.g;c||((c=Ka("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=qi(a,c))||a.O("The user ID is invalid.")):b&&a.O("Browser local storage is not available"));return c}
function qi(a,b){a.g=null;b=Da(Fa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Na("user",b.data),a.g=b.data)}catch(d){p(d.message+" ("+c+")")}return a.g}function hi(a){var b=null;a.g&&(b=Fa()+"/api/v1/user?req=load&user="+a.g+"&state="+ri(a,"1.30.2"));return b}
function pi(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=ri(a,"1.30.2");d.data=c;b=Da(Fa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.O("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.O(c),Na("user",""),a.g=null)}}
function Jg(a){var b;a=nb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.gb=function(a){if(this.Ka){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Ka.focus();!a&&window&&window.scrollTo(b,c)}};k.da=function(a){this.b&&this.b.da(a);this.A&&this.A.da(a)};
Wa(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new ci(g,d,!0);C(g,f);g.L&&ii(g,g.Cb)}});Ra.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=pb("Computer",c.id))&&c.ba&&!c.v.ha&&c.Cb(-1)}});
Ra.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=pb("Computer",c.id))&&c.v.ha&&bi(c,!(!c.f||c.I),!0)}});function O(a,b,c){this.id=a.id;this.key=ri(a,b,c);this.i=a.i;mi(this,a.Oc)}function ri(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
O.prototype={constructor:O,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){mi(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function mi(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function ni(a){var b=!0;if(Ia()){var c=JSON.stringify(a[a.id]);Na(a.key,c)||(p("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function ki(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){p(c.message||c),b=!1}return b}function gi(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ia()&&(b=Ka(a.key))?(a[a.id]=b,a.b=!0):!1}var si=0;
function Ei(a,b,c,d,e,f){e("Loading "+a+"...");Da(a,null,!0,function(g,h,m){m?(h||(h="unable to load "+a+" ("+m+")"),f(h,null)):Fi(h,a,b,c,d,e,f)})}
function Fi(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(mb(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){f=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Gi(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Gi(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Da(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=h[0],n,q=/( [a-z]+=)(['"])(.*?)\2/g;n=q.exec(f);)m=0>m.indexOf(n[1])?m.replace(">",n[0]+">"):m.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);h[0]!=m&&(g=g.replace(h[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);Gi(a,b,c)}})}else c(a,null)}
function Hi(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=va(a))}function f(a){e("Error: "+a);m&&(--si||Ya(!0));m=!1}var g,h,m=!0;si++;lb[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],w=document.createElement("style");w.type="text/css";w.styleSheet?w.styleSheet.cssText=n:w.appendChild(document.createTextNode(n));q.appendChild(w)}c||
(c="/versions/pdpjs/1.30.2/components.xsl");n=function(d,h){h?Ei(c,null,null,!1,e,function(d,m){m?(mb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=h.transformNode(m))?(g.outerHTML=m,--si||Ya(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--si||Ya(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Ei(b,a,d,!0,e,n):Fi(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(v){f(v.message)}return m}window.embedPDP11=function(a,b,c,d){Ya(!1);return Hi(a,b,c,d)};window.enableEvents=Ya;window.sendEvent=Za;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11-dbg.map
63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},Eh=[0],Fh=
[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=xh.prototype;
k.Ca=function(a,b,c,d){this.w=b;this.b=c;this.B=a;(a=Vc(a,"messages"))&&Ah(this,a);this.ob=Dh;this.Ab=1145>this.b.qb?Fh:[];Gh(this,function(a){a:{var b=d.w.W,c=a[0],e=a=0,m=b.length;if(c){a=d.ba(Hh(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.w.la;m=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,n=0;m--;){var p=b[e];p.type==c?n++||d.j("..."):(c=p.type,n=fc[c],p&&d.j(l(p.id,8)+" %"+l(e<<d.w.la,
8)+" %%"+l(p.D,8)+" "+l(p.Jb,4,!0)+" "+l(p.size,4,!0)+" "+n),c!=Hc&&(c=-1),n=0);a+=d.w.xa;e++}}});G(this)};
k.sa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ma=this.G[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Yc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.v<d.g.length-1&&(b=d.g[++d.v])):40==a.keyCode&&(0<d.v?b=d.g[--d.v]:(b="",d.v=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.G[b]=c,Ra(c,function(){if(d.ma){var a=d.ma.value;
d.ma.value="";Yc(d,a,!0);return!0}return!1}),!0;case "step":return this.G[b]=c,Ra(c,function(a){var b=!1;sb(d,!0)||(rb(d,!0),b=d.xb(a?1:0),rb(d,!1));return b}),!0}return!1};k.lb=function(a){if(this.ma){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.ma.focus();!a&&window&&window.scrollTo(b,c)}};k.ba=function(a){a=a&&a.D;null==a&&(a=-1);return a};k.Db=function(a,b){var c=255,d=this.ba(a,!1,1);-1!==d&&(c=a.Mb?this.w.Pb(d):this.b.Pb(d),b&&Ih(a,b));return c};
k.pa=function(a,b){var c=65535,d=this.ba(a,!1,2);-1!==d&&(c=a.Mb?this.w.ib(d):this.b.ib(d),b&&Ih(a,b));return c};k.Sb=function(a,b,c){var d=this.ba(a,!0,1);-1!==d&&(a.Mb?this.w.kb(d,b):this.b.kb(d,b),c&&Ih(a,c),this.B.da(!0))};k.mb=function(a,b,c){var d=this.ba(a,!0,2);-1!==d&&(a.Mb?this.w.Ib(d,b):this.b.Ib(d,b),c&&Ih(a,c),this.B.da(!0))};function Z(a,b){return{D:a,Mb:b,La:!1}}function Jh(a){return[a.D,a.La]}function Kh(a){return{D:a[0],La:a[1]}}
function Hh(a,b,c){var d,e=(c?a.K:a.eb).D;c=!1;if(void 0!==b){b=th(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.I.length;e++){var g=a.I[e].ha[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Z(d));break}}if(d=f)return d;e=sh(a,b,void 0)}null!=e&&(d=Z(e,c));return d}function Lh(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Fc=qh(a,b.Ac=c[2]))}function Ih(a,b){null!=a.D&&(a.D+=b||1)}
function Ah(a,b){a.i=a;a.oa=a.Jc=536870912;a.ca=null;a.ua=[];b=qh(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in xb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.oa|=xb[c],a.j(c+" messages enabled"))}}function Gh(a,b){for(var c in xb)if(64==xb[c]){a.Ja[c]=b;break}}
k.pc=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function Mh(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.qc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ra[a-8]:20>a?b=this.b.Fa[a-16]:20==a&&(b=Cb(this.b)));return b};
k.message=function(a,b){b&&(a+=" @"+J(this,Z(this.b.Hb).D));this.oa&1073741824?this.ua.push(a):this.ca&&a==this.ca||(this.ca=a,this.oa&-2147483648&&(this.ja(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,dd(a),a.ua=0,a.B.da()))};function zh(a){var b;if(!ce(a))a.F&&a.F.length&&a.j("instruction history buffer freed"),a.Y=0,a.F=[];else if(!a.F||!a.F.length){a.F=Array(1E3);for(b=0;b<a.F.length;b++)a.F[b]=Z();a.Y=0;a.j("instruction history buffer allocated")}}
k.wb=function(a,b){if(!Nh(this,b))return!1;this.b.wb(a);return!0};k.xb=function(a,b,c){if(!Nh(this))return!1;this.J=0;a||ce(this)&&de(this,this.b.u[7],0);try{a=ed(this.b,a);var d=this.b.xb(a);0<d&&(fd(this.b,a),this.J+=d,bd(this.b,d,!0),Zc(this.b,d),this.va++)}catch(e){"number"!=typeof e&&(this.J=0,vb(this.b,e.stack||e.message))}!1!==c&&this.B.da();this.da(b||!1);return 0<this.J};k.ja=function(a){this.b&&this.b.ja(a)};
k.da=function(a){if(this.fb){void 0===a&&(a=!0);var b;b=this.b;if(b=b.H&8?b.Tc|b.Sc<<8:0){var c=b>>8;this.j("trapped to "+J(this,b&255,1)+(c?" ("+J(this,c)+")":""))}this.K=Z(this.b.u[7]);a&&1!=this.R?Oh(this):Ph(this)}};function Nh(a,b){var c;(c=!a.b||!tb(a.b))||(c=a.b,c.A.ia?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.A.ga?(b||a.j("cpu busy or unavailable, command ignored"),!1):!ub(a.b)}k.Ea=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
k.Da=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){zh(this);this.va=0;this.ca=null;this.J=0;this.K=Z(this.b.u[7]);this.A.ga=!1;Qh(this);a||this.da()};k.save=function(){var a=new P(this);a.set(0,Jh(this.K));a.set(1,Jh(this.N));a.set(2,[this.g,this.P,this.oa]);a.set(3,this.I);return a.data()};
k.restore=function(a){var b=0;void 0!==a[2]&&(this.K=Kh(a[b++]),this.N=Kh(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.P=a[b][1],this.oa|=a[b][2]);a[3]&&(this.I=a[3]);return!0};k.start=function(a,b){this.R||this.j("running");this.A.ga=!0;this.Bb=a;this.Cb=b};
k.stop=function(a,b){if(this.A.ga){this.A.ga=!1;this.J=b-this.Cb;if(!this.R){b="stopped";if(this.J){a-=this.Bb;var c=0<a?Math.round(1E3*this.J/a):0;b+=" (";ce(this)&&(b+=this.va+" instructions, ",this.va=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}this.da(!0);this.lb();Qh(this,this.b.u[7]);this.ca=null}};function ce(a){return 1<a.f.length||!!a.na}
function de(a,b,c){var d=-1;c||(d=a.b.ib(b),0==d&&(b=qd(a.b,2)));if(0<c&&(a.na&&!--a.na||Qc(a,b,1,a.f)))return!0;0<=c&&a.F.length&&(a.va++,0>d&&(d=a.b.ib(b)),65535!=(d&65535)&&(c=a.F[a.Y],c.D=b,c.La=!1,++a.Y==a.F.length&&(a.Y=0)));return!1}function dc(a){var b=a.b;if(b.A.ga)throw O(b,a.b.Hb),a.ja(),-1;return!1}
function yh(a){var b,c;a.f=["bp"];if(a.L)for(b=1;b<a.L.length;b++){c=a.L[b];var d=a.w;c=a.ba(c);Rc(d.W[c>>>d.la],!1)}a.L=["br"];if(a.C)for(b=1;b<a.C.length;b++)c=a.C[b],d=a.w,c=a.ba(c),Rc(d.W[c>>>d.la],!0);a.C=["bw"];a.bb=0}k.hb=function(a,b,c){var d=!0;c||Rh(this,a,b,!1,!0);if(a!=this.f){var e=this.ba(b);if(-1===e)this.j("invalid address: "+J(this,b.D)),d=!1;else{var f=this.w;f.W[e>>>f.la].hb(e&f.w,a==this.C)}}d&&(a.push(b),c?b.La=!0:(Sh(this,a,a.length-1,"set"),zh(this)));return d};
function Rh(a,b,c,d,e){var f=!1;c=a.ba(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.ba(h)&&(!d||h.La)){f=!0;h.La||e||Sh(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.w,Rc(d.W[c>>>d.la],b==a.C));h.La||zh(a);break}}return f}function Th(a,b){for(var c=1;c<b.length;c++)Sh(a,b,c);return b.length-1}function Sh(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.D)+(d?" "+d:c.Ac?' "'+c.Ac+'"':""))}
function Qh(a,b){if(void 0!==b)Qc(a,b,1,a.f,!0),a.R=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.La){if(!Rh(a,a.f,c,!0))break;b=0}}}
function Qc(a,b,c,d,e){var f=!1;if(!a.bb++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.La)for(var m=a.ba(h),n=0;n<c;n++)if(b+n==m){var p,f=!0;h.La&&(Rh(a,d,h,!0),e=!0);if(p=h.Fc){for(var f=!1,u=0;u<p.length;u++)if(!Uh(a,p[u],!0)){if(p[u].indexOf("if")){f=!0;break}for(var v=u+1;v<p.length&&p[v].indexOf("else");v++)u++;if(v==p.length){f=!0;break}}a.b.A.ga||(f=!0)}if(f){e||Sh(a,d,g,"hit");break}}}a.bb--;return f}
function Vh(a,b,c,d){var e=Z(b.D),f=a.pa(b,2),g,h;for(h in a.ob)if(g=a.ob[h][f&h])break;g||(g=Eh);var m=g[0];0<=a.Ab.indexOf(m)&&(g=Eh,m=g[0]);var n=h="",p=Ch[m],u=g.length-1;m||u||(h=J(a,f));for(m=1;m<=u;m++){var v=g[m];if(void 0!==v){var x;x=a;var z=v,v=b,y="",B=z&61440;if(4096==B)v=v.D+((f&255)<<24>>23)&65535,y=J(x,v);else if(8192==B)v=v.D-((f&63)<<1)&65535,y=J(x,v);else if(12288==B)y=J(x,f&7,1);else if(24576==B)y=J(x,f&63,1);else if(32768==B)y=J(x,f&255,1);else if(B=f&z,z&4032&&(B>>=6,z>>=6),
z&63)switch(z=B&7,B&56){case 0:y=Mh(z);break;case 8:y="@"+Mh(z);break;case 16:7>z?y="("+Mh(z)+")+":(B=x.pa(v,2),y="#"+J(x,B,0,!0));break;case 24:7>z?y="@("+Mh(z)+")+":(B=x.pa(v,2),y="@#"+J(x,B,0,!0));break;case 32:y="-("+Mh(z)+")";break;case 40:y="@-("+Mh(z)+")";break;case 48:B=x.pa(v,2);y=J(x,B,0,!0)+"("+Mh(z)+")";7==z&&(y=J(x,B+v.D&65535));break;case 56:B=x.pa(v,2),y="@"+J(x,B)+"("+Mh(z)+")",7==z&&(y="@"+J(x,B+v.D&65535))}x=y;if(!x||!x.length){h="INVALID";break}"string"!=typeof x&&(n=x[1],x=x[0]);
0<h.length&&(h+=",");h+=x||"???"}}f="";g=J(a,e.D)+":";if(-1!==e.D&&-1!==b.D){do if(f+=" "+J(a,a.pa(e,2)),null==e.D)break;while(e.D!=b.D)}g+=xa(f,24);g+=xa(p,5);h&&(g+=" "+h);if(c||n)g=xa(g,60)+";"+(c||""),g=a.b.A.pb?g+("cycles="+$c(a.b).toString()+" cs="+l(a.b.Eb)):g+(null!=d?"="+d.toString():""),n&&(g+=" @"+n);return g}function Wh(a,b){switch(b){case "N":a=a.b.Qa();break;case "Z":a=od(a.b);break;case "V":a=nd(a.b);break;case "C":a=md(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function Xh(a,b){var c="",d=a.b;8>b?(c=Mh(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Ra[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.Fa[b-16]):20==b&&(c="PS="+J(a,Cb(d)));c&&(c+=" ");return c}function Yh(a){var b,c="";for(b=0;6>b;b++)c+=Xh(a,b);c=c+"\n"+(Xh(a,6)+Xh(a,7)+Xh(a,20));return c+=Wh(a,"T")+Wh(a,"N")+Wh(a,"Z")+Wh(a,"V")+Wh(a,"C")}k.jc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function gg(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var m=h.o,n=h.a;if(void 0!==m){var p=f,m=[m>>>0,g],u=Aa(p,m,a.jc);0>u&&p.splice(-(u+1),0,m)}n&&(h.a=n.replace(/''/g,'"'))}a.I.push({Je:b,D:c,Rc:d,ha:e,hc:f})}function Zh(a,b,c){var d=[],e=a.ba(b)>>>0;for(b=0;b<a.I.length;b++){var f=a.I[b],g=f.D>>>0,h=f.Rc;if(e>=g&&e<g+h){e=Aa(f.hc,[e-g],a.jc);0<=e?$h(a,b,e,d):c&&(e=~e,$h(a,b,e-1,d),$h(a,b,e,d));break}}return d}
function $h(a,b,c,d){var e={},f=a.I[b].hc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.I[b].ha[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function ai(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return wh(a)||a.j("no variables"),!0;if(!c[2])return wh(a,c[1]);if(!c[3])return delete a.S[c[1]],!0;b=sh(a,c[3]);return void 0!==b?(a.S[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
function bi(a,b,c){var d=null;if(b=Hh(a,b,!0)){a.ba(b);var e=Zh(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.D-e[1])&&(g=" + "+l(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.j(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.D)&&(g=" - "+l(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
function Oh(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}f=sh(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":O(d,f);a.K=Z(d.u[7]);break;case "N":d.X=f?32768:0;break;case "Z":d.aa=
f?0:1;break;case "V":d.U=f?32768:0;break;case "C":d.T=f?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=f&65535;break}a.j("unknown register: "+e);return}a.B.da();a.j("updated registers:")}a.j(Yh(a));c&&(a.K=Z(d.u[7]),Ph(a,J(a,a.K.D)))}}function ci(a,b){b=ya(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):vh(a,null,c[2].charCodeAt(0)):sh(a,b,!0)}
function di(a,b,c){var d="t"!=b;c=uh(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Qa(c,function(){return rb(a,!0)&&a.xb(e,d,!1)},function(){a.B.da();rb(a,!1)})}
function Ph(a,b,c,d){if(b=Hh(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=uh(a,c.substr(1)),null!=c&&(d=c);else{d=Hh(a,c,!0);if(!d||d.D<b.D)return;e=d.D-b.D;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=sb(a,!1)||a.R?a.J:null;var g=null!=f?"cycles":null,h=Zh(a,b),m=b.D;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var n=h[0]+":";h[2]&&(n+=" "+h[2]);a.j(n)}h[3]&&(g=h[3],f=null);f=Vh(a,b,g,f);a.j(f);a.K=b;e-=b.D-m;c++}}}
function Uh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.P&&(a.j("ended assemble at "+J(a,a.N.D)),a.K=a.N,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ca=null;if(tb(a)&&0<b.length){a.P&&(b="a "+J(a,a.N.D)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],m=h.charAt(0),n=1;n<h.length;n++){var p=h.charAt(n);if("?"==m||"r"==m||"a">p||"z"<p){g[0]=h.substr(n);g.unshift(h.substr(0,n));break}}switch(g[0].charAt(0)){case "a":var u=
Hh(a,g[1],!0);if(u)if(a.N=u,void 0===g[2])a.j("begin assemble at "+J(a,u.D)),a.P=!0,a.B.da();else{var v;a.j("not supported yet");v=[];if(v.length){for(var x=0;x<v.length;x++)a.Sb(u,v[x],1);a.j(Vh(a,a.N))}}break;case "b":a:{var z=g[0],y=g[1],B=b;if("?"==y)a.j("breakpoint commands:"),a.j("\tbp [a]\tset exec breakpoint at addr [a]"),a.j("\tbr [a]\tset read breakpoint at addr [a]"),a.j("\tbw [a]\tset write breakpoint at addr [a]"),a.j("\tbc [a]\tclear breakpoint at addr [a]"),a.j("\tbl\tlist all breakpoints"),
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var ja=z.charAt(1);if("l"==ja){var Ja;Ja=0+Th(a,a.f);Ja+=Th(a,a.L);(Ja+=Th(a,a.C))||a.j("no breakpoints")}else if("n"==ja)a.na=uh(a,y),a.j("break after "+a.na+" instruction(s)");else if(void 0===y)a.j("missing breakpoint address");else{var Q=Z();if("*"!=y&&(Q=Hh(a,y,!0),!Q))break a;"c"==ja?null==Q.D?(yh(a),a.j("all breakpoints cleared")):Rh(a,a.f,Q)||Rh(a,a.L,Q)||Rh(a,a.C,Q)||a.j("breakpoint missing: "+J(a,Q.D)):null!=Q.D&&(Lh(a,Q,B),"p"==ja?a.hb(a.f,
Q):"r"==ja?a.hb(a.L,Q):"w"==ja?a.hb(a.C,Q):a.j("unknown breakpoint command: "+ja))}}}break;case "c":a.Oa&&(a.Oa.value="");break;case "d":a:{var db,eb=g[0],ma=g[1],La=g[2],wi=g[3];if("?"==ma){var fb="";for(db in xb)a.Ja[db]&&(fb&&(fb+=","),fb+=db);fb+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
fb.length&&a.j("dump extension commands:\n\t"+fb)}else if("state"==ma){var jg=ei(a.B,!0);"console"==La?console.log(jg):(a.Oa&&(a.Oa.value=""),a.j(jg))}else if("symbols"==ma)for(var yd=0;yd<a.I.length;yd++){var zd=a.I[yd],gb;for(gb in zd.ha)if("."!=gb.charAt(0)){var kg=zd.ha[gb].o;if(void 0!==kg){var lg=zd.ha[gb].l;lg&&(gb=lg);a.j(J(a,kg)+" "+gb)}}}else{if("d"==eb){for(db in xb)if(g[1]==db){var mg=a.Ja[db];mg?(g.shift(),g.shift(),mg(g)):a.j("no dump registered for "+ma);break a}ma||(eb=a.Nb||"db")}else a.Nb=
eb;if("dh"==eb){var ng=ma,og=La,pg="",qg=0,fa=a.Y,na=a.F;if(na.length){var aa=+ng||a.gb,Eb=+og||10;isNaN(aa)?aa=Eb:pg="more ";aa>na.length&&(a.j("note: only "+na.length+" available"),aa=na.length);fa-=aa;0>fa&&(null==na[na.length-1].D?(aa=fa+aa,fa=0):fa+=na.length);var Ad=[];"call"==og&&(Eb=1E5,Ad=["CALL"]);for(void 0!==ng&&a.j(aa+" instructions earlier:");0<Eb&&fa!=a.Y;){var rg=na[fa++];if(null==rg.D)break;var Fb=Z(rg.D),xi=aa--,sg=Vh(a,Fb,"history",xi);(!Ad.length||0<=sg.indexOf(Ad[0]))&&a.j(sg);
Fb.Xb&&(fa+=Fb.Xb,Eb-=Fb.Xb,aa-=Fb.Xb);fa>=na.length&&(fa=0);a.gb=aa;qg++;Eb--}}qg||(a.j("no "+pg+"history available"),a.gb=void 0)}else{var Gb=Hh(a,ma);if(Gb){var wc=0;La&&("l"==La.charAt(0)&&(La=La.substr(1)||wi),wc=uh(a,La)>>>0,65536<wc&&(wc=65536));for(var Hb="",hb="dd"==eb?4:"dw"==eb?2:1,xc=hb*wc||128,yi=xc+15>>4||1;yi--&&0<xc;){var yc=0,Ib=0,Jb,Bd="",tg="",ma=J(a,Gb.D);for(Jb=4==hb?16:a.$;0<Jb&&0<xc;Jb--){var zc=1,Ac=1==hb?a.Db(Gb,zc):a.pa(Gb,zc=2),yc=yc|Ac<<(Ib<<3),Ib=Ib+zc;Ib==hb&&(Bd+=J(a,
yc,hb),Bd+=1==hb?9==Jb?"-":" ":" ",yc=Ib=0);tg+=32<=Ac&&128>Ac?String.fromCharCode(Ac):".";xc-=zc}Hb&&(Hb+="\n");Hb+=ma+" "+Bd+(0==Jb?" "+tg:"")}Hb&&a.j(Hb);a.eb=Gb}}}}break;case "e":if("else"==g[0])break;var ib,Cd,Dd,Ed,Fd=g[0],Gd=g[1];"eb"==Fd?(ib=1,Cd=255,Dd=a.Db,Ed=a.Sb):"e"==Fd||"ew"==Fd?(ib=2,Cd=65535,Dd=a.pa,Ed=a.mb):Gd=null;if(null==Gd)a.j("edit memory commands:"),a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var Bc=Hh(a,Gd);if(Bc)for(var Cc=
2;Cc<g.length;Cc++){var Kb=sh(a,g[Cc]);if(void 0===Kb){a.j("unrecognized value: "+g[Cc]);break}Kb&~Cd&&a.j("warning: "+l(Kb)+" exceeds "+ib+"-byte value");var zi=Dd.call(a,Bc);a.j("changing "+J(a,Bc.D)+" from "+J(a,zi,ib)+" to "+J(a,Kb,ib));Ed.call(a,Bc,Kb,ib)}}break;case "g":a:{var ug=g[1],Ai=b;if(void 0!==ug){var Hd=Hh(a,ug,!0);if(!Hd)break a;Lh(a,Hd,Ai);a.hb(a.f,Hd,!0)}a.wb(!0,c)}break;case "h":a.A.ga?(c||a.j("halting"),a.ja()):sb(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var Id;
var Lb=b.substr(2),Lb=ya(Lb);sh(a,Lb)?(c||a.j("true: "+Lb),Id=!0):(c||a.j("false: "+Lb),Id=!1);Id||(d=!1);break}f=!0;break;case "k":var Bi=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var Jd=0,Kd=Z(),Mb=Z(a.b.u[6]);for(a.j("stack trace for "+J(a,Mb.D));10>Jd;){for(var Ma=null,Ci=256;65536>Mb.D>>>0;){Kd.D=a.pa(Mb,2);if(null==Mb.D||!Ci--)break;if(!(Kd.D&1)){for(var Di=a,Dc=Kd,vg=null,Nb=Dc.D,wg=Nb,Ld=1;6>=Ld&&Nb;Ld++){if(2<
Ld){Dc.D=Nb;var Ec=Vh(Di,Dc);if(0<=Ec.indexOf("JSR")){var xg=Ec.indexOf(" ");if(Nb+(Ec.indexOf(" ",xg+1)-xg-1)/2==wg){vg=Ec;break}}}Nb-=2}Dc.D=wg;if(Ma=vg)break}}if(!Ma||null==Ma)break;var yg=null;if("ks"==Bi){var zg=Ma.match(/[0-9A-F]+$/);zg&&(yg=bi(a,zg[0]))}Ma=xa(Ma,50)+" ;"+(yg||"stack="+J(a,Mb.D));a.j(Ma);Jd++}Jd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){bi(a,g[1],!0);break}f=!0;break;case "m":a:{var oa,pa=null,H=g[1];"?"==H&&(H=void 0);if(void 0!==H){var Da=0;if("all"==
H)Da=1878917119,H=null;else if("on"==H)pa=!0,H=null;else if("off"==H)pa=!1,H=null;else{"keys"==H&&(H="key");"kbd"==H&&(H="keyboard");for(oa in xb)if(H==oa){Da=xb[oa];pa=!!(a.oa&Da);break}if(!Da){a.j("unknown message category: "+H);break a}}if(Da)if("on"==g[2])a.oa|=Da,pa=!0;else if("off"==g[2]&&(a.oa&=~Da,pa=!1,1073741824==Da)){for(var Md=0;Md<a.ua.length;Md++)a.j(a.ua[Md]);a.ua=[]}}var Ei=0,Ob="";for(oa in xb)if(!H||H==oa){var Fi=!!(a.oa&xb[oa]);if(null===pa||pa==Fi)Ob&&(Ob+=","),++Ei%10||(Ob+="\n\t"),
"key"==oa&&(oa="keys"),Ob+=oa}void 0===H&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==pa?pa?"messages on: ":"messages off: ":"message categories:\n\t")+(Ob||"none"));zh(a)}break;case "p":if("print"==g[0]){ci(a,b.substr(5));break}var Gi="pr"==g[0]?1:0;if(a.R)a.j("step in progress");else{var Ag=Z(a.b.u[7]);a.Db(Ag);a.R?(a.hb(a.f,Ag,!0),a.wb()||(a.B&&a.B.lb(),a.R=0)):di(a,Gi?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}Oh(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Pb=
+g[2];if(8==Pb||10==Pb||16==Pb)a.$=Pb;else{a.j("invalid base: "+Pb);break}}a.j("default base: "+a.$);break;case "cs":var Qb;void 0!==g[3]&&(Qb=+g[3]);switch(g[2]){case "int":a.b.rb=Qb;break;case "start":a.b.Fb=Qb;break;case "stop":a.b.sb=Qb;break;default:a.j("unknown cs option");break a}void 0!==Qb&&Xc(a.b);a.j("checksums "+(a.b.A.pb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(ad(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.jb.toFixed(2)+
"Mhz")+" ("+a.b.Xa+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":di(a,g[0],g[1]);break;case "u":Ph(a,g[1],g[2],8);break;case "v":if("var"==g[0]){ai(a,b.substr(3))||(d=!1);break}if("ver"==
g[0]){a.j("PDPjs version 1.30.2 ("+a.b.qb+",RELEASE"+(wb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){ci(a,b.substr(1));break}var Nd="commands:",Od;for(Od in Bh)Nd+="\n"+xa(Od,9)+Bh[Od];ce(a)||(Nd+="\nnote: history disabled if no exec breakpoints");a.j(Nd);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(Bg){a.j("debugger error: "+(Bg.stack||Bg.message)),d=!1}return d}
function Yc(a,b,c){b=qh(a,b,c);for(var d in b)if(!Uh(a,b[+d]))return!1;return!0}Xa(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new xh(d);C(d,c)}});
function fi(a,b,c){r.call(this,"Computer",a,fi,67108864);this.A.ia=!1;gi(this,b);this.L=Vc(this,"autoPower",a);this.B=0;this.Y=a.busWidth||a.buswidth;this.f=hi;this.J=null;this.F=this.R=!1;this.$=Vc(this,"url")||"";(Math.random()+.1).toString(36);this.g=ii(this);if(this.b=qb("CPU",this.id)){this.i=qb("Debugger",this.id);this.w=new Db({id:this.Na+".bus",busWidth:this.Y},this.b,this.i);var d,e=ob(this.id);if((this.v=qb("Panel",this.id))&&this.v.Oa)for(b=0;b<e.length;b++)d=e[b],d.O=this.v.O,d.j=this.v.j,
d.Oa=this.v.Oa;this.j("PDPjs v1.30.2\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ca&&d.Ca(this,this.w,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.I=d:this.f=parseInt(d,10));var f;if(a=Vc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.F=!0,this.f=hi),this.f&&(this.K=
new P(this,"1.30.2"),ji(this.K)?b=null:delete this.K);!b&&this.f&&(b=ki(this))&&(this.F=!0);if(b){var g=this;Ea(b,null,!0,function(a,b,c){c?(g.I=null,g.F=!1,g.O("Unable to load machine state from server (error "+c+(b?": "+ya(b):"")+")")):(g.J=b,g.R=!0);G(g)})}else G(this);this.G.power||(this.L=!0);!c&&this.L&&li(this,this.Gb)}else q("Unable to find CPU component")}w(fi);var hi=0;
function gi(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.S=b}function Vc(a,b,c){var d=b.toLowerCase(),d=bb[b]||bb[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function li(a,b,c){for(var d=ob(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!tb(f)){tb(f,function(){li(a,b,c)});return}}b.call(a,c)}
function mi(a,b){var c=new P(a,"1.30.2","validate");if(ji(c)&&ni(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.O("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=fi.prototype;
k.Gb=function(a){void 0===a&&(a=this.f||(this.J?1:hi));if(!this.B){this.B++;var b=!1,c=!1;this.P=!1;var d=this.K||new P(this,"1.30.2");if(-1==a)b=!0;else if(a>hi){if(ji(d,this.J)){this.C=new P(this,"1.30.2","failsafe");ji(this.C)&&(oi(this,d),a=2,pi(this.C));this.C.set("timestamp",Ca());qi(this.C);var e=this.f&&!this.F;if(1==a||Ha("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=ni(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?ji(d,g):("error"==
f&&"no machine state"!=g?(this.O("Error: "+g),"unable to verify user"==g&&(Oa("user",""),this.g=null)):this.j(f+": "+g),pi(d),ji(d)?(c=ni(d),e=!0):c=!1))}e&&mi(this,c?d:null)}else 2==a&&d.clear()}else mi(this);delete this.J;delete this.K}e=ob(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=ri(this,g,d,b,c));b=[d,a,c];-1!=a?li(this,this.lc,b):this.lc(b)}};
function ri(a,b,c,d,e){if(!b.A.ia){b.A.ia=!0;if(b.Ea){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Ea(f,d)&&f&&(q("Unable to restore state for "+b.type),a.N&&!a.R?(c.clear(),a.f=hi,window&&window.location.reload()):a.P=!0,b.Ea(null),e=!1)}if(!d&&b.nc)for(a=b.nc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
k.lc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ca=!0;this.A.ia=!0;var d=this.G.power;d&&(d.textContent="Shutdown");this.b&&(ri(this,this.b,b,c,a),this.b.nb());this.P&&(oi(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.B=0};
function oi(a,b){if(Ha("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.2"};d.url=a.$;d.user=c;d.type="bug";d.data=b;Ea("http://www.pcjs.org/api/v1/report",d,!0)}}
function ei(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new P(a,"1.30.2"),g=new P(a,"1.30.2","validate"),h=Ca();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.2");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Da&&(c&&a.b.ja(),d=a.b.Da(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.A.ia=!1,!1===d&&(e=null)));for(var h=ob(a.id),m=0;m<h.length;m++){var n=h[m];n.A.ia&&(n.Da&&(d=n.Da(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.A.ia=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&si(a,a.g,f.toString()),qi(g)&&qi(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.A.ia=!1,b=a.G.power)&&(b.textContent="Power");a.B=0;return e}k.reset=function(){this.w&&this.w.reset&&(E(this,"Resetting "+this.w.type),this.w.reset());for(var a=ob(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.w&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}};
k.start=function(a,b){for(var c=ob(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.da(!0)};k.stop=function(a,b){for(var c=ob(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.da(!0)};
k.sa=function(a,b,c){var d=this;switch(b){case "power":return this.G[b]=c,c.onclick=function(){d.B||(d.A.ia?ei(d,!1,!0):li(d,d.Gb))},!0;case "reset":return this.G[b]=c,c.onclick=function(){if(d.A.ia&&!d.B)if(d.f&&!d.I){var a=Ha("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");ei(d,a,!0);!a&&d.N?window&&window.location.reload():(a||(d.mc=!0),d.Gb(hi),d.mc=!1)}else d.reset(),d.b&&d.b.nb()},!0;case "save":if(ua(Ga(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.G[b]=c,c.onclick=function(){var a=ii(d,!0);if(a){var b=!!(d.f&&!d.I||d.N),c=ei(d,b);b?si(d,a,c):d.O("Resume disabled, machine state not saved")}},!0}return!1};
function ii(a,b){var c=a.g;c||((c=Na("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=ti(a,c))||a.O("The user ID is invalid.")):b&&a.O("Browser local storage is not available"));return c}
function ti(a,b){a.g=null;b=Ea(Ga()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Oa("user",b.data),a.g=b.data)}catch(d){q(d.message+" ("+c+")")}return a.g}function ki(a){var b=null;a.g&&(b=Ga()+"/api/v1/user?req=load&user="+a.g+"&state="+ui(a,"1.30.2"));return b}
function si(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=ui(a,"1.30.2");d.data=c;b=Ea(Ga()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.O("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.O(c),Oa("user",""),a.g=null)}}
function Lg(a){var b;a=ob(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.lb=function(a){if(this.Oa){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Oa.focus();!a&&window&&window.scrollTo(b,c)}};k.da=function(a){this.b&&this.b.da(a);this.v&&this.v.da(a)};
Xa(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new fi(g,d,!0);C(g,f);g.L&&li(g,g.Gb)}});Sa.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=qb("Computer",c.id))&&c.ca&&!c.A.ia&&c.Gb(-1)}});
Sa.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=qb("Computer",c.id))&&c.A.ia&&ei(c,!(!c.f||c.I),!0)}});function P(a,b,c){this.id=a.id;this.key=ui(a,b,c);this.i=a.i;pi(this,a.Qc)}function ui(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
P.prototype={constructor:P,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){pi(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function pi(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function qi(a){var b=!0;if(Ka()){var c=JSON.stringify(a[a.id]);Oa(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function ni(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function ji(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ka()&&(b=Na(a.key))?(a[a.id]=b,a.b=!0):!1}var vi=0;
function Hi(a,b,c,d,e,f){e("Loading "+a+"...");Ea(a,null,!0,function(g,h,m){m?(h||(h="unable to load "+a+" ("+m+")"),f(h,null)):Ii(h,a,b,c,d,e,f)})}
function Ii(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(nb(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){f=null,a=p.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Ji(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Ji(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Ea(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=h[0],n,p=/( [a-z]+=)(['"])(.*?)\2/g;n=p.exec(f);)m=0>m.indexOf(n[1])?m.replace(">",n[0]+">"):m.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);h[0]!=m&&(g=g.replace(h[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);Ji(a,b,c)}})}else c(a,null)}
function Ki(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=wa(a))}function f(a){e("Error: "+a);m&&(--vi||Za(!0));m=!1}var g,h,m=!0;vi++;mb[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.type="text/css";u.styleSheet?u.styleSheet.cssText=n:u.appendChild(document.createTextNode(n));p.appendChild(u)}c||
(c="/versions/pdpjs/1.30.2/components.xsl");n=function(d,h){h?Hi(c,null,null,!1,e,function(d,m){m?(nb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=h.transformNode(m))?(g.outerHTML=m,--vi||Za(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--vi||Za(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Hi(b,a,d,!0,e,n):Ii(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(v){f(v.message)}return m}window.embedPDP11=function(a,b,c,d){Za(!1);return Ki(a,b,c,d)};window.enableEvents=Za;window.sendEvent=$a;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11-dbg.map

View file

@ -34,198 +34,207 @@
for(var h,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,ca=["Math","log2"],da=0;da<ca.length-1;da++){var ea=ca[da];ea in ba||(ba[ea]={});ba=ba[ea]}var fa=ca[ca.length-1],ga=ba[fa],ha=ga?ga:function(a){return Math.log(a)/Math.LN2};
ha!=ga&&null!=ha&&aa(ba,fa,{configurable:!0,writable:!0,value:ha});var ia={163840:[40,1,8,,254],184320:[40,1,9,,252],327680:[40,2,8,,255],368640:[40,2,9,,253],737280:[80,2,9,,249],1228800:[80,2,15,,249],1474560:[80,2,18,,240],2949120:[80,2,36,,240],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]};
function ja(a){var b=10,c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==
e&&d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function ka(a,b){var c="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;)c=String.fromCharCode((a&7)+48)+c,a>>=3;return""+c}function l(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
e&&d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function ka(a,b){var c="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;)c=String.fromCharCode((a&7)+48)+c,a>>=3;return""+c}function k(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
function n(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function la(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ma(a,b){return-1!==a.indexOf(b,a.length-b.length)}var na={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function oa(a){return a.replace(/[&<>"']/g,function(a){return na[a]})}
function pa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var qa={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"},ra=Date.now||function(){return+new Date};
function sa(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function q(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var m="",p;for(p in b)b.hasOwnProperty(p)&&(m&&(m+="&"),m+=p+"="+encodeURIComponent(b[p]));m=m.replace(/%20/g,"+");k.open("POST",a,!!c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(m)}else k.open("GET",a,!!c),"bytes"==b&&k.overrideMimeType("text/plain; charset=x-user-defined"),k.send();c||(f=k.responseText,200!=k.status&&(e=k.status||-1),d&&d(a,f,e),g=[f,e]);return g}
function va(a,b){var c,d={L:null,T:null,aa:null,$:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.aa=g.load;d.$=g.exec;if(e=g.bytes)d.L=e;else if(e=g.words)for(d.L=Array(2*e.length),f=c=0;c<e.length;c++)d.L[f++]=e[c]&255,d.L[f++]=e[c]>>8&255;else if(e=g.data)for(d.L=Array(4*e.length),f=c=0;c<e.length;c++)d.L[f++]=e[c]&255,
d.L[f++]=e[c]>>8&255,d.L[f++]=e[c]>>16&255,d.L[f++]=e[c]>>24&255;else d.L=g;d.T=g.symbols;d.L.length?1==d.L.length&&(r(d.L[0]),d=null):(r("Empty resource: "+a),d=null)}catch(k){r("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){r("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.L=e)}return d}
function u(){return"http://"+(window?window.location.host:"www.pcjs.org")}function r(a){window&&window.alert(a)}function wa(a){var b=!1;window&&(b=window.confirm(a));return b}var xa=null;function ya(){if(null==xa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}xa=a}return xa}
function za(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Aa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ba(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var v={init:[],show:[],exit:[]},Ca=!1,Da=!1,Ea=!0;
function Fa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function x(a){v.init.push(a)}function Ga(a){if(Ea)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){r(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ha(a){!Ea&&a?(Ea=!0,Ca&&Ia("init"),Da&&Ia("show")):Ea=a}function Ia(a){v[a]&&Ga(v[a])}Fa("onload",function(){Ca=!0;Ga(v.init)});Fa("onpageshow",function(){Da=!0;Ga(v.show)});
Fa(Ba("Opera")||Ba("iOS")?"onunload":"onbeforeunload",function(){Ga(v.exit)});function y(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Ib=b.comment;this.bc=b;b=this.id.indexOf(".");0>b?this.Aa=this.id:(this.ia=this.id.substr(0,b),this.Aa=this.id.substr(b+1));this[a]=c;this.j={ready:!1,jb:!1,Fd:!1,O:!1,error:!1};this.eb=null;this.j.error=!1;this.m={};this.D=null;z.push(this)}var Ja=void 0,Ka={};
if(window){Ja||(Ja=window.location.search.substr(1));for(var La,Ma=/\+/g,Na=/([^&=]+)=?([^&]*)/g;La=Na.exec(Ja);)Ka[decodeURIComponent(La[1].replace(Ma," "))]=decodeURIComponent(La[2].replace(Ma," "))}function Oa(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function A(a,b){b||(b=y);a.prototype=Oa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Pa=window.PCjs.Machines||(window.PCjs.Machines={}),z=window.PCjs.Components||(window.PCjs.Components=[])}else Pa={},z=[];function Qa(a,b,c){Pa[a]&&b&&(Pa[a][b]=c)}function B(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<z.length;b++){var d=z[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function Ra(a){if(void 0!==a){var b;for(b=0;b<z.length;b++)if(z[b].id===a)return z[b]}return null}function Sa(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<z.length;d++)if(c)c==z[d]&&(c=null);else if(!(a!=z[d].type||b&&z[d].id.indexOf(b)))return z[d]}return null}function C(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){r(c.message+" ("+a+")")}return b}
function D(a,b){b=E(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var k=g.split(" "),m=0;m<k.length;m++)switch(g=k[m],g){case "pdp11-binding":(g=C(f))&&g.binding&&a.V(g.type,g.binding,f,g.value),m=k.length}}}}
function r(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var l=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(l.onreadystatechange=function(){4===l.readyState&&(f=l.responseText,200==l.status||!l.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=l.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var m="",p;for(p in b)b.hasOwnProperty(p)&&(m&&(m+="&"),m+=p+"="+encodeURIComponent(b[p]));m=m.replace(/%20/g,"+");l.open("POST",a,!!c);l.setRequestHeader("Content-type","application/x-www-form-urlencoded");l.send(m)}else l.open("GET",a,!!c),"bytes"==b&&l.overrideMimeType("text/plain; charset=x-user-defined"),l.send();c||(f=l.responseText,200!=l.status&&(e=l.status||-1),d&&d(a,f,e),g=[f,e]);return g}
function ta(a,b){var c,d={L:null,W:null,fa:null,ea:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.fa=g.load;d.ea=g.exec;if(e=g.bytes)d.L=e;else if(e=g.words)for(d.L=Array(2*e.length),f=c=0;c<e.length;c++)d.L[f++]=e[c]&255,d.L[f++]=e[c]>>8&255;else if(e=g.data)for(d.L=Array(4*e.length),f=c=0;c<e.length;c++)d.L[f++]=e[c]&255,
d.L[f++]=e[c]>>8&255,d.L[f++]=e[c]>>16&255,d.L[f++]=e[c]>>24&255;else d.L=g;d.W=g.symbols;d.L.length?1==d.L.length&&(t(d.L[0]),d=null):(t("Empty resource: "+a),d=null)}catch(l){t("Resource data error ("+a+"): "+l.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){t("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.L=e)}return d}
function v(){return"http://"+(window?window.location.host:"www.pcjs.org")}function t(a){window&&window.alert(a)}function wa(a){var b=!1;window&&(b=window.confirm(a));return b}var xa=null;function ya(){if(null==xa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}xa=a}return xa}
function za(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Aa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ba(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var w={init:[],show:[],exit:[]},Ca=!1,Da=!1,Ea=!0;
function Fa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ga(a){w.init.push(a)}function Ha(a){if(Ea)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ia(a){!Ea&&a?(Ea=!0,Ca&&Ja("init"),Da&&Ja("show")):Ea=a}function Ja(a){w[a]&&Ha(w[a])}Fa("onload",function(){Ca=!0;Ha(w.init)});Fa("onpageshow",function(){Da=!0;Ha(w.show)});
Fa(Ba("Opera")||Ba("iOS")?"onunload":"onbeforeunload",function(){Ha(w.exit)});function x(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Lb=b.comment;this.jc=b;b=this.id.indexOf(".");0>b?this.Na=this.id:(this.na=this.id.substr(0,b),this.Na=this.id.substr(b+1));this[a]=c;this.l={ready:!1,lb:!1,Xd:!1,P:!1,error:!1};this.hb=null;this.l.error=!1;this.o={};this.F=null;y.push(this)}var Ka=void 0,La={};
if(window){Ka||(Ka=window.location.search.substr(1));for(var Ma,Na=/\+/g,Oa=/([^&=]+)=?([^&]*)/g;Ma=Oa.exec(Ka);)La[decodeURIComponent(Ma[1].replace(Na," "))]=decodeURIComponent(Ma[2].replace(Na," "))}function Pa(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function A(a,b){b||(b=x);a.prototype=Pa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Qa=window.PCjs.Machines||(window.PCjs.Machines={}),y=window.PCjs.Components||(window.PCjs.Components=[])}else Qa={},y=[];function Ra(a,b,c){Qa[a]&&b&&(Qa[a][b]=c)}function B(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<y.length;b++){var d=y[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function Sa(a){if(void 0!==a){var b;for(b=0;b<y.length;b++)if(y[b].id===a)return y[b]}return null}function Ta(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<y.length;d++)if(c)c==y[d]&&(c=null);else if(!(a!=y[d].type||b&&y[d].id.indexOf(b)))return y[d]}return null}function C(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
function D(a,b){b=E(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var l=g.split(" "),m=0;m<l.length;m++)switch(g=l[m],g){case "pdp11-binding":(g=C(f))&&g.binding&&a.Z(g.type,g.binding,f,g.value),m=l.length}}}}
function E(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
y.prototype={constructor:y,parent:null,toString:function(){return this.name?this.name:this.id||this.type},V:function(a,b,c){switch(b){case "clear":return this.m[b]||(this.m[b]=c,c.onclick=function(a){return function(){a.m.print&&(a.m.print.value="")}}(this)),!0;case "print":return this.m[b]||(this.Na=this.m[b]=c,c.value="",this.R=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.C=function(a){this.R(a,this.Aa)}),!0;default:return!1}},log:function(){},R:function(){},status:function(a){this.R(this.Aa+": "+a)},C:function(a,b,c){c=c||this.type;b||r((c?c+": ":"")+a)},ea:function(){return this.j.O=!0},da:function(a,b){b&&(this.j.O=!1);return!0}};function G(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.eb,a.eb=null,b&&b()))}function Ta(a,b){b&&(a.j.ready?b():a.eb=b);return a.j.ready}
x.prototype={constructor:x,parent:null,toString:function(){return this.name?this.name:this.id||this.type},Z:function(a,b,c){switch(b){case "clear":return this.o[b]||(this.o[b]=c,c.onclick=function(a){return function(){a.o.print&&(a.o.print.value="")}}(this)),!0;case "print":return this.o[b]||(this.Ta=this.o[b]=c,c.value="",this.U=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.C=function(a){this.U(a,this.Na)}),!0;default:return!1}},log:function(){},U:function(){},status:function(a){this.U(this.Na+": "+a)},C:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},ja:function(){return this.l.P=!0},ia:function(a,b){b&&(this.l.P=!1);return!0}};function F(a,b){a.l.error||(a.l.ready=!1!==b,a.l.ready&&(b=a.hb,a.hb=null,b&&b()))}function Ua(a,b){b&&(a.l.ready?b():a.hb=b);return a.l.ready}
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});var Ua="undefined"!==typeof ArrayBuffer;function Va(a){y.call(this,"Panel",a,Va);this.b=0;this.j.Cb=!0}A(Va);h=Va.prototype;
h.V=function(a,b,c,d){if(this.i&&this.i.V(a,b,c,d)||this.a&&this.a.V(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.m[b]=c,this.b++,!0;default:return"rled"==a?(this.m[b]=c,this.b++,!0):this.parent.V.call(this,a,b,c,d)}};h.ba=function(a,b,c,d){this.i=a;this.l=b;this.a=c;this.D=d};h.ea=function(a,b){b||Wa();return!0};h.da=function(){return!0};
function Xa(a,b,c,d){if(a.m[b]){void 0===c&&(a.j.error=!0,a.C("Value for "+b+" is invalid"),H(a.a));var e=a.D&&a.D.b||8;c=!a.a.j.Z||a.j.Cb?8==e?ka(c,d):l(c,d):"--------".substr(0,d||4);a.m[b].textContent!=c&&(a.m[b].textContent=c)}}function Ya(a,b,c,d){for(var e=0;e<d;e++){var f=a.m[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
h.ha=function(a){if(this.b&&(a||!this.a.j.Z||this.j.Cb)){for(a=0;a<this.a.f.length;a++)Xa(this,"R"+a,this.a.f[a]);a=Za(this.a);Xa(this,"PS",a);Xa(this,"NF",a&8?1:0,1);Xa(this,"ZF",a&4?1:0,1);Xa(this,"VF",a&2?1:0,1);Xa(this,"CF",a&1?1:0,1);Ya(this,"D",this.a.f[0],16);Ya(this,"A",this.a.f[7],22)}};function Wa(){for(var a=!1,b=E(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=C(d),f=Ra(e.id);f||(a=!0,f=new Va(e));D(f,d);a&&G(f)}}x(Wa);
function $a(a,b,c){y.call(this,"Bus",a,$a);this.a=b;this.D=c;this.I=a.busWidth||16;this.h=0;this.G=[];this.w=null;this.B=Math.pow(2,this.I);this.g=this.B-1|0;this.c=I;this.l=Math.log2(this.c);this.F=this.c>>2;this.i=this.c-1;this.v=this.B/this.c|0;this.ta=[];this.o=0;this.u=[];this.Ub=[ab,bb,cb,db];a=new J(this);eb(a,this.D);this.b=Array(this.v);for(b=0;b<this.v;b++)this.b[b]=a;G(this)}A($a);var I=8192,fb=I-1;
function ab(a,b){var c=-1,d=this.controller,e=d.ta[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.ta[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);return 0<=c?c:c=gb(d,b)}function bb(a,b,c){var d=!1,e=this.controller,f=e.ta[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.ta[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d||gb(e,c)}
function cb(a,b){var c=-1,d=this.controller;(a=d.ta[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));return 0<=c?c:c=gb(d,b)}function db(a,b,c){var d=!1,e=this.controller;if(a=e.ta[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d||gb(e,c)}function hb(a,b){if(b!=a.h){var c;a.h&&(c=(1<<a.h)-I,ib(a,c,I,a.G),a.h=0);b&&(a.h=b,c=(1<<b)-I,a.G=jb(a,c,I),a.w?ib(a,c,I,a.w):(kb(a,c,I,lb,a),a.w=jb(a,c,I)))}}
$a.prototype.reset=function(){for(var a=0;a<this.u.length;a++)this.u[a]();hb(this,16)};function gb(a,b){a.o||K(a.a,4,b);return 0}$a.prototype.ea=function(a,b){b||this.reset();return!0};
function kb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.l;0<g&&k<a.b.length;){var m=a.b[k],p=k*a.c,t=a.c-(f-p);t>g&&(t=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.Da)return m.hb+=m.Da-f,m.Da=f,!0;if(f>=m.Da+m.hb){t=m.size-(f-p);t>g&&(t=g);m.hb=f-m.Da+t;f=p+a.c;g-=t;k++;continue}}return mb(1,f,g)}f=new J(a,f,t,a.c,d,e);eb(f,a.D,m);a.b[k++]=f;f=p+a.c;g-=t}if(0>=g){c/=1024;var w;e="";w?10<w&&(w=10):w=c&-65536?10:5;if(null==c||isNaN(c))for(;0<w--;)e="?"+e;else for(;0<w--;)e=String.fromCharCode(c%10+48)+e,c/=
10;a.status(e+"Kb "+nb[d]+" at "+ka(b));return!0}return mb(2,b,c)}function jb(a,b,c){var d=[];for(b>>>=a.l;0<c&&b<a.b.length;)d.push(a.b[b++]),c-=a.c;return d}function ib(a,b,c,d){var e=0;for(b>>>=a.l;0<c&&b<a.b.length;){var f=d[e++];if(!f)break;a.b[b++]=f;c-=a.c}}function ob(a,b){return a.b[(b&a.g)>>>a.l].tb(b&a.i,b)}function pb(a,b){return a.b[(b&a.g)>>>a.l].S(b&a.i,b)}$a.prototype.Qa=function(a,b){this.o++;this.b[(a&this.g)>>>this.l].Ab(a&this.i,b&255,a);this.o--};
function qb(a,b,c){a.b[(b&a.g)>>>a.l].ib(b&a.i,c&65535,b)}function rb(a){for(var b=0,c=[],d=0;d<a.v;d++){var e=a.b[d];if(e.na||e.Yb){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,k=0,m=[];g<e.length;){for(var p=e[g],t=g+1;t<e.length&&e[t]===p;)t++;m[k++]=t-g;m[k++]=p;g=t}m.length<e.length&&(e=m)}c[f]=e}}return c}function sb(a,b,c,d,e,f,g,k){for(;b<=c;b+=2){var m=b&fb;void 0!==a.ta[m]?r("I/O address already registered: "+l(b,8,!0)):a.ta[m]=[d,e,f,g,k||"unknown",!1]}}
function tb(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.a.Ra)){var g=f[0]?f[0].bind(b):null,k=f[1]?f[1].bind(b):null,m=f[2]?f[2].bind(b):null,p=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&m&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!k&&p&&(k=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));sb(a,e,e,g,k,m,p,f[4])}}}function ub(a,b){a.u.push(b)}function vb(a,b){a.o||K(a.a,4,b)}
function mb(a,b,c){r("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}function L(a){y.call(this,"Device",a,L);this.c={data:0,Bd:0,gb:20,Pc:0};this.b={Gd:0,yb:-1}}A(L);h=L.prototype;h.ba=function(a,b,c,d){this.l=b;this.a=c;this.D=d;var e=this;this.b.yb=wb(c,function(){e.b.va|=128;e.b.va&64&&(xb(e.a,e.b.Qc),yb(e.a,e.b.yb,1E3/60))});this.b.Qc=zb(64,6);tb(b,this,M);ub(b,this.reset.bind(this));G(this)};h.reset=function(){this.c.gb=this.c.gb&-120|20;this.b.va=0};
h.kc=function(){var a=this.b.va;this.b.va&=-129;return a};h.Zc=function(a){this.b.va=a;a&64&&yb(this.a,this.b.yb,1E3/60);this.b.va=a&-129};h.dc=function(a){return(a?this.c.Pc:this.c.data)&65535};h.Sc=function(a){this.c.data=a};h.mc=function(){var a=this.a;return a.w&62337|a.Sa<<5|a.Ta<<1};h.ad=function(a){var b=this.a;a&=62337;if(b.w!=a){b.w=a;b.Sa=a>>5&3;b.Ta=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Oa!=c&&(b.Oa=c,Ab(b))}Bb(this)};
h.nc=function(){var a=this.a.wa;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.oc=function(){return this.a.vb};h.pc=function(){return this.a.xa};h.bd=function(a){var b=this.a;1170>b.Ra&&(a&=-49);b.xa!=a&&(b.xa=a,a&16?(b.pb=4194303,b.Ua=3915776):(b.pb=262143,b.Ua=253952),Ab(b));Bb(this)};function Bb(a){a.c.gb=a.c.gb&-8|(a.a.Oa?a.a.xa&16?1:2:4)}h.Dc=function(a){return this.a.H[1][a>>1&7]};h.qd=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.Bc=function(a){return this.a.H[1][(a>>1&7)+8]};
h.od=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};h.Cc=function(a){return this.a.U[1][a>>1&7]};h.pd=function(a,b){b=b>>1&7;this.a.U[1][b]=a;this.a.H[1][b]&=65295};h.Ac=function(a){return this.a.U[1][(a>>1&7)+8]};h.nd=function(a,b){b=(b>>1&7)+8;this.a.U[1][b]=a;this.a.H[1][b]&=65295};h.jc=function(a){return this.a.H[0][a>>1&7]};h.Yc=function(a,b){this.a.H[0][b>>1&7]=a&65295};h.hc=function(a){return this.a.H[0][(a>>1&7)+8]};h.Wc=function(a,b){this.a.H[0][(b>>1&7)+8]=a&65295};
h.ic=function(a){return this.a.U[0][a>>1&7]};h.Xc=function(a,b){b=b>>1&7;this.a.U[0][b]=a;this.a.H[0][b]&=65295};h.gc=function(a){return this.a.U[0][(a>>1&7)+8]};h.Vc=function(a,b){b=(b>>1&7)+8;this.a.U[0][b]=a;this.a.H[0][b]&=65295};h.Jc=function(a){return this.a.H[3][a>>1&7]};h.wd=function(a,b){this.a.H[3][b>>1&7]=a&65295};h.Hc=function(a){return this.a.H[3][(a>>1&7)+8]};h.ud=function(a,b){this.a.H[3][(b>>1&7)+8]=a&65295};h.Ic=function(a){return this.a.U[3][a>>1&7]};
h.vd=function(a,b){b=b>>1&7;this.a.U[3][b]=a;this.a.H[3][b]&=65295};h.Gc=function(a){return this.a.U[3][(a>>1&7)+8]};h.td=function(a,b){b=(b>>1&7)+8;this.a.U[3][b]=a;this.a.H[3][b]&=65295};h.Fa=function(a){a&=7;return this.a.A&2048?this.a.Ca[a]:this.a.f[a]};h.Ha=function(a,b){b&=7;this.a.A&2048?this.a.Ca[b]=a:this.a.f[b]=a};h.uc=function(){return this.a.A&49152?this.a.ga[0]:this.a.f[6]};h.gd=function(a){this.a.A&49152?this.a.ga[0]=a:this.a.f[6]=a};h.xc=function(){return this.a.f[7]};
h.kd=function(a){this.a.f[7]=a};h.Ga=function(a){a&=7;return this.a.A&2048?this.a.f[a]:this.a.Ca[a]};h.Ia=function(a,b){b&=7;this.a.A&2048?this.a.f[b]=a:this.a.Ca[b]=a};h.vc=function(){return 1==(this.a.A&49152)>>14?this.a.f[6]:this.a.ga[1]};h.hd=function(a){1==(this.a.A&49152)>>14?this.a.f[6]=a:this.a.ga[1]=a};h.wc=function(){return 3==(this.a.A&49152)>>14?this.a.f[6]:this.a.ga[3]};h.jd=function(a){3==(this.a.A&49152)>>14?this.a.f[6]=a:this.a.ga[3]=a};h.fc=function(a){return this.a.Pb[a-65504>>1]};
h.Uc=function(a,b){this.a.Pb[b-65504>>1]=a};h.Nb=function(a){return 65520==a?61183:0};h.Tb=function(){};h.Fc=function(){return 1};h.sd=function(){};h.ec=function(){return this.a.J};h.Tc=function(){this.a.J=0};h.lc=function(){return this.a.Ob};h.$c=function(a,b){b&1||(a&=255);this.a.Ob=a};h.qc=function(a){return a?this.a.wb:0};h.cd=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.wb=a;b.s|=2};h.Ec=function(a){return a?this.a.ya&65280:0};h.rd=function(a){this.a.ya=a|255};
h.tc=function(){return Za(this.a)};h.fd=function(a){Cb(this.a,a&-1809|Za(this.a)&1808);this.a.s|=128};h.Sb=function(){};
var N={},M=(N[62592]=[null,null,L.prototype.Dc,L.prototype.qd,"SISDR",1145],N[62608]=[null,null,L.prototype.Bc,L.prototype.od,"SDSDR",1145],N[62624]=[null,null,L.prototype.Cc,L.prototype.pd,"SISAR",1145],N[62640]=[null,null,L.prototype.Ac,L.prototype.nd,"SDSAR",1145],N[62656]=[null,null,L.prototype.jc,L.prototype.Yc,"KISDR",1145],N[62672]=[null,null,L.prototype.hc,L.prototype.Wc,"KDSDR",1145],N[62688]=[null,null,L.prototype.ic,L.prototype.Xc,"KISAR",1145],N[62704]=[null,null,L.prototype.gc,L.prototype.Vc,
"KDSAR",1145],N[62798]=[null,null,L.prototype.pc,L.prototype.bd,"MMR3",1145],N[65382]=[null,null,L.prototype.kc,L.prototype.Zc,"LKS"],N[65400]=[null,null,L.prototype.dc,L.prototype.Sc,"CNSL"],N[65402]=[null,null,L.prototype.mc,L.prototype.ad,"MMR0",1145],N[65404]=[null,null,L.prototype.nc,L.prototype.Sb,"MMR1",1145],N[65406]=[null,null,L.prototype.oc,L.prototype.Sb,"MMR2",1145],N[65408]=[null,null,L.prototype.Jc,L.prototype.wd,"UISDR",1145],N[65424]=[null,null,L.prototype.Hc,L.prototype.ud,"UDSDR",
1145],N[65440]=[null,null,L.prototype.Ic,L.prototype.vd,"UISAR",1145],N[65456]=[null,null,L.prototype.Gc,L.prototype.td,"UDSAR",1145],N[65472]=[null,null,L.prototype.Fa,L.prototype.Ha,"R0SET0"],N[65473]=[null,null,L.prototype.Fa,L.prototype.Ha,"R1SET0"],N[65474]=[null,null,L.prototype.Fa,L.prototype.Ha,"R2SET0"],N[65475]=[null,null,L.prototype.Fa,L.prototype.Ha,"R3SET0"],N[65476]=[null,null,L.prototype.Fa,L.prototype.Ha,"R4SET0"],N[65477]=[null,null,L.prototype.Fa,L.prototype.Ha,"R5SET0"],N[65478]=
[null,null,L.prototype.uc,L.prototype.gd,"R6KERNEL"],N[65479]=[null,null,L.prototype.xc,L.prototype.kd,"R7KERNEL"],N[65480]=[null,null,L.prototype.Ga,L.prototype.Ia,"R0SET1",1145],N[65481]=[null,null,L.prototype.Ga,L.prototype.Ia,"R1SET1",1145],N[65482]=[null,null,L.prototype.Ga,L.prototype.Ia,"R2SET1",1145],N[65483]=[null,null,L.prototype.Ga,L.prototype.Ia,"R3SET1",1145],N[65484]=[null,null,L.prototype.Ga,L.prototype.Ia,"R4SET1",1145],N[65485]=[null,null,L.prototype.Ga,L.prototype.Ia,"R5SET1",1145],
N[65486]=[null,null,L.prototype.vc,L.prototype.hd,"R6SUPER",1145],N[65487]=[null,null,L.prototype.wc,L.prototype.jd,"R6USER",1145],N[65504]=[null,null,L.prototype.fc,L.prototype.Uc,"CTRL",1170],N[65520]=[null,null,L.prototype.Nb,L.prototype.Tb,"LSIZE",1170],N[65522]=[null,null,L.prototype.Nb,L.prototype.Tb,"HSIZE",1170],N[65524]=[null,null,L.prototype.Fc,L.prototype.sd,"SYSID",1170],N[65526]=[null,null,L.prototype.ec,L.prototype.Tc,"CPUERR",1170],N[65528]=[null,null,L.prototype.lc,L.prototype.$c,
"MB",1170],N[65530]=[null,null,L.prototype.qc,L.prototype.cd,"PIR"],N[65532]=[null,null,L.prototype.Ec,L.prototype.rd,"SL"],N[65534]=[null,null,L.prototype.tc,L.prototype.fd,"PSW"],N);M[62594]=M[62592];M[62596]=M[62592];M[62598]=M[62592];M[62600]=M[62592];M[62602]=M[62592];M[62604]=M[62592];M[62606]=M[62592];M[62610]=M[62608];M[62612]=M[62608];M[62614]=M[62608];M[62616]=M[62608];M[62618]=M[62608];M[62620]=M[62608];M[62622]=M[62608];M[62626]=M[62624];M[62628]=M[62624];M[62630]=M[62624];M[62632]=M[62624];
M[62634]=M[62624];M[62636]=M[62624];M[62638]=M[62624];M[62642]=M[62640];M[62644]=M[62640];M[62646]=M[62640];M[62648]=M[62640];M[62650]=M[62640];M[62652]=M[62640];M[62654]=M[62640];M[62658]=M[62656];M[62660]=M[62656];M[62662]=M[62656];M[62664]=M[62656];M[62666]=M[62656];M[62668]=M[62656];M[62670]=M[62656];M[62674]=M[62672];M[62676]=M[62672];M[62678]=M[62672];M[62680]=M[62672];M[62682]=M[62672];M[62684]=M[62672];M[62686]=M[62672];M[62690]=M[62688];M[62692]=M[62688];M[62694]=M[62688];M[62696]=M[62688];
M[62698]=M[62688];M[62700]=M[62688];M[62702]=M[62688];M[62706]=M[62704];M[62708]=M[62704];M[62710]=M[62704];M[62712]=M[62704];M[62714]=M[62704];M[62716]=M[62704];M[62718]=M[62704];M[65410]=M[65408];M[65412]=M[65408];M[65414]=M[65408];M[65416]=M[65408];M[65418]=M[65408];M[65420]=M[65408];M[65422]=M[65408];M[65426]=M[65424];M[65428]=M[65424];M[65430]=M[65424];M[65432]=M[65424];M[65434]=M[65424];M[65436]=M[65424];M[65438]=M[65424];M[65442]=M[65440];M[65444]=M[65440];M[65446]=M[65440];M[65448]=M[65440];
M[65450]=M[65440];M[65452]=M[65440];M[65454]=M[65440];M[65458]=M[65456];M[65460]=M[65456];M[65462]=M[65456];M[65464]=M[65456];M[65466]=M[65456];M[65468]=M[65456];M[65470]=M[65456];M[65506]=M[65504];M[65508]=M[65504];M[65510]=M[65504];M[65512]=M[65504];M[65514]=M[65504];M[65516]=M[65504];M[65518]=M[65504];
x(function(){for(var a=E(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=C(d);switch(c.type){case "default":c=new L(c);D(c,d);break;case "pc11":c=new Db(c);D(c,d);break;case "rl11":c=new Eb(c),D(c,d)}}});var Fb;if(Ua){var Gb=new ArrayBuffer(2);(new DataView(Gb)).setUint16(0,256,!0);Fb=256===(new Uint16Array(Gb))[0]}else Fb=!1;var Hb=Fb;
function J(a,b,c,d,e,f){this.l=a;this.id=Ib+=2;this.a=null;this.Da=b;this.hb=c;this.size=d||0;this.type=e||Jb;this.i=e==Kb;this.controller=null;eb(this);this.na=this.Yb=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],Lb(this,f.Ub);else if(Ua)this.m=new ArrayBuffer(this.size),this.c=new DataView(this.m,0,this.size),this.b=new Uint8Array(this.m,0,this.size),this.u=new Uint16Array(this.m,0,this.size>>1),this.a=new Int32Array(this.m,0,this.size>>2),Lb(this,Hb?Mb:Nb);else{a=this.a=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;Lb(this,Ob)}else Lb(this)}var Jb=0,Kb=2,lb=4,nb=["NONE","RAM","ROM","VID","H/W"],Ib=0;
J.prototype={constructor:J,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ua)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.c.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Ua)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.na=!0}return!1},v:function(a,b){vb(this.l,b);return 255},g:function(a,b,c){vb(this.l,c)},w:function(a,b){return this.tb(a++,b++)|this.tb(a,
b)<<8},B:function(a,b,c){this.zb(a++,b&255,c++);this.zb(a,b>>8,c)},M:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ia:function(a,b){a&1&&vb(this.l,b);b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},pa:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.na=!0},Ba:function(a,b,c){a&1&&vb(this.l,c);c=a>>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<<a)|b<<a:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|b>>8);this.na=
!0},G:function(a,b){return this.I(a,b)},P:function(a,b){return this.W(a,b)},ka:function(a,b,c){this.i?this.g(a,b,c):this.Ab(a,b,c)},ra:function(a,b,c){this.i?this.g(a,b,c):this.sa(a,b,c)},F:function(a){return this.b[a]},K:function(a){return this.b[a]},N:function(a,b){a&1&&vb(this.l,b);return this.c.getUint16(a,!0)},X:function(a,b){a&1&&vb(this.l,b);return this.u[a>>1]},ja:function(a,b){this.b[a]=b;this.na=!0},la:function(a,b){this.b[a]=b;this.na=!0},qa:function(a,b,c){a&1&&vb(this.l,c);this.c.setUint16(a,
b,!0);this.na=!0},Aa:function(a,b,c){a&1&&vb(this.l,c);this.u[a>>1]=b;this.na=!0}};function eb(a,b,c){a.D=b;a.h=a.o=0;c&&((a.h=c.h)&&Pb(a,Qb,!1),(a.o=c.o)&&Rb(a,Qb,!1))}function Rb(a,b,c){c&&a.o||(a.zb=!a.i&&b[1]||a.g,a.ib=!a.i&&b[3]||a.B);if(c||void 0===c)a.Ab=b[1]||a.g,a.sa=b[3]||a.B}function Pb(a,b,c){c&&a.h||(a.tb=b[0]||a.v,a.S=b[2]||a.w);if(c||void 0===c)a.I=b[0]||a.v,a.W=b[2]||a.w}function Lb(a,b){b||(b=Sb);Pb(a,b,void 0);Rb(a,b,void 0)}
var Sb=[],Ob=[J.prototype.M,J.prototype.pa,J.prototype.ia,J.prototype.Ba],Qb=[J.prototype.G,J.prototype.ka,J.prototype.P,J.prototype.ra];if(Ua)var Nb=[J.prototype.F,J.prototype.ja,J.prototype.N,J.prototype.qa],Mb=[J.prototype.K,J.prototype.la,J.prototype.X,J.prototype.Aa];
function Tb(a,b){y.call(this,"CPU",a,Tb);var c=a.multiplier||1;this.$a=a.cycles||b;this.la=c;this.ob=Math.round(this.$a/1E4)/100;this.pa=this.ob*this.la;this.j.Z=!1;this.j.xb=!1;this.j.Ma=a.autoStart;this.j.Za=!1;this.Wa=this.ra=0;this.Ya=a.csStart;this.Ba=a.csInterval;this.Ja=a.csStop;this.I=[];this.Mb=this.Oc.bind(this);G(this)}A(Tb);var Ub=["power","reset"];h=Tb.prototype;
h.ba=function(a,b,c,d){this.i=a;this.l=b;this.D=d;for(b=0;b<Ub.length;b++)(c=this.m[Ub[b]])&&this.i.V(null,Ub[b],c);a=Vb(a,"autoStart");null!=a&&(this.j.Ma="true"==a?!0:"false"==a?!1:!!a);G(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.ea=function(a,b){if(!b){if(a&&this.restore){Yb(this);if(!this.restore(a))return!1;Zb(this)}else this.reset();this.R("No debugger detected")}this.i.ha();return!0};h.da=function(a){return a?this.save():!0};
h.Ma=function(){return this.j.Ma||void 0===this.m.run?($b(this),!0):!1};h.Fb=function(){return 0};function Zb(a){void 0===a.Ya&&(a.Ya=0);void 0===a.Ba&&(a.Ba=-1);void 0===a.Ja&&(a.Ja=-1);a.j.Za=0<=a.Ya&&0<a.Ba;a.j.Za&&(a.Wa=0,a.ra=a.Ya-a.M)}
h.V=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.m[b]=c,!0;case "run":return this.m[b]=c,c.onclick=function(){var a;if(a=d.i)if(a=d.i,a.j.O)a=!0;else{var b=null,c,k=B(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.j.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.j.O);c++);c==k.length&&(b=a);r("The "+b.type+" component ("+b.id+") is not "+(b.j.ready?"powered yet":"ready yet"+(b.eb?" (waiting for notification)":""))+".");a=!1}a&&(d.j.Z?H(d):$b(d))},!0;case "speed":return this.m[b]=
c,!0;case "setSpeed":return this.m[b]=c,c.onclick=function(){ac(d,d.la<<1,!0)},c.textContent=this.pa.toFixed(2)+"Mhz",!0}return!1};h.ha=function(){var a=this.m.speed;a&&(a.textContent=this.j.Z&&this.ja?this.ja.toFixed(2)+"Mhz":"Stopped")};function bc(a,b){var c=1;b&&1<a.la&&a.ja&&(c=a.ja/a.ob);a.Jb=Math.round(1E3/30);a.bb=Math.floor(a.$a/30*c);b||(a.Ka=a.bb);a.rb=0}function cc(a){return a.M+a.X+a.qa-a.a}function Yb(a){a.ja=0;a.Lb=0;a.M=a.X=a.qa=a.a=a.G=0;Zb(a);ac(a,1)}
function ac(a,b,c){if(void 0!==b){.8>a.ja/a.pa&&(b=1);a.la=b;b=a.ob*a.la;if(a.pa!=b){a.pa=b;b=a.pa.toFixed(2)+"Mhz";var d=a.m.setSpeed;d&&(d.textContent=b);a.R("target speed: "+b)}c&&a.i&&dc(a.i)}a.M+=a.X;a.X=0;a.W=ra();a.ka=0;bc(a)}function wb(a,b){var c=a.I.length;a.I.push([-1,b]);return c}function yb(a,b,c){0<=b&&b<a.I.length&&0>a.I[b][0]&&(c=a.$a*a.la/1E3*c|0,a.I[b][0]=c+ec(a))}function ec(a,b){var c=a.qa-=a.a;a.a=a.G=0;b&&(a.qa=0);return c}
h.Oc=function(){if(this.j.Z){this.rb>=this.$a&&bc(this,!0);this.La=0;this.Va=ra();if(this.ka){var a=this.Va-this.ka;a>this.Jb&&(this.W+=a,this.W>this.Va&&(this.W=this.Va))}try{do{for(var b,c=this.j.Za?1:this.bb,d=this.I.length-1;0<=d;d--){var e=this.I[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.Rb(b)}catch(m){if("number"!=typeof m)throw m;}b=ec(this,!0);this.La+=b;this.X+=b;a=b;if(this.j.Za){var f=!1;this.Wa=this.Wa+this.Fb()|0;this.ra-=a;0>=this.ra&&(this.ra+=this.Ba,f=!0);0<=this.Ja&&this.Ja<=cc(this)&&
(this.Ba=this.Ja=-1,Zb(this),H(this),f=!0);f&&this.R(cc(this)+" cycles: checksum="+l(this.Wa))}for(var a=b,g=this.I.length-1;0<=g;g--){var k=this.I[g];0>k[0]||(k[0]-=a,0>=k[0]&&(k[0]=-1,k[1]()))}this.Ka-=b;if(0>=this.Ka){this.Ka+=this.bb;15<=++this.Lb&&(this.i&&this.i.ha(),this.Lb=0);break}}while(this.j.Z)}catch(m){H(this);this.i&&this.i.stop(ra(),cc(this));b=m.stack||m.message;this.j.error=!0;this.C(b);return}if(this.j.Z){b=setTimeout;c=this.Mb;this.ka=ra();d=this.Jb;this.La&&(d=Math.round(d*this.La/
this.bb));d-=this.ka-this.Va;if(e=this.ka-this.W)this.ja=Math.round(this.X/(10*e))/100,864E5<=e&&(this.M=0,ac(this));if(0>d||this.ja<this.pa)-1E3>d&&(this.W-=d),d=0;this.rb+=this.La;this.ka+=d;b(c,d)}}};function $b(a){var b;a.j.error?(a.R(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.Z)a.R(a.toString()+" busy");else{ac(a);a.j.Z=!0;a.j.xb=!0;if(b=a.m.run)b.textContent="Halt";a.i&&a.i.start(a.W,cc(a));setTimeout(a.Mb,0)}}h.Rb=function(){return 0};
function H(a){var b=!1;if(a.j.Z){ec(a);a.M+=a.X;a.X=0;a.j.Z=!1;if(b=a.m.run)b.textContent="Run";a.i&&a.i.stop(ra(),cc(a));b=!0}a.j.complete=void 0;return b}function fc(a){this.Ra=+a.model||1170;this.Hb=a.addrReset||0;Tb.call(this,a,6666667);this.decode=1120==this.Ra?gc.bind(this):hc.bind(this);ic(this);this.sb=0;this.N=null;this.j.complete=!1}A(fc,Tb);h=fc.prototype;h.reset=function(){this.status("model "+this.Ra);this.j.Z&&H(this);ic(this);Yb(this);this.j.error=!1;this.parent.reset.call(this)};
function ic(a){a.o=65536;a.g=32768;a.h=65535;a.u=32768;a.A=15;a.f=[0,0,0,0,0,0,0,a.Hb];a.Ca=[0,0,0,0,0,0];a.ga=[0,0,0,0];a.v=0;a.Ta=0;a.ac=[4,2,0,1];a.H=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.U=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.cc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.Pb=[0,0,0,0,0,0,0,0];a.Ob=0;a.s=0;a.B=a.F=0;a.c=a.b=a.nb=0;a.sa=-1;jc(a)}function jc(a){a.ya=255;a.J=0;a.wb=0;a.w=0;a.wa=0;a.vb=0;a.xa=0;a.Oa=0;a.Sa=0;a.pb=262143;a.Ua=253952;a.N=null;a.l&&Ab(a)}function Ab(a){a.Oa?(a.P=65536,a.K=a.$b,a.S=a.Lc,a.ib=a.yd,hb(a.l,a.xa&16?22:18)):(a.P=0,a.K=a.Zb,a.S=a.Kc,a.ib=a.xd,hb(a.l,16))}function kc(a,b,c){a.Hb=b;O(a,b);!c&&a.D&&(H(a)||a.D.ha())}h.Fb=function(){return 0};
h.save=function(){var a=new P(this);a.set(0,[]);a.set(1,[this.M,this.la]);a.set(2,rb(this.l));return a.data()};h.restore=function(a){var b=a[1];this.M=b[1];ac(this,b[3]);a:{b=this.l;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.F){for(var f=0,g=Array(b.F),k=0;k<e.length-1;)for(var m=e[k++],p=e[k++];m--;)g[f++]=p;e=g}f=b.b[d];if(!f||!f.restore(e)){r("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Q(a){return a.o&65536?1:0}
h.ua=function(){return this.u&32768?8:0};function lc(a){var b=a.f[7];a.w&57344||(a.wa=0,a.vb=b);a.f[7]=b+2&65535;return a.S(b)}function mc(a,b){var c=a.f[7];a.f[7]=c+b&65535;return c}function O(a,b){a.f[7]=b&65535}function zb(a,b){return{Rc:a,Ea:b,next:null}}function xb(a,b){if(b!=a.N){var c=a.N;if(!c||c.Ea<=b.Ea)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.Ea<=b.Ea){b.next=d;c.next=b;break}c=d}while(c)}}a.s|=2}function Za(a){return a.A=a.A&63728|a.ua()|(a.h&65535?0:4)|(a.g&32768?2:0)|Q(a)}
function Cb(a,b){a.u=b<<12;a.h=~b&4;a.g=b<<14;a.o=b<<16;if((b^a.A)&2048)for(var c=a.Ca.length;0<=--c;){var d=a.f[c];a.f[c]=a.Ca[c];a.Ca[c]=d}a.v=b>>14&3;c=a.A>>14&3;a.v!=c&&(a.ga[c]=a.f[6],a.f[6]=a.ga[a.v]);a.A=b;a.s|=2}function S(a,b){a.s&128||(a.u=a.h=b,a.g=0)}function nc(a,b,c){a.s&128||(a.u=a.h=a.o=b,a.g=c||0)}function oc(a,b,c,d){a.s&128||(a.u=a.h=a.o=b,a.g=(c^b)&(d^b))}function pc(a,b){a.s&128||(a.u=a.h=a.o=b,a.g=a.u^a.o>>1)}function qc(a,b,c,d){a.s&128||(a.u=a.h=a.o=b,a.g=(c^d)&(d^b))}
function K(a,b,c){if(!a.sb){var d=!1;0>a.sa?a.sa=Za(a):a.v||(b=4,d=!0);a.w&57344||(a.wa=63222,a.vb=b);a.v=0;var e=a.S(b|a.P),f=a.S(b+2&65535|a.P);Cb(a,f&-12289|a.sa>>2&12288);d&&(a.J|=4,a.f[6]=4);rc(a,a.sa);rc(a,a.f[7]);O(a,e);a.s&=-113;a.sa=-1;a.s|=8;if(26!=c)throw b;}}function sc(a){var b=tc(a),c=tc(a)&-1793;a.A&49152&&(c=c&-225|a.A&63712);O(a,b);Cb(a,c);a.s&=-17}
function uc(a,b,c){var d,e,f,g=0;d=b>>13;a.xa&a.ac[a.v]||(d&=7);e=a.H[a.v][d];f=(a.U[a.v][d]<<6)+(b&8191)&a.pb;if(f<a.Ua)f&1&&!(c&1)&&(a.J|=64,K(a,4,10));else if(a.xa&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var k=f>>13&31;31>k?a.xa&32&&(f=a.cc[k]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Ua&&4186112>f&&(a.J|=32,K(a,4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:
128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.H[a.v][d]=e;if(4194170!==f||a.v)a.Sa=a.v,a.Ta=d;g&&(g&57344&&(0<=a.sa&&(g|=128),a.w&57344||(a.w=a.w|g|a.Sa<<5|a.Ta<<1),K(a,168,16)),a.w&61440||!(4191360>f||4194239<f)||(a.w|=4096,a.w&512&&(a.s|=32)));return f}function vc(a,b,c){b&1&&a.a--;a=a.l;a.b[(b&a.g)>>>a.l].zb(b&a.i,c&255,b)}function tc(a){var b=a.S(a.f[6]|a.P);a.f[6]=a.f[6]+2&65535;return b}
function rc(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.w&57344||(a.wa=a.wa<<8|246);!a.v&&c<=a.ya&&4<c&&(c<=a.ya-32?(a.J|=4,a.f[6]=4,K(a,4,18)):(a.J|=8,a.s|=4));a.ib(c,b)}
function wc(a,b,c,d){var e,f,g=d&8?0:a.P;switch(b){case 0:return K(a,4,20),0;case 1:return 6===c&&!a.v&&d&4&&(a.f[6]<=a.ya||65534<=a.f[6])&&(a.f[6]<=a.ya-32||65534<=a.f[6]?(a.J|=4,a.f[6]=4,K(a,4,22)):(a.J|=8,a.s|=64)),a.a-=3,7===c?a.f[c]:a.f[c]|g;case 2:f=2;e=a.f[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.f[c];7!==c&&(e|=g);e=a.S(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.f[c]+f&65535;7!==c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.f[c]-2&65535;7!==c&&(e|=g);e=a.S(e)|g;a.a-=
8;break;case 6:return e=a.S(mc(a,2)),e=e+a.f[c]&65535|g,a.a-=6,e;case 7:return e=a.S(mc(a,2)),e=e+a.f[c]&65535,e=a.S(e|a.P)|g,a.a-=10,e}a.f[c]=a.f[c]+f&65535;!g||a.w&57344||(a.wa=a.wa<<8|f<<3&248|c);6==c&&!a.v&&d&4&&0>=f&&(a.f[6]<=a.ya||65534<=a.f[6])&&(a.f[6]<=a.ya-32?(a.J|=4,a.f[6]=4,K(a,4,24)):(a.J|=8,a.s|=64));return e}h.Qa=function(a,b){this.Oa?(this.sb++,vc(this,uc(this,a,5),b),this.sb--):this.l.Qa(a,b)};h.Zb=function(a,b,c){return wc(this,a,b,c)};
h.$b=function(a,b,c){return uc(this,wc(this,a,b,c),c)};h.Kc=function(a){return pb(this.l,a)};h.Lc=function(a){return pb(this.l,uc(this,a,2))};h.xd=function(a,b){qb(this.l,a,b&65535)};h.yd=function(a,b){qb(this.l,uc(this,a,4),b)};function xc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=wc(a,b,d,2),c&65536||61440!==(a.A&61440)&&(d&=65535),a.v=a.A>>12&3,c=a.S(d|c&a.P),a.v=a.A>>14&3):c=6!=d||(a.A>>2&12288)===(a.A&12288)?a.f[d]:a.ga[a.A>>12&3];return c}
function yc(a,b,c,d){a.w&57344||(a.wa=22);var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=wc(a,b,e,4),c&65536||(e&=65535),a.v=a.A>>12&3,e=uc(a,e|c&65536,4),a.v=a.A>>14&3,qb(a.l,e,d)):6!=e||(a.A>>2&12288)===(a.A&12288)?a.f[e]=d:a.ga[a.A>>12&3]=d}function zc(a,b){b>>=6;var c=a.F=b&7;(b=a.B=(b&56)>>3)?(c=a.K(b,c,3),a=ob(a.l,c)):a=a.f[c]&255;return a}function Ac(a,b){b>>=6;var c=a.F=b&7;return(b=a.B=(b&56)>>3)?pb(a.l,a.K(b,c,2)):a.f[c]}function Bc(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return wc(a,b,c,8)}
function Cc(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.K(b,c,3),a=ob(a.l,c)):a=a.f[c]&255;return a}function Dc(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?pb(a.l,a.K(b,c,2)):a.f[c]}function T(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.nb=a.K(b,e,7),vc(a,e,d.call(a,c,ob(a.l,e)))):a.f[e]=a.f[e]&65280|d.call(a,c,a.f[e])}function U(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.K(b,e,6),qb(a.l,e,d.call(a,c,pb(a.l,e)))):a.f[e]=d.call(a,c,a.f[e])}
function Ec(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?vc(a,a.K(b,e,5),c):a.f[e]=c?d&1?c<<24>>24&65535:a.f[e]&-256|c&255:a.f[e]&-256;return c}function Fc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?qb(a.l,a.K(b,d,4),c):a.f[d]=c&65535;return c}function V(a,b,c){c&&(O(a,a.f[7]+(b<<24>>23)),a.a-=2);a.a-=3}
h.Rb=function(a){this.j.complete=!0;var b=a?this.j.xb?0:1:-1;this.j.xb=!1;this.qa=this.a=a;do{if(this.s){this.s&112&&(this.s&32?K(this,168,28):this.s&64?K(this,4,30):this.s&16&&K(this,12,32),this.s&=-113);if(a=this.s&7){a=!1;if(this.s&2){this.s&=-3;var c=160,d=(this.wb&224)>>5,e=this.N&&this.N.Ea>d?this.N:null;e&&(c=e.Rc,d=e.Ea);d>(this.A&224)>>5?(this.s&4&&(mc(this,2),this.s&=-5),K(this,c,26),d=!0):d=!1;if(d){if(e)if(a=e,e=this.N,e==a)this.N=a.next;else for(;e;){d=e.next;if(d==a){e.next=d.next;break}e=
d}a=!0}}else this.s&1&&this.s++;a=a&&0>b}if(a)break}this.s=this.s&7|this.A&16;this.decode(lc(this))}while(0<this.a);return this.j.complete?this.qa-this.a:void 0===this.j.complete?0:-1};x(function(){for(var a=E(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new fc(d);D(d,c)}});function Gc(a,b){var c=b+a;oc(this,c,a,b);return c&65535}function Hc(a,b){var c=b+a;oc(this,c<<8,a<<8,b<<8);return c&255}function Ic(a,b){a=b<<1;pc(this,a);return a&65535}
function Jc(a,b){a=b<<1;pc(this,a<<8);return a&255}function Kc(a,b){a=b&32768|b>>1|b<<16;pc(this,a);return a&65535}function Lc(a,b){a=b&2048|b>>1|b<<8;pc(this,a<<8);return a&255}function Mc(a,b){a=b&~a;S(this,a);return a}function Nc(a,b){a=b&~a;S(this,a<<8);return a}function Oc(a,b){a|=b;S(this,a);return a}function Pc(a,b){a|=b;S(this,a<<8);return a}function Qc(a,b){a=~b|65536;nc(this,a);return a&65535}function Rc(a,b){a=~b|256;nc(this,a<<8);return a&255}
function Sc(a,b){a=b-a;this.s&128||(this.u=this.h=a,this.g=b&(b^a));return a&65535}function Tc(a,b){a=b-a;var c=a<<8;b<<=8;this.s&128||(this.u=this.h=c,this.g=b&(b^c));return a&255}function Uc(a,b){a=b+a;this.s&128||(this.u=this.h=a,this.g=a&(b^a));return a&65535}function Vc(a,b){a=b+a;var c=a<<8;this.s&128||(this.u=this.h=c,this.g=c&(b<<8^c));return a&255}function Wc(a,b){a=-b;nc(this,a,a&b&32768);return a&65535}function Xc(a,b){a=-b;nc(this,a<<8,(a&b&128)<<8);return a&255}
function Yc(a,b){a=b<<1|this.o>>16&1;pc(this,a);return a&65535}function Zc(a,b){a=b<<1|this.o>>16&1;pc(this,a<<8);return a&255}function $c(a,b){a=(this.o&65536|b)>>1|b<<16;pc(this,a);return a&65535}function ad(a,b){a=((this.o&65536)>>8|b)>>1|b<<8;pc(this,a<<8);return a&255}function bd(a,b){var c=b-a;qc(this,c,a,b);return c&65535}function cd(a,b){var c=b-a;qc(this,c<<8,a<<8,b<<8);return c&255}function dd(a,b){this.s&128||(this.u=this.h=b&65280,this.g=this.o=0);return(b<<8|b>>8)&65535}
function ed(a,b){a^=b;S(this,a);return a&65535}function fd(a){U(this,a,Ac(this,a),Gc);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function gd(a){var b=Dc(this,a);a=a>>6&7;var c=this.f[a];c&32768&&(c|=4294901760);this.o=this.g=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.o=c<<17-b,c>>=b;else if(b)if(16<b)this.g=c,c=0;else{this.o=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.g=32768)}this.f[a]=c&65535;this.u=this.h=c;this.a-=(this.c?6:7)+b}
function hd(a){var b=Dc(this,a);a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.o=this.g=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.o=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.o=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.g=32768)):d=c;this.f[a]=d>>16&65535;this.f[a|1]=d&65535;this.u=d>>16;this.h=d>>16|d;this.a-=(this.c?6:7)+b}function id(a){V(this,a,!Q(this))}function jd(a){V(this,a,Q(this))}
function kd(a){U(this,a,Ac(this,a),Mc);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function ld(a){T(this,a,zc(this,a),Nc);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function md(a){U(this,a,Ac(this,a),Oc);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function nd(a){T(this,a,zc(this,a),Pc);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}
function od(a){S(this,Ac(this,a)&Dc(this,a));this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function pd(a){S(this,(zc(this,a)&Cc(this,a))<<8);this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function qd(a){V(this,a,this.h&65535?0:4)}function rd(a){V(this,a,!this.ua()==!(this.g&32768))}function sd(a){V(this,a,!!(this.h&65535)&&!this.ua()==!(this.g&32768))}function td(a){V(this,a,!Q(this)&&!!(this.h&65535))}
function ud(a){V(this,a,(this.h&65535?0:4)||!this.ua()!=!(this.g&32768))}function vd(a){V(this,a,Q(this)||(this.h&65535?0:4))}function wd(a){V(this,a,!this.ua()!=!(this.g&32768))}function xd(a){V(this,a,this.ua())}function yd(a){V(this,a,!!(this.h&65535))}function zd(a){V(this,a,!this.ua())}function Ad(){K(this,12,1);this.a-=5}function Bd(a){V(this,a,!0)}function Cd(a){V(this,a,!(this.g&32768))}function Dd(a){V(this,a,this.g&32768?2:0)}
function W(a){a&1&&(this.o=0);a&2&&(this.g=0);a&4&&(this.h=1);a&8&&(this.u=0);this.a-=5}function Ed(a){var b=Ac(this,a);a=Dc(this,a);qc(this,b-a,a,b);this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function Fd(a){var b=zc(this,a)<<8;a=Cc(this,a)<<8;qc(this,b-a,a,b);this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}
function Gd(a){var b=Dc(this,a);if(b){a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.o=this.g=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.f[a]=d&65535,this.f[a|1]=c-d*b&65535,this.h=d>>16|d,this.u=d>>16):(this.g=32768,this.h=d>>15|d,this.u=c>>16,-1===b&&65534===this.f[a]&&(this.f[a]=this.f[a|1]=1));this.a-=53}else this.h=this.u=0,this.g=32768,this.o=65536,this.a-=7}function Hd(){K(this,24,2);this.a-=25}
function Id(){this.A&49152?(this.J|=128,K(this,4,3)):this.D?this.D.c():H(this);this.a-=7}function Jd(){K(this,16,4);this.a-=25}var Kd=[0,7,7,10,7,11,9,13];function Ld(a){this.G=this.a;O(this,Bc(this,a));this.a=this.G-Kd[this.c]}var Md=[0,14,14,17,14,18,16,20];function Nd(a){this.G=this.a;var b=Bc(this,a);a=a>>6&7;rc(this,this.f[a]);this.f[a]=this.f[7];O(this,b);this.a=this.G-Md[this.c]}var Od=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
function Pd(a){var b=Ac(this,a);this.G=this.a;S(this,Fc(this,a,b));this.a=this.G-Od[(this.B?8:0)+this.c]+(7!=this.b||this.c?0:2)}function Qd(a){var b=zc(this,a);S(this,Ec(this,a,b,1)<<8);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}var Rd=[7,13,13,17,14,18,17,21];
function Sd(a){var b=Dc(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.f[a];c&32768&&(c|=-65536);b=~~(b*c);this.f[a]=b>>16&65535;this.f[a|1]=b&65535;this.s&128||(this.u=b>>16,this.h=this.u|b,this.g=0,this.o=-32768>b||32767<b?65536:0);this.a-=23}function Td(){this.a-=5}function Ud(){this.A&49152||(jc(this),this.l.reset());this.a-=667}function Vd(){sc(this);this.s|=this.A&16;this.a-=13}
function Wd(a){if(a&8)K(this,8,6);else{var b=tc(this);a&=7;7==a?O(this,b):(O(this,this.f[a]),this.f[a]=b);this.a-=9}}function X(a){a&1&&(this.o=65536);a&2&&(this.g=32768);a&4&&(this.h=0);a&8&&(this.u=32768);this.a-=5}function Xd(a){var b=(a&448)>>6;if(this.f[b]=this.f[b]-1&65535)O(this,this.f[7]-((a&63)<<1)),this.a+=1;this.a-=6}function Yd(a){U(this,a,Ac(this,a),bd);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}
function Zd(a){U(this,a,0,dd);this.a-=this.c?9:3+(7==this.b?2:0)}function $d(){K(this,28,5);this.a-=5}function ae(){this.s&4||this.i.ha();this.s|=4;mc(this,-2);this.a-=3}function be(a){U(this,a,Ac(this,a),ed);this.a-=this.c?9:3+(7==this.b?2:0)}function Y(){K(this,8,6)}function gc(a){ce[a>>12].call(this,a)}function de(a){ee[a>>6&3].call(this,a)}function fe(a){ge[a>>6&3].call(this,a)}function he(a){ie[a>>6&3].call(this,a)}function je(a){ke[a&15].call(this,a)}function le(a){me[a&15].call(this,a)}
function ne(a){oe[a>>6&3].call(this,a)}function pe(a){qe[a>>6&3].call(this,a)}function re(a){se[a>>6&3].call(this,a)}
var ce=[function(a){te[a>>8&15].call(this,a)},Pd,Ed,od,kd,md,fd,Y,function(a){ue[a>>8&15].call(this,a)},Qd,Fd,pd,ld,nd,Yd,Y],te=[function(a){ve[a>>4&15].call(this,a)},Bd,yd,qd,rd,wd,sd,ud,Nd,Nd,de,fe,he,Y,Y,Y],ee=[function(a){nc(this,Fc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Qc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,Uc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,Sc);this.a-=this.c?9:3+(7==this.b?2:0)}],ge=[function(a){U(this,a,0,
Wc);this.a-=this.c?11:6},function(a){U(this,a,Q(this)?1:0,Gc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,Q(this)?1:0,bd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Dc(this,a);nc(this,a);this.a-=this.c?4:3+(7==this.b?2:0)}],ie=[function(a){U(this,a,0,$c);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Yc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Kc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Ic);this.a-=this.c?9:3+(7==this.b?2:0)}],
ve=[function(a){we[a&15].call(this,a)},Y,Y,Y,Ld,Ld,Ld,Ld,Wd,Y,je,le,Zd,Zd,Zd,Zd],we=[Id,ae,Vd,Ad,Jd,Ud,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y],ke=[Td,function(){this.o=0;this.a-=5},function(){this.g=0;this.a-=5},W,function(){this.h=1;this.a-=5},W,W,W,function(){this.u=0;this.a-=5},W,W,W,W,W,W,W],me=[Td,function(){this.o=65536;this.a-=5},function(){this.g=32768;this.a-=5},X,function(){this.h=0;this.a-=5},X,X,X,function(){this.u=32768;this.a-=5},X,X,X,X,X,X,X],ue=[zd,xd,td,vd,Cd,Dd,id,jd,Hd,$d,ne,pe,re,Y,Y,Y],oe=[function(a){nc(this,
Ec(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,Rc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,Vc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,Tc);this.a-=this.c?9:3+(7==this.b?2:0)}],qe=[function(a){T(this,a,0,Xc);this.a-=this.c?11:6},function(a){T(this,a,Q(this)?1:0,Hc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,Q(this)?1:0,cd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Cc(this,a);nc(this,a<<8);this.a-=this.c?4:3+(7==this.b?
2:0)}],se=[function(a){T(this,a,0,ad);this.a-=this.c?9+(this.nb&1):3+(7==this.b?2:0)},function(a){T(this,a,0,Zc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,Lc);this.a-=this.c?9+(this.nb&1):3+(7==this.b?2:0)},function(a){T(this,a,0,Jc);this.a-=this.c?9:3+(7==this.b?2:0)}];function hc(a){xe[a>>12].call(this,a)}
var xe=[function(a){ye[a>>8&15].call(this,a)},Pd,Ed,od,kd,md,fd,function(a){ze[a>>8&15].call(this,a)},function(a){Ae[a>>8&15].call(this,a)},Qd,Fd,pd,ld,nd,Yd,Y],ye=[function(a){Be[a>>4&15].call(this,a)},Bd,yd,qd,rd,wd,sd,ud,Nd,Nd,de,fe,he,function(a){Ce[a>>6&3].call(this,a)},Y,Y],Ce=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=this.S(a|this.P);O(this,this.f[5]);this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=xc(this,a,0);rc(this,a);S(this,a);this.a-=11},function(a){var b=tc(this);this.G=
this.a;yc(this,a,0,b);S(this,b);this.a=this.G-Rd[this.c]},function(a){S(this,Fc(this,a,this.ua?65535:0));this.a-=this.c?9:3+(7==this.b?2:0)}],Be=[function(a){De[a&15].call(this,a)},Y,Y,Y,Ld,Ld,Ld,Ld,Wd,function(a){a&8?(this.A&49152||(this.A=this.A&-2017|(a&7)<<5,this.s|=1),this.a-=5):K(this,8,6)},je,le,Zd,Zd,Zd,Zd],De=[Id,ae,Vd,Ad,Jd,Ud,function(){sc(this);this.a-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],ze=[Sd,Sd,Gd,Gd,gd,gd,hd,hd,be,be,Y,Y,Y,Y,Xd,Xd],Ae=[zd,xd,td,vd,Cd,Dd,id,jd,Hd,$d,ne,pe,re,function(a){Ee[a>>6&
3].call(this,a)},Y,Y],Ee=[Y,function(a){a=xc(this,a,65536);rc(this,a);S(this,a);this.a-=11},function(a){var b=tc(this);this.G=this.a;yc(this,a,65536,b);S(this,b);this.a=this.G-Rd[this.c]},Y];
function Fe(a){y.call(this,"ROM",a,Fe);this.T=this.b=null;this.h=a.addr;this.c=a.size;this.g=a.alias;this.i=a.file;this.o=n(this.i);if(this.i){a=this.i;var b=la(this.o);"json"!=b&&"hex"!=b&&(a=u()+"/api/v1/dump?file="+this.i+"&format=bytes&decimal=true");var c=this;q(a,null,!0,function(a,b,f){f?c.C("Unable to load ROM resource (error "+f+": "+a+")"):(Qa(c.ia,a,b),(a=va(a,b))?(c.b=a.L,c.T=a.T):c.i=null,Ge(c))})}}A(Fe);Fe.prototype.ba=function(a,b,c,d){this.l=b;this.a=c;this.D=d;Ge(this)};
Fe.prototype.ea=function(){this.T&&(this.D&&this.D.a(this.id,this.h,this.c,this.T),delete this.T);return!0};Fe.prototype.da=function(){return!0};
function Ge(a){if(!Ta(a)){if(a.i){if(!a.b||!a.l)return;a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size ("+l(a.b.length,8,!0)+") does not match specified size ("+l(a.c,8,!0)+")";a.j.error=!0;a.C(b)}else{b=a.h;if(kb(a.l,b,a.c,Kb)){var c;for(c=0;c<a.b.length;c++)a.l.Qa(b+c,a.b[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.g?b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){var d=a,e=b[c],f=jb(d.l,d.h,d.c);ib(d.l,e,d.c,f)}delete a.b}}}G(a)}}
x(function(){for(var a=E(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Fe(d);D(d,c)}});
function He(a){y.call(this,"RAM",a,He);this.T=this.c=null;this.i=a.addr;this.h=a.size;this.aa=a.load;this.$=a.exec;this.g=!1;this.b=a.file;this.o=n(this.b);if(this.b){a=this.b;var b=la(this.o);"json"!=b&&"hex"!=b&&(a=u()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;q(a,null,!0,function(a,b,f){f?c.C("Unable to load RAM resource (error "+f+": "+a+")"):(Qa(c.ia,a,b),(a=va(a,b))?(c.c=a.L,c.T=a.T,null==c.aa&&(c.aa=a.aa),null==c.$&&(c.$=a.$)):c.b=null,Ie(c))})}}A(He);
He.prototype.ba=function(a,b,c,d){this.l=b;this.a=c;this.D=d;Ie(this)};He.prototype.ea=function(){this.T&&(this.D&&this.D.a(this.id,this.i,this.h,this.T),delete this.T);return!0};He.prototype.da=function(){return!0};function Ie(a){if(a.l&&(!a.g&&a.h&&kb(a.l,a.i,a.h,1)&&(a.g=!0),!Ta(a))){if(!a.g)r("No RAM allocated");else if(a.b){if(!a.c||!a.l)return;Je(a,a.c,a.aa,a.$,a.i)}G(a)}}
He.prototype.reset=function(){if(this.g){for(var a=this.l,b=this.i,c=this.h,d=b&a.i,b=b>>>a.l;0<c&&b<a.b.length;){var e=a.b[b],f=c,g,d=d||0;void 0===f&&(f=e.size);if(Ua)for(g=d;f--&&g<e.b.length;g++)e.b[g]=0;else for(g=d;f--&&g<e.size;g++)e.Ab(d,0,e.Da+d);c-=a.c;b++;d=0}this.c&&Je(this,this.c,this.aa,this.$,this.i,!0)}};
function Je(a,b,c,d,e,f){var g=!1;if(null==c)for(var k=0;k<b.length-1;){var m=b[k]&255|(b[k+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(k+6>=b.length)break;for(var k=k+2,p=b[k++]&255|(b[k++]&255)<<8,t=b[k++]&255|(b[k++]&255)<<8,m=m+((p&255)+(p>>8)+(t&255)+(t>>8)),w=k,F=p-=6;0<p&&k<b.length;)m+=b[k++]&255,p--;if(p||k>=b.length)break;m+=b[k++]&255;if(m&255)break;if(F)for(;F--;)a.a.Qa(t++,b[w++]&255);else t&1?H(a.a):kc(a.a,t,f);g=!0}else k++;else k+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.a.Qa(c+
e,b[e]);null!=d&&kc(a.a,d,f);g=!0}return g}x(function(){for(var a=E(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new He(d);D(d,c)}});function Ke(a){y.call(this,"Keyboard",a,Ke);G(this)}A(Ke);Ke.prototype.V=function(){return!1};Ke.prototype.ba=function(a,b,c,d){this.i=a;this.a=c;this.D=d};x(function(){for(var a=E(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Ke(d);D(d,c)}});
function Z(a){this.F=a.baudReceive||9600;this.I=a.baudTransmit||9600;this.P=a.upperCase;this.g=this.o=null;this.K=a.tabSize;this.G=a.charBOL;this.u=0;y.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.o="";else{var c;a=Le;b&&(void 0===c&&(c="Panel"),(c=Sa(c,this.id))&&(b=c.m[b])&&this.V(null,a,b))}this.v=this.B=null;this.exports={connect:this.Gb,receiveData:this.ub}}A(Z);var Le="buffer";h=Z.prototype;
h.V=function(a,b,c){var d=this;switch(b){case Le:return this.m[b]=this.g=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.ub(b);return!0},c.onkeypress=function(a){a=a||window.event;d.ub(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.ba=function(a,b,c,d){this.i=a;this.l=b;this.a=c;this.D=d;var e=this;this.W=zb(48,4);this.M=wb(this.a,function(){e.b&128||!e.h.length||(e.w=e.h.shift()&255,e.P&&97<=e.w&&122>e.w&&(e.w-=32),e.b|=128,e.b&64&&xb(e.a,e.W))});this.X=zb(52,4);this.N=wb(this.a,function(){e.c|=128;e.c&64&&xb(e.a,e.X)});tb(b,this,Me);G(this)};
h.Gb=function(){if(!this.v){var a=Vb(this.i,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.Aa)return;b=pa(b[1]);if(this.v=Ra(b)){var d=this.v.exports;if(d){var e=d.connect;e&&e.call(this.v);if(this.B=d.receiveData){this.status(this.ia+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.ea=function(a,b){if(!b)if(this.Gb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.da=function(a){return a?this.save():!0};h.reset=function(){Ne(this)};h.save=function(){var a=new P(this);a.set(0,[]);return a.data()};h.restore=function(){return Ne(this)};function Ne(a){a.w=0;a.b=0;a.c=128;a.h=[];return!0}h.ub=function(a){if("number"==typeof a)this.h.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.h.push(a.charCodeAt(b));else this.h=this.h.concat(a);yb(this.a,this.M,1E3/Math.round(this.F/10));return!0};h.zc=function(){return this.b&65534};
h.md=function(a){this.b=this.b&-112|a&111};h.yc=function(){this.b&=-129;0<this.h.length&&yb(this.a,this.M,1E3/Math.round(this.F/10));return this.w};h.ld=function(){};h.Nc=function(){return this.c};h.Ad=function(a){128==(this.c&192)&&a&64&&yb(this.a,this.N,1E3/Math.round(this.I/10));this.c=this.c&-70|a&69};h.Mc=function(){return 0};
h.zd=function(a){if(a&=255){this.B&&this.B.call(this.v,a);if(this.g)if(13==a)this.u=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.u&&this.u--;else{var b;b=(b=qa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.K||8,c=a-this.u%a,this.K&&(b=" ".slice(0,c)));this.G&&!this.u&&c&&(b=String.fromCharCode(this.G)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.u+=c}else if(null!=this.o){if(10==a||1024<=this.o.length)this.R(this.o),
this.o="";10!=a&&(this.o+=String.fromCharCode(a))}this.c&=-129;yb(this.a,this.N,1E3/Math.round(this.I/10))}};var Oe={},Me=(Oe[65392]=[null,null,Z.prototype.zc,Z.prototype.md,"RCSR"],Oe[65394]=[null,null,Z.prototype.yc,Z.prototype.ld,"RBUF"],Oe[65396]=[null,null,Z.prototype.Nc,Z.prototype.Ad,"XCSR"],Oe[65398]=[null,null,Z.prototype.Mc,Z.prototype.zd,"XBUF"],Oe);x(function(){for(var a=E(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Z(d);D(d,c)}});
function Db(a){y.call(this,"PC11",a,Db);this.c=a.autoMount||null;this.o=0;this.N=a.baudReceive||3600;this.w=this.B=this.b=0;this.v=[];this.u=Pe;this.g=Qe;this.F=this.h="";this.L=this.aa=this.$=null;this.K=-1;this.I=!Ba("Mobi")&&window&&"FileReader"in window}A(Db);var Pe="",Qe=0;h=Db.prototype;
h.V=function(a,b,c){var d=this,e=Qe;switch(b){case "listTapes":return this.m[b]=c,c.onchange=function(){var a=d.m.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(m){r("PC11 option error: "+m.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.m[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.m[b]=c,c.onclick=function(){var a=
d.m.listTapes;a&&Re(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.I){c.parentNode.removeChild(c);break}this.m[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Re(d,n(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.m[b]=c,!0}return!1};
h.ba=function(a,b,c,d){this.i=a;this.l=b;this.a=c;this.D=d;this.M=Se(a);var e=this;if((this.c=Vb(this.i,"autoMount")||this.c)&&"string"==typeof this.c)try{this.c=eval("("+this.c+")")}catch(f){r("PC11 auto-mount error: "+f.message+" ("+this.c+")"),this.c=null}this.G=zb(56,4);this.P=wb(this.a,function(){1==(e.b&32769)&&!(e.b&128)&&e.w<e.v.length&&(e.B=e.v[e.w++]&255,Te(e,e.w/e.v.length*100),e.b|=128,e.b&=-2049,e.b&64&&xb(e.a,e.G))});tb(b,this,Ue);Ve(this,"None",Pe,!0);this.I&&Ve(this,"Local Tape","?");
Ve(this,"Remote Tape","??");We(this)||G(this)};h.ea=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.da=function(a){return a?this.save():!0};h.reset=function(){this.b&=-2241;this.B=0};function We(a){a.o=0;if(a.c){var b=a.c.path||"",c;if(!(c=a.c.name))a:{if((c=a.m.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=n(b,!0)}b&&c?Xe(a,c,b,1,!0):Ye(a)}return!!a.o}
function Re(a,b,c,d,e){if(c)if("?"==c)a.C('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=n(c);a.status("Attempting to load "+c+' as "'+b+'"');a.u="??"}else a.u=c;Xe(a,b,c,d,!1,e)}else Ze(a,!1)}function Xe(a,b,c,d,e,f){var g=-1;if(a.h.toLowerCase()!=c.toLowerCase()||a.g!=d)g++,Ze(a,!0),a.j.jb?a.C("PC11 busy"):(e&&a.o++,$e(a,b,c,d,f)?g++:a.j.jb=!0);g&&af(a,a.F,a.h,a.g,a.L,a.aa,a.$)}
function $e(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),af(a,b,c,d,e),a.u="?");Ye(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=la(c),f="json"==e||"gz"==e?encodeURI(c):u()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!q(f,null,!0,function(e,f,g){var k=0>g&&a.i&&!a.i.j.O;g?a.C('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(Qa(a.ia,e,f),(e=va(e,f))&&af(a,b,c,d,e.L,e.aa,e.$));
a.j.jb=!1;a.o&&(a.o--,a.o||G(a));Ye(a)})}function Ve(a,b,c,d){if((a=a.m.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}function Ye(a){var b=a.m.listTapes;if(b&&b.options){a=a.u||a.h;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}
function Te(a,b){b|=0;if(b!==a.K){var c=a.m.readProgress;c&&(c=(c=E(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.K=b}}function af(a,b,c,d,e,f,g){a.F=b;a.h=c;a.g=d;a.L=e;a.aa=f;a.$=g;2==d?a.M&&Je(a.M,e,f,g)?a.status("tape loaded: "+b):(a.F="",a.h="",a.u=Pe,a.g=Qe,a.C("No load address available for tape: "+b)):(a.w=0,a.v=e,a.status("tape attached: "+b),Te(a,0))}
function Ze(a,b){if(a.h||!1===b)a.F="",a.h="",b||(a.g&&a.status(1==a.g?"tape detached":"tape unloaded"),a.u=Pe,a.g=Qe,Ye(a))}h.save=function(){return(new P(this)).data()};h.restore=function(){return!0};h.sc=function(){return this.b&65534};h.ed=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&xb(this.a,this.G)):(this.b&=-129,this.b|=2048,this.B=0,yb(this.a,this.P,1E3/Math.round(this.N/10))));this.b=this.b&-66|a&65};h.rc=function(){this.b&=-129;this.b|=2048;return this.B};h.dd=function(){};
var bf={},Ue=(bf[65384]=[null,null,Db.prototype.sc,Db.prototype.ed,"PRS"],bf[65386]=[null,null,Db.prototype.rc,Db.prototype.dd,"PRB"],bf);function cf(a,b,c){y.call(this,"Disk",{id:a.ia+".disk"+l(++df,4)},cf);this.controller=a;this.i=a.i;this.D=a.D;this.g=b;this.oa=b.name;this.mb=b.mb;ef(this,c,b.fa,b.ca,b.Y,b.ma);G(this)}var df=0;A(cf);cf.prototype.ba=function(a,b,c,d){this.D=d};
function ef(a,b,c,d,e,f){a.mode=b;a.fa=c;a.ca=d;a.Y=e;a.ma=f;a.a=[];if("preload"!=a.mode){b=Array(a.fa);for(c=0;c<b.length;c++){d=Array(a.ca);for(e=0;e<d.length;e++){f=Array(a.Y);for(var g=1;g<=f.length;g++)f[g-1]=ff(null,c,e,g,a.ma,0);d[e]=f}b[c]=d}a.a=b}a.c=null}
function gf(a,b,c,d,e){var f=c;if(a.b)return!0;a.oa=b;a.za=c;a.Qb=n(c);a.b=e;a.h=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ia[d];if(e){a.fa=e[0];a.ca=e[1];a.Y=e[2];a.ma=e[3]||512;c=a.ma>>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.fa);for(d=0;d<a.a.length;d++)for(var F=a.a[d]=Array(a.ca),R=0;R<F.length;R++)for(var ta=F[R]=Array(a.Y),ua=0;ua<ta.length;ua++){for(var Wb=ff(null,d,R,ua+1,a.ma,0),If=Wb.data,Xb=0;Xb<c;Xb++,f+=4)var Jf=If[Xb]=b.getInt32(f,
!0),e=e+Jf&-1;Wb.Xa=c;ta[ua]=Wb}a.c=e;c=a}else a.C("Unrecognized disk format ("+d+" bytes)");a.b&&(a.b.call(a.controller,a.g,c,a.oa,a.za),a.b=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=la(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ma(c,"/")&&(d="dir"),f=u()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.mb?"":e)+"&format=json"));return!!q(f,
null,!0,function(b,c,d){hf(a,b,c,d)})}
function hf(a,b,c,d){var e=null;a.l=!1;var f=0>d&&a.i&&!a.i.j.O;if(d)a.controller.C('Unable to load disk "'+a.oa+'" (error '+d+": "+b+")",f);else{Qa(a.controller.ia,b,c);try{if(0<n(a.Qb,!0).toLowerCase().indexOf("-readonly"))a.l=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.l=!0)}var k;"<"==c.substr(0,1)?k=["Missing disk image: "+a.oa]:k=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(k.length)if(1==k.length)r(k[0]);else{a.fa=k.length;a.ca=k[0].length;a.Y=k[0][0].length;var m=k[0][0][0];a.ma=m&&m.length||512;for(d=c=0;d<a.fa;d++)for(f=0;f<a.ca;f++)for(g=0;g<a.Y;g++)if(m=k[d][f][g]){var p=m.length;void 0===p&&(p=m.length=512);var p=p>>2,t=m.pattern;void 0===t&&(t=m.pattern=0);var w=m.data;if(void 0===w){var F=m.bytes;if(void 0!==F&&F.length){for(var R=p<<2,ta=F.length;ta<R;ta++)F[ta]=t;jf(m,F)}else w=[],t=m.pattern=t|t<<8|t<<16|t<<24,m.data=w;delete m.bytes}ff(m,d,f);
for(R=0;R<w.length;R++)c=c+w[R]&-1}a.a=k;a.c=c;e=a}else r("Empty disk image: "+a.oa)}catch(ua){r("Disk image error ("+b+"): "+ua.message)}}a.b&&(a.b.call(a.h,a.g,e,a.oa,a.za),a.b=null)}function ff(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.Hd=b;a.Id=c;a.fb=a.Xa=0;a.na=!1;return a}function jf(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
function kf(a,b){var c=a.ca*a.Y,d=b/c|0;if(d<a.fa){c=b%c;b=c/a.Y|0;var c=c%a.Y+1,e=null,f=a.g,g=a.a[d];if(g){a=g[b];if(!a&&f.Vb&&b<f.ca)for(a=g[b]=Array(f.Wb),g=0;g<a.length;g++)a[g]=ff(null,d,b,g+1,f.Kb,0);if(a){for(g=0;g<a.length;g++)if(a[g]&&a[g].sector==c){e=a[g];break}!e&&f.Vb&&9==f.Bb&&(e=a[g]=ff(null,d,b,f.Bb,f.Kb,0))}}return e}return null}
function lf(a,b){for(var c=1,d=0,e=0;c--;){var f;f=b++;var g=-1;if(a&&f<a.length)var g=a.data,k=f>>2,g=(k<g.length?g[k]:a.pattern)>>((f&3)<<3)&255;f=g;if(0>f)break;d|=f<<e;e+=8}return d}
cf.prototype.save=function(){var a=0,b=[];b[a++]=[this.za,this.c,this.fa,this.ca,this.Y,this.ma];if(!this.l)for(var c=this.a,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Xa){for(var k=[],m=0,p=g.fb,t=g.fb+g.Xa;p<t;)k[m++]=g.data[p++];b[a++]=[d,e,f,g.fb,k]}}return b};
cf.prototype.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.a.length&&6<=e.length?ef(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.c&&e[1]!=this.c&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.c+")",b=-2));for(this.a.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],k=g[f++],m=g[f++],p=g[f++];if(k>=this.a.length||m>=this.a[k].length||p>=this.a[k][m].length){c="sector (CHS="+k+":"+m+":"+p+") out of range ("+
b+" changes applied)";b=-1;break}if(this.l){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.a[k][m][p]){for(m=k.data.length;m<e;)k.data[m++]=k.pattern;m=0;k.fb=e;for(k.Xa=f.length;e<g;)k.data[e++]=f[m++];b++}}}0>b&&-2!=b&&this.controller.C("Unable to restore disk '"+this.oa+": "+c);return b};
cf.prototype.toJSON=function(){var a;a=0;for(var b;b=kf(this,a++);)mf(b);a=JSON.stringify(this.a,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function mf(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function Eb(a){y.call(this,"RL11",a,Eb);this.c=a.autoMount||null;this.g=0;this.b=Array(1);this.h=!Ba("Mobi")&&window&&"FileReader"in window}A(Eb);h=Eb.prototype;
h.V=function(a,b,c){var d=this;switch(b){case "listDisks":return this.m[b]=c,c.onchange=function(){var a=d.m.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){r("RL11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.m[b]=c,c.onchange=function(){var a=ja(c.value);null!=a&&nf(d,a)},!0;case "loadDrive":return this.m[b]=
c,c.onclick=function(){var a=d.m.listDisks;a&&of(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.h){c.parentNode.removeChild(c);break}this.m[b]=c;c.onclick=function(){var a=d.m.listDrives;if(a&&a.options&&d.b)if(a=d.b[ja(a.value)||0])if(a=a.ab){var b;b="";for(var c=0,k;k=kf(a,c++);)for(var m=0,p=k.length;m<p;m++)b+=String.fromCharCode(lf(k,m));b=btoa(b);a=a.Qb.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),"string"!=
typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");r(a)}else d.C("No disk loaded in drive.");else d.C("No disk drive selected.")};return!0;case "mountDrive":if(this.h)return this.m[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),
c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;of(d,n(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
h.ba=function(a,b,c,d){this.i=a;this.l=b;this.a=c;this.D=d;if((this.c=Vb(this.i,"autoMount")||this.c)&&"string"==typeof this.c)try{this.c=eval("("+this.c+")")}catch(e){r("RL11 auto-mount error: "+e.message+" ("+this.c+")"),this.c=null}pf(this);this.G=zb(112,5);tb(b,this,qf);rf(this,"None","",!0);this.h&&rf(this,"Local Disk","?");rf(this,"Remote Disk","??");sf(this)||G(this)};
h.ea=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.i.Eb){for(a=0;a<this.b.length;a++)tf(this,a,!0);sf(this,!0)}}else if(!this.restore(a))return!1;if(a=this.m.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;1>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";nf(this,0)}}return!0};h.da=function(a){return a?this.save():!0};h.reset=function(){pf(this)};h.save=function(){return(new P(this)).data()};
h.restore=function(){return!0};function pf(a){for(var b=0;b<a.b.length;b++){var c=a.b[b];void 0===c&&(c=a.b[b]={});var d=a;c.qb=b;c.lb=c.cb=!1;c.name=d.Aa;c.fa=512;c.ca=2;c.Y=40;c.ma=256;c.mb=!0;c.Ed=0;c.Dd=0;c.Cd=0;c.Bb=1;c.Wb=c.Y;c.Kb=c.ma;c.Jd=0;c.Kd=null;c.ab||(c.za="")}}
function sf(a,b){b||(a.g=0);if(a.c)for(var c in a.c){var d=a.c[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.m.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var k=f.options[g];if(k.value==e){f=k.text;break a}}f=n(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.b.length)){!uf(a,g,f,e,!0)&&b&&G(a,!1);continue}a.C("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.g}
function of(a,b,c,d){var e=a.m.listDrives,e=e&&ja(e.value);if(void 0===e||0>e||e>=a.b.length)a.C("Unable to load the selected drive");else if(c)if("?"==c)a.C('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=n(c);a.status("Attempting to load "+c+' as "'+b+'"')}uf(a,e,b,c,!1,d)}else tf(a,e)}
function uf(a,b,c,d,e,f){var g=-1,k=a.b[b];k.za.toLowerCase()!=d.toLowerCase()&&(g++,tf(a,b,!0),k.lb?a.C("RL11 busy"):(k.lb=!0,e&&(k.kb=!0,a.g++),k.cb=!!f,gf(new cf(a,k,"preload"),c,d,f,a.Xb)&&g++));return g}
h.Xb=function(a,b,c,d,e){var f;a.lb=!1;b&&(f=b.a.length?[b.a.length,b.a[0].length,b.a[0][0].length,b.a[0][0][0].length]:[0,0,0,0],b&&f[0]>a.fa||f[1]>a.ca)&&(this.C('Disk "'+c+'" too large for drive '+("RL"+a.qb)),b=null);b?(a.ab=b,a.oa=c,a.za=d,this.C('Mounted disk "'+c+'" in drive '+("RL"+a.qb),a.kb||e),this.i&&dc(this.i)):a.cb=!1;a.kb&&(a.kb=!1,--this.g||G(this));nf(this,a.qb)};
function rf(a,b,c,d){if((a=a.m.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function nf(a,b){if(0<=b&&b<a.b.length){var c=a.b[b],d=a.m.listDisks;a=a.m.listDrives;if(d&&a&&d.options&&a.options&&(a=ja(a.value),c=c.cb?"?":c.za,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function tf(a,b,c){var d=a.b[b];if(d.ab||!1===c)d.oa="",d.za="",d.ab=null,d.cb=!1,c||(a.C("Drive RL"+b+" unloaded",c),nf(a,b))}var qf={};
function vf(a,b,c){y.call(this,"Computer",a,vf);this.j.O=!1;wf(this,b);this.B=Vb(this,"autoPower",a);this.i=0;this.M=a.busWidth||a.buswidth;this.b=xf;this.v=null;this.o=this.I=!1;this.N=Vb(this,"url")||"";(Math.random()+.1).toString(36);this.c=yf(this);if(this.a=Sa("CPU",this.id)){this.D=Sa("Debugger",this.id);this.l=new $a({id:this.ia+".bus",busWidth:this.M},this.a,this.D);var d,e=B(this.id);if((this.g=Sa("Panel",this.id))&&this.g.Na)for(b=0;b<e.length;b++)d=e[b],d.C=this.g.C,d.R=this.g.R,d.Na=this.g.Na;
this.R("PDPjs v1.30.2\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.R("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.ba&&d.ba(this,this.l,this.a,this.D);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.u=d:this.b=parseInt(d,10));var f;if(a=Vb(this,"state")||(f=!0,a.state))b=this.F=a,f||(this.o=!0,this.b=xf),this.b&&(this.w=new P(this,
"1.30.2"),zf(this.w)?b=null:delete this.w);!b&&this.b&&(b=Af(this))&&(this.o=!0);if(b){var g=this;q(b,null,!0,function(a,b,c){c?(g.u=null,g.o=!1,g.C("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.v=b,g.I=!0);G(g)})}else G(this);this.m.power||(this.B=!0);!c&&this.B&&Bf(this,this.Pa)}else r("Unable to find CPU component")}A(vf);var xf=0;
function wf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){r(d.message+" ("+c+")")}}a.K=b}function Vb(a,b,c){var d=b.toLowerCase(),d=Ka[b]||Ka[d];void 0===d&&a.K&&(d=a.K[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Bf(a,b,c){for(var d=B(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ta(f)){Ta(f,function(){Bf(a,b,c)});return}}b.call(a,c)}
function Cf(a,b){var c=new P(a,"1.30.2","validate");if(zf(c)&&Df(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.C("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=vf.prototype;
h.Pa=function(a){void 0===a&&(a=this.b||(this.v?1:xf));if(!this.i){this.i++;var b=!1,c=!1;this.G=!1;var d=this.w||new P(this,"1.30.2");if(-1==a)b=!0;else if(a>xf){if(zf(d,this.v)){this.h=new P(this,"1.30.2","failsafe");zf(this.h)&&(Ef(this,d),a=2,Ff(this.h));this.h.set("timestamp",sa());Gf(this.h);var e=this.b&&!this.o;if(1==a||wa("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Df(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?zf(d,g):("error"==
f&&"no machine state"!=g?(this.C("Error: "+g),"unable to verify user"==g&&(Aa("user",""),this.c=null)):this.R(f+": "+g),Ff(d),zf(d)?(c=Df(d),e=!0):c=!1))}e&&Cf(this,c?d:null)}else 2==a&&d.clear()}else Cf(this);delete this.v;delete this.w}e=B(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=Hf(this,g,d,b,c));b=[d,a,c];-1!=a?Bf(this,this.Db,b):this.Db(b)}};
function Hf(a,b,c,d,e){if(!b.j.O){b.j.O=!0;if(b.ea){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ea(f,d)&&f&&(r("Unable to restore state for "+b.type),a.F&&!a.I?(c.clear(),a.b=xf,window&&window.location.reload()):a.G=!0,b.ea(null),e=!1)}if(!d&&b.Ib)for(a=b.Ib.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Db=function(a){var b=a[0],c=0>a[1];a=a[2];this.P=!0;this.j.O=!0;var d=this.m.power;d&&(d.textContent="Shutdown");this.a&&(Hf(this,this.a,b,c,a),this.a.Ma());this.G&&(Ef(this,b),b.clear());!c&&this.h&&(this.h.clear(),delete this.h);this.i=0};
function Ef(a,b){if(wa("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.c||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.2"};d.url=a.N;d.user=c;d.type="bug";d.data=b;q("http://www.pcjs.org/api/v1/report",d,!0)}}
function Kf(a,b,c){var d,e="none";if(a.i)return null;a.i--;var f=new P(a,"1.30.2"),g=new P(a,"1.30.2","validate"),k=sa();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.2");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.da&&(c&&H(a.a),d=a.a.da(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.j.O=!1,!1===d&&(e=null)));for(var k=B(a.id),m=0;m<k.length;m++){var p=k[m];p.j.O&&(p.da&&(d=p.da(b,c),"object"===typeof d&&f.set(p.id,
d)),c&&(p.j.O=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.c&&Lf(a,a.c,f.toString()),Gf(g)&&Gf(f)||(e=null,d=k=!0)):a.b&&(d=!0,k=3==a.b),d&&f.clear(k)):e=f.toString());c&&(a.j.O=!1,b=a.m.power)&&(b.textContent="Power");a.i=0;return e}h.reset=function(){this.l&&this.l.reset&&this.l.reset();for(var a=B(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.l&&c.reset&&c.reset()}};h.start=function(a,b){for(var c=B(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.ha(!0)};
h.stop=function(a,b){for(var c=B(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.ha(!0)};
h.V=function(a,b,c){var d=this;switch(b){case "power":return this.m[b]=c,c.onclick=function(){d.i||(d.j.O?Kf(d,!1,!0):Bf(d,d.Pa))},!0;case "reset":return this.m[b]=c,c.onclick=function(){if(d.j.O&&!d.i)if(d.b&&!d.u){var a=wa("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Kf(d,a,!0);!a&&d.F?window&&window.location.reload():(a||(d.Eb=!0),d.Pa(xf),d.Eb=!1)}else d.reset(),d.a&&d.a.Ma()},!0;case "save":if(ma(u(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.m[b]=c,c.onclick=function(){var a=yf(d,!0);if(a){var b=!!(d.b&&!d.u||d.F),c=Kf(d,b);b?Lf(d,a,c):d.C("Resume disabled, machine state not saved")}},!0}return!1};
function yf(a,b){var c=a.c;c||((c=za("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Mf(a,c))||a.C("The user ID is invalid.")):b&&a.C("Browser local storage is not available"));return c}
function Mf(a,b){a.c=null;b=q(u()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Aa("user",b.data),a.c=b.data)}catch(d){r(d.message+" ("+c+")")}return a.c}function Af(a){var b=null;a.c&&(b=u()+"/api/v1/user?req=load&user="+a.c+"&state="+Nf(a,"1.30.2"));return b}
function Lf(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Nf(a,"1.30.2");d.data=c;b=q(u()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.C("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.C(c),Aa("user",""),a.c=null)}}
function Se(a){var b;a=B(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}function dc(a){if(a.Na){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Na.focus();window&&window.scrollTo(b,c)}}h.ha=function(a){this.a&&this.a.ha(a);this.g&&this.g.ha(a)};
x(function(){for(var a=E(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=C(c),c=E(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=C(f),g=new vf(g,d,!0);D(g,f);g.B&&Bf(g,g.Pa)}});v.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Sa("Computer",c.id))&&c.P&&!c.j.O&&c.Pa(-1)}});v.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Sa("Computer",c.id))&&c.j.O&&Kf(c,!(!c.b||c.u),!0)}});
function P(a,b,c){this.id=a.id;this.key=Nf(a,b,c);this.D=a.D;Ff(this,a.bc)}function Nf(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
P.prototype={constructor:P,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Ff(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function Ff(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function Gf(a){var b=!0;if(ya()){var c=JSON.stringify(a[a.id]);Aa(a.key,c)||(r("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Df(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){r(c.message||c),b=!1}return b}function zf(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:ya()&&(b=za(a.key))?(a[a.id]=b,a.a=!0):!1}var Of=0;
function Pf(a,b,c,d,e,f){e("Loading "+a+"...");q(a,null,!0,function(g,k,m){m?(k||(k="unable to load "+a+" ("+m+")"),f(k,null)):Qf(k,a,b,c,d,e,f)})}
function Qf(a,b,c,d,e,f,g){function k(a,f){if(f)g(f,null);else{c&&(Qa(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(t){f=null,a=t.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Rf(a,f,k):k(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Rf(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");q(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=k[0],p,t=/( [a-z]+=)(['"])(.*?)\2/g;p=t.exec(f);)m=0>m.indexOf(p[1])?m.replace(">",p[0]+">"):m.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);k[0]!=m&&(g=g.replace(k[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);Rf(a,b,c)}})}else c(a,null)}
function Sf(a,b,c,d){function e(a){if(void 0===k){var b=g&&E(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=oa(a))}function f(a){e("Error: "+a);m&&(--Of||Ha(!0));m=!1}var g,k,m=!0;Of++;Pa[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var t=document.head||document.getElementsByTagName("head")[0],w=document.createElement("style");w.type="text/css";w.styleSheet?w.styleSheet.cssText=p:w.appendChild(document.createTextNode(p));t.appendChild(w)}c||
(c="/versions/pdpjs/1.30.2/components.xsl");p=function(d,k){k?Pf(c,null,null,!1,e,function(d,m){m?(Qa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=k.transformNode(m))?(g.outerHTML=m,--Of||Ha(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Of||Ha(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Pf(b,a,d,!0,e,p):Qf(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(F){f(F.message)}return m}window.embedPDP11=function(a,b,c,d){Ha(!1);return Sf(a,b,c,d)};window.enableEvents=Ha;window.sendEvent=Ia;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11.map
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});var Va="undefined"!==typeof ArrayBuffer;function Wa(a){x.call(this,"Panel",a,Wa);this.b=0;this.l.Fb=!0}A(Wa);h=Wa.prototype;
h.Z=function(a,b,c,d){if(this.j&&this.j.Z(a,b,c,d)||this.a&&this.a.Z(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.o[b]=c,this.b++,!0;default:return"rled"==a?(this.o[b]=c,this.b++,!0):this.parent.Z.call(this,a,b,c,d)}};h.ha=function(a,b,c,d){this.j=a;this.h=b;this.a=c;this.F=d};h.ja=function(a,b){b||Xa();return!0};h.ia=function(){return!0};
function Ya(a,b,c,d){if(a.o[b]){void 0===c&&(a.l.error=!0,a.C("Value for "+b+" is invalid"),G(a.a));var e=a.F&&a.F.h||8;c=!a.a.l.da||a.l.Fb?8==e?ka(c,d):k(c,d):"--------".substr(0,d||4);a.o[b].textContent!=c&&(a.o[b].textContent=c)}}function Za(a,b,c,d){for(var e=0;e<d;e++){var f=a.o[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
h.ma=function(a){if(this.b&&(a||!this.a.l.da||this.l.Fb)){for(a=0;a<this.a.g.length;a++)Ya(this,"R"+a,this.a.g[a]);a=$a(this.a);Ya(this,"PS",a);Ya(this,"NF",a&8?1:0,1);Ya(this,"ZF",a&4?1:0,1);Ya(this,"VF",a&2?1:0,1);Ya(this,"CF",a&1?1:0,1);Za(this,"D",this.a.g[0],16);Za(this,"A",this.a.g[7],22)}};function Xa(){for(var a=!1,b=E(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=C(d),f=Sa(e.id);f||(a=!0,f=new Wa(e));D(f,d);a&&F(f)}}Ga(Xa);
function ab(a,b,c){x.call(this,"Bus",a,ab);this.a=b;this.F=c;this.K=a.busWidth||16;this.s=0;this.J=[];this.A=null;this.D=Math.pow(2,this.K);this.i=this.D-1|0;this.b=H;this.c=Math.log2(this.b);this.G=this.b>>2;this.j=this.b-1;this.w=this.D/this.b|0;this.xa=[];this.f=0;this.m=!1;this.v=[];this.ac=[bb,cb,db,eb];a=new I(this);fb(a,this.F);this.h=Array(this.w);for(b=0;b<this.w;b++)this.h[b]=a;F(this)}A(ab);var H=8192,gb=H-1;
function bb(a,b){var c=-1,d=this.controller,e=d.xa[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.xa[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);return 0<=c?c:c=hb(d,b)}function cb(a,b,c){var d=!1,e=this.controller,f=e.xa[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.xa[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d||hb(e,c)}
function db(a,b){var c=-1,d=this.controller;(a=d.xa[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));return 0<=c?c:c=hb(d,b)}function eb(a,b,c){var d=!1,e=this.controller;if(a=e.xa[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d||hb(e,c)}function ib(a,b){if(b!=a.s){var c;a.s&&(c=(1<<a.s)-H,jb(a,c,H,a.J),a.s=0);b&&(a.s=b,c=(1<<b)-H,a.J=kb(a,c,H),a.A?jb(a,c,H,a.A):(lb(a,c,H,mb,a),a.A=kb(a,c,H)))}}h=ab.prototype;
h.reset=function(){for(var a=0;a<this.v.length;a++)this.v[a]();ib(this,16)};function hb(a,b){a.f||(a.a.I|=16,J(a.a,4,b));return 0}h.ja=function(a,b){b||this.reset();return!0};
function lb(a,b,c,d,e){for(var f=b,g=c,l=f>>>a.c;0<g&&l<a.h.length;){var m=a.h[l],p=l*a.b,q=a.b-(f-p);q>g&&(q=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.Ha)return m.jb+=m.Ha-f,m.Ha=f,!0;if(f>=m.Ha+m.jb){q=m.size-(f-p);q>g&&(q=g);m.jb=f-m.Ha+q;f=p+a.b;g-=q;l++;continue}}return nb(1,f,g)}f=new I(a,f,q,a.b,d,e);fb(f,a.F,m);a.h[l++]=f;f=p+a.b;g-=q}if(0>=g){c/=1024;var u;e="";u?10<u&&(u=10):u=c&-65536?10:5;if(null==c||isNaN(c))for(;0<u--;)e="?"+e;else for(;0<u--;)e=String.fromCharCode(c%10+48)+e,c/=
10;a.status(e+"Kb "+ob[d]+" at "+ka(b));return!0}return nb(2,b,c)}function kb(a,b,c){var d=[];for(b>>>=a.c;0<c&&b<a.h.length;)d.push(a.h[b++]),c-=a.b;return d}function jb(a,b,c,d){var e=0;for(b>>>=a.c;0<c&&b<a.h.length;){var f=d[e++];if(!f)break;a.h[b++]=f;c-=a.b}}function pb(a,b){return a.h[(b&a.i)>>>a.c].vb(b&a.j,b)}function qb(a,b){return a.h[(b&a.i)>>>a.c].V(b&a.j,b)}h.qb=function(a){var b=a&this.j,c=(a&this.i)>>>this.c;this.m=!1;this.f++;a=this.h[c].Rb(b,a);this.f--;return a};
h.Va=function(a,b){this.m=!1;this.f++;this.h[(a&this.i)>>>this.c].Db(a&this.j,b&255,a);this.f--};function rb(a,b,c){a.h[(b&a.i)>>>a.c].kb(b&a.j,c&65535,b)}h.zb=function(a,b){var c=a&this.j,d=(a&this.i)>>>this.c;this.m=!1;this.f++;this.h[d].Zb(c,b&65535,a);this.f--};
function sb(a){for(var b=0,c=[],d=0;d<a.w;d++){var e=a.h[d];if(e.sa||e.fc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,l=0,m=[];g<e.length;){for(var p=e[g],q=g+1;q<e.length&&e[q]===p;)q++;m[l++]=q-g;m[l++]=p;g=q}m.length<e.length&&(e=m)}c[f]=e}}return c}function tb(a,b,c,d,e,f,g,l){for(;b<=c;b+=2){var m=b&gb;void 0!==a.xa[m]?t("I/O address already registered: "+k(b,8,!0)):a.xa[m]=[d,e,f,g,l||"unknown",!1]}}
function ub(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.a.Za)){var g=f[0]?f[0].bind(b):null,l=f[1]?f[1].bind(b):null,m=f[2]?f[2].bind(b):null,p=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&m&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!l&&p&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));tb(a,e,e,g,l,m,p,f[4])}}}function vb(a,b){a.v.push(b)}function wb(a,b){a.f||J(a.a,4,b);a.m=!0}function xb(a){var b=a.m;a.m=!1;return b}
function nb(a,b,c){t("Memory block error ("+a+": "+k(b)+","+k(c)+")");return!1}function K(a){x.call(this,"Device",a,K);this.c={data:0,Td:0,ib:20,bd:0};this.b={M:0,Bb:-1}}A(K);h=K.prototype;h.ha=function(a,b,c,d){this.h=b;this.a=c;this.F=d;var e=this;this.b.Bb=yb(c,function(){e.b.za|=128;e.b.za&64&&(zb(e.a,e.b.cd),Ab(e.a,e.b.Bb,1E3/60))});this.b.cd=Bb(64,6);ub(b,this,L);vb(b,this.reset.bind(this));F(this)};h.reset=function(){this.c.ib=this.c.ib&-120|20;this.b.za=0};
h.tc=function(){var a=this.b.za;this.b.za&=-129;return a};h.nd=function(a){this.b.za=a;a&64&&Ab(this.a,this.b.Bb,1E3/60);this.b.za=a&-129};h.lc=function(a){return(a?this.c.bd:this.c.data)&65535};h.ed=function(a){this.c.data=a};h.vc=function(){var a=this.a;return a.w&62337|a.Xa<<5|a.Ya<<1};h.pd=function(a){var b=this.a;a&=62337;if(b.w!=a){b.w=a;b.Xa=a>>5&3;b.Ya=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ea!=c&&(b.Ea=c,Cb(b))}Db(this)};
h.wc=function(){var a=this.a.Aa;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.xc=function(){return this.a.xb};h.yc=function(){return this.a.Ba};h.qd=function(a){var b=this.a;1170>b.Za&&(a&=-49);b.Ba!=a&&(b.Ba=a,a&16?(b.tb=4194303,b.Wa=3915776):(b.tb=262143,b.Wa=253952),Cb(b));Db(this)};function Db(a){a.c.ib=a.c.ib&-8|(a.a.Ea?a.a.Ba&16?1:2:4)}h.Rc=function(a){return this.a.H[1][a>>1&7]};h.Jd=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.Pc=function(a){return this.a.H[1][(a>>1&7)+8]};
h.Hd=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};h.Qc=function(a){return this.a.X[1][a>>1&7]};h.Id=function(a,b){b=b>>1&7;this.a.X[1][b]=a;this.a.H[1][b]&=65295};h.Oc=function(a){return this.a.X[1][(a>>1&7)+8]};h.Gd=function(a,b){b=(b>>1&7)+8;this.a.X[1][b]=a;this.a.H[1][b]&=65295};h.sc=function(a){return this.a.H[0][a>>1&7]};h.md=function(a,b){this.a.H[0][b>>1&7]=a&65295};h.qc=function(a){return this.a.H[0][(a>>1&7)+8]};h.kd=function(a,b){this.a.H[0][(b>>1&7)+8]=a&65295};
h.rc=function(a){return this.a.X[0][a>>1&7]};h.ld=function(a,b){b=b>>1&7;this.a.X[0][b]=a;this.a.H[0][b]&=65295};h.pc=function(a){return this.a.X[0][(a>>1&7)+8]};h.jd=function(a,b){b=(b>>1&7)+8;this.a.X[0][b]=a;this.a.H[0][b]&=65295};h.Xc=function(a){return this.a.H[3][a>>1&7]};h.Pd=function(a,b){this.a.H[3][b>>1&7]=a&65295};h.Vc=function(a){return this.a.H[3][(a>>1&7)+8]};h.Nd=function(a,b){this.a.H[3][(b>>1&7)+8]=a&65295};h.Wc=function(a){return this.a.X[3][a>>1&7]};
h.Od=function(a,b){b=b>>1&7;this.a.X[3][b]=a;this.a.H[3][b]&=65295};h.Uc=function(a){return this.a.X[3][(a>>1&7)+8]};h.Md=function(a,b){b=(b>>1&7)+8;this.a.X[3][b]=a;this.a.H[3][b]&=65295};h.Ja=function(a){a&=7;return this.a.B&2048?this.a.Fa[a]:this.a.g[a]};h.La=function(a,b){b&=7;this.a.B&2048?this.a.Fa[b]=a:this.a.g[b]=a};h.Dc=function(){return this.a.B&49152?this.a.la[0]:this.a.g[6]};h.vd=function(a){this.a.B&49152?this.a.la[0]=a:this.a.g[6]=a};h.Gc=function(){return this.a.g[7]};
h.yd=function(a){this.a.g[7]=a};h.Ka=function(a){a&=7;return this.a.B&2048?this.a.g[a]:this.a.Fa[a]};h.Ma=function(a,b){b&=7;this.a.B&2048?this.a.g[b]=a:this.a.Fa[b]=a};h.Ec=function(){return 1==(this.a.B&49152)>>14?this.a.g[6]:this.a.la[1]};h.wd=function(a){1==(this.a.B&49152)>>14?this.a.g[6]=a:this.a.la[1]=a};h.Fc=function(){return 3==(this.a.B&49152)>>14?this.a.g[6]:this.a.la[3]};h.xd=function(a){3==(this.a.B&49152)>>14?this.a.g[6]=a:this.a.la[3]=a};h.nc=function(a){return this.a.Ub[a-65504>>1]};
h.gd=function(a,b){this.a.Ub[b-65504>>1]=a};h.Qb=function(a){return 65520==a?61183:0};h.Yb=function(){};h.Tc=function(){return 1};h.Ld=function(){};h.mc=function(){return this.a.I};h.fd=function(){this.a.I=0};h.uc=function(){return this.a.Tb};h.od=function(a,b){b&1||(a&=255);this.a.Tb=a};h.zc=function(a){return a?this.a.yb:0};h.rd=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.yb=a;b.u|=2};h.Sc=function(a){return a?this.a.Ca&65280:0};h.Kd=function(a){this.a.Ca=a|255};
h.Cc=function(){return $a(this.a)};h.ud=function(a){Eb(this.a,a&-1809|$a(this.a)&1808);this.a.u|=128};h.Xb=function(){};
var M={},L=(M[62592]=[null,null,K.prototype.Rc,K.prototype.Jd,"SISDR",1145],M[62608]=[null,null,K.prototype.Pc,K.prototype.Hd,"SDSDR",1145],M[62624]=[null,null,K.prototype.Qc,K.prototype.Id,"SISAR",1145],M[62640]=[null,null,K.prototype.Oc,K.prototype.Gd,"SDSAR",1145],M[62656]=[null,null,K.prototype.sc,K.prototype.md,"KISDR",1145],M[62672]=[null,null,K.prototype.qc,K.prototype.kd,"KDSDR",1145],M[62688]=[null,null,K.prototype.rc,K.prototype.ld,"KISAR",1145],M[62704]=[null,null,K.prototype.pc,K.prototype.jd,
"KDSAR",1145],M[62798]=[null,null,K.prototype.yc,K.prototype.qd,"MMR3",1145],M[65382]=[null,null,K.prototype.tc,K.prototype.nd,"LKS"],M[65400]=[null,null,K.prototype.lc,K.prototype.ed,"CNSL"],M[65402]=[null,null,K.prototype.vc,K.prototype.pd,"MMR0",1145],M[65404]=[null,null,K.prototype.wc,K.prototype.Xb,"MMR1",1145],M[65406]=[null,null,K.prototype.xc,K.prototype.Xb,"MMR2",1145],M[65408]=[null,null,K.prototype.Xc,K.prototype.Pd,"UISDR",1145],M[65424]=[null,null,K.prototype.Vc,K.prototype.Nd,"UDSDR",
1145],M[65440]=[null,null,K.prototype.Wc,K.prototype.Od,"UISAR",1145],M[65456]=[null,null,K.prototype.Uc,K.prototype.Md,"UDSAR",1145],M[65472]=[null,null,K.prototype.Ja,K.prototype.La,"R0SET0"],M[65473]=[null,null,K.prototype.Ja,K.prototype.La,"R1SET0"],M[65474]=[null,null,K.prototype.Ja,K.prototype.La,"R2SET0"],M[65475]=[null,null,K.prototype.Ja,K.prototype.La,"R3SET0"],M[65476]=[null,null,K.prototype.Ja,K.prototype.La,"R4SET0"],M[65477]=[null,null,K.prototype.Ja,K.prototype.La,"R5SET0"],M[65478]=
[null,null,K.prototype.Dc,K.prototype.vd,"R6KERNEL"],M[65479]=[null,null,K.prototype.Gc,K.prototype.yd,"R7KERNEL"],M[65480]=[null,null,K.prototype.Ka,K.prototype.Ma,"R0SET1",1145],M[65481]=[null,null,K.prototype.Ka,K.prototype.Ma,"R1SET1",1145],M[65482]=[null,null,K.prototype.Ka,K.prototype.Ma,"R2SET1",1145],M[65483]=[null,null,K.prototype.Ka,K.prototype.Ma,"R3SET1",1145],M[65484]=[null,null,K.prototype.Ka,K.prototype.Ma,"R4SET1",1145],M[65485]=[null,null,K.prototype.Ka,K.prototype.Ma,"R5SET1",1145],
M[65486]=[null,null,K.prototype.Ec,K.prototype.wd,"R6SUPER",1145],M[65487]=[null,null,K.prototype.Fc,K.prototype.xd,"R6USER",1145],M[65504]=[null,null,K.prototype.nc,K.prototype.gd,"CTRL",1170],M[65520]=[null,null,K.prototype.Qb,K.prototype.Yb,"LSIZE",1170],M[65522]=[null,null,K.prototype.Qb,K.prototype.Yb,"HSIZE",1170],M[65524]=[null,null,K.prototype.Tc,K.prototype.Ld,"SYSID",1170],M[65526]=[null,null,K.prototype.mc,K.prototype.fd,"CPUERR",1170],M[65528]=[null,null,K.prototype.uc,K.prototype.od,
"MB",1170],M[65530]=[null,null,K.prototype.zc,K.prototype.rd,"PIR"],M[65532]=[null,null,K.prototype.Sc,K.prototype.Kd,"SL"],M[65534]=[null,null,K.prototype.Cc,K.prototype.ud,"PSW"],M);L[62594]=L[62592];L[62596]=L[62592];L[62598]=L[62592];L[62600]=L[62592];L[62602]=L[62592];L[62604]=L[62592];L[62606]=L[62592];L[62610]=L[62608];L[62612]=L[62608];L[62614]=L[62608];L[62616]=L[62608];L[62618]=L[62608];L[62620]=L[62608];L[62622]=L[62608];L[62626]=L[62624];L[62628]=L[62624];L[62630]=L[62624];L[62632]=L[62624];
L[62634]=L[62624];L[62636]=L[62624];L[62638]=L[62624];L[62642]=L[62640];L[62644]=L[62640];L[62646]=L[62640];L[62648]=L[62640];L[62650]=L[62640];L[62652]=L[62640];L[62654]=L[62640];L[62658]=L[62656];L[62660]=L[62656];L[62662]=L[62656];L[62664]=L[62656];L[62666]=L[62656];L[62668]=L[62656];L[62670]=L[62656];L[62674]=L[62672];L[62676]=L[62672];L[62678]=L[62672];L[62680]=L[62672];L[62682]=L[62672];L[62684]=L[62672];L[62686]=L[62672];L[62690]=L[62688];L[62692]=L[62688];L[62694]=L[62688];L[62696]=L[62688];
L[62698]=L[62688];L[62700]=L[62688];L[62702]=L[62688];L[62706]=L[62704];L[62708]=L[62704];L[62710]=L[62704];L[62712]=L[62704];L[62714]=L[62704];L[62716]=L[62704];L[62718]=L[62704];L[65410]=L[65408];L[65412]=L[65408];L[65414]=L[65408];L[65416]=L[65408];L[65418]=L[65408];L[65420]=L[65408];L[65422]=L[65408];L[65426]=L[65424];L[65428]=L[65424];L[65430]=L[65424];L[65432]=L[65424];L[65434]=L[65424];L[65436]=L[65424];L[65438]=L[65424];L[65442]=L[65440];L[65444]=L[65440];L[65446]=L[65440];L[65448]=L[65440];
L[65450]=L[65440];L[65452]=L[65440];L[65454]=L[65440];L[65458]=L[65456];L[65460]=L[65456];L[65462]=L[65456];L[65464]=L[65456];L[65466]=L[65456];L[65468]=L[65456];L[65470]=L[65456];L[65506]=L[65504];L[65508]=L[65504];L[65510]=L[65504];L[65512]=L[65504];L[65514]=L[65504];L[65516]=L[65504];L[65518]=L[65504];
Ga(function(){for(var a=E(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=C(d);switch(c.type){case "default":c=new K(c);D(c,d);break;case "pc11":c=new Fb(c);D(c,d);break;case "rl11":c=new N(c),D(c,d)}}});var Gb;if(Va){var Hb=new ArrayBuffer(2);(new DataView(Hb)).setUint16(0,256,!0);Gb=256===(new Uint16Array(Hb))[0]}else Gb=!1;var Ib=Gb;
function I(a,b,c,d,e,f){this.h=a;this.id=Jb+=2;this.a=null;this.Ha=b;this.jb=c;this.size=d||0;this.type=e||Kb;this.j=e==Lb;this.controller=null;fb(this);this.sa=this.fc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],Mb(this,f.ac);else if(Va)this.o=new ArrayBuffer(this.size),this.c=new DataView(this.o,0,this.size),this.b=new Uint8Array(this.o,0,this.size),this.s=new Uint16Array(this.o,0,this.size>>1),this.a=new Int32Array(this.o,0,this.size>>2),Mb(this,Ib?Nb:Ob);else{a=this.a=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;Mb(this,Pb)}else Mb(this)}var Kb=0,Lb=2,mb=4,ob=["NONE","RAM","ROM","VID","H/W"],Jb=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Va)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.c.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Va)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.sa=!0}return!1},v:function(a,b){wb(this.h,b);return 255},f:function(a,b,c){wb(this.h,c)},w:function(a,b){return this.vb(a++,b++)|this.vb(a,
b)<<8},A:function(a,b,c){this.Cb(a++,b&255,c++);this.Cb(a,b>>8,c)},N:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},aa:function(a,b){a&1&&wb(this.h,b);b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},qa:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.sa=!0},wa:function(a,b,c){a&1&&wb(this.h,c);c=a>>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<<a)|b<<a:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|b>>8);this.sa=
!0},G:function(a,b){return this.J(a,b)},R:function(a,b){return this.Rb(a,b)},oa:function(a,b,c){this.j?this.f(a,b,c):this.Db(a,b,c)},ua:function(a,b,c){this.j?this.f(a,b,c):this.Zb(a,b,c)},D:function(a){return this.b[a]},K:function(a){return this.b[a]},O:function(a,b){a&1&&wb(this.h,b);return this.c.getUint16(a,!0)},$:function(a,b){a&1&&wb(this.h,b);return this.s[a>>1]},na:function(a,b){this.b[a]=b;this.sa=!0},pa:function(a,b){this.b[a]=b;this.sa=!0},ra:function(a,b,c){a&1&&wb(this.h,c);this.c.setUint16(a,
b,!0);this.sa=!0},va:function(a,b,c){a&1&&wb(this.h,c);this.s[a>>1]=b;this.sa=!0}};function fb(a,b,c){a.F=b;a.i=a.m=0;c&&((a.i=c.i)&&Qb(a,Rb,!1),(a.m=c.m)&&Sb(a,Rb,!1))}function Sb(a,b,c){c&&a.m||(a.Cb=!a.j&&b[1]||a.f,a.kb=!a.j&&b[3]||a.A);if(c||void 0===c)a.Db=b[1]||a.f,a.Zb=b[3]||a.A}function Qb(a,b,c){c&&a.i||(a.vb=b[0]||a.v,a.V=b[2]||a.w);if(c||void 0===c)a.J=b[0]||a.v,a.Rb=b[2]||a.w}function Mb(a,b){b||(b=Tb);Qb(a,b,void 0);Sb(a,b,void 0)}
var Tb=[],Pb=[I.prototype.N,I.prototype.qa,I.prototype.aa,I.prototype.wa],Rb=[I.prototype.G,I.prototype.oa,I.prototype.R,I.prototype.ua];if(Va)var Ob=[I.prototype.D,I.prototype.na,I.prototype.O,I.prototype.ra],Nb=[I.prototype.K,I.prototype.pa,I.prototype.$,I.prototype.va];
function Ub(a,b){x.call(this,"CPU",a,Ub);var c=a.multiplier||1;this.eb=a.cycles||b;this.qa=c;this.rb=Math.round(this.eb/1E4)/100;this.ua=this.rb*this.qa;this.l.da=!1;this.l.Ab=!1;this.l.Sa=a.autoStart;this.l.bb=!1;this.ab=this.wa=0;this.cb=a.csStart;this.Oa=a.csInterval;this.Pa=a.csStop;this.J=[];this.Pb=this.ad.bind(this);F(this)}A(Ub);var Vb=["power","reset"];h=Ub.prototype;
h.ha=function(a,b,c,d){this.j=a;this.h=b;this.F=d;for(b=0;b<Vb.length;b++)(c=this.o[Vb[b]])&&this.j.Z(null,Vb[b],c);a=Wb(a,"autoStart");null!=a&&(this.l.Sa="true"==a?!0:"false"==a?!1:!!a);F(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.ja=function(a,b){if(!b){if(a&&this.restore){Xb(this);if(!this.restore(a))return!1;$b(this)}else this.reset();this.U("No debugger detected")}this.j.ma();return!0};h.ia=function(a){return a?this.save():!0};
h.Sa=function(){return this.l.Sa||void 0===this.o.run?(ac(this),!0):!1};h.Ib=function(){return 0};function $b(a){void 0===a.cb&&(a.cb=0);void 0===a.Oa&&(a.Oa=-1);void 0===a.Pa&&(a.Pa=-1);a.l.bb=0<=a.cb&&0<a.Oa;a.l.bb&&(a.ab=0,a.wa=a.cb-a.N)}
h.Z=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.o[b]=c,!0;case "run":return this.o[b]=c,c.onclick=function(){var a;if(a=d.j)if(a=d.j,a.l.P)a=!0;else{var b=null,c,l=B(a.id);for(c=0;c<l.length&&(b=l[c],b===a||b.l.ready);c++);if(c==l.length)for(c=0;c<l.length&&(b=l[c],b===a||b.l.P);c++);c==l.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.l.ready?"powered yet":"ready yet"+(b.hb?" (waiting for notification)":""))+".");a=!1}a&&(d.l.da?G(d):ac(d))},!0;case "speed":return this.o[b]=
c,!0;case "setSpeed":return this.o[b]=c,c.onclick=function(){bc(d,d.qa<<1,!0)},c.textContent=this.ua.toFixed(2)+"Mhz",!0}return!1};h.ma=function(){var a=this.o.speed;a&&(a.textContent=this.l.da&&this.oa?this.oa.toFixed(2)+"Mhz":"Stopped")};function cc(a,b){var c=1;b&&1<a.qa&&a.oa&&(c=a.oa/a.rb);a.Mb=Math.round(1E3/30);a.gb=Math.floor(a.eb/30*c);b||(a.Qa=a.gb);a.ub=0}function dc(a){return a.N+a.aa+a.va-a.a}function Xb(a){a.oa=0;a.Ob=0;a.N=a.aa=a.va=a.a=a.G=0;$b(a);bc(a,1)}
function bc(a,b,c){if(void 0!==b){.8>a.oa/a.ua&&(b=1);a.qa=b;b=a.rb*a.qa;if(a.ua!=b){a.ua=b;b=a.ua.toFixed(2)+"Mhz";var d=a.o.setSpeed;d&&(d.textContent=b);a.U("target speed: "+b)}c&&a.j&&ec(a.j)}a.N+=a.aa;a.aa=0;a.$=ra();a.pa=0;cc(a)}function yb(a,b){var c=a.J.length;a.J.push([-1,b]);return c}function Ab(a,b,c){0<=b&&b<a.J.length&&0>a.J[b][0]&&(c=a.eb*a.qa/1E3*c|0,a.J[b][0]=c+fc(a))}function fc(a,b){var c=a.va-=a.a;a.a=a.G=0;b&&(a.va=0);return c}
h.ad=function(){if(this.l.da){this.ub>=this.eb&&cc(this,!0);this.Ra=0;this.$a=ra();if(this.pa){var a=this.$a-this.pa;a>this.Mb&&(this.$+=a,this.$>this.$a&&(this.$=this.$a))}try{do{for(var b,c=this.l.bb?1:this.gb,d=this.J.length-1;0<=d;d--){var e=this.J[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.Wb(b)}catch(m){if("number"!=typeof m)throw m;}b=fc(this,!0);this.Ra+=b;this.aa+=b;a=b;if(this.l.bb){var f=!1;this.ab=this.ab+this.Ib()|0;this.wa-=a;0>=this.wa&&(this.wa+=this.Oa,f=!0);0<=this.Pa&&this.Pa<=dc(this)&&
(this.Oa=this.Pa=-1,$b(this),G(this),f=!0);f&&this.U(dc(this)+" cycles: checksum="+k(this.ab))}for(var a=b,g=this.J.length-1;0<=g;g--){var l=this.J[g];0>l[0]||(l[0]-=a,0>=l[0]&&(l[0]=-1,l[1]()))}this.Qa-=b;if(0>=this.Qa){this.Qa+=this.gb;15<=++this.Ob&&(this.j&&this.j.ma(),this.Ob=0);break}}while(this.l.da)}catch(m){G(this);this.j&&this.j.stop(ra(),dc(this));b=m.stack||m.message;this.l.error=!0;this.C(b);return}if(this.l.da){b=setTimeout;c=this.Pb;this.pa=ra();d=this.Mb;this.Ra&&(d=Math.round(d*this.Ra/
this.gb));d-=this.pa-this.$a;if(e=this.pa-this.$)this.oa=Math.round(this.aa/(10*e))/100,864E5<=e&&(this.N=0,bc(this));if(0>d||this.oa<this.ua)-1E3>d&&(this.$-=d),d=0;this.ub+=this.Ra;this.pa+=d;b(c,d)}}};function ac(a){var b;a.l.error?(a.U(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.l.da)a.U(a.toString()+" busy");else{bc(a);a.l.da=!0;a.l.Ab=!0;if(b=a.o.run)b.textContent="Halt";a.j&&a.j.start(a.$,dc(a));setTimeout(a.Pb,0)}}h.Wb=function(){return 0};
function G(a){var b=!1;if(a.l.da){fc(a);a.N+=a.aa;a.aa=0;a.l.da=!1;if(b=a.o.run)b.textContent="Run";a.j&&a.j.stop(ra(),dc(a));b=!0}a.l.complete=void 0;return b}function gc(a){this.Za=+a.model||1170;this.Kb=a.addrReset||0;Ub.call(this,a,6666667);this.decode=1120==this.Za?hc.bind(this):ic.bind(this);jc(this);this.ra=0;this.O=null;this.l.complete=!1}A(gc,Ub);h=gc.prototype;h.reset=function(){this.status("model "+this.Za);this.l.da&&G(this);jc(this);Xb(this);this.l.error=!1;this.parent.reset.call(this)};
function jc(a){a.m=65536;a.f=32768;a.i=65535;a.s=32768;a.B=15;a.g=[0,0,0,0,0,0,0,a.Kb];a.Fa=[0,0,0,0,0,0];a.la=[0,0,0,0];a.v=0;a.Ya=0;a.ic=[4,2,0,1];a.H=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.X=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.kc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.Ub=[0,0,0,0,0,0,0,0];a.Tb=0;a.u=0;a.A=a.D=0;a.c=a.b=a.pb=0;a.Ga=-1;kc(a)}function kc(a){a.Ca=255;a.I=0;a.yb=0;a.w=0;a.Aa=0;a.xb=0;a.Ba=0;a.Ea=0;a.Xa=0;a.tb=262143;a.Wa=253952;a.O=null;a.h&&Cb(a)}function Cb(a){a.Ea?(a.R=65536,a.K=a.hc,a.V=a.Yc,a.kb=a.Qd,ib(a.h,a.Ba&16?22:18)):(a.R=0,a.K=a.gc,a.V=a.Sb,a.kb=a.$b,ib(a.h,16))}function lc(a,b,c){a.Kb=b;O(a,b);!c&&a.F&&(G(a)||a.F.ma())}h.Ib=function(){return 0};
h.save=function(){var a=new P(this);a.set(0,[]);a.set(1,[this.N,this.qa]);a.set(2,sb(this.h));return a.data()};h.restore=function(a){var b=a[1];this.N=b[1];bc(this,b[3]);a:{b=this.h;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.G){for(var f=0,g=Array(b.G),l=0;l<e.length-1;)for(var m=e[l++],p=e[l++];m--;)g[f++]=p;e=g}f=b.h[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Q(a){return a.m&65536?1:0}
h.ya=function(){return this.s&32768?8:0};function mc(a){var b=a.g[7];a.w&57344||(a.Aa=0,a.xb=b);a.g[7]=b+2&65535;return a.V(b)}function nc(a,b){var c=a.g[7];a.g[7]=c+b&65535;return c}function O(a,b){a.g[7]=b&65535}function Bb(a,b){return{dd:a,Ia:b,next:null}}function zb(a,b){if(b!=a.O){var c=a.O;if(!c||c.Ia<=b.Ia)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.Ia<=b.Ia){b.next=d;c.next=b;break}c=d}while(c)}}a.u|=2}function $a(a){return a.B=a.B&63728|a.ya()|(a.i&65535?0:4)|(a.f&32768?2:0)|Q(a)}
function Eb(a,b){a.s=b<<12;a.i=~b&4;a.f=b<<14;a.m=b<<16;if((b^a.B)&2048)for(var c=a.Fa.length;0<=--c;){var d=a.g[c];a.g[c]=a.Fa[c];a.Fa[c]=d}a.v=b>>14&3;c=a.B>>14&3;a.v!=c&&(a.la[c]=a.g[6],a.g[6]=a.la[a.v]);a.B=b;a.u|=2}function R(a,b){a.u&128||(a.s=a.i=b,a.f=0)}function oc(a,b,c){a.u&128||(a.s=a.i=a.m=b,a.f=c||0)}function pc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.f=(c^b)&(d^b))}function qc(a,b){a.u&128||(a.s=a.i=a.m=b,a.f=a.s^a.m>>1)}function rc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.f=(c^d)&(d^b))}
function J(a,b,c){if(!a.ra){var d=!1;0>a.Ga?a.Ga=$a(a):a.v||(b=4,d=!0);a.w&57344||(a.Aa=63222,a.xb=b);a.v=0;var e=a.V(b|a.R),f=a.V(b+2&65535|a.R);Eb(a,f&-12289|a.Ga>>2&12288);d&&(a.I|=4,a.g[6]=4);sc(a,a.Ga);sc(a,a.g[7]);O(a,e);a.u&=-113;a.Ga=-1;a.u|=8;if(26!=c)throw b;}}function tc(a){var b=uc(a),c=uc(a)&-1793;a.B&49152&&(c=c&-225|a.B&63712);O(a,b);Eb(a,c);a.u&=-17}
function vc(a,b){var c=b>>13&31;31>c?a.Ba&32&&(b=a.kc[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b}
function wc(a,b,c){var d,e,f,g=0;d=b>>13;a.Ba&a.ic[a.v]||(d&=7);e=a.H[a.v][d];f=(a.X[a.v][d]<<6)+(b&8191)&a.tb;f<a.Wa?f&1&&!(c&1)&&(a.I|=64,J(a,4,10)):(a.Ba&16||253952<=f&&(f|=4186112),4186112>f&&(3932160<=f&&(f=vc(a,f&262143)),f>=a.Wa&&4186112>f&&(a.I|=32,J(a,4,12))));switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=
16384));a.H[a.v][d]=e;if(4194170!==f||a.v)a.Xa=a.v,a.Ya=d;g&&(g&57344&&(0<=a.Ga&&(g|=128),a.w&57344||(a.w=a.w|g|a.Xa<<5|a.Ya<<1),J(a,168,16)),a.w&61440||!(4191360>f||4194239<f)||(a.w|=4096,a.w&512&&(a.u|=32)));return f}function xc(a,b,c){b&1&&a.a--;a=a.h;a.h[(b&a.i)>>>a.c].Cb(b&a.j,c&255,b)}function uc(a){var b=a.V(a.g[6]|a.R);a.g[6]=a.g[6]+2&65535;return b}
function sc(a,b){var c=a.g[6]-2&65535;a.g[6]=c;a.w&57344||(a.Aa=a.Aa<<8|246);!a.v&&c<=a.Ca&&4<c&&(c<=a.Ca-32?(a.I|=4,a.g[6]=4,J(a,4,18)):(a.I|=8,a.u|=4));a.kb(c,b)}
function yc(a,b,c,d){var e,f,g=d&8?0:a.R;switch(b){case 0:return J(a,4,20),0;case 1:return 6===c&&!a.v&&d&4&&(a.g[6]<=a.Ca||65534<=a.g[6])&&(a.g[6]<=a.Ca-32||65534<=a.g[6]?(a.I|=4,a.g[6]=4,J(a,4,22)):(a.I|=8,a.u|=64)),a.a-=3,7===c?a.g[c]:a.g[c]|g;case 2:f=2;e=a.g[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.g[c];7!==c&&(e|=g);e=a.V(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.g[c]+f&65535;7!==c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.g[c]-2&65535;7!==c&&(e|=g);e=a.V(e)|g;a.a-=
8;break;case 6:return e=a.V(nc(a,2)),e=e+a.g[c]&65535|g,a.a-=6,e;case 7:return e=a.V(nc(a,2)),e=e+a.g[c]&65535,e=a.V(e|a.R)|g,a.a-=10,e}a.g[c]=a.g[c]+f&65535;!g||a.w&57344||(a.Aa=a.Aa<<8|f<<3&248|c);6==c&&!a.v&&d&4&&0>=f&&(a.g[6]<=a.Ca||65534<=a.g[6])&&(a.g[6]<=a.Ca-32?(a.I|=4,a.g[6]=4,J(a,4,24)):(a.I|=8,a.u|=64));return e}h.qb=function(a){if(!this.Ea)return this.h.qb(a);this.ra++;a=this.Sb(wc(this,a,2));this.ra--;return a};
h.Va=function(a,b){this.Ea?(this.ra++,xc(this,wc(this,a,5),b),this.ra--):this.h.Va(a,b)};h.zb=function(a,b){this.Ea?(this.ra++,this.$b(wc(this,a,4),b),this.ra--):this.h.zb(a,b)};h.gc=function(a,b,c){return yc(this,a,b,c)};h.hc=function(a,b,c){return wc(this,yc(this,a,b,c),c)};h.Sb=function(a){return qb(this.h,a)};h.Yc=function(a){return qb(this.h,wc(this,a,2))};h.$b=function(a,b){rb(this.h,a,b&65535)};h.Qd=function(a,b){rb(this.h,wc(this,a,4),b)};
function zc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=yc(a,b,d,2),c&65536||61440!==(a.B&61440)&&(d&=65535),a.v=a.B>>12&3,c=a.V(d|c&a.R),a.v=a.B>>14&3):c=6!=d||(a.B>>2&12288)===(a.B&12288)?a.g[d]:a.la[a.B>>12&3];return c}function Ac(a,b,c,d){a.w&57344||(a.Aa=22);var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=yc(a,b,e,4),c&65536||(e&=65535),a.v=a.B>>12&3,e=wc(a,e|c&65536,4),a.v=a.B>>14&3,rb(a.h,e,d)):6!=e||(a.B>>2&12288)===(a.B&12288)?a.g[e]=d:a.la[a.B>>12&3]=d}
function Bc(a,b){b>>=6;var c=a.D=b&7;(b=a.A=(b&56)>>3)?(c=a.K(b,c,3),a=pb(a.h,c)):a=a.g[c]&255;return a}function Cc(a,b){b>>=6;var c=a.D=b&7;return(b=a.A=(b&56)>>3)?qb(a.h,a.K(b,c,2)):a.g[c]}function Dc(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return yc(a,b,c,8)}function Ec(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.K(b,c,3),a=pb(a.h,c)):a=a.g[c]&255;return a}function Fc(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?qb(a.h,a.K(b,c,2)):a.g[c]}
function T(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.pb=a.K(b,e,7),xc(a,e,d.call(a,c,pb(a.h,e)))):a.g[e]=a.g[e]&65280|d.call(a,c,a.g[e])}function U(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.K(b,e,6),rb(a.h,e,d.call(a,c,qb(a.h,e)))):a.g[e]=d.call(a,c,a.g[e])}function Gc(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?xc(a,a.K(b,e,5),c):a.g[e]=c?d&1?c<<24>>24&65535:a.g[e]&-256|c&255:a.g[e]&-256;return c}
function Hc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?rb(a.h,a.K(b,d,4),c):a.g[d]=c&65535;return c}function V(a,b,c){c&&(O(a,a.g[7]+(b<<24>>23)),a.a-=2);a.a-=3}
h.Wb=function(a){this.l.complete=!0;var b=a?this.l.Ab?0:1:-1;this.l.Ab=!1;this.va=this.a=a;do{if(this.u){this.u&112&&(this.u&32?J(this,168,28):this.u&64?J(this,4,30):this.u&16&&J(this,12,32),this.u&=-113);if(a=this.u&7){a=!1;if(this.u&2){this.u&=-3;var c=160,d=(this.yb&224)>>5,e=this.O&&this.O.Ia>d?this.O:null;e&&(c=e.dd,d=e.Ia);d>(this.B&224)>>5?(this.u&4&&(nc(this,2),this.u&=-5),J(this,c,26),d=!0):d=!1;if(d){if(e)if(a=e,e=this.O,e==a)this.O=a.next;else for(;e;){d=e.next;if(d==a){e.next=d.next;break}e=
d}a=!0}}else this.u&1&&this.u++;a=a&&0>b}if(a)break}this.u=this.u&7|this.B&16;this.decode(mc(this))}while(0<this.a);return this.l.complete?this.va-this.a:void 0===this.l.complete?0:-1};Ga(function(){for(var a=E(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new gc(d);D(d,c)}});function Ic(a,b){var c=b+a;pc(this,c,a,b);return c&65535}function Jc(a,b){var c=b+a;pc(this,c<<8,a<<8,b<<8);return c&255}function Kc(a,b){a=b<<1;qc(this,a);return a&65535}
function Lc(a,b){a=b<<1;qc(this,a<<8);return a&255}function Mc(a,b){a=b&32768|b>>1|b<<16;qc(this,a);return a&65535}function Nc(a,b){a=b&2048|b>>1|b<<8;qc(this,a<<8);return a&255}function Oc(a,b){a=b&~a;R(this,a);return a}function Pc(a,b){a=b&~a;R(this,a<<8);return a}function Qc(a,b){a|=b;R(this,a);return a}function Rc(a,b){a|=b;R(this,a<<8);return a}function Sc(a,b){a=~b|65536;oc(this,a);return a&65535}function Tc(a,b){a=~b|256;oc(this,a<<8);return a&255}
function Uc(a,b){a=b-a;this.u&128||(this.s=this.i=a,this.f=b&(b^a));return a&65535}function Vc(a,b){a=b-a;var c=a<<8;b<<=8;this.u&128||(this.s=this.i=c,this.f=b&(b^c));return a&255}function Wc(a,b){a=b+a;this.u&128||(this.s=this.i=a,this.f=a&(b^a));return a&65535}function Xc(a,b){a=b+a;var c=a<<8;this.u&128||(this.s=this.i=c,this.f=c&(b<<8^c));return a&255}function Yc(a,b){a=-b;oc(this,a,a&b&32768);return a&65535}function Zc(a,b){a=-b;oc(this,a<<8,(a&b&128)<<8);return a&255}
function $c(a,b){a=b<<1|this.m>>16&1;qc(this,a);return a&65535}function ad(a,b){a=b<<1|this.m>>16&1;qc(this,a<<8);return a&255}function bd(a,b){a=(this.m&65536|b)>>1|b<<16;qc(this,a);return a&65535}function cd(a,b){a=((this.m&65536)>>8|b)>>1|b<<8;qc(this,a<<8);return a&255}function dd(a,b){var c=b-a;rc(this,c,a,b);return c&65535}function ed(a,b){var c=b-a;rc(this,c<<8,a<<8,b<<8);return c&255}function fd(a,b){this.u&128||(this.s=this.i=b&65280,this.f=this.m=0);return(b<<8|b>>8)&65535}
function gd(a,b){a^=b;R(this,a);return a&65535}function hd(a){U(this,a,Cc(this,a),Ic);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function id(a){var b=Fc(this,a);a=a>>6&7;var c=this.g[a];c&32768&&(c|=4294901760);this.m=this.f=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.m=c<<17-b,c>>=b;else if(b)if(16<b)this.f=c,c=0;else{this.m=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.f=32768)}this.g[a]=c&65535;this.s=this.i=c;this.a-=(this.c?6:7)+b}
function jd(a){var b=Fc(this,a);a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.m=this.f=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.m=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.m=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.f=32768)):d=c;this.g[a]=d>>16&65535;this.g[a|1]=d&65535;this.s=d>>16;this.i=d>>16|d;this.a-=(this.c?6:7)+b}function kd(a){V(this,a,!Q(this))}function ld(a){V(this,a,Q(this))}
function md(a){U(this,a,Cc(this,a),Oc);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function nd(a){T(this,a,Bc(this,a),Pc);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function od(a){U(this,a,Cc(this,a),Qc);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function pd(a){T(this,a,Bc(this,a),Rc);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}
function qd(a){R(this,Cc(this,a)&Fc(this,a));this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}function rd(a){R(this,(Bc(this,a)&Ec(this,a))<<8);this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}function sd(a){V(this,a,this.i&65535?0:4)}function td(a){V(this,a,!this.ya()==!(this.f&32768))}function ud(a){V(this,a,!!(this.i&65535)&&!this.ya()==!(this.f&32768))}function vd(a){V(this,a,!Q(this)&&!!(this.i&65535))}
function wd(a){V(this,a,(this.i&65535?0:4)||!this.ya()!=!(this.f&32768))}function xd(a){V(this,a,Q(this)||(this.i&65535?0:4))}function yd(a){V(this,a,!this.ya()!=!(this.f&32768))}function zd(a){V(this,a,this.ya())}function Ad(a){V(this,a,!!(this.i&65535))}function Bd(a){V(this,a,!this.ya())}function Cd(){J(this,12,1);this.a-=5}function Dd(a){V(this,a,!0)}function Ed(a){V(this,a,!(this.f&32768))}function Fd(a){V(this,a,this.f&32768?2:0)}
function W(a){a&1&&(this.m=0);a&2&&(this.f=0);a&4&&(this.i=1);a&8&&(this.s=0);this.a-=5}function Gd(a){var b=Cc(this,a);a=Fc(this,a);rc(this,b-a,a,b);this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}function Hd(a){var b=Bc(this,a)<<8;a=Ec(this,a)<<8;rc(this,b-a,a,b);this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}
function Id(a){var b=Fc(this,a);if(b){a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.m=this.f=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.g[a]=d&65535,this.g[a|1]=c-d*b&65535,this.i=d>>16|d,this.s=d>>16):(this.f=32768,this.i=d>>15|d,this.s=c>>16,-1===b&&65534===this.g[a]&&(this.g[a]=this.g[a|1]=1));this.a-=53}else this.i=this.s=0,this.f=32768,this.m=65536,this.a-=7}function Jd(){J(this,24,2);this.a-=25}
function Kd(){this.B&49152?(this.I|=128,J(this,4,3)):this.F?this.F.b():G(this);this.a-=7}function Ld(){J(this,16,4);this.a-=25}var Md=[0,7,7,10,7,11,9,13];function Nd(a){this.G=this.a;O(this,Dc(this,a));this.a=this.G-Md[this.c]}var Od=[0,14,14,17,14,18,16,20];function Pd(a){this.G=this.a;var b=Dc(this,a);a=a>>6&7;sc(this,this.g[a]);this.g[a]=this.g[7];O(this,b);this.a=this.G-Od[this.c]}var Qd=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
function Rd(a){var b=Cc(this,a);this.G=this.a;R(this,Hc(this,a,b));this.a=this.G-Qd[(this.A?8:0)+this.c]+(7!=this.b||this.c?0:2)}function Sd(a){var b=Bc(this,a);R(this,Gc(this,a,b,1)<<8);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}var Td=[7,13,13,17,14,18,17,21];
function Ud(a){var b=Fc(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.g[a];c&32768&&(c|=-65536);b=~~(b*c);this.g[a]=b>>16&65535;this.g[a|1]=b&65535;this.u&128||(this.s=b>>16,this.i=this.s|b,this.f=0,this.m=-32768>b||32767<b?65536:0);this.a-=23}function Vd(){this.a-=5}function Wd(){this.B&49152||(kc(this),this.h.reset());this.a-=667}function Xd(){tc(this);this.u|=this.B&16;this.a-=13}
function Yd(a){if(a&8)J(this,8,6);else{var b=uc(this);a&=7;7==a?O(this,b):(O(this,this.g[a]),this.g[a]=b);this.a-=9}}function X(a){a&1&&(this.m=65536);a&2&&(this.f=32768);a&4&&(this.i=0);a&8&&(this.s=32768);this.a-=5}function Zd(a){var b=(a&448)>>6;if(this.g[b]=this.g[b]-1&65535)O(this,this.g[7]-((a&63)<<1)),this.a+=1;this.a-=6}function $d(a){U(this,a,Cc(this,a),dd);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}
function ae(a){U(this,a,0,fd);this.a-=this.c?9:3+(7==this.b?2:0)}function be(){J(this,28,5);this.a-=5}function ce(){this.u&4||this.j.ma();this.u|=4;nc(this,-2);this.a-=3}function de(a){U(this,a,Cc(this,a),gd);this.a-=this.c?9:3+(7==this.b?2:0)}function Y(){J(this,8,6)}function hc(a){ee[a>>12].call(this,a)}function fe(a){ge[a>>6&3].call(this,a)}function he(a){ie[a>>6&3].call(this,a)}function je(a){ke[a>>6&3].call(this,a)}function le(a){me[a&15].call(this,a)}function ne(a){oe[a&15].call(this,a)}
function pe(a){qe[a>>6&3].call(this,a)}function re(a){se[a>>6&3].call(this,a)}function te(a){ue[a>>6&3].call(this,a)}
var ee=[function(a){ve[a>>8&15].call(this,a)},Rd,Gd,qd,md,od,hd,Y,function(a){we[a>>8&15].call(this,a)},Sd,Hd,rd,nd,pd,$d,Y],ve=[function(a){xe[a>>4&15].call(this,a)},Dd,Ad,sd,td,yd,ud,wd,Pd,Pd,fe,he,je,Y,Y,Y],ge=[function(a){oc(this,Hc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Sc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,Wc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,Uc);this.a-=this.c?9:3+(7==this.b?2:0)}],ie=[function(a){U(this,a,0,
Yc);this.a-=this.c?11:6},function(a){U(this,a,Q(this)?1:0,Ic);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,Q(this)?1:0,dd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Fc(this,a);oc(this,a);this.a-=this.c?4:3+(7==this.b?2:0)}],ke=[function(a){U(this,a,0,bd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,$c);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Mc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Kc);this.a-=this.c?9:3+(7==this.b?2:0)}],
xe=[function(a){ye[a&15].call(this,a)},Y,Y,Y,Nd,Nd,Nd,Nd,Yd,Y,le,ne,ae,ae,ae,ae],ye=[Kd,ce,Xd,Cd,Ld,Wd,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y],me=[Vd,function(){this.m=0;this.a-=5},function(){this.f=0;this.a-=5},W,function(){this.i=1;this.a-=5},W,W,W,function(){this.s=0;this.a-=5},W,W,W,W,W,W,W],oe=[Vd,function(){this.m=65536;this.a-=5},function(){this.f=32768;this.a-=5},X,function(){this.i=0;this.a-=5},X,X,X,function(){this.s=32768;this.a-=5},X,X,X,X,X,X,X],we=[Bd,zd,vd,xd,Ed,Fd,kd,ld,Jd,be,pe,re,te,Y,Y,Y],qe=[function(a){oc(this,
Gc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,Tc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,Xc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,Vc);this.a-=this.c?9:3+(7==this.b?2:0)}],se=[function(a){T(this,a,0,Zc);this.a-=this.c?11:6},function(a){T(this,a,Q(this)?1:0,Jc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,Q(this)?1:0,ed);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Ec(this,a);oc(this,a<<8);this.a-=this.c?4:3+(7==this.b?
2:0)}],ue=[function(a){T(this,a,0,cd);this.a-=this.c?9+(this.pb&1):3+(7==this.b?2:0)},function(a){T(this,a,0,ad);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,Nc);this.a-=this.c?9+(this.pb&1):3+(7==this.b?2:0)},function(a){T(this,a,0,Lc);this.a-=this.c?9:3+(7==this.b?2:0)}];function ic(a){ze[a>>12].call(this,a)}
var ze=[function(a){Ae[a>>8&15].call(this,a)},Rd,Gd,qd,md,od,hd,function(a){Be[a>>8&15].call(this,a)},function(a){Ce[a>>8&15].call(this,a)},Sd,Hd,rd,nd,pd,$d,Y],Ae=[function(a){De[a>>4&15].call(this,a)},Dd,Ad,sd,td,yd,ud,wd,Pd,Pd,fe,he,je,function(a){Ee[a>>6&3].call(this,a)},Y,Y],Ee=[function(a){a=this.g[7]+((a&63)<<1)&65535;var b=this.V(a|this.R);O(this,this.g[5]);this.g[6]=a+2&65535;this.g[5]=b;this.a-=8},function(a){a=zc(this,a,0);sc(this,a);R(this,a);this.a-=11},function(a){var b=uc(this);this.G=
this.a;Ac(this,a,0,b);R(this,b);this.a=this.G-Td[this.c]},function(a){R(this,Hc(this,a,this.ya?65535:0));this.a-=this.c?9:3+(7==this.b?2:0)}],De=[function(a){Fe[a&15].call(this,a)},Y,Y,Y,Nd,Nd,Nd,Nd,Yd,function(a){a&8?(this.B&49152||(this.B=this.B&-2017|(a&7)<<5,this.u|=1),this.a-=5):J(this,8,6)},le,ne,ae,ae,ae,ae],Fe=[Kd,ce,Xd,Cd,Ld,Wd,function(){tc(this);this.a-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],Be=[Ud,Ud,Id,Id,id,id,jd,jd,de,de,Y,Y,Y,Y,Zd,Zd],Ce=[Bd,zd,vd,xd,Ed,Fd,kd,ld,Jd,be,pe,re,te,function(a){Ge[a>>6&
3].call(this,a)},Y,Y],Ge=[Y,function(a){a=zc(this,a,65536);sc(this,a);R(this,a);this.a-=11},function(a){var b=uc(this);this.G=this.a;Ac(this,a,65536,b);R(this,b);this.a=this.G-Td[this.c]},Y];
function He(a){x.call(this,"ROM",a,He);this.W=this.b=null;this.i=a.addr;this.c=a.size;this.f=a.alias;this.j=a.file;this.m=n(this.j);if(this.j){a=this.j;var b=la(this.m);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.j+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?c.C("Unable to load ROM resource (error "+f+": "+a+")"):(Ra(c.na,a,b),(a=ta(a,b))?(c.b=a.L,c.W=a.W):c.j=null,Ie(c))})}}A(He);He.prototype.ha=function(a,b,c,d){this.h=b;this.a=c;this.F=d;Ie(this)};
He.prototype.ja=function(){this.W&&(this.F&&this.F.a(this.id,this.i,this.c,this.W),delete this.W);return!0};He.prototype.ia=function(){return!0};
function Ie(a){if(!Ua(a)){if(a.j){if(!a.b||!a.h)return;a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size ("+k(a.b.length,8,!0)+") does not match specified size ("+k(a.c,8,!0)+")";a.l.error=!0;a.C(b)}else{b=a.i;if(lb(a.h,b,a.c,Lb)){var c;for(c=0;c<a.b.length;c++)a.h.Va(b+c,a.b[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.f?b.push(a.f):null!=a.f&&a.f.length&&(b=a.f);for(c=0;c<b.length;c++){var d=a,e=b[c],f=kb(d.h,d.i,d.c);jb(d.h,e,d.c,f)}delete a.b}}}F(a)}}
Ga(function(){for(var a=E(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new He(d);D(d,c)}});
function Je(a){x.call(this,"RAM",a,Je);this.W=this.c=null;this.j=a.addr;this.i=a.size;this.fa=a.load;this.ea=a.exec;this.f=!1;this.b=a.file;this.m=n(this.b);if(this.b){a=this.b;var b=la(this.m);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?c.C("Unable to load RAM resource (error "+f+": "+a+")"):(Ra(c.na,a,b),(a=ta(a,b))?(c.c=a.L,c.W=a.W,null==c.fa&&(c.fa=a.fa),null==c.ea&&(c.ea=a.ea)):c.b=null,Ke(c))})}}A(Je);
Je.prototype.ha=function(a,b,c,d){this.h=b;this.a=c;this.F=d;Ke(this)};Je.prototype.ja=function(){this.W&&(this.F&&this.F.a(this.id,this.j,this.i,this.W),delete this.W);return!0};Je.prototype.ia=function(){return!0};function Ke(a){if(a.h&&(!a.f&&a.i&&lb(a.h,a.j,a.i,1)&&(a.f=!0),!Ua(a))){if(!a.f)t("No RAM allocated");else if(a.b){if(!a.c||!a.h)return;Le(a,a.c,a.fa,a.ea,a.j)}F(a)}}
Je.prototype.reset=function(){if(this.f){for(var a=this.h,b=this.j,c=this.i,d=b&a.j,b=b>>>a.c;0<c&&b<a.h.length;){var e=a.h[b],f=c,g,d=d||0;void 0===f&&(f=e.size);if(Va)for(g=d;f--&&g<e.b.length;g++)e.b[g]=0;else for(g=d;f--&&g<e.size;g++)e.Db(d,0,e.Ha+d);c-=a.b;b++;d=0}this.c&&Le(this,this.c,this.fa,this.ea,this.j,!0)}};
function Le(a,b,c,d,e,f){var g=!1;if(null==c)for(var l=0;l<b.length-1;){var m=b[l]&255|(b[l+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(l+6>=b.length)break;for(var l=l+2,p=b[l++]&255|(b[l++]&255)<<8,q=b[l++]&255|(b[l++]&255)<<8,m=m+((p&255)+(p>>8)+(q&255)+(q>>8)),u=l,z=p-=6;0<p&&l<b.length;)m+=b[l++]&255,p--;if(p||l>=b.length)break;m+=b[l++]&255;if(m&255)break;if(z)for(;z--;)a.a.Va(q++,b[u++]&255);else q&1?G(a.a):lc(a.a,q,f);g=!0}else l++;else l+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.a.Va(c+
e,b[e]);null!=d&&lc(a.a,d,f);g=!0}return g}Ga(function(){for(var a=E(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Je(d);D(d,c)}});function Me(a){x.call(this,"Keyboard",a,Me);F(this)}A(Me);Me.prototype.Z=function(){return!1};Me.prototype.ha=function(a,b,c,d){this.j=a;this.a=c;this.F=d};Ga(function(){for(var a=E(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Me(d);D(d,c)}});
function Z(a){this.D=a.baudReceive||9600;this.J=a.baudTransmit||9600;this.R=a.upperCase;this.f=this.m=null;this.K=a.tabSize;this.G=a.charBOL;this.s=0;x.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.m="";else{var c;a=Ne;b&&(void 0===c&&(c="Panel"),(c=Ta(c,this.id))&&(b=c.o[b])&&this.Z(null,a,b))}this.v=this.A=null;this.exports={connect:this.Jb,receiveData:this.wb}}A(Z);var Ne="buffer";h=Z.prototype;
h.Z=function(a,b,c){var d=this;switch(b){case Ne:return this.o[b]=this.f=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.wb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.wb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.ha=function(a,b,c,d){this.j=a;this.h=b;this.a=c;this.F=d;var e=this;this.$=Bb(48,4);this.N=yb(this.a,function(){e.b&128||!e.i.length||(e.w=e.i.shift()&255,e.R&&97<=e.w&&122>e.w&&(e.w-=32),e.b|=128,e.b&64&&zb(e.a,e.$))});this.aa=Bb(52,4);this.O=yb(this.a,function(){e.c|=128;e.c&64&&zb(e.a,e.aa)});ub(b,this,Oe);F(this)};
h.Jb=function(){if(!this.v){var a=Wb(this.j,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.Na)return;b=pa(b[1]);if(this.v=Sa(b)){var d=this.v.exports;if(d){var e=d.connect;e&&e.call(this.v);if(this.A=d.receiveData){this.status(this.na+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.ja=function(a,b){if(!b)if(this.Jb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.ia=function(a){return a?this.save():!0};h.reset=function(){Pe(this)};h.save=function(){var a=new P(this);a.set(0,[]);return a.data()};h.restore=function(){return Pe(this)};function Pe(a){a.w=0;a.b=0;a.c=128;a.i=[];return!0}h.wb=function(a){if("number"==typeof a)this.i.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.i.push(a.charCodeAt(b));else this.i=this.i.concat(a);Ab(this.a,this.N,1E3/Math.round(this.D/10));return!0};h.Ic=function(){return this.b&65534};
h.Ad=function(a){this.b=this.b&-112|a&111};h.Hc=function(){this.b&=-129;0<this.i.length&&Ab(this.a,this.N,1E3/Math.round(this.D/10));return this.w};h.zd=function(){};h.$c=function(){return this.c};h.Sd=function(a){128==(this.c&192)&&a&64&&Ab(this.a,this.O,1E3/Math.round(this.J/10));this.c=this.c&-70|a&69};h.Zc=function(){return 0};
h.Rd=function(a){if(a&=255){this.A&&this.A.call(this.v,a);if(this.f)if(13==a)this.s=0;else if(8==a)this.f.value=this.f.value.slice(0,-1),0<this.s&&this.s--;else{var b;b=(b=qa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.K||8,c=a-this.s%a,this.K&&(b=" ".slice(0,c)));this.G&&!this.s&&c&&(b=String.fromCharCode(this.G)+b);this.f.value+=b;this.f.scrollTop=this.f.scrollHeight;this.s+=c}else if(null!=this.m){if(10==a||1024<=this.m.length)this.U(this.m),
this.m="";10!=a&&(this.m+=String.fromCharCode(a))}this.c&=-129;Ab(this.a,this.O,1E3/Math.round(this.J/10))}};var Qe={},Oe=(Qe[65392]=[null,null,Z.prototype.Ic,Z.prototype.Ad,"RCSR"],Qe[65394]=[null,null,Z.prototype.Hc,Z.prototype.zd,"RBUF"],Qe[65396]=[null,null,Z.prototype.$c,Z.prototype.Sd,"XCSR"],Qe[65398]=[null,null,Z.prototype.Zc,Z.prototype.Rd,"XBUF"],Qe);Ga(function(){for(var a=E(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Z(d);D(d,c)}});
function Fb(a){x.call(this,"PC11",a,Fb);this.c=a.autoMount||null;this.m=0;this.O=a.baudReceive||3600;this.w=this.A=this.b=0;this.v=[];this.s=Re;this.f=Se;this.D=this.i="";this.L=this.fa=this.ea=null;this.J=-1;this.G=!Ba("Mobi")&&window&&"FileReader"in window}A(Fb);var Re="",Se=0;h=Fb.prototype;
h.Z=function(a,b,c){var d=this,e=Se;switch(b){case "listTapes":return this.o[b]=c,c.onchange=function(){var a=d.o.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(m){t("PC11 option error: "+m.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.o[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.o[b]=c,c.onclick=function(){var a=
d.o.listTapes;a&&Te(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.G){c.parentNode.removeChild(c);break}this.o[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Te(d,n(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.o[b]=c,!0}return!1};
h.ha=function(a,b,c,d){this.j=a;this.h=b;this.a=c;this.F=d;this.K=Ue(a);var e=this;if((this.c=Wb(this.j,"autoMount")||this.c)&&"string"==typeof this.c)try{this.c=eval("("+this.c+")")}catch(f){t("PC11 auto-mount error: "+f.message+" ("+this.c+")"),this.c=null}this.N=Bb(56,4);this.R=yb(this.a,function(){1==(e.b&32769)&&!(e.b&128)&&e.w<e.v.length&&(e.A=e.v[e.w++]&255,Ve(e,e.w/e.v.length*100),e.b|=128,e.b&=-2049,e.b&64&&zb(e.a,e.N))});ub(b,this,We);Xe(this,"None",Re,!0);this.G&&Xe(this,"Local Tape","?");
Xe(this,"Remote Tape","??");Ye(this)||F(this)};h.ja=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.ia=function(a){return a?this.save():!0};h.reset=function(){this.b&=-2241;this.A=0};function Ye(a){a.m=0;if(a.c){var b=a.c.path||"",c;if(!(c=a.c.name))a:{if((c=a.o.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=n(b,!0)}b&&c?Ze(a,c,b,1,!0):$e(a)}return!!a.m}
function Te(a,b,c,d,e){if(c)if("?"==c)a.C('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=n(c);a.status("Attempting to load "+c+' as "'+b+'"');a.s="??"}else a.s=c;Ze(a,b,c,d,!1,e)}else af(a,!1)}function Ze(a,b,c,d,e,f){var g=-1;if(a.i.toLowerCase()!=c.toLowerCase()||a.f!=d)g++,af(a,!0),a.l.lb?a.C("PC11 busy"):(e&&a.m++,bf(a,b,c,d,f)?g++:a.l.lb=!0);g&&cf(a,a.D,a.i,a.f,a.L,a.fa,a.ea)}
function bf(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),cf(a,b,c,d,e),a.s="?");$e(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=la(c),f="json"==e||"gz"==e?encodeURI(c):v()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!r(f,null,!0,function(e,f,g){var l=0>g&&a.j&&!a.j.l.P;g?a.C('Unable to load tape "'+b+'" (error '+g+": "+e+")",l):(Ra(a.na,e,f),(e=ta(e,f))&&cf(a,b,c,d,e.L,e.fa,e.ea));
a.l.lb=!1;a.m&&(a.m--,a.m||F(a));$e(a)})}function Xe(a,b,c,d){if((a=a.o.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}function $e(a){var b=a.o.listTapes;if(b&&b.options){a=a.s||a.i;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}
function Ve(a,b){b|=0;if(b!==a.J){var c=a.o.readProgress;c&&(c=(c=E(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.J=b}}function cf(a,b,c,d,e,f,g){a.D=b;a.i=c;a.f=d;a.L=e;a.fa=f;a.ea=g;2==d?a.K&&Le(a.K,e,f,g)?a.status("tape loaded: "+b):(a.D="",a.i="",a.s=Re,a.f=Se,a.C("No load address available for tape: "+b)):(a.w=0,a.v=e,a.status("tape attached: "+b),Ve(a,0))}
function af(a,b){if(a.i||!1===b)a.D="",a.i="",b||(a.f&&a.status(1==a.f?"tape detached":"tape unloaded"),a.s=Re,a.f=Se,$e(a))}h.save=function(){return(new P(this)).data()};h.restore=function(){return!0};h.Bc=function(){return this.b&65534};h.td=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&zb(this.a,this.N)):(this.b&=-129,this.b|=2048,this.A=0,Ab(this.a,this.R,1E3/Math.round(this.O/10))));this.b=this.b&-66|a&65};h.Ac=function(){this.b&=-129;this.b|=2048;return this.A};h.sd=function(){};
var df={},We=(df[65384]=[null,null,Fb.prototype.Bc,Fb.prototype.td,"PRS"],df[65386]=[null,null,Fb.prototype.Ac,Fb.prototype.sd,"PRB"],df);function ef(a,b,c){x.call(this,"Disk",{id:a.na+".disk"+k(++ff,4)},ef);this.controller=a;this.j=a.j;this.F=a.F;this.f=b;this.ta=b.name;this.ob=b.ob;gf(this,c,b.T,b.Y,b.S,b.ga);F(this)}var ff=0;A(ef);h=ef.prototype;h.ha=function(a,b,c,d){this.F=d};
function gf(a,b,c,d,e,f){a.mode=b;a.T=c;a.Y=d;a.S=e;a.ga=f;a.a=[];if("preload"!=a.mode){b=Array(a.T);for(c=0;c<b.length;c++){d=Array(a.Y);for(e=0;e<d.length;e++){f=Array(a.S);for(var g=1;g<=f.length;g++)f[g-1]=hf(null,c,e,g,a.ga,0);d[e]=f}b[c]=d}a.a=b}a.b=null}
function jf(a,b,c,d,e){var f=c;if(a.h)return!0;a.ta=b;a.Da=c;a.Vb=n(c);a.h=e;a.i=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ia[d];if(e){a.T=e[0];a.Y=e[1];a.S=e[2];a.ga=e[3]||512;c=a.ga>>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.T);for(d=0;d<a.a.length;d++)for(var z=a.a[d]=Array(a.Y),S=0;S<z.length;S++)for(var ua=z[S]=Array(a.S),va=0;va<ua.length;va++){for(var Yb=hf(null,d,S,va+1,a.ga,0),Lf=Yb.data,Zb=0;Zb<c;Zb++,f+=4)var Mf=Lf[Zb]=b.getInt32(f,
!0),e=e+Mf&-1;Yb.ba=c;ua[va]=Yb}a.b=e;c=a}else a.C("Unrecognized disk format ("+d+" bytes)");a.h&&(a.h.call(a.controller,a.f,c,a.ta,a.Da),a.h=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=la(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ma(c,"/")&&(d="dir"),f=v()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.ob?"":e)+"&format=json"));return!!r(f,
null,!0,function(b,c,d){kf(a,b,c,d)})}
function kf(a,b,c,d){var e=null;a.c=!1;var f=0>d&&a.j&&!a.j.l.P;if(d)a.controller.C('Unable to load disk "'+a.ta+'" (error '+d+": "+b+")",f);else{Ra(a.controller.na,b,c);try{if(0<n(a.Vb,!0).toLowerCase().indexOf("-readonly"))a.c=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.c=!0)}var l;"<"==c.substr(0,1)?l=["Missing disk image: "+a.ta]:l=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(l.length)if(1==l.length)t(l[0]);else{a.T=l.length;a.Y=l[0].length;a.S=l[0][0].length;var m=l[0][0][0];a.ga=m&&m.length||512;for(d=c=0;d<a.T;d++)for(f=0;f<a.Y;f++)for(g=0;g<a.S;g++)if(m=l[d][f][g]){var p=m.length;void 0===p&&(p=m.length=512);var p=p>>2,q=m.pattern;void 0===q&&(q=m.pattern=0);var u=m.data;if(void 0===u){var z=m.bytes;if(void 0!==z&&z.length){for(var S=p<<2,ua=z.length;ua<S;ua++)z[ua]=q;lf(m,z)}else u=[],q=m.pattern=q|q<<8|q<<16|q<<24,m.data=u;delete m.bytes}hf(m,d,f);for(S=
0;S<u.length;S++)c=c+u[S]&-1}a.a=l;a.b=c;e=a}else t("Empty disk image: "+a.ta)}catch(va){t("Disk image error ("+b+"): "+va.message)}}a.h&&(a.h.call(a.i,a.f,e,a.ta,a.Da),a.h=null)}function hf(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.Yd=b;a.Zd=c;a.ka=a.ba=0;a.sa=!1;return a}
h.seek=function(a,b,c,d,e){d=null;var f=this.f,g=this.a[a];if(g){var l=g[b];if(!l&&f.bc&&b<f.Y)for(l=g[b]=Array(f.cc),g=0;g<l.length;g++)l[g]=hf(null,a,b,g+1,f.Nb,0);if(l){for(g=0;g<l.length;g++)if(l[g]&&l[g].sector==c){d=l[g];break}!d&&f.bc&&9==f.Eb&&(d=l[g]=hf(null,a,b,f.Eb,f.Nb,0))}}e&&e(d,!1);return d};function lf(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
h.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.c)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.ba?f<a.ka?(a.ba+=a.ka-f,a.ka=f):f>=a.ka+a.ba&&(a.ba+=f-(a.ka+a.ba)+1):(a.ka=f,a.ba=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
function mf(a,b){var c=a.Y*a.S,d=b/c|0;return d<a.T?(b%=c,a.seek(d,b/a.S|0,b%a.S+1)):null}function nf(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}h.save=function(){var a=0,b=[];b[a++]=[this.Da,this.b,this.T,this.Y,this.S,this.ga];if(!this.c)for(var c=this.a,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.ba){for(var l=[],m=0,p=g.ka,q=g.ka+g.ba;p<q;)l[m++]=g.data[p++];b[a++]=[d,e,f,g.ka,l]}}return b};
h.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.a.length&&6<=e.length?gf(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.b&&e[1]!=this.b&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.b+")",b=-2));for(this.a.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],l=g[f++],m=g[f++],p=g[f++];if(l>=this.a.length||m>=this.a[l].length||p>=this.a[l][m].length){c="sector (CHS="+l+":"+m+":"+p+") out of range ("+
b+" changes applied)";b=-1;break}if(this.c){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(l=this.a[l][m][p]){for(m=l.data.length;m<e;)l.data[m++]=l.pattern;m=0;l.ka=e;for(l.ba=f.length;e<g;)l.data[e++]=f[m++];b++}}}0>b&&-2!=b&&this.controller.C("Unable to restore disk '"+this.ta+": "+c);return b};
h.toJSON=function(){var a;a=0;for(var b;b=mf(this,a++);)of(b);a=JSON.stringify(this.a,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function of(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function N(a){x.call(this,"RL11",a,N);this.f=a.autoMount||null;this.s=0;this.b=Array(1);this.A=!Ba("Mobi")&&window&&"FileReader"in window}A(N);h=N.prototype;
h.Z=function(a,b,c){var d=this;switch(b){case "listDisks":return this.o[b]=c,c.onchange=function(){var a=d.o.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(l){t("RL11 option error: "+l.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.o[b]=c,c.onchange=function(){var a=ja(c.value);null!=a&&pf(d,a)},!0;case "loadDrive":return this.o[b]=
c,c.onclick=function(){var a=d.o.listDisks;a&&qf(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.A){c.parentNode.removeChild(c);break}this.o[b]=c;c.onclick=function(){var a=d.o.listDrives;if(a&&a.options&&d.b)if(a=d.b[ja(a.value)||0])if(a=a.ca){var b;b="";for(var c=0,l;l=mf(a,c++);)for(var m=0,p=l.length;m<p;m++)b+=String.fromCharCode(nf(a,l,m));b=btoa(b);a=a.Vb.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),"string"!=
typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");t(a)}else d.C("No disk loaded in drive.");else d.C("No disk drive selected.")};return!0;case "mountDrive":if(this.A)return this.o[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),
c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;qf(d,n(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
h.ha=function(a,b,c,d){this.j=a;this.h=b;this.a=c;this.F=d;if((this.f=Wb(this.j,"autoMount")||this.f)&&"string"==typeof this.f)try{this.f=eval("("+this.f+")")}catch(e){t("RL11 auto-mount error: "+e.message+" ("+this.f+")"),this.f=null}rf(this);this.G=Bb(112,5);ub(b,this,sf);tf(this,"None","",!0);this.A&&tf(this,"Local Disk","?");tf(this,"Remote Disk","??");uf(this)||F(this)};
h.ja=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.j.Hb){for(a=0;a<this.b.length;a++)vf(this,a,!0);uf(this,!0)}}else if(!this.restore(a))return!1;if(a=this.o.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;1>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";pf(this,0)}}return!0};h.ia=function(a){return a?this.save():!0};h.reset=function(){rf(this)};h.save=function(){return(new P(this)).data()};
h.restore=function(a){return rf(this,a[0])};function uf(a,b){b||(a.s=0);if(a.f)for(var c in a.f){var d=a.f[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.o.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var l=f.options[g];if(l.value==e){f=l.text;break a}}f=n(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.b.length)){!wf(a,g,f,e,!0)&&b&&F(a,!1);continue}a.C("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.s}
function qf(a,b,c,d){var e=a.o.listDrives,e=e&&ja(e.value);if(void 0===e||0>e||e>=a.b.length)a.C("Unable to load the selected drive");else if(c)if("?"==c)a.C('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=n(c);a.status("Attempting to load "+c+' as "'+b+'"')}wf(a,e,b,c,!1,d)}else vf(a,e)}
function wf(a,b,c,d,e,f){var g=-1,l=a.b[b];l.Da.toLowerCase()!=d.toLowerCase()&&(g++,vf(a,b,!0),l.nb?a.C("RL11 busy"):(l.nb=!0,e&&(l.mb=!0,a.s++),l.fb=!!f,jf(new ef(a,l,"preload"),c,d,f,a.dc)&&g++));return g}
h.dc=function(a,b,c,d,e){var f;a.nb=!1;b&&(f=b.a.length?[b.a.length,b.a[0].length,b.a[0][0].length,b.a[0][0][0].length]:[0,0,0,0],b&&f[0]>a.T||f[1]>a.Y)&&(this.C('Disk "'+c+'" too large for drive '+("RL"+a.sb)),b=null);b?(a.ca=b,a.ta=c,a.Da=d,this.C('Mounted disk "'+c+'" in drive '+("RL"+a.sb),a.mb||e),this.j&&ec(this.j)):a.fb=!1;a.mb&&(a.mb=!1,--this.s||F(this));pf(this,a.sb)};
function tf(a,b,c,d){if((a=a.o.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function pf(a,b){if(0<=b&&b<a.b.length){var c=a.b[b],d=a.o.listDisks;a=a.o.listDrives;if(d&&a&&d.options&&a.options&&(a=ja(a.value),c=c.fb?"?":c.Da,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function vf(a,b,c){var d=a.b[b];if(d.ca||!1===c)d.ta="",d.Da="",d.ca=null,d.fb=!1,c||(a.C("Drive RL"+b+" unloaded",c),pf(a,b))}
function rf(a,b){var c=0;b||(b=[]);a.M=b[c++]||0;a.v=b[c++]||0;a.c=b[c++]||0;a.i=b[c++]||0;a.m=b[c++]||0;a.w=b[c]||0;for(b=0;b<a.b.length;b++){var d=a.b[b];void 0===d&&(d=a.b[b]={});c=a;d.sb=b;d.nb=d.fb=!1;d.name=c.Na;d.T=512;d.Y=2;d.S=40;d.ga=256;d.ob=!0;d.Wd=0;d.Vd=0;d.Ud=0;d.Eb=1;d.cc=d.S;d.Nb=d.ga;d.$d=0;d.ae=null;d.ca||(d.Da="");d.status=29|(512==d.T?128:0)}return!0}
h.ec=function(a,b,c,d,e,f){this.v=f&65535;this.M=this.M&-49|f>>12&48;this.w=f>>16&63;this.i=this.c=b<<7|(c?64:0)|d&63;this.m=65536-e&65535;a&&(this.M=this.M|a|32768);return!0};
h.oc=function(a,b,c,d,e,f,g){for(var l=0,m=a.ca,p=null,q;e--;){if(!p){p=a.ca.seek(b,c,d,!0);if(!p){l=5120;break}q=0}var u,z;if(0>(u=a.ca.read(p,q++))||0>(z=a.ca.read(p,q++))){l=5120;break}this.h.zb(vc(this.a,f),u|z<<8);if(xb(this.h)){l=8192;break}f+=2;if(q>=m.ga&&(p=null,++d>=m.S&&(d=0,++c>=m.Y&&(c=0,++b>=m.T)))){l=5120;break}}return g(l,b,c,d,e,f)};
h.hd=function(a,b,c,d,e,f,g){for(var l=0,m=a.ca,p=null,q;e--;){var u=this.h.qb(vc(this.a,f));if(xb(this.h)){l=8192;break}f+=2;if(!p){p=a.ca.seek(b,c,d,!0);if(!p){l=5120;break}q=0}if(!a.ca.write(p,q++,u&255)||!a.ca.write(p,q++,u>>8)){l=5120;break}if(q>=m.ga&&(p=null,++d>=m.S&&(d=0,++c>=m.Y&&(c=0,++b>=m.T)))){l=5120;break}}return g(l,b,c,d,e,f)};h.Lc=function(){return this.M&65535};
h.Dd=function(a){this.M=this.M&-1023|a&1022;this.D=this.D&-4|(a&48)>>4;if(!(this.M&128)){var b;a=!0;var c=this.b[(this.M&768)>>8],d,e,f,g;this.M&=-2;switch(this.M&14){case 4:this.c&8&&(this.M&=63);this.m=c.status|this.i&64;break;case 6:1==(this.c&3)&&(b=this.c&65408,c=(this.c&16)<<2,this.i=this.c&4?this.i+b:this.i-b,this.c=this.i=this.i&65408|c);break;case 8:this.m=this.i;break;case 12:b=this.oc;case 10:b||(b=this.hd),d=this.c>>7,e=this.c&64?0:1,f=this.c&63,d>=c.T||f>=c.S?this.M|=37888:(g=(this.w&
63)<<16|this.v,a=65536-this.m&65535,a=b.call(this,c,d,e,f,a,g,this.ec.bind(this)))}a&&(this.M|=129,this.M&64&&zb(this.a,this.G))}};h.Jc=function(){return this.v};h.Bd=function(a){this.v=a&65534};h.Mc=function(){return this.c};h.Ed=function(a){this.c=a};h.Nc=function(){return this.m};h.Fd=function(a){this.m=a};h.Kc=function(){return this.w};h.Cd=function(a){this.w=a&63};
var xf={},sf=(xf[63744]=[null,null,N.prototype.Lc,N.prototype.Dd,"RLCS"],xf[63746]=[null,null,N.prototype.Jc,N.prototype.Bd,"RLBA"],xf[65284]=[null,null,N.prototype.Mc,N.prototype.Ed,"RLDA"],xf[65286]=[null,null,N.prototype.Nc,N.prototype.Fd,"RLMP"],xf[65288]=[null,null,N.prototype.Kc,N.prototype.Cd,"RLBE"],xf);
function yf(a,b,c){x.call(this,"Computer",a,yf);this.l.P=!1;zf(this,b);this.A=Wb(this,"autoPower",a);this.j=0;this.N=a.busWidth||a.buswidth;this.b=Af;this.v=null;this.m=this.J=!1;this.O=Wb(this,"url")||"";(Math.random()+.1).toString(36);this.c=Bf(this);if(this.a=Ta("CPU",this.id)){this.F=Ta("Debugger",this.id);this.h=new ab({id:this.na+".bus",busWidth:this.N},this.a,this.F);var d,e=B(this.id);if((this.f=Ta("Panel",this.id))&&this.f.Ta)for(b=0;b<e.length;b++)d=e[b],d.C=this.f.C,d.U=this.f.U,d.Ta=this.f.Ta;
this.U("PDPjs v1.30.2\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.U("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.ha&&d.ha(this,this.h,this.a,this.F);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.b=parseInt(d,10));var f;if(a=Wb(this,"state")||(f=!0,a.state))b=this.D=a,f||(this.m=!0,this.b=Af),this.b&&(this.w=new P(this,
"1.30.2"),Cf(this.w)?b=null:delete this.w);!b&&this.b&&(b=Df(this))&&(this.m=!0);if(b){var g=this;r(b,null,!0,function(a,b,c){c?(g.s=null,g.m=!1,g.C("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.v=b,g.J=!0);F(g)})}else F(this);this.o.power||(this.A=!0);!c&&this.A&&Ef(this,this.Ua)}else t("Unable to find CPU component")}A(yf);var Af=0;
function zf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.K=b}function Wb(a,b,c){var d=b.toLowerCase(),d=La[b]||La[d];void 0===d&&a.K&&(d=a.K[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Ef(a,b,c){for(var d=B(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ua(f)){Ua(f,function(){Ef(a,b,c)});return}}b.call(a,c)}
function Ff(a,b){var c=new P(a,"1.30.2","validate");if(Cf(c)&&Gf(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.C("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=yf.prototype;
h.Ua=function(a){void 0===a&&(a=this.b||(this.v?1:Af));if(!this.j){this.j++;var b=!1,c=!1;this.G=!1;var d=this.w||new P(this,"1.30.2");if(-1==a)b=!0;else if(a>Af){if(Cf(d,this.v)){this.i=new P(this,"1.30.2","failsafe");Cf(this.i)&&(Hf(this,d),a=2,If(this.i));this.i.set("timestamp",sa());Jf(this.i);var e=this.b&&!this.m;if(1==a||wa("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Gf(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Cf(d,g):("error"==
f&&"no machine state"!=g?(this.C("Error: "+g),"unable to verify user"==g&&(Aa("user",""),this.c=null)):this.U(f+": "+g),If(d),Cf(d)?(c=Gf(d),e=!0):c=!1))}e&&Ff(this,c?d:null)}else 2==a&&d.clear()}else Ff(this);delete this.v;delete this.w}e=B(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=Kf(this,g,d,b,c));b=[d,a,c];-1!=a?Ef(this,this.Gb,b):this.Gb(b)}};
function Kf(a,b,c,d,e){if(!b.l.P){b.l.P=!0;if(b.ja){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ja(f,d)&&f&&(t("Unable to restore state for "+b.type),a.D&&!a.J?(c.clear(),a.b=Af,window&&window.location.reload()):a.G=!0,b.ja(null),e=!1)}if(!d&&b.Lb)for(a=b.Lb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Gb=function(a){var b=a[0],c=0>a[1];a=a[2];this.R=!0;this.l.P=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(Kf(this,this.a,b,c,a),this.a.Sa());this.G&&(Hf(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.j=0};
function Hf(a,b){if(wa("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.c||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.2"};d.url=a.O;d.user=c;d.type="bug";d.data=b;r("http://www.pcjs.org/api/v1/report",d,!0)}}
function Nf(a,b,c){var d,e="none";if(a.j)return null;a.j--;var f=new P(a,"1.30.2"),g=new P(a,"1.30.2","validate"),l=sa();g.set("timestamp",l);f.set("timestamp",l);f.set("version","1.30.2");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.ia&&(c&&G(a.a),d=a.a.ia(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.l.P=!1,!1===d&&(e=null)));for(var l=B(a.id),m=0;m<l.length;m++){var p=l[m];p.l.P&&(p.ia&&(d=p.ia(b,c),"object"===typeof d&&f.set(p.id,
d)),c&&(p.l.P=!1,!1===d&&(e=null)))}e&&(c?(l=d=!1,b?(a.c&&Of(a,a.c,f.toString()),Jf(g)&&Jf(f)||(e=null,d=l=!0)):a.b&&(d=!0,l=3==a.b),d&&f.clear(l)):e=f.toString());c&&(a.l.P=!1,b=a.o.power)&&(b.textContent="Power");a.j=0;return e}h.reset=function(){this.h&&this.h.reset&&this.h.reset();for(var a=B(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.h&&c.reset&&c.reset()}};h.start=function(a,b){for(var c=B(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.ma(!0)};
h.stop=function(a,b){for(var c=B(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.ma(!0)};
h.Z=function(a,b,c){var d=this;switch(b){case "power":return this.o[b]=c,c.onclick=function(){d.j||(d.l.P?Nf(d,!1,!0):Ef(d,d.Ua))},!0;case "reset":return this.o[b]=c,c.onclick=function(){if(d.l.P&&!d.j)if(d.b&&!d.s){var a=wa("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Nf(d,a,!0);!a&&d.D?window&&window.location.reload():(a||(d.Hb=!0),d.Ua(Af),d.Hb=!1)}else d.reset(),d.a&&d.a.Sa()},!0;case "save":if(ma(v(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.o[b]=c,c.onclick=function(){var a=Bf(d,!0);if(a){var b=!!(d.b&&!d.s||d.D),c=Nf(d,b);b?Of(d,a,c):d.C("Resume disabled, machine state not saved")}},!0}return!1};
function Bf(a,b){var c=a.c;c||((c=za("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Pf(a,c))||a.C("The user ID is invalid.")):b&&a.C("Browser local storage is not available"));return c}
function Pf(a,b){a.c=null;b=r(v()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Aa("user",b.data),a.c=b.data)}catch(d){t(d.message+" ("+c+")")}return a.c}function Df(a){var b=null;a.c&&(b=v()+"/api/v1/user?req=load&user="+a.c+"&state="+Qf(a,"1.30.2"));return b}
function Of(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Qf(a,"1.30.2");d.data=c;b=r(v()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.C("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.C(c),Aa("user",""),a.c=null)}}
function Ue(a){var b;a=B(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}function ec(a){if(a.Ta){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Ta.focus();window&&window.scrollTo(b,c)}}h.ma=function(a){this.a&&this.a.ma(a);this.f&&this.f.ma(a)};
Ga(function(){for(var a=E(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=C(c),c=E(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=C(f),g=new yf(g,d,!0);D(g,f);g.A&&Ef(g,g.Ua)}});w.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Ta("Computer",c.id))&&c.R&&!c.l.P&&c.Ua(-1)}});w.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Ta("Computer",c.id))&&c.l.P&&Nf(c,!(!c.b||c.s),!0)}});
function P(a,b,c){this.id=a.id;this.key=Qf(a,b,c);this.F=a.F;If(this,a.jc)}function Qf(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
P.prototype={constructor:P,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){If(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function If(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function Jf(a){var b=!0;if(ya()){var c=JSON.stringify(a[a.id]);Aa(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Gf(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Cf(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:ya()&&(b=za(a.key))?(a[a.id]=b,a.a=!0):!1}var Rf=0;
function Sf(a,b,c,d,e,f){e("Loading "+a+"...");r(a,null,!0,function(g,l,m){m?(l||(l="unable to load "+a+" ("+m+")"),f(l,null)):Tf(l,a,b,c,d,e,f)})}
function Tf(a,b,c,d,e,f,g){function l(a,f){if(f)g(f,null);else{c&&(Ra(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){f=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Uf(a,f,l):l(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Uf(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");r(e,null,!0,function(f,g,l){if(l||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+l+")");else{if(f=d[3])if(l=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=l[0],p,q=/( [a-z]+=)(['"])(.*?)\2/g;p=q.exec(f);)m=0>m.indexOf(p[1])?m.replace(">",p[0]+">"):m.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);l[0]!=m&&(g=g.replace(l[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);Uf(a,b,c)}})}else c(a,null)}
function Vf(a,b,c,d){function e(a){if(void 0===l){var b=g&&E(g,"machine-warning");l=b&&b[0]||g}l&&(l.innerHTML=oa(a))}function f(a){e("Error: "+a);m&&(--Rf||Ia(!0));m=!1}var g,l,m=!0;Rf++;Qa[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.type="text/css";u.styleSheet?u.styleSheet.cssText=p:u.appendChild(document.createTextNode(p));q.appendChild(u)}c||
(c="/versions/pdpjs/1.30.2/components.xsl");p=function(d,l){l?Sf(c,null,null,!1,e,function(d,m){m?(Ra(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=l.transformNode(m))?(g.outerHTML=m,--Rf||Ia(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(l,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Rf||Ia(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Sf(b,a,d,!0,e,p):Tf(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(z){f(z.message)}return m}window.embedPDP11=function(a,b,c,d){Ia(!1);return Vf(a,b,c,d)};window.enableEvents=Ia;window.sendEvent=Ja;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11.map