More device refactoring

This commit is contained in:
Jeff Parsons 2016-10-07 17:37:13 -07:00 committed by Jeff Parsons
commit 0ee3a091b4
11 changed files with 1104 additions and 1667 deletions

View file

@ -7,7 +7,7 @@
<ram id="ram" addr="0x0000" size="0xC000"/>
<rom id="rom" addr="0xC000" size="0x0570" file="/devices/pdp11/rom/custom/boot.json" writable="true"/>
<ram id="ram" addr="0x10000" size="0x34000"/>
<device id="unibus" name="unibus"/>
<device id="default" name="default"/>
<serial id="dl11" adapter="0"/>
<panel ref="/devices/pdp11/panel/1170/wide.xml"/>
<debugger id="debugger" base="8" messages="" commands=""/>

View file

@ -7,7 +7,7 @@
<ram id="ram" addr="0x0000" size="0xC000"/>
<rom id="rom" addr="0xC000" size="0x0570" file="/devices/pdp11/rom/custom/boot.json" writable="true"/>
<ram id="ram" addr="0x10000" size="0x34000"/>
<device id="unibus" name="unibus"/>
<device id="default" name="default"/>
<serial id="dl11" adapter="0" binding="print"/>
<panel ref="/devices/pdp11/panel/1170/wide.xml"/>
<debugger id="debugger" base="8" messages="" commands=""/>

View file

@ -116,23 +116,21 @@ function BusPDP11(parmsBus, cpu, dbg)
* Memory access handlers must service the entire block; see the setAccess() function in the Memory
* component for details.
*
* Finally, for debugging purposes, if an I/O address has a symbolic name, it will be saved here:
*
* [4]: symbolic name of I/O address
*
* UPDATE: The Debugger wants to piggy-back on these arrays to indicate addresses for which it wants
* notification. In those cases, the following additional element will be set:
*
* [4]: true to break on I/O, false to ignore I/O
* [5]: true to break on I/O, false to ignore I/O
*
* The false case is important if fIOBreakAll is set, because it allows the Debugger to selectively
* ignore specific addresses.
*
* Finally, for debugging purposes, if an I/O address has a symbolic name, it will be saved here:
*
* [5]: symbolic name of I/O address
*/
this.aIOHandlers = [];
this.fIOBreakAll = false;
this.fnReset = null;
this.fnIOAccess = this.unknownIO;
this.afnReset = [];
/*
* Allocate empty Memory blocks to span the entire physical address space.
@ -151,7 +149,6 @@ BusPDP11.IOPAGE_22BIT = 0x3FE000; /*017760000*/ // eg, PDP-11/70
BusPDP11.IOPAGE_LENGTH = 0x2000; // ie, 8Kb
BusPDP11.IOPAGE_MASK = BusPDP11.IOPAGE_LENGTH - 1;
BusPDP11.MAX_MEMORY = BusPDP11.IOPAGE_UNIBUS - 16384; // Maximum memory address (need less memory for BSD 2.9 boot)
BusPDP11.MAX_ADDRESS = 0x400000; /*020000000*/ // Register addresses are above 22 bit addressing
BusPDP11.ERROR = {
RANGE_INUSE: 1,
@ -191,7 +188,7 @@ BusPDP11.IOController = {
var afn = bus.aIOHandlers[off];
if (afn) {
if (afn[0]) {
b = afn[0](addr);
b = afn[0](addr) & 0xff; // we mask the result of readByte() in case the caller is re-using their readWord() handler
} else if (afn[2]) {
if (!(addr & 0x1)) {
b = afn[2](addr) & 0xff;
@ -209,13 +206,13 @@ BusPDP11.IOController = {
}
if (b >= 0) {
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
this.dbg.printMessage(afn[5] + ".readByte(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(b), true, true);
this.dbg.printMessage(afn[4] + ".readByte(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(b), true, true);
}
return b;
}
b = bus.fnIOAccess(addr | BusPDP11.IOPAGE_22BIT, -1, 1);
b = bus.unknownAccess(addr | BusPDP11.IOPAGE_22BIT, -1, 1);
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
this.dbg.printMessage("warning: unconverted read access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b));
this.dbg.printMessage("warning: unconverted read access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b), true, true);
}
return b;
},
@ -274,13 +271,13 @@ BusPDP11.IOController = {
}
if (fWrite) {
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
this.dbg.printMessage(afn[5] + ".writeByte(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(b) + ")", true, true);
this.dbg.printMessage(afn[4] + ".writeByte(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(b) + ")", true, true);
}
return;
}
bus.fnIOAccess(addr | BusPDP11.IOPAGE_22BIT, b, 1);
bus.unknownAccess(addr | BusPDP11.IOPAGE_22BIT, b, 1);
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
this.dbg.printMessage("warning: unconverted write access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b));
this.dbg.printMessage("warning: unconverted write access to byte @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(b), true, true);
}
},
@ -296,7 +293,6 @@ BusPDP11.IOController = {
{
var w = -1;
var bus = this.controller;
Component.assert(!(addr & 1)); // unaligned addresses should be getting trapped at a higher level
var afn = bus.aIOHandlers[off];
if (afn) {
if (afn[2]) {
@ -307,13 +303,13 @@ BusPDP11.IOController = {
}
if (w >= 0) {
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
this.dbg.printMessage(afn[5] + ".readWord(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(w), true, true);
this.dbg.printMessage(afn[4] + ".readWord(" + this.dbg.toStrBase(addr) + "): " + this.dbg.toStrBase(w), true, true);
}
return w;
}
w = bus.fnIOAccess(addr | BusPDP11.IOPAGE_22BIT, -1, 0);
w = bus.unknownAccess(addr | BusPDP11.IOPAGE_22BIT, -1, 0);
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
this.dbg.printMessage("warning: unconverted read access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w));
this.dbg.printMessage("warning: unconverted read access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w), true, true);
}
return w;
},
@ -330,7 +326,6 @@ BusPDP11.IOController = {
{
var fWrite = false;
var bus = this.controller;
Component.assert(!(addr & 1)); // unaligned addresses should be getting trapped at a higher level
var afn = bus.aIOHandlers[off];
if (afn) {
if (afn[3]) {
@ -344,13 +339,13 @@ BusPDP11.IOController = {
}
if (fWrite) {
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
this.dbg.printMessage(afn[5] + ".writeWord(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(w) + ")", true, true);
this.dbg.printMessage(afn[4] + ".writeWord(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(w) + ")", true, true);
}
return;
}
bus.fnIOAccess(addr | BusPDP11.IOPAGE_22BIT, w, 0);
bus.unknownAccess(addr | BusPDP11.IOPAGE_22BIT, w, 0);
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
this.dbg.printMessage("warning: unconverted write access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w));
this.dbg.printMessage("warning: unconverted write access to word @" + this.dbg.toStrBase(addr) + ": " + this.dbg.toStrBase(w), true, true);
}
}
};
@ -364,7 +359,7 @@ BusPDP11.IOController = {
*/
BusPDP11.prototype.initMemory = function()
{
var block = new MemoryPDP11();
var block = new MemoryPDP11(this.cpu);
block.copyBreakpoints(this.dbg);
this.aMemBlocks = new Array(this.nBlockTotal);
for (var iBlock = 0; iBlock < this.nBlockTotal; iBlock++) {
@ -414,18 +409,19 @@ BusPDP11.prototype.getControllerAccess = function()
/**
* reset()
*
* The Device component initializes fnReset by calling addIODefaultHandlers() from its initBus() function;
* it will be that function's responsibility to reset all the necessary devices.
* Call all registered reset() handlers.
*
* @this {BusPDP11}
*/
BusPDP11.prototype.reset = function()
{
if (this.fnReset) this.fnReset();
for (var i = 0; i < this.afnReset.length; i++) {
this.afnReset[i]();
}
};
/**
* unknownIO(addr, data, byteFlag)
* unknownAccess(addr, data, byteFlag)
*
* This is our default I/O handler, called whenever there's an IOPAGE access without a corresponding entry
* in aIOHandlers; in the interim, our Device component will override this default handler with its own function
@ -437,12 +433,12 @@ BusPDP11.prototype.reset = function()
* @param {number} data (-1 if read, otherwise write)
* @param {number} byteFlag (true if byte I/O, otherwise word)
*/
BusPDP11.prototype.unknownIO = function(addr, data, byteFlag)
BusPDP11.prototype.unknownAccess = function(addr, data, byteFlag)
{
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.BUS)) {
this.dbg.printMessage("warning: unrecognized I/O access(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(data) + "," + byteFlag + ")");
if (DEBUGGER && this.dbg && this.dbg.messageEnabled(MessagesPDP11.WARN)) {
this.dbg.printMessage("warning: unrecognized I/O access(" + this.dbg.toStrBase(addr) + "," + this.dbg.toStrBase(data) + "," + byteFlag + ")", true, true);
}
return 0;
this.cpu.trap(PDP11.TRAP.BUS_ERROR, addr);
};
/**
@ -537,7 +533,7 @@ BusPDP11.prototype.addMemory = function(addr, size, type, controller)
return this.reportError(BusPDP11.ERROR.RANGE_INUSE, addrNext, sizeLeft);
}
var blockNew = new MemoryPDP11(addrNext, sizeBlock, this.nBlockSize, type, controller);
var blockNew = new MemoryPDP11(this.cpu, addrNext, sizeBlock, this.nBlockSize, type, controller);
blockNew.copyBreakpoints(this.dbg, block);
this.aMemBlocks[iBlock++] = blockNew;
@ -675,7 +671,7 @@ BusPDP11.prototype.removeMemory = function(addr, size)
var iBlock = addr >>> this.nBlockShift;
while (size > 0) {
var blockOld = this.aMemBlocks[iBlock];
var blockNew = new MemoryPDP11(addr);
var blockNew = new MemoryPDP11(this.cpu, addr);
blockNew.copyBreakpoints(this.dbg, blockOld);
this.aMemBlocks[iBlock++] = blockNew;
addr = iBlock * this.nBlockSize;
@ -761,7 +757,7 @@ BusPDP11.prototype.setMemoryBlocks = function(addr, size, aBlocks, type)
this.assert(block);
if (!block) break;
if (type !== undefined) {
var blockNew = new MemoryPDP11(addr);
var blockNew = new MemoryPDP11(this.cpu, addr);
blockNew.clone(block, type, this.dbg);
block = blockNew;
}
@ -1044,7 +1040,7 @@ BusPDP11.prototype.addIOHandlers = function(start, end, fnReadByte, fnWriteByte,
Component.warning("I/O address already registered: " + str.toHexLong(addr));
continue;
}
this.aIOHandlers[off] = [fnReadByte, fnWriteByte, fnReadWord, fnWriteWord, false, sName || "unknown"];
this.aIOHandlers[off] = [fnReadByte, fnWriteByte, fnReadWord, fnWriteWord, sName || "unknown", false];
if (MAXDEBUG) this.log("addIOHandlers(" + str.toHexLong(addr) + ")");
}
};
@ -1062,6 +1058,7 @@ BusPDP11.prototype.addIOTable = function(component, table)
{
for (var port in table) {
var afn = table[port];
if (afn[5] && afn[5] > this.cpu.model) continue;
var fnReadByte = afn[0]? afn[0].bind(component) : null;
var fnWriteByte = afn[1]? afn[1].bind(component) : null;
var fnReadWord = afn[2]? afn[2].bind(component) : null;
@ -1071,18 +1068,14 @@ BusPDP11.prototype.addIOTable = function(component, table)
};
/**
* addIODefaultHandlers(fnReset, fnIOAccess)
*
* Add default I/O notification handlers.
* addResetHandler(fnReset)
*
* @this {BusPDP11}
* @param {function()} fnReset
* @param {function(number,number,number)} fnIOAccess
*/
BusPDP11.prototype.addIODefaultHandlers = function(fnReset, fnIOAccess)
BusPDP11.prototype.addResetHandler = function(fnReset)
{
this.fnReset = fnReset;
this.fnIOAccess = fnIOAccess;
this.afnReset.push(fnReset);
};
/**

View file

@ -151,7 +151,6 @@ CPUStatePDP11.prototype.initRegs = function()
this.mmuMode = 0; // current memory management mode (see PDP11.MODE.KERNEL | SUPER | UNUSED | USER)
this.mmuLastPage = 0;
this.mmuLastVirtual = 0;
this.mapMMR3 = [4,2,0,1]; // map from mode to MMR3 I/D bit
this.mmuPDR = [ // memory management PDR registers by mode
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // kernel 0
@ -165,20 +164,14 @@ CPUStatePDP11.prototype.initRegs = function()
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // mode 2 (not used)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // user 3
];
this.mmuMap = [ // memory management register by mode - 16 PDR (8 I then 8 D descriptors) followed by 16 PAR (I/D addresses)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // kernel
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // super
[0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // illegal mode 2 requires illegal PDRs
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // user
];
this.unibusMap = [ // 32 unibus map registers
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
];
this.controlReg = [ // various control registers we don't really care about
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
this.regsControl = [ // various control registers we don't really care about
0, 0, 0, 0, 0, 0, 0, 0
];
this.regMB = 0;
/*
* opFlags contains various triggers that stepCPU() needs to be aware of
@ -269,7 +262,6 @@ CPUStatePDP11.prototype.getMMR0 = function()
*
* @this {CPUStatePDP11}
* @param {number} newMMR0
* @return {number}
*/
CPUStatePDP11.prototype.setMMR0 = function(newMMR0)
{
@ -286,7 +278,45 @@ CPUStatePDP11.prototype.setMMR0 = function(newMMR0)
this.mmuEnable = 0;
}
this.initMemoryAccess();
return this.regMMR0;
};
/**
* getMMR1()
*
* @this {CPUStatePDP11}
* @return {number}
*/
CPUStatePDP11.prototype.getMMR1 = function()
{
var result = this.regMMR1;
if (result & 0xff00) {
result = ((result << 8) | (result >> 8)) & 0xffff;
}
return result;
};
/**
* setMMR3()
*
* @this {CPUStatePDP11}
* @param {number} newMMR3
*/
CPUStatePDP11.prototype.setMMR3 = function(newMMR3)
{
/*
* Don't allow 11/45 to do 22 bit or use unibus map
*/
if (this.cpuType !== 70) {
newMMR3 &= ~(PDP11.MMR3.MMU_22BIT | PDP11.MMR3.UNIBUS_MAP);
}
this.regMMR3 = newMMR3;
if (this.regMMR3 & PDP11.MMR3.MMU_22BIT) {
this.mmuMask = 0x3fffff;
this.mmuMemorySize = BusPDP11.MAX_MEMORY;
} else {
this.mmuMask = 0x3ffff;
this.mmuMemorySize = BusPDP11.IOPAGE_18BIT;
}
};
/**
@ -772,6 +802,58 @@ CPUStatePDP11.prototype.setPSW = function(newPSW)
this.regPSW = newPSW;
};
/**
* getSL()
*
* @this {CPUStatePDP11}
* @return {number}
*/
CPUStatePDP11.prototype.getSL = function()
{
return this.regSL & 0xff00;
};
/**
* setSL(newSL)
*
* @this {CPUStatePDP11}
* @param {number} newSL
*/
CPUStatePDP11.prototype.setSL = function(newSL)
{
this.regSL = newSL | 0xff;
};
/**
* getPIR()
*
* @this {CPUStatePDP11}
* @return {number}
*/
CPUStatePDP11.prototype.getPIR = function()
{
return this.regPIR;
};
/**
* setPIR(newPIR)
*
* @this {CPUStatePDP11}
* @param {number} newPIR
*/
CPUStatePDP11.prototype.setPIR = function(newPIR)
{
newPIR &= 0xfe00;
if (newPIR) {
var i = newPIR >> 9;
do {
newPIR += 0x22;
} while (i >>= 1);
}
this.regPIR = newPIR;
this.opFlags |= PDP11.OPFLAG.INTQ;
};
/**
* updateNZVFlags(result)
*
@ -926,6 +1008,19 @@ CPUStatePDP11.prototype.updateSubFlags = function(result, src, dst)
}
};
/**
* fault(addr)
*
* Memory interface for signaling alignment errors.
*
* @this {CPUStatePDP11}
* @param {number} addr
*/
CPUStatePDP11.prototype.fault = function(addr)
{
this.trap(PDP11.TRAP.BUS_ERROR, addr);
};
/**
* panic(reason)
*
@ -992,7 +1087,7 @@ CPUStatePDP11.prototype.trap = function(vector, reason)
if (DEBUG && this.dbg) {
if (this.messageEnabled(MessagesPDP11.TRAP)) {
this.printMessage("trap to vector " + this.dbg.toStrBase(vector, 0, true) + (reason? " (reason " + reason + ")" : ""), MessagesPDP11.TRAP, true);
this.printMessage("trap to vector " + this.dbg.toStrBase(vector, 0, true) + (reason? " (" + this.dbg.toStrBase(reason) + ")" : ""), MessagesPDP11.TRAP, true);
}
}
@ -1057,7 +1152,7 @@ CPUStatePDP11.prototype.mapUnibus = function(unibusAddress)
* the operation access mask (accessFlags). If there is no match then the virtual
* address is simply mapped as a 16 bit physical address with the upper page going
* to the IO address space. Significant access mask values used are PDP11.ACCESS.READ
* and PDP11.ACCESS.WRITE
* and PDP11.ACCESS.WRITE.
*
* As an aside it turns out that it is the memory management unit that does odd address
* and non-existent memory trapping: who knew? :-) I thought these would have been
@ -1106,11 +1201,6 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFl
physicalAddress = ((this.mmuPAR[this.mmuMode][page] << 6) + (virtualAddress & 0x1fff)) & this.mmuMask;
if (physicalAddress < this.mmuMemorySize) {
/*
* I'm leaving this code here, per Paul's comments above, but it does surprisingly redundant
* to have to perform this check here AND at the physical level (see readWordFromPhysical() and
* writeWordToPhysical()).
*/
if ((physicalAddress & 1) && !(accessFlags & PDP11.ACCESS.BYTE)) {
this.regErr |= PDP11.CPUERR.ODDADDR;
this.trap(PDP11.TRAP.BUS_ERROR, PDP11.REASON.ODDMEMADDR);
@ -1465,10 +1555,6 @@ CPUStatePDP11.prototype.getVirtualAddrByMode = function(mode, reg, accessFlags)
*/
CPUStatePDP11.prototype.readWordFromPhysical = function(physicalAddress)
{
if (physicalAddress & 0x1) {
this.regErr |= PDP11.CPUERR.ODDADDR;
this.trap(PDP11.TRAP.BUS_ERROR, PDP11.REASON.ODDMEMADDR);
}
return this.bus.getWord(physicalAddress);
};
@ -1483,7 +1569,7 @@ CPUStatePDP11.prototype.readWordFromPhysical = function(physicalAddress)
*/
CPUStatePDP11.prototype.readWordFromVirtual = function(virtualAddress)
{
return this.readWordFromPhysical(this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.READ_WORD));
return this.bus.getWord(this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.READ_WORD));
};
/**
@ -1497,10 +1583,6 @@ CPUStatePDP11.prototype.readWordFromVirtual = function(virtualAddress)
*/
CPUStatePDP11.prototype.writeWordToPhysical = function(physicalAddress, data)
{
if (physicalAddress & 0x1) {
this.regErr |= PDP11.CPUERR.ODDADDR;
this.trap(PDP11.TRAP.BUS_ERROR, PDP11.REASON.ODDMEMADDR);
}
this.bus.setWord(physicalAddress, data & 0xffff);
};
@ -1515,7 +1597,7 @@ CPUStatePDP11.prototype.writeWordToPhysical = function(physicalAddress, data)
*/
CPUStatePDP11.prototype.writeWordToVirtual = function(virtualAddress, data)
{
this.writeWordToPhysical(this.mapVirtualToPhysical(virtualAddress | PDP11.ACCESS.DSPACE, PDP11.ACCESS.WRITE_WORD), data);
this.bus.setWord(this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.WRITE_WORD), data);
};
/**
@ -1575,14 +1657,14 @@ CPUStatePDP11.prototype.writeWordToPrevSpace = function(opCode, accessFlags, dat
if (!(accessFlags & PDP11.ACCESS.DSPACE)) addr &= 0xffff;
/*
* TODO: Consider replacing the following code with writeWordToAddr(), by adding optional mmuMode
* parameters for each of the discrete mapVirtualToPhysical() and writeWordToPhysical() operations,
* because as it stands, this is the only remaining call to mapVirtualToPhysical() outside of our
* parameters for each of the discrete mapVirtualToPhysical() and bus.setWord() operations, because
* as it stands, this is the only remaining call to mapVirtualToPhysical() outside of our
* initMemoryAccess() handlers.
*/
this.mmuMode = (this.regPSW >> 12) & 3;
addr = this.mapVirtualToPhysical(addr | (accessFlags & PDP11.ACCESS.DSPACE), PDP11.ACCESS.WRITE);
this.mmuMode = (this.regPSW >> 14) & 3;
this.writeWordToPhysical(addr, data);
this.bus.setWord(addr, data);
}
};
@ -1623,7 +1705,7 @@ CPUStatePDP11.prototype.readSrcWord = function(opCode)
if (!mode) {
result = this.regsGen[reg];
} else {
result = this.readWordFromPhysical(this.getAddrByMode(mode, reg, PDP11.ACCESS.READ_WORD));
result = this.bus.getWord(this.getAddrByMode(mode, reg, PDP11.ACCESS.READ_WORD));
}
return result;
};
@ -1677,7 +1759,7 @@ CPUStatePDP11.prototype.readDstWord = function(opCode)
if (!mode) {
result = this.regsGen[reg];
} else {
result = this.readWordFromPhysical(this.getAddrByMode(mode, reg, PDP11.ACCESS.READ_WORD));
result = this.bus.getWord(this.getAddrByMode(mode, reg, PDP11.ACCESS.READ_WORD));
}
return result;
};
@ -1722,7 +1804,7 @@ CPUStatePDP11.prototype.updateDstWord = function(opCode, src, fnOp)
this.regsGen[reg] = fnOp.call(this, src, this.regsGen[reg]);
} else {
var addr = this.getAddrByMode(mode, reg, PDP11.ACCESS.UPDATE_WORD);
this.writeWordToPhysical(addr, fnOp.call(this, src, this.readWordFromPhysical(addr)));
this.bus.setWord(addr, fnOp.call(this, src, this.bus.getWord(addr)));
}
};
@ -1772,7 +1854,7 @@ CPUStatePDP11.prototype.writeDstWord = function(opCode, data)
if (!mode) {
this.regsGen[reg] = data & 0xffff;
} else {
this.writeWordToPhysical(this.getAddrByMode(mode, reg, PDP11.ACCESS.WRITE_WORD), data);
this.bus.setWord(this.getAddrByMode(mode, reg, PDP11.ACCESS.WRITE_WORD), data);
}
return data;
};

View file

@ -589,7 +589,7 @@ if (DEBUGGER) {
if (addr !== PDP11.ADDR_INVALID) {
this.nDisableMessages++;
/*
* TODO: We also need a Bus interface to disable fnIOAccess() calls that could trigger a trap().
* TODO: We also need a Bus interface to disable accesses that could trigger a trap().
*/
b = this.bus.getByteDirect(addr);
this.nDisableMessages--;
@ -613,7 +613,7 @@ if (DEBUGGER) {
if (addr !== PDP11.ADDR_INVALID) {
this.nDisableMessages++;
/*
* TODO: We also need a Bus interface to disable fnIOAccess() calls that could trigger a trap().
* TODO: We also need a Bus interface to disable accesses that could trigger a trap().
*
* NOTE: We don't care if the word address is aligned, because 1) we assume the user knows what
* they're doing, and 2) the Bus simply ignores the low address bit anyway. Alignment checks are
@ -640,7 +640,7 @@ if (DEBUGGER) {
if (addr !== PDP11.ADDR_INVALID) {
this.nDisableMessages++;
/*
* TODO: We also need a Bus interface to disable fnIOAccess() calls that could trigger a trap().
* TODO: We also need a Bus interface to disable accesses that could trigger a trap().
*/
this.bus.setByteDirect(addr, b);
this.nDisableMessages--;
@ -663,7 +663,7 @@ if (DEBUGGER) {
if (addr !== PDP11.ADDR_INVALID) {
this.nDisableMessages++;
/*
* TODO: We also need a Bus interface to disable fnIOAccess() calls that could trigger a trap().
* TODO: We also need a Bus interface to disable accesses that could trigger a trap().
*
* NOTE: We don't care if the word address is aligned, because 1) we assume the user knows what
* they're doing, and 2) the Bus simply ignores the low address bit anyway. Alignment checks are

View file

@ -455,11 +455,40 @@ var PDP11 = {
UDSAR6: 0o177674, // User D Space Address Register 6
UDSAR7: 0o177676, // User D Space Address Register 7
SIZE_LO: 0o177760, // Lower Size Register (last 32-word block) (11/70 only?)
SIZE_HI: 0o177762, // Upper Size Register (always zero) (11/70 only?)
SYSID: 0o177764, // System ID Register (11/70 only?)
CPUERR: 0o177766, // CPU error (11/70 only?)
MB: 0o177770, // Microprogram break (11/70 only?)
R0SET0: 0o177700,
R1SET0: 0o177701,
R2SET0: 0o177702,
R3SET0: 0o177703,
R4SET0: 0o177704,
R5SET0: 0o177705,
R6KERNEL: 0o177706,
R7KERNEL: 0o177707,
R0SET1: 0o177710,
R1SET1: 0o177711,
R2SET1: 0o177712,
R3SET1: 0o177713,
R4SET1: 0o177714,
R5SET1: 0o177715,
R6SUPER: 0o177716,
R6USER: 0o177717,
/*
* This next group of registers is largely ignored; all accesses are routed to regsControl[]
*/
LAERR: 0o177740, // Low Address Error (11/70 only)
HAERR: 0o177742, // High Address Error (11/70 only)
MEMERR: 0o177744, // Memory System Error (11/70 only)
CACHEC: 0o177746, // Cache Control (11/70 only)
MAINT: 0o177750, // Maintenance (11/70 only)
HITMISS: 0o177752, // Hit/Miss (11/70 only)
UNDEF1: 0o177754,
UNDEF2: 0o177756,
LSIZE: 0o177760, // Lower Size Register (last 32-word block) (11/70 only)
HSIZE: 0o177762, // Upper Size Register (always zero) (11/70 only)
SYSID: 0o177764, // System ID Register (11/70 only)
CPUERR: 0o177766, // CPU error (11/70 only)
MB: 0o177770, // Microprogram break
PIR: 0o177772, // Program Interrupt Request
SL: 0o177774, // Stack Limit Register
PSW: 0o177776 // 777776 17777776 0x3FFFFE Processor Status Word

File diff suppressed because it is too large Load diff

View file

@ -56,7 +56,7 @@ var littleEndian = (TYPEDARRAYS? (function() {
})() : false);
/**
* MemoryPDP11(addr, used, size, type, controller)
* MemoryPDP11(cpu, addr, used, size, type, controller)
*
* The Bus component allocates Memory objects so that each has a memory buffer with a
* block-granular starting address and an address range equal to bus.nBlockSize; however,
@ -89,15 +89,17 @@ var littleEndian = (TYPEDARRAYS? (function() {
* is available).
*
* @constructor
* @param {CPUStatePDP11} cpu
* @param {number|null} [addr] of lowest used address in block
* @param {number} [used] portion of block in bytes (0 for none); must be a multiple of 4
* @param {number} [size] of block's buffer in bytes (0 for none); must be a multiple of 4
* @param {number} [type] is one of the MemoryPDP11.TYPE constants (default is MemoryPDP11.TYPE.NONE)
* @param {Object} [controller] is an optional memory controller component
*/
function MemoryPDP11(addr, used, size, type, controller)
function MemoryPDP11(cpu, addr, used, size, type, controller)
{
var i;
this.cpu = cpu;
this.id = (MemoryPDP11.idBlock += 2);
this.adw = null;
this.offset = 0;
@ -621,6 +623,9 @@ MemoryPDP11.prototype = {
* @return {number}
*/
readWordMemory: function readWordMemory(off, addr) {
if (PDP11.WORDBUS && (off & 0x1)) {
this.cpu.fault(addr);
}
if (BYTEARRAYS) {
return this.ab[off] | (this.ab[off + 1] << 8);
}
@ -662,6 +667,9 @@ MemoryPDP11.prototype = {
* @param {number} addr
*/
writeWordMemory: function writeWordMemory(off, w, addr) {
if (PDP11.WORDBUS && (off & 0x1)) {
this.cpu.fault(addr);
}
if (BYTEARRAYS) {
this.ab[off] = (w & 0xff);
this.ab[off + 1] = (w >> 8);
@ -769,6 +777,9 @@ MemoryPDP11.prototype = {
* @return {number}
*/
readWordBE: function readWordBE(off, addr) {
if (PDP11.WORDBUS && (off & 0x1)) {
this.cpu.fault(addr);
}
return this.dv.getUint16(off, true);
},
/**
@ -785,7 +796,10 @@ MemoryPDP11.prototype = {
* for an aligned read vs. always reading the bytes separately.
*/
var w;
if (PDP11.WORDBUS || !(off & 0x1)) {
if (PDP11.WORDBUS && (off & 0x1)) {
this.cpu.fault(addr);
}
if (!(off & 0x1)) {
w = this.aw[off >> 1];
} else {
w = this.ab[off] | (this.ab[off+1] << 8);
@ -831,6 +845,9 @@ MemoryPDP11.prototype = {
* @param {number} w
*/
writeWordBE: function writeWordBE(off, w, addr) {
if (PDP11.WORDBUS && (off & 0x1)) {
this.cpu.fault(addr);
}
this.dv.setUint16(off, w, true);
this.fDirty = true;
},
@ -847,7 +864,10 @@ MemoryPDP11.prototype = {
* TODO: For non-WORDBUS machines, it remains to be seen if there's any advantage to checking the offset
* for an aligned write vs. always writing the bytes separately.
*/
if (PDP11.WORDBUS || !(off & 0x1)) {
if (PDP11.WORDBUS && (off & 0x1)) {
this.cpu.fault(addr);
}
if (!(off & 0x1)) {
this.aw[off >> 1] = w;
} else {
this.ab[off] = w;

85
modules/pdp11/lib/rk11.js Normal file
View file

@ -0,0 +1,85 @@
/**
* @fileoverview Implements RK11 device support.
* @author <a href="mailto:Jeff@pcjs.org">Jeff Parsons</a>
* @copyright Jeff Parsons 2012-2016
*
* This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
*
* It has been adapted from the JavaScript PDP 11/70 Emulator v1.3 written by Paul Nankervis
* (paulnank@hotmail.com) as of August 2016 from http://skn.noip.me/pdp11/pdp11.html. This code
* may be used freely provided the original author name is acknowledged in any modified source code.
*
* PCjs is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCjs. If not,
* see <http://www.gnu.org/licenses/gpl.html>.
*
* You are required to include the above copyright notice in every source code file of every
* copy or modified version of this work, and to display that copyright notice on every screen
* that loads or runs any version of this software (see COPYRIGHT in /modules/shared/lib/defines.js).
*
* Some PCjs files also attempt to load external resource files, such as character-image files,
* ROM files, and disk image files. Those external resource files are not considered part of PCjs
* for purposes of the GNU General Public License, and the author does not claim any copyright
* as to their contents.
*/
"use strict";
if (NODE) {
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
var State = require("../../shared/lib/state");
var BusPDP11 = require("./bus");
}
/**
* RK11(parmsDevice)
*
* @constructor
* @extends Component
* @param {Object} parmsRK11
*/
function RK11(parmsRK11)
{
Component.call(this, "RK11", parmsRK11, RK11);
this.rkds = 0x9C0;/*04700*/ // 017777400 Drive Status
this.rker = 0; // 017777402 Error Register
this.rkcs = 0x80; /*0200*/ // 017777404 Control Status
this.rkwc = 0; // 017777406 Word Count
this.rkba = 0; // 017777410 Bus Address
this.rkda = 0; // 017777412 Disk Address
this.rkdb = 0; // 017777416 Data Buffer
this.meta = [];
this.TRACKS = [406, 406, 406, 406];
this.SECTORS = [12, 12, 12, 12];
}
Component.subclass(RK11);
/**
* initBus(cmp, bus, cpu, dbg)
*
* @this {DevicePDP11}
* @param {ComputerPDP11} cmp
* @param {BusPDP11} bus
* @param {CPUStatePDP11} cpu
* @param {DebuggerPDP11} dbg
*/
RK11.prototype.initBus = function(cmp, bus, cpu, dbg)
{
this.bus = bus;
this.cpu = cpu;
this.dbg = dbg;
this.setReady();
};
if (NODE) module.exports = RK11;

View file

@ -683,239 +683,221 @@
*/
var h;
function aa(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 ca(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 da(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}function fa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ga(){var a=ha();return-1!==a.indexOf("pcjs.org",a.length-8)}var ia={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function ja(a){return a.replace(/[&<>"']/g,function(a){return ia[a]})}function oa(a,b){return(a+" ").slice(0,b)}
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"};
function ra(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,k;k=c(b,a[g]);0<k?d=g+1:(e=g,f=!k)}return f?d:~d}var sa=Date.now||function(){return+new Date};function ta(){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 ua(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="",n;for(n in b)b.hasOwnProperty(n)&&(m&&(m+="&"),m+=n+"="+encodeURIComponent(b[n]));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 ha(){return"http://"+(window?window.location.host:"www.pcjs.org")}
function q(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 Da(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ea(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 Fa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Ga(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 Ha={init:[],show:[],exit:[]},Ia=!1,Ja=!1,Ka=!0;function La(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ma(a){Ha.init.push(a)}
function Na(a){if(Ka)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 Oa(a){!Ka&&a?(Ka=!0,Ia&&Ua("init"),Ja&&Ua("show")):Ka=a}function Ua(a){Ha[a]&&Na(Ha[a])}La("onload",function(){Ia=!0;Na(Ha.init)});La("onpageshow",function(){Ja=!0;Na(Ha.show)});La(Ea("Opera")||Ea("iOS")?"onunload":"onbeforeunload",function(){Na(Ha.exit)});
function u(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.yc=b.comment;this.$c=b;b=this.id.indexOf(".");0>b?this.Sb=this.id:(this.fc=this.id.substr(0,b),this.Sb=this.id.substr(b+1));this[a]=c;this.v={ready:!1,Gb:!1,gc:!1,ja:!1,error:!1};this.Ub=null;this.v.error=!1;this.L={};this.j=null;this.ma=d||0;v.push(this)}var Va=void 0,Wa={};
if(window){Va||(Va=window.location.search.substr(1));for(var Xa,Ya=/\+/g,Za=/([^&=]+)=?([^&]*)/g;Xa=Za.exec(Va);)Wa[decodeURIComponent(Xa[1].replace(Ya," "))]=decodeURIComponent(Xa[2].replace(Ya," "))}function $a(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 y(a,b){b||(b=u);a.prototype=$a(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var ab=window.PCjs.Machines||(window.PCjs.Machines={}),v=window.PCjs.Components||(window.PCjs.Components=[])}else ab={},v=[];function bb(a,b,c){ab[a]&&b&&(ab[a][b]=c)}function cb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<v.length;b++){var d=v[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function db(a){if(void 0!==a){var b;for(b=0;b<v.length;b++)if(v[b].id===a)return v[b]}return null}function eb(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<v.length;d++)if(c)c==v[d]&&(c=null);else if(!(a!=v[d].type||b&&v[d].id.indexOf(b)))return v[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){q(c.message+" ("+a+")")}return b}
function fb(a,b){b=A(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=z(f))&&g.binding&&a.pa(g.type,g.binding,f,g.value),m=k.length}}}}
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function ba(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 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 da(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}function ea(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function fa(){var a=ga();return-1!==a.indexOf("pcjs.org",a.length-8)}var ha={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function ma(a){return a.replace(/[&<>"']/g,function(a){return ha[a]})}function na(a,b){return(a+" ").slice(0,b)}
function oa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var pa={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 qa(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,l;l=c(b,a[g]);0<l?d=g+1:(e=g,f=!l)}return f?d:~d}var 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 ua(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 n="",p;for(p in b)b.hasOwnProperty(p)&&(n&&(n+="&"),n+=p+"="+encodeURIComponent(b[p]));n=n.replace(/%20/g,"+");l.open("POST",a,!!c);l.setRequestHeader("Content-type","application/x-www-form-urlencoded");l.send(n)}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 ga(){return"http://"+(window?window.location.host:"www.pcjs.org")}
function m(a){window&&window.alert(a)}function va(a){var b=!1;window&&(b=window.confirm(a));return b}var wa=null;function xa(){if(null==wa){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}wa=a}return wa}function Ba(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
function Ca(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Da(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 Ea(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Fa(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 Ga={init:[],show:[],exit:[]},Ha=!1,Ia=!1,Ja=!0;function Ka(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function La(a){Ga.init.push(a)}
function Ma(a){if(Ja)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){m(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Sa(a){!Ja&&a?(Ja=!0,Ha&&Ta("init"),Ia&&Ta("show")):Ja=a}function Ta(a){Ga[a]&&Ma(Ga[a])}Ka("onload",function(){Ha=!0;Ma(Ga.init)});Ka("onpageshow",function(){Ia=!0;Ma(Ga.show)});Ka(Da("Opera")||Da("iOS")?"onunload":"onbeforeunload",function(){Ma(Ga.exit)});
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Rb=b.comment;this.xc=b;b=this.id.indexOf(".");0>b?this.Ya=this.id:(this.zb=this.id.substr(0,b),this.Ya=this.id.substr(b+1));this[a]=c;this.v={ready:!1,ib:!1,xb:!1,fa:!1,error:!1};this.rb=null;this.v.error=!1;this.J={};this.j=null;this.ha=d||0;t.push(this)}var Ua=void 0,Va={};
if(window){Ua||(Ua=window.location.search.substr(1));for(var Wa,Xa=/\+/g,Ya=/([^&=]+)=?([^&]*)/g;Wa=Ya.exec(Ua);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function Za(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 y(a,b){b||(b=r);a.prototype=Za(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var $a=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else $a={},t=[];function ab(a,b,c){$a[a]&&b&&($a[a][b]=c)}function bb(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 cb(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 db(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 z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){m(c.message+" ("+a+")")}return b}
function eb(a,b){b=A(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(" "),n=0;n<l.length;n++)switch(g=l[n],g){case "pdp11-binding":(g=z(f))&&g.binding&&a.ja(g.type,g.binding,f,g.value),n=l.length}}}}
function A(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}
u.prototype={constructor:u,parent:null,toString:function(){return this.name?this.name:this.id||this.type},pa:function(a,b,c){switch(b){case "clear":return this.L[b]||(this.L[b]=c,c.onclick=function(a){return function(){a.L.print&&(a.L.print.value="")}}(this)),!0;case "print":return this.L[b]||(this.kb=this.L[b]=c,c.value="",this.i=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.ta=function(a){this.i(a,this.Sb)}),!0;default:return!1}},log:function(){},i:function(){},status:function(a){this.i(this.Sb+": "+a)},ta:function(a,b,c){c=c||this.type;b||q((c?c+": ":"")+a)},Ka:function(){return this.v.ja=!0},Ja:function(a,b){b&&(this.v.ja=!1);return!0}};function D(a,b,c,d){a.j&&(!0===c||F(a,c|0))&&a.j.message(b,d)}function F(a,b){if(a.j){a===a.j?b|=0:b=b||a.ma;var c=a.j.ma&b;return!!b&&c===b||!!(c&a.j.Tc)}return!1}
function gb(a,b){if(a.v.gc)return a.v.Gb=!1,a.v.gc=!1;if(a.v.error)return a.i(a.toString()+" error"),!1;a.v.Gb=b;return a.v.Gb}function hb(a,b){a.v.Gb&&(b?a.v.gc=!0:void 0===b&&a.i(a.toString()+" busy"));return a.v.Gb}function G(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.Ub;a.Ub=null;b&&b()}}function ib(a,b){b&&(a.v.ready?b():a.Ub=b);return a.v.ready}function jb(a){return a.v.error?(a.i(a.toString()+" error"),!0):!1}function kb(a,b){a.v.error=!0;a.ta(b)}
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ja:function(a,b,c){switch(b){case "clear":return this.J[b]||(this.J[b]=c,c.onclick=function(a){return function(){a.J.print&&(a.J.print.value="")}}(this)),!0;case "print":return this.J[b]||(this.Ta=this.J[b]=c,c.value="",this.i=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.na=function(a){this.i(a,this.Ya)}),!0;default:return!1}},log:function(){},i:function(){},status:function(a){this.i(this.Ya+": "+a)},na:function(a,b,c){c=c||this.type;b||m((c?c+": ":"")+a)},Ca:function(){return this.v.fa=!0},Ba:function(a,b){b&&(this.v.fa=!1);return!0}};function D(a,b,c,d){a.j&&(!0===c||F(a,c|0))&&a.j.message(b,d)}function F(a,b){if(a.j){a===a.j?b|=0:b=b||a.ha;var c=a.j.ha&b;return!!b&&c===b||!!(c&a.j.qc)}return!1}
function fb(a,b){if(a.v.xb)return a.v.ib=!1,a.v.xb=!1;if(a.v.error)return a.i(a.toString()+" error"),!1;a.v.ib=b;return a.v.ib}function gb(a,b){a.v.ib&&(b?a.v.xb=!0:void 0===b&&a.i(a.toString()+" busy"));return a.v.ib}function G(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.rb;a.rb=null;b&&b()}}function hb(a,b){b&&(a.v.ready?b():a.rb=b);return a.v.ready}function ib(a){return a.v.error?(a.i(a.toString()+" error"),!0):!1}function vb(a,b){a.v.error=!0;a.na(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});
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 xb="undefined"!==typeof ArrayBuffer,yb={cpu:1,trap:16,bus:64,mem:128,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function zb(a){u.call(this,"Panel",a,zb)}y(zb);h=zb.prototype;h.pa=function(a,b,c,d){return this.D&&this.D.pa(a,b,c,d)||this.b&&this.b.pa(a,b,c,d)||this.j&&this.j.pa(a,b,c,d)?!0:this.parent.pa.call(this,a,b,c,d)};h.Pa=function(a,b,c,d){this.D=a;this.F=b;this.b=c;this.j=d};
h.Ka=function(a,b){b||Ab();return!0};h.Ja=function(){return!0};h.Ga=function(){};function Ab(){for(var a=!1,b=A(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=db(e.id);f||(a=!0,f=new zb(e));fb(f,d);a&&G(f)}}Ma(Ab);
function Bb(a,b,c){u.call(this,"Bus",a,Bb,64);this.b=b;this.j=c;this.B=a.busWidth||16;this.F=Math.pow(2,this.B);this.g=this.F-1|0;this.ca=(this.B>>1)+2;10>this.ca&&(this.ca=10);15<this.ca&&(this.ca=15);this.Da=1<<this.ca;this.G=this.Da>>2;this.f=this.Da-1;this.w=this.F/this.Da|0;this.Ua=[];this.D=null;this.Hb=this.Jd;a=new H;Cb(a,this.j);this.aa=Array(this.w);for(b=0;b<this.w;b++)this.aa[b]=a;this.Db=Array(4);this.Db[0]=Db;this.Db[1]=Eb;this.Db[2]=Fb;this.Db[3]=Gb;Hb(this,this.F-8192,8192,Ib,this);
Hb(this,57344,8192,Ib,this);G(this)}y(Bb);function Db(a,b){var c=-1,d=this.controller,e=d.Ua[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.Ua[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.j&&F(this.j,64)&&D(this.j,e[5]+".readByte("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=d.Hb(b|4186112,-1,1);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to byte @"+I(this.j,b)+": "+I(this.j,c));return c}
function Eb(a,b,c){var d=!1,e=this.controller,f=e.Ua[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](c):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.Ua[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](c):0,f[3](a&255|b<<8,c),d=!0);d?this.j&&F(this.j,64)&&D(this.j,f[5]+".writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(e.Hb(c|4186112,b,1),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to byte @"+I(this.j,c)+": "+I(this.j,b)))}
function Fb(a,b){var c=-1,d=this.controller;(a=d.Ua[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.j&&F(this.j,64)&&D(this.j,a[5]+".readWord("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=d.Hb(b|4186112,-1,0);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to word @"+I(this.j,b)+": "+I(this.j,c));return c}
function Gb(a,b,c){var d=!1,e=this.controller;if(a=e.Ua[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.j&&F(this.j,64)&&D(this.j,a[5]+".writeWord("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(e.Hb(c|4186112,b,0),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to word @"+I(this.j,c)+": "+I(this.j,b)))}h=Bb.prototype;h.reset=function(){this.D&&this.D()};
h.Jd=function(a,b,c){this.j&&F(this.j,64)&&D(this.j,"warning: unrecognized I/O access("+I(this.j,a)+","+I(this.j,b)+","+c+")");return 0};h.Ka=function(a,b){b||this.reset();return!0};
function Hb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.ca;0<g&&k<a.aa.length;){var m=a.aa[k],n=k*a.Da,p=a.Da-(f-n);p>g&&(p=g);if(m&&m.size){if(m.type==d&&m.controller==e){if(f+g<=m.A)return m.Rb+=m.A-f,m.A=f,!0;if(f>=m.A+m.Rb){p=m.size-(f-n);p>g&&(p=g);m.Rb=f-m.A+p;f=n+a.Da;g-=p;k++;continue}}return Jb(1,f,g)}f=new H(f,p,a.Da,d,e);Cb(f,a.j,m);a.aa[k++]=f;f=n+a.Da;g-=p}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Kb[d]+" at "+l(b,8,!0)),!0):Jb(2,b,c)}
h.mb=function(a){return this.aa[(a&this.g)>>>this.ca].Zb(a&this.f,a)};h.Ia=function(a){return this.aa[(a&this.g)>>>this.ca].Hc(a&this.f,a)};function Lb(a,b){return a.aa[(b&a.g)>>>a.ca].mc(b&a.f,b)}h.Ob=function(a,b){this.aa[(a&this.g)>>>this.ca].cc(a&this.f,b&255,a)};h.qc=function(a,b){this.aa[(a&this.g)>>>this.ca].Pc(a&this.f,b&65535,a)};
function Mb(a){for(var b=0,c=[],d=0;d<a.w;d++){var e=a.aa[d];if(e.Xa||e.Vc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,k=0,m=[];g<e.length;){for(var n=e[g],p=g+1;p<e.length&&e[p]===n;)p++;m[k++]=p-g;m[k++]=n;g=p}m.length<e.length&&(e=m)}c[f]=e}}return c}
function Nb(a,b,c){for(var d in c)for(var e=c[d],f=e[0]?e[0].bind(b):null,g=e[1]?e[1].bind(b):null,k=e[2]?e[2].bind(b):null,m=e[3]?e[3].bind(b):null,n=a,p=+d,e=e[4],t=+d;t<=p;t+=2){var r=t&8191;void 0!==n.Ua[r]?q("I/O address already registered: "+l(t,8,!0)):n.Ua[r]=[f,g,k,m,!1,e||"unknown"]}}function Ob(a,b,c){a.D=b;a.Hb=c}function Jb(a,b,c){q("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}
function J(a){u.call(this,"Device",a,J);this.g={data:0,de:0,tb:20,Id:0};this.f={M:0,sc:-1};this.D={Mb:2496,oa:0,P:128,Nb:0,Lb:0,xa:0,Jc:0,sa:[],ib:[406,406,406,406],da:[12,12,12,12]};this.w={M:129,Fb:0,fa:0,Za:0,Va:0,gb:0,sa:[],da:[40,40,40,40],ib:[1024,1024,512,512],Qc:[157,157,29,29]};this.B={b:[8210,8208,8210,8226],da:[22,22,22,50],hb:[19,19,19,32],ec:[815,411,815,630],sa:[],T:2176,zb:0,xb:0,Fa:[0,0,0,0,0,0,0,0],Ea:0,ua:[4544,4544,4544,4544,4544,4544,4544,4544],yb:[0,0,0,0,0,0,0,0],ob:0,Fd:[0,
0,0,0,0,0,0,0],Kc:0,Lc:[0,0,0,0,0,0,0,0],j:[0,0,0,0,0,0,0,0],Gd:[1,2,3,4,5,6,7,8],Mc:[0,0,0,0,0,0,0,0],Ra:[0,0,0,0,0,0,0,0],bc:[0,0,0,0,0,0,0,0],Dd:[0,0,0,0,0,0,0,0],Ed:[0,0,0,0,0,0,0,0],Bd:[0,0,0,0,0,0,0,0],Cd:[0,0,0,0,0,0,0,0],eb:0,pc:0}}y(J);
var Pb=[4127,448,4191,450,4383,452,2591,454,21983,32768,65534,13791,16384,65534,770,2719,454,2591,65534,257,0,2566,33028,34051,33282,1281,33537,0,2758,32771,770,1025,1793,0,3078,33794,34305,513,0,5574,43690,4480,4097,4162,4227,4292,4357,57665,1281,769,0,3138,34305,1281,0,24707,2691,2627,24769,34561,1793,0,3076,20739,24899,2691,34562,2753,1281,0,2624,33537,0,16385,24641,1537,1793,0,193,8279,21589,516,12549,1538,2629,513,0,38336,65281,32769,0,32258,2561,2689,32258,3008,514,3009,769,0,5574,510,2551,
2,0,9678,208,769,0,5582,226,135,0,2598,5606,236,2,0,95,242,128,5573,57344,2591,6,5599,256,4,5574,510,3045,5599,460,76,2591,78,5571,65510,5579,12,5570,512,4224,4104,3024,8197,33788,4224,4609,8193,769,0,2640,8197,33785,6145,2625,8193,769,0,8194,761,2574,5572,43690,5579,24,5568,2048,5570,512,2628,4360,2632,2632,8708,769,0,3103,65514,34562,0,305,35406,754,258,119,65160,3024,32403,5579,36,5568,3072,35446,1,740,5570,512,4224,4104,3024,8197,33788,5569,3,2574,3039,454,528,5582,24,4224,2632,2632,8200,769,
0,3024,3103,65514,34562,0,264,8197,33779,5003,2574,32337,260,0,258,5579,12,6080,448,6081,450,6084,452,116,2,6084,65400,17860,65024,21956,62976,38848,65401,3200,161,76,0,16944,10797];h=J.prototype;h.Pa=function(a,b,c,d){this.F=b;this.b=c;this.j=d;var e=this;this.f.sc=Qb(this.b,function(){e.f.Ya|=128;e.f.Ya&64&&(K(e.b,0,6,64),Rb(e.b,e.f.sc,1E3/60))});Nb(b,this,L);Ob(b,this.reset.bind(this),this.Sc.bind(this));G(this)};h.jd=function(){var a=this.f.Ya;this.f.Ya&=-129;return a};
h.Od=function(a){this.f.Ya=a;a&64&&Rb(this.b,this.f.sc,1E3/60);this.f.Ya=a&-129};h.kd=function(){var a=this.b;return a.G&62337|a.Ba<<5|a.Ca<<1};h.Pd=function(a){var b=4,c=this.b;c.G=a&=62337;c.Ba=a>>5&3;c.Ca=a>>1&15;c.kc=a&257?a&1?6:4:0;Sb(c);a=c.G;a&1|256&&(b=this.b.bb&16?1:2);this.g.tb=this.g.tb&-8|b};h.rd=function(a){return this.b.W[1][a>>1&7]};h.Wd=function(a,b){this.b.W[1][b>>1&7]=a&65295};h.pd=function(a){return this.b.W[1][(a>>1&7)+8]};h.Ud=function(a,b){this.b.W[1][(b>>1&7)+8]=a&65295};
h.qd=function(a){return this.b.wa[1][a>>1&7]};h.Vd=function(a,b){b=b>>1&7;this.b.wa[1][b]=a;this.b.W[1][b]&=65295};h.od=function(a){return this.b.wa[1][(a>>1&7)+8]};h.Td=function(a,b){b=(b>>1&7)+8;this.b.wa[1][b]=a;this.b.W[1][b]&=65295};h.hd=function(a){return this.b.W[0][a>>1&7]};h.Nd=function(a,b){this.b.W[0][b>>1&7]=a&65295};h.fd=function(a){return this.b.W[0][(a>>1&7)+8]};h.Ld=function(a,b){this.b.W[0][(b>>1&7)+8]=a&65295};h.gd=function(a){return this.b.wa[0][a>>1&7]};
h.Md=function(a,b){b=b>>1&7;this.b.wa[0][b]=a;this.b.W[0][b]&=65295};h.ed=function(a){return this.b.wa[0][(a>>1&7)+8]};h.Kd=function(a,b){b=(b>>1&7)+8;this.b.wa[0][b]=a;this.b.W[0][b]&=65295};h.vd=function(a){return this.b.W[3][a>>1&7]};h.$d=function(a,b){this.b.W[3][b>>1&7]=a&65295};h.td=function(a){return this.b.W[3][(a>>1&7)+8]};h.Yd=function(a,b){this.b.W[3][(b>>1&7)+8]=a&65295};h.ud=function(a){return this.b.wa[3][a>>1&7]};h.Zd=function(a,b){b=b>>1&7;this.b.wa[3][b]=a;this.b.W[3][b]&=65295};
h.sd=function(a){return this.b.wa[3][(a>>1&7)+8]};h.Xd=function(a,b){b=(b>>1&7)+8;this.b.wa[3][b]=a;this.b.W[3][b]&=65295};h.ld=function(){return Tb(this.b)};h.Qd=function(a){Ub(this.b,a&-1809|Tb(this.b)&1808);this.b.C|=128};
function Vb(a){var b=a.D,c,d,e,f=b.xa>>13&7;"undefined"===typeof b.sa[f]&&(b.sa[f]={cache:[],postProcess:a.yd,drive:f,blocksize:256,mapped:0,maxblock:b.ib[f]*b.da[f],url:"rk"+f+".dsk"});b.P&=-129;switch(b.P>>1&7){case 0:b.Mb=2496;b.oa=0;b.P=128;b.xa=0;break;case 1:if((b.xa>>4&511)>=b.ib[f]){b.oa|=32832;b.P|=49152;break}if((b.xa&15)>=b.da[f]){b.oa|=32800;b.P|=49152;break}c=(b.xa>>4&511)*b.da[f]+(b.xa&15);d=(b.P&48)<<12|b.Lb;e=65536-b.Nb&65535;Wb(a,b.sa[f],c,d,e);return;case 2:if((b.xa>>4&511)>=b.ib[f])b.oa|=
32832,b.P|=49152;else if((b.xa&15)>=b.da[f])b.oa|=32800,b.P|=49152;else{c=(b.xa>>4&511)*b.da[f]+(b.xa&15);d=(b.P&48)<<12|b.Lb;e=65536-b.Nb&65535;a.$b(b.sa[f],c,d,e);return}}b.Mb=f<<13|b.Mb&8176|b.xa%9&15;K(a.b,20,5,144,function(){b.P=b.P&65534|128;return!!(b.P&64)})}h.yd=function(a,b,c,d,e){var f=this.D;f.Lb=d&65535;f.P=f.P&-49|d>>12&48;f.Nb=65536-e&65535;switch(a){case 1:f.oa|=33024;f.P|=49152;break;case 2:f.oa|=33792,f.P|=49152}K(this.b,20,5,144,function(){f.P=f.P&65534|128;return!!(f.P&64)})};
function fc(a){var b=a.w,c,d,e,f=b.M>>8&3;b.M&=-2;"undefined"===typeof b.sa[f]&&(b.sa[f]={cache:[],postProcess:a.zd,drive:f,blocksize:128,mapped:1,maxblock:b.ib[f]*b.da[f],url:"rl"+f+".dsk"});switch(b.M>>1&7){case 2:b.Za&8&&(b.M&=63);b.Za=b.Qc[f]|b.gb&64;break;case 3:1==(b.fa&3)&&(b.gb=b.fa&4?b.gb+(b.fa&65408)&65408|b.fa<<2&64:b.gb-(b.fa&65408)&65408|b.fa<<2&64,b.fa=b.gb);break;case 4:b.Za=b.gb;break;case 5:if(b.fa>>6>=b.ib[f]){b.M|=37888;break}if((b.fa&63)>=b.da[f]){b.M|=37888;break}c=(b.fa>>6)*
b.da[f]+(b.fa&63);d=(b.Va&63)<<16|b.Fb;e=65536-b.Za&65535;Wb(a,b.sa[f],c,d,e);return;case 6:if(b.fa>>6>=b.ib[f])b.M|=37888;else if((b.fa&63)>=b.da[f])b.M|=37888;else{c=(b.fa>>6)*b.da[f]+(b.fa&63);d=(b.Va&63)<<16|b.Fb;e=65536-b.Za&65535;a.$b(b.sa[f],c,d,e);return}}K(a.b,20,5,112,function(){b.M|=129;return!!(b.M&64)})}
h.zd=function(a,b,c,d,e){var f=this.w;f.Fb=d&65535;f.M=f.M&-49|d>>12&48;f.Va=d>>16&63;f.fa=~~(c/f.da[b.Na])<<6|c%f.da[b.Na];f.gb=f.fa;f.Za=65536-e&65535;switch(a){case 1:f.M|=33792;break;case 2:f.M|=40960}K(this.b,20,5,112,function(){f.M|=129;return!!(f.M&64)})};function gc(a){a=a.B;a.T=2176;a.Ea=0;a.ua=[4544,4544,4544,4544,4544,4544,4544,4544];a.yb=[0,0,0,0,0,0,0,0];a.ob=a.zb=a.xb=a.eb=a.pc=0}
function hc(a,b){var c=a.B,d,e,f;c.T&=-16513;c.Ea&=-2049;c.ua[b]&=-1153;K(a.b,-1,0,172);"undefined"===typeof c.sa[b]&&(c.sa[b]={cache:[],postProcess:a.Ad,drive:b,blocksize:256,mapped:0,maxblock:c.ec[0]*c.hb[0]*c.da[0],url:"rp"+b+".dsk"});switch(c.T&63){case 5:c.bc[b]=c.Ra[b];c.T|=32896;c.ua[b]|=32896;c.ob|=1<<b;break;case 9:gc(a);break;case 19:c.ua[b]|=64;break;case 49:if(c.Ra[b]>=c.ec[0]||c.Fa[b]>>8>=c.hb[0]||(c.Fa[b]&255)>=c.da[0]){c.yb[b]|=1024;c.T|=49152;break}d=(c.Ra[b]*c.hb[0]+(c.Fa[b]>>8))*
c.da[0]+(c.Fa[b]&255);e=(c.eb&63)<<16|c.xb;f=65536-c.zb&65535;Wb(a,c.sa[b],d,e,f);return;case 57:if(c.Ra[b]>=c.ec[0]||c.Fa[b]>>8>=c.hb[0]||(c.Fa[b]&255)>=c.da[0])c.yb[b]|=1024,c.T|=49152;else{d=(c.Ra[b]*c.hb[0]+(c.Fa[b]>>8))*c.da[0]+(c.Fa[b]&255);e=(c.eb&63)<<16|c.xb;f=65536-c.zb&65535;a.$b(c.sa[b],d,e,f);return}}K(a.b,3,5,172,function(){c.T=c.T&65534|128;c.ua[b]|=128;return!!(c.T&64)})}
h.Ad=function(a,b,c,d,e){var f=this.B;f.zb=65536-e&65535;f.xb=d&65535;f.T=f.T&-769|d>>8&768;f.eb=d>>16&63;e=~~(c/f.da[0]);d=~~(e/f.hb[0]);f.Fa[b.Na]=e%f.hb[0]<<8|c%f.da[0];f.bc[b.Na]=f.Ra[b.Na]=d;f.ob|=1<<b.Na;c>=b.bd-1&&(f.ua[b.Na]|=1024);switch(a){case 1:f.Ea|=512;f.T|=49152;break;case 2:f.Ea|=2048,f.T|=49152}K(this.b,20,5,172,function(){f.ua[b.Na]|=128;f.T=f.T&65534|128;return!!(f.T&64)})};
function ic(a,b,c,d,e,f){var g=~~((f+c.Wa-1)/c.Wa),k=new XMLHttpRequest;2048>g&&d+2048<c.bd&&(g=2048);k.open("GET",c.url,!0);k.setRequestHeader("Range","bytes="+(d*c.Wa<<1)+"-"+(((d+g)*c.Wa<<1)-1));k.responseType="arraybuffer";k.onreadystatechange=function(){if(4==k.readyState){var g=b.bind(a),n,p,t,r;n=k.response;if(k.status&&206!=k.status||!n)c.Yb(1,c,d,e,f);else{n=new Uint8Array(n);p=d;for(r=0;r<n.length;){if("undefined"===typeof c.cache[p])for(c.cache[p]=[],t=0;t<c.Wa;t++)c.cache[p][t]=r<n.length?
n[r]&255|n[r+1]<<8&65280:0,r+=2;else r+=c.Wa<<1;p++}g(c,d,e,f)}}};k.send(null)}function M(a,b,c,d,e){c&1?e?d=0<=d?d<<8&65280|b&255:b:a.b.K(4,122):0<=d?e&&(d=b&65280|d&255):d=b;return d}h.$b=function(a,b,c,d){for(var e;0<d;){if("undefined"===typeof a.cache[b]){ic(this,this.$b,a,b,c,d);return}for(e=0;e<a.Wa&&0<d;e++){if(0>this.b.Cb(a.ad?jc(this.b,c):c,a.cache[b][e])){a.Yb(2,a,b,c,d);return}c+=2;--d}b++}a.Yb(0,a,b,c,d)};
function Wb(a,b,c,d,e){for(var f,g;0<e;){if("undefined"===typeof b.cache[c])for(b.cache[c]=[],f=0;f<b.Wa;f++)b.cache[c][f]=0;for(f=0;f<b.Wa&&0<e;f++){g=a.b.wb(b.ad?jc(a.b,d):d);if(0>g){b.Yb(2,b,c,d,e);return}b.cache[c][f]=g;d+=2;--e}c++}b.Yb(0,b,c,d,e)}h.reset=function(){this.g.tb=this.g.tb&-120|20;this.f.Ya=0;this.D.P=128;this.w.M=128;gc(this)};
h.Sc=function(a,b,c){var d,e,f=this.b;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=f.cb&65280:(a&1&&(b<<=8),f.cb=b|255,d=0);break;case 4194298:if(0>b)d=f.oc;else{a&1&&(b<<=8);if(d=b&65024){e=d>>9;do d+=34;while(e>>=1)}f.oc=d;f.C|=2}break;case 4194294:if(70!==f.lb)return f.K(4,222);0>b?d=f.I:d=f.I=0;break;case 4194292:if(70!==f.lb)return f.K(4,224);d=1;break;case 4194290:if(70!==f.lb)return f.K(4,226);d=0;break;case 4194288:if(70!==f.lb)return f.K(4,228);d=61183;break;case 4194296:0<=
b&&!(a&1)&&(b&=255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==f.lb)return f.K(4,232);e=a-4194272>>1;0>b?d=f.jc[e]:(d=M(this,f.jc[e],a,b,c),0<=d&&(f.jc[e]=d));break;case 4194254:return a&1?f.O>>14&1?(0<=b&&(f.u[6]=b),d=f.u[6]):(0<=b&&(f.Aa[3]=b),d=f.Aa[3]):f.O>>14&0?(0<=b&&(f.u[6]=b),d=f.u[6]):(0<=b&&(f.Aa[1]=b),d=f.Aa[1]),d;case 4194252:case 4194250:case 4194248:return e=a&7,f.O&2048?(0<=b&&(f.u[e]=b),d=f.u[e]):(0<=b&&(f.Qa[e]=
b),d=f.Qa[e]),d;case 4194246:return a&1?(0<=b&&(f.u[7]=b),d=f.u[7]):f.O>>14&0?(0<=b&&(f.u[6]=b),d=f.u[6]):(0<=b&&(f.Aa[0]=b),d=f.Aa[0]),d;case 4194244:case 4194242:case 4194240:return e=a&7,f.O&2048?(0<=b&&(f.Qa[e]=b),d=f.Qa[e]):(0<=b&&(f.u[e]=b),d=f.u[e]),d;default:return f.I|=16,f.K(4,124)}break;case 4194176:e=a>>1&31;d=M(this,f.za[3][e],a,b,c);0<=d&&(f.za[3][e]=d,f.za[3][e&15]&=65295);break;case 4194112:switch(a&-2){case 4194174:d=M(this,f.ac,a,b,c);0<=d&&(f.ac=d);break;case 4194172:d=f.ab;d&65280&&
(d=(d<<8|d>>8)&65535);break;case 4194168:0>b?d=this.g.Id&65535:(d=M(this,this.g.data,a,b,c),0<=d&&(this.g.data=d));break;default:return f.I|=16,f.K(4,126)}break;case 4194048:e=this.D;switch(a&-2){case 4194048:d=M(this,e.Mb,a,b,c);0<=d&&(e.Mb=d);break;case 4194050:d=M(this,e.oa,a,b,c);0<=d&&(e.oa=d);break;case 4194052:d=M(this,e.P,a,b,c);0<=b&&0<=d&&(e.P=d&-36993|e.P&36992,e.P&1&&Vb(this));break;case 4194054:d=M(this,e.Nb,a,b,c);0<=d&&(e.Nb=d);break;case 4194056:d=M(this,e.Lb,a,b,c);0<=d&&(e.Lb=d);
break;case 4194058:d=M(this,e.xa,a,b,c);0<=d&&(e.xa=d);break;case 4194060:break;case 4194062:d=M(this,e.Jc,a,b,c);0<=d&&(e.Jc=d);break;default:return f.I|=16,f.K(4,128)}break;case 4193728:var g=this.B;e=g.Ea&7;switch(a&-2){case 4193728:d=M(this,g.T,a,b,c);0<=b&&0<=d&&(g.eb=g.eb&60|d>>8&3,g.T=d&17279|g.T&34944|2048,d&1&&g.T&128?hc(this,e):192==(d&192)&&K(f,0,5,172));break;case 4193730:d=M(this,g.zb,a,b,c);0<=d&&(g.zb=d);break;case 4193732:d=M(this,g.xb,a,b,c);0<=d&&(g.xb=d&65534);break;case 4193734:d=
M(this,g.Fa[e],a,b,c);0<=d&&(g.Fa[e]=d&7967);break;case 4193736:d=M(this,g.Ea,a,b,c);0<=d&&(g.Ea=d&63|g.Ea&65472,d&128&&gc(this));break;case 4193738:d=g.ua[e];break;case 4193740:d=g.yb[e];break;case 4193742:d=M(this,g.ob,a,b,c);0<=d&&(g.ob=d&255);break;case 4193744:d=g.Fd[e];break;case 4193746:d=M(this,g.Kc,a,b,c);0<=d&&(g.Kc=d);break;case 4193748:d=M(this,g.Lc[e],a,b,c);0<=d&&(g.Lc[e]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=g.Gd[e];break;case 4193754:d=M(this,g.Mc[e],a,b,c);0<=d&&
(g.Mc[e]=d);break;case 4193756:d=M(this,g.Ra[e],a,b,c);0<=d&&(g.Ra[e]=d&511);break;case 4193758:g.bc[e]=g.Ra[e];d=g.bc[e];break;case 4193760:d=g.Dd[e];break;case 4193762:d=g.Ed[e];break;case 4193764:d=g.Bd[e];break;case 4193766:d=g.Cd[e];break;case 4193768:d=M(this,g.eb,a,b,c);0<=d&&(g.eb=d&63,g.T=g.T&-769|(d&3)<<8);break;case 4193770:d=M(this,g.pc,a,b,c);0<=d&&(g.pc=d);break;default:return f.I|=16,f.K(4,132)}break;case 4192512:e=this.w;switch(a&-2){case 4192512:d=M(this,e.M,a,b,c);0<=b&&0<=d&&(e.Va=
e.Va&60|d>>4&3,e.M=e.M&-1023|d&1022,e.M&128||fc(this));break;case 4192514:d=M(this,e.Fb,a,b,c);0<=d&&(e.Fb=d&65534);break;case 4192516:d=M(this,e.fa,a,b,c);0<=d&&(e.fa=d);break;case 4192518:d=M(this,e.Za,a,b,c);0<=d&&(e.Za=d);break;case 4192520:d=M(this,e.Va,a,b,c);0<=d&&(e.Va=d&63,e.M=e.M&-49|(e.Va&3)<<4);break;default:return f.I|=16,f.K(4,134)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=f.bb:(d=M(this,f.bb,a,b,c),0<=d&&(70!==f.lb&&(d&=-49),f.bb=d,f.Xb[0]=d&4?15:7,f.Xb[1]=d&2?15:7,f.Xb[3]=
d&1?15:7,f.kc&&(e=2,f.bb&16&&(e=1),this.g.tb=this.g.tb&-8|e)));break;default:return f.I|=16,f.K(4,136)}break;case 4191424:e=a>>1&31;d=M(this,f.za[0][e],a,b,c);0<=d&&(f.za[0][e]=d,f.za[0][e&15]&=65295);break;case 4191360:e=a>>1&31;d=M(this,f.za[1][e],a,b,c);0<=d&&(f.za[1][e]=d,f.za[1][e&15]&=65295);break;case 4190400:case 4190336:if(70!==f.lb)return f.K(4,234);e=a>>2&31;d=f.Pb[e];a&2&&(d>>=16);d&=65535;0<=b&&(d=M(this,d,a,b,c),0<=d&&(f.Pb[e]=a&2?d<<16|f.Pb[e]&65535:f.Pb[e]&4294901760|d&65534));break;
case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)d=Pb[a>>1&255];else return f.I|=16,f.K(4,138);break;default:return f.I|=16,f.K(4,142)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)");return d};
var N={},L=(N[62592]=[null,null,J.prototype.rd,J.prototype.Wd,"SISDR"],N[62608]=[null,null,J.prototype.pd,J.prototype.Ud,"SDSDR"],N[62624]=[null,null,J.prototype.qd,J.prototype.Vd,"SISAR"],N[62640]=[null,null,J.prototype.od,J.prototype.Td,"SDSAR"],N[62656]=[null,null,J.prototype.hd,J.prototype.Nd,"KISDR"],N[62672]=[null,null,J.prototype.fd,J.prototype.Ld,"KDSDR"],N[62688]=[null,null,J.prototype.gd,J.prototype.Md,"KISAR"],N[62704]=[null,null,J.prototype.ed,J.prototype.Kd,"KDSAR"],N[65382]=[null,null,
J.prototype.jd,J.prototype.Od,"LKS"],N[65402]=[null,null,J.prototype.kd,J.prototype.Pd,"MMR0"],N[65408]=[null,null,J.prototype.vd,J.prototype.$d,"UISDR"],N[65424]=[null,null,J.prototype.td,J.prototype.Yd,"UDSDR"],N[65440]=[null,null,J.prototype.ud,J.prototype.Zd,"UISAR"],N[65456]=[null,null,J.prototype.sd,J.prototype.Xd,"UDSAR"],N[65534]=[null,null,J.prototype.ld,J.prototype.Qd,"PSW"],N);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];
Ma(function(){for(var a=A(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new J(d);fb(d,c)}});var kc;if(xb){var lc=new ArrayBuffer(2);(new DataView(lc)).setUint16(0,256,!0);kc=256===(new Uint16Array(lc))[0]}else kc=!1;var mc=kc;
function H(a,b,c,d,e){this.id=nc+=2;this.b=null;this.A=a;this.Rb=b;this.size=c||0;this.type=d||oc;this.f=d==pc;this.controller=null;Cb(this);this.Xa=this.Vc=!1;if(c)if(e)this.controller=e,this.b=null,qc(this,e.Db);else if(xb)this.D=new ArrayBuffer(c),this.B=new DataView(this.D,0,c),this.w=new Uint8Array(this.D,0,c),this.H=new Uint16Array(this.D,0,c>>1),this.b=new Int32Array(this.D,0,c>>2),qc(this,mc?rc:sc);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;qc(this,tc)}else qc(this)}
var oc=0,pc=2,Ib=4,Kb=["NONE","RAM","ROM","VID","H/W"],nc=0;
H.prototype={constructor:H,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(xb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.B.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(xb)for(b=0;b<a.length;b++)this.B.setInt32(b<<2,a[b],!0);else this.b=a;return this.Xa=!0}return!1},jb:function(a,b){b?this.F++||uc(this,vc,!1):this.g++||wc(this,vc,!1)},J:function(){this.j&&F(this.j,128)&&(D(this.j,"attempt to read invalid block %"+
l(this.A),!0),this.j.ia());return 255},L:function(a,b){this.j&&F(this.j,128)&&(D(this.j,"attempt to write "+l(b,4,!0)+" to invalid block %"+l(this.A),!0),this.j.ia())},N:function(a,b){return this.Zb(a++,b++)|this.Zb(a,b)<<8},G:function(a,b,c){this.cc(a++,b&255,c++);this.cc(a,b>>8,c)},Z:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ka:function(a){var 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},ra:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<
a)|b<<a;this.Xa=!0},Ca:function(a,b){var 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.Xa=!0},S:function(a,b){if(this.j&&null!=this.A){var c=this.j;xc(c,this.A+a,1,c.S)&&c.ia(!0)}return this.lc(a,b)},ea:function(a,b){if(this.j&&null!=this.A){var c=this.j;xc(c,this.A+a,2,c.S)&&c.ia(!0)}return this.mc(a,b)},na:function(a,b,c){if(this.j&&null!=this.A){var d=this.j;xc(d,this.A+a,1,d.G)&&d.ia(!0)}this.f?this.L(a,
b,c):this.dc(a,b,c)},ya:function(a,b,c){if(this.j&&null!=this.A){var d=this.j;xc(d,this.A+a,2,d.G)&&d.ia(!0)}this.f?this.L(a,b,c):this.tc(a,b,c)},R:function(a){return this.w[a]},X:function(a,b){a=this.w[a];this.j&&F(this.j,128)&&D(this.j,"Memory.readByte("+I(this.j,b)+"): "+I(this.j,a),!0);return a},$:function(a){return this.B.getUint16(a,!0)},ha:function(a,b){a=this.H[a>>1];this.j&&F(this.j,128)&&D(this.j,"Memory.readWord("+I(this.j,b)+"): "+I(this.j,a),!0);return a},la:function(a,b){this.w[a]=b;
this.Xa=!0},qa:function(a,b,c){this.w[a]=b;this.Xa=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0)},va:function(a,b){this.B.setUint16(a,b,!0);this.Xa=!0},Ba:function(a,b,c){this.H[a>>1]=b;this.Xa=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeWord("+I(this.j,c)+","+I(this.j,b)+")",!0)}};function Cb(a,b,c){a.j=b;a.g=a.F=0;c&&((a.g=c.g)&&wc(a,vc,!1),(a.F=c.F)&&uc(a,vc,!1))}
function yc(a,b){b?--a.F||(a.cc=a.f?a.L:a.dc,a.Pc=a.f?a.G:a.tc):--a.g||(a.Zb=a.lc,a.Hc=a.mc)}function uc(a,b,c){c&&a.F||(a.cc=!a.f&&b[1]||a.L,a.Pc=!a.f&&b[3]||a.G);if(c||void 0===c)a.dc=b[1]||a.L,a.tc=b[3]||a.G}function wc(a,b,c){c&&a.g||(a.Zb=b[0]||a.J,a.Hc=b[2]||a.N);if(c||void 0===c)a.lc=b[0]||a.J,a.mc=b[2]||a.N}function qc(a,b){b||(b=zc);wc(a,b,void 0);uc(a,b,void 0)}var zc=[],tc=[H.prototype.Z,H.prototype.ra,H.prototype.ka,H.prototype.Ca],vc=[H.prototype.S,H.prototype.na,H.prototype.ea,H.prototype.ya];
if(xb)var sc=[H.prototype.R,H.prototype.la,H.prototype.$,H.prototype.va],rc=[H.prototype.X,H.prototype.qa,H.prototype.ha,H.prototype.Ba];function Ac(a,b){u.call(this,"CPU",a,Ac,1);var c=a.multiplier||1;this.Ta=a.cycles||b;this.$a=c;this.qb=Math.round(this.Ta/1E4)/100;this.nb=this.qb*this.$a;this.v.ga=!1;this.v.rc=!1;this.v.Eb=a.autoStart;this.v.wc=!1;this.v.rb=!1;this.Ib=this.na=0;this.Jb=a.csStart;this.ub=a.csInterval;this.vb=a.csStop;this.N=[];this.Ec=this.Hd.bind(this);G(this)}y(Ac);
var Bc=["power","reset"];h=Ac.prototype;h.Pa=function(a,b,c,d){this.D=a;this.F=b;this.j=d;for(b=0;b<Bc.length;b++)(c=this.L[Bc[b]])&&this.D.pa(null,Bc[b],c);this.va=null;a=Cc(a,"autoStart");null!=a&&(this.v.Eb="true"==a?!0:"false"==a?!1:!!a);G(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};
h.Ka=function(a,b){if(!b){if(a&&this.restore){Dc(this);if(!this.restore(a))return!1;Ec(this)}else this.reset();this.j?(a=this.j,a.i("Type ? for help with PDP11 Debugger commands"),a.Ga(),a.Ta&&(b=a.Ta,a.Ta=null,Fc(a,b))):this.i("No debugger detected")}O(this);return!0};h.Ja=function(a){return a?this.save():!0};h.Eb=function(){return this.v.Eb||!this.j&&void 0===this.L.run?(this.Ab(!0),!0):!1};h.zc=function(){return 0};
function Ec(a){void 0===a.Jb&&(a.Jb=0);void 0===a.ub&&(a.ub=-1);void 0===a.vb&&(a.vb=-1);a.v.rb=0<=a.Jb&&0<a.ub;a.v.rb&&(a.Ib=0,a.na=a.Jb-a.la)}function Gc(a,b){if(a.v.rb){var c=!1;a.Ib=a.Ib+a.zc()|0;a.na-=b;0>=a.na&&(a.na+=a.ub,c=!0);0<=a.vb&&a.vb<=Hc(a)&&(a.ub=a.vb=-1,Ec(a),a.ia(),c=!0);c&&a.i(Hc(a)+" cycles: checksum="+l(a.Ib))}}
function Ic(a,b,c,d){if(a.L[b]){void 0===c&&(kb(a,"Value for "+b+" is invalid"),a.ia());var e=a.j&&a.j.na||8;c=!a.v.ga||a.v.wc?8==e?ca(c,d):l(c,d):"--------".substr(0,d||4);a.L[b].textContent!=c&&(a.L[b].textContent=c)}}
h.pa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.L[b]=c;a=!0;break;case "run":this.L[b]=c;c.onclick=function(){var a;if(a=d.D)if(a=d.D,a.v.ja)a=!0;else{var b=null,c,k=cb(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.v.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.v.ja);c++);c==k.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.Ub?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ga?d.ia():d.Ab())};
a=!0;break;case "speed":this.L[b]=c;a=!0;break;case "setSpeed":this.L[b]=c,c.onclick=function(){Jc(d,d.$a<<1,!0)},c.textContent=this.nb.toFixed(2)+"Mhz",a=!0}return a};function Kc(a,b,c){a.la+=b;c&&(a.S=a.b=0)}function Lc(a,b){var c=1;b&&1<a.$a&&a.ha&&(c=a.ha/a.qb);a.Wb=Math.round(1E3/30);a.fb=Math.floor(a.Ta/30*c);b||(a.qa=a.fb);a.sb=0}function Hc(a){return a.la+a.$+a.S-a.b}function Dc(a){a.ha=0;a.Cc=0;a.la=a.$=a.S=a.b=0;Ec(a);Jc(a,1)}
function Jc(a,b,c){var d=!1;if(void 0!==b){.8>a.ha/a.nb?b=1:d=!0;a.$a=b;b=a.qb*a.$a;if(a.nb!=b){a.nb=b;b=a.nb.toFixed(2)+"Mhz";var e=a.L.setSpeed;e&&(e.textContent=b);a.i("target speed: "+b)}c&&a.D&&a.D.Qb()}Kc(a,a.$);a.$=0;a.Z=sa();a.ka=0;Lc(a);return d}function Qb(a,b){var c=a.N.length;a.N.push([-1,b]);return c}function Rb(a,b,c){0<=b&&b<a.N.length&&0>a.N[b][0]&&(c*=a.Ta*a.$a/1E3,a.N[b][0]=c)}function ed(a,b){for(var c=a.N.length-1;0<=c;c--){var d=a.N[c];0>d[0]||b>d[0]&&(b=d[0])}return b}
function fd(a,b){for(var c=a.N.length-1;0<=c;c--){var d=a.N[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}
h.Hd=function(){if(this.v.ga){this.sb>=this.Ta&&Lc(this,!0);this.ya=0;this.Sa=sa();if(this.ka){var a=this.Sa-this.ka;a>this.Wb&&(this.Z+=a,this.Z>this.Sa&&(this.Z=this.Sa))}try{do{var b=ed(this,this.v.rb?1:this.fb);try{this.Bb(b)}catch(e){if("number"!=typeof e)throw e;}var c=this.S-this.b;fd(this,c);this.ya+=c;this.$+=c;Kc(this,0,!0);Gc(this,c);this.qa-=c;if(0>=this.qa){this.qa+=this.fb;15<=++this.Cc&&(this.D&&this.D.Ga(),this.Cc=0);break}}while(this.v.ga)}catch(e){this.ia();O(this);this.D&&this.D.stop(sa(),
Hc(this));kb(this,e.stack||e.message);return}if(this.v.ga){a=setTimeout;b=this.Ec;this.ka=sa();c=this.Wb;this.ya&&(c=Math.round(c*this.ya/this.fb));var c=c-(this.ka-this.Sa),d=this.ka-this.Z;d&&(this.ha=Math.round(this.$/(10*d))/100,864E5<=d&&(this.la=0,Jc(this)));if(0>c||this.ha<this.nb)-1E3>c&&(this.Z-=c),c=0;this.sb+=this.ya;this.ka+=c;a(b,c)}}};
h.Ab=function(a){if(jb(this))return!1;if(this.v.ga)return this.i(this.toString()+" busy"),!1;Jc(this);this.v.ga=!0;this.v.rc=!0;this.va&&this.va.start();var b=this.L.run;b&&(b.textContent="Halt");this.D&&(a&&this.D.Qb(!0),this.D.start(this.Z,Hc(this)));O(this,!0);setTimeout(this.Ec,0);return!0};h.Bb=function(){return 0};
h.ia=function(a){if(this.v.ga){this.S-=this.b;this.b=0;Kc(this,this.$);this.$=0;this.v.ga=!1;this.va&&this.va.stop();var b=this.L.run;b&&(b.textContent="Run");this.D&&this.D.stop(sa(),Hc(this));O(this)}this.v.complete=a};function O(a,b){a.D&&a.D.Ga(b)}
function gd(a){this.cd=+a.model||1170;this.dd=a.resetAddr||0;Ac.call(this,a,6666667);this.Tb=0;this.decode=hd.bind(this);this.U=65536;this.V=32768;this.ba=65535;this.Y=32768;this.O=15;this.u=[0,0,0,0,0,0,0,this.dd];this.Qa=[0,0,0,0,0,0];this.Aa=[0,0,0,0];this.Ca=this.B=0;this.Yc=[4,2,0,1];this.W=[[0,0,0,0,0,0,0,0,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]];this.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]];this.za=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Pb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.jc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.g=this.f=this.pb=this.H=this.J=this.C=0;this.lb=70;this.ra=-1;id(this);this.v.complete=this.v.Uc=!1}y(gd,Ac);h=gd.prototype;h.reset=function(){this.v.ga&&this.ia();id(this);Dc(this);this.v.error=!1;this.parent.reset.call(this)};function id(a){a.cb=255;a.I=0;a.oc=0;a.G=0;a.ab=0;a.ac=0;a.bb=0;a.kc=0;a.Ba=0;a.Xb=262143;a.Vb=253952;a.w=[];a.C|=2;Sb(a)}
function Sb(a){a.kc?(a.ea=65536,a.R=a.Xc,a.X=a.Ic,a.Fc=a.ae):(a.ea=0,a.R=a.Wc,a.X=a.wb,a.Fc=a.Cb)}h.zc=function(){return 0};h.save=function(){var a=new P(this);a.set(0,[]);a.set(1,[this.la,this.$a]);a.set(2,Mb(this.F));return a.data()};
h.restore=function(a){var b=a[1];this.la=b[1];Jc(this,b[3]);a:{b=this.F;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),k=0;k<e.length-1;)for(var m=e[k++],n=e[k++];m--;)g[f++]=n;e=g}f=b.aa[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
h.pa=function(a,b,c){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":this.L[b]=c;this.Tb++;a=!0;break;default:a=this.parent.pa.call(this,a,b,c)}return a};
h.Ga=function(a){if(this.Tb&&(a||!this.v.ga||this.v.wc)){for(a=0;a<this.u.length;a++)Ic(this,"R"+a,this.u[a]);a=Tb(this);Ic(this,"PS",a);Ic(this,"NF",a&8?1:0,1);Ic(this,"ZF",a&4?1:0,1);Ic(this,"VF",a&2?1:0,1);Ic(this,"CF",a&1?1:0,1)}if(a=this.L.speed)a.textContent=this.v.ga&&this.ha?this.ha.toFixed(2)+"Mhz":"Stopped"};function jd(a){return a.U&65536?1:0}function kd(a){return a.V&32768?2:0}function ld(a){return a.ba&65535?0:4}h.Oa=function(){return this.Y&32768?8:0};
function md(a){var b=a.X(a.u[7]);a.u[7]=a.u[7]+2&65535;return b}function nd(a,b){a.u[7]=b&65535}function K(a,b,c,d,e){for(var f=a.w.length;0<f--;)if(a.w[f].Oc===d){0<f&&(a.w[f-1].Ma+=a.w[f].Ma);a.w.splice(f,1);break}if(0<=b){for(f=a.w.length;0<f--;){if(a.w[f].Ma>b){a.w[f].Ma-=b;break}b-=a.w[f].Ma}a.w.splice(f+1,0,{Ma:b,Gc:c<<5&224,Oc:d,ic:e})}a.C|=2}function Tb(a){return a.O=a.O&63728|a.Oa()|ld(a)|kd(a)|jd(a)}
function Ub(a,b){a.Y=b<<12;a.ba=~b&4;a.V=b<<14;a.U=b<<16;if((b^a.O)&2048)for(var c=a.Qa.length;0<=--c;){var d=a.u[c];a.u[c]=a.Qa[c];a.Qa[c]=d}a.B=b>>14&3;c=a.O>>14&3;a.B!=c&&(a.Aa[c]=a.u[6],a.u[6]=a.Aa[a.B]);a.C|=2;a.O=b}function Q(a,b){a.C&128||(a.Y=a.ba=b,a.V=0)}function od(a,b,c){a.C&128||(a.Y=a.ba=a.U=b,a.V=c||0)}function pd(a,b,c,d){a.C&128||(a.Y=a.ba=a.U=b,a.V=(c^b)&(d^b))}function qd(a,b){a.C&128||(a.Y=a.ba=a.U=b,a.V=a.Y^a.U>>1)}
function rd(a,b,c,d){a.C&128||(a.Y=a.ba=a.U=b,a.V=(c^d)&(d^b))}h.K=function(a){var b=!1;0>this.ra?this.ra=Tb(this):this.B||(a=4,b=!0);this.G&57344||(this.ab=63222,this.ac=a);this.B=0;var c=this.X(a|this.ea),d=this.X(a+2&65535|this.ea);Ub(this,d&-12289|this.ra>>2&12288);b&&(this.I|=4,this.u[6]=4);sd(this,this.ra);sd(this,this.u[7]);nd(this,c);this.C&=-113;this.ra=-1;throw a;};function td(a){var b=ud(a),c=ud(a)&-1793;a.O&49152&&(c=c&-225|a.O&63712);nd(a,b);Ub(a,c);a.C&=-17}
function jc(a,b){var c=b>>13&31;31>c?a.bb&32&&(b=a.Pb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b}
function vd(a,b,c){var d,e,f,g=0;d=b>>13;a.bb&a.Yc[a.B]||(d&=7);e=a.W[a.B][d];f=(a.wa[a.B][d]<<6)+(b&8191)&a.Xb;f<a.Vb?f&1&&!(c&1)&&(a.I|=64,a.K(4,10)):(a.bb&16||253952<=f&&(f|=4186112),4186112>f&&(3932160<=f&&(f=jc(a,f&262143)),f>=a.Vb&&4186112>f&&(a.I|=32,a.K(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.W[a.B][d]=e;if(4194170!==f||a.B)a.Ba=a.B,a.Ca=d;g&&(g&57344&&(0<=a.ra&&(g|=128),a.G&57344||(a.G=a.G|g|a.Ba<<5|a.Ca<<1),a.K(168,16)),a.G&61440||!(4191360>f||4194239<f)||(a.G|=4096,a.G&512&&(a.C|=32)));return f}function ud(a){var b=a.X(a.u[6]|a.ea);a.u[6]=a.u[6]+2&65535;return b}function sd(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.G&57344||(a.ab=a.ab<<8|246);!a.B&&c<=a.cb&&4<c&&(c<=a.cb-32?(a.I|=4,a.u[6]=4,a.K(4,18)):(a.I|=8,a.C|=4));a.Fc(c,b)}
function wd(a,b,c,d){var e,f,g=d&8?0:a.ea;switch(b){case 0:return a.K(4,20),0;case 1:return 6===c&&!a.B&&d&4&&(a.u[6]<=a.cb||65534<=a.u[6])&&(a.u[6]<=a.cb-32||65534<=a.u[6]?(a.I|=4,a.u[6]=4,a.K(4,22)):(a.I|=8,a.C|=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.X(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.X(e)|g;a.b-=
8;break;case 6:return e=md(a),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=md(a),e=e+a.u[c]&65535,e=a.X(e|a.ea)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.G&57344||(a.ab=a.ab<<8|f<<3&248|c);6==c&&!a.B&&d&4&&0>=f&&(a.u[6]<=a.cb||65534<=a.u[6])&&(a.u[6]<=a.cb-32?(a.I|=4,a.u[6]=4,a.K(4,24)):(a.I|=8,a.C|=64));return e}h.Wc=function(a,b,c){return wd(this,a,b,c)};h.Xc=function(a,b,c){return vd(this,wd(this,a,b,c),c)};h.wb=function(a){a&1&&(this.I|=64,this.K(4,10));return this.F.Ia(a)};
h.Ic=function(a){return this.wb(vd(this,a,2))};h.Cb=function(a,b){a&1&&(this.I|=64,this.K(4,10));this.F.qc(a,b&65535)};h.ae=function(a,b){this.Cb(vd(this,a|65536,4),b)};function xd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=wd(a,b,d,2),c&65536||61440!==(a.O&61440)&&(d&=65535),a.B=a.O>>12&3,c=a.X(d|c&a.ea),a.B=a.O>>14&3):c=6!=d||(a.O>>2&12288)===(a.O&12288)?a.u[d]:a.Aa[a.O>>12&3];return c}
function yd(a,b,c,d){a.G&57344||(a.ab=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=wd(a,b,e,4),c&65536||(e&=65535),a.B=a.O>>12&3,e=vd(a,e|c&65536,4),a.B=a.O>>14&3,a.Cb(e,d)):6!=e||(a.O>>2&12288)===(a.O&12288)?a.u[e]=d:a.Aa[a.O>>12&3]=d}function zd(a,b){b>>=6;var c=a.J=b&7;(b=a.H=(b&56)>>3)?(c=a.R(b,c,3),a=a.F.mb(c)):a=a.u[c]&255;return a}function Ad(a,b){var c;b>>=6;var d=a.J=b&7;(b=a.H=(b&56)>>3)?c=a.wb(a.R(b,d,2)):c=a.u[d];return c}function Bd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return wd(a,b,c,8)}
function Cd(a,b){var c=a.f=b&7;(b=a.g=(b&56)>>3)?(c=a.R(b,c,3),a=a.F.mb(c)):a=a.u[c]&255;return a}function Dd(a,b){var c,d=a.f=b&7;(b=a.g=(b&56)>>3)?c=a.wb(a.R(b,d,2)):c=a.u[d];return c}function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.pb=a.R(b,e,7),c=d.call(a,c,a.F.mb(e)),e&1&&a.b--,a.F.Ob(e,c&255)):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.R(b,e,6),a.Cb(e,d.call(a,c,a.wb(e)))):a.u[e]=d.call(a,c,a.u[e])}
function Ed(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.R(b,e,5),d&1&&a.b--,a.F.Ob(d,c&255)):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}function Fd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.Cb(a.R(b,d,4),c):a.u[d]=c&65535;return c}function T(a,b,c){c&&(nd(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
h.Bb=function(a){this.v.complete=!0;var b=this.v.Uc=this.j&&Gd(this.j),c=a?this.v.rc?0:1:-1;this.v.rc=!1;this.S=this.b=a;do{if(b){if(Hd(this.j,this.u[7],c)){this.ia();break}c=1}if(this.C&&(this.C&112&&(this.C&32?this.K(168,28):this.C&64?this.K(4,30):this.C&16&&this.K(12,32),this.C&=-113),this.C&7))if(this.C&2){this.C&=-3;a=null;for(var d=this.oc&224,e=this.w.length;0<=--e;){if(0<this.w[e].Ma){this.w[e].Ma--;this.C|=2;break}if(this.w[e].ic){if(!this.w[e].ic()){this.w.splice(e,1);continue}this.w[e].ic=
null}this.w[e].Gc>d&&(d=this.w[e].Gc,a=this.w[e],this.w.splice(e,1))}d>(this.O&224)&&(this.C&4&&(this.u[7]=this.u[7]+2&65535,this.C&=-5),a?this.K(a.Oc,26):this.K(160,26))}else this.C&1&&this.C++;this.G&57344||(this.ab=0,this.ac=this.u[7]);this.C=this.C&7|this.O&16;this.decode(md(this))}while(0<this.b);return this.v.complete?this.S-this.b:void 0===this.v.complete?0:-1};Ma(function(){for(var a=A(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new gd(d);fb(d,c)}});
function Id(a,b){var c=b+a;pd(this,c,a,b);return c&65535}function Jd(a,b){var c=b+a;pd(this,c<<8,a<<8,b<<8);return c&255}function Kd(a,b){a=b<<1;qd(this,a);return a&65535}function Ld(a,b){a=b<<1;qd(this,a<<8);return a&255}function Md(a,b){a=b&32768|b>>1|b<<16;qd(this,a);return a&65535}function Nd(a,b){a=b&2048|b>>1|b<<8;qd(this,a<<8);return a&255}function Od(a,b){a=b&~a;Q(this,a);return a}function Pd(a,b){a=b&~a;Q(this,a<<8);return a}function Qd(a,b){a|=b;Q(this,a);return a}
function Rd(a,b){a|=b;Q(this,a<<8);return a}function Sd(a,b){a=~b|65536;od(this,a);return a&65535}function Td(a,b){a=~b|256;od(this,a<<8);return a&255}function Ud(a,b){a=b-a;this.C&128||(this.Y=this.ba=a,this.V=b&(b^a));return a&65535}function Vd(a,b){a=b-a;var c=a<<8;b<<=8;this.C&128||(this.Y=this.ba=c,this.V=b&(b^c));return a&255}function Wd(a,b){a=b+a;this.C&128||(this.Y=this.ba=a,this.V=a&(b^a));return a&65535}
function Xd(a,b){a=b+a;var c=a<<8;this.C&128||(this.Y=this.ba=c,this.V=c&(b<<8^c));return a&255}function Yd(a,b){a=-b;od(this,a,a&b&32768);return a&65535}function Zd(a,b){a=-b;od(this,a<<8,(a&b&128)<<8);return a&255}function $d(a,b){a=b<<1|this.U>>16&1;qd(this,a);return a&65535}function ae(a,b){a=b<<1|this.U>>16&1;qd(this,a<<8);return a&255}function be(a,b){a=(this.U&65536|b)>>1|b<<16;qd(this,a);return a&65535}function ce(a,b){a=((this.U&65536)>>8|b)>>1|b<<8;qd(this,a<<8);return a&255}
function de(a,b){var c=b-a;rd(this,c,a,b);return c&65535}function ee(a,b){var c=b-a;rd(this,c<<8,a<<8,b<<8);return c&255}function fe(a,b){this.C&128||(this.Y=this.ba=b&65280,this.V=this.U=0);return(b<<8|b>>8)&65535}function ge(a,b){a^=b;Q(this,a);return a&65535}
function he(a){var b=Dd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.U=this.V=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.U=c<<17-b,c>>=b;else if(b)if(16<b)this.V=c,c=0;else{this.U=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.V=32768)}this.u[a]=c&65535;this.Y=this.ba=c;this.b-=(this.g?6:7)+b}
function ie(a){var b=Dd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.U=this.V=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.U=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.U=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.V=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.Y=d>>16;this.ba=d>>16|d;this.b-=(this.g?6:7)+b}function U(a){a&1&&(this.U=0);a&2&&(this.V=0);a&4&&(this.ba=1);a&8&&(this.Y=0);this.b-=5}
function je(a){var b=Dd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.U=this.V=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.ba=d>>16|d,this.Y=d>>16):(this.V=32768,this.ba=d>>15|d,this.Y=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.ba=this.Y=0,this.V=32768,this.U=65536,this.b-=7}var ke=[0,7,7,10,7,11,9,13];function le(a){var b=this.b;nd(this,Bd(this,a));this.b=b-ke[this.g]}
var me=[0,14,14,17,14,18,16,20];function ne(a){var b=this.b,c=Bd(this,a);a=a>>6&7;sd(this,this.u[a]);this.u[a]=this.u[7];nd(this,c);this.b=b-me[this.g]}var oe=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],pe=[7,13,13,17,14,18,17,21];function qe(a){var b=Dd(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.C&128||(this.Y=b>>16,this.ba=this.Y|b,this.V=0,this.U=-32768>b||32767<b?65536:0);this.b-=23}
function re(){this.b-=5}function se(a){a&1&&(this.U=65536);a&2&&(this.V=32768);a&4&&(this.ba=0);a&8&&(this.Y=32768);this.b-=5}function te(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)nd(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function ue(a){S(this,a,0,fe);this.b-=this.g?9:3+(7==this.f?2:0)}function Oe(a){S(this,a,Ad(this,a),ge);this.b-=this.g?9:3+(7==this.f?2:0)}function V(){this.K(8,6)}function hd(a){Pe[a>>12].call(this,a)}
var Pe=[function(a){Qe[a>>8&15].call(this,a)},function(a){var b=Ad(this,a),c=this.b;Q(this,Fd(this,a,b));this.b=c-oe[(this.H?8:0)+this.g]+(7!=this.f||this.g?0:2)},function(a){var b=Ad(this,a);a=Dd(this,a);rd(this,b-a,a,b);this.b-=this.g?4+(this.J&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){Q(this,Ad(this,a)&Dd(this,a));this.b-=this.g?4+(this.J&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){S(this,a,Ad(this,a),Od);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?
2:0)},function(a){S(this,a,Ad(this,a),Qd);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){S(this,a,Ad(this,a),Id);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){Re[a>>8&15].call(this,a)},function(a){Se[a>>8&15].call(this,a)},function(a){var b=zd(this,a);Q(this,Ed(this,a,b,1)<<8);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){var b=zd(this,a)<<8;a=Cd(this,a)<<8;rd(this,b-a,a,b);this.b-=this.g?
4+(this.J&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){Q(this,(zd(this,a)&Cd(this,a))<<8);this.b-=this.g?4+(this.J&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){R(this,a,zd(this,a),Pd);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){R(this,a,zd(this,a),Rd);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){S(this,a,Ad(this,a),de);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},V],Qe=
[function(a){Te[a>>4&15].call(this,a)},function(a){T(this,a,!0)},function(a){T(this,a,!ld(this))},function(a){T(this,a,ld(this))},function(a){T(this,a,!this.Oa()==!kd(this))},function(a){T(this,a,!this.Oa()!=!kd(this))},function(a){T(this,a,!ld(this)&&!this.Oa()==!kd(this))},function(a){T(this,a,ld(this)||!this.Oa()!=!kd(this))},ne,ne,function(a){Ue[a>>6&3].call(this,a)},function(a){Ve[a>>6&3].call(this,a)},function(a){We[a>>6&3].call(this,a)},function(a){Xe[a>>6&3].call(this,a)},V,V],Ue=[function(a){od(this,
Fd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Sd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Wd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Ud);this.b-=this.g?9:3+(7==this.f?2:0)}],Ve=[function(a){S(this,a,0,Yd);this.b-=this.g?11:6},function(a){S(this,a,jd(this)?1:0,Id);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,jd(this)?1:0,de);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Dd(this,a);od(this,a);this.b-=this.g?4:3+(7==this.f?
2:0)}],We=[function(a){S(this,a,0,be);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,$d);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Md);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Kd);this.b-=this.g?9:3+(7==this.f?2:0)}],Xe=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.Ic(a|65536);nd(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=xd(this,a,0);sd(this,a);Q(this,a);this.b-=11},function(a){var b=ud(this),c=this.b;yd(this,a,
0,b);Q(this,b);this.b=c-pe[this.g]},function(a){Q(this,Fd(this,a,this.Oa?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Te=[function(a){Ye[a&15].call(this,a)},V,V,V,le,le,le,le,function(a){if(a&8)this.K(8,6);else{var b=ud(this);a&=7;nd(this,this.u[a]);this.u[a]=b;this.b-=9}},function(a){a&8?(this.O&49152||(this.O=this.O&-2017|(a&7)<<5,this.C|=1),this.b-=5):this.K(8,6)},function(a){Ze[a&15].call(this,a)},function(a){$e[a&15].call(this,a)},ue,ue,ue,ue],Ye=[function(){this.O&49152?(this.I|=128,this.K(4,
3)):this.ia();this.b-=7},function(){this.C|=4;this.u[7]=this.u[7]+-2&65535;this.b-=3},function(){td(this);this.C|=this.O&16;this.b-=13},function(){this.K(12,1);this.b-=5},function(){this.K(16,4);this.b-=25},function(){this.O&49152||(id(this),this.F.reset());this.b-=667},function(){td(this);this.b-=13},V,V,V,V,V,V,V,V,V],Ze=[re,function(){this.U=0;this.b-=5},function(){this.V=0;this.b-=5},U,function(){this.ba=1;this.b-=5},U,U,U,function(){this.Y=0;this.b-=5},U,U,U,U,U,U,U],$e=[re,function(){this.U=
65536;this.b-=5},function(){this.V=32768;this.b-=5},se,function(){this.ba=0;this.b-=5},se,se,se,function(){this.Y=32768;this.b-=5},se,se,se,se,se,se,se],Re=[qe,qe,je,je,he,he,ie,ie,Oe,Oe,V,V,V,V,te,te],Se=[function(a){T(this,a,!this.Oa())},function(a){T(this,a,this.Oa())},function(a){T(this,a,!jd(this)&&!ld(this))},function(a){T(this,a,jd(this)||ld(this))},function(a){T(this,a,!kd(this))},function(a){T(this,a,kd(this))},function(a){T(this,a,!jd(this))},function(a){T(this,a,jd(this))},function(){this.K(24,
2);this.b-=25},function(){this.K(28,5);this.b-=5},function(a){af[a>>6&3].call(this,a)},function(a){bf[a>>6&3].call(this,a)},function(a){cf[a>>6&3].call(this,a)},function(a){df[a>>6&3].call(this,a)},V,V],af=[function(a){od(this,Ed(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Td);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Xd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Vd);this.b-=this.g?9:3+(7==this.f?2:0)}],bf=[function(a){R(this,a,0,Zd);this.b-=
this.g?11:6},function(a){R(this,a,jd(this)?1:0,Jd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,jd(this)?1:0,ee);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Cd(this,a);od(this,a<<8);this.b-=this.g?4:3+(7==this.f?2:0)}],cf=[function(a){R(this,a,0,ce);this.b-=this.g?9+(this.pb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,ae);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Nd);this.b-=this.g?9+(this.pb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Ld);this.b-=this.g?9:3+(7==
this.f?2:0)}],df=[V,function(a){a=xd(this,a,65536);sd(this,a);Q(this,a);this.b-=11},function(a){var b=ud(this),c=this.b;yd(this,a,65536,b);Q(this,b);this.b=c-pe[this.g]},V];function ef(a){u.call(this,"ROM",a,ef);this.f=null;this.B=a.addr;this.g=a.size;this.G=a.writable;this.D=a.alias;this.w=a.file;this.H=da(this.w);if(this.w){a=this.w;var b=fa(this.H);"json"!=b&&"hex"!=b&&(a=ha()+"/api/v1/dump?file="+this.w+"&format=bytes&decimal=true");var c=this;ua(a,null,!0,function(a,b,f){ff(c,a,b,f)})}}y(ef);
ef.prototype.Pa=function(a,b,c,d){this.F=b;this.b=c;this.j=d;gf(this)};ef.prototype.Ka=function(){if(this.La){if(this.j){var a=this.j,b=this.id,c=this.B,d=this.g,e=this.La,f=[],g;for(g in e){var k=e[g];"number"==typeof k&&(e[g]=k={o:k});var m=k.o,n=k.a;if(void 0!==m){var p=f,m=[m>>>0,g],t=ra(p,m,a.vc);0>t&&p.splice(-(t+1),0,m)}n&&(k.a=n.replace(/''/g,'"'))}a.H.push({ee:b,A:c,Zc:d,La:e,uc:f})}delete this.La}return!0};ef.prototype.Ja=function(){return!0};
function ff(a,b,c,d){if(d)a.ta("Unable to load system ROM (error "+d+": "+b+")");else{bb(a.fc,b,c);var e;if("["==c.charAt(0)||"{"==c.charAt(0))try{var f,g,k=eval("("+c+")");if(f=k.bytes)a.f=f;else if(f=k.words)for(a.f=Array(2*f.length),g=e=0;e<f.length;e++)a.f[g++]=f[e]&255,a.f[g++]=f[e]>>8&255;else if(f=k.data)for(a.f=Array(4*f.length),g=e=0;e<f.length;e++)a.f[g++]=f[e]&255,a.f[g++]=f[e]>>8&255,a.f[g++]=f[e]>>16&255,a.f[g++]=f[e]>>24&255;else a.f=k;a.La=k.symbols;if(!a.f.length){q("Empty ROM: "+
b);return}if(1==a.f.length){q(a.f[0]);return}}catch(m){a.ta("ROM data error: "+m.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.f=Array(b.length),e=0;e<b.length;e++)a.f[e]=aa(b[e],16);gf(a)}}
function gf(a){if(!ib(a))if(!a.w)G(a);else if(a.f&&a.F){a.g||(a.g=a.f.length);if(a.f.length!=a.g)kb(a,"ROM size ("+l(a.f.length,8,!0)+") does not match specified size ("+l(a.g,8,!0)+")");else{var b;b=a.B;if(Hb(a.F,b,a.g,a.G?1:pc)){var c;for(c=0;c<a.f.length;c++){a.j&&a.j.g++;var d=a.F,e=b+c;d.aa[(e&d.g)>>>d.ca].dc(e&d.f,a.f[c]&255,e);a.j&&a.j.g--}b=!0}else b=!1;if(b){b=[];"number"==typeof a.D?b.push(a.D):null!=a.D&&a.D.length&&(b=a.D);for(c=0;c<b.length;c++){for(var f=a,d=b[c],e=f.F,g=f.g,k=[],m=
f.B>>>e.ca;0<g&&m<e.aa.length;)k.push(e.aa[m++]),g-=e.Da;e=f.F;f=f.g;g=0;for(d>>>=e.ca;0<f&&d<e.aa.length;){m=k[g++];if(!m)break;e.aa[d++]=m;f-=e.Da}}delete a.f}}G(a)}}Ma(function(){for(var a=A(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new ef(d);fb(d,c)}});function hf(a){u.call(this,"RAM",a,hf);this.D=a.addr;this.g=a.size;this.f=!1}y(hf);h=hf.prototype;h.Pa=function(a,b,c,d){this.F=b;this.b=c;this.j=d;G(this)};h.Ka=function(a,b){b||this.reset();return!0};
h.Ja=function(a){return a?this.save():!0};h.reset=function(){!this.f&&this.g&&Hb(this.F,this.D,this.g,1)&&(this.f=!0);this.f||q("No RAM allocated")};h.save=function(){return null};h.restore=function(){return!0};Ma(function(){for(var a=A(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new hf(d);fb(d,c)}});function jf(a){u.call(this,"Keyboard",a,jf,65536);G(this)}y(jf);jf.prototype.pa=function(){return!1};jf.prototype.Pa=function(a,b,c,d){this.D=a;this.b=c;this.j=d;this.va=null};
Ma(function(){for(var a=A(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new jf(d);fb(d,c)}});function X(a){this.w=this.G=null;this.Z=a.tabSize;this.R=a.charBOL;this.H=0;u.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.G="";else{var c;a=kf;b&&(void 0===c&&(c="Panel"),(c=eb(c,this.id))&&(b=c.L[b])&&this.pa(null,a,b))}this.J=this.N=null;this.exports={connect:this.Dc,receiveData:this.nc}}y(X);var kf="buffer";h=X.prototype;
h.pa=function(a,b,c){var d=this;switch(b){case kf:return this.L[b]=this.w=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.nc(b);return!0},c.onkeypress=function(a){a=a||window.event;d.nc(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.Pa=function(a,b,c,d){this.D=a;this.F=b;this.b=c;this.j=d;var e=this;this.$=Qb(this.b,function(){e.f&128||!e.B.length||(e.X=e.B.shift(),e.f|=128,e.f&64&&K(e.b,40,4,48))});this.S=function(){e.g|=128;return!!(e.g&64)};Nb(b,this,lf);G(this)};
h.Dc=function(){if(!this.J){var a=Cc(this.D,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.Sb)return;b=pa(b[1]);if(this.J=db(b)){var d=this.J.exports;if(d){var e=d.connect;e&&e.call(this.J);if(this.N=d.receiveData){this.status(this.fc+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.Ka=function(a,b){if(!b)if(this.Dc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.Ja=function(a){return a?this.save():!0};h.reset=function(){mf(this)};h.save=function(){var a=new P(this);a.set(0,[]);return a.data()};h.restore=function(){return mf(this)};function mf(a){a.X=0;a.f=0;a.g=128;a.B=[];return!0}h.nc=function(a){if("number"==typeof a)this.B.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.B.push(a.charCodeAt(b));else this.B=this.B.concat(a);Rb(this.b,this.$,50);return!0};h.nd=function(){return this.f&65535};h.Sd=function(a){this.f=this.f&-112|a&111};
h.md=function(){this.f&=-129;0<this.B.length&&Rb(this.b,this.$,50);return this.X};h.Rd=function(){};h.xd=function(){return this.g};h.ce=function(a){128==(this.g&192)&&a&64&&K(this.b,8,4,52,this.S);this.g=this.g&-70|a&69};h.wd=function(){return 0};
h.be=function(a){if(a&=255){D(this,"transmitByte("+l(a,2,!0)+")");this.N&&this.N.call(this.J,a);if(this.w)if(13==a)this.H=0;else if(8==a)this.w.value=this.w.value.slice(0,-1),0<this.H&&this.H--;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.Z||8,c=a-this.H%a,this.Z&&(b=oa("",c)));this.R&&!this.H&&c&&(b=String.fromCharCode(this.R)+b);this.w.value+=b;this.w.scrollTop=this.w.scrollHeight;this.H+=c}else if(null!=this.G){if(10==a||1024<=this.G.length)this.i(this.G),
this.G="";10!=a&&(this.G+=String.fromCharCode(a))}this.g&=-129;K(this.b,100,4,52,this.S)}};var nf={},lf=(nf[65392]=[null,null,X.prototype.nd,X.prototype.Sd,"RCSR"],nf[65394]=[null,null,X.prototype.md,X.prototype.Rd,"RBUF"],nf[65396]=[null,null,X.prototype.xd,X.prototype.ce,"XCSR"],nf[65398]=[null,null,X.prototype.wd,X.prototype.be,"XBUF"],nf);Ma(function(){for(var a=A(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new X(d);fb(d,c)}});
function of(a){u.call(this,"Debugger",a,of);this.na=a.base||16;this.Ca=!1;this.X=this.Ba=this.J=0;this.$=!1;this.B=-1;this.w=[];this.ha={}}y(of);var pf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};of.prototype.Ac=function(){return-1};of.prototype.Bc=function(){};
function qf(a,b,c,d){if(c)if(b){0>a.B&&a.w.length&&(a.B=0);if(0>a.B||b!=a.w[a.B])a.w.splice(0,0,b),a.B=0;a.B--}else a.$?b="end":b=a.w[a.B+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(pa(b.substring(c,f))),c=f+1}}return a}
function rf(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;
var wb="undefined"!==typeof ArrayBuffer,xb={cpu:1,trap:16,bus:64,mem:128,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)}y(yb);h=yb.prototype;h.ja=function(a,b,c,d){return this.F&&this.F.ja(a,b,c,d)||this.b&&this.b.ja(a,b,c,d)||this.j&&this.j.ja(a,b,c,d)?!0:this.parent.ja.call(this,a,b,c,d)};h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.b=c;this.j=d};
h.Ca=function(a,b){b||zb();return!0};h.Ba=function(){return!0};h.za=function(){};function zb(){for(var a=!1,b=A(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=cb(e.id);f||(a=!0,f=new yb(e));eb(f,d);a&&G(f)}}La(zb);
function Ab(a,b,c){r.call(this,"Bus",a,Ab,64);this.b=b;this.j=c;this.C=a.busWidth||16;this.B=Math.pow(2,this.C);this.g=this.B-1|0;this.Z=(this.C>>1)+2;10>this.Z&&(this.Z=10);15<this.Z&&(this.Z=15);this.ya=1<<this.Z;this.G=this.ya>>2;this.f=this.ya-1;this.A=this.B/this.ya|0;this.Ka=[];this.F=[];a=new H(this.b);Bb(a,this.j);this.X=Array(this.A);for(b=0;b<this.A;b++)this.X[b]=a;this.gb=Array(4);this.gb[0]=Cb;this.gb[1]=Db;this.gb[2]=Eb;this.gb[3]=Fb;Gb(this,this.B-8192,8192,Hb,this);Gb(this,57344,8192,
Hb,this);G(this)}y(Ab);function Cb(a,b){var c=-1,d=this.controller,e=d.Ka[a];e?e[0]?c=e[0](b)&255:e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.Ka[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.j&&F(this.j,64)&&D(this.j,e[4]+".readByte("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=Ib(d,b|4186112,-1,1);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to byte @"+I(this.j,b)+": "+I(this.j,c),!0,!0);return c}
function Db(a,b,c){var d=!1,e=this.controller,f=e.Ka[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](c):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.Ka[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](c):0,f[3](a&255|b<<8,c),d=!0);d?this.j&&F(this.j,64)&&D(this.j,f[4]+".writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(Ib(e,c|4186112,b,1),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to byte @"+I(this.j,c)+": "+I(this.j,b),!0,!0))}
function Eb(a,b){var c=-1,d=this.controller;(a=d.Ka[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.j&&F(this.j,64)&&D(this.j,a[4]+".readWord("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=Ib(d,b|4186112,-1,0);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to word @"+I(this.j,b)+": "+I(this.j,c),!0,!0);return c}
function Fb(a,b,c){var d=!1,e=this.controller;if(a=e.Ka[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.j&&F(this.j,64)&&D(this.j,a[4]+".writeWord("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(Ib(e,c|4186112,b,0),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to word @"+I(this.j,c)+": "+I(this.j,b),!0,!0))}h=Ab.prototype;h.reset=function(){for(var a=0;a<this.F.length;a++)this.F[a]()};
function Ib(a,b,c,d){a.j&&F(a.j,536870912)&&D(a.j,"warning: unrecognized I/O access("+I(a.j,b)+","+I(a.j,c)+","+d+")",!0,!0);a.b.O(4,b)}h.Ca=function(a,b){b||this.reset();return!0};
function Gb(a,b,c,d,e){for(var f=b,g=c,l=f>>>a.Z;0<g&&l<a.X.length;){var n=a.X[l],p=l*a.ya,q=a.ya-(f-p);q>g&&(q=g);if(n&&n.size){if(n.type==d&&n.controller==e){if(f+g<=n.w)return n.qb+=n.w-f,n.w=f,!0;if(f>=n.w+n.qb){q=n.size-(f-p);q>g&&(q=g);n.qb=f-n.w+q;f=p+a.ya;g-=q;l++;continue}}return Jb(1,f,g)}f=new H(a.b,f,q,a.ya,d,e);Bb(f,a.j,n);a.X[l++]=f;f=p+a.ya;g-=q}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Kb[d]+" at "+k(b,8,!0)),!0):Jb(2,b,c)}
h.Ua=function(a){return this.X[(a&this.g)>>>this.Z].ub(a&this.f,a)};h.ma=function(a){return this.X[(a&this.g)>>>this.Z].dc(a&this.f,a)};function Lb(a,b){return a.X[(b&a.g)>>>a.Z].Db(b&a.f,b)}h.ob=function(a,b){this.X[(a&this.g)>>>this.Z].vb(a&this.f,b&255,a)};h.Xa=function(a,b){this.X[(a&this.g)>>>this.Z].oc(a&this.f,b&65535,a)};
function Mb(a){for(var b=0,c=[],d=0;d<a.A;d++){var e=a.X[d];if(e.La||e.sc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,l=0,n=[];g<e.length;){for(var p=e[g],q=g+1;q<e.length&&e[q]===p;)q++;n[l++]=q-g;n[l++]=p;g=q}n.length<e.length&&(e=n)}c[f]=e}}return c}
function Nb(a,b,c){for(var d in c){var e=c[d];if(!(e[5]&&e[5]>a.b.Xb))for(var f=e[0]?e[0].bind(b):null,g=e[1]?e[1].bind(b):null,l=e[2]?e[2].bind(b):null,n=e[3]?e[3].bind(b):null,p=a,q=+d,e=e[4],v=+d;v<=q;v+=2){var u=v&8191;void 0!==p.Ka[u]?m("I/O address already registered: "+k(v,8,!0)):p.Ka[u]=[f,g,l,n,e||"unknown",!1]}}}function Ob(a,b){a.F.push(b)}function Jb(a,b,c){m("Memory block error ("+a+": "+k(b)+","+k(c)+")");return!1}
function J(a){r.call(this,"Device",a,J);this.g={data:0,Gd:0,tb:20,Jd:0};this.f={Hd:0,Ib:-1}}y(J);h=J.prototype;h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;var e=this;this.f.Ib=Pb(this.b,function(){e.f.Ma|=128;e.f.Ma&64&&(Qb(e.b,0,6,64),Rb(e.b,e.f.Ib,1E3/60))});Nb(b,this,K);Ob(b,this.reset.bind(this));G(this)};h.Gc=function(){var a=this.f.Ma;this.f.Ma&=-129;return a};h.kd=function(a){this.f.Ma=a;a&64&&Rb(this.b,this.f.Ib,1E3/60);this.f.Ma=a&-129};
h.Ic=function(){var a=this.b;return a.G&62337|a.wa<<5|a.xa<<1};h.md=function(a){var b=this.b;b.G=a&=62337;b.wa=a>>5&3;b.xa=a>>1&15;b.Bb=a&257?a&1?6:4:0;Sb(b);Tb(this)};h.Jc=function(){var a=this.b.Oa;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Kc=function(){return this.b.Fb};h.Lc=function(){return this.b.Wa};h.nd=function(a){var b=this.b;b.Wa=a;b.Wa&16?(b.jb=4194303,b.Ia=3915776):(b.jb=262143,b.Ia=253952);Tb(this)};function Tb(a){a.g.tb=a.g.tb&-8|(a.b.Bb?a.b.Wa&16?1:2:4)}
h.Tc=function(a){return this.b.S[1][a>>1&7]};h.vd=function(a,b){this.b.S[1][b>>1&7]=a&65295};h.Rc=function(a){return this.b.S[1][(a>>1&7)+8]};h.td=function(a,b){this.b.S[1][(b>>1&7)+8]=a&65295};h.Sc=function(a){return this.b.pa[1][a>>1&7]};h.ud=function(a,b){b=b>>1&7;this.b.pa[1][b]=a;this.b.S[1][b]&=65295};h.Qc=function(a){return this.b.pa[1][(a>>1&7)+8]};h.sd=function(a,b){b=(b>>1&7)+8;this.b.pa[1][b]=a;this.b.S[1][b]&=65295};h.Fc=function(a){return this.b.S[0][a>>1&7]};
h.jd=function(a,b){this.b.S[0][b>>1&7]=a&65295};h.Dc=function(a){return this.b.S[0][(a>>1&7)+8]};h.gd=function(a,b){this.b.S[0][(b>>1&7)+8]=a&65295};h.Ec=function(a){return this.b.pa[0][a>>1&7]};h.hd=function(a,b){b=b>>1&7;this.b.pa[0][b]=a;this.b.S[0][b]&=65295};h.Cc=function(a){return this.b.pa[0][(a>>1&7)+8]};h.fd=function(a,b){b=(b>>1&7)+8;this.b.pa[0][b]=a;this.b.S[0][b]&=65295};h.Zc=function(a){return this.b.S[3][a>>1&7]};h.Bd=function(a,b){this.b.S[3][b>>1&7]=a&65295};
h.Xc=function(a){return this.b.S[3][(a>>1&7)+8]};h.zd=function(a,b){this.b.S[3][(b>>1&7)+8]=a&65295};h.Yc=function(a){return this.b.pa[3][a>>1&7]};h.Ad=function(a,b){b=b>>1&7;this.b.pa[3][b]=a;this.b.S[3][b]&=65295};h.Wc=function(a){return this.b.pa[3][(a>>1&7)+8]};h.yd=function(a,b){b=(b>>1&7)+8;this.b.pa[3][b]=a;this.b.S[3][b]&=65295};h.ra=function(a){a&=7;return this.b.K&2048?this.b.Ha[a]:this.b.u[a]};h.ua=function(a,b){b&=7;this.b.K&2048?this.b.Ha[b]=a:this.b.u[b]=a};
h.Zb=function(){return this.b.K&49152?this.b.ta[0]:this.b.u[6]};h.jc=function(a){this.b.K&49152?this.b.ta[0]=a:this.b.u[6]=a};h.bc=function(){return this.b.u[7]};h.mc=function(a){this.b.u[7]=a};h.sa=function(a){a&=7;return this.b.K&2048?this.b.u[a]:this.b.Ha[a]};h.va=function(a,b){b&=7;this.b.K&2048?this.b.u[b]=a:this.b.Ha[b]=a};h.$b=function(){return 1==(this.b.K&49152)>>14?this.b.u[6]:this.b.ta[1]};h.kc=function(a){1==(this.b.K&49152)>>14?this.b.u[6]=a:this.b.ta[1]=a};
h.ac=function(){return 3==(this.b.K&49152)>>14?this.b.u[6]:this.b.ta[3]};h.lc=function(a){3==(this.b.K&49152)>>14?this.b.u[6]=a:this.b.ta[3]=a};h.Bc=function(a){return this.b.gc[a-65504>>1]};h.ed=function(a,b){this.b.gc[b-65504>>1]=a};h.cc=function(a){return 65520==a?61183:0};h.nc=function(){};h.Vc=function(){return 1};h.xd=function(){};h.Ac=function(){return this.b.$};h.dd=function(){this.b.$=0};h.Hc=function(){return this.b.fc};h.ld=function(a,b){b&1||(a&=255);this.b.fc=a};h.Mc=function(){return this.b.Gb};
h.od=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Gb=a;b.D|=2};h.Uc=function(){return this.b.Pa&65280};h.wd=function(a){this.b.Pa=a|255};h.Nc=function(){return Ub(this.b)};h.pd=function(a){Vb(this.b,a&-1809|Ub(this.b)&1808);this.b.D|=128};h.reset=function(){this.g.tb=this.g.tb&-120|20;this.f.Ma=0};
var L={},K=(L[62592]=[null,null,J.prototype.Tc,J.prototype.vd,"SISDR"],L[62608]=[null,null,J.prototype.Rc,J.prototype.td,"SDSDR"],L[62624]=[null,null,J.prototype.Sc,J.prototype.ud,"SISAR"],L[62640]=[null,null,J.prototype.Qc,J.prototype.sd,"SDSAR"],L[62656]=[null,null,J.prototype.Fc,J.prototype.jd,"KISDR"],L[62672]=[null,null,J.prototype.Dc,J.prototype.gd,"KDSDR"],L[62688]=[null,null,J.prototype.Ec,J.prototype.hd,"KISAR"],L[62704]=[null,null,J.prototype.Cc,J.prototype.fd,"KDSAR"],L[62798]=[null,null,
J.prototype.Lc,J.prototype.nd,"MMR3"],L[65382]=[null,null,J.prototype.Gc,J.prototype.kd,"LKS"],L[65402]=[null,null,J.prototype.Ic,J.prototype.md,"MMR0"],L[65404]=[null,null,J.prototype.Jc,null,"MMR1"],L[65406]=[null,null,J.prototype.Kc,null,"MMR2"],L[65408]=[null,null,J.prototype.Zc,J.prototype.Bd,"UISDR"],L[65424]=[null,null,J.prototype.Xc,J.prototype.zd,"UDSDR"],L[65440]=[null,null,J.prototype.Yc,J.prototype.Ad,"UISAR"],L[65456]=[null,null,J.prototype.Wc,J.prototype.yd,"UDSAR"],L[65472]=[J.prototype.ra,
J.prototype.ua,J.prototype.ra,J.prototype.ua,"R0SET0"],L[65473]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R1SET0"],L[65474]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R2SET0"],L[65475]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R3SET0"],L[65476]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R4SET0"],L[65477]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R5SET0"],L[65478]=[J.prototype.Zb,J.prototype.jc,J.prototype.Zb,
J.prototype.jc,"R6KERNEL"],L[65479]=[J.prototype.bc,J.prototype.mc,J.prototype.bc,J.prototype.mc,"R7KERNEL"],L[65480]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R0SET1"],L[65481]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R1SET1"],L[65482]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R2SET1"],L[65483]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R3SET1"],L[65484]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R4SET1"],
L[65485]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R5SET1"],L[65486]=[J.prototype.$b,J.prototype.kc,J.prototype.$b,J.prototype.kc,"R6SUPER"],L[65487]=[J.prototype.ac,J.prototype.lc,J.prototype.ac,J.prototype.lc,"R6USER"],L[65504]=[null,null,J.prototype.Bc,J.prototype.ed,"CTRL",1170],L[65520]=[null,null,J.prototype.cc,J.prototype.nc,"LSIZE",1170],L[65522]=[null,null,J.prototype.cc,J.prototype.nc,"HSIZE",1170],L[65524]=[null,null,J.prototype.Vc,J.prototype.xd,"SYSID",1170],L[65526]=
[null,null,J.prototype.Ac,J.prototype.dd,"CPUERR",1170],L[65528]=[null,null,J.prototype.Hc,J.prototype.ld,"MB",1170],L[65530]=[null,null,J.prototype.Mc,J.prototype.od,"PIR"],L[65532]=[null,null,J.prototype.Uc,J.prototype.wd,"SL"],L[65534]=[null,null,J.prototype.Nc,J.prototype.pd,"PSW"],L);K[62594]=K[62592];K[62596]=K[62592];K[62598]=K[62592];K[62600]=K[62592];K[62602]=K[62592];K[62604]=K[62592];K[62606]=K[62592];K[62610]=K[62608];K[62612]=K[62608];K[62614]=K[62608];K[62616]=K[62608];K[62618]=K[62608];
K[62620]=K[62608];K[62622]=K[62608];K[62626]=K[62624];K[62628]=K[62624];K[62630]=K[62624];K[62632]=K[62624];K[62634]=K[62624];K[62636]=K[62624];K[62638]=K[62624];K[62642]=K[62640];K[62644]=K[62640];K[62646]=K[62640];K[62648]=K[62640];K[62650]=K[62640];K[62652]=K[62640];K[62654]=K[62640];K[62658]=K[62656];K[62660]=K[62656];K[62662]=K[62656];K[62664]=K[62656];K[62666]=K[62656];K[62668]=K[62656];K[62670]=K[62656];K[62674]=K[62672];K[62676]=K[62672];K[62678]=K[62672];K[62680]=K[62672];K[62682]=K[62672];
K[62684]=K[62672];K[62686]=K[62672];K[62690]=K[62688];K[62692]=K[62688];K[62694]=K[62688];K[62696]=K[62688];K[62698]=K[62688];K[62700]=K[62688];K[62702]=K[62688];K[62706]=K[62704];K[62708]=K[62704];K[62710]=K[62704];K[62712]=K[62704];K[62714]=K[62704];K[62716]=K[62704];K[62718]=K[62704];K[65410]=K[65408];K[65412]=K[65408];K[65414]=K[65408];K[65416]=K[65408];K[65418]=K[65408];K[65420]=K[65408];K[65422]=K[65408];K[65426]=K[65424];K[65428]=K[65424];K[65430]=K[65424];K[65432]=K[65424];K[65434]=K[65424];
K[65436]=K[65424];K[65438]=K[65424];K[65442]=K[65440];K[65444]=K[65440];K[65446]=K[65440];K[65448]=K[65440];K[65450]=K[65440];K[65452]=K[65440];K[65454]=K[65440];K[65458]=K[65456];K[65460]=K[65456];K[65462]=K[65456];K[65464]=K[65456];K[65466]=K[65456];K[65468]=K[65456];K[65470]=K[65456];K[65506]=K[65504];K[65508]=K[65504];K[65510]=K[65504];K[65512]=K[65504];K[65514]=K[65504];K[65516]=K[65504];K[65518]=K[65504];
La(function(){for(var a=A(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=z(c);switch(d.name){case "default":d=new J(d),eb(d,c)}}});var Wb;if(wb){var fc=new ArrayBuffer(2);(new DataView(fc)).setUint16(0,256,!0);Wb=256===(new Uint16Array(fc))[0]}else Wb=!1;var gc=Wb;
function H(a,b,c,d,e,f){this.b=a;this.id=hc+=2;this.f=null;this.w=b;this.qb=c;this.size=d||0;this.type=e||ic;this.B=e==jc;this.controller=null;Bb(this);this.La=this.sc=!1;if(d)if(f)this.controller=f,this.f=null,kc(this,f.gb);else if(wb)this.C=new ArrayBuffer(d),this.G=new DataView(this.C,0,d),this.g=new Uint8Array(this.C,0,d),this.I=new Uint16Array(this.C,0,d>>1),this.f=new Int32Array(this.C,0,d>>2),kc(this,gc?lc:mc);else{this.f=Array(d>>2);for(a=0;a<this.f.length;a++)this.f[a]=0;kc(this,nc)}else kc(this)}
var ic=0,jc=2,Hb=4,Kb=["NONE","RAM","ROM","VID","H/W"],hc=0;
H.prototype={constructor:H,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.G.getInt32(b<<2,!0);else a=this.f;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.G.setInt32(b<<2,a[b],!0);else this.f=a;return this.La=!0}return!1},Sa:function(a,b){b?this.F++||oc(this,pc,!1):this.J++||qc(this,pc,!1)},L:function(){this.j&&F(this.j,128)&&(D(this.j,"attempt to read invalid block %"+
k(this.w),!0),this.j.ea());return 255},A:function(a,b){this.j&&F(this.j,128)&&(D(this.j,"attempt to write "+k(b,4,!0)+" to invalid block %"+k(this.w),!0),this.j.ea())},M:function(a,b){return this.ub(a++,b++)|this.ub(a,b)<<8},H:function(a,b,c){this.vb(a++,b&255,c++);this.vb(a,b>>8,c)},W:function(a){return this.f[a>>2]>>>((a&3)<<3)&255},ga:function(a,b){a&1&&this.b.O(4,b);b=a>>2;a=(a&3)<<3;var c=this.f[b]>>a;return 24>a?c&65535:c&255|(this.f[b+1]&255)<<8},oa:function(a,b){var c=a>>2;a=(a&3)<<3;this.f[c]=
this.f[c]&~(255<<a)|b<<a;this.La=!0},Ya:function(a,b,c){a&1&&this.b.O(4,c);c=a>>2;a=(a&3)<<3;24>a?this.f[c]=this.f[c]&~(65535<<a)|b<<a:(this.f[c]=this.f[c]&16777215|b<<24,c++,this.f[c]=this.f[c]&-256|b>>8);this.La=!0},T:function(a,b){if(this.j&&null!=this.w){var c=this.j;rc(c,this.w+a,1,c.N)&&c.ea(!0)}return this.Cb(a,b)},ca:function(a,b){if(this.j&&null!=this.w){var c=this.j;rc(c,this.w+a,2,c.N)&&c.ea(!0)}return this.Db(a,b)},ka:function(a,b,c){if(this.j&&null!=this.w){var d=this.j;rc(d,this.w+a,
1,d.G)&&d.ea(!0)}this.B?this.A(a,b,c):this.wb(a,b,c)},wa:function(a,b,c){if(this.j&&null!=this.w){var d=this.j;rc(d,this.w+a,2,d.G)&&d.ea(!0)}this.B?this.A(a,b,c):this.Jb(a,b,c)},N:function(a){return this.g[a]},V:function(a,b){a=this.g[a];this.j&&F(this.j,128)&&D(this.j,"Memory.readByte("+I(this.j,b)+"): "+I(this.j,a),!0);return a},aa:function(a,b){a&1&&this.b.O(4,b);return this.G.getUint16(a,!0)},da:function(a,b){a&1&&this.b.O(4,b);a=a&1?this.g[a]|this.g[a+1]<<8:this.I[a>>1];this.j&&F(this.j,128)&&
D(this.j,"Memory.readWord("+I(this.j,b)+"): "+I(this.j,a),!0);return a},ia:function(a,b){this.g[a]=b;this.La=!0},la:function(a,b,c){this.g[a]=b;this.La=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0)},qa:function(a,b,c){a&1&&this.b.O(4,c);this.G.setUint16(a,b,!0);this.La=!0},xa:function(a,b,c){a&1&&this.b.O(4,c);a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.I[a>>1]=b;this.La=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeWord("+I(this.j,c)+","+I(this.j,b)+")",
!0)}};function Bb(a,b,c){a.j=b;a.J=a.F=0;c&&((a.J=c.J)&&qc(a,pc,!1),(a.F=c.F)&&oc(a,pc,!1))}function sc(a,b){b?--a.F||(a.vb=a.B?a.A:a.wb,a.oc=a.B?a.H:a.Jb):--a.J||(a.ub=a.Cb,a.dc=a.Db)}function oc(a,b,c){c&&a.F||(a.vb=!a.B&&b[1]||a.A,a.oc=!a.B&&b[3]||a.H);if(c||void 0===c)a.wb=b[1]||a.A,a.Jb=b[3]||a.H}function qc(a,b,c){c&&a.J||(a.ub=b[0]||a.L,a.dc=b[2]||a.M);if(c||void 0===c)a.Cb=b[0]||a.L,a.Db=b[2]||a.M}function kc(a,b){b||(b=tc);qc(a,b,void 0);oc(a,b,void 0)}
var tc=[],nc=[H.prototype.W,H.prototype.oa,H.prototype.ga,H.prototype.Ya],pc=[H.prototype.T,H.prototype.ka,H.prototype.ca,H.prototype.wa];if(wb)var mc=[H.prototype.N,H.prototype.ia,H.prototype.aa,H.prototype.qa],lc=[H.prototype.V,H.prototype.la,H.prototype.da,H.prototype.xa];
function uc(a,b){r.call(this,"CPU",a,uc,1);var c=a.multiplier||1;this.Qa=a.cycles||b;this.Na=c;this.ab=Math.round(this.Qa/1E4)/100;this.Va=this.ab*this.Na;this.v.ba=!1;this.v.Hb=!1;this.v.hb=a.autoStart;this.v.Mb=!1;this.v.$a=!1;this.lb=this.ia=0;this.mb=a.csStart;this.bb=a.csInterval;this.cb=a.csStop;this.L=[];this.Vb=this.cd.bind(this);G(this)}y(uc);var vc=["power","reset"];h=uc.prototype;
h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.j=d;for(b=0;b<vc.length;b++)(c=this.J[vc[b]])&&this.F.ja(null,vc[b],c);this.oa=null;a=wc(a,"autoStart");null!=a&&(this.v.hb="true"==a?!0:"false"==a?!1:!!a);G(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};
h.Ca=function(a,b){if(!b){if(a&&this.restore){xc(this);if(!this.restore(a))return!1;yc(this)}else this.reset();this.j?(a=this.j,a.i("Type ? for help with PDP11 Debugger commands"),a.za(),a.Ja&&(b=a.Ja,a.Ja=null,zc(a,b))):this.i("No debugger detected")}M(this);return!0};h.Ba=function(a){return a?this.save():!0};h.hb=function(){return this.v.hb||!this.j&&void 0===this.J.run?(this.eb(!0),!0):!1};h.Ob=function(){return 0};
function yc(a){void 0===a.mb&&(a.mb=0);void 0===a.bb&&(a.bb=-1);void 0===a.cb&&(a.cb=-1);a.v.$a=0<=a.mb&&0<a.bb;a.v.$a&&(a.lb=0,a.ia=a.mb-a.ga)}function Ac(a,b){if(a.v.$a){var c=!1;a.lb=a.lb+a.Ob()|0;a.ia-=b;0>=a.ia&&(a.ia+=a.bb,c=!0);0<=a.cb&&a.cb<=Bc(a)&&(a.bb=a.cb=-1,yc(a),a.ea(),c=!0);c&&a.i(Bc(a)+" cycles: checksum="+k(a.lb))}}
function Cc(a,b,c,d){if(a.J[b]){void 0===c&&(vb(a,"Value for "+b+" is invalid"),a.ea());var e=a.j&&a.j.ia||8;c=!a.v.ba||a.v.Mb?8==e?ba(c,d):k(c,d):"--------".substr(0,d||4);a.J[b].textContent!=c&&(a.J[b].textContent=c)}}
h.ja=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.J[b]=c;a=!0;break;case "run":this.J[b]=c;c.onclick=function(){var a;if(a=d.F)if(a=d.F,a.v.fa)a=!0;else{var b=null,c,l=bb(a.id);for(c=0;c<l.length&&(b=l[c],b===a||b.v.ready);c++);if(c==l.length)for(c=0;c<l.length&&(b=l[c],b===a||b.v.fa);c++);c==l.length&&(b=a);m("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.rb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ba?d.ea():d.eb())};
a=!0;break;case "speed":this.J[b]=c;a=!0;break;case "setSpeed":this.J[b]=c,c.onclick=function(){Dc(d,d.Na<<1,!0)},c.textContent=this.Va.toFixed(2)+"Mhz",a=!0}return a};function Ec(a,b,c){a.ga+=b;c&&(a.N=a.b=0)}function Fc(a,b){var c=1;b&&1<a.Na&&a.ca&&(c=a.ca/a.ab);a.Sb=Math.round(1E3/30);a.Ra=Math.floor(a.Qa/30*c);b||(a.ka=a.Ra);a.kb=0}function Bc(a){return a.ga+a.W+a.N-a.b}function xc(a){a.ca=0;a.Ub=0;a.ga=a.W=a.N=a.b=0;yc(a);Dc(a,1)}
function Dc(a,b,c){var d=!1;if(void 0!==b){.8>a.ca/a.Va?b=1:d=!0;a.Na=b;b=a.ab*a.Na;if(a.Va!=b){a.Va=b;b=a.Va.toFixed(2)+"Mhz";var e=a.J.setSpeed;e&&(e.textContent=b);a.i("target speed: "+b)}c&&a.F&&a.F.pb()}Ec(a,a.W);a.W=0;a.V=ra();a.da=0;Fc(a);return d}function Pb(a,b){var c=a.L.length;a.L.push([-1,b]);return c}function Rb(a,b,c){0<=b&&b<a.L.length&&0>a.L[b][0]&&(c*=a.Qa*a.Na/1E3,a.L[b][0]=c)}function Gc(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||b>d[0]&&(b=d[0])}return b}
function Hc(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}
h.cd=function(){if(this.v.ba){this.kb>=this.Qa&&Fc(this,!0);this.qa=0;this.Ja=ra();if(this.da){var a=this.Ja-this.da;a>this.Sb&&(this.V+=a,this.V>this.Ja&&(this.V=this.Ja))}try{do{var b=Gc(this,this.v.$a?1:this.Ra);try{this.fb(b)}catch(e){if("number"!=typeof e)throw e;}var c=this.N-this.b;Hc(this,c);this.qa+=c;this.W+=c;Ec(this,0,!0);Ac(this,c);this.ka-=c;if(0>=this.ka){this.ka+=this.Ra;15<=++this.Ub&&(this.F&&this.F.za(),this.Ub=0);break}}while(this.v.ba)}catch(e){this.ea();M(this);this.F&&this.F.stop(ra(),
Bc(this));vb(this,e.stack||e.message);return}if(this.v.ba){a=setTimeout;b=this.Vb;this.da=ra();c=this.Sb;this.qa&&(c=Math.round(c*this.qa/this.Ra));var c=c-(this.da-this.Ja),d=this.da-this.V;d&&(this.ca=Math.round(this.W/(10*d))/100,864E5<=d&&(this.ga=0,Dc(this)));if(0>c||this.ca<this.Va)-1E3>c&&(this.V-=c),c=0;this.kb+=this.qa;this.da+=c;a(b,c)}}};
h.eb=function(a){if(ib(this))return!1;if(this.v.ba)return this.i(this.toString()+" busy"),!1;Dc(this);this.v.ba=!0;this.v.Hb=!0;this.oa&&this.oa.start();var b=this.J.run;b&&(b.textContent="Halt");this.F&&(a&&this.F.pb(!0),this.F.start(this.V,Bc(this)));M(this,!0);setTimeout(this.Vb,0);return!0};h.fb=function(){return 0};
h.ea=function(a){if(this.v.ba){this.N-=this.b;this.b=0;Ec(this,this.W);this.W=0;this.v.ba=!1;this.oa&&this.oa.stop();var b=this.J.run;b&&(b.textContent="Run");this.F&&this.F.stop(ra(),Bc(this));M(this)}this.v.complete=a};function M(a,b){a.F&&a.F.za(b)}
function Ic(a){this.Xb=+a.model||1170;this.yc=a.resetAddr||0;uc.call(this,a,6666667);this.sb=0;this.decode=bd.bind(this);this.P=65536;this.R=32768;this.Y=65535;this.U=32768;this.K=15;this.u=[0,0,0,0,0,0,0,this.yc];this.Ha=[0,0,0,0,0,0];this.ta=[0,0,0,0];this.xa=this.C=0;this.wc=[4,2,0,1];this.S=[[0,0,0,0,0,0,0,0,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]];this.pa=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.zc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.gc=[0,0,0,0,0,0,0,0];this.g=this.f=this.Za=this.H=this.I=this.D=this.fc=0;this.la=-1;cd(this);this.v.complete=this.v.rc=!1}y(Ic,uc);h=Ic.prototype;h.reset=function(){this.v.ba&&this.ea();cd(this);xc(this);this.v.error=!1;this.parent.reset.call(this)};
function cd(a){a.Pa=255;a.$=0;a.Gb=0;a.G=0;a.Oa=0;a.Fb=0;a.Wa=0;a.Bb=0;a.wa=0;a.jb=262143;a.Ia=253952;a.A=[];a.D|=2;Sb(a)}function Sb(a){a.Bb?(a.aa=65536,a.M=a.uc,a.T=a.ec,a.Wb=a.Dd):(a.aa=0,a.M=a.tc,a.T=a.$c,a.Wb=a.Cd)}h.Ob=function(){return 0};h.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.ga,this.Na]);a.set(2,Mb(this.B));return a.data()};
h.restore=function(a){var b=a[1];this.ga=b[1];Dc(this,b[3]);a:{b=this.B;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 n=e[l++],p=e[l++];n--;)g[f++]=p;e=g}f=b.X[d];if(!f||!f.restore(e)){m("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
h.ja=function(a,b,c){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":this.J[b]=c;this.sb++;a=!0;break;default:a=this.parent.ja.call(this,a,b,c)}return a};
h.za=function(a){if(this.sb&&(a||!this.v.ba||this.v.Mb)){for(a=0;a<this.u.length;a++)Cc(this,"R"+a,this.u[a]);a=Ub(this);Cc(this,"PS",a);Cc(this,"NF",a&8?1:0,1);Cc(this,"ZF",a&4?1:0,1);Cc(this,"VF",a&2?1:0,1);Cc(this,"CF",a&1?1:0,1)}if(a=this.J.speed)a.textContent=this.v.ba&&this.ca?this.ca.toFixed(2)+"Mhz":"Stopped"};function dd(a){return a.P&65536?1:0}function ed(a){return a.R&32768?2:0}function fd(a){return a.Y&65535?0:4}h.Fa=function(){return this.U&32768?8:0};
function gd(a){var b=a.T(a.u[7]);a.u[7]=a.u[7]+2&65535;return b}function hd(a,b){a.u[7]=b&65535}function Qb(a,b,c,d,e){for(var f=a.A.length;0<f--;)if(a.A[f].ic===d){0<f&&(a.A[f-1].Ea+=a.A[f].Ea);a.A.splice(f,1);break}if(0<=b){for(f=a.A.length;0<f--;){if(a.A[f].Ea>b){a.A[f].Ea-=b;break}b-=a.A[f].Ea}a.A.splice(f+1,0,{Ea:b,Yb:c<<5&224,ic:d,Ab:e})}a.D|=2}function Ub(a){return a.K=a.K&63728|a.Fa()|fd(a)|ed(a)|dd(a)}
function Vb(a,b){a.U=b<<12;a.Y=~b&4;a.R=b<<14;a.P=b<<16;if((b^a.K)&2048)for(var c=a.Ha.length;0<=--c;){var d=a.u[c];a.u[c]=a.Ha[c];a.Ha[c]=d}a.C=b>>14&3;c=a.K>>14&3;a.C!=c&&(a.ta[c]=a.u[6],a.u[6]=a.ta[a.C]);a.D|=2;a.K=b}function O(a,b){a.D&128||(a.U=a.Y=b,a.R=0)}function id(a,b,c){a.D&128||(a.U=a.Y=a.P=b,a.R=c||0)}function jd(a,b,c,d){a.D&128||(a.U=a.Y=a.P=b,a.R=(c^b)&(d^b))}function kd(a,b){a.D&128||(a.U=a.Y=a.P=b,a.R=a.U^a.P>>1)}function ld(a,b,c,d){a.D&128||(a.U=a.Y=a.P=b,a.R=(c^d)&(d^b))}
h.O=function(a){var b=!1;0>this.la?this.la=Ub(this):this.C||(a=4,b=!0);this.G&57344||(this.Oa=63222,this.Fb=a);this.C=0;var c=this.T(a|this.aa),d=this.T(a+2&65535|this.aa);Vb(this,d&-12289|this.la>>2&12288);b&&(this.$|=4,this.u[6]=4);md(this,this.la);md(this,this.u[7]);hd(this,c);this.D&=-113;this.la=-1;throw a;};function nd(a){var b=od(a),c=od(a)&-1793;a.K&49152&&(c=c&-225|a.K&63712);hd(a,b);Vb(a,c);a.D&=-17}
function pd(a,b,c){var d,e,f,g=0;d=b>>13;a.Wa&a.wc[a.C]||(d&=7);e=a.S[a.C][d];f=(a.pa[a.C][d]<<6)+(b&8191)&a.jb;if(f<a.Ia)f&1&&!(c&1)&&(a.$|=64,a.O(4,10));else if(a.Wa&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var l=f>>13&31;31>l?a.Wa&32&&(f=a.zc[l]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Ia&&4186112>f&&(a.$|=32,a.O(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.S[a.C][d]=e;if(4194170!==f||a.C)a.wa=a.C,a.xa=d;g&&(g&57344&&(0<=a.la&&(g|=128),a.G&57344||(a.G=a.G|g|a.wa<<5|a.xa<<1),a.O(168,16)),a.G&61440||!(4191360>f||4194239<f)||(a.G|=4096,a.G&512&&(a.D|=32)));return f}function od(a){var b=a.T(a.u[6]|a.aa);a.u[6]=a.u[6]+2&65535;return b}
function md(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.G&57344||(a.Oa=a.Oa<<8|246);!a.C&&c<=a.Pa&&4<c&&(c<=a.Pa-32?(a.$|=4,a.u[6]=4,a.O(4,18)):(a.$|=8,a.D|=4));a.Wb(c,b)}
function qd(a,b,c,d){var e,f,g=d&8?0:a.aa;switch(b){case 0:return a.O(4,20),0;case 1:return 6===c&&!a.C&&d&4&&(a.u[6]<=a.Pa||65534<=a.u[6])&&(a.u[6]<=a.Pa-32||65534<=a.u[6]?(a.$|=4,a.u[6]=4,a.O(4,22)):(a.$|=8,a.D|=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.T(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.T(e)|g;a.b-=
8;break;case 6:return e=gd(a),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=gd(a),e=e+a.u[c]&65535,e=a.T(e|a.aa)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.G&57344||(a.Oa=a.Oa<<8|f<<3&248|c);6==c&&!a.C&&d&4&&0>=f&&(a.u[6]<=a.Pa||65534<=a.u[6])&&(a.u[6]<=a.Pa-32?(a.$|=4,a.u[6]=4,a.O(4,24)):(a.$|=8,a.D|=64));return e}h.tc=function(a,b,c){return qd(this,a,b,c)};h.uc=function(a,b,c){return pd(this,qd(this,a,b,c),c)};h.$c=function(a){return this.B.ma(a)};h.ec=function(a){return this.B.ma(pd(this,a,2))};
h.Cd=function(a,b){this.B.Xa(a,b&65535)};h.Dd=function(a,b){this.B.Xa(pd(this,a,4),b)};function rd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=qd(a,b,d,2),c&65536||61440!==(a.K&61440)&&(d&=65535),a.C=a.K>>12&3,c=a.T(d|c&a.aa),a.C=a.K>>14&3):c=6!=d||(a.K>>2&12288)===(a.K&12288)?a.u[d]:a.ta[a.K>>12&3];return c}
function sd(a,b,c,d){a.G&57344||(a.Oa=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=qd(a,b,e,4),c&65536||(e&=65535),a.C=a.K>>12&3,e=pd(a,e|c&65536,4),a.C=a.K>>14&3,a.B.Xa(e,d)):6!=e||(a.K>>2&12288)===(a.K&12288)?a.u[e]=d:a.ta[a.K>>12&3]=d}function td(a,b){b>>=6;var c=a.I=b&7;(b=a.H=(b&56)>>3)?(c=a.M(b,c,3),a=a.B.Ua(c)):a=a.u[c]&255;return a}function ud(a,b){b>>=6;var c=a.I=b&7;return(b=a.H=(b&56)>>3)?a.B.ma(a.M(b,c,2)):a.u[c]}function vd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return qd(a,b,c,8)}
function wd(a,b){var c=a.f=b&7;(b=a.g=(b&56)>>3)?(c=a.M(b,c,3),a=a.B.Ua(c)):a=a.u[c]&255;return a}function xd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.B.ma(a.M(b,c,2)):a.u[c]}function P(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.Za=a.M(b,e,7),c=d.call(a,c,a.B.Ua(e)),e&1&&a.b--,a.B.ob(e,c&255)):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function Q(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.M(b,e,6),a.B.Xa(e,d.call(a,c,a.B.ma(e)))):a.u[e]=d.call(a,c,a.u[e])}
function yd(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.M(b,e,5),d&1&&a.b--,a.B.ob(d,c&255)):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}function zd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.B.Xa(a.M(b,d,4),c):a.u[d]=c&65535;return c}function R(a,b,c){c&&(hd(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
h.fb=function(a){this.v.complete=!0;var b=this.v.rc=this.j&&Ad(this.j),c=a?this.v.Hb?0:1:-1;this.v.Hb=!1;this.N=this.b=a;do{if(b){if(Bd(this.j,this.u[7],c)){this.ea();break}c=1}if(this.D&&(this.D&112&&(this.D&32?this.O(168,28):this.D&64?this.O(4,30):this.D&16&&this.O(12,32),this.D&=-113),this.D&7))if(this.D&2){this.D&=-3;a=null;for(var d=this.Gb&224,e=this.A.length;0<=--e;){if(0<this.A[e].Ea){this.A[e].Ea--;this.D|=2;break}if(this.A[e].Ab){if(!this.A[e].Ab()){this.A.splice(e,1);continue}this.A[e].Ab=
null}this.A[e].Yb>d&&(d=this.A[e].Yb,a=this.A[e],this.A.splice(e,1))}d>(this.K&224)&&(this.D&4&&(this.u[7]=this.u[7]+2&65535,this.D&=-5),a?this.O(a.ic,26):this.O(160,26))}else this.D&1&&this.D++;this.G&57344||(this.Oa=0,this.Fb=this.u[7]);this.D=this.D&7|this.K&16;this.decode(gd(this))}while(0<this.b);return this.v.complete?this.N-this.b:void 0===this.v.complete?0:-1};La(function(){for(var a=A(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Ic(d);eb(d,c)}});
function Cd(a,b){var c=b+a;jd(this,c,a,b);return c&65535}function Dd(a,b){var c=b+a;jd(this,c<<8,a<<8,b<<8);return c&255}function Ed(a,b){a=b<<1;kd(this,a);return a&65535}function Fd(a,b){a=b<<1;kd(this,a<<8);return a&255}function Gd(a,b){a=b&32768|b>>1|b<<16;kd(this,a);return a&65535}function Hd(a,b){a=b&2048|b>>1|b<<8;kd(this,a<<8);return a&255}function Id(a,b){a=b&~a;O(this,a);return a}function Jd(a,b){a=b&~a;O(this,a<<8);return a}function Kd(a,b){a|=b;O(this,a);return a}
function Ld(a,b){a|=b;O(this,a<<8);return a}function Md(a,b){a=~b|65536;id(this,a);return a&65535}function Nd(a,b){a=~b|256;id(this,a<<8);return a&255}function Od(a,b){a=b-a;this.D&128||(this.U=this.Y=a,this.R=b&(b^a));return a&65535}function Pd(a,b){a=b-a;var c=a<<8;b<<=8;this.D&128||(this.U=this.Y=c,this.R=b&(b^c));return a&255}function Qd(a,b){a=b+a;this.D&128||(this.U=this.Y=a,this.R=a&(b^a));return a&65535}
function Rd(a,b){a=b+a;var c=a<<8;this.D&128||(this.U=this.Y=c,this.R=c&(b<<8^c));return a&255}function Sd(a,b){a=-b;id(this,a,a&b&32768);return a&65535}function Td(a,b){a=-b;id(this,a<<8,(a&b&128)<<8);return a&255}function Ud(a,b){a=b<<1|this.P>>16&1;kd(this,a);return a&65535}function Vd(a,b){a=b<<1|this.P>>16&1;kd(this,a<<8);return a&255}function Wd(a,b){a=(this.P&65536|b)>>1|b<<16;kd(this,a);return a&65535}function Xd(a,b){a=((this.P&65536)>>8|b)>>1|b<<8;kd(this,a<<8);return a&255}
function Yd(a,b){var c=b-a;ld(this,c,a,b);return c&65535}function Zd(a,b){var c=b-a;ld(this,c<<8,a<<8,b<<8);return c&255}function $d(a,b){this.D&128||(this.U=this.Y=b&65280,this.R=this.P=0);return(b<<8|b>>8)&65535}function ae(a,b){a^=b;O(this,a);return a&65535}
function be(a){var b=xd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.P=this.R=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.P=c<<17-b,c>>=b;else if(b)if(16<b)this.R=c,c=0;else{this.P=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.R=32768)}this.u[a]=c&65535;this.U=this.Y=c;this.b-=(this.g?6:7)+b}
function ce(a){var b=xd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.P=this.R=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.P=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.P=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.R=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.U=d>>16;this.Y=d>>16|d;this.b-=(this.g?6:7)+b}function S(a){a&1&&(this.P=0);a&2&&(this.R=0);a&4&&(this.Y=1);a&8&&(this.U=0);this.b-=5}
function de(a){var b=xd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.P=this.R=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.Y=d>>16|d,this.U=d>>16):(this.R=32768,this.Y=d>>15|d,this.U=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.Y=this.U=0,this.R=32768,this.P=65536,this.b-=7}var ee=[0,7,7,10,7,11,9,13];function fe(a){var b=this.b;hd(this,vd(this,a));this.b=b-ee[this.g]}
var ge=[0,14,14,17,14,18,16,20];function he(a){var b=this.b,c=vd(this,a);a=a>>6&7;md(this,this.u[a]);this.u[a]=this.u[7];hd(this,c);this.b=b-ge[this.g]}var ie=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],je=[7,13,13,17,14,18,17,21];function ke(a){var b=xd(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.D&128||(this.U=b>>16,this.Y=this.U|b,this.R=0,this.P=-32768>b||32767<b?65536:0);this.b-=23}
function le(){this.b-=5}function T(a){a&1&&(this.P=65536);a&2&&(this.R=32768);a&4&&(this.Y=0);a&8&&(this.U=32768);this.b-=5}function me(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)hd(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function ne(a){Q(this,a,0,$d);this.b-=this.g?9:3+(7==this.f?2:0)}function oe(a){Q(this,a,ud(this,a),ae);this.b-=this.g?9:3+(7==this.f?2:0)}function V(){this.O(8,6)}function bd(a){pe[a>>12].call(this,a)}
var pe=[function(a){qe[a>>8&15].call(this,a)},function(a){var b=ud(this,a),c=this.b;O(this,zd(this,a,b));this.b=c-ie[(this.H?8:0)+this.g]+(7!=this.f||this.g?0:2)},function(a){var b=ud(this,a);a=xd(this,a);ld(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){O(this,ud(this,a)&xd(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){Q(this,a,ud(this,a),Id);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?
2:0)},function(a){Q(this,a,ud(this,a),Kd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){Q(this,a,ud(this,a),Cd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){re[a>>8&15].call(this,a)},function(a){se[a>>8&15].call(this,a)},function(a){var b=td(this,a);O(this,yd(this,a,b,1)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){var b=td(this,a)<<8;a=wd(this,a)<<8;ld(this,b-a,a,b);this.b-=this.g?
4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){O(this,(td(this,a)&wd(this,a))<<8);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){P(this,a,td(this,a),Jd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){P(this,a,td(this,a),Ld);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){Q(this,a,ud(this,a),Yd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},V],qe=
[function(a){Me[a>>4&15].call(this,a)},function(a){R(this,a,!0)},function(a){R(this,a,!fd(this))},function(a){R(this,a,fd(this))},function(a){R(this,a,!this.Fa()==!ed(this))},function(a){R(this,a,!this.Fa()!=!ed(this))},function(a){R(this,a,!fd(this)&&!this.Fa()==!ed(this))},function(a){R(this,a,fd(this)||!this.Fa()!=!ed(this))},he,he,function(a){Ne[a>>6&3].call(this,a)},function(a){Oe[a>>6&3].call(this,a)},function(a){Pe[a>>6&3].call(this,a)},function(a){Qe[a>>6&3].call(this,a)},V,V],Ne=[function(a){id(this,
zd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Md);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,Qd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,Od);this.b-=this.g?9:3+(7==this.f?2:0)}],Oe=[function(a){Q(this,a,0,Sd);this.b-=this.g?11:6},function(a){Q(this,a,dd(this)?1:0,Cd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,dd(this)?1:0,Yd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=xd(this,a);id(this,a);this.b-=this.g?4:3+(7==this.f?
2:0)}],Pe=[function(a){Q(this,a,0,Wd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Ud);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Gd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Ed);this.b-=this.g?9:3+(7==this.f?2:0)}],Qe=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.ec(a|65536);hd(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=rd(this,a,0);md(this,a);O(this,a);this.b-=11},function(a){var b=od(this),c=this.b;sd(this,a,
0,b);O(this,b);this.b=c-je[this.g]},function(a){O(this,zd(this,a,this.Fa?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Me=[function(a){Re[a&15].call(this,a)},V,V,V,fe,fe,fe,fe,function(a){if(a&8)this.O(8,6);else{var b=od(this);a&=7;hd(this,this.u[a]);this.u[a]=b;this.b-=9}},function(a){a&8?(this.K&49152||(this.K=this.K&-2017|(a&7)<<5,this.D|=1),this.b-=5):this.O(8,6)},function(a){Se[a&15].call(this,a)},function(a){Te[a&15].call(this,a)},ne,ne,ne,ne],Re=[function(){this.K&49152?(this.$|=128,this.O(4,
3)):this.ea();this.b-=7},function(){this.D|=4;this.u[7]=this.u[7]+-2&65535;this.b-=3},function(){nd(this);this.D|=this.K&16;this.b-=13},function(){this.O(12,1);this.b-=5},function(){this.O(16,4);this.b-=25},function(){this.K&49152||(cd(this),this.B.reset());this.b-=667},function(){nd(this);this.b-=13},V,V,V,V,V,V,V,V,V],Se=[le,function(){this.P=0;this.b-=5},function(){this.R=0;this.b-=5},S,function(){this.Y=1;this.b-=5},S,S,S,function(){this.U=0;this.b-=5},S,S,S,S,S,S,S],Te=[le,function(){this.P=
65536;this.b-=5},function(){this.R=32768;this.b-=5},T,function(){this.Y=0;this.b-=5},T,T,T,function(){this.U=32768;this.b-=5},T,T,T,T,T,T,T],re=[ke,ke,de,de,be,be,ce,ce,oe,oe,V,V,V,V,me,me],se=[function(a){R(this,a,!this.Fa())},function(a){R(this,a,this.Fa())},function(a){R(this,a,!dd(this)&&!fd(this))},function(a){R(this,a,dd(this)||fd(this))},function(a){R(this,a,!ed(this))},function(a){R(this,a,ed(this))},function(a){R(this,a,!dd(this))},function(a){R(this,a,dd(this))},function(){this.O(24,2);
this.b-=25},function(){this.O(28,5);this.b-=5},function(a){Ue[a>>6&3].call(this,a)},function(a){Ve[a>>6&3].call(this,a)},function(a){We[a>>6&3].call(this,a)},function(a){Xe[a>>6&3].call(this,a)},V,V],Ue=[function(a){id(this,yd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Nd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,1,Rd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,1,Pd);this.b-=this.g?9:3+(7==this.f?2:0)}],Ve=[function(a){P(this,a,0,Td);this.b-=
this.g?11:6},function(a){P(this,a,dd(this)?1:0,Dd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,dd(this)?1:0,Zd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=wd(this,a);id(this,a<<8);this.b-=this.g?4:3+(7==this.f?2:0)}],We=[function(a){P(this,a,0,Xd);this.b-=this.g?9+(this.Za&1):3+(7==this.f?2:0)},function(a){P(this,a,0,Vd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Hd);this.b-=this.g?9+(this.Za&1):3+(7==this.f?2:0)},function(a){P(this,a,0,Fd);this.b-=this.g?9:3+(7==
this.f?2:0)}],Xe=[V,function(a){a=rd(this,a,65536);md(this,a);O(this,a);this.b-=11},function(a){var b=od(this),c=this.b;sd(this,a,65536,b);O(this,b);this.b=c-je[this.g]},V];function Ye(a){r.call(this,"ROM",a,Ye);this.f=null;this.C=a.addr;this.g=a.size;this.G=a.writable;this.F=a.alias;this.A=a.file;this.H=da(this.A);if(this.A){a=this.A;var b=ea(this.H);"json"!=b&&"hex"!=b&&(a=ga()+"/api/v1/dump?file="+this.A+"&format=bytes&decimal=true");var c=this;ua(a,null,!0,function(a,b,f){Ze(c,a,b,f)})}}y(Ye);
Ye.prototype.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;$e(this)};Ye.prototype.Ca=function(){if(this.Da){if(this.j){var a=this.j,b=this.id,c=this.C,d=this.g,e=this.Da,f=[],g;for(g in e){var l=e[g];"number"==typeof l&&(e[g]=l={o:l});var n=l.o,p=l.a;if(void 0!==n){var q=f,n=[n>>>0,g],v=qa(q,n,a.Lb);0>v&&q.splice(-(v+1),0,n)}p&&(l.a=p.replace(/''/g,'"'))}a.H.push({Id:b,w:c,vc:d,Da:e,Kb:f})}delete this.Da}return!0};Ye.prototype.Ba=function(){return!0};
function Ze(a,b,c,d){if(d)a.na("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.zb,b,c);var e;if("["==c.charAt(0)||"{"==c.charAt(0))try{var f,g,l=eval("("+c+")");if(f=l.bytes)a.f=f;else if(f=l.words)for(a.f=Array(2*f.length),g=e=0;e<f.length;e++)a.f[g++]=f[e]&255,a.f[g++]=f[e]>>8&255;else if(f=l.data)for(a.f=Array(4*f.length),g=e=0;e<f.length;e++)a.f[g++]=f[e]&255,a.f[g++]=f[e]>>8&255,a.f[g++]=f[e]>>16&255,a.f[g++]=f[e]>>24&255;else a.f=l;a.Da=l.symbols;if(!a.f.length){m("Empty ROM: "+
b);return}if(1==a.f.length){m(a.f[0]);return}}catch(n){a.na("ROM data error: "+n.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.f=Array(b.length),e=0;e<b.length;e++)a.f[e]=aa(b[e],16);$e(a)}}
function $e(a){if(!hb(a))if(!a.A)G(a);else if(a.f&&a.B){a.g||(a.g=a.f.length);if(a.f.length!=a.g)vb(a,"ROM size ("+k(a.f.length,8,!0)+") does not match specified size ("+k(a.g,8,!0)+")");else{var b;b=a.C;if(Gb(a.B,b,a.g,a.G?1:jc)){var c;for(c=0;c<a.f.length;c++){a.j&&a.j.g++;var d=a.B,e=b+c;d.X[(e&d.g)>>>d.Z].wb(e&d.f,a.f[c]&255,e);a.j&&a.j.g--}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++){for(var f=a,d=b[c],e=f.B,g=f.g,l=[],n=f.C>>>
e.Z;0<g&&n<e.X.length;)l.push(e.X[n++]),g-=e.ya;e=f.B;f=f.g;g=0;for(d>>>=e.Z;0<f&&d<e.X.length;){n=l[g++];if(!n)break;e.X[d++]=n;f-=e.ya}}delete a.f}}G(a)}}La(function(){for(var a=A(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Ye(d);eb(d,c)}});function af(a){r.call(this,"RAM",a,af);this.F=a.addr;this.g=a.size;this.f=!1}y(af);h=af.prototype;h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;G(this)};h.Ca=function(a,b){b||this.reset();return!0};
h.Ba=function(a){return a?this.save():!0};h.reset=function(){!this.f&&this.g&&Gb(this.B,this.F,this.g,1)&&(this.f=!0);this.f||m("No RAM allocated")};h.save=function(){return null};h.restore=function(){return!0};La(function(){for(var a=A(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new af(d);eb(d,c)}});function bf(a){r.call(this,"Keyboard",a,bf,65536);G(this)}y(bf);bf.prototype.ja=function(){return!1};bf.prototype.Ga=function(a,b,c,d){this.F=a;this.b=c;this.j=d;this.oa=null};
La(function(){for(var a=A(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new bf(d);eb(d,c)}});function W(a){this.A=this.G=null;this.V=a.tabSize;this.M=a.charBOL;this.H=0;r.call(this,"SerialPort",a,W,8388608);var b=a.binding;if("console"==b)this.G="";else{var c;a=cf;b&&(void 0===c&&(c="Panel"),(c=db(c,this.id))&&(b=c.J[b])&&this.ja(null,a,b))}this.I=this.L=null;this.exports={connect:this.Tb,receiveData:this.Eb}}y(W);var cf="buffer";h=W.prototype;
h.ja=function(a,b,c){var d=this;switch(b){case cf:return this.J[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.Eb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Eb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.b=c;this.j=d;var e=this;this.W=Pb(this.b,function(){e.f&128||!e.C.length||(e.T=e.C.shift(),e.f|=128,e.f&64&&Qb(e.b,40,4,48))});this.N=function(){e.g|=128;return!!(e.g&64)};Nb(b,this,df);G(this)};
h.Tb=function(){if(!this.I){var a=wc(this.F,"connection");if(a){var b=a.split("->");if(2==b.length){var c=oa(b[0]);if(c!=this.Ya)return;b=oa(b[1]);if(this.I=cb(b)){var d=this.I.exports;if(d){var e=d.connect;e&&e.call(this.I);if(this.L=d.receiveData){this.status(this.zb+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.Ca=function(a,b){if(!b)if(this.Tb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.Ba=function(a){return a?this.save():!0};h.reset=function(){ef(this)};h.save=function(){var a=new N(this);a.set(0,[]);return a.data()};h.restore=function(){return ef(this)};function ef(a){a.T=0;a.f=0;a.g=128;a.C=[];return!0}h.Eb=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);Rb(this.b,this.W,50);return!0};h.Pc=function(){return this.f&65535};h.rd=function(a){this.f=this.f&-112|a&111};
h.Oc=function(){this.f&=-129;0<this.C.length&&Rb(this.b,this.W,50);return this.T};h.qd=function(){};h.bd=function(){return this.g};h.Fd=function(a){128==(this.g&192)&&a&64&&Qb(this.b,8,4,52,this.N);this.g=this.g&-70|a&69};h.ad=function(){return 0};
h.Ed=function(a){if(a&=255){D(this,"transmitByte("+k(a,2,!0)+")");this.L&&this.L.call(this.I,a);if(this.A)if(13==a)this.H=0;else if(8==a)this.A.value=this.A.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=pa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.V||8,c=a-this.H%a,this.V&&(b=na("",c)));this.M&&!this.H&&c&&(b=String.fromCharCode(this.M)+b);this.A.value+=b;this.A.scrollTop=this.A.scrollHeight;this.H+=c}else if(null!=this.G){if(10==a||1024<=this.G.length)this.i(this.G),
this.G="";10!=a&&(this.G+=String.fromCharCode(a))}this.g&=-129;Qb(this.b,100,4,52,this.N)}};var ff={},df=(ff[65392]=[null,null,W.prototype.Pc,W.prototype.rd,"RCSR"],ff[65394]=[null,null,W.prototype.Oc,W.prototype.qd,"RBUF"],ff[65396]=[null,null,W.prototype.bd,W.prototype.Fd,"XCSR"],ff[65398]=[null,null,W.prototype.ad,W.prototype.Ed,"XBUF"],ff);La(function(){for(var a=A(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new W(d);eb(d,c)}});
function gf(a){r.call(this,"Debugger",a,gf);this.ia=a.base||16;this.xa=!1;this.T=this.wa=this.I=0;this.W=!1;this.C=-1;this.A=[];this.ca={}}y(gf);var hf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};gf.prototype.Pb=function(){return-1};gf.prototype.Qb=function(){};
function jf(a,b,c,d){if(c)if(b){0>a.C&&a.A.length&&(a.C=0);if(0>a.C||b!=a.A[a.C])a.A.splice(0,0,b),a.C=0;a.C--}else a.W?b="end":b=a.A[a.C+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(oa(b.substring(c,f))),c=f+1}}return a}
function kf(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 sf(a,b,c){var d;if(b){b=tf(a,b);for(var e=0,f=!1,g=b,k=[],m=[],n=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<n.length;){var p=n[e++],t=p.length,p=pa(p);if(!p){f=!0;break}p=uf(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}k.push(p);if(e==n.length)break;var p=n[e++],r=p.length;m.length&&pf[p]<pf[m[m.length-1]]&&rf(k,m,1);m.push(p);b=b.substr(t+r)}rf(k,m)&&1==k.length||(f=!0);f?c&&a.i("error parsing '"+g+"' at character "+(g.length-b.length)):(d=k.pop(),c&&vf(a,null,
d))}return d}function tf(a,b){for(var c,d=a.Ca?"(":"{",e=a.Ca?")":"}",f=new RegExp(a.Ca?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=sf(a,c[1]);b=b.replace(d+c[1]+e,null!=g?I(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.X-a.Ba}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
function uf(a,b,c,d){var e;null!=b?(e=a.Ac(b),0<=e?e=a.Bc(e):(e=a.ha[b],null==e&&(e=aa(b,a.na))),null!=e||d||a.i("invalid "+(c?c:"value")+": "+b)):d||a.i("missing "+(c||"value"));return e}
function vf(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 k=0;k<f;k++){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+". "+ca(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.i((null!=b?b+": ":"")+d);return e}function wf(a,b){if(b)return vf(a,b,a.ha[b]);var c=0;for(b in a.ha)vf(a,b,a.ha[b]),c++;return 0<c}
function I(a,b,c,d){switch(a.na){case 8:a=ca(b,3*c);break;case 10:a=b.toString();break;default:a=l(b,2*c)}d&&"0"==a.charAt(0)&&(a=a.replace(/^0+([0-9A-F]+)$/i,"$1"));return a}
function xf(a){of.call(this,a);this.Ca=!0;this.R=Y(0);this.fb=Y(0);this.Z=Y(0);this.H=[];this.f=this.S=this.G=[];yf(this);this.ra=0;zf(this);this.Sa={};Af(this,a.messages);this.Ta=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Fc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Fc(b,a)})}y(xf,of);
var Bf={"?":"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"},Cf="NONE 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(" "),
Df={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 lf(a,b,c){var d;if(b){b=mf(a,b);for(var e=0,f=!1,g=b,l=[],n=[],p=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<p.length;){var q=p[e++],v=q.length,q=oa(q);if(!q){f=!0;break}q=nf(a,q,null,!1===c);if(void 0===q){f=!0;c=!1;break}l.push(q);if(e==p.length)break;var q=p[e++],u=q.length;n.length&&hf[q]<hf[n[n.length-1]]&&kf(l,n,1);n.push(q);b=b.substr(v+u)}kf(l,n)&&1==l.length||(f=!0);f?c&&a.i("error parsing '"+g+"' at character "+(g.length-b.length)):(d=l.pop(),c&&of(a,null,
d))}return d}function mf(a,b){for(var c,d=a.xa?"(":"{",e=a.xa?")":"}",f=new RegExp(a.xa?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=lf(a,c[1]);b=b.replace(d+c[1]+e,null!=g?I(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.T-a.wa}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
function nf(a,b,c,d){var e;null!=b?(e=a.Pb(b),0<=e?e=a.Qb(e):(e=a.ca[b],null==e&&(e=aa(b,a.ia))),null!=e||d||a.i("invalid "+(c?c:"value")+": "+b)):d||a.i("missing "+(c||"value"));return e}
function of(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 l=0;l<f;l++){g&&(g=","+g);var n=d&255,p=8,q="";p?32<p&&(p=32):p=32;if(null==n||isNaN(n))for(;0<p--;)q="?"+q;else for(;0<p--;)q=(n&1?"1":"0")+q,n>>=1;g=q+g;d>>=8}d=k(c,0,!0)+" "+c+". "+ba(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.i((null!=b?b+": ":"")+d);return e}function pf(a,b){if(b)return of(a,b,a.ca[b]);var c=0;for(b in a.ca)of(a,b,a.ca[b]),c++;return 0<c}
function I(a,b,c,d){switch(a.ia){case 8:a=ba(b,3*c);break;case 10:a=b.toString();break;default:a=k(b,2*c)}d&&"0"==a.charAt(0)&&(a=a.replace(/^0+([0-9A-F]+)$/i,"$1"));return a}
function qf(a){gf.call(this,a);this.xa=!0;this.M=X(0);this.Qa=X(0);this.V=X(0);this.H=[];this.f=this.N=this.G=[];rf(this);this.la=0;sf(this);this.Ia={};tf(this,a.messages);this.Ja=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return zc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return zc(b,a)})}y(qf,gf);
var uf={"?":"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"},vf="NONE 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(" "),
wf={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],35072:[107]},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]}};h=xf.prototype;
h.Pa=function(a,b,c,d){this.F=b;this.b=c;this.D=a;(a=Cc(a,"messages"))&&Af(this,a);this.sb=Df;Ef(this,function(a){a:{var b=d.F.aa,c=a[0],e=a=0,m=b.length;if(c){a=Z(Ff(d,c));if(-1===a){d.i("invalid address: "+c);break a}e=a>>>d.F.ca;m=1}d.i("blockid physical blockaddr used size type");d.i("-------- --------- ---------- ------ ------ ----");for(var c=-1,n=0;m--;){var p=b[e];p.type==c?n++||d.i("..."):(c=p.type,n=Kb[c],p&&d.i(l(p.id,8)+" %"+l(e<<d.F.ca,8)+" %%"+l(p.A,8)+" "+l(p.Rb,
4,!0)+" "+l(p.size,4,!0)+" "+n),c!=oc&&(c=-1),n=0);a+=d.F.Da;e++}}});G(this)};
h.pa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.qa=this.L[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Fc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.B<d.w.length-1&&(b=d.w[++d.B])):40==a.keyCode&&(0<d.B?b=d.w[--d.B]:(b="",d.B=-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.L[b]=c,Ga(c,function(){if(d.qa){var a=d.qa.value;
d.qa.value="";Fc(d,a,!0);return!0}return!1}),!0;case "step":return this.L[b]=c,Ga(c,function(a){var b=!1;hb(d,!0)||(gb(d,!0),b=d.Bb(a?1:0),gb(d,!1));return b}),!0}return!1};h.Qb=function(){this.qa&&this.qa.focus()};function Z(a){a=a&&a.A;null==a&&(a=-1);return a}h.mb=function(a,b){var c=255,d=Z(a);-1!==d&&(this.g++,c=this.F,c=c.aa[(d&c.g)>>>c.ca].lc(d&c.f,d),this.g--,b&&Gf(a,b));return c};h.Ia=function(a,b){var c=65535,d=Z(a);-1!==d&&(this.g++,c=Lb(this.F,d),this.g--,b&&Gf(a,b));return c};
h.Ob=function(a,b,c){var d=Z(a);if(-1!==d){this.g++;var e=this.F;e.aa[(d&e.g)>>>e.ca].dc(d&e.f,b&255,d);this.g--;c&&Gf(a,c);O(this.b,!0)}};h.qc=function(a,b,c){var d=Z(a);if(-1!==d){this.g++;var e=this.F;e.aa[(d&e.g)>>>e.ca].tc(d&e.f,b&65535,d);this.g--;c&&Gf(a,c);O(this.b,!0)}};function Y(a){return{A:a,Ha:!1}}function Hf(a){return[a.A,a.Ha]}function If(a){return{A:a[0],Ha:a[1]}}
function Ff(a,b,c){var d;c=(c?a.R:a.fb).A;if(void 0!==b){d=b=tf(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.H.length;c++){var f=a.H[c].La[d];if(void 0!==f){d=f.o;void 0!==d&&(e=Y(d));break}}if(d=e)return d;c=sf(a,b,void 0)}null!=c&&(d=Y(c));return d}function Jf(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Rc=qf(a,b.Nc=c[2]))}function Gf(a,b){null!=a.A&&(a.A+=b||1)}
function Af(a,b){a.j=a;a.ma=a.Tc=536870912;a.va=null;a.ya=[];a.g=0;b=qf(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in yb){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.ma|=yb[c],a.i(c+" messages enabled"))}}function Ef(a,b){for(var c in yb)if(64==yb[c]){a.Sa[c]=b;break}}
h.Ac=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 Kf(a){return 6>a?"R"+a:6==a?"SP":"PC"}h.Bc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Qa[a-8]:20>a?b=this.b.Aa[a-16]:20==a&&(b=Tb(this.b)));return b};
h.message=function(a,b){this.g||(b&&(a+=" @"+I(this,Y(this.b.u[7]).A)),this.ma&1073741824?this.ya.push(a):this.va&&a==this.va||(this.va=a,this.ma&-2147483648&&(this.ia(),a+=" (cpu halted)"),this.i(a),this.b&&(a=this.b,a.S-=a.b,a.b=0,a.qa=0,O(a))))};
function zf(a){var b;if(Gd(a)){if(!a.N||!a.N.length){a.N=Array(1E3);for(b=0;b<a.N.length;b++)a.N[b]=Y();a.la=0;a.i("instruction history buffer allocated")}if(!a.ka||!a.ka.length)for(a.ka=Array(256),b=0;b<a.ka.length;b++)a.ka[b]=[b,0]}else a.N&&a.N.length&&a.i("instruction history buffer freed"),a.la=0,a.N=[],a.ka=[]}h.Ab=function(a){if(!Lf(this))return!1;this.b.Ab(a);return!0};
h.Bb=function(a,b,c){if(!Lf(this))return!1;this.J=0;a||Gd(this)&&Hd(this,this.b.u[7],0);try{a=ed(this.b,a);var d=this.b.Bb(a);0<d&&(fd(this.b,a),this.J+=d,Kc(this.b,d,!0),Gc(this.b,d),this.X++)}catch(e){"number"!=typeof e&&(this.J=0,kb(this.b,e.stack||e.message))}!1!==c&&O(this.b);this.Ga(b||!1);return 0<this.J};h.ia=function(a){this.b&&this.b.ia(a)};h.Ga=function(a){void 0===a&&(a=!0);this.R=Y(this.b.u[7]);a&&1!=this.ea?Mf(this):Nf(this)};
function Lf(a){var b;if(b=a.b&&ib(a.b))b=a.b,b.v.ja?b=!0:(b.i(b.toString()+" not powered"),b=!1);return b&&!a.b.v.ga?!jb(a.b):!1}h.Ka=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};h.Ja=function(a,b){b&&this.i(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){zf(this);this.X=this.Ba=0;this.va=null;this.J=0;this.R=Y(this.b.u[7]);this.v.ga=!1;Of(this);a||this.Ga()};
h.save=function(){var a=new P(this);a.set(0,Hf(this.R));a.set(1,Hf(this.Z));a.set(2,[this.w,this.$,this.ma]);a.set(3,this.H);return a.data()};h.restore=function(a){var b=0;void 0!==a[2]&&(this.R=If(a[b++]),this.Z=If(a[b++]),this.w=a[b][0],"string"==typeof this.w&&(this.w=[this.w]),this.$=a[b][1],this.ma|=a[b][2]);a[3]&&(this.H=a[3]);return!0};h.start=function(a,b){this.ea||this.i("running");this.v.ga=!0;this.Tb=a;this.Vb=b};
h.stop=function(a,b){if(this.v.ga){this.v.ga=!1;this.J=b-this.Vb;if(!this.ea){b="stopped";if(this.J){a-=this.Tb;var c=0<a?Math.round(1E3*this.J/a):0;b+=" (";Gd(this)&&(b+=this.X+" opcodes, ",this.Ba-=this.X,this.X=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.i(b)}this.Ga(!0);this.Qb();Of(this,this.b.u[7])}};function Gd(a){return 1<a.f.length||!!a.ra}
function Hd(a,b,c){var d=a.b;if(0<c&&(a.ra&&!--a.ra||xc(a,b,1,a.f)))return!0;0<=c&&a.ka.length&&(a.X++,a.g++,b=Lb(a.F,b),a.g--,null!=b&&(b=a.N[a.la],b.A=d.u[7],b.Ha=!1,++a.la==a.N.length&&(a.la=0)));return!1}function yf(a){var b,c;a.f=["bp"];if(a.S)for(b=1;b<a.S.length;b++){c=a.S[b];var d=a.F;yc(d.aa[Z(c)>>>d.ca],!1)}a.S=["br"];if(a.G)for(b=1;b<a.G.length;b++)c=a.G[b],d=a.F,yc(d.aa[Z(c)>>>d.ca],!0);a.G=["bw"];a.pb=0}
h.jb=function(a,b,c){var d=!0;c||Pf(this,a,b,!1,!0);if(a!=this.f){var e=Z(b);if(-1===e)this.i("invalid address: "+I(this,b.A)),d=!1;else{var f=this.F;f.aa[e>>>f.ca].jb(e&f.f,a==this.G)}}d&&(a.push(b),c?b.Ha=!0:(Qf(this,a,a.length-1,"set"),zf(this)));return d};function Pf(a,b,c,d,e){var f=!1;c=Z(c);for(var g=1;g<b.length;g++){var k=b[g];if(c==Z(k)&&(!d||k.Ha)){f=!0;k.Ha||e||Qf(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.F,yc(d.aa[c>>>d.ca],b==a.G));k.Ha||zf(a);break}}return f}
function Rf(a,b){for(var c=1;c<b.length;c++)Qf(a,b,c);return b.length-1}function Qf(a,b,c,d){c=b[c];a.i(b[0]+" "+I(a,c.A)+(d?" "+d:c.Nc?' "'+c.Nc+'"':""))}function Of(a,b){if(void 0!==b)xc(a,b,1,a.f,!0),a.ea=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ha){if(!Pf(a,a.f,c,!0))break;b=0}}}
function xc(a,b,c,d,e){var f=!1;if(!a.pb++)for(var g=1;!f&&g<d.length;g++){var k=d[g];if(!e||k.Ha)for(var m=Z(k),n=0;n<c;n++)if(b+n==m){var p,f=!0;k.Ha&&(Pf(a,d,k,!0),e=!0);if(p=k.Rc){for(var f=!1,t=0;t<p.length;t++)if(!Sf(a,p[t],!0)){if(p[t].indexOf("if")){f=!0;break}for(var r=t+1;r<p.length&&p[r].indexOf("else");r++)t++;if(r==p.length){f=!0;break}}a.b.v.ga||(f=!0)}if(f){e||Qf(a,d,g,"hit");break}}}a.pb--;return f}
function Tf(a,b,c,d){var e=Y(b.A),f=a.Ia(b,2),g,k;for(k in a.sb)if(g=a.sb[k][f&k])break;g||(g=[0]);for(var m=k="",n=Cf[g[0]],p=g.length-1,t=1;t<=p;t++){var r=g[t];if(void 0!==r){var w;w=a;var B=r,r=b,x="",C=B&61440;if(4096==C)r=r.A+((f&255)<<24>>23)&65535,x=I(w,r);else if(8192==C)r=r.A-((f&63)<<1)&65535,x=I(w,r);else if(12288==C)x=I(w,f&7,1);else if(24576==C)x=I(w,f&63,1);else if(C=f&B,B&4032&&(C>>=6,B>>=6),B&63)switch(B=C&7,C&56){case 0:x=Kf(B);break;case 8:x="@"+Kf(B);break;case 16:7>B?x="("+Kf(B)+
")+":(C=w.Ia(r,2),x="#"+I(w,C,0,!0));break;case 24:7>B?x="@("+Kf(B)+")+":(C=w.Ia(r,2),x="@#"+I(w,C,0,!0));break;case 32:x="-("+Kf(B)+")";break;case 40:x="@-("+Kf(B)+")";break;case 48:C=w.Ia(r,2);x=I(w,C,0,!0)+"("+Kf(B)+")";7==B&&(x=[x,I(w,C+r.A&65535)]);break;case 56:C=w.Ia(r,2),x="@"+I(w,C)+"("+Kf(B)+")",7==B&&(x=[x,I(w,C+r.A&65535)])}w=x;if(!w||!w.length){k="INVALID";break}"string"!=typeof w&&(m=w[1],w=w[0]);0<k.length&&(k+=",");k+=w||"???"}}f="";g=I(a,e.A)+":";if(-1!==e.A&&-1!==b.A){do if(f+=" "+
I(a,a.Ia(e,2)),null==e.A)break;while(e.A!=b.A)}g+=oa(f,24);g+=oa(n,5);k&&(g+=" "+k);if(c||m)g=oa(g,60)+";"+(c||""),g=a.b.v.rb?g+("cycles="+Hc(a.b).toString()+" cs="+l(a.b.Ib)):g+(null!=d?"="+d.toString():""),m&&(g+=" @"+m);return g}function Uf(a,b){switch(b){case "N":a=a.b.Oa();break;case "Z":a=ld(a.b);break;case "V":a=kd(a.b);break;case "C":a=jd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function Vf(a,b){var c="",d=a.b;8>b?(c=Kf(b),c+="="+I(a,d.u[b])):13>b?c="A"+(b-8)+"="+I(a,d.Qa[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+I(a,d.Aa[b-16]):20==b&&(c="PS="+I(a,Tb(d)));c&&(c+=" ");return c}function Wf(a){var b,c="";for(b=0;6>b;b++)c+=Vf(a,b);c=c+"\n"+(Vf(a,6)+Vf(a,7)+Vf(a,20));return c+=Uf(a,"T")+Uf(a,"N")+Uf(a,"Z")+Uf(a,"V")+Uf(a,"C")}h.vc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function Xf(a,b,c){var d=[],e=Z(b)>>>0;for(b=0;b<a.H.length;b++){var f=a.H[b],g=f.A>>>0,k=f.Zc;if(e>=g&&e<g+k){e=ra(f.uc,[e-g],a.vc);0<=e?Yf(a,b,e,d):c&&(e=~e,Yf(a,b,e-1,d),Yf(a,b,e,d));break}}return d}function Yf(a,b,c,d){var e={},f=a.H[b].uc,g=0,k=null;0<=c&&c<f.length&&(g=f[c][0],k=f[c][1]);k&&(e=a.H[b].La[k],k="."==k.charAt(0)?null:e.l||k);d.push(k);d.push(g);d.push(e.a);d.push(e.c)}
function Zf(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return wf(a)||a.i("no variables"),!0;if(!c[2])return wf(a,c[1]);if(!c[3])return delete a.ha[c[1]],!0;b=sf(a,c[3]);return void 0!==b?(a.ha[c[1]]=b,!0):!1}a.i("invalid assignment:"+b);return!1}
function $f(a,b,c){var d=null;if(b=Ff(a,b,!0)){var e=Xf(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.A-e[1])&&(g=" + "+l(f,4,!0)),f=e[0]+" ("+I(a,e[1])+")"+g,c&&a.i(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.A)&&(g=" - "+l(f,4,!0)),f=e[4]+" ("+I(a,e[5])+")"+g,c&&a.i(f),d||(d=f))}else c&&a.i("no symbols")}return d}
function Mf(a,b){var c;if(b&&"?"==b[1])a.i("register commands:"),a.i("\tr\tdump registers"),a.i("\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.i("missing value for "+b[1]);return}f=sf(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":nd(d,f);a.R=Y(d.u[7]);break;case "N":d.Y=f?32768:0;break;
case "Z":d.ba=f?0:1;break;case "V":d.V=f?32768:0;break;case "C":d.U=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.i("unknown register: "+e);return}O(d);a.i("updated registers:")}a.i(Wf(a));c&&(a.R=Y(d.u[7]),Nf(a,I(a,a.R.A)))}}function ag(a,b){b=pa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.i(c[2]):vf(a,null,c[2].charCodeAt(0)):sf(a,b,!0)}
function bg(a,b,c){var d="t"!=b;c=uf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Fa(c,function(){return gb(a,!0)&&a.Bb(e,d,!1)},function(){O(a.b);gb(a,!1)})}
function Nf(a,b,c,d){if(b=Ff(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=Ff(a,c,!0);if(!d||d.A<b.A)return;e=d.A-b.A;if(256<e){a.i("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=hb(a,!1)||a.ea?a.J:null;var g=null!=f?"cycles":null,k=Xf(a,b),m=b.A;if(k[0]&&d&&(!c&&d||0>k[0].indexOf("+"))){var n=k[0]+":";k[2]&&(n+=" "+k[2]);a.i(n)}k[3]&&(g=k[3],f=null);f=Tf(a,b,g,f);a.i(f);a.R=b;e-=b.A-m;c++}}}
function Sf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.i(">> "+b):(a.$&&(a.i("ended assemble at "+I(a,a.Z.A)),a.R=a.Z,a.$=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.va=null;if(ib(a)&&0<b.length){a.$&&(b="a "+I(a,a.Z.A)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");if(g&&g.length)for(var k=g[0],m=k.charAt(0),n=1;n<k.length;n++){var p=k.charAt(n);if("?"==m||"r"==m||"a">p||"z"<p){g[0]=k.substr(n);g.unshift(k.substr(0,n));break}}g[0]=g[0].toLowerCase();switch(g[0].charAt(0)){case "a":var t=
Ff(a,g[1],!0);if(t)if(a.Z=t,void 0===g[2])a.i("begin assemble at "+I(a,t.A)),a.$=!0,O(a.b);else{var r;a.i("not supported yet");r=[];if(r.length){for(var w=0;w<r.length;w++)a.Ob(t,r[w],1);a.i(Tf(a,a.Z))}}break;case "b":a:{var B=g[0],x=g[1],C=b;if("?"==x)a.i("breakpoint commands:"),a.i("\tbp [a]\tset exec breakpoint at addr [a]"),a.i("\tbr [a]\tset read breakpoint at addr [a]"),a.i("\tbw [a]\tset write breakpoint at addr [a]"),a.i("\tbc [a]\tclear breakpoint at addr [a]"),a.i("\tbl\tlist all breakpoints"),
a.i("\tbn [n]\tbreak after [n] instruction(s)");else{var Aa=B.charAt(1);if("l"==Aa){var Mc;Mc=0+Rf(a,a.f);Mc+=Rf(a,a.S);(Mc+=Rf(a,a.G))||a.i("no breakpoints")}else if("n"==Aa)a.ra=uf(a,x),a.i("break after "+a.ra+" instruction(s)");else if(void 0===x)a.i("missing breakpoint address");else{var W=Y();if("*"!=x&&(W=Ff(a,x,!0),!W))break a;"c"==Aa?null==W.A?(yf(a),a.i("all breakpoints cleared")):Pf(a,a.f,W)||Pf(a,a.S,W)||Pf(a,a.G,W)||a.i("breakpoint missing: "+I(a,W.A)):null!=W.A&&(Jf(a,W,C),"p"==Aa?a.jb(a.f,
W):"r"==Aa?a.jb(a.S,W):"w"==Aa?a.jb(a.G,W):a.i("unknown breakpoint command: "+Aa))}}}break;case "c":a.kb&&(a.kb.value="");break;case "d":a:{var Pa,Qa=g[0],ka=g[1],Ba=g[2],ug=g[3];if("?"==ka){var Ra="";for(Pa in yb)a.Sa[Pa]&&(Ra&&(Ra+=","),Ra+=Pa);Ra+=",state,symbols";a.i("dump memory commands:");a.i("\tdb [a] [#] dump # bytes at address a");a.i("\tdw [a] [#] dump # words at address a");a.i("\tdd [a] [#] dump # dwords at address a");a.i("\tdh [#] [#] dump # instructions from history");
Ra.length&&a.i("dump extension commands:\n\t"+Ra)}else if("state"==ka){var ve=cg(a.D,!0);"console"==Ba?console.log(ve):(a.kb&&(a.kb.value=""),a.i(ve))}else if("symbols"==ka)for(var Nc=0;Nc<a.H.length;Nc++){var Oc=a.H[Nc],Sa;for(Sa in Oc.La)if("."!=Sa.charAt(0)){var we=Oc.La[Sa].o;if(void 0!==we){var xe=Oc.La[Sa].l;xe&&(Sa=xe);a.i(I(a,we)+" "+Sa)}}}else{if("d"==Qa){for(Pa in yb)if(g[1]==Pa){var ye=a.Sa[Pa];ye?(g.shift(),g.shift(),ye(g)):a.i("no dump registered for "+ka);break a}ka||(Qa=a.Wb||"db")}else a.Wb=
Qa;if("dh"==Qa){var ze=ka,Ae=Ba,Be="",Ce=0,ea=a.la,la=a.N;if(la.length){var ba=+ze||a.qb,lb=+Ae||10;isNaN(ba)?ba=lb:Be="more ";ba>la.length&&(a.i("note: only "+la.length+" available"),ba=la.length);ea-=ba;0>ea&&(null==la[la.length-1].A?(ba=ea+ba,ea=0):ea+=la.length);var Pc=[];"call"==Ae&&(lb=1E5,Pc=["CALL"]);for(void 0!==ze&&a.i(ba+" instructions earlier:");0<lb&&ea!=a.la;){var De=la[ea++];if(null==De.A)break;var mb=Y(De.A),vg=ba--,Ee=Tf(a,mb,"history",vg);(!Pc.length||0<=Ee.indexOf(Pc[0]))&&a.i(Ee);
mb.hc&&(ea+=mb.hc,lb-=mb.hc,ba-=mb.hc);ea>=la.length&&(ea=0);a.qb=ba;Ce++;lb--}}Ce||(a.i("no "+Be+"history available"),a.qb=void 0)}else{var Xb=Ff(a,ka);if(Xb){var Yb=0;Ba&&("l"==Ba.charAt(0)&&(Ba=Ba.substr(1)||ug),Yb=uf(a,Ba)>>>0,65536<Yb&&(Yb=65536));for(var nb="",ob="dd"==Qa?4:"dw"==Qa?2:1,Zb=ob*Yb||128,wg=Zb+15>>4||1;wg--&&0<Zb;){var $b=0,Qc=0,pb,Rc="",Fe="",ka=I(a,Xb.A);for(pb=4==ob?16:a.na;0<pb&&0<Zb;pb--){var ac=a.mb(Xb,1),$b=$b|ac<<(Qc++<<3);Qc==ob&&(Rc+=I(a,$b,ob),Rc+=1==ob?9==pb?"-":" ":
" ",$b=Qc=0);Fe+=32<=ac&&128>ac?String.fromCharCode(ac):".";Zb--}nb&&(nb+="\n");nb+=ka+" "+Rc+(0==pb?" "+Fe:"")}nb&&a.i(nb);a.fb=Xb}}}}break;case "e":if("else"==g[0])break;var Ta,Sc,Tc,Uc,Vc=g[0],Wc=g[1];"eb"==Vc?(Ta=1,Sc=255,Tc=a.mb,Uc=a.Ob):"e"==Vc||"ew"==Vc?(Ta=2,Sc=65535,Tc=a.Ia,Uc=a.qc):Wc=null;if(null==Wc)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a");else{var bc=Ff(a,Wc);if(bc)for(var cc=2;cc<g.length;cc++){var qb=
sf(a,g[cc]);if(void 0===qb){a.i("unrecognized value: "+g[cc]);break}qb&~Sc&&a.i("warning: "+l(qb)+" exceeds "+Ta+"-byte value");var xg=Tc.call(a,bc);a.i("changing "+I(a,bc.A)+" from "+I(a,xg,Ta)+" to "+I(a,qb,Ta));Uc.call(a,bc,qb,Ta)}}break;case "g":a:{var Ge=g[1],yg=b;if(void 0!==Ge){var Xc=Ff(a,Ge,!0);if(!Xc)break a;Jf(a,Xc,yg);a.jb(a.f,Xc,!0)}a.Ab(!0)||c||a.i("cpu busy or unavailable, run command ignored")}break;case "h":a.v.ga?(c||a.i("halting"),a.ia()):hb(a,!0)||c||a.i("already halted");break;
case "i":if("if"==g[0]){var Yc;var rb=b.substr(2),rb=pa(rb);sf(a,rb)?(c||a.i("true: "+rb),Yc=!0):(c||a.i("false: "+rb),Yc=!1);Yc||(d=!1);break}f=!0;break;case "k":var zg=g[0];if("?"==g[1])a.i("stack trace commands:"),a.i("\tk\tshow frame addresses"),a.i("\tks\tshow symbol information");else{var Zc=0,$c=Y(),sb=Y(a.b.u[6]);for(a.i("stack trace for "+I(a,sb.A));10>Zc;){for(var Ca=null,Ag=256;65536>sb.A>>>0;){$c.A=a.Ia(sb,2);if(null==sb.A||!Ag--)break;if(!($c.A&1)){for(var Bg=a,dc=$c,He=null,tb=dc.A,
Ie=tb,ad=1;6>=ad&&tb;ad++){if(2<ad){dc.A=tb;var ec=Tf(Bg,dc);if(0<=ec.indexOf("JSR")){var Je=ec.indexOf(" ");if(tb+(ec.indexOf(" ",Je+1)-Je-1)/2==Ie){He=ec;break}}}tb-=2}dc.A=Ie;if(Ca=He)break}}if(!Ca||null==Ca)break;var Ke=null;if("ks"==zg){var Le=Ca.match(/[0-9A-F]+$/);Le&&(Ke=$f(a,Le[0]))}Ca=oa(Ca,50)+" ;"+(Ke||"stack="+I(a,sb.A));a.i(Ca);Zc++}Zc||a.i("no return addresses found")}break;case "l":if("ln"==g[0]){$f(a,g[1],!0);break}f=!0;break;case "m":a:{var ma,na=null,E=g[1];"?"==E&&(E=void 0);
if(void 0!==E){var va=0;if("all"==E)va=1878917119,E=null;else if("on"==E)na=!0,E=null;else if("off"==E)na=!1,E=null;else{"keys"==E&&(E="key");"kbd"==E&&(E="keyboard");for(ma in yb)if(E==ma){va=yb[ma];na=!!(a.ma&va);break}if(!va){a.i("unknown message category: "+E);break a}}if(va)if("on"==g[2])a.ma|=va,na=!0;else if("off"==g[2]&&(a.ma&=~va,na=!1,1073741824==va)){for(var bd=0;bd<a.ya.length;bd++)a.i(a.ya[bd]);a.ya=[]}}var Cg=0,ub="";for(ma in yb)if(!E||E==ma){var Dg=!!(a.ma&yb[ma]);if(null===na||na==
Dg)ub&&(ub+=","),++Cg%10||(ub+="\n\t"),"key"==ma&&(ma="keys"),ub+=ma}void 0===E&&a.i("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.i((null!==na?na?"messages on: ":"messages off: ":"message categories:\n\t")+(ub||"none"));zf(a)}break;case "p":if("print"==g[0]){ag(a,b.substr(5));break}var Eg="pr"==g[0]?1:0;if(a.ea)a.i("step in progress");else{var Me=Y(a.b.u[7]);a.mb(Me);a.ea?(a.jb(a.f,Me,!0),a.Ab()||(a.D&&a.D.Qb(),a.ea=0)):bg(a,Eg?"tr":"t")}break;case "r":if("reset"==b){a.D&&
a.D.reset();break}Mf(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var vb=+g[2];if(8==vb||10==vb||16==vb)a.na=vb;else{a.i("invalid base: "+vb);break}}a.i("default base: "+a.na);break;case "cs":var wb;void 0!==g[3]&&(wb=+g[3]);switch(g[2]){case "int":a.b.ub=wb;break;case "start":a.b.Jb=wb;break;case "stop":a.b.vb=wb;break;default:a.i("unknown cs option");break a}void 0!==wb&&Ec(a.b);a.i("checksums "+(a.b.v.rb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Jc(a.b,+g[2])||a.i("warning: using 1x multiplier, previous target not reached"));
a.i("target speed: "+(a.b.nb.toFixed(2)+"Mhz")+" ("+a.b.$a+"x)");break;default:if(g[1]){a.i("unknown option: "+g[1]);break}case "?":a.i("debugger options:"),a.i("\tbase #\t\tset default base to #"),a.i("\tcs int #\tset checksum cycle interval to #"),a.i("\tcs start #\tset checksum cycle start count to #"),a.i("\tcs stop #\tset checksum cycle stop count to #"),a.i("\tsp #\t\tset speed multiplier to #")}break;case "t":bg(a,g[0],g[1]);break;case "u":Nf(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Zf(a,
b.substr(3))||(d=!1);break}if("ver"==g[0]){a.i("PDPjs version 1.30.1 ("+a.b.cd+",RELEASE"+(xb?",TYPEDARRAYS":",LONGARRAYS")+")");a.i(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){ag(a,b.substr(1));break}var cd="commands:",dd;for(dd in Bf)cd+="\n"+oa(dd,9)+Bf[dd];Gd(a)||(cd+="\nnote: history disabled if no exec breakpoints");a.i(cd);break;default:f=!0}f&&(a.i("unknown command: "+b),d=!1)}}catch(Ne){a.i("debugger error: "+(Ne.stack||Ne.message)),d=!1}return d}
function Fc(a,b,c){b=qf(a,b,c);for(var d in b)if(!Sf(a,b[+d]))return!1;return!0}Ma(function(){for(var a=A(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new xf(d);fb(d,c)}});
function dg(a,b,c){u.call(this,"Computer",a,dg,67108864);this.v.ja=!1;eg(this,b);this.R=Cc(this,"autoPower",a);this.D=0;this.ea=a.busWidth||a.buswidth;this.f=fg;this.J=null;this.G=this.Z=!1;this.url=Cc(this,"url")||"";(Math.random()+.1).toString(36);this.g=gg(this);if(this.b=eb("CPU",this.id)){this.j=eb("Debugger",this.id);this.F=new Bb({id:this.fc+".bus",busWidth:this.ea},this.b,this.j);var d,e=cb(this.id);if((this.w=eb("Panel",this.id))&&this.w.kb)for(b=0;b<e.length;b++)d=e[b],d.ta=this.w.ta,d.i=
this.w.i,d.kb=this.w.kb;this.i("PDPjs v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.i("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Pa&&d.Pa(this,this.F,this.b,this.j);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=Cc(this,"state")||(f=!0,a.state))b=this.S=a,f||(this.G=!0,this.f=fg),this.f&&
(this.N=new P(this,"1.30.1"),hg(this.N)?b=null:delete this.N);!b&&this.f&&(b=ig(this))&&(this.G=!0);if(b){var g=this;ua(b,null,!0,function(a,b,c){c?(g.H=null,g.G=!1,g.ta("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.J=b,g.Z=!0);G(g)})}else G(this);this.L.power||(this.R=!0);!c&&this.R&&jg(this,this.Kb)}else q("Unable to find CPU component")}y(dg);var fg=0;
function eg(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.$=b}function Cc(a,b,c){var d=b.toLowerCase(),d=Wa[b]||Wa[d];void 0===d&&a.$&&(d=a.$[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function jg(a,b,c){for(var d=cb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!ib(f)){ib(f,function(){jg(a,b,c)});return}}b.call(a,c)}
function kg(a,b){var c=new P(a,"1.30.1","validate");if(hg(c)&&lg(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.ta("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=dg.prototype;
h.Kb=function(a){void 0===a&&(a=this.f||(this.J?1:fg));if(!this.D){this.D++;var b=!1,c=!1;this.X=!1;var d=this.N||new P(this,"1.30.1");if(-1==a)b=!0;else if(a>fg){if(hg(d,this.J)){this.B=new P(this,"1.30.1","failsafe");hg(this.B)&&(mg(this,d),a=2,ng(this.B));this.B.set("timestamp",ta());og(this.B);var e=this.f&&!this.G;if(1==a||wa("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=lg(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?hg(d,g):("error"==
f&&"no machine state"!=g?(this.ta("Error: "+g),"unable to verify user"==g&&(Da("user",""),this.g=null)):this.i(f+": "+g),ng(d),hg(d)?(c=lg(d),e=!0):c=!1))}e&&kg(this,c?d:null)}else 2==a&&d.clear()}else kg(this);delete this.J;delete this.N}e=cb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=pg(this,g,d,b,c));b=[d,a,c];-1!=a?jg(this,this.xc,b):this.xc(b)}};
function pg(a,b,c,d,e){if(!b.v.ja){b.v.ja=!0;if(b.Ka){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.Ka(f,d)&&f&&(q("Unable to restore state for "+b.type),a.S&&!a.Z?(c.clear(),a.f=fg,window&&window.location.reload()):a.X=!0,b.Ka(null),e=!1)}if(!d&&b.yc)for(a=b.yc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.xc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ha=!0;this.v.ja=!0;var d=this.L.power;d&&(d.textContent="Shutdown");this.b&&(pg(this,this.b,b,c,a),this.b.Eb());this.X&&(mg(this,b),b.clear());!c&&this.B&&(this.B.clear(),delete this.B);this.D=0};
function mg(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.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.1"};d.url=a.url;d.user=c;d.type="bug";d.data=b;ua("http://www.pcjs.org/api/v1/report",d,!0)}}
function cg(a,b,c){var d,e="none";if(a.D)return null;a.D--;var f=new P(a,"1.30.1"),g=new P(a,"1.30.1","validate"),k=ta();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Ja&&(c&&a.b.ia(),d=a.b.Ja(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.ja=!1,!1===d&&(e=null)));for(var k=cb(a.id),m=0;m<k.length;m++){var n=k[m];n.v.ja&&(n.Ja&&(d=n.Ja(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.v.ja=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.g&&qg(a,a.g,f.toString()),og(g)&&og(f)||(e=null,d=k=!0)):a.f&&(d=!0,k=3==a.f),d&&f.clear(k)):e=f.toString());c&&(a.v.ja=!1,b=a.L.power)&&(b.textContent="Power");a.D=0;return e}h.reset=function(){this.F&&this.F.reset&&(D(this,"Resetting "+this.F.type),this.F.reset());for(var a=cb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.F&&c.reset&&(D(this,"Resetting "+c.type),c.reset())}};
h.start=function(a,b){for(var c=cb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};h.stop=function(a,b){for(var c=cb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
h.pa=function(a,b,c){var d=this;switch(b){case "power":return this.L[b]=c,c.onclick=function(){d.D||(d.v.ja?cg(d,!1,!0):jg(d,d.Kb))},!0;case "reset":return this.L[b]=c,c.onclick=function(){if(d.v.ja&&!d.D)if(d.f&&!d.H){var a=wa("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");cg(d,a,!0);!a&&d.S?window&&window.location.reload():d.Kb(fg)}else d.reset(),d.b&&d.b.Eb()},!0;case "save":if(ga())c.parentNode.removeChild(c);else return this.L[b]=
c,c.onclick=function(){var a=gg(d,!0);if(a){var b=!!(d.f&&!d.H||d.S),c=cg(d,b);b?qg(d,a,c):d.ta("Resume disabled, machine state not saved")}},!0}return!1};
function gg(a,b){var c=a.g;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=rg(a,c))||a.ta("The user ID is invalid.")):b&&a.ta("Browser local storage is not available"));return c}
function rg(a,b){a.g=null;b=ua(ha()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Da("user",b.data),a.g=b.data)}catch(d){q(d.message+" ("+c+")")}return a.g}function ig(a){var b=null;a.g&&(b=ha()+"/api/v1/user?req=load&user="+a.g+"&state="+sg(a,"1.30.1"));return b}
function qg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=sg(a,"1.30.1");d.data=c;b=ua(ha()+"/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.ta("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.ta(c),Da("user",""),a.g=null)}}h.Qb=function(){};
h.Ga=function(a){this.b&&this.b.Ga(a);this.w&&this.w.Ga(a)};Ma(function(){for(var a=A(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=A(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=z(f),g=new dg(g,d,!0);fb(g,f);g.R&&jg(g,g.Kb)}});Ha.show.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=eb("Computer",c.id))&&c.ha&&!c.v.ja&&c.Kb(-1)}});
Ha.exit.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=eb("Computer",c.id))&&c.v.ja&&cg(c,!(!c.f||c.H),!0)}});function P(a,b,c){this.id=a.id;this.key=sg(a,b,c);this.j=a.j;ng(this,a.$c)}function sg(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){ng(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 ng(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function og(a){var b=!0;if(ya()){var c=JSON.stringify(a[a.id]);Da(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function lg(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function hg(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:ya()&&(b=za(a.key))?(a[a.id]=b,a.b=!0):!1}var tg=0;
function Fg(a,b,c,d,e,f){e("Loading "+a+"...");ua(a,null,!0,function(g,k,m){m?(k||(k="unable to load "+a+" ("+m+")"),f(k,null)):Gg(k,a,b,c,d,e,f)})}
function Gg(a,b,c,d,e,f,g){function k(a,f){if(f)g(f,null);else{c&&(bb(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?Hg(a,f,k):k(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Hg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");ua(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],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]);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);Hg(a,b,c)}})}else c(a,null)}
function Ig(a,b,c,d){function e(a){if(void 0===k){var b=g&&A(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=ja(a))}function f(a){e("Error: "+a);m&&(--tg||Oa(!0));m=!1}var g,k,m=!0;tg++;ab[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));p.appendChild(t)}c||
(c="/versions/pdp11/1.30.1/components.xsl");n=function(d,k){k?Fg(c,null,null,!1,e,function(d,m){m?(bb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=k.transformNode(m))?(g.outerHTML=m,--tg||Oa(!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),--tg||Oa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Fg(b,a,d,!0,e,n):Gg(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(r){f(r.message)}return m}window.embedPDP11=function(a,b,c,d){Oa(!1);return Ig(a,b,c,d)};window.enableEvents=Oa;window.sendEvent=Ua;})();
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]}};h=qf.prototype;
h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.F=a;(a=wc(a,"messages"))&&tf(this,a);this.ab=wf;xf(this,function(a){a:{var b=d.B.X,c=a[0],e=a=0,n=b.length;if(c){a=Y(yf(d,c));if(-1===a){d.i("invalid address: "+c);break a}e=a>>>d.B.Z;n=1}d.i("blockid physical blockaddr used size type");d.i("-------- --------- ---------- ------ ------ ----");for(var c=-1,p=0;n--;){var q=b[e];q.type==c?p++||d.i("..."):(c=q.type,p=Kb[c],q&&d.i(k(q.id,8)+" %"+k(e<<d.B.Z,8)+" %%"+k(q.w,8)+" "+k(q.qb,4,
!0)+" "+k(q.size,4,!0)+" "+p),c!=ic&&(c=-1),p=0);a+=d.B.ya;e++}}});G(this)};
h.ja=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ka=this.J[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",zc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.C<d.A.length-1&&(b=d.A[++d.C])):40==a.keyCode&&(0<d.C?b=d.A[--d.C]:(b="",d.C=-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.J[b]=c,Fa(c,function(){if(d.ka){var a=d.ka.value;
d.ka.value="";zc(d,a,!0);return!0}return!1}),!0;case "step":return this.J[b]=c,Fa(c,function(a){var b=!1;gb(d,!0)||(fb(d,!0),b=d.fb(a?1:0),fb(d,!1));return b}),!0}return!1};h.pb=function(){this.ka&&this.ka.focus()};function Y(a){a=a&&a.w;null==a&&(a=-1);return a}h.Ua=function(a,b){var c=255,d=Y(a);-1!==d&&(this.g++,c=this.B,c=c.X[(d&c.g)>>>c.Z].Cb(d&c.f,d),this.g--,b&&zf(a,b));return c};h.ma=function(a,b){var c=65535,d=Y(a);-1!==d&&(this.g++,c=Lb(this.B,d),this.g--,b&&zf(a,b));return c};
h.ob=function(a,b,c){var d=Y(a);if(-1!==d){this.g++;var e=this.B;e.X[(d&e.g)>>>e.Z].wb(d&e.f,b&255,d);this.g--;c&&zf(a,c);M(this.b,!0)}};h.Xa=function(a,b,c){var d=Y(a);if(-1!==d){this.g++;var e=this.B;e.X[(d&e.g)>>>e.Z].Jb(d&e.f,b&65535,d);this.g--;c&&zf(a,c);M(this.b,!0)}};function X(a){return{w:a,Aa:!1}}function Af(a){return[a.w,a.Aa]}function Bf(a){return{w:a[0],Aa:a[1]}}
function yf(a,b,c){var d;c=(c?a.M:a.Qa).w;if(void 0!==b){d=b=mf(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.H.length;c++){var f=a.H[c].Da[d];if(void 0!==f){d=f.o;void 0!==d&&(e=X(d));break}}if(d=e)return d;c=lf(a,b,void 0)}null!=c&&(d=X(c));return d}function Cf(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.pc=jf(a,b.hc=c[2]))}function zf(a,b){null!=a.w&&(a.w+=b||1)}
function tf(a,b){a.j=a;a.ha=a.qc=536870912;a.oa=null;a.qa=[];a.g=0;b=jf(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.ha|=xb[c],a.i(c+" messages enabled"))}}function xf(a,b){for(var c in xb)if(64==xb[c]){a.Ia[c]=b;break}}
h.Pb=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 Df(a){return 6>a?"R"+a:6==a?"SP":"PC"}h.Qb=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ha[a-8]:20>a?b=this.b.ta[a-16]:20==a&&(b=Ub(this.b)));return b};
h.message=function(a,b){this.g||(b&&(a+=" @"+I(this,X(this.b.u[7]).w)),this.ha&1073741824?this.qa.push(a):this.oa&&a==this.oa||(this.oa=a,this.ha&-2147483648&&(this.ea(),a+=" (cpu halted)"),this.i(a),this.b&&(a=this.b,a.N-=a.b,a.b=0,a.ka=0,M(a))))};
function sf(a){var b;if(Ad(a)){if(!a.L||!a.L.length){a.L=Array(1E3);for(b=0;b<a.L.length;b++)a.L[b]=X();a.ga=0;a.i("instruction history buffer allocated")}if(!a.da||!a.da.length)for(a.da=Array(256),b=0;b<a.da.length;b++)a.da[b]=[b,0]}else a.L&&a.L.length&&a.i("instruction history buffer freed"),a.ga=0,a.L=[],a.da=[]}h.eb=function(a){if(!Ef(this))return!1;this.b.eb(a);return!0};
h.fb=function(a,b,c){if(!Ef(this))return!1;this.I=0;a||Ad(this)&&Bd(this,this.b.u[7],0);try{a=Gc(this.b,a);var d=this.b.fb(a);0<d&&(Hc(this.b,a),this.I+=d,Ec(this.b,d,!0),Ac(this.b,d),this.T++)}catch(e){"number"!=typeof e&&(this.I=0,vb(this.b,e.stack||e.message))}!1!==c&&M(this.b);this.za(b||!1);return 0<this.I};h.ea=function(a){this.b&&this.b.ea(a)};h.za=function(a){void 0===a&&(a=!0);this.M=X(this.b.u[7]);a&&1!=this.aa?Ff(this):Gf(this)};
function Ef(a){var b;if(b=a.b&&hb(a.b))b=a.b,b.v.fa?b=!0:(b.i(b.toString()+" not powered"),b=!1);return b&&!a.b.v.ba?!ib(a.b):!1}h.Ca=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};h.Ba=function(a,b){b&&this.i(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){sf(this);this.T=this.wa=0;this.oa=null;this.I=0;this.M=X(this.b.u[7]);this.v.ba=!1;Hf(this);a||this.za()};
h.save=function(){var a=new N(this);a.set(0,Af(this.M));a.set(1,Af(this.V));a.set(2,[this.A,this.W,this.ha]);a.set(3,this.H);return a.data()};h.restore=function(a){var b=0;void 0!==a[2]&&(this.M=Bf(a[b++]),this.V=Bf(a[b++]),this.A=a[b][0],"string"==typeof this.A&&(this.A=[this.A]),this.W=a[b][1],this.ha|=a[b][2]);a[3]&&(this.H=a[3]);return!0};h.start=function(a,b){this.aa||this.i("running");this.v.ba=!0;this.jb=a;this.kb=b};
h.stop=function(a,b){if(this.v.ba){this.v.ba=!1;this.I=b-this.kb;if(!this.aa){b="stopped";if(this.I){a-=this.jb;var c=0<a?Math.round(1E3*this.I/a):0;b+=" (";Ad(this)&&(b+=this.T+" opcodes, ",this.wa-=this.T,this.T=0);b+=this.I+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.i(b)}this.za(!0);this.pb();Hf(this,this.b.u[7])}};function Ad(a){return 1<a.f.length||!!a.la}
function Bd(a,b,c){var d=a.b;if(0<c&&(a.la&&!--a.la||rc(a,b,1,a.f)))return!0;0<=c&&a.da.length&&(a.T++,a.g++,b=Lb(a.B,b),a.g--,null!=b&&(b=a.L[a.ga],b.w=d.u[7],b.Aa=!1,++a.ga==a.L.length&&(a.ga=0)));return!1}function rf(a){var b,c;a.f=["bp"];if(a.N)for(b=1;b<a.N.length;b++){c=a.N[b];var d=a.B;sc(d.X[Y(c)>>>d.Z],!1)}a.N=["br"];if(a.G)for(b=1;b<a.G.length;b++)c=a.G[b],d=a.B,sc(d.X[Y(c)>>>d.Z],!0);a.G=["bw"];a.Ra=0}
h.Sa=function(a,b,c){var d=!0;c||If(this,a,b,!1,!0);if(a!=this.f){var e=Y(b);if(-1===e)this.i("invalid address: "+I(this,b.w)),d=!1;else{var f=this.B;f.X[e>>>f.Z].Sa(e&f.f,a==this.G)}}d&&(a.push(b),c?b.Aa=!0:(Jf(this,a,a.length-1,"set"),sf(this)));return d};function If(a,b,c,d,e){var f=!1;c=Y(c);for(var g=1;g<b.length;g++){var l=b[g];if(c==Y(l)&&(!d||l.Aa)){f=!0;l.Aa||e||Jf(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.B,sc(d.X[c>>>d.Z],b==a.G));l.Aa||sf(a);break}}return f}
function Kf(a,b){for(var c=1;c<b.length;c++)Jf(a,b,c);return b.length-1}function Jf(a,b,c,d){c=b[c];a.i(b[0]+" "+I(a,c.w)+(d?" "+d:c.hc?' "'+c.hc+'"':""))}function Hf(a,b){if(void 0!==b)rc(a,b,1,a.f,!0),a.aa=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Aa){if(!If(a,a.f,c,!0))break;b=0}}}
function rc(a,b,c,d,e){var f=!1;if(!a.Ra++)for(var g=1;!f&&g<d.length;g++){var l=d[g];if(!e||l.Aa)for(var n=Y(l),p=0;p<c;p++)if(b+p==n){var q,f=!0;l.Aa&&(If(a,d,l,!0),e=!0);if(q=l.pc){for(var f=!1,v=0;v<q.length;v++)if(!Lf(a,q[v],!0)){if(q[v].indexOf("if")){f=!0;break}for(var u=v+1;u<q.length&&q[u].indexOf("else");u++)v++;if(u==q.length){f=!0;break}}a.b.v.ba||(f=!0)}if(f){e||Jf(a,d,g,"hit");break}}}a.Ra--;return f}
function Mf(a,b,c,d){var e=X(b.w),f=a.ma(b,2),g,l;for(l in a.ab)if(g=a.ab[l][f&l])break;g||(g=[0]);for(var n=l="",p=vf[g[0]],q=g.length-1,v=1;v<=q;v++){var u=g[v];if(void 0!==u){var w;w=a;var B=u,u=b,x="",C=B&61440;if(4096==C)u=u.w+((f&255)<<24>>23)&65535,x=I(w,u);else if(8192==C)u=u.w-((f&63)<<1)&65535,x=I(w,u);else if(12288==C)x=I(w,f&7,1);else if(24576==C)x=I(w,f&63,1);else if(C=f&B,B&4032&&(C>>=6,B>>=6),B&63)switch(B=C&7,C&56){case 0:x=Df(B);break;case 8:x="@"+Df(B);break;case 16:7>B?x="("+Df(B)+
")+":(C=w.ma(u,2),x="#"+I(w,C,0,!0));break;case 24:7>B?x="@("+Df(B)+")+":(C=w.ma(u,2),x="@#"+I(w,C,0,!0));break;case 32:x="-("+Df(B)+")";break;case 40:x="@-("+Df(B)+")";break;case 48:C=w.ma(u,2);x=I(w,C,0,!0)+"("+Df(B)+")";7==B&&(x=[x,I(w,C+u.w&65535)]);break;case 56:C=w.ma(u,2),x="@"+I(w,C)+"("+Df(B)+")",7==B&&(x=[x,I(w,C+u.w&65535)])}w=x;if(!w||!w.length){l="INVALID";break}"string"!=typeof w&&(n=w[1],w=w[0]);0<l.length&&(l+=",");l+=w||"???"}}f="";g=I(a,e.w)+":";if(-1!==e.w&&-1!==b.w){do if(f+=" "+
I(a,a.ma(e,2)),null==e.w)break;while(e.w!=b.w)}g+=na(f,24);g+=na(p,5);l&&(g+=" "+l);if(c||n)g=na(g,60)+";"+(c||""),g=a.b.v.$a?g+("cycles="+Bc(a.b).toString()+" cs="+k(a.b.lb)):g+(null!=d?"="+d.toString():""),n&&(g+=" @"+n);return g}function Nf(a,b){switch(b){case "N":a=a.b.Fa();break;case "Z":a=fd(a.b);break;case "V":a=ed(a.b);break;case "C":a=dd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function Of(a,b){var c="",d=a.b;8>b?(c=Df(b),c+="="+I(a,d.u[b])):13>b?c="A"+(b-8)+"="+I(a,d.Ha[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+I(a,d.ta[b-16]):20==b&&(c="PS="+I(a,Ub(d)));c&&(c+=" ");return c}function Pf(a){var b,c="";for(b=0;6>b;b++)c+=Of(a,b);c=c+"\n"+(Of(a,6)+Of(a,7)+Of(a,20));return c+=Nf(a,"T")+Nf(a,"N")+Nf(a,"Z")+Nf(a,"V")+Nf(a,"C")}h.Lb=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function Qf(a,b,c){var d=[],e=Y(b)>>>0;for(b=0;b<a.H.length;b++){var f=a.H[b],g=f.w>>>0,l=f.vc;if(e>=g&&e<g+l){e=qa(f.Kb,[e-g],a.Lb);0<=e?Rf(a,b,e,d):c&&(e=~e,Rf(a,b,e-1,d),Rf(a,b,e,d));break}}return d}function Rf(a,b,c,d){var e={},f=a.H[b].Kb,g=0,l=null;0<=c&&c<f.length&&(g=f[c][0],l=f[c][1]);l&&(e=a.H[b].Da[l],l="."==l.charAt(0)?null:e.l||l);d.push(l);d.push(g);d.push(e.a);d.push(e.c)}
function Sf(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return pf(a)||a.i("no variables"),!0;if(!c[2])return pf(a,c[1]);if(!c[3])return delete a.ca[c[1]],!0;b=lf(a,c[3]);return void 0!==b?(a.ca[c[1]]=b,!0):!1}a.i("invalid assignment:"+b);return!1}
function Tf(a,b,c){var d=null;if(b=yf(a,b,!0)){var e=Qf(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.w-e[1])&&(g=" + "+k(f,4,!0)),f=e[0]+" ("+I(a,e[1])+")"+g,c&&a.i(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.w)&&(g=" - "+k(f,4,!0)),f=e[4]+" ("+I(a,e[5])+")"+g,c&&a.i(f),d||(d=f))}else c&&a.i("no symbols")}return d}
function Ff(a,b){var c;if(b&&"?"==b[1])a.i("register commands:"),a.i("\tr\tdump registers"),a.i("\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.i("missing value for "+b[1]);return}f=lf(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":hd(d,f);a.M=X(d.u[7]);break;case "N":d.U=f?32768:0;break;
case "Z":d.Y=f?0:1;break;case "V":d.R=f?32768:0;break;case "C":d.P=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.i("unknown register: "+e);return}M(d);a.i("updated registers:")}a.i(Pf(a));c&&(a.M=X(d.u[7]),Gf(a,I(a,a.M.w)))}}function Uf(a,b){b=oa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.i(c[2]):of(a,null,c[2].charCodeAt(0)):lf(a,b,!0)}
function Vf(a,b,c){var d="t"!=b;c=nf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ea(c,function(){return fb(a,!0)&&a.fb(e,d,!1)},function(){M(a.b);fb(a,!1)})}
function Gf(a,b,c,d){if(b=yf(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=yf(a,c,!0);if(!d||d.w<b.w)return;e=d.w-b.w;if(256<e){a.i("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=gb(a,!1)||a.aa?a.I:null;var g=null!=f?"cycles":null,l=Qf(a,b),n=b.w;if(l[0]&&d&&(!c&&d||0>l[0].indexOf("+"))){var p=l[0]+":";l[2]&&(p+=" "+l[2]);a.i(p)}l[3]&&(g=l[3],f=null);f=Mf(a,b,g,f);a.i(f);a.M=b;e-=b.w-n;c++}}}
function Lf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.i(">> "+b):(a.W&&(a.i("ended assemble at "+I(a,a.V.w)),a.M=a.V,a.W=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.oa=null;if(hb(a)&&0<b.length){a.W&&(b="a "+I(a,a.V.w)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");if(g&&g.length)for(var l=g[0],n=l.charAt(0),p=1;p<l.length;p++){var q=l.charAt(p);if("?"==n||"r"==n||"a">q||"z"<q){g[0]=l.substr(p);g.unshift(l.substr(0,p));break}}g[0]=g[0].toLowerCase();switch(g[0].charAt(0)){case "a":var v=
yf(a,g[1],!0);if(v)if(a.V=v,void 0===g[2])a.i("begin assemble at "+I(a,v.w)),a.W=!0,M(a.b);else{var u;a.i("not supported yet");u=[];if(u.length){for(var w=0;w<u.length;w++)a.ob(v,u[w],1);a.i(Mf(a,a.V))}}break;case "b":a:{var B=g[0],x=g[1],C=b;if("?"==x)a.i("breakpoint commands:"),a.i("\tbp [a]\tset exec breakpoint at addr [a]"),a.i("\tbr [a]\tset read breakpoint at addr [a]"),a.i("\tbw [a]\tset write breakpoint at addr [a]"),a.i("\tbc [a]\tclear breakpoint at addr [a]"),a.i("\tbl\tlist all breakpoints"),
a.i("\tbn [n]\tbreak after [n] instruction(s)");else{var ya=B.charAt(1);if("l"==ya){var Jc;Jc=0+Kf(a,a.f);Jc+=Kf(a,a.N);(Jc+=Kf(a,a.G))||a.i("no breakpoints")}else if("n"==ya)a.la=nf(a,x),a.i("break after "+a.la+" instruction(s)");else if(void 0===x)a.i("missing breakpoint address");else{var U=X();if("*"!=x&&(U=yf(a,x,!0),!U))break a;"c"==ya?null==U.w?(rf(a),a.i("all breakpoints cleared")):If(a,a.f,U)||If(a,a.N,U)||If(a,a.G,U)||a.i("breakpoint missing: "+I(a,U.w)):null!=U.w&&(Cf(a,U,C),"p"==ya?a.Sa(a.f,
U):"r"==ya?a.Sa(a.N,U):"w"==ya?a.Sa(a.G,U):a.i("unknown breakpoint command: "+ya))}}}break;case "c":a.Ta&&(a.Ta.value="");break;case "d":a:{var Na,Oa=g[0],ia=g[1],za=g[2],ng=g[3];if("?"==ia){var Pa="";for(Na in xb)a.Ia[Na]&&(Pa&&(Pa+=","),Pa+=Na);Pa+=",state,symbols";a.i("dump memory commands:");a.i("\tdb [a] [#] dump # bytes at address a");a.i("\tdw [a] [#] dump # words at address a");a.i("\tdd [a] [#] dump # dwords at address a");a.i("\tdh [#] [#] dump # instructions from history");
Pa.length&&a.i("dump extension commands:\n\t"+Pa)}else if("state"==ia){var te=Wf(a.F,!0);"console"==za?console.log(te):(a.Ta&&(a.Ta.value=""),a.i(te))}else if("symbols"==ia)for(var Kc=0;Kc<a.H.length;Kc++){var Lc=a.H[Kc],Qa;for(Qa in Lc.Da)if("."!=Qa.charAt(0)){var ue=Lc.Da[Qa].o;if(void 0!==ue){var ve=Lc.Da[Qa].l;ve&&(Qa=ve);a.i(I(a,ue)+" "+Qa)}}}else{if("d"==Oa){for(Na in xb)if(g[1]==Na){var we=a.Ia[Na];we?(g.shift(),g.shift(),we(g)):a.i("no dump registered for "+ia);break a}ia||(Oa=a.sb||"db")}else a.sb=
Oa;if("dh"==Oa){var xe=ia,ye=za,ze="",Ae=0,ca=a.ga,ja=a.L;if(ja.length){var Z=+xe||a.Za,jb=+ye||10;isNaN(Z)?Z=jb:ze="more ";Z>ja.length&&(a.i("note: only "+ja.length+" available"),Z=ja.length);ca-=Z;0>ca&&(null==ja[ja.length-1].w?(Z=ca+Z,ca=0):ca+=ja.length);var Mc=[];"call"==ye&&(jb=1E5,Mc=["CALL"]);for(void 0!==xe&&a.i(Z+" instructions earlier:");0<jb&&ca!=a.ga;){var Be=ja[ca++];if(null==Be.w)break;var kb=X(Be.w),og=Z--,Ce=Mf(a,kb,"history",og);(!Mc.length||0<=Ce.indexOf(Mc[0]))&&a.i(Ce);kb.yb&&
(ca+=kb.yb,jb-=kb.yb,Z-=kb.yb);ca>=ja.length&&(ca=0);a.Za=Z;Ae++;jb--}}Ae||(a.i("no "+ze+"history available"),a.Za=void 0)}else{var Xb=yf(a,ia);if(Xb){var Yb=0;za&&("l"==za.charAt(0)&&(za=za.substr(1)||ng),Yb=nf(a,za)>>>0,65536<Yb&&(Yb=65536));for(var lb="",mb="dd"==Oa?4:"dw"==Oa?2:1,Zb=mb*Yb||128,pg=Zb+15>>4||1;pg--&&0<Zb;){var $b=0,Nc=0,nb,Oc="",De="",ia=I(a,Xb.w);for(nb=4==mb?16:a.ia;0<nb&&0<Zb;nb--){var ac=a.Ua(Xb,1),$b=$b|ac<<(Nc++<<3);Nc==mb&&(Oc+=I(a,$b,mb),Oc+=1==mb?9==nb?"-":" ":" ",$b=
Nc=0);De+=32<=ac&&128>ac?String.fromCharCode(ac):".";Zb--}lb&&(lb+="\n");lb+=ia+" "+Oc+(0==nb?" "+De:"")}lb&&a.i(lb);a.Qa=Xb}}}}break;case "e":if("else"==g[0])break;var Ra,Pc,Qc,Rc,Sc=g[0],Tc=g[1];"eb"==Sc?(Ra=1,Pc=255,Qc=a.Ua,Rc=a.ob):"e"==Sc||"ew"==Sc?(Ra=2,Pc=65535,Qc=a.ma,Rc=a.Xa):Tc=null;if(null==Tc)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a");else{var bc=yf(a,Tc);if(bc)for(var cc=2;cc<g.length;cc++){var ob=lf(a,g[cc]);
if(void 0===ob){a.i("unrecognized value: "+g[cc]);break}ob&~Pc&&a.i("warning: "+k(ob)+" exceeds "+Ra+"-byte value");var qg=Qc.call(a,bc);a.i("changing "+I(a,bc.w)+" from "+I(a,qg,Ra)+" to "+I(a,ob,Ra));Rc.call(a,bc,ob,Ra)}}break;case "g":a:{var Ee=g[1],rg=b;if(void 0!==Ee){var Uc=yf(a,Ee,!0);if(!Uc)break a;Cf(a,Uc,rg);a.Sa(a.f,Uc,!0)}a.eb(!0)||c||a.i("cpu busy or unavailable, run command ignored")}break;case "h":a.v.ba?(c||a.i("halting"),a.ea()):gb(a,!0)||c||a.i("already halted");break;case "i":if("if"==
g[0]){var Vc;var pb=b.substr(2),pb=oa(pb);lf(a,pb)?(c||a.i("true: "+pb),Vc=!0):(c||a.i("false: "+pb),Vc=!1);Vc||(d=!1);break}f=!0;break;case "k":var sg=g[0];if("?"==g[1])a.i("stack trace commands:"),a.i("\tk\tshow frame addresses"),a.i("\tks\tshow symbol information");else{var Wc=0,Xc=X(),qb=X(a.b.u[6]);for(a.i("stack trace for "+I(a,qb.w));10>Wc;){for(var Aa=null,tg=256;65536>qb.w>>>0;){Xc.w=a.ma(qb,2);if(null==qb.w||!tg--)break;if(!(Xc.w&1)){for(var ug=a,dc=Xc,Fe=null,rb=dc.w,Ge=rb,Yc=1;6>=Yc&&
rb;Yc++){if(2<Yc){dc.w=rb;var ec=Mf(ug,dc);if(0<=ec.indexOf("JSR")){var He=ec.indexOf(" ");if(rb+(ec.indexOf(" ",He+1)-He-1)/2==Ge){Fe=ec;break}}}rb-=2}dc.w=Ge;if(Aa=Fe)break}}if(!Aa||null==Aa)break;var Ie=null;if("ks"==sg){var Je=Aa.match(/[0-9A-F]+$/);Je&&(Ie=Tf(a,Je[0]))}Aa=na(Aa,50)+" ;"+(Ie||"stack="+I(a,qb.w));a.i(Aa);Wc++}Wc||a.i("no return addresses found")}break;case "l":if("ln"==g[0]){Tf(a,g[1],!0);break}f=!0;break;case "m":a:{var ka,la=null,E=g[1];"?"==E&&(E=void 0);if(void 0!==E){var ta=
0;if("all"==E)ta=1878917119,E=null;else if("on"==E)la=!0,E=null;else if("off"==E)la=!1,E=null;else{"keys"==E&&(E="key");"kbd"==E&&(E="keyboard");for(ka in xb)if(E==ka){ta=xb[ka];la=!!(a.ha&ta);break}if(!ta){a.i("unknown message category: "+E);break a}}if(ta)if("on"==g[2])a.ha|=ta,la=!0;else if("off"==g[2]&&(a.ha&=~ta,la=!1,1073741824==ta)){for(var Zc=0;Zc<a.qa.length;Zc++)a.i(a.qa[Zc]);a.qa=[]}}var vg=0,sb="";for(ka in xb)if(!E||E==ka){var wg=!!(a.ha&xb[ka]);if(null===la||la==wg)sb&&(sb+=","),++vg%
10||(sb+="\n\t"),"key"==ka&&(ka="keys"),sb+=ka}void 0===E&&a.i("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.i((null!==la?la?"messages on: ":"messages off: ":"message categories:\n\t")+(sb||"none"));sf(a)}break;case "p":if("print"==g[0]){Uf(a,b.substr(5));break}var xg="pr"==g[0]?1:0;if(a.aa)a.i("step in progress");else{var Ke=X(a.b.u[7]);a.Ua(Ke);a.aa?(a.Sa(a.f,Ke,!0),a.eb()||(a.F&&a.F.pb(),a.aa=0)):Vf(a,xg?"tr":"t")}break;case "r":if("reset"==b){a.F&&a.F.reset();break}Ff(a,
g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var tb=+g[2];if(8==tb||10==tb||16==tb)a.ia=tb;else{a.i("invalid base: "+tb);break}}a.i("default base: "+a.ia);break;case "cs":var ub;void 0!==g[3]&&(ub=+g[3]);switch(g[2]){case "int":a.b.bb=ub;break;case "start":a.b.mb=ub;break;case "stop":a.b.cb=ub;break;default:a.i("unknown cs option");break a}void 0!==ub&&yc(a.b);a.i("checksums "+(a.b.v.$a?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Dc(a.b,+g[2])||a.i("warning: using 1x multiplier, previous target not reached"));
a.i("target speed: "+(a.b.Va.toFixed(2)+"Mhz")+" ("+a.b.Na+"x)");break;default:if(g[1]){a.i("unknown option: "+g[1]);break}case "?":a.i("debugger options:"),a.i("\tbase #\t\tset default base to #"),a.i("\tcs int #\tset checksum cycle interval to #"),a.i("\tcs start #\tset checksum cycle start count to #"),a.i("\tcs stop #\tset checksum cycle stop count to #"),a.i("\tsp #\t\tset speed multiplier to #")}break;case "t":Vf(a,g[0],g[1]);break;case "u":Gf(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Sf(a,
b.substr(3))||(d=!1);break}if("ver"==g[0]){a.i("PDPjs version 1.30.1 ("+a.b.Xb+",RELEASE"+(wb?",TYPEDARRAYS":",LONGARRAYS")+")");a.i(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){Uf(a,b.substr(1));break}var $c="commands:",ad;for(ad in uf)$c+="\n"+na(ad,9)+uf[ad];Ad(a)||($c+="\nnote: history disabled if no exec breakpoints");a.i($c);break;default:f=!0}f&&(a.i("unknown command: "+b),d=!1)}}catch(Le){a.i("debugger error: "+(Le.stack||Le.message)),d=!1}return d}
function zc(a,b,c){b=jf(a,b,c);for(var d in b)if(!Lf(a,b[+d]))return!1;return!0}La(function(){for(var a=A(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new qf(d);eb(d,c)}});
function Xf(a,b,c){r.call(this,"Computer",a,Xf,67108864);this.v.fa=!1;Yf(this,b);this.M=wc(this,"autoPower",a);this.F=0;this.aa=a.busWidth||a.buswidth;this.f=Zf;this.I=null;this.G=this.V=!1;this.ca=wc(this,"url")||"";(Math.random()+.1).toString(36);this.g=$f(this);if(this.b=db("CPU",this.id)){this.j=db("Debugger",this.id);this.B=new Ab({id:this.zb+".bus",busWidth:this.aa},this.b,this.j);var d,e=bb(this.id);if((this.A=db("Panel",this.id))&&this.A.Ta)for(b=0;b<e.length;b++)d=e[b],d.na=this.A.na,d.i=
this.A.i,d.Ta=this.A.Ta;this.i("PDPjs v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.i("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ga&&d.Ga(this,this.B,this.b,this.j);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=wc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.G=!0,this.f=Zf),this.f&&
(this.L=new N(this,"1.30.1"),ag(this.L)?b=null:delete this.L);!b&&this.f&&(b=bg(this))&&(this.G=!0);if(b){var g=this;ua(b,null,!0,function(a,b,c){c?(g.H=null,g.G=!1,g.na("Unable to load machine state from server (error "+c+(b?": "+oa(b):"")+")")):(g.I=b,g.V=!0);G(g)})}else G(this);this.J.power||(this.M=!0);!c&&this.M&&cg(this,this.nb)}else m("Unable to find CPU component")}y(Xf);var Zf=0;
function Yf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){m(d.message+" ("+c+")")}}a.W=b}function wc(a,b,c){var d=b.toLowerCase(),d=Va[b]||Va[d];void 0===d&&a.W&&(d=a.W[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function cg(a,b,c){for(var d=bb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!hb(f)){hb(f,function(){cg(a,b,c)});return}}b.call(a,c)}
function dg(a,b){var c=new N(a,"1.30.1","validate");if(ag(c)&&eg(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.na("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=Xf.prototype;
h.nb=function(a){void 0===a&&(a=this.f||(this.I?1:Zf));if(!this.F){this.F++;var b=!1,c=!1;this.T=!1;var d=this.L||new N(this,"1.30.1");if(-1==a)b=!0;else if(a>Zf){if(ag(d,this.I)){this.C=new N(this,"1.30.1","failsafe");ag(this.C)&&(fg(this,d),a=2,gg(this.C));this.C.set("timestamp",sa());hg(this.C);var e=this.f&&!this.G;if(1==a||va("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=eg(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?ag(d,g):("error"==
f&&"no machine state"!=g?(this.na("Error: "+g),"unable to verify user"==g&&(Ca("user",""),this.g=null)):this.i(f+": "+g),gg(d),ag(d)?(c=eg(d),e=!0):c=!1))}e&&dg(this,c?d:null)}else 2==a&&d.clear()}else dg(this);delete this.I;delete this.L}e=bb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=ig(this,g,d,b,c));b=[d,a,c];-1!=a?cg(this,this.Nb,b):this.Nb(b)}};
function ig(a,b,c,d,e){if(!b.v.fa){b.v.fa=!0;if(b.Ca){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.Ca(f,d)&&f&&(m("Unable to restore state for "+b.type),a.N&&!a.V?(c.clear(),a.f=Zf,window&&window.location.reload()):a.T=!0,b.Ca(null),e=!1)}if(!d&&b.Rb)for(a=b.Rb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Nb=function(a){var b=a[0],c=0>a[1];a=a[2];this.da=!0;this.v.fa=!0;var d=this.J.power;d&&(d.textContent="Shutdown");this.b&&(ig(this,this.b,b,c,a),this.b.hb());this.T&&(fg(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.F=0};
function fg(a,b){if(va("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.1"};d.url=a.ca;d.user=c;d.type="bug";d.data=b;ua("http://www.pcjs.org/api/v1/report",d,!0)}}
function Wf(a,b,c){var d,e="none";if(a.F)return null;a.F--;var f=new N(a,"1.30.1"),g=new N(a,"1.30.1","validate"),l=sa();g.set("timestamp",l);f.set("timestamp",l);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Ba&&(c&&a.b.ea(),d=a.b.Ba(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.fa=!1,!1===d&&(e=null)));for(var l=bb(a.id),n=0;n<l.length;n++){var p=l[n];p.v.fa&&(p.Ba&&(d=p.Ba(b,c),"object"===typeof d&&f.set(p.id,
d)),c&&(p.v.fa=!1,!1===d&&(e=null)))}e&&(c?(l=d=!1,b?(a.g&&jg(a,a.g,f.toString()),hg(g)&&hg(f)||(e=null,d=l=!0)):a.f&&(d=!0,l=3==a.f),d&&f.clear(l)):e=f.toString());c&&(a.v.fa=!1,b=a.J.power)&&(b.textContent="Power");a.F=0;return e}h.reset=function(){this.B&&this.B.reset&&(D(this,"Resetting "+this.B.type),this.B.reset());for(var a=bb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.B&&c.reset&&(D(this,"Resetting "+c.type),c.reset())}};
h.start=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};h.stop=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
h.ja=function(a,b,c){var d=this;switch(b){case "power":return this.J[b]=c,c.onclick=function(){d.F||(d.v.fa?Wf(d,!1,!0):cg(d,d.nb))},!0;case "reset":return this.J[b]=c,c.onclick=function(){if(d.v.fa&&!d.F)if(d.f&&!d.H){var a=va("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Wf(d,a,!0);!a&&d.N?window&&window.location.reload():d.nb(Zf)}else d.reset(),d.b&&d.b.hb()},!0;case "save":if(fa())c.parentNode.removeChild(c);else return this.J[b]=
c,c.onclick=function(){var a=$f(d,!0);if(a){var b=!!(d.f&&!d.H||d.N),c=Wf(d,b);b?jg(d,a,c):d.na("Resume disabled, machine state not saved")}},!0}return!1};
function $f(a,b){var c=a.g;c||((c=Ba("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=kg(a,c))||a.na("The user ID is invalid.")):b&&a.na("Browser local storage is not available"));return c}
function kg(a,b){a.g=null;b=ua(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&&(Ca("user",b.data),a.g=b.data)}catch(d){m(d.message+" ("+c+")")}return a.g}function bg(a){var b=null;a.g&&(b=ga()+"/api/v1/user?req=load&user="+a.g+"&state="+lg(a,"1.30.1"));return b}
function jg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=lg(a,"1.30.1");d.data=c;b=ua(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.na("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.na(c),Ca("user",""),a.g=null)}}h.pb=function(){};
h.za=function(a){this.b&&this.b.za(a);this.A&&this.A.za(a)};La(function(){for(var a=A(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=A(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=z(f),g=new Xf(g,d,!0);eb(g,f);g.M&&cg(g,g.nb)}});Ga.show.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=db("Computer",c.id))&&c.da&&!c.v.fa&&c.nb(-1)}});
Ga.exit.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=db("Computer",c.id))&&c.v.fa&&Wf(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=lg(a,b,c);this.j=a.j;gg(this,a.xc)}function lg(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}
N.prototype={constructor:N,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){gg(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 gg(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function hg(a){var b=!0;if(xa()){var c=JSON.stringify(a[a.id]);Ca(a.key,c)||(m("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function eg(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){m(c.message||c),b=!1}return b}function ag(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:xa()&&(b=Ba(a.key))?(a[a.id]=b,a.b=!0):!1}var mg=0;
function yg(a,b,c,d,e,f){e("Loading "+a+"...");ua(a,null,!0,function(g,l,n){n?(l||(l="unable to load "+a+" ("+n+")"),f(l,null)):zg(l,a,b,c,d,e,f)})}
function zg(a,b,c,d,e,f,g){function l(a,f){if(f)g(f,null);else{c&&(ab(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?Ag(a,f,l):l(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Ag(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");ua(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 n=l[0],p,q=/( [a-z]+=)(['"])(.*?)\2/g;p=q.exec(f);)n=0>n.indexOf(p[1])?n.replace(">",p[0]+">"):n.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);l[0]!=n&&(g=g.replace(l[0],n))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);Ag(a,b,c)}})}else c(a,null)}
function Bg(a,b,c,d){function e(a){if(void 0===l){var b=g&&A(g,"machine-warning");l=b&&b[0]||g}l&&(l.innerHTML=ma(a))}function f(a){e("Error: "+a);n&&(--mg||Sa(!0));n=!1}var g,l,n=!0;mg++;$a[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=p:v.appendChild(document.createTextNode(p));q.appendChild(v)}c||
(c="/versions/pdp11/1.30.1/components.xsl");p=function(d,l){l?yg(c,null,null,!1,e,function(d,n){n?(ab(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(n=l.transformNode(n))?(g.outerHTML=n,--mg||Sa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(n),(n=d.transformToFragment(l,document))?g.parentNode?(g.parentNode.replaceChild(n,g),--mg||Sa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?yg(b,a,d,!0,e,p):zg(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(u){f(u.message)}return n}window.embedPDP11=function(a,b,c,d){Sa(!1);return Bg(a,b,c,d)};window.enableEvents=Sa;window.sendEvent=Ta;})();

View file

@ -681,170 +681,152 @@
for purposes of the GNU General Public License, and the author does not claim any copyright
as to their contents.
*/
var h;
var g;
function aa(a){var b=16,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 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 ba(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}function ca(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
e&&d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function h(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 ba(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}function ca(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
function da(){var a=ea();return-1!==a.indexOf("pcjs.org",a.length-8)}var fa={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function ga(a){return a.replace(/[&<>"']/g,function(a){return fa[a]})}function ha(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}
var ia={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"},ja=Date.now||function(){return+new Date};
function ka(){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 p(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="",n;for(n in b)b.hasOwnProperty(n)&&(m&&(m+="&"),m+=n+"="+encodeURIComponent(b[n]));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 ea(){return"http://"+(window?window.location.host:"www.pcjs.org")}
function q(a){window&&window.alert(a)}function la(a){var b=!1;window&&(b=window.confirm(a));return b}var ma=null;function na(){if(null==ma){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}ma=a}return ma}function oa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
function l(a,b,c,d){var e=0,f=null,k=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)}),k;var m=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(m.onreadystatechange=function(){4===m.readyState&&(f=m.responseText,200==m.status||!m.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=m.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var n="",q;for(q in b)b.hasOwnProperty(q)&&(n&&(n+="&"),n+=q+"="+encodeURIComponent(b[q]));n=n.replace(/%20/g,"+");m.open("POST",a,!!c);m.setRequestHeader("Content-type","application/x-www-form-urlencoded");m.send(n)}else m.open("GET",a,!!c),"bytes"==b&&m.overrideMimeType("text/plain; charset=x-user-defined"),m.send();c||(f=m.responseText,200!=m.status&&(e=m.status||-1),d&&d(a,f,e),k=[f,e]);return k}function ea(){return"http://"+(window?window.location.host:"www.pcjs.org")}
function p(a){window&&window.alert(a)}function la(a){var b=!1;window&&(b=window.confirm(a));return b}var ma=null;function na(){if(null==ma){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}ma=a}return ma}function oa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
function pa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function qa(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 r={init:[],show:[],exit:[]},ra=!1,sa=!1,ta=!0;function ua(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function u(a){r.init.push(a)}
function va(a){if(ta)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 wa(a){!ta&&a?(ta=!0,ra&&xa("init"),sa&&xa("show")):ta=a}function xa(a){r[a]&&va(r[a])}ua("onload",function(){ra=!0;va(r.init)});ua("onpageshow",function(){sa=!0;va(r.show)});ua(qa("Opera")||qa("iOS")?"onunload":"onbeforeunload",function(){va(r.exit)});
function v(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Rb=b.comment;this.qc=b;b=this.id.indexOf(".");0>b?this.jb=this.id:(this.Eb=this.id.substr(0,b),this.jb=this.id.substr(b+1));this[a]=c;this.i={ready:!1,td:!1,ud:!1,R:!1,error:!1};this.rb=null;this.i.error=!1;this.A={};this.L=null;w.push(this)}var ya=void 0,za={};
if(window){ya||(ya=window.location.search.substr(1));for(var Aa,Ba=/\+/g,Ca=/([^&=]+)=?([^&]*)/g;Aa=Ca.exec(ya);)za[decodeURIComponent(Aa[1].replace(Ba," "))]=decodeURIComponent(Aa[2].replace(Ba," "))}function Da(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 x(a,b){b||(b=v);a.prototype=Da(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ea=window.PCjs.Machines||(window.PCjs.Machines={}),w=window.PCjs.Components||(window.PCjs.Components=[])}else Ea={},w=[];function Fa(a,b,c){Ea[a]&&b&&(Ea[a][b]=c)}function y(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<w.length;b++){var d=w[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function Ga(a){if(void 0!==a){var b;for(b=0;b<w.length;b++)if(w[b].id===a)return w[b]}return null}function Ha(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<w.length;d++)if(c)c==w[d]&&(c=null);else if(!(a!=w[d].type||b&&w[d].id.indexOf(b)))return w[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 B(a,b){b=C(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=A(f))&&g.binding&&a.Z(g.type,g.binding,f,g.value),m=l.length}}}}
function va(a){if(ta)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 wa(a){!ta&&a?(ta=!0,ra&&xa("init"),sa&&xa("show")):ta=a}function xa(a){r[a]&&va(r[a])}ua("onload",function(){ra=!0;va(r.init)});ua("onpageshow",function(){sa=!0;va(r.show)});ua(qa("Opera")||qa("iOS")?"onunload":"onbeforeunload",function(){va(r.exit)});
function v(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.kb=b.comment;this.Nb=b;b=this.id.indexOf(".");0>b?this.Fa=this.id:(this.Va=this.id.substr(0,b),this.Fa=this.id.substr(b+1));this[a]=c;this.i={ready:!1,Yc:!1,Zc:!1,L:!1,error:!1};this.Oa=null;this.i.error=!1;this.w={};this.I=null;w.push(this)}var ya=void 0,za={};
if(window){ya||(ya=window.location.search.substr(1));for(var Aa,Ca=/\+/g,Da=/([^&=]+)=?([^&]*)/g;Aa=Da.exec(ya);)za[decodeURIComponent(Aa[1].replace(Ca," "))]=decodeURIComponent(Aa[2].replace(Ca," "))}function Ea(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 x(a,b){b||(b=v);a.prototype=Ea(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Fa=window.PCjs.Machines||(window.PCjs.Machines={}),w=window.PCjs.Components||(window.PCjs.Components=[])}else Fa={},w=[];function Ga(a,b,c){Fa[a]&&b&&(Fa[a][b]=c)}function y(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<w.length;b++){var d=w[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function Ha(a){if(void 0!==a){var b;for(b=0;b<w.length;b++)if(w[b].id===a)return w[b]}return null}function z(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<w.length;d++)if(c)c==w[d]&&(c=null);else if(!(a!=w[d].type||b&&w[d].id.indexOf(b)))return w[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 B(a,b){b=C(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 k=f.getAttribute("class");if(k)for(var m=k.split(" "),n=0;n<m.length;n++)switch(k=m[n],k){case "pdp11-binding":(k=A(f))&&k.binding&&a.R(k.type,k.binding,f,k.value),n=m.length}}}}
function C(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}
v.prototype={constructor:v,parent:null,toString:function(){return this.name?this.name:this.id||this.type},Z:function(a,b,c){switch(b){case "clear":return this.A[b]||(this.A[b]=c,c.onclick=function(a){return function(){a.A.print&&(a.A.print.value="")}}(this)),!0;case "print":return this.A[b]||(this.Bb=this.A[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.P=function(a){this.U(a,this.jb)}),!0;default:return!1}},log:function(){},U:function(){},status:function(a){this.U(this.jb+": "+a)},P:function(a,b,c){c=c||this.type;b||q((c?c+": ":"")+a)},pa:function(){return this.i.R=!0},oa:function(a,b){b&&(this.i.R=!1);return!0}};function D(a){if(!a.i.error&&(a.i.ready=!0,a.i.ready)){var b=a.rb;a.rb=null;b&&b()}}function Ia(a,b){b&&(a.i.ready?b():a.rb=b);return a.i.ready}
v.prototype={constructor:v,parent:null,toString:function(){return this.name?this.name:this.id||this.type},R:function(a,b,c){switch(b){case "clear":return this.w[b]||(this.w[b]=c,c.onclick=function(a){return function(){a.w.print&&(a.w.print.value="")}}(this)),!0;case "print":return this.w[b]||(this.Ta=this.w[b]=c,c.value="",this.M=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.K=function(a){this.M(a,this.Fa)}),!0;default:return!1}},log:function(){},M:function(){},status:function(a){this.M(this.Fa+": "+a)},K:function(a,b,c){c=c||this.type;b||p((c?c+": ":"")+a)},ha:function(){return this.i.L=!0},ga:function(a,b){b&&(this.i.L=!1);return!0}};function D(a){if(!a.i.error&&(a.i.ready=!0,a.i.ready)){var b=a.Oa;a.Oa=null;b&&b()}}function Ia(a,b){b&&(a.i.ready?b():a.Oa=b);return a.i.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});
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 Ja="undefined"!==typeof ArrayBuffer;function Ka(a){v.call(this,"Panel",a,Ka)}x(Ka);h=Ka.prototype;
h.Z=function(a,b,c,d){return this.B&&this.B.Z(a,b,c,d)||this.a&&this.a.Z(a,b,c,d)?!0:this.parent.Z.call(this,a,b,c,d)};h.za=function(a,b,c,d){this.B=a;this.u=b;this.a=c;this.L=d};h.pa=function(a,b){b||La();return!0};h.oa=function(){return!0};h.Ta=function(){};function La(){for(var a=!1,b=C(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=Ga(e.id);f||(a=!0,f=new Ka(e));B(f,d);a&&D(f)}}u(La);
function Ma(a,b,c){v.call(this,"Bus",a,Ma);this.a=b;this.L=c;this.B=a.busWidth||16;this.l=Math.pow(2,this.B);this.u=this.l-1|0;this.c=(this.B>>1)+2;10>this.c&&(this.c=10);15<this.c&&(this.c=15);this.g=1<<this.c;this.w=this.g>>2;this.h=this.g-1;this.o=this.l/this.g|0;this.ua=[];this.m=null;this.bb=this.H;a=new E;Na(a,this.L);this.b=Array(this.o);for(b=0;b<this.o;b++)this.b[b]=a;this.Za=Array(4);this.Za[0]=Oa;this.Za[1]=Pa;this.Za[2]=Qa;this.Za[3]=Ra;Sa(this,this.l-8192,8192,Ta,this);Sa(this,57344,
8192,Ta,this);D(this)}x(Ma);function Oa(a,b){var c=-1,d=this.controller,e=d.ua[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.ua[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);return 0<=c?c:c=d.bb(b|4186112,-1,1)}function Pa(a,b,c){var d=!1,e=this.controller,f=e.ua[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](c):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.ua[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](c):0,f[3](a&255|b<<8,c),d=!0);d||e.bb(c|4186112,b,1)}
function Qa(a,b){var c=-1,d=this.controller;(a=d.ua[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));return 0<=c?c:c=d.bb(b|4186112,-1,0)}function Ra(a,b,c){var d=!1,e=this.controller;if(a=e.ua[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||e.bb(c|4186112,b,0)}Ma.prototype.reset=function(){this.m&&this.m()};Ma.prototype.H=function(){return 0};Ma.prototype.pa=function(a,b){b||this.reset();return!0};
function Sa(a,b,c,d,e){for(var f=b,g=c,l=f>>>a.c;0<g&&l<a.b.length;){var m=a.b[l],n=l*a.g,t=a.g-(f-n);t>g&&(t=g);if(m&&m.size){if(m.type==d&&m.controller==e){if(f+g<=m.Ya)return m.xb+=m.Ya-f,m.Ya=f,!0;if(f>=m.Ya+m.xb){t=m.size-(f-n);t>g&&(t=g);m.xb=f-m.Ya+t;f=n+a.g;g-=t;l++;continue}}return Ua(1,f,g)}f=new E(f,t,a.g,d,e);Na(f,a.L,m);a.b[l++]=f;f=n+a.g;g-=t}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Va[d]+" at "+k(b,8,!0)),!0):Ua(2,b,c)}function Wa(a,b){return a.b[(b&a.u)>>>a.c].Ib(b&a.h,b)}
function Xa(a){for(var b=0,c=[],d=0;d<a.o;d++){var e=a.b[d];if(e.xa||e.kc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,l=0,m=[];g<e.length;){for(var n=e[g],t=g+1;t<e.length&&e[t]===n;)t++;m[l++]=t-g;m[l++]=n;g=t}m.length<e.length&&(e=m)}c[f]=e}}return c}
function Ya(a,b,c){for(var d in c)for(var e=c[d],f=e[0]?e[0].bind(b):null,g=e[1]?e[1].bind(b):null,l=e[2]?e[2].bind(b):null,m=e[3]?e[3].bind(b):null,n=a,t=+d,e=e[4],z=+d;z<=t;z+=2){var H=z&8191;void 0!==n.ua[H]?q("I/O address already registered: "+k(z,8,!0)):n.ua[H]=[f,g,l,m,!1,e||"unknown"]}}function Za(a,b,c){a.m=b;a.bb=c}function Ua(a,b,c){q("Memory block error ("+a+": "+k(b)+","+k(c)+")");return!1}
function F(a){v.call(this,"Device",a,F);this.c={data:0,sd:0,Oa:20,Wc:0};this.b={v:0,Mb:-1};this.g={fb:2496,S:0,D:128,gb:0,eb:0,Y:0,$b:0,T:[],Ka:[406,406,406,406],K:[12,12,12,12]};this.h={v:129,ab:0,M:0,Ba:0,va:0,Ga:0,T:[],K:[40,40,40,40],Ka:[1024,1024,512,512],hc:[157,157,29,29]};this.l={a:[8210,8208,8210,8226],K:[22,22,22,50],Ja:[19,19,19,32],zb:[815,411,815,630],T:[],F:2176,Sa:0,Qa:0,da:[0,0,0,0,0,0,0,0],ca:0,V:[4544,4544,4544,4544,4544,4544,4544,4544],Ra:[0,0,0,0,0,0,0,0],Na:0,Tc:[0,0,0,0,0,0,
0,0],ac:0,bc:[0,0,0,0,0,0,0,0],b:[0,0,0,0,0,0,0,0],Uc:[1,2,3,4,5,6,7,8],cc:[0,0,0,0,0,0,0,0],qa:[0,0,0,0,0,0,0,0],wb:[0,0,0,0,0,0,0,0],Rc:[0,0,0,0,0,0,0,0],Sc:[0,0,0,0,0,0,0,0],Pc:[0,0,0,0,0,0,0,0],Qc:[0,0,0,0,0,0,0,0],Fa:0,Lb:0}}x(F);
var $a=[4127,448,4191,450,4383,452,2591,454,21983,32768,65534,13791,16384,65534,770,2719,454,2591,65534,257,0,2566,33028,34051,33282,1281,33537,0,2758,32771,770,1025,1793,0,3078,33794,34305,513,0,5574,43690,4480,4097,4162,4227,4292,4357,57665,1281,769,0,3138,34305,1281,0,24707,2691,2627,24769,34561,1793,0,3076,20739,24899,2691,34562,2753,1281,0,2624,33537,0,16385,24641,1537,1793,0,193,8279,21589,516,12549,1538,2629,513,0,38336,65281,32769,0,32258,2561,2689,32258,3008,514,3009,769,0,5574,510,2551,
2,0,9678,208,769,0,5582,226,135,0,2598,5606,236,2,0,95,242,128,5573,57344,2591,6,5599,256,4,5574,510,3045,5599,460,76,2591,78,5571,65510,5579,12,5570,512,4224,4104,3024,8197,33788,4224,4609,8193,769,0,2640,8197,33785,6145,2625,8193,769,0,8194,761,2574,5572,43690,5579,24,5568,2048,5570,512,2628,4360,2632,2632,8708,769,0,3103,65514,34562,0,305,35406,754,258,119,65160,3024,32403,5579,36,5568,3072,35446,1,740,5570,512,4224,4104,3024,8197,33788,5569,3,2574,3039,454,528,5582,24,4224,2632,2632,8200,769,
0,3024,3103,65514,34562,0,264,8197,33779,5003,2574,32337,260,0,258,5579,12,6080,448,6081,450,6084,452,116,2,6084,65400,17860,65024,21956,62976,38848,65401,3200,161,76,0,16944,10797];h=F.prototype;h.za=function(a,b,c,d){this.u=b;this.a=c;this.L=d;var e=this;this.b.Mb=ab(this.a,function(){e.b.Aa|=128;e.b.Aa&64&&(G(e.a,0,6,64),bb(e.a,e.b.Mb,1E3/60))});Ya(b,this,I);Za(b,this.reset.bind(this),this.ic.bind(this));D(this)};h.wc=function(){var a=this.b.Aa;this.b.Aa&=-129;return a};
h.ad=function(a){this.b.Aa=a;a&64&&bb(this.a,this.b.Mb,1E3/60);this.b.Aa=a&-129};h.xc=function(){var a=this.a;return a.H&62337|a.kb<<5|a.lb<<1};h.bd=function(a){var b=4,c=this.a;c.H=a&=62337;c.kb=a>>5&3;c.lb=a>>1&15;c.Hb=a&257?a&1?6:4:0;cb(c);a=c.H;a&1|256&&(b=this.a.Da&16?1:2);this.c.Oa=this.c.Oa&-8|b};h.Ec=function(a){return this.a.G[1][a>>1&7]};h.jd=function(a,b){this.a.G[1][b>>1&7]=a&65295};h.Cc=function(a){return this.a.G[1][(a>>1&7)+8]};h.gd=function(a,b){this.a.G[1][(b>>1&7)+8]=a&65295};
h.Dc=function(a){return this.a.X[1][a>>1&7]};h.hd=function(a,b){b=b>>1&7;this.a.X[1][b]=a;this.a.G[1][b]&=65295};h.Bc=function(a){return this.a.X[1][(a>>1&7)+8]};h.fd=function(a,b){b=(b>>1&7)+8;this.a.X[1][b]=a;this.a.G[1][b]&=65295};h.vc=function(a){return this.a.G[0][a>>1&7]};h.$c=function(a,b){this.a.G[0][b>>1&7]=a&65295};h.tc=function(a){return this.a.G[0][(a>>1&7)+8]};h.Yc=function(a,b){this.a.G[0][(b>>1&7)+8]=a&65295};h.uc=function(a){return this.a.X[0][a>>1&7]};
h.Zc=function(a,b){b=b>>1&7;this.a.X[0][b]=a;this.a.G[0][b]&=65295};h.sc=function(a){return this.a.X[0][(a>>1&7)+8]};h.Xc=function(a,b){b=(b>>1&7)+8;this.a.X[0][b]=a;this.a.G[0][b]&=65295};h.Ic=function(a){return this.a.G[3][a>>1&7]};h.nd=function(a,b){this.a.G[3][b>>1&7]=a&65295};h.Gc=function(a){return this.a.G[3][(a>>1&7)+8]};h.ld=function(a,b){this.a.G[3][(b>>1&7)+8]=a&65295};h.Hc=function(a){return this.a.X[3][a>>1&7]};h.md=function(a,b){b=b>>1&7;this.a.X[3][b]=a;this.a.G[3][b]&=65295};
h.Fc=function(a){return this.a.X[3][(a>>1&7)+8]};h.kd=function(a,b){b=(b>>1&7)+8;this.a.X[3][b]=a;this.a.G[3][b]&=65295};h.yc=function(){return db(this.a)};h.cd=function(a){eb(this.a,a&-1809|db(this.a)&1808);this.a.j|=128};
function fb(a){var b=a.g,c,d,e,f=b.Y>>13&7;"undefined"===typeof b.T[f]&&(b.T[f]={cache:[],postProcess:a.Mc,drive:f,blocksize:256,mapped:0,maxblock:b.Ka[f]*b.K[f],url:"rk"+f+".dsk"});b.D&=-129;switch(b.D>>1&7){case 0:b.fb=2496;b.S=0;b.D=128;b.Y=0;break;case 1:if((b.Y>>4&511)>=b.Ka[f]){b.S|=32832;b.D|=49152;break}if((b.Y&15)>=b.K[f]){b.S|=32800;b.D|=49152;break}c=(b.Y>>4&511)*b.K[f]+(b.Y&15);d=(b.D&48)<<12|b.eb;e=65536-b.gb&65535;gb(a,b.T[f],c,d,e);return;case 2:if((b.Y>>4&511)>=b.Ka[f])b.S|=32832,
b.D|=49152;else if((b.Y&15)>=b.K[f])b.S|=32800,b.D|=49152;else{c=(b.Y>>4&511)*b.K[f]+(b.Y&15);d=(b.D&48)<<12|b.eb;e=65536-b.gb&65535;a.ub(b.T[f],c,d,e);return}}b.fb=f<<13|b.fb&8176|b.Y%9&15;G(a.a,20,5,144,function(){b.D=b.D&65534|128;return!!(b.D&64)})}h.Mc=function(a,b,c,d,e){var f=this.g;f.eb=d&65535;f.D=f.D&-49|d>>12&48;f.gb=65536-e&65535;switch(a){case 1:f.S|=33024;f.D|=49152;break;case 2:f.S|=33792,f.D|=49152}G(this.a,20,5,144,function(){f.D=f.D&65534|128;return!!(f.D&64)})};
function hb(a){var b=a.h,c,d,e,f=b.v>>8&3;b.v&=-2;"undefined"===typeof b.T[f]&&(b.T[f]={cache:[],postProcess:a.Nc,drive:f,blocksize:128,mapped:1,maxblock:b.Ka[f]*b.K[f],url:"rl"+f+".dsk"});switch(b.v>>1&7){case 2:b.Ba&8&&(b.v&=63);b.Ba=b.hc[f]|b.Ga&64;break;case 3:1==(b.M&3)&&(b.Ga=b.M&4?b.Ga+(b.M&65408)&65408|b.M<<2&64:b.Ga-(b.M&65408)&65408|b.M<<2&64,b.M=b.Ga);break;case 4:b.Ba=b.Ga;break;case 5:if(b.M>>6>=b.Ka[f]){b.v|=37888;break}if((b.M&63)>=b.K[f]){b.v|=37888;break}c=(b.M>>6)*b.K[f]+(b.M&63);
d=(b.va&63)<<16|b.ab;e=65536-b.Ba&65535;gb(a,b.T[f],c,d,e);return;case 6:if(b.M>>6>=b.Ka[f])b.v|=37888;else if((b.M&63)>=b.K[f])b.v|=37888;else{c=(b.M>>6)*b.K[f]+(b.M&63);d=(b.va&63)<<16|b.ab;e=65536-b.Ba&65535;a.ub(b.T[f],c,d,e);return}}G(a.a,20,5,112,function(){b.v|=129;return!!(b.v&64)})}
h.Nc=function(a,b,c,d,e){var f=this.h;f.ab=d&65535;f.v=f.v&-49|d>>12&48;f.va=d>>16&63;f.M=~~(c/f.K[b.na])<<6|c%f.K[b.na];f.Ga=f.M;f.Ba=65536-e&65535;switch(a){case 1:f.v|=33792;break;case 2:f.v|=40960}G(this.a,20,5,112,function(){f.v|=129;return!!(f.v&64)})};function ib(a){a=a.l;a.F=2176;a.ca=0;a.V=[4544,4544,4544,4544,4544,4544,4544,4544];a.Ra=[0,0,0,0,0,0,0,0];a.Na=a.Sa=a.Qa=a.Fa=a.Lb=0}
function jb(a,b){var c=a.l,d,e,f;c.F&=-16513;c.ca&=-2049;c.V[b]&=-1153;G(a.a,-1,0,172);"undefined"===typeof c.T[b]&&(c.T[b]={cache:[],postProcess:a.Oc,drive:b,blocksize:256,mapped:0,maxblock:c.zb[0]*c.Ja[0]*c.K[0],url:"rp"+b+".dsk"});switch(c.F&63){case 5:c.wb[b]=c.qa[b];c.F|=32896;c.V[b]|=32896;c.Na|=1<<b;break;case 9:ib(a);break;case 19:c.V[b]|=64;break;case 49:if(c.qa[b]>=c.zb[0]||c.da[b]>>8>=c.Ja[0]||(c.da[b]&255)>=c.K[0]){c.Ra[b]|=1024;c.F|=49152;break}d=(c.qa[b]*c.Ja[0]+(c.da[b]>>8))*c.K[0]+
(c.da[b]&255);e=(c.Fa&63)<<16|c.Qa;f=65536-c.Sa&65535;gb(a,c.T[b],d,e,f);return;case 57:if(c.qa[b]>=c.zb[0]||c.da[b]>>8>=c.Ja[0]||(c.da[b]&255)>=c.K[0])c.Ra[b]|=1024,c.F|=49152;else{d=(c.qa[b]*c.Ja[0]+(c.da[b]>>8))*c.K[0]+(c.da[b]&255);e=(c.Fa&63)<<16|c.Qa;f=65536-c.Sa&65535;a.ub(c.T[b],d,e,f);return}}G(a.a,3,5,172,function(){c.F=c.F&65534|128;c.V[b]|=128;return!!(c.F&64)})}
h.Oc=function(a,b,c,d,e){var f=this.l;f.Sa=65536-e&65535;f.Qa=d&65535;f.F=f.F&-769|d>>8&768;f.Fa=d>>16&63;e=~~(c/f.K[0]);d=~~(e/f.Ja[0]);f.da[b.na]=e%f.Ja[0]<<8|c%f.K[0];f.wb[b.na]=f.qa[b.na]=d;f.Na|=1<<b.na;c>=b.oc-1&&(f.V[b.na]|=1024);switch(a){case 1:f.ca|=512;f.F|=49152;break;case 2:f.ca|=2048,f.F|=49152}G(this.a,20,5,172,function(){f.V[b.na]|=128;f.F=f.F&65534|128;return!!(f.F&64)})};
function kb(a,b,c,d,e,f){var g=~~((f+c.wa-1)/c.wa),l=new XMLHttpRequest;2048>g&&d+2048<c.oc&&(g=2048);l.open("GET",c.url,!0);l.setRequestHeader("Range","bytes="+(d*c.wa<<1)+"-"+(((d+g)*c.wa<<1)-1));l.responseType="arraybuffer";l.onreadystatechange=function(){if(4==l.readyState){var g=b.bind(a),n,t,z,H;n=l.response;if(l.status&&206!=l.status||!n)c.tb(1,c,d,e,f);else{n=new Uint8Array(n);t=d;for(H=0;H<n.length;){if("undefined"===typeof c.cache[t])for(c.cache[t]=[],z=0;z<c.wa;z++)c.cache[t][z]=H<n.length?
n[H]&255|n[H+1]<<8&65280:0,H+=2;else H+=c.wa<<1;t++}g(c,d,e,f)}}};l.send(null)}function J(a,b,c,d,e){c&1?e?d=0<=d?d<<8&65280|b&255:b:K(a.a,4):0<=d?e&&(d=b&65280|d&255):d=b;return d}h.ub=function(a,b,c,d){for(var e;0<d;){if("undefined"===typeof a.cache[b]){kb(this,this.ub,a,b,c,d);return}for(e=0;e<a.wa&&0<d;e++){if(0>this.a.Ua(a.nc?lb(this.a,c):c,a.cache[b][e])){a.tb(2,a,b,c,d);return}c+=2;--d}b++}a.tb(0,a,b,c,d)};
function gb(a,b,c,d,e){for(var f,g;0<e;){if("undefined"===typeof b.cache[c])for(b.cache[c]=[],f=0;f<b.wa;f++)b.cache[c][f]=0;for(f=0;f<b.wa&&0<e;f++){g=a.a.Pa(b.nc?lb(a.a,d):d);if(0>g){b.tb(2,b,c,d,e);return}b.cache[c][f]=g;d+=2;--e}c++}b.tb(0,b,c,d,e)}h.reset=function(){this.c.Oa=this.c.Oa&-120|20;this.b.Aa=0;this.g.D=128;this.h.v=128;ib(this)};
h.ic=function(a,b,c){var d,e,f=this.a;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=f.Ea&65280:(a&1&&(b<<=8),f.Ea=b|255,d=0);break;case 4194298:if(0>b)d=f.Kb;else{a&1&&(b<<=8);if(d=b&65024){e=d>>9;do d+=34;while(e>>=1)}f.Kb=d;f.j|=2}break;case 4194294:if(70!==f.La)return K(f,4);0>b?d=f.s:d=f.s=0;break;case 4194292:if(70!==f.La)return K(f,4);d=1;break;case 4194290:if(70!==f.La)return K(f,4);d=0;break;case 4194288:if(70!==f.La)return K(f,4);d=61183;break;case 4194296:0<=b&&!(a&1)&&(b&=
255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==f.La)return K(f,4);e=a-4194272>>1;0>b?d=f.Cb[e]:(d=J(this,f.Cb[e],a,b,c),0<=d&&(f.Cb[e]=d));break;case 4194254:return a&1?f.C>>14&1?(0<=b&&(f.f[6]=b),d=f.f[6]):(0<=b&&(f.fa[3]=b),d=f.fa[3]):f.C>>14&0?(0<=b&&(f.f[6]=b),d=f.f[6]):(0<=b&&(f.fa[1]=b),d=f.fa[1]),d;case 4194252:case 4194250:case 4194248:return e=a&7,f.C&2048?(0<=b&&(f.f[e]=b),d=f.f[e]):(0<=b&&(f.Ma[e]=b),d=f.Ma[e]),d;case 4194246:return a&
1?(0<=b&&(f.f[7]=b),d=f.f[7]):f.C>>14&0?(0<=b&&(f.f[6]=b),d=f.f[6]):(0<=b&&(f.fa[0]=b),d=f.fa[0]),d;case 4194244:case 4194242:case 4194240:return e=a&7,f.C&2048?(0<=b&&(f.Ma[e]=b),d=f.Ma[e]):(0<=b&&(f.f[e]=b),d=f.f[e]),d;default:return f.s|=16,K(f,4)}break;case 4194176:e=a>>1&31;d=J(this,f.aa[3][e],a,b,c);0<=d&&(f.aa[3][e]=d,f.aa[3][e&15]&=65295);break;case 4194112:switch(a&-2){case 4194174:d=J(this,f.vb,a,b,c);0<=d&&(f.vb=d);break;case 4194172:d=f.Ca;d&65280&&(d=(d<<8|d>>8)&65535);break;case 4194168:0>
b?d=this.c.Wc&65535:(d=J(this,this.c.data,a,b,c),0<=d&&(this.c.data=d));break;default:return f.s|=16,K(f,4)}break;case 4194048:e=this.g;switch(a&-2){case 4194048:d=J(this,e.fb,a,b,c);0<=d&&(e.fb=d);break;case 4194050:d=J(this,e.S,a,b,c);0<=d&&(e.S=d);break;case 4194052:d=J(this,e.D,a,b,c);0<=b&&0<=d&&(e.D=d&-36993|e.D&36992,e.D&1&&fb(this));break;case 4194054:d=J(this,e.gb,a,b,c);0<=d&&(e.gb=d);break;case 4194056:d=J(this,e.eb,a,b,c);0<=d&&(e.eb=d);break;case 4194058:d=J(this,e.Y,a,b,c);0<=d&&(e.Y=
d);break;case 4194060:break;case 4194062:d=J(this,e.$b,a,b,c);0<=d&&(e.$b=d);break;default:return f.s|=16,K(f,4)}break;case 4193728:var g=this.l;e=g.ca&7;switch(a&-2){case 4193728:d=J(this,g.F,a,b,c);0<=b&&0<=d&&(g.Fa=g.Fa&60|d>>8&3,g.F=d&17279|g.F&34944|2048,d&1&&g.F&128?jb(this,e):192==(d&192)&&G(f,0,5,172));break;case 4193730:d=J(this,g.Sa,a,b,c);0<=d&&(g.Sa=d);break;case 4193732:d=J(this,g.Qa,a,b,c);0<=d&&(g.Qa=d&65534);break;case 4193734:d=J(this,g.da[e],a,b,c);0<=d&&(g.da[e]=d&7967);break;case 4193736:d=
J(this,g.ca,a,b,c);0<=d&&(g.ca=d&63|g.ca&65472,d&128&&ib(this));break;case 4193738:d=g.V[e];break;case 4193740:d=g.Ra[e];break;case 4193742:d=J(this,g.Na,a,b,c);0<=d&&(g.Na=d&255);break;case 4193744:d=g.Tc[e];break;case 4193746:d=J(this,g.ac,a,b,c);0<=d&&(g.ac=d);break;case 4193748:d=J(this,g.bc[e],a,b,c);0<=d&&(g.bc[e]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=g.Uc[e];break;case 4193754:d=J(this,g.cc[e],a,b,c);0<=d&&(g.cc[e]=d);break;case 4193756:d=J(this,g.qa[e],a,b,c);0<=d&&(g.qa[e]=
d&511);break;case 4193758:g.wb[e]=g.qa[e];d=g.wb[e];break;case 4193760:d=g.Rc[e];break;case 4193762:d=g.Sc[e];break;case 4193764:d=g.Pc[e];break;case 4193766:d=g.Qc[e];break;case 4193768:d=J(this,g.Fa,a,b,c);0<=d&&(g.Fa=d&63,g.F=g.F&-769|(d&3)<<8);break;case 4193770:d=J(this,g.Lb,a,b,c);0<=d&&(g.Lb=d);break;default:return f.s|=16,K(f,4)}break;case 4192512:e=this.h;switch(a&-2){case 4192512:d=J(this,e.v,a,b,c);0<=b&&0<=d&&(e.va=e.va&60|d>>4&3,e.v=e.v&-1023|d&1022,e.v&128||hb(this));break;case 4192514:d=
J(this,e.ab,a,b,c);0<=d&&(e.ab=d&65534);break;case 4192516:d=J(this,e.M,a,b,c);0<=d&&(e.M=d);break;case 4192518:d=J(this,e.Ba,a,b,c);0<=d&&(e.Ba=d);break;case 4192520:d=J(this,e.va,a,b,c);0<=d&&(e.va=d&63,e.v=e.v&-49|(e.va&3)<<4);break;default:return f.s|=16,K(f,4)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=f.Da:(d=J(this,f.Da,a,b,c),0<=d&&(70!==f.La&&(d&=-49),f.Da=d,f.sb[0]=d&4?15:7,f.sb[1]=d&2?15:7,f.sb[3]=d&1?15:7,f.Hb&&(e=2,f.Da&16&&(e=1),this.c.Oa=this.c.Oa&-8|e)));break;default:return f.s|=
16,K(f,4)}break;case 4191424:e=a>>1&31;d=J(this,f.aa[0][e],a,b,c);0<=d&&(f.aa[0][e]=d,f.aa[0][e&15]&=65295);break;case 4191360:e=a>>1&31;d=J(this,f.aa[1][e],a,b,c);0<=d&&(f.aa[1][e]=d,f.aa[1][e&15]&=65295);break;case 4190400:case 4190336:if(70!==f.La)return K(f,4);e=a>>2&31;d=f.hb[e];a&2&&(d>>=16);d&=65535;0<=b&&(d=J(this,d,a,b,c),0<=d&&(f.hb[e]=a&2?d<<16|f.hb[e]&65535:f.hb[e]&4294901760|d&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>
b)d=$a[a>>1&255];else return f.s|=16,K(f,4);break;default:return f.s|=16,K(f,4)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)");return d};
var L={},I=(L[62592]=[null,null,F.prototype.Ec,F.prototype.jd,"SISDR"],L[62608]=[null,null,F.prototype.Cc,F.prototype.gd,"SDSDR"],L[62624]=[null,null,F.prototype.Dc,F.prototype.hd,"SISAR"],L[62640]=[null,null,F.prototype.Bc,F.prototype.fd,"SDSAR"],L[62656]=[null,null,F.prototype.vc,F.prototype.$c,"KISDR"],L[62672]=[null,null,F.prototype.tc,F.prototype.Yc,"KDSDR"],L[62688]=[null,null,F.prototype.uc,F.prototype.Zc,"KISAR"],L[62704]=[null,null,F.prototype.sc,F.prototype.Xc,"KDSAR"],L[65382]=[null,null,
F.prototype.wc,F.prototype.ad,"LKS"],L[65402]=[null,null,F.prototype.xc,F.prototype.bd,"MMR0"],L[65408]=[null,null,F.prototype.Ic,F.prototype.nd,"UISDR"],L[65424]=[null,null,F.prototype.Gc,F.prototype.ld,"UDSDR"],L[65440]=[null,null,F.prototype.Hc,F.prototype.md,"UISAR"],L[65456]=[null,null,F.prototype.Fc,F.prototype.kd,"UDSAR"],L[65534]=[null,null,F.prototype.yc,F.prototype.cd,"PSW"],L);I[62594]=I[62592];I[62596]=I[62592];I[62598]=I[62592];I[62600]=I[62592];I[62602]=I[62592];I[62604]=I[62592];
I[62606]=I[62592];I[62610]=I[62608];I[62612]=I[62608];I[62614]=I[62608];I[62616]=I[62608];I[62618]=I[62608];I[62620]=I[62608];I[62622]=I[62608];I[62626]=I[62624];I[62628]=I[62624];I[62630]=I[62624];I[62632]=I[62624];I[62634]=I[62624];I[62636]=I[62624];I[62638]=I[62624];I[62642]=I[62640];I[62644]=I[62640];I[62646]=I[62640];I[62648]=I[62640];I[62650]=I[62640];I[62652]=I[62640];I[62654]=I[62640];I[62658]=I[62656];I[62660]=I[62656];I[62662]=I[62656];I[62664]=I[62656];I[62666]=I[62656];I[62668]=I[62656];
I[62670]=I[62656];I[62674]=I[62672];I[62676]=I[62672];I[62678]=I[62672];I[62680]=I[62672];I[62682]=I[62672];I[62684]=I[62672];I[62686]=I[62672];I[62690]=I[62688];I[62692]=I[62688];I[62694]=I[62688];I[62696]=I[62688];I[62698]=I[62688];I[62700]=I[62688];I[62702]=I[62688];I[62706]=I[62704];I[62708]=I[62704];I[62710]=I[62704];I[62712]=I[62704];I[62714]=I[62704];I[62716]=I[62704];I[62718]=I[62704];I[65410]=I[65408];I[65412]=I[65408];I[65414]=I[65408];I[65416]=I[65408];I[65418]=I[65408];I[65420]=I[65408];
I[65422]=I[65408];I[65426]=I[65424];I[65428]=I[65424];I[65430]=I[65424];I[65432]=I[65424];I[65434]=I[65424];I[65436]=I[65424];I[65438]=I[65424];I[65442]=I[65440];I[65444]=I[65440];I[65446]=I[65440];I[65448]=I[65440];I[65450]=I[65440];I[65452]=I[65440];I[65454]=I[65440];I[65458]=I[65456];I[65460]=I[65456];I[65462]=I[65456];I[65464]=I[65456];I[65466]=I[65456];I[65468]=I[65456];I[65470]=I[65456];
u(function(){for(var a=C(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new F(d);B(d,c)}});var mb;if(Ja){var nb=new ArrayBuffer(2);(new DataView(nb)).setUint16(0,256,!0);mb=256===(new Uint16Array(nb))[0]}else mb=!1;var ob=mb;
function E(a,b,c,d,e){this.id=pb+=2;this.a=null;this.Ya=a;this.xb=b;this.size=c||0;this.type=d||qb;this.A=d==rb;this.controller=null;Na(this);this.xa=this.kc=!1;if(c)if(e)this.controller=e,this.a=null,sb(this,e.Za);else if(Ja)this.b=new ArrayBuffer(c),this.g=new DataView(this.b,0,c),this.c=new Uint8Array(this.b,0,c),this.l=new Uint16Array(this.b,0,c>>1),this.a=new Int32Array(this.b,0,c>>2),sb(this,ob?tb:ub);else{this.a=Array(c>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;sb(this,vb)}else sb(this)}
var qb=0,rb=2,Ta=4,Va=["NONE","RAM","ROM","VID","H/W"],pb=0;
E.prototype={constructor:E,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ja)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.g.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(Ja)for(b=0;b<a.length;b++)this.g.setInt32(b<<2,a[b],!0);else this.a=a;return this.xa=!0}return!1},m:function(){return 255},B:function(){},o:function(a,b){return this.Ib(a++,b++)|this.Ib(a,b)<<8},w:function(a,b,c){this.yb(a++,
b&255,c++);this.yb(a,b>>8,c)},O:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ha:function(a){var 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},la:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.xa=!0},Ia:function(a,b){var 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.xa=!0},I:function(a,b){return this.J(a,b)},$:function(a,b){return this.ea(a,
b)},ja:function(a,b,c){this.A||this.gc(a,b,c)},sa:function(a,b,c){this.A||this.ta(a,b,c)},H:function(a){return this.c[a]},N:function(a){return this.c[a]},W:function(a){return this.g.getUint16(a,!0)},ga:function(a){return this.l[a>>1]},ia:function(a,b){this.c[a]=b;this.xa=!0},ka:function(a,b){this.c[a]=b;this.xa=!0},ra:function(a,b){this.g.setUint16(a,b,!0);this.xa=!0},Ha:function(a,b){this.l[a>>1]=b;this.xa=!0}};
function Na(a,b,c){a.L=b;a.h=a.u=0;c&&((a.h=c.h)&&wb(a,xb,!1),(a.u=c.u)&&yb(a,xb,!1))}function yb(a,b,c){c&&a.u||(a.yb=!a.A&&b[1]||a.B,a.od=!a.A&&b[3]||a.w);if(c||void 0===c)a.gc=b[1]||a.B,a.ta=b[3]||a.w}function wb(a,b,c){c&&a.h||(a.Ib=b[0]||a.m,a.Jc=b[2]||a.o);if(c||void 0===c)a.J=b[0]||a.m,a.ea=b[2]||a.o}function sb(a,b){b||(b=zb);wb(a,b,void 0);yb(a,b,void 0)}var zb=[],vb=[E.prototype.O,E.prototype.la,E.prototype.ha,E.prototype.Ia],xb=[E.prototype.I,E.prototype.ja,E.prototype.$,E.prototype.sa];
if(Ja)var ub=[E.prototype.H,E.prototype.ia,E.prototype.W,E.prototype.ra],tb=[E.prototype.N,E.prototype.ka,E.prototype.ga,E.prototype.Ha];function Ab(a,b){v.call(this,"CPU",a,Ab);var c=a.multiplier||1;this.ob=a.cycles||b;this.ka=c;this.Fb=Math.round(this.ob/1E4)/100;this.ra=this.Fb*this.ka;this.i.ba=!1;this.i.dc=!1;this.i.$a=a.autoStart;this.i.Nb=!1;this.i.qb=!1;this.ib=this.sa=0;this.nb=a.csStart;this.Ia=a.csInterval;this.Va=a.csStop;this.N=[];this.Wb=this.Vc.bind(this);D(this)}x(Ab);
var Bb=["power","reset"];h=Ab.prototype;h.za=function(a,b,c,d){this.B=a;this.u=b;this.L=d;for(b=0;b<Bb.length;b++)(c=this.A[Bb[b]])&&this.B.Z(null,Bb[b],c);this.Ha=null;a=Cb(a,"autoStart");null!=a&&(this.i.$a="true"==a?!0:"false"==a?!1:!!a);D(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.pa=function(a,b){if(!b){if(a&&this.restore){Db(this);if(!this.restore(a))return!1;Eb(this)}else this.reset();this.U("No debugger detected")}Fb(this);return!0};
h.oa=function(a){return a?this.save():!0};h.$a=function(){return this.i.$a||void 0===this.A.run?(Gb(this),!0):!1};h.Pb=function(){return 0};function Eb(a){void 0===a.nb&&(a.nb=0);void 0===a.Ia&&(a.Ia=-1);void 0===a.Va&&(a.Va=-1);a.i.qb=0<=a.nb&&0<a.Ia;a.i.qb&&(a.ib=0,a.sa=a.nb-a.la)}
function Hb(a,b,c,d){if(a.A[b]){void 0===c&&(a.i.error=!0,a.P("Value for "+b+" is invalid"),M(a));var e=a.L&&a.L.b||8;if(!a.i.ba||a.i.Nb)if(8==e){e="";d?11<d&&(d=11):d=c&-65536?11:6;if(null==c||isNaN(c))for(;0<d--;)e="?"+e;else for(;0<d--;)e=String.fromCharCode((c&7)+48)+e,c>>=3;d=""+e}else d=k(c,d);else d="--------".substr(0,d||4);a.A[b].textContent!=d&&(a.A[b].textContent=d)}}
h.Z=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.A[b]=c;a=!0;break;case "run":this.A[b]=c;c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.i.R)a=!0;else{var b=null,c,l=y(a.id);for(c=0;c<l.length&&(b=l[c],b===a||b.i.ready);c++);if(c==l.length)for(c=0;c<l.length&&(b=l[c],b===a||b.i.R);c++);c==l.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.i.ready?"powered yet":"ready yet"+(b.rb?" (waiting for notification)":""))+".");a=!1}a&&(d.i.ba?M(d):Gb(d))};a=!0;break;
case "speed":this.A[b]=c;a=!0;break;case "setSpeed":this.A[b]=c,c.onclick=function(){Ib(d,d.ka<<1)},c.textContent=this.ra.toFixed(2)+"Mhz",a=!0}return a};function Jb(a,b,c){a.la+=b;c&&(a.ja=a.a=0)}function Kb(a,b){var c=1;b&&1<a.ka&&a.ha&&(c=a.ha/a.Fb);a.Ub=Math.round(1E3/30);a.pb=Math.floor(a.ob/30*c);b||(a.Wa=a.pb);a.Gb=0}function Lb(a){return a.la+a.ea+a.ja-a.a}function Db(a){a.ha=0;a.Vb=0;a.la=a.ea=a.ja=a.a=0;Eb(a);Ib(a,1)}
function Ib(a,b){if(void 0!==b&&(.8>a.ha/a.ra&&(b=1),a.ka=b,b=a.Fb*a.ka,a.ra!=b)){a.ra=b;b=a.ra.toFixed(2)+"Mhz";var c=a.A.setSpeed;c&&(c.textContent=b);a.U("target speed: "+b)}Jb(a,a.ea);a.ea=0;a.$=ja();a.ia=0;Kb(a)}function ab(a,b){var c=a.N.length;a.N.push([-1,b]);return c}function bb(a,b,c){0<=b&&b<a.N.length&&0>a.N[b][0]&&(c*=a.ob*a.ka/1E3,a.N[b][0]=c)}
h.Vc=function(){if(this.i.ba){this.Gb>=this.ob&&Kb(this,!0);this.Xa=0;this.mb=ja();if(this.ia){var a=this.mb-this.ia;a>this.Ub&&(this.$+=a,this.$>this.mb&&(this.$=this.mb))}try{do{for(var b,c=this.i.qb?1:this.pb,d=this.N.length-1;0<=d;d--){var e=this.N[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.ec(b)}catch(n){if("number"!=typeof n)throw n;}for(var f=this.ja-this.a,a=f,g=this.N.length-1;0<=g;g--){var l=this.N[g];0>l[0]||(l[0]-=a,0>=l[0]&&(l[0]=-1,l[1]()))}this.Xa+=f;this.ea+=f;Jb(this,0,!0);a=f;if(this.i.qb){var m=
!1;this.ib=this.ib+this.Pb()|0;this.sa-=a;0>=this.sa&&(this.sa+=this.Ia,m=!0);0<=this.Va&&this.Va<=Lb(this)&&(this.Ia=this.Va=-1,Eb(this),M(this),m=!0);m&&this.U(Lb(this)+" cycles: checksum="+k(this.ib))}this.Wa-=f;if(0>=this.Wa){this.Wa+=this.pb;15<=++this.Vb&&(this.B&&this.B.Ta(),this.Vb=0);break}}while(this.i.ba)}catch(n){M(this);Fb(this);this.B&&this.B.stop(ja(),Lb(this));b=n.stack||n.message;this.i.error=!0;this.P(b);return}if(this.i.ba){b=setTimeout;c=this.Wb;this.ia=ja();d=this.Ub;this.Xa&&
(d=Math.round(d*this.Xa/this.pb));d-=this.ia-this.mb;if(e=this.ia-this.$)this.ha=Math.round(this.ea/(10*e))/100,864E5<=e&&(this.la=0,Ib(this));if(0>d||this.ha<this.ra)-1E3>d&&(this.$-=d),d=0;this.Gb+=this.Xa;this.ia+=d;b(c,d)}}};function Gb(a){var b;a.i.error?(a.U(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.i.ba)a.U(a.toString()+" busy");else{Ib(a);a.i.ba=!0;a.i.dc=!0;a.Ha&&a.Ha.start();if(b=a.A.run)b.textContent="Halt";a.B&&a.B.start(a.$,Lb(a));Fb(a,!0);setTimeout(a.Wb,0)}}h.ec=function(){return 0};
function M(a){if(a.i.ba){a.ja-=a.a;a.a=0;Jb(a,a.ea);a.ea=0;a.i.ba=!1;a.Ha&&a.Ha.stop();var b=a.A.run;b&&(b.textContent="Run");a.B&&a.B.stop(ja(),Lb(a));Fb(a)}a.i.complete=void 0}function Fb(a,b){a.B&&a.B.Ta(b)}
function Mb(a){this.rc=a.resetAddr||0;Ab.call(this,a,6666667);this.Qb=0;this.decode=Nb.bind(this);this.l=65536;this.g=32768;this.h=65535;this.m=32768;this.C=15;this.f=[0,0,0,0,0,0,0,this.rc];this.Ma=[0,0,0,0,0,0];this.fa=[0,0,0,0];this.lb=this.w=0;this.pc=[4,2,0,1];this.G=[[0,0,0,0,0,0,0,0,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]];this.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]];this.aa=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.hb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0];this.Cb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.c=this.b=this.Db=this.I=this.J=this.j=0;this.La=70;this.ta=-1;Ob(this);this.i.complete=this.i.jc=!1}x(Mb,Ab);h=Mb.prototype;h.reset=function(){this.i.ba&&M(this);Ob(this);Db(this);this.i.error=!1;this.parent.reset.call(this)};function Ob(a){a.Ea=255;a.s=0;a.Kb=0;a.H=0;a.Ca=0;a.vb=0;a.Da=0;a.Hb=0;a.kb=0;a.sb=262143;a.Tb=253952;a.o=[];a.j|=2;cb(a)}
function cb(a){a.Hb?(a.ga=65536,a.O=a.mc,a.W=a.Zb,a.Xb=a.pd):(a.ga=0,a.O=a.lc,a.W=a.Pa,a.Xb=a.Ua)}h.Pb=function(){return 0};h.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.la,this.ka]);a.set(2,Xa(this.u));return a.data()};
h.restore=function(a){var b=a[1];this.la=b[1];Ib(this,b[3]);a:{b=this.u;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.w){for(var f=0,g=Array(b.w),l=0;l<e.length-1;)for(var m=e[l++],n=e[l++];m--;)g[f++]=n;e=g}f=b.b[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
h.Z=function(a,b,c){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":this.A[b]=c;this.Qb++;a=!0;break;default:a=this.parent.Z.call(this,a,b,c)}return a};
h.Ta=function(a){if(this.Qb&&(a||!this.i.ba||this.i.Nb)){for(a=0;a<this.f.length;a++)Hb(this,"R"+a,this.f[a]);a=db(this);Hb(this,"PS",a);Hb(this,"NF",a&8?1:0,1);Hb(this,"ZF",a&4?1:0,1);Hb(this,"VF",a&2?1:0,1);Hb(this,"CF",a&1?1:0,1)}if(a=this.A.speed)a.textContent=this.i.ba&&this.ha?this.ha.toFixed(2)+"Mhz":"Stopped"};function O(a){return a.l&65536?1:0}h.ya=function(){return this.m&32768?8:0};function Pb(a){var b=a.W(a.f[7]);a.f[7]=a.f[7]+2&65535;return b}
function G(a,b,c,d,e){for(var f=a.o.length;0<f--;)if(a.o[f].fc===d){0<f&&(a.o[f-1].ma+=a.o[f].ma);a.o.splice(f,1);break}if(0<=b){for(f=a.o.length;0<f--;){if(a.o[f].ma>b){a.o[f].ma-=b;break}b-=a.o[f].ma}a.o.splice(f+1,0,{ma:b,Yb:c<<5&224,fc:d,Ab:e})}a.j|=2}function db(a){return a.C=a.C&63728|a.ya()|(a.h&65535?0:4)|(a.g&32768?2:0)|O(a)}
function eb(a,b){a.m=b<<12;a.h=~b&4;a.g=b<<14;a.l=b<<16;if((b^a.C)&2048)for(var c=a.Ma.length;0<=--c;){var d=a.f[c];a.f[c]=a.Ma[c];a.Ma[c]=d}a.w=b>>14&3;c=a.C>>14&3;a.w!=c&&(a.fa[c]=a.f[6],a.f[6]=a.fa[a.w]);a.j|=2;a.C=b}function P(a,b){a.j&128||(a.m=a.h=b,a.g=0)}function Q(a,b,c){a.j&128||(a.m=a.h=a.l=b,a.g=c||0)}function Qb(a,b,c,d){a.j&128||(a.m=a.h=a.l=b,a.g=(c^b)&(d^b))}function R(a,b){a.j&128||(a.m=a.h=a.l=b,a.g=a.m^a.l>>1)}function Rb(a,b,c,d){a.j&128||(a.m=a.h=a.l=b,a.g=(c^d)&(d^b))}
function K(a,b){var c=!1;0>a.ta?a.ta=db(a):a.w||(b=4,c=!0);a.H&57344||(a.Ca=63222,a.vb=b);a.w=0;var d=a.W(b|a.ga),e=a.W(b+2&65535|a.ga);eb(a,e&-12289|a.ta>>2&12288);c&&(a.s|=4,a.f[6]=4);Sb(a,a.ta);Sb(a,a.f[7]);a.f[7]=d&65535;a.j&=-113;a.ta=-1;throw b;}function Tb(a){var b=Ub(a),c=Ub(a)&-1793;a.C&49152&&(c=c&-225|a.C&63712);a.f[7]=b&65535;eb(a,c);a.j&=-17}
function lb(a,b){var c=b>>13&31;31>c?a.Da&32&&(b=a.hb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b}
function Vb(a,b,c){var d,e,f,g=0;d=b>>13;a.Da&a.pc[a.w]||(d&=7);e=a.G[a.w][d];f=(a.X[a.w][d]<<6)+(b&8191)&a.sb;f<a.Tb?f&1&&!(c&1)&&(a.s|=64,K(a,4)):(a.Da&16||253952<=f&&(f|=4186112),4186112>f&&(3932160<=f&&(f=lb(a,f&262143)),f>=a.Tb&&4186112>f&&(a.s|=32,K(a,4))));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.G[a.w][d]=e;if(4194170!==f||a.w)a.kb=a.w,a.lb=d;g&&(g&57344&&(0<=a.ta&&(g|=128),a.H&57344||(a.H=a.H|g|a.kb<<5|a.lb<<1),K(a,168)),a.H&61440||!(4191360>f||4194239<f)||(a.H|=4096,a.H&512&&(a.j|=32)));return f}function Ub(a){var b=a.W(a.f[6]|a.ga);a.f[6]=a.f[6]+2&65535;return b}function Sb(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.H&57344||(a.Ca=a.Ca<<8|246);!a.w&&c<=a.Ea&&4<c&&(c<=a.Ea-32?(a.s|=4,a.f[6]=4,K(a,4)):(a.s|=8,a.j|=4));a.Xb(c,b)}
function Wb(a,b,c,d){var e,f,g=d&8?0:a.ga;switch(b){case 0:return K(a,4),0;case 1:return 6===c&&!a.w&&d&4&&(a.f[6]<=a.Ea||65534<=a.f[6])&&(a.f[6]<=a.Ea-32||65534<=a.f[6]?(a.s|=4,a.f[6]=4,K(a,4)):(a.s|=8,a.j|=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.W(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.W(e)|g;a.a-=8;break;
case 6:return e=Pb(a),e=e+a.f[c]&65535|g,a.a-=6,e;case 7:return e=Pb(a),e=e+a.f[c]&65535,e=a.W(e|a.ga)|g,a.a-=10,e}a.f[c]=a.f[c]+f&65535;!g||a.H&57344||(a.Ca=a.Ca<<8|f<<3&248|c);6==c&&!a.w&&d&4&&0>=f&&(a.f[6]<=a.Ea||65534<=a.f[6])&&(a.f[6]<=a.Ea-32?(a.s|=4,a.f[6]=4,K(a,4)):(a.s|=8,a.j|=64));return e}h.lc=function(a,b,c){return Wb(this,a,b,c)};h.mc=function(a,b,c){return Vb(this,Wb(this,a,b,c),c)};h.Pa=function(a){a&1&&(this.s|=64,K(this,4));var b=this.u;return b.b[(a&b.u)>>>b.c].Jc(a&b.h,a)};
h.Zb=function(a){return this.Pa(Vb(this,a,2))};h.Ua=function(a,b){a&1&&(this.s|=64,K(this,4));var c=this.u;c.b[(a&c.u)>>>c.c].od(a&c.h,b&65535,a)};h.pd=function(a,b){this.Ua(Vb(this,a|65536,4),b)};function Xb(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=Wb(a,b,d,2),c&65536||61440!==(a.C&61440)&&(d&=65535),a.w=a.C>>12&3,c=a.W(d|c&a.ga),a.w=a.C>>14&3):c=6!=d||(a.C>>2&12288)===(a.C&12288)?a.f[d]:a.fa[a.C>>12&3];return c}
function Yb(a,b,c,d){a.H&57344||(a.Ca=22);var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=Wb(a,b,e,4),c&65536||(e&=65535),a.w=a.C>>12&3,e=Vb(a,e|c&65536,4),a.w=a.C>>14&3,a.Ua(e,d)):6!=e||(a.C>>2&12288)===(a.C&12288)?a.f[e]=d:a.fa[a.C>>12&3]=d}function Zb(a,b){b>>=6;var c=a.J=b&7;(b=a.I=(b&56)>>3)?(c=a.O(b,c,3),a=Wa(a.u,c)):a=a.f[c]&255;return a}function S(a,b){var c;b>>=6;var d=a.J=b&7;(b=a.I=(b&56)>>3)?c=a.Pa(a.O(b,d,2)):c=a.f[d];return c}function $b(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return Wb(a,b,c,8)}
function ac(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.O(b,c,3),a=Wa(a.u,c)):a=a.f[c]&255;return a}function bc(a,b){var c,d=a.b=b&7;(b=a.c=(b&56)>>3)?c=a.Pa(a.O(b,d,2)):c=a.f[d];return c}function T(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.Db=a.O(b,e,7),c=d.call(a,c,Wa(a.u,e)),e&1&&a.a--,a=a.u,a.b[(e&a.u)>>>a.c].yb(e&a.h,c&255,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.O(b,e,6),a.Ua(e,d.call(a,c,a.Pa(e)))):a.f[e]=d.call(a,c,a.f[e])}
function cc(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(d=a.O(b,e,5),d&1&&a.a--,a=a.u,a.b[(d&a.u)>>>a.c].yb(d&a.h,c&255,d)):a.f[e]=c?d&1?c<<24>>24&65535:a.f[e]&-256|c&255:a.f[e]&-256;return c}function dc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?a.Ua(a.O(b,d,4),c):a.f[d]=c&65535;return c}function V(a,b,c){c&&(a.f[7]=a.f[7]+(b<<24>>23)&65535,a.a-=2);a.a-=3}
h.ec=function(a){this.i.complete=!0;this.i.jc=!1;this.i.dc=!1;this.ja=this.a=a;do{if(this.j&&(this.j&112&&(this.j&32?K(this,168):this.j&64?K(this,4):this.j&16&&K(this,12),this.j&=-113),this.j&7))if(this.j&2){this.j&=-3;a=null;for(var b=this.Kb&224,c=this.o.length;0<=--c;){if(0<this.o[c].ma){this.o[c].ma--;this.j|=2;break}if(this.o[c].Ab){if(!this.o[c].Ab()){this.o.splice(c,1);continue}this.o[c].Ab=null}this.o[c].Yb>b&&(b=this.o[c].Yb,a=this.o[c],this.o.splice(c,1))}b>(this.C&224)&&(this.j&4&&(this.f[7]=
this.f[7]+2&65535,this.j&=-5),a?K(this,a.fc):K(this,160))}else this.j&1&&this.j++;this.H&57344||(this.Ca=0,this.vb=this.f[7]);this.j=this.j&7|this.C&16;this.decode(Pb(this))}while(0<this.a);return this.i.complete?this.ja-this.a:void 0===this.i.complete?0:-1};u(function(){for(var a=C(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Mb(d);B(d,c)}});function ec(a,b){var c=b+a;Qb(this,c,a,b);return c&65535}function fc(a,b){var c=b+a;Qb(this,c<<8,a<<8,b<<8);return c&255}
function gc(a,b){a=b<<1;R(this,a);return a&65535}function hc(a,b){a=b<<1;R(this,a<<8);return a&255}function ic(a,b){a=b&32768|b>>1|b<<16;R(this,a);return a&65535}function jc(a,b){a=b&2048|b>>1|b<<8;R(this,a<<8);return a&255}function kc(a,b){a=b&~a;P(this,a);return a}function lc(a,b){a=b&~a;P(this,a<<8);return a}function mc(a,b){a|=b;P(this,a);return a}function nc(a,b){a|=b;P(this,a<<8);return a}function oc(a,b){a=~b|65536;Q(this,a);return a&65535}
function pc(a,b){a=~b|256;Q(this,a<<8);return a&255}function qc(a,b){a=b-a;this.j&128||(this.m=this.h=a,this.g=b&(b^a));return a&65535}function rc(a,b){a=b-a;var c=a<<8;b<<=8;this.j&128||(this.m=this.h=c,this.g=b&(b^c));return a&255}function sc(a,b){a=b+a;this.j&128||(this.m=this.h=a,this.g=a&(b^a));return a&65535}function tc(a,b){a=b+a;var c=a<<8;this.j&128||(this.m=this.h=c,this.g=c&(b<<8^c));return a&255}function uc(a,b){a=-b;Q(this,a,a&b&32768);return a&65535}
function vc(a,b){a=-b;Q(this,a<<8,(a&b&128)<<8);return a&255}function wc(a,b){a=b<<1|this.l>>16&1;R(this,a);return a&65535}function xc(a,b){a=b<<1|this.l>>16&1;R(this,a<<8);return a&255}function yc(a,b){a=(this.l&65536|b)>>1|b<<16;R(this,a);return a&65535}function zc(a,b){a=((this.l&65536)>>8|b)>>1|b<<8;R(this,a<<8);return a&255}function Ac(a,b){var c=b-a;Rb(this,c,a,b);return c&65535}function Bc(a,b){var c=b-a;Rb(this,c<<8,a<<8,b<<8);return c&255}
function Cc(a,b){this.j&128||(this.m=this.h=b&65280,this.g=this.l=0);return(b<<8|b>>8)&65535}function Dc(a,b){a^=b;P(this,a);return a&65535}function Ec(a){var b=bc(this,a);a=a>>6&7;var c=this.f[a];c&32768&&(c|=4294901760);this.l=this.g=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.l=c<<17-b,c>>=b;else if(b)if(16<b)this.g=c,c=0;else{this.l=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.g=32768)}this.f[a]=c&65535;this.m=this.h=c;this.a-=(this.c?6:7)+b}
function Fc(a){var b=bc(this,a);a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.l=this.g=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.l=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.l=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.m=d>>16;this.h=d>>16|d;this.a-=(this.c?6:7)+b}function W(a){a&1&&(this.l=0);a&2&&(this.g=0);a&4&&(this.h=1);a&8&&(this.m=0);this.a-=5}
function Gc(a){var b=bc(this,a);if(b){a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.l=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.m=d>>16):(this.g=32768,this.h=d>>15|d,this.m=c>>16,-1===b&&65534===this.f[a]&&(this.f[a]=this.f[a|1]=1));this.a-=53}else this.h=this.m=0,this.g=32768,this.l=65536,this.a-=7}var Hc=[0,7,7,10,7,11,9,13];function Ic(a){var b=this.a;a=$b(this,a);this.f[7]=a&65535;this.a=b-Hc[this.c]}
var Jc=[0,14,14,17,14,18,16,20];function Kc(a){var b=this.a,c=$b(this,a);a=a>>6&7;Sb(this,this.f[a]);this.f[a]=this.f[7];this.f[7]=c&65535;this.a=b-Jc[this.c]}var Lc=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],Mc=[7,13,13,17,14,18,17,21];function Nc(a){var b=bc(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.j&128||(this.m=b>>16,this.h=this.m|b,this.g=0,this.l=-32768>b||32767<b?65536:0);this.a-=23}
function Oc(){this.a-=5}function X(a){a&1&&(this.l=65536);a&2&&(this.g=32768);a&4&&(this.h=0);a&8&&(this.m=32768);this.a-=5}function Pc(a){var b=(a&448)>>6;if(this.f[b]=this.f[b]-1&65535)this.f[7]=this.f[7]-((a&63)<<1)&65535,this.a+=1;this.a-=6}function Qc(a){U(this,a,0,Cc);this.a-=this.c?9:3+(7==this.b?2:0)}function Rc(a){U(this,a,S(this,a),Dc);this.a-=this.c?9:3+(7==this.b?2:0)}function Y(){K(this,8)}function Nb(a){Sc[a>>12].call(this,a)}
var Sc=[function(a){Tc[a>>8&15].call(this,a)},function(a){var b=S(this,a),c=this.a;P(this,dc(this,a,b));this.a=c-Lc[(this.I?8:0)+this.c]+(7!=this.b||this.c?0:2)},function(a){var b=S(this,a);a=bc(this,a);Rb(this,b-a,a,b);this.a-=this.c?4+(this.J&&6<=this.b?1:0):(this.I?4:3)+(7==this.b?2:0)},function(a){P(this,S(this,a)&bc(this,a));this.a-=this.c?4+(this.J&&6<=this.b?1:0):(this.I?4:3)+(7==this.b?2:0)},function(a){U(this,a,S(this,a),kc);this.a-=this.c?9+(this.J&&6<=this.b?1:0):(this.I?5:3)+(7==this.b?
2:0)},function(a){U(this,a,S(this,a),mc);this.a-=this.c?9+(this.J&&6<=this.b?1:0):(this.I?5:3)+(7==this.b?2:0)},function(a){U(this,a,S(this,a),ec);this.a-=this.c?9+(this.J&&6<=this.b?1:0):(this.I?5:3)+(7==this.b?2:0)},function(a){Uc[a>>8&15].call(this,a)},function(a){Vc[a>>8&15].call(this,a)},function(a){var b=Zb(this,a);P(this,cc(this,a,b,1)<<8);this.a-=this.c?9+(this.J&&6<=this.b?1:0):(this.I?5:3)+(7==this.b?2:0)},function(a){var b=Zb(this,a)<<8;a=ac(this,a)<<8;Rb(this,b-a,a,b);this.a-=this.c?4+
(this.J&&6<=this.b?1:0):(this.I?4:3)+(7==this.b?2:0)},function(a){P(this,(Zb(this,a)&ac(this,a))<<8);this.a-=this.c?4+(this.J&&6<=this.b?1:0):(this.I?4:3)+(7==this.b?2:0)},function(a){T(this,a,Zb(this,a),lc);this.a-=this.c?9+(this.J&&6<=this.b?1:0):(this.I?5:3)+(7==this.b?2:0)},function(a){T(this,a,Zb(this,a),nc);this.a-=this.c?9+(this.J&&6<=this.b?1:0):(this.I?5:3)+(7==this.b?2:0)},function(a){U(this,a,S(this,a),Ac);this.a-=this.c?9+(this.J&&6<=this.b?1:0):(this.I?5:3)+(7==this.b?2:0)},Y],Tc=[function(a){Wc[a>>
4&15].call(this,a)},function(a){V(this,a,!0)},function(a){V(this,a,!!(this.h&65535))},function(a){V(this,a,this.h&65535?0:4)},function(a){V(this,a,!this.ya()==!(this.g&32768))},function(a){V(this,a,!this.ya()!=!(this.g&32768))},function(a){V(this,a,!!(this.h&65535)&&!this.ya()==!(this.g&32768))},function(a){V(this,a,(this.h&65535?0:4)||!this.ya()!=!(this.g&32768))},Kc,Kc,function(a){Xc[a>>6&3].call(this,a)},function(a){Yc[a>>6&3].call(this,a)},function(a){Zc[a>>6&3].call(this,a)},function(a){$c[a>>
6&3].call(this,a)},Y,Y],Xc=[function(a){Q(this,dc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,oc);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)},function(a){U(this,a,1,qc);this.a-=this.c?9:3+(7==this.b?2:0)}],Yc=[function(a){U(this,a,0,uc);this.a-=this.c?11:6},function(a){U(this,a,O(this)?1:0,ec);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,O(this)?1:0,Ac);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=bc(this,
a);Q(this,a);this.a-=this.c?4:3+(7==this.b?2:0)}],Zc=[function(a){U(this,a,0,yc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,wc);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)},function(a){U(this,a,0,gc);this.a-=this.c?9:3+(7==this.b?2:0)}],$c=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=this.Zb(a|65536);this.f[7]=this.f[5]&65535;this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=Xb(this,a,0);Sb(this,a);P(this,a);this.a-=
11},function(a){var b=Ub(this),c=this.a;Yb(this,a,0,b);P(this,b);this.a=c-Mc[this.c]},function(a){P(this,dc(this,a,this.ya?65535:0));this.a-=this.c?9:3+(7==this.b?2:0)}],Wc=[function(a){ad[a&15].call(this,a)},Y,Y,Y,Ic,Ic,Ic,Ic,function(a){if(a&8)K(this,8);else{var b=Ub(this);a&=7;this.f[7]=this.f[a]&65535;this.f[a]=b;this.a-=9}},function(a){a&8?(this.C&49152||(this.C=this.C&-2017|(a&7)<<5,this.j|=1),this.a-=5):K(this,8)},function(a){bd[a&15].call(this,a)},function(a){cd[a&15].call(this,a)},Qc,Qc,
Qc,Qc],ad=[function(){this.C&49152?(this.s|=128,K(this,4)):M(this);this.a-=7},function(){this.j|=4;this.f[7]=this.f[7]+-2&65535;this.a-=3},function(){Tb(this);this.j|=this.C&16;this.a-=13},function(){K(this,12);this.a-=5},function(){K(this,16);this.a-=25},function(){this.C&49152||(Ob(this),this.u.reset());this.a-=667},function(){Tb(this);this.a-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],bd=[Oc,function(){this.l=0;this.a-=5},function(){this.g=0;this.a-=5},W,function(){this.h=1;this.a-=5},W,W,W,function(){this.m=0;this.a-=
5},W,W,W,W,W,W,W],cd=[Oc,function(){this.l=65536;this.a-=5},function(){this.g=32768;this.a-=5},X,function(){this.h=0;this.a-=5},X,X,X,function(){this.m=32768;this.a-=5},X,X,X,X,X,X,X],Uc=[Nc,Nc,Gc,Gc,Ec,Ec,Fc,Fc,Rc,Rc,Y,Y,Y,Y,Pc,Pc],Vc=[function(a){V(this,a,!this.ya())},function(a){V(this,a,this.ya())},function(a){V(this,a,!O(this)&&!!(this.h&65535))},function(a){V(this,a,O(this)||(this.h&65535?0:4))},function(a){V(this,a,!(this.g&32768))},function(a){V(this,a,this.g&32768?2:0)},function(a){V(this,
a,!O(this))},function(a){V(this,a,O(this))},function(){K(this,24);this.a-=25},function(){K(this,28);this.a-=5},function(a){dd[a>>6&3].call(this,a)},function(a){ed[a>>6&3].call(this,a)},function(a){fd[a>>6&3].call(this,a)},function(a){gd[a>>6&3].call(this,a)},Y,Y],dd=[function(a){Q(this,cc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,pc);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)},function(a){T(this,a,1,rc);this.a-=this.c?
9:3+(7==this.b?2:0)}],ed=[function(a){T(this,a,0,vc);this.a-=this.c?11:6},function(a){T(this,a,O(this)?1:0,fc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,O(this)?1:0,Bc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=ac(this,a);Q(this,a<<8);this.a-=this.c?4:3+(7==this.b?2:0)}],fd=[function(a){T(this,a,0,zc);this.a-=this.c?9+(this.Db&1):3+(7==this.b?2:0)},function(a){T(this,a,0,xc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,jc);this.a-=this.c?9+(this.Db&1):3+(7==this.b?
2:0)},function(a){T(this,a,0,hc);this.a-=this.c?9:3+(7==this.b?2:0)}],gd=[Y,function(a){a=Xb(this,a,65536);Sb(this,a);P(this,a);this.a-=11},function(a){var b=Ub(this),c=this.a;Yb(this,a,65536,b);P(this,b);this.a=c-Mc[this.c]},Y];
function hd(a){v.call(this,"ROM",a,hd);this.b=null;this.m=a.addr;this.c=a.size;this.o=a.writable;this.g=a.alias;this.h=a.file;this.B=ba(this.h);if(this.h){a=this.h;var b=ca(this.B);"json"!=b&&"hex"!=b&&(a=ea()+"/api/v1/dump?file="+this.h+"&format=bytes&decimal=true");var c=this;p(a,null,!0,function(a,b,f){id(c,a,b,f)})}}x(hd);hd.prototype.za=function(a,b,c,d){this.u=b;this.a=c;this.L=d;jd(this)};hd.prototype.pa=function(){this.l&&(this.L&&this.L.a(this.id,this.m,this.c,this.l),delete this.l);return!0};
hd.prototype.oa=function(){return!0};
function id(a,b,c,d){if(d)a.P("Unable to load system ROM (error "+d+": "+b+")");else{Fa(a.Eb,b,c);var e;if("["==c.charAt(0)||"{"==c.charAt(0))try{var f,g,l=eval("("+c+")");if(f=l.bytes)a.b=f;else if(f=l.words)for(a.b=Array(2*f.length),g=e=0;e<f.length;e++)a.b[g++]=f[e]&255,a.b[g++]=f[e]>>8&255;else if(f=l.data)for(a.b=Array(4*f.length),g=e=0;e<f.length;e++)a.b[g++]=f[e]&255,a.b[g++]=f[e]>>8&255,a.b[g++]=f[e]>>16&255,a.b[g++]=f[e]>>24&255;else a.b=l;a.l=l.symbols;if(!a.b.length){q("Empty ROM: "+b);
return}if(1==a.b.length){q(a.b[0]);return}}catch(m){a.P("ROM data error: "+m.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),e=0;e<b.length;e++)a.b[e]=aa(b[e]);jd(a)}}
function jd(a){if(!Ia(a))if(!a.h)D(a);else if(a.b&&a.u){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.i.error=!0;a.P(b)}else{b=a.m;if(Sa(a.u,b,a.c,a.o?1:rb)){var c;for(c=0;c<a.b.length;c++){var d=a.u,e=b+c;d.b[(e&d.u)>>>d.c].gc(e&d.h,a.b[c]&255,e)}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++){for(var f=a,d=b[c],e=f.u,g=f.c,l=[],m=f.m>>>e.c;0<g&&
m<e.b.length;)l.push(e.b[m++]),g-=e.g;e=f.u;f=f.c;g=0;for(d>>>=e.c;0<f&&d<e.b.length;){m=l[g++];if(!m)break;e.b[d++]=m;f-=e.g}}delete a.b}}D(a)}}u(function(){for(var a=C(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new hd(d);B(d,c)}});function kd(a){v.call(this,"RAM",a,kd);this.g=a.addr;this.c=a.size;this.b=!1}x(kd);h=kd.prototype;h.za=function(a,b,c,d){this.u=b;this.a=c;this.L=d;D(this)};h.pa=function(a,b){b||this.reset();return!0};h.oa=function(a){return a?this.save():!0};
h.reset=function(){!this.b&&this.c&&Sa(this.u,this.g,this.c,1)&&(this.b=!0);this.b||q("No RAM allocated")};h.save=function(){return null};h.restore=function(){return!0};u(function(){for(var a=C(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new kd(d);B(d,c)}});function ld(a){v.call(this,"Keyboard",a,ld);D(this)}x(ld);ld.prototype.Z=function(){return!1};ld.prototype.za=function(a,b,c,d){this.B=a;this.a=c;this.L=d;this.Ha=null};
u(function(){for(var a=C(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new ld(d);B(d,c)}});function Z(a){this.g=this.l=null;this.N=a.tabSize;this.H=a.charBOL;this.m=0;v.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.l="";else{var c;a=md;b&&(void 0===c&&(c="Panel"),(c=Ha(c,this.id))&&(b=c.A[b])&&this.Z(null,a,b))}this.o=this.w=null;this.exports={connect:this.Sb,receiveData:this.Jb}}x(Z);var md="buffer";h=Z.prototype;
h.Z=function(a,b,c){var d=this;switch(b){case md:return this.A[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.Jb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Jb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.za=function(a,b,c,d){this.B=a;this.u=b;this.a=c;this.L=d;var e=this;this.O=ab(this.a,function(){e.b&128||!e.h.length||(e.J=e.h.shift(),e.b|=128,e.b&64&&G(e.a,40,4,48))});this.I=function(){e.c|=128;return!!(e.c&64)};Ya(b,this,nd);D(this)};
h.Sb=function(){if(!this.o){var a=Cb(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ha(b[0]);if(c!=this.jb)return;b=ha(b[1]);if(this.o=Ga(b)){var d=this.o.exports;if(d){var e=d.connect;e&&e.call(this.o);if(this.w=d.receiveData){this.status(this.Eb+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.pa=function(a,b){if(!b)if(this.Sb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.oa=function(a){return a?this.save():!0};h.reset=function(){od(this)};h.save=function(){var a=new N(this);a.set(0,[]);return a.data()};h.restore=function(){return od(this)};function od(a){a.J=0;a.b=0;a.c=128;a.h=[];return!0}h.Jb=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);bb(this.a,this.O,50);return!0};h.Ac=function(){return this.b&65535};h.ed=function(a){this.b=this.b&-112|a&111};
h.zc=function(){this.b&=-129;0<this.h.length&&bb(this.a,this.O,50);return this.J};h.dd=function(){};h.Lc=function(){return this.c};h.rd=function(a){128==(this.c&192)&&a&64&&G(this.a,8,4,52,this.I);this.c=this.c&-70|a&69};h.Kc=function(){return 0};
h.qd=function(a){if(a&=255){this.w&&this.w.call(this.o,a);if(this.g)if(13==a)this.m=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.m&&this.m--;else{var b;b=(b=ia[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.N||8,c=a-this.m%a,this.N&&(b=" ".slice(0,c)));this.H&&!this.m&&c&&(b=String.fromCharCode(this.H)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.m+=c}else if(null!=this.l){if(10==a||1024<=this.l.length)this.U(this.l),
this.l="";10!=a&&(this.l+=String.fromCharCode(a))}this.c&=-129;G(this.a,100,4,52,this.I)}};var pd={},nd=(pd[65392]=[null,null,Z.prototype.Ac,Z.prototype.ed,"RCSR"],pd[65394]=[null,null,Z.prototype.zc,Z.prototype.dd,"RBUF"],pd[65396]=[null,null,Z.prototype.Lc,Z.prototype.rd,"XCSR"],pd[65398]=[null,null,Z.prototype.Kc,Z.prototype.qd,"XBUF"],pd);u(function(){for(var a=C(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Z(d);B(d,c)}});
function qd(a,b,c){v.call(this,"Computer",a,qd);this.i.R=!1;rd(this,b);this.H=Cb(this,"autoPower",a);this.g=0;this.W=a.busWidth||a.buswidth;this.b=sd;this.B=null;this.m=this.N=!1;this.url=Cb(this,"url")||"";(Math.random()+.1).toString(36);this.c=td(this);if(this.a=Ha("CPU",this.id)){this.L=Ha("Debugger",this.id);this.u=new Ma({id:this.Eb+".bus",busWidth:this.W},this.a,this.L);var d,e=y(this.id);if((this.h=Ha("Panel",this.id))&&this.h.Bb)for(b=0;b<e.length;b++)d=e[b],d.P=this.h.P,d.U=this.h.U,d.Bb=
this.h.Bb;this.U("PDPjs v1.30.1\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.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.za&&d.za(this,this.u,this.a,this.L);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.o=d:this.b=parseInt(d,10));var f;if(a=Cb(this,"state")||(f=!0,a.state))b=this.I=a,f||(this.m=!0,this.b=sd),this.b&&(this.w=new N(this,
"1.30.1"),ud(this.w)?b=null:delete this.w);!b&&this.b&&(b=vd(this))&&(this.m=!0);if(b){var g=this;p(b,null,!0,function(a,b,c){c?(g.o=null,g.m=!1,g.P("Unable to load machine state from server (error "+c+(b?": "+ha(b):"")+")")):(g.B=b,g.N=!0);D(g)})}else D(this);this.A.power||(this.H=!0);!c&&this.H&&wd(this,this.cb)}else q("Unable to find CPU component")}x(qd);var sd=0;
function rd(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.O=b}function Cb(a,b,c){var d=b.toLowerCase(),d=za[b]||za[d];void 0===d&&a.O&&(d=a.O[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function wd(a,b,c){for(var d=y(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ia(f)){Ia(f,function(){wd(a,b,c)});return}}b.call(a,c)}
function xd(a,b){var c=new N(a,"1.30.1","validate");if(ud(c)&&yd(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.P("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=qd.prototype;
h.cb=function(a){void 0===a&&(a=this.b||(this.B?1:sd));if(!this.g){this.g++;var b=!1,c=!1;this.J=!1;var d=this.w||new N(this,"1.30.1");if(-1==a)b=!0;else if(a>sd){if(ud(d,this.B)){this.l=new N(this,"1.30.1","failsafe");ud(this.l)&&(zd(this,d),a=2,Ad(this.l));this.l.set("timestamp",ka());Bd(this.l);var e=this.b&&!this.m;if(1==a||la("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=yd(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?ud(d,g):("error"==
f&&"no machine state"!=g?(this.P("Error: "+g),"unable to verify user"==g&&(pa("user",""),this.c=null)):this.U(f+": "+g),Ad(d),ud(d)?(c=yd(d),e=!0):c=!1))}e&&xd(this,c?d:null)}else 2==a&&d.clear()}else xd(this);delete this.B;delete this.w}e=y(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=Cd(this,g,d,b,c));b=[d,a,c];-1!=a?wd(this,this.Ob,b):this.Ob(b)}};
function Cd(a,b,c,d,e){if(!b.i.R){b.i.R=!0;if(b.pa){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.pa(f,d)&&f&&(q("Unable to restore state for "+b.type),a.I&&!a.N?(c.clear(),a.b=sd,window&&window.location.reload()):a.J=!0,b.pa(null),e=!1)}if(!d&&b.Rb)for(a=b.Rb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Ob=function(a){var b=a[0],c=0>a[1];a=a[2];this.$=!0;this.i.R=!0;var d=this.A.power;d&&(d.textContent="Shutdown");this.a&&(Cd(this,this.a,b,c,a),this.a.$a());this.J&&(zd(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.g=0};
function zd(a,b){if(la("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.1"};d.url=a.url;d.user=c;d.type="bug";d.data=b;p("http://www.pcjs.org/api/v1/report",d,!0)}}
function Dd(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new N(a,"1.30.1"),g=new N(a,"1.30.1","validate"),l=ka();g.set("timestamp",l);f.set("timestamp",l);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.oa&&(c&&M(a.a),d=a.a.oa(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.i.R=!1,!1===d&&(e=null)));for(var l=y(a.id),m=0;m<l.length;m++){var n=l[m];n.i.R&&(n.oa&&(d=n.oa(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.i.R=!1,!1===d&&(e=null)))}e&&(c?(l=d=!1,b?(a.c&&Ed(a,a.c,f.toString()),Bd(g)&&Bd(f)||(e=null,d=l=!0)):a.b&&(d=!0,l=3==a.b),d&&f.clear(l)):e=f.toString());c&&(a.i.R=!1,b=a.A.power)&&(b.textContent="Power");a.g=0;return e}h.reset=function(){this.u&&this.u.reset&&this.u.reset();for(var a=y(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.u&&c.reset&&c.reset()}};h.start=function(a,b){for(var c=y(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};
h.stop=function(a,b){for(var c=y(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
h.Z=function(a,b,c){var d=this;switch(b){case "power":return this.A[b]=c,c.onclick=function(){d.g||(d.i.R?Dd(d,!1,!0):wd(d,d.cb))},!0;case "reset":return this.A[b]=c,c.onclick=function(){if(d.i.R&&!d.g)if(d.b&&!d.o){var a=la("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Dd(d,a,!0);!a&&d.I?window&&window.location.reload():d.cb(sd)}else d.reset(),d.a&&d.a.$a()},!0;case "save":if(da())c.parentNode.removeChild(c);else return this.A[b]=
c,c.onclick=function(){var a=td(d,!0);if(a){var b=!!(d.b&&!d.o||d.I),c=Dd(d,b);b?Ed(d,a,c):d.P("Resume disabled, machine state not saved")}},!0}return!1};
function td(a,b){var c=a.c;c||((c=oa("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=Fd(a,c))||a.P("The user ID is invalid.")):b&&a.P("Browser local storage is not available"));return c}
function Fd(a,b){a.c=null;b=p(ea()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(pa("user",b.data),a.c=b.data)}catch(d){q(d.message+" ("+c+")")}return a.c}function vd(a){var b=null;a.c&&(b=ea()+"/api/v1/user?req=load&user="+a.c+"&state="+Gd(a,"1.30.1"));return b}
function Ed(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Gd(a,"1.30.1");d.data=c;b=p(ea()+"/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.P("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.P(c),pa("user",""),a.c=null)}}
h.Ta=function(a){this.a&&this.a.Ta(a);this.h&&this.h.Ta(a)};u(function(){for(var a=C(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=C(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new qd(g,d,!0);B(g,f);g.H&&wd(g,g.cb)}});r.show.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=Ha("Computer",c.id))&&c.$&&!c.i.R&&c.cb(-1)}});
r.exit.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=Ha("Computer",c.id))&&c.i.R&&Dd(c,!(!c.b||c.o),!0)}});function N(a,b,c){this.id=a.id;this.key=Gd(a,b,c);this.L=a.L;Ad(this,a.qc)}function Gd(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}
N.prototype={constructor:N,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){Ad(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 Ad(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function Bd(a){var b=!0;if(na()){var c=JSON.stringify(a[a.id]);pa(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function yd(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function ud(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:na()&&(b=oa(a.key))?(a[a.id]=b,a.a=!0):!1}var Hd=0;
function Id(a,b,c,d,e,f){e("Loading "+a+"...");p(a,null,!0,function(g,l,m){m?(l||(l="unable to load "+a+" ("+m+")"),f(l,null)):Jd(l,a,b,c,d,e,f)})}
function Jd(a,b,c,d,e,f,g){function l(a,f){if(f)g(f,null);else{c&&(Fa(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?Kd(a,f,l):l(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Kd(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");p(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],n,t=/( [a-z]+=)(['"])(.*?)\2/g;n=t.exec(f);)m=0>m.indexOf(n[1])?m.replace(">",n[0]+">"):m.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[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);Kd(a,b,c)}})}else c(a,null)}
function Ld(a,b,c,d){function e(a){if(void 0===l){var b=g&&C(g,"machine-warning");l=b&&b[0]||g}l&&(l.innerHTML=ga(a))}function f(a){e("Error: "+a);m&&(--Hd||wa(!0));m=!1}var g,l,m=!0;Hd++;Ea[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var t=document.head||document.getElementsByTagName("head")[0],z=document.createElement("style");z.type="text/css";z.styleSheet?z.styleSheet.cssText=n:z.appendChild(document.createTextNode(n));t.appendChild(z)}c||
(c="/versions/pdp11/1.30.1/components.xsl");n=function(d,l){l?Id(c,null,null,!1,e,function(d,m){m?(Fa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=l.transformNode(m))?(g.outerHTML=m,--Hd||wa(!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),--Hd||wa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Id(b,a,d,!0,e,n):Jd(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(H){f(H.message)}return m}window.embedPDP11=function(a,b,c,d){wa(!1);return Ld(a,b,c,d)};window.enableEvents=wa;window.sendEvent=xa;})();
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 Ja="undefined"!==typeof ArrayBuffer;function Ka(a){v.call(this,"Panel",a,Ka)}x(Ka);g=Ka.prototype;
g.R=function(a,b,c,d){return this.A&&this.A.R(a,b,c,d)||this.b&&this.b.R(a,b,c,d)?!0:this.parent.R.call(this,a,b,c,d)};g.oa=function(a,b,c,d){this.A=a;this.o=b;this.b=c;this.I=d};g.ha=function(a,b){b||La();return!0};g.ga=function(){return!0};g.wa=function(){};function La(){for(var a=!1,b=C(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=Ha(e.id);f||(a=!0,f=new Ka(e));B(f,d);a&&D(f)}}u(La);
function Ma(a,b,c){v.call(this,"Bus",a,Ma);this.b=b;this.I=c;this.u=a.busWidth||16;this.l=Math.pow(2,this.u);this.h=this.l-1|0;this.c=(this.u>>1)+2;10>this.c&&(this.c=10);15<this.c&&(this.c=15);this.g=1<<this.c;this.A=this.g>>2;this.o=this.g-1;this.s=this.l/this.g|0;this.la=[];this.m=[];a=new E(this.b);Na(a,this.I);this.a=Array(this.s);for(b=0;b<this.s;b++)this.a[b]=a;this.Ba=Array(4);this.Ba[0]=Oa;this.Ba[1]=Pa;this.Ba[2]=Qa;this.Ba[3]=Ra;Sa(this,this.l-8192,8192,Ta,this);Sa(this,57344,8192,Ta,this);
D(this)}x(Ma);function Oa(a,b){var c=-1,d=this.controller,e=d.la[a];e?e[0]?c=e[0](b)&255:e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.la[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return c;F(d.b,4)}function Pa(a,b,c){var d=!1,e=this.controller,f=e.la[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](c):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.la[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](c):0,f[3](a&255|b<<8,c),d=!0);d||F(e.b,4)}
function Qa(a,b){var c=-1,d=this.controller;(a=d.la[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return c;F(d.b,4)}function Ra(a,b,c){var d=!1,e=this.controller;if(a=e.la[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||F(e.b,4)}Ma.prototype.reset=function(){for(var a=0;a<this.m.length;a++)this.m[a]()};Ma.prototype.ha=function(a,b){b||this.reset();return!0};
function Sa(a,b,c,d,e){for(var f=b,k=c,m=f>>>a.c;0<k&&m<a.a.length;){var n=a.a[m],q=m*a.g,t=a.g-(f-q);t>k&&(t=k);if(n&&n.size){if(n.type==d&&n.controller==e){if(f+k<=n.Aa)return n.Qa+=n.Aa-f,n.Aa=f,!0;if(f>=n.Aa+n.Qa){t=n.size-(f-q);t>k&&(t=k);n.Qa=f-n.Aa+t;f=q+a.g;k-=t;m++;continue}}return Ua(1,f,k)}f=new E(a.b,f,t,a.g,d,e);Na(f,a.I,n);a.a[m++]=f;f=q+a.g;k-=t}return 0>=k?(a.status(Math.floor(c/1024)+"Kb "+Va[d]+" at "+h(b,8,!0)),!0):Ua(2,b,c)}
function Wa(a,b){return a.a[(b&a.h)>>>a.c].$a(b&a.o,b)}function Xa(a,b){return a.a[(b&a.h)>>>a.c].nc(b&a.o,b)}function Ya(a,b,c){a.a[(b&a.h)>>>a.c].Sc(b&a.o,c&65535,b)}function Za(a){for(var b=0,c=[],d=0;d<a.s;d++){var e=a.a[d];if(e.ma||e.Ib){c[b++]=d;var f=b++;if(e=e.save()){for(var k=0,m=0,n=[];k<e.length;){for(var q=e[k],t=k+1;t<e.length&&e[t]===q;)t++;n[m++]=t-k;n[m++]=q;k=t}n.length<e.length&&(e=n)}c[f]=e}}return c}
function $a(a,b,c){for(var d in c){var e=c[d];if(!(e[5]&&e[5]>a.b.Mb))for(var f=e[0]?e[0].bind(b):null,k=e[1]?e[1].bind(b):null,m=e[2]?e[2].bind(b):null,n=e[3]?e[3].bind(b):null,q=a,t=+d,e=e[4],J=+d;J<=t;J+=2){var Ba=J&8191;void 0!==q.la[Ba]?p("I/O address already registered: "+h(J,8,!0)):q.la[Ba]=[f,k,m,n,e||"unknown",!1]}}}function ab(a,b){a.m.push(b)}function Ua(a,b,c){p("Memory block error ("+a+": "+h(b)+","+h(c)+")");return!1}
function G(a){v.call(this,"Device",a,G);this.c={data:0,Xc:0,Pa:20,ad:0};this.a={$c:0,eb:-1}}x(G);g=G.prototype;g.oa=function(a,b,c,d){this.o=b;this.b=c;this.I=d;var e=this;this.a.eb=bb(this.b,function(){e.a.pa|=128;e.a.pa&64&&(cb(e.b,0,6,64),db(e.b,e.a.eb,1E3/60))});$a(b,this,H);ab(b,this.reset.bind(this));D(this)};g.Ub=function(){var a=this.a.pa;this.a.pa&=-129;return a};g.Ac=function(a){this.a.pa=a;a&64&&db(this.b,this.a.eb,1E3/60);this.a.pa=a&-129};
g.Wb=function(){var a=this.b;return a.D&62337|a.Ga<<5|a.Ha<<1};g.Cc=function(a){var b=this.b;b.D=a&=62337;b.Ga=a>>5&3;b.Ha=a>>1&15;b.Za=a&257?a&1?6:4:0;eb(b);fb(this)};g.Xb=function(){var a=this.b.qa;a&65280&&(a=(a<<8|a>>8)&65535);return a};g.Yb=function(){return this.b.bb};g.Zb=function(){return this.b.ua};g.Dc=function(a){var b=this.b;b.ua=a;b.ua&16?(b.Xa=4194303,b.Ia=3915776):(b.Xa=262143,b.Ia=253952);fb(this)};function fb(a){a.c.Pa=a.c.Pa&-8|(a.b.Za?a.b.ua&16?1:2:4)}
g.gc=function(a){return this.b.C[1][a>>1&7]};g.Lc=function(a,b){this.b.C[1][b>>1&7]=a&65295};g.ec=function(a){return this.b.C[1][(a>>1&7)+8]};g.Jc=function(a,b){this.b.C[1][(b>>1&7)+8]=a&65295};g.fc=function(a){return this.b.P[1][a>>1&7]};g.Kc=function(a,b){b=b>>1&7;this.b.P[1][b]=a;this.b.C[1][b]&=65295};g.dc=function(a){return this.b.P[1][(a>>1&7)+8]};g.Ic=function(a,b){b=(b>>1&7)+8;this.b.P[1][b]=a;this.b.C[1][b]&=65295};g.Tb=function(a){return this.b.C[0][a>>1&7]};
g.zc=function(a,b){this.b.C[0][b>>1&7]=a&65295};g.Rb=function(a){return this.b.C[0][(a>>1&7)+8]};g.xc=function(a,b){this.b.C[0][(b>>1&7)+8]=a&65295};g.Sb=function(a){return this.b.P[0][a>>1&7]};g.yc=function(a,b){b=b>>1&7;this.b.P[0][b]=a;this.b.C[0][b]&=65295};g.Qb=function(a){return this.b.P[0][(a>>1&7)+8]};g.wc=function(a,b){b=(b>>1&7)+8;this.b.P[0][b]=a;this.b.C[0][b]&=65295};g.mc=function(a){return this.b.C[3][a>>1&7]};g.Rc=function(a,b){this.b.C[3][b>>1&7]=a&65295};
g.kc=function(a){return this.b.C[3][(a>>1&7)+8]};g.Pc=function(a,b){this.b.C[3][(b>>1&7)+8]=a&65295};g.lc=function(a){return this.b.P[3][a>>1&7]};g.Qc=function(a,b){b=b>>1&7;this.b.P[3][b]=a;this.b.C[3][b]&=65295};g.jc=function(a){return this.b.P[3][(a>>1&7)+8]};g.Oc=function(a,b){b=(b>>1&7)+8;this.b.P[3][b]=a;this.b.C[3][b]&=65295};g.T=function(a){a&=7;return this.b.v&2048?this.b.va[a]:this.b.f[a]};g.W=function(a,b){b&=7;this.b.v&2048?this.b.va[b]=a:this.b.f[b]=a};
g.qb=function(){return this.b.v&49152?this.b.Z[0]:this.b.f[6]};g.Cb=function(a){this.b.v&49152?this.b.Z[0]=a:this.b.f[6]=a};g.tb=function(){return this.b.f[7]};g.Fb=function(a){this.b.f[7]=a};g.U=function(a){a&=7;return this.b.v&2048?this.b.f[a]:this.b.va[a]};g.X=function(a,b){b&=7;this.b.v&2048?this.b.f[b]=a:this.b.va[b]=a};g.rb=function(){return 1==(this.b.v&49152)>>14?this.b.f[6]:this.b.Z[1]};g.Db=function(a){1==(this.b.v&49152)>>14?this.b.f[6]=a:this.b.Z[1]=a};
g.sb=function(){return 3==(this.b.v&49152)>>14?this.b.f[6]:this.b.Z[3]};g.Eb=function(a){3==(this.b.v&49152)>>14?this.b.f[6]=a:this.b.Z[3]=a};g.Pb=function(a){return this.b.xb[a-65504>>1]};g.vc=function(a,b){this.b.xb[b-65504>>1]=a};g.ub=function(a){return 65520==a?61183:0};g.Gb=function(){};g.ic=function(){return 1};g.Nc=function(){};g.Ob=function(){return this.b.F};g.uc=function(){this.b.F=0};g.Vb=function(){return this.b.wb};g.Bc=function(a,b){b&1||(a&=255);this.b.wb=a};g.$b=function(){return this.b.cb};
g.Ec=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.cb=a;b.j|=2};g.hc=function(){return this.b.ra&65280};g.Mc=function(a){this.b.ra=a|255};g.ac=function(){return gb(this.b)};g.Fc=function(a){hb(this.b,a&-1809|gb(this.b)&1808);this.b.j|=128};g.reset=function(){this.c.Pa=this.c.Pa&-120|20;this.a.pa=0};
var I={},H=(I[62592]=[null,null,G.prototype.gc,G.prototype.Lc,"SISDR"],I[62608]=[null,null,G.prototype.ec,G.prototype.Jc,"SDSDR"],I[62624]=[null,null,G.prototype.fc,G.prototype.Kc,"SISAR"],I[62640]=[null,null,G.prototype.dc,G.prototype.Ic,"SDSAR"],I[62656]=[null,null,G.prototype.Tb,G.prototype.zc,"KISDR"],I[62672]=[null,null,G.prototype.Rb,G.prototype.xc,"KDSDR"],I[62688]=[null,null,G.prototype.Sb,G.prototype.yc,"KISAR"],I[62704]=[null,null,G.prototype.Qb,G.prototype.wc,"KDSAR"],I[62798]=[null,null,
G.prototype.Zb,G.prototype.Dc,"MMR3"],I[65382]=[null,null,G.prototype.Ub,G.prototype.Ac,"LKS"],I[65402]=[null,null,G.prototype.Wb,G.prototype.Cc,"MMR0"],I[65404]=[null,null,G.prototype.Xb,null,"MMR1"],I[65406]=[null,null,G.prototype.Yb,null,"MMR2"],I[65408]=[null,null,G.prototype.mc,G.prototype.Rc,"UISDR"],I[65424]=[null,null,G.prototype.kc,G.prototype.Pc,"UDSDR"],I[65440]=[null,null,G.prototype.lc,G.prototype.Qc,"UISAR"],I[65456]=[null,null,G.prototype.jc,G.prototype.Oc,"UDSAR"],I[65472]=[G.prototype.T,
G.prototype.W,G.prototype.T,G.prototype.W,"R0SET0"],I[65473]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R1SET0"],I[65474]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R2SET0"],I[65475]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R3SET0"],I[65476]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R4SET0"],I[65477]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R5SET0"],I[65478]=[G.prototype.qb,G.prototype.Cb,G.prototype.qb,G.prototype.Cb,
"R6KERNEL"],I[65479]=[G.prototype.tb,G.prototype.Fb,G.prototype.tb,G.prototype.Fb,"R7KERNEL"],I[65480]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R0SET1"],I[65481]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R1SET1"],I[65482]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R2SET1"],I[65483]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R3SET1"],I[65484]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R4SET1"],I[65485]=[G.prototype.U,G.prototype.X,
G.prototype.U,G.prototype.X,"R5SET1"],I[65486]=[G.prototype.rb,G.prototype.Db,G.prototype.rb,G.prototype.Db,"R6SUPER"],I[65487]=[G.prototype.sb,G.prototype.Eb,G.prototype.sb,G.prototype.Eb,"R6USER"],I[65504]=[null,null,G.prototype.Pb,G.prototype.vc,"CTRL",1170],I[65520]=[null,null,G.prototype.ub,G.prototype.Gb,"LSIZE",1170],I[65522]=[null,null,G.prototype.ub,G.prototype.Gb,"HSIZE",1170],I[65524]=[null,null,G.prototype.ic,G.prototype.Nc,"SYSID",1170],I[65526]=[null,null,G.prototype.Ob,G.prototype.uc,
"CPUERR",1170],I[65528]=[null,null,G.prototype.Vb,G.prototype.Bc,"MB",1170],I[65530]=[null,null,G.prototype.$b,G.prototype.Ec,"PIR"],I[65532]=[null,null,G.prototype.hc,G.prototype.Mc,"SL"],I[65534]=[null,null,G.prototype.ac,G.prototype.Fc,"PSW"],I);H[62594]=H[62592];H[62596]=H[62592];H[62598]=H[62592];H[62600]=H[62592];H[62602]=H[62592];H[62604]=H[62592];H[62606]=H[62592];H[62610]=H[62608];H[62612]=H[62608];H[62614]=H[62608];H[62616]=H[62608];H[62618]=H[62608];H[62620]=H[62608];H[62622]=H[62608];
H[62626]=H[62624];H[62628]=H[62624];H[62630]=H[62624];H[62632]=H[62624];H[62634]=H[62624];H[62636]=H[62624];H[62638]=H[62624];H[62642]=H[62640];H[62644]=H[62640];H[62646]=H[62640];H[62648]=H[62640];H[62650]=H[62640];H[62652]=H[62640];H[62654]=H[62640];H[62658]=H[62656];H[62660]=H[62656];H[62662]=H[62656];H[62664]=H[62656];H[62666]=H[62656];H[62668]=H[62656];H[62670]=H[62656];H[62674]=H[62672];H[62676]=H[62672];H[62678]=H[62672];H[62680]=H[62672];H[62682]=H[62672];H[62684]=H[62672];H[62686]=H[62672];
H[62690]=H[62688];H[62692]=H[62688];H[62694]=H[62688];H[62696]=H[62688];H[62698]=H[62688];H[62700]=H[62688];H[62702]=H[62688];H[62706]=H[62704];H[62708]=H[62704];H[62710]=H[62704];H[62712]=H[62704];H[62714]=H[62704];H[62716]=H[62704];H[62718]=H[62704];H[65410]=H[65408];H[65412]=H[65408];H[65414]=H[65408];H[65416]=H[65408];H[65418]=H[65408];H[65420]=H[65408];H[65422]=H[65408];H[65426]=H[65424];H[65428]=H[65424];H[65430]=H[65424];H[65432]=H[65424];H[65434]=H[65424];H[65436]=H[65424];H[65438]=H[65424];
H[65442]=H[65440];H[65444]=H[65440];H[65446]=H[65440];H[65448]=H[65440];H[65450]=H[65440];H[65452]=H[65440];H[65454]=H[65440];H[65458]=H[65456];H[65460]=H[65456];H[65462]=H[65456];H[65464]=H[65456];H[65466]=H[65456];H[65468]=H[65456];H[65470]=H[65456];H[65506]=H[65504];H[65508]=H[65504];H[65510]=H[65504];H[65512]=H[65504];H[65514]=H[65504];H[65516]=H[65504];H[65518]=H[65504];
u(function(){for(var a=C(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=A(c);switch(d.name){case "default":d=new G(d),B(d,c)}}});var ib;if(Ja){var jb=new ArrayBuffer(2);(new DataView(jb)).setUint16(0,256,!0);ib=256===(new Uint16Array(jb))[0]}else ib=!1;var kb=ib;
function E(a,b,c,d,e,f){this.b=a;this.id=lb+=2;this.a=null;this.Aa=b;this.Qa=c;this.size=d||0;this.type=e||mb;this.h=e==nb;this.controller=null;Na(this);this.ma=this.Ib=!1;if(d)if(f)this.controller=f,this.a=null,ob(this,f.Ba);else if(Ja)this.g=new ArrayBuffer(d),this.o=new DataView(this.g,0,d),this.c=new Uint8Array(this.g,0,d),this.m=new Uint16Array(this.g,0,d>>1),this.a=new Int32Array(this.g,0,d>>2),ob(this,kb?pb:qb);else{this.a=Array(d>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;ob(this,rb)}else ob(this)}
var mb=0,nb=2,Ta=4,Va=["NONE","RAM","ROM","VID","H/W"],lb=0;
E.prototype={constructor:E,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ja)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.o.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(Ja)for(b=0;b<a.length;b++)this.o.setInt32(b<<2,a[b],!0);else this.a=a;return this.ma=!0}return!1},s:function(){return 255},A:function(){},u:function(a,b){return this.$a(a++,b++)|this.$a(a,b)<<8},B:function(a,b,c){this.Ra(a++,
b&255,c++);this.Ra(a,b>>8,c)},N:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},aa:function(a){a&1&&F(this.b,4);var 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},ea:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.ma=!0},ta:function(a,b){a&1&&F(this.b,4);var 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.ma=!0},G:function(a,b){return this.H(a,
b)},S:function(a,b){return this.Y(a,b)},ca:function(a,b,c){this.h||this.Bb(a,b,c)},ja:function(a,b,c){this.h||this.ka(a,b,c)},D:function(a){return this.c[a]},J:function(a){return this.c[a]},O:function(a){a&1&&F(this.b,4);return this.o.getUint16(a,!0)},$:function(a){a&1&&F(this.b,4);return a&1?this.c[a]|this.c[a+1]<<8:this.m[a>>1]},ba:function(a,b){this.c[a]=b;this.ma=!0},da:function(a,b){this.c[a]=b;this.ma=!0},ia:function(a,b){a&1&&F(this.b,4);this.o.setUint16(a,b,!0);this.ma=!0},sa:function(a,b){a&
1&&F(this.b,4);a&1?(this.c[a]=b,this.c[a+1]=b>>8):this.m[a>>1]=b;this.ma=!0}};function Na(a,b,c){a.I=b;a.w=a.l=0;c&&((a.w=c.w)&&sb(a,tb,!1),(a.l=c.l)&&ub(a,tb,!1))}function ub(a,b,c){c&&a.l||(a.Ra=!a.h&&b[1]||a.A,a.Sc=!a.h&&b[3]||a.B);if(c||void 0===c)a.Bb=b[1]||a.A,a.ka=b[3]||a.B}function sb(a,b,c){c&&a.w||(a.$a=b[0]||a.s,a.nc=b[2]||a.u);if(c||void 0===c)a.H=b[0]||a.s,a.Y=b[2]||a.u}function ob(a,b){b||(b=vb);sb(a,b,void 0);ub(a,b,void 0)}
var vb=[],rb=[E.prototype.N,E.prototype.ea,E.prototype.aa,E.prototype.ta],tb=[E.prototype.G,E.prototype.ca,E.prototype.S,E.prototype.ja];if(Ja)var qb=[E.prototype.D,E.prototype.ba,E.prototype.O,E.prototype.ia],pb=[E.prototype.J,E.prototype.da,E.prototype.$,E.prototype.sa];
function wb(a,b){v.call(this,"CPU",a,wb);var c=a.multiplier||1;this.La=a.cycles||b;this.da=c;this.Wa=Math.round(this.La/1E4)/100;this.ia=this.Wa*this.da;this.i.V=!1;this.i.yb=!1;this.i.Ca=a.autoStart;this.i.fb=!1;this.i.Ma=!1;this.Ja=this.ja=0;this.Ka=a.csStart;this.ta=a.csInterval;this.xa=a.csStop;this.J=[];this.nb=this.rc.bind(this);D(this)}x(wb);var xb=["power","reset"];g=wb.prototype;
g.oa=function(a,b,c,d){this.A=a;this.o=b;this.I=d;for(b=0;b<xb.length;b++)(c=this.w[xb[b]])&&this.A.R(null,xb[b],c);this.sa=null;a=yb(a,"autoStart");null!=a&&(this.i.Ca="true"==a?!0:"false"==a?!1:!!a);D(this)};g.reset=function(){};g.save=function(){return null};g.restore=function(){return!1};g.ha=function(a,b){if(!b){if(a&&this.restore){zb(this);if(!this.restore(a))return!1;Ab(this)}else this.reset();this.M("No debugger detected")}Bb(this);return!0};g.ga=function(a){return a?this.save():!0};
g.Ca=function(){return this.i.Ca||void 0===this.w.run?(Cb(this),!0):!1};g.hb=function(){return 0};function Ab(a){void 0===a.Ka&&(a.Ka=0);void 0===a.ta&&(a.ta=-1);void 0===a.xa&&(a.xa=-1);a.i.Ma=0<=a.Ka&&0<a.ta;a.i.Ma&&(a.Ja=0,a.ja=a.Ka-a.ea)}
function K(a,b,c,d){if(a.w[b]){void 0===c&&(a.i.error=!0,a.K("Value for "+b+" is invalid"),L(a));var e=a.I&&a.I.c||8;if(!a.i.V||a.i.fb)if(8==e){e="";d?11<d&&(d=11):d=c&-65536?11:6;if(null==c||isNaN(c))for(;0<d--;)e="?"+e;else for(;0<d--;)e=String.fromCharCode((c&7)+48)+e,c>>=3;d=""+e}else d=h(c,d);else d="--------".substr(0,d||4);a.w[b].textContent!=d&&(a.w[b].textContent=d)}}
g.R=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.w[b]=c;a=!0;break;case "run":this.w[b]=c;c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.i.L)a=!0;else{var b=null,c,m=y(a.id);for(c=0;c<m.length&&(b=m[c],b===a||b.i.ready);c++);if(c==m.length)for(c=0;c<m.length&&(b=m[c],b===a||b.i.L);c++);c==m.length&&(b=a);p("The "+b.type+" component ("+b.id+") is not "+(b.i.ready?"powered yet":"ready yet"+(b.Oa?" (waiting for notification)":""))+".");a=!1}a&&(d.i.V?L(d):Cb(d))};a=!0;break;
case "speed":this.w[b]=c;a=!0;break;case "setSpeed":this.w[b]=c,c.onclick=function(){Db(d,d.da<<1)},c.textContent=this.ia.toFixed(2)+"Mhz",a=!0}return a};function Eb(a,b,c){a.ea+=b;c&&(a.ca=a.a=0)}function Fb(a,b){var c=1;b&&1<a.da&&a.aa&&(c=a.aa/a.Wa);a.lb=Math.round(1E3/30);a.Na=Math.floor(a.La/30*c);b||(a.ya=a.Na);a.Ya=0}function Gb(a){return a.ea+a.Y+a.ca-a.a}function zb(a){a.aa=0;a.mb=0;a.ea=a.Y=a.ca=a.a=0;Ab(a);Db(a,1)}
function Db(a,b){if(void 0!==b&&(.8>a.aa/a.ia&&(b=1),a.da=b,b=a.Wa*a.da,a.ia!=b)){a.ia=b;b=a.ia.toFixed(2)+"Mhz";var c=a.w.setSpeed;c&&(c.textContent=b);a.M("target speed: "+b)}Eb(a,a.Y);a.Y=0;a.S=ja();a.ba=0;Fb(a)}function bb(a,b){var c=a.J.length;a.J.push([-1,b]);return c}function db(a,b,c){0<=b&&b<a.J.length&&0>a.J[b][0]&&(c*=a.La*a.da/1E3,a.J[b][0]=c)}
g.rc=function(){if(this.i.V){this.Ya>=this.La&&Fb(this,!0);this.za=0;this.Ea=ja();if(this.ba){var a=this.Ea-this.ba;a>this.lb&&(this.S+=a,this.S>this.Ea&&(this.S=this.Ea))}try{do{for(var b,c=this.i.Ma?1:this.Na,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.zb(b)}catch(q){if("number"!=typeof q)throw q;}for(var f=this.ca-this.a,a=f,k=this.J.length-1;0<=k;k--){var m=this.J[k];0>m[0]||(m[0]-=a,0>=m[0]&&(m[0]=-1,m[1]()))}this.za+=f;this.Y+=f;Eb(this,0,!0);a=f;if(this.i.Ma){var n=
!1;this.Ja=this.Ja+this.hb()|0;this.ja-=a;0>=this.ja&&(this.ja+=this.ta,n=!0);0<=this.xa&&this.xa<=Gb(this)&&(this.ta=this.xa=-1,Ab(this),L(this),n=!0);n&&this.M(Gb(this)+" cycles: checksum="+h(this.Ja))}this.ya-=f;if(0>=this.ya){this.ya+=this.Na;15<=++this.mb&&(this.A&&this.A.wa(),this.mb=0);break}}while(this.i.V)}catch(q){L(this);Bb(this);this.A&&this.A.stop(ja(),Gb(this));b=q.stack||q.message;this.i.error=!0;this.K(b);return}if(this.i.V){b=setTimeout;c=this.nb;this.ba=ja();d=this.lb;this.za&&(d=
Math.round(d*this.za/this.Na));d-=this.ba-this.Ea;if(e=this.ba-this.S)this.aa=Math.round(this.Y/(10*e))/100,864E5<=e&&(this.ea=0,Db(this));if(0>d||this.aa<this.ia)-1E3>d&&(this.S-=d),d=0;this.Ya+=this.za;this.ba+=d;b(c,d)}}};function Cb(a){var b;a.i.error?(a.M(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.i.V)a.M(a.toString()+" busy");else{Db(a);a.i.V=!0;a.i.yb=!0;a.sa&&a.sa.start();if(b=a.w.run)b.textContent="Halt";a.A&&a.A.start(a.S,Gb(a));Bb(a,!0);setTimeout(a.nb,0)}}g.zb=function(){return 0};
function L(a){if(a.i.V){a.ca-=a.a;a.a=0;Eb(a,a.Y);a.Y=0;a.i.V=!1;a.sa&&a.sa.stop();var b=a.w.run;b&&(b.textContent="Run");a.A&&a.A.stop(ja(),Gb(a));Bb(a)}a.i.complete=void 0}function Bb(a,b){a.A&&a.A.wa(b)}
function Hb(a){this.Mb=+a.model||1170;this.sc=a.resetAddr||0;wb.call(this,a,6666667);this.jb=0;this.decode=Ib.bind(this);this.m=65536;this.h=32768;this.l=65535;this.s=32768;this.v=15;this.f=[0,0,0,0,0,0,0,this.sc];this.va=[0,0,0,0,0,0];this.Z=[0,0,0,0];this.Ha=this.B=0;this.Lb=[4,2,0,1];this.C=[[0,0,0,0,0,0,0,0,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]];this.P=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.tc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.xb=[0,0,0,0,0,0,0,0];this.g=this.c=this.Ua=this.G=this.H=this.j=this.wb=0;this.ka=-1;Jb(this);this.i.complete=this.i.Hb=!1}x(Hb,wb);g=Hb.prototype;g.reset=function(){this.i.V&&L(this);Jb(this);zb(this);this.i.error=!1;this.parent.reset.call(this)};
function Jb(a){a.ra=255;a.F=0;a.cb=0;a.D=0;a.qa=0;a.bb=0;a.ua=0;a.Za=0;a.Ga=0;a.Xa=262143;a.Ia=253952;a.u=[];a.j|=2;eb(a)}function eb(a){a.Za?(a.$=65536,a.N=a.Kb,a.O=a.vb,a.ob=a.Uc):(a.$=0,a.N=a.Jb,a.O=a.oc,a.ob=a.Tc)}g.hb=function(){return 0};g.save=function(){var a=new M(this);a.set(0,[]);a.set(1,[this.ea,this.da]);a.set(2,Za(this.o));return a.data()};
g.restore=function(a){var b=a[1];this.ea=b[1];Db(this,b[3]);a:{b=this.o;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.A){for(var f=0,k=Array(b.A),m=0;m<e.length-1;)for(var n=e[m++],q=e[m++];n--;)k[f++]=q;e=k}f=b.a[d];if(!f||!f.restore(e)){p("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
g.R=function(a,b,c){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":this.w[b]=c;this.jb++;a=!0;break;default:a=this.parent.R.call(this,a,b,c)}return a};
g.wa=function(a){if(this.jb&&(a||!this.i.V||this.i.fb)){for(a=0;a<this.f.length;a++)K(this,"R"+a,this.f[a]);a=gb(this);K(this,"PS",a);K(this,"NF",a&8?1:0,1);K(this,"ZF",a&4?1:0,1);K(this,"VF",a&2?1:0,1);K(this,"CF",a&1?1:0,1)}if(a=this.w.speed)a.textContent=this.i.V&&this.aa?this.aa.toFixed(2)+"Mhz":"Stopped"};function N(a){return a.m&65536?1:0}g.na=function(){return this.s&32768?8:0};function Kb(a){var b=a.O(a.f[7]);a.f[7]=a.f[7]+2&65535;return b}
function cb(a,b,c,d,e){for(var f=a.u.length;0<f--;)if(a.u[f].Ab===d){0<f&&(a.u[f-1].fa+=a.u[f].fa);a.u.splice(f,1);break}if(0<=b){for(f=a.u.length;0<f--;){if(a.u[f].fa>b){a.u[f].fa-=b;break}b-=a.u[f].fa}a.u.splice(f+1,0,{fa:b,pb:c<<5&224,Ab:d,Sa:e})}a.j|=2}function gb(a){return a.v=a.v&63728|a.na()|(a.l&65535?0:4)|(a.h&32768?2:0)|N(a)}
function hb(a,b){a.s=b<<12;a.l=~b&4;a.h=b<<14;a.m=b<<16;if((b^a.v)&2048)for(var c=a.va.length;0<=--c;){var d=a.f[c];a.f[c]=a.va[c];a.va[c]=d}a.B=b>>14&3;c=a.v>>14&3;a.B!=c&&(a.Z[c]=a.f[6],a.f[6]=a.Z[a.B]);a.j|=2;a.v=b}function O(a,b){a.j&128||(a.s=a.l=b,a.h=0)}function P(a,b,c){a.j&128||(a.s=a.l=a.m=b,a.h=c||0)}function Lb(a,b,c,d){a.j&128||(a.s=a.l=a.m=b,a.h=(c^b)&(d^b))}function Q(a,b){a.j&128||(a.s=a.l=a.m=b,a.h=a.s^a.m>>1)}function Mb(a,b,c,d){a.j&128||(a.s=a.l=a.m=b,a.h=(c^d)&(d^b))}
function F(a,b){var c=!1;0>a.ka?a.ka=gb(a):a.B||(b=4,c=!0);a.D&57344||(a.qa=63222,a.bb=b);a.B=0;var d=a.O(b|a.$),e=a.O(b+2&65535|a.$);hb(a,e&-12289|a.ka>>2&12288);c&&(a.F|=4,a.f[6]=4);Nb(a,a.ka);Nb(a,a.f[7]);a.f[7]=d&65535;a.j&=-113;a.ka=-1;throw b;}function Ob(a){var b=Pb(a),c=Pb(a)&-1793;a.v&49152&&(c=c&-225|a.v&63712);a.f[7]=b&65535;hb(a,c);a.j&=-17}
function Qb(a,b,c){var d,e,f,k=0;d=b>>13;a.ua&a.Lb[a.B]||(d&=7);e=a.C[a.B][d];f=(a.P[a.B][d]<<6)+(b&8191)&a.Xa;if(f<a.Ia)f&1&&!(c&1)&&(a.F|=64,F(a,4));else if(a.ua&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var m=f>>13&31;31>m?a.ua&32&&(f=a.tc[m]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Ia&&4186112>f&&(a.F|=32,F(a,4))}switch(e&7){case 1:k=4096;case 2:e|=128;c&4&&(k=8192);break;case 4:k=4096;case 5:c&4&&(k=4096);case 6:e|=c&4?192:128;break;
default:k=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(k|=16384):(b&8128)>(e>>2&8128)&&(k|=16384));a.C[a.B][d]=e;if(4194170!==f||a.B)a.Ga=a.B,a.Ha=d;k&&(k&57344&&(0<=a.ka&&(k|=128),a.D&57344||(a.D=a.D|k|a.Ga<<5|a.Ha<<1),F(a,168)),a.D&61440||!(4191360>f||4194239<f)||(a.D|=4096,a.D&512&&(a.j|=32)));return f}function Pb(a){var b=a.O(a.f[6]|a.$);a.f[6]=a.f[6]+2&65535;return b}
function Nb(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.D&57344||(a.qa=a.qa<<8|246);!a.B&&c<=a.ra&&4<c&&(c<=a.ra-32?(a.F|=4,a.f[6]=4,F(a,4)):(a.F|=8,a.j|=4));a.ob(c,b)}
function Rb(a,b,c,d){var e,f,k=d&8?0:a.$;switch(b){case 0:return F(a,4),0;case 1:return 6===c&&!a.B&&d&4&&(a.f[6]<=a.ra||65534<=a.f[6])&&(a.f[6]<=a.ra-32||65534<=a.f[6]?(a.F|=4,a.f[6]=4,F(a,4)):(a.F|=8,a.j|=64)),a.a-=3,7===c?a.f[c]:a.f[c]|k;case 2:f=2;e=a.f[c];7!==c&&(e|=k,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.f[c];7!==c&&(e|=k);e=a.O(e);e|=k;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.f[c]+f&65535;7!==c&&(e|=k);a.a-=4;break;case 5:f=-2;e=a.f[c]-2&65535;7!==c&&(e|=k);e=a.O(e)|k;a.a-=8;break;
case 6:return e=Kb(a),e=e+a.f[c]&65535|k,a.a-=6,e;case 7:return e=Kb(a),e=e+a.f[c]&65535,e=a.O(e|a.$)|k,a.a-=10,e}a.f[c]=a.f[c]+f&65535;!k||a.D&57344||(a.qa=a.qa<<8|f<<3&248|c);6==c&&!a.B&&d&4&&0>=f&&(a.f[6]<=a.ra||65534<=a.f[6])&&(a.f[6]<=a.ra-32?(a.F|=4,a.f[6]=4,F(a,4)):(a.F|=8,a.j|=64));return e}g.Jb=function(a,b,c){return Rb(this,a,b,c)};g.Kb=function(a,b,c){return Qb(this,Rb(this,a,b,c),c)};g.oc=function(a){return Xa(this.o,a)};g.vb=function(a){return Xa(this.o,Qb(this,a,2))};
g.Tc=function(a,b){Ya(this.o,a,b&65535)};g.Uc=function(a,b){Ya(this.o,Qb(this,a,4),b)};function Sb(a,b,c){var d=a.c=b&7;(b=a.g=(b&56)>>3)?(d=Rb(a,b,d,2),c&65536||61440!==(a.v&61440)&&(d&=65535),a.B=a.v>>12&3,c=a.O(d|c&a.$),a.B=a.v>>14&3):c=6!=d||(a.v>>2&12288)===(a.v&12288)?a.f[d]:a.Z[a.v>>12&3];return c}
function Tb(a,b,c,d){a.D&57344||(a.qa=22);var e=a.c=b&7;(b=a.g=(b&56)>>3)?(e=Rb(a,b,e,4),c&65536||(e&=65535),a.B=a.v>>12&3,e=Qb(a,e|c&65536,4),a.B=a.v>>14&3,Ya(a.o,e,d)):6!=e||(a.v>>2&12288)===(a.v&12288)?a.f[e]=d:a.Z[a.v>>12&3]=d}function Ub(a,b){b>>=6;var c=a.H=b&7;(b=a.G=(b&56)>>3)?(c=a.N(b,c,3),a=Wa(a.o,c)):a=a.f[c]&255;return a}function R(a,b){b>>=6;var c=a.H=b&7;return(b=a.G=(b&56)>>3)?Xa(a.o,a.N(b,c,2)):a.f[c]}function Vb(a,b){var c=a.c=b&7;b=a.g=(b&56)>>3;return Rb(a,b,c,8)}
function Wb(a,b){var c=a.c=b&7;(b=a.g=(b&56)>>3)?(c=a.N(b,c,3),a=Wa(a.o,c)):a=a.f[c]&255;return a}function S(a,b){var c=a.c=b&7;return(b=a.g=(b&56)>>3)?Xa(a.o,a.N(b,c,2)):a.f[c]}function T(a,b,c,d){var e=a.c=b&7;(b=a.g=(b&56)>>3)?(e=a.Ua=a.N(b,e,7),c=d.call(a,c,Wa(a.o,e)),e&1&&a.a--,a=a.o,a.a[(e&a.h)>>>a.c].Ra(e&a.o,c&255,e)):a.f[e]=a.f[e]&65280|d.call(a,c,a.f[e])}function U(a,b,c,d){var e=a.c=b&7;(b=a.g=(b&56)>>3)?(e=a.N(b,e,6),Ya(a.o,e,d.call(a,c,Xa(a.o,e)))):a.f[e]=d.call(a,c,a.f[e])}
function Xb(a,b,c,d){var e=a.c=b&7;(b=a.g=(b&56)>>3)?(d=a.N(b,e,5),d&1&&a.a--,a=a.o,a.a[(d&a.h)>>>a.c].Ra(d&a.o,c&255,d)):a.f[e]=c?d&1?c<<24>>24&65535:a.f[e]&-256|c&255:a.f[e]&-256;return c}function Yb(a,b,c){var d=a.c=b&7;(b=a.g=(b&56)>>3)?Ya(a.o,a.N(b,d,4),c):a.f[d]=c&65535;return c}function V(a,b,c){c&&(a.f[7]=a.f[7]+(b<<24>>23)&65535,a.a-=2);a.a-=3}
g.zb=function(a){this.i.complete=!0;this.i.Hb=!1;this.i.yb=!1;this.ca=this.a=a;do{if(this.j&&(this.j&112&&(this.j&32?F(this,168):this.j&64?F(this,4):this.j&16&&F(this,12),this.j&=-113),this.j&7))if(this.j&2){this.j&=-3;a=null;for(var b=this.cb&224,c=this.u.length;0<=--c;){if(0<this.u[c].fa){this.u[c].fa--;this.j|=2;break}if(this.u[c].Sa){if(!this.u[c].Sa()){this.u.splice(c,1);continue}this.u[c].Sa=null}this.u[c].pb>b&&(b=this.u[c].pb,a=this.u[c],this.u.splice(c,1))}b>(this.v&224)&&(this.j&4&&(this.f[7]=
this.f[7]+2&65535,this.j&=-5),a?F(this,a.Ab):F(this,160))}else this.j&1&&this.j++;this.D&57344||(this.qa=0,this.bb=this.f[7]);this.j=this.j&7|this.v&16;this.decode(Kb(this))}while(0<this.a);return this.i.complete?this.ca-this.a:void 0===this.i.complete?0:-1};u(function(){for(var a=C(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Hb(d);B(d,c)}});function Zb(a,b){var c=b+a;Lb(this,c,a,b);return c&65535}function $b(a,b){var c=b+a;Lb(this,c<<8,a<<8,b<<8);return c&255}
function ac(a,b){a=b<<1;Q(this,a);return a&65535}function bc(a,b){a=b<<1;Q(this,a<<8);return a&255}function cc(a,b){a=b&32768|b>>1|b<<16;Q(this,a);return a&65535}function dc(a,b){a=b&2048|b>>1|b<<8;Q(this,a<<8);return a&255}function ec(a,b){a=b&~a;O(this,a);return a}function fc(a,b){a=b&~a;O(this,a<<8);return a}function gc(a,b){a|=b;O(this,a);return a}function hc(a,b){a|=b;O(this,a<<8);return a}function ic(a,b){a=~b|65536;P(this,a);return a&65535}
function jc(a,b){a=~b|256;P(this,a<<8);return a&255}function kc(a,b){a=b-a;this.j&128||(this.s=this.l=a,this.h=b&(b^a));return a&65535}function lc(a,b){a=b-a;var c=a<<8;b<<=8;this.j&128||(this.s=this.l=c,this.h=b&(b^c));return a&255}function mc(a,b){a=b+a;this.j&128||(this.s=this.l=a,this.h=a&(b^a));return a&65535}function nc(a,b){a=b+a;var c=a<<8;this.j&128||(this.s=this.l=c,this.h=c&(b<<8^c));return a&255}function oc(a,b){a=-b;P(this,a,a&b&32768);return a&65535}
function pc(a,b){a=-b;P(this,a<<8,(a&b&128)<<8);return a&255}function qc(a,b){a=b<<1|this.m>>16&1;Q(this,a);return a&65535}function rc(a,b){a=b<<1|this.m>>16&1;Q(this,a<<8);return a&255}function sc(a,b){a=(this.m&65536|b)>>1|b<<16;Q(this,a);return a&65535}function tc(a,b){a=((this.m&65536)>>8|b)>>1|b<<8;Q(this,a<<8);return a&255}function uc(a,b){var c=b-a;Mb(this,c,a,b);return c&65535}function vc(a,b){var c=b-a;Mb(this,c<<8,a<<8,b<<8);return c&255}
function wc(a,b){this.j&128||(this.s=this.l=b&65280,this.h=this.m=0);return(b<<8|b>>8)&65535}function xc(a,b){a^=b;O(this,a);return a&65535}function yc(a){var b=S(this,a);a=a>>6&7;var c=this.f[a];c&32768&&(c|=4294901760);this.m=this.h=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.h=c,c=0;else{this.m=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.h=32768)}this.f[a]=c&65535;this.s=this.l=c;this.a-=(this.g?6:7)+b}
function zc(a){var b=S(this,a);a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.m=this.h=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.h=32768)):d=c;this.f[a]=d>>16&65535;this.f[a|1]=d&65535;this.s=d>>16;this.l=d>>16|d;this.a-=(this.g?6:7)+b}function W(a){a&1&&(this.m=0);a&2&&(this.h=0);a&4&&(this.l=1);a&8&&(this.s=0);this.a-=5}
function Ac(a){var b=S(this,a);if(b){a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.m=this.h=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.l=d>>16|d,this.s=d>>16):(this.h=32768,this.l=d>>15|d,this.s=c>>16,-1===b&&65534===this.f[a]&&(this.f[a]=this.f[a|1]=1));this.a-=53}else this.l=this.s=0,this.h=32768,this.m=65536,this.a-=7}var Bc=[0,7,7,10,7,11,9,13];function Cc(a){var b=this.a;a=Vb(this,a);this.f[7]=a&65535;this.a=b-Bc[this.g]}
var Dc=[0,14,14,17,14,18,16,20];function Ec(a){var b=this.a,c=Vb(this,a);a=a>>6&7;Nb(this,this.f[a]);this.f[a]=this.f[7];this.f[7]=c&65535;this.a=b-Dc[this.g]}var Fc=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],Gc=[7,13,13,17,14,18,17,21];function Hc(a){var b=S(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.j&128||(this.s=b>>16,this.l=this.s|b,this.h=0,this.m=-32768>b||32767<b?65536:0);this.a-=23}
function Ic(){this.a-=5}function X(a){a&1&&(this.m=65536);a&2&&(this.h=32768);a&4&&(this.l=0);a&8&&(this.s=32768);this.a-=5}function Jc(a){var b=(a&448)>>6;if(this.f[b]=this.f[b]-1&65535)this.f[7]=this.f[7]-((a&63)<<1)&65535,this.a+=1;this.a-=6}function Kc(a){U(this,a,0,wc);this.a-=this.g?9:3+(7==this.c?2:0)}function Lc(a){U(this,a,R(this,a),xc);this.a-=this.g?9:3+(7==this.c?2:0)}function Y(){F(this,8)}function Ib(a){Mc[a>>12].call(this,a)}
var Mc=[function(a){Nc[a>>8&15].call(this,a)},function(a){var b=R(this,a),c=this.a;O(this,Yb(this,a,b));this.a=c-Fc[(this.G?8:0)+this.g]+(7!=this.c||this.g?0:2)},function(a){var b=R(this,a);a=S(this,a);Mb(this,b-a,a,b);this.a-=this.g?4+(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){O(this,R(this,a)&S(this,a));this.a-=this.g?4+(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){U(this,a,R(this,a),ec);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?
2:0)},function(a){U(this,a,R(this,a),gc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){U(this,a,R(this,a),Zb);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){Oc[a>>8&15].call(this,a)},function(a){Pc[a>>8&15].call(this,a)},function(a){var b=Ub(this,a);O(this,Xb(this,a,b,1)<<8);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){var b=Ub(this,a)<<8;a=Wb(this,a)<<8;Mb(this,b-a,a,b);this.a-=this.g?4+
(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){O(this,(Ub(this,a)&Wb(this,a))<<8);this.a-=this.g?4+(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){T(this,a,Ub(this,a),fc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){T(this,a,Ub(this,a),hc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){U(this,a,R(this,a),uc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},Y],Nc=[function(a){Qc[a>>
4&15].call(this,a)},function(a){V(this,a,!0)},function(a){V(this,a,!!(this.l&65535))},function(a){V(this,a,this.l&65535?0:4)},function(a){V(this,a,!this.na()==!(this.h&32768))},function(a){V(this,a,!this.na()!=!(this.h&32768))},function(a){V(this,a,!!(this.l&65535)&&!this.na()==!(this.h&32768))},function(a){V(this,a,(this.l&65535?0:4)||!this.na()!=!(this.h&32768))},Ec,Ec,function(a){Rc[a>>6&3].call(this,a)},function(a){Sc[a>>6&3].call(this,a)},function(a){Tc[a>>6&3].call(this,a)},function(a){Uc[a>>
6&3].call(this,a)},Y,Y],Rc=[function(a){P(this,Yb(this,a,0));this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,ic);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,1,mc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,1,kc);this.a-=this.g?9:3+(7==this.c?2:0)}],Sc=[function(a){U(this,a,0,oc);this.a-=this.g?11:6},function(a){U(this,a,N(this)?1:0,Zb);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,N(this)?1:0,uc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){a=S(this,
a);P(this,a);this.a-=this.g?4:3+(7==this.c?2:0)}],Tc=[function(a){U(this,a,0,sc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,qc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,cc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,ac);this.a-=this.g?9:3+(7==this.c?2:0)}],Uc=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=this.vb(a|65536);this.f[7]=this.f[5]&65535;this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=Sb(this,a,0);Nb(this,a);O(this,a);this.a-=
11},function(a){var b=Pb(this),c=this.a;Tb(this,a,0,b);O(this,b);this.a=c-Gc[this.g]},function(a){O(this,Yb(this,a,this.na?65535:0));this.a-=this.g?9:3+(7==this.c?2:0)}],Qc=[function(a){Vc[a&15].call(this,a)},Y,Y,Y,Cc,Cc,Cc,Cc,function(a){if(a&8)F(this,8);else{var b=Pb(this);a&=7;this.f[7]=this.f[a]&65535;this.f[a]=b;this.a-=9}},function(a){a&8?(this.v&49152||(this.v=this.v&-2017|(a&7)<<5,this.j|=1),this.a-=5):F(this,8)},function(a){Wc[a&15].call(this,a)},function(a){Xc[a&15].call(this,a)},Kc,Kc,
Kc,Kc],Vc=[function(){this.v&49152?(this.F|=128,F(this,4)):L(this);this.a-=7},function(){this.j|=4;this.f[7]=this.f[7]+-2&65535;this.a-=3},function(){Ob(this);this.j|=this.v&16;this.a-=13},function(){F(this,12);this.a-=5},function(){F(this,16);this.a-=25},function(){this.v&49152||(Jb(this),this.o.reset());this.a-=667},function(){Ob(this);this.a-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],Wc=[Ic,function(){this.m=0;this.a-=5},function(){this.h=0;this.a-=5},W,function(){this.l=1;this.a-=5},W,W,W,function(){this.s=0;this.a-=
5},W,W,W,W,W,W,W],Xc=[Ic,function(){this.m=65536;this.a-=5},function(){this.h=32768;this.a-=5},X,function(){this.l=0;this.a-=5},X,X,X,function(){this.s=32768;this.a-=5},X,X,X,X,X,X,X],Oc=[Hc,Hc,Ac,Ac,yc,yc,zc,zc,Lc,Lc,Y,Y,Y,Y,Jc,Jc],Pc=[function(a){V(this,a,!this.na())},function(a){V(this,a,this.na())},function(a){V(this,a,!N(this)&&!!(this.l&65535))},function(a){V(this,a,N(this)||(this.l&65535?0:4))},function(a){V(this,a,!(this.h&32768))},function(a){V(this,a,this.h&32768?2:0)},function(a){V(this,
a,!N(this))},function(a){V(this,a,N(this))},function(){F(this,24);this.a-=25},function(){F(this,28);this.a-=5},function(a){Yc[a>>6&3].call(this,a)},function(a){Zc[a>>6&3].call(this,a)},function(a){$c[a>>6&3].call(this,a)},function(a){ad[a>>6&3].call(this,a)},Y,Y],Yc=[function(a){P(this,Xb(this,a,0));this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,0,jc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,1,nc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,1,lc);this.a-=this.g?
9:3+(7==this.c?2:0)}],Zc=[function(a){T(this,a,0,pc);this.a-=this.g?11:6},function(a){T(this,a,N(this)?1:0,$b);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,N(this)?1:0,vc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){a=Wb(this,a);P(this,a<<8);this.a-=this.g?4:3+(7==this.c?2:0)}],$c=[function(a){T(this,a,0,tc);this.a-=this.g?9+(this.Ua&1):3+(7==this.c?2:0)},function(a){T(this,a,0,rc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,0,dc);this.a-=this.g?9+(this.Ua&1):3+(7==this.c?
2:0)},function(a){T(this,a,0,bc);this.a-=this.g?9:3+(7==this.c?2:0)}],ad=[Y,function(a){a=Sb(this,a,65536);Nb(this,a);O(this,a);this.a-=11},function(a){var b=Pb(this),c=this.a;Tb(this,a,65536,b);O(this,b);this.a=c-Gc[this.g]},Y];
function bd(a){v.call(this,"ROM",a,bd);this.a=null;this.m=a.addr;this.c=a.size;this.s=a.writable;this.g=a.alias;this.h=a.file;this.u=ba(this.h);if(this.h){a=this.h;var b=ca(this.u);"json"!=b&&"hex"!=b&&(a=ea()+"/api/v1/dump?file="+this.h+"&format=bytes&decimal=true");var c=this;l(a,null,!0,function(a,b,f){cd(c,a,b,f)})}}x(bd);bd.prototype.oa=function(a,b,c,d){this.o=b;this.b=c;this.I=d;dd(this)};bd.prototype.ha=function(){this.l&&(this.I&&this.I.a(this.id,this.m,this.c,this.l),delete this.l);return!0};
bd.prototype.ga=function(){return!0};
function cd(a,b,c,d){if(d)a.K("Unable to load system ROM (error "+d+": "+b+")");else{Ga(a.Va,b,c);var e;if("["==c.charAt(0)||"{"==c.charAt(0))try{var f,k,m=eval("("+c+")");if(f=m.bytes)a.a=f;else if(f=m.words)for(a.a=Array(2*f.length),k=e=0;e<f.length;e++)a.a[k++]=f[e]&255,a.a[k++]=f[e]>>8&255;else if(f=m.data)for(a.a=Array(4*f.length),k=e=0;e<f.length;e++)a.a[k++]=f[e]&255,a.a[k++]=f[e]>>8&255,a.a[k++]=f[e]>>16&255,a.a[k++]=f[e]>>24&255;else a.a=m;a.l=m.symbols;if(!a.a.length){p("Empty ROM: "+b);
return}if(1==a.a.length){p(a.a[0]);return}}catch(n){a.K("ROM data error: "+n.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.a=Array(b.length),e=0;e<b.length;e++)a.a[e]=aa(b[e]);dd(a)}}
function dd(a){if(!Ia(a))if(!a.h)D(a);else if(a.a&&a.o){a.c||(a.c=a.a.length);if(a.a.length!=a.c){var b="ROM size ("+h(a.a.length,8,!0)+") does not match specified size ("+h(a.c,8,!0)+")";a.i.error=!0;a.K(b)}else{b=a.m;if(Sa(a.o,b,a.c,a.s?1:nb)){var c;for(c=0;c<a.a.length;c++){var d=a.o,e=b+c;d.a[(e&d.h)>>>d.c].Bb(e&d.o,a.a[c]&255,e)}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++){for(var f=a,d=b[c],e=f.o,k=f.c,m=[],n=f.m>>>e.c;0<k&&
n<e.a.length;)m.push(e.a[n++]),k-=e.g;e=f.o;f=f.c;k=0;for(d>>>=e.c;0<f&&d<e.a.length;){n=m[k++];if(!n)break;e.a[d++]=n;f-=e.g}}delete a.a}}D(a)}}u(function(){for(var a=C(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new bd(d);B(d,c)}});function ed(a){v.call(this,"RAM",a,ed);this.g=a.addr;this.c=a.size;this.a=!1}x(ed);g=ed.prototype;g.oa=function(a,b,c,d){this.o=b;this.b=c;this.I=d;D(this)};g.ha=function(a,b){b||this.reset();return!0};g.ga=function(a){return a?this.save():!0};
g.reset=function(){!this.a&&this.c&&Sa(this.o,this.g,this.c,1)&&(this.a=!0);this.a||p("No RAM allocated")};g.save=function(){return null};g.restore=function(){return!0};u(function(){for(var a=C(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new ed(d);B(d,c)}});function fd(a){v.call(this,"Keyboard",a,fd);D(this)}x(fd);fd.prototype.R=function(){return!1};fd.prototype.oa=function(a,b,c,d){this.A=a;this.b=c;this.I=d;this.sa=null};
u(function(){for(var a=C(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new fd(d);B(d,c)}});function Z(a){this.g=this.l=null;this.H=a.tabSize;this.B=a.charBOL;this.m=0;v.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.l="";else{var c;a=gd;b&&(void 0===c&&(c="Panel"),(c=z(c,this.id))&&(b=c.w[b])&&this.R(null,a,b))}this.s=this.u=null;this.exports={connect:this.ib,receiveData:this.ab}}x(Z);var gd="buffer";g=Z.prototype;
g.R=function(a,b,c){var d=this;switch(b){case gd:return this.w[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.ab(b);return!0},c.onkeypress=function(a){a=a||window.event;d.ab(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
g.oa=function(a,b,c,d){this.A=a;this.o=b;this.b=c;this.I=d;var e=this;this.J=bb(this.b,function(){e.a&128||!e.h.length||(e.G=e.h.shift(),e.a|=128,e.a&64&&cb(e.b,40,4,48))});this.D=function(){e.c|=128;return!!(e.c&64)};$a(b,this,hd);D(this)};
g.ib=function(){if(!this.s){var a=yb(this.A,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ha(b[0]);if(c!=this.Fa)return;b=ha(b[1]);if(this.s=Ha(b)){var d=this.s.exports;if(d){var e=d.connect;e&&e.call(this.s);if(this.u=d.receiveData){this.status(this.Va+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};g.ha=function(a,b){if(!b)if(this.ib(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
g.ga=function(a){return a?this.save():!0};g.reset=function(){id(this)};g.save=function(){var a=new M(this);a.set(0,[]);return a.data()};g.restore=function(){return id(this)};function id(a){a.G=0;a.a=0;a.c=128;a.h=[];return!0}g.ab=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);db(this.b,this.J,50);return!0};g.cc=function(){return this.a&65535};g.Hc=function(a){this.a=this.a&-112|a&111};
g.bc=function(){this.a&=-129;0<this.h.length&&db(this.b,this.J,50);return this.G};g.Gc=function(){};g.qc=function(){return this.c};g.Wc=function(a){128==(this.c&192)&&a&64&&cb(this.b,8,4,52,this.D);this.c=this.c&-70|a&69};g.pc=function(){return 0};
g.Vc=function(a){if(a&=255){this.u&&this.u.call(this.s,a);if(this.g)if(13==a)this.m=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.m&&this.m--;else{var b;b=(b=ia[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.H||8,c=a-this.m%a,this.H&&(b=" ".slice(0,c)));this.B&&!this.m&&c&&(b=String.fromCharCode(this.B)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.m+=c}else if(null!=this.l){if(10==a||1024<=this.l.length)this.M(this.l),
this.l="";10!=a&&(this.l+=String.fromCharCode(a))}this.c&=-129;cb(this.b,100,4,52,this.D)}};var jd={},hd=(jd[65392]=[null,null,Z.prototype.cc,Z.prototype.Hc,"RCSR"],jd[65394]=[null,null,Z.prototype.bc,Z.prototype.Gc,"RBUF"],jd[65396]=[null,null,Z.prototype.qc,Z.prototype.Wc,"XCSR"],jd[65398]=[null,null,Z.prototype.pc,Z.prototype.Vc,"XBUF"],jd);u(function(){for(var a=C(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Z(d);B(d,c)}});
function kd(a,b,c){v.call(this,"Computer",a,kd);this.i.L=!1;ld(this,b);this.B=yb(this,"autoPower",a);this.g=0;this.N=a.busWidth||a.buswidth;this.a=md;this.u=null;this.m=this.H=!1;this.O=yb(this,"url")||"";(Math.random()+.1).toString(36);this.c=nd(this);if(this.b=z("CPU",this.id)){this.I=z("Debugger",this.id);this.o=new Ma({id:this.Va+".bus",busWidth:this.N},this.b,this.I);var d,e=y(this.id);if((this.h=z("Panel",this.id))&&this.h.Ta)for(b=0;b<e.length;b++)d=e[b],d.K=this.h.K,d.M=this.h.M,d.Ta=this.h.Ta;
this.M("PDPjs v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.M("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.oa&&d.oa(this,this.o,this.b,this.I);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.a=parseInt(d,10));var f;if(a=yb(this,"state")||(f=!0,a.state))b=this.D=a,f||(this.m=!0,this.a=md),this.a&&(this.A=new M(this,
"1.30.1"),od(this.A)?b=null:delete this.A);!b&&this.a&&(b=pd(this))&&(this.m=!0);if(b){var k=this;l(b,null,!0,function(a,b,c){c?(k.s=null,k.m=!1,k.K("Unable to load machine state from server (error "+c+(b?": "+ha(b):"")+")")):(k.u=b,k.H=!0);D(k)})}else D(this);this.w.power||(this.B=!0);!c&&this.B&&qd(this,this.Da)}else p("Unable to find CPU component")}x(kd);var md=0;
function ld(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){p(d.message+" ("+c+")")}}a.J=b}function yb(a,b,c){var d=b.toLowerCase(),d=za[b]||za[d];void 0===d&&a.J&&(d=a.J[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function qd(a,b,c){for(var d=y(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ia(f)){Ia(f,function(){qd(a,b,c)});return}}b.call(a,c)}
function rd(a,b){var c=new M(a,"1.30.1","validate");if(od(c)&&sd(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.K("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}g=kd.prototype;
g.Da=function(a){void 0===a&&(a=this.a||(this.u?1:md));if(!this.g){this.g++;var b=!1,c=!1;this.G=!1;var d=this.A||new M(this,"1.30.1");if(-1==a)b=!0;else if(a>md){if(od(d,this.u)){this.l=new M(this,"1.30.1","failsafe");od(this.l)&&(td(this,d),a=2,ud(this.l));this.l.set("timestamp",ka());vd(this.l);var e=this.a&&!this.m;if(1==a||la("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=sd(d)){var f=d.get("code"),k=d.get("data");f&&("ok"==f?od(d,k):("error"==
f&&"no machine state"!=k?(this.K("Error: "+k),"unable to verify user"==k&&(pa("user",""),this.c=null)):this.M(f+": "+k),ud(d),od(d)?(c=sd(d),e=!0):c=!1))}e&&rd(this,c?d:null)}else 2==a&&d.clear()}else rd(this);delete this.u;delete this.A}e=y(this.id);for(f=0;f<e.length;f++)k=e[f],k!==this&&k!=this.b&&(c=wd(this,k,d,b,c));b=[d,a,c];-1!=a?qd(this,this.gb,b):this.gb(b)}};
function wd(a,b,c,d,e){if(!b.i.L){b.i.L=!0;if(b.ha){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.ha(f,d)&&f&&(p("Unable to restore state for "+b.type),a.D&&!a.H?(c.clear(),a.a=md,window&&window.location.reload()):a.G=!0,b.ha(null),e=!1)}if(!d&&b.kb)for(a=b.kb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
g.gb=function(a){var b=a[0],c=0>a[1];a=a[2];this.S=!0;this.i.L=!0;var d=this.w.power;d&&(d.textContent="Shutdown");this.b&&(wd(this,this.b,b,c,a),this.b.Ca());this.G&&(td(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.g=0};
function td(a,b){if(la("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.1"};d.url=a.O;d.user=c;d.type="bug";d.data=b;l("http://www.pcjs.org/api/v1/report",d,!0)}}
function xd(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new M(a,"1.30.1"),k=new M(a,"1.30.1","validate"),m=ka();k.set("timestamp",m);f.set("timestamp",m);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.ga&&(c&&L(a.b),d=a.b.ga(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.i.L=!1,!1===d&&(e=null)));for(var m=y(a.id),n=0;n<m.length;n++){var q=m[n];q.i.L&&(q.ga&&(d=q.ga(b,c),"object"===typeof d&&f.set(q.id,
d)),c&&(q.i.L=!1,!1===d&&(e=null)))}e&&(c?(m=d=!1,b?(a.c&&yd(a,a.c,f.toString()),vd(k)&&vd(f)||(e=null,d=m=!0)):a.a&&(d=!0,m=3==a.a),d&&f.clear(m)):e=f.toString());c&&(a.i.L=!1,b=a.w.power)&&(b.textContent="Power");a.g=0;return e}g.reset=function(){this.o&&this.o.reset&&this.o.reset();for(var a=y(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.o&&c.reset&&c.reset()}};g.start=function(a,b){for(var c=y(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};
g.stop=function(a,b){for(var c=y(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
g.R=function(a,b,c){var d=this;switch(b){case "power":return this.w[b]=c,c.onclick=function(){d.g||(d.i.L?xd(d,!1,!0):qd(d,d.Da))},!0;case "reset":return this.w[b]=c,c.onclick=function(){if(d.i.L&&!d.g)if(d.a&&!d.s){var a=la("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");xd(d,a,!0);!a&&d.D?window&&window.location.reload():d.Da(md)}else d.reset(),d.b&&d.b.Ca()},!0;case "save":if(da())c.parentNode.removeChild(c);else return this.w[b]=
c,c.onclick=function(){var a=nd(d,!0);if(a){var b=!!(d.a&&!d.s||d.D),c=xd(d,b);b?yd(d,a,c):d.K("Resume disabled, machine state not saved")}},!0}return!1};
function nd(a,b){var c=a.c;c||((c=oa("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=zd(a,c))||a.K("The user ID is invalid.")):b&&a.K("Browser local storage is not available"));return c}
function zd(a,b){a.c=null;b=l(ea()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(pa("user",b.data),a.c=b.data)}catch(d){p(d.message+" ("+c+")")}return a.c}function pd(a){var b=null;a.c&&(b=ea()+"/api/v1/user?req=load&user="+a.c+"&state="+Ad(a,"1.30.1"));return b}
function yd(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Ad(a,"1.30.1");d.data=c;b=l(ea()+"/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.K("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.K(c),pa("user",""),a.c=null)}}
g.wa=function(a){this.b&&this.b.wa(a);this.h&&this.h.wa(a)};u(function(){for(var a=C(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=C(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],k=A(f),k=new kd(k,d,!0);B(k,f);k.B&&qd(k,k.Da)}});r.show.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=z("Computer",c.id))&&c.S&&!c.i.L&&c.Da(-1)}});
r.exit.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=z("Computer",c.id))&&c.i.L&&xd(c,!(!c.a||c.s),!0)}});function M(a,b,c){this.id=a.id;this.key=Ad(a,b,c);this.I=a.I;ud(this,a.Nb)}function Ad(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}
M.prototype={constructor:M,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){ud(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 ud(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function vd(a){var b=!0;if(na()){var c=JSON.stringify(a[a.id]);pa(a.key,c)||(p("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function sd(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){p(c.message||c),b=!1}return b}function od(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:na()&&(b=oa(a.key))?(a[a.id]=b,a.a=!0):!1}var Bd=0;
function Cd(a,b,c,d,e,f){e("Loading "+a+"...");l(a,null,!0,function(k,m,n){n?(m||(m="unable to load "+a+" ("+n+")"),f(m,null)):Dd(m,a,b,c,d,e,f)})}
function Dd(a,b,c,d,e,f,k){function m(a,f){if(f)k(f,null);else{c&&(Ga(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);k(a,f)}}a?e?Ed(a,f,m):m(a,null):k("no data"+(b?" for file: "+b:""),null)}
function Ed(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");l(e,null,!0,function(f,k,m){if(m||!k)c(a,"unable to resolve XML reference: "+d[0]+" ("+m+")");else{if(f=d[3])if(m=k.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var n=m[0],q,t=/( [a-z]+=)(['"])(.*?)\2/g;q=t.exec(f);)n=0>n.indexOf(q[1])?n.replace(">",q[0]+">"):n.replace(new RegExp(q[1]+"(['\"])(.*?)\\1"),q[0]);m[0]!=n&&(k=k.replace(m[0],n))}else{c(a,"missing <"+d[1]+"> in "+e);return}k=k.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],k);Ed(a,b,c)}})}else c(a,null)}
function Fd(a,b,c,d){function e(a){if(void 0===m){var b=k&&C(k,"machine-warning");m=b&&b[0]||k}m&&(m.innerHTML=ga(a))}function f(a){e("Error: "+a);n&&(--Bd||wa(!0));n=!1}var k,m,n=!0;Bd++;Fa[a]={};try{if(k=document.getElementById(a)){var q;if("object"==typeof resources&&(q=resources.css)){var t=document.head||document.getElementsByTagName("head")[0],J=document.createElement("style");J.type="text/css";J.styleSheet?J.styleSheet.cssText=q:J.appendChild(document.createTextNode(q));t.appendChild(J)}c||
(c="/versions/pdp11/1.30.1/components.xsl");q=function(d,m){m?Cd(c,null,null,!1,e,function(d,n){n?(Ga(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(n=m.transformNode(n))?(k.outerHTML=n,--Bd||wa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(n),(n=d.transformToFragment(m,document))?k.parentNode?(k.parentNode.replaceChild(n,k),--Bd||wa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Cd(b,a,d,!0,e,q):Dd(b,null,a,d,!1,e,q)}else f("missing machine element: "+a)}catch(Ba){f(Ba.message)}return n}window.embedPDP11=function(a,b,c,d){wa(!1);return Fd(a,b,c,d)};window.enableEvents=wa;window.sendEvent=xa;})();