Debugger improvements (dumping/setting MMU registers)

This commit is contained in:
Jeff 2016-11-16 17:44:52 -08:00 committed by Jeff Parsons
commit 2b23c86649
8 changed files with 709 additions and 473 deletions

View file

@ -243,17 +243,18 @@ CPUStatePDP11.prototype.resetCPU = function()
*/
CPUStatePDP11.prototype.resetMMU = function()
{
this.regSL = 0xff; // 177774
this.regErr = 0; // 177766
this.regPIR = 0; // 177772
this.regMMR0 = 0; // 177572
this.regMMR1 = 0; // 177574
this.regMMR2 = 0; // 177576
this.regMMR3 = 0; // 172516
this.regErr = 0; // 177766
this.regPIR = 0; // 177772
this.regSL = 0xff; // 177774
this.mmuEnable = 0; // MMU enabled for PDP11.ACCESS.READ or PDP11.ACCESS.WRITE
this.mmuLastMode = 0;
this.mmuMask = 0x3ffff;
this.lastAddr = 0; // this is queried by the Panel when it's not using its own ADDRESS register
this.lastOp = 0; // stores the PC and any auto-incs or auto-decs from the last opcode; used to update MMR1 and MMR2
this.resetTriggers();
@ -684,6 +685,17 @@ CPUStatePDP11.prototype.getPC = function()
return this.regsGen[PDP11.REG.PC];
};
/**
* getLastAddr()
*
* @this {CPUStatePDP11}
* @return {number}
*/
CPUStatePDP11.prototype.getLastAddr = function()
{
return this.lastAddr;
};
/**
* getLastPC()
*
@ -1605,8 +1617,13 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFl
newMMR0 |= (this.mmuLastMode << 5) | (this.mmuLastPage << 1);
this.assert(!(newMMR0 & ~PDP11.MMR0.UPDATE));
this.setMMR0((this.regMMR0 & ~PDP11.MMR0.UPDATE) | newMMR0);
/*
* I've decided to NOT set fAbort if MMR0 already indicates an ABORT condition,
* because otherwise we run the risk of infinitely looping; eg, we call trap(), which
* calls mapVirtualToPhysical() on the trap vector, which faults again, etc.
*/
fAbort = true;
}
fAbort = true;
}
if (!(this.regMMR0 & (PDP11.MMR0.ABORT | PDP11.MMR0.TRAP_MMU))) {
/*
@ -1999,7 +2016,7 @@ CPUStatePDP11.prototype.getVirtualAddrByMode = function(mode, reg, accessFlags)
*/
CPUStatePDP11.prototype.readWordFromPhysical = function(physicalAddress)
{
return this.bus.getWord(physicalAddress);
return this.bus.getWord(this.lastAddr = physicalAddress);
};
/**
@ -2013,7 +2030,7 @@ CPUStatePDP11.prototype.readWordFromPhysical = function(physicalAddress)
*/
CPUStatePDP11.prototype.readWordFromVirtual = function(virtualAddress)
{
return this.bus.getWord(this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.READ_WORD));
return this.bus.getWord(this.lastAddr = this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.READ_WORD));
};
/**
@ -2027,7 +2044,7 @@ CPUStatePDP11.prototype.readWordFromVirtual = function(virtualAddress)
*/
CPUStatePDP11.prototype.writeWordToPhysical = function(physicalAddress, data)
{
this.bus.setWord(physicalAddress, data & 0xffff);
this.bus.setWord(this.lastAddr = physicalAddress, data & 0xffff);
};
/**
@ -2041,7 +2058,7 @@ CPUStatePDP11.prototype.writeWordToPhysical = function(physicalAddress, data)
*/
CPUStatePDP11.prototype.writeWordToVirtual = function(virtualAddress, data)
{
this.bus.setWord(this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.WRITE_WORD), data);
this.bus.setWord(this.lastAddr = this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.WRITE_WORD), data);
};
/**

View file

@ -266,7 +266,32 @@ if (DEBUGGER) {
* Register numbers 0-7 are reserved for cpu.regsGen, 8-15 are reserved for cpu.regsAlt, and 16-19 for cpu.regsStack.
*/
DebuggerPDP11.REG_PSW = 20;
DebuggerPDP11.REG_SR = 21; // SWITCH register; see Panel's getSR() and setSR()
DebuggerPDP11.REG_PIR = 21;
DebuggerPDP11.REG_ERR = 22;
DebuggerPDP11.REG_SL = 23;
DebuggerPDP11.REG_MMR0 = 24;
DebuggerPDP11.REG_MMR1 = 25;
DebuggerPDP11.REG_MMR2 = 26;
DebuggerPDP11.REG_MMR3 = 27;
DebuggerPDP11.REG_AR = 28; // ADDRESS register; see Panel's getAR() and setAR()
DebuggerPDP11.REG_DR = 29; // DISPLAY/DATA register; see Panel's getDR() and setDR()
DebuggerPDP11.REG_SR = 30; // SWITCH register; see Panel's getSR() and setSR()
DebuggerPDP11.REGS = {
"SP": 6,
"PC": 7,
"PS": DebuggerPDP11.REG_PSW,
"IR": DebuggerPDP11.REG_PIR,
"ER": DebuggerPDP11.REG_ERR,
"SL": DebuggerPDP11.REG_SL,
"MMR0": DebuggerPDP11.REG_MMR0,
"MMR1": DebuggerPDP11.REG_MMR1,
"MMR2": DebuggerPDP11.REG_MMR2,
"MMR3": DebuggerPDP11.REG_MMR3,
"AR": DebuggerPDP11.REG_AR,
"DR": DebuggerPDP11.REG_DR,
"SR": DebuggerPDP11.REG_SR
};
/*
* Operand type masks; anything that's not covered by OP_SRC or OP_DST must be a OP_OTHER value.
@ -1118,24 +1143,14 @@ if (DEBUGGER) {
*/
DebuggerPDP11.prototype.getRegIndex = function(sReg, off)
{
var iReg = -1;
sReg = sReg.toUpperCase();
switch(sReg) {
case "SP":
iReg = 6;
break;
case "PC":
iReg = 7;
break;
case "SR":
iReg = 21;
break;
default:
var iReg = DebuggerPDP11.REGS[sReg];
if (iReg == null) {
iReg = -1;
if (sReg.charAt(0) == "R") {
iReg = +sReg.charAt(1);
if (iReg < 0 || iReg > 7) iReg = -1;
}
break;
}
return iReg;
};
@ -1156,7 +1171,7 @@ if (DEBUGGER) {
* getRegValue(iReg)
*
* Register numbers 0-7 are reserved for cpu.regsGen, 8-15 are reserved for cpu.regsAlt,
* 16-19 for cpu.regsAltStack, 20 for regPSW, and 21 for SR (SWITCH register).
* 16-19 for cpu.regsAltStack, 20 for regPSW, etc.
*
* @this {DebuggerPDP11}
* @param {number} iReg
@ -1175,11 +1190,50 @@ if (DEBUGGER) {
else if (iReg < 20) {
value = this.cpu.regsAltStack[iReg-16];
}
else if (iReg == DebuggerPDP11.REG_PSW) {
value = this.cpu.getPSW();
}
else if (iReg == DebuggerPDP11.REG_SR && this.panel && this.panel.hasSwitches()) {
value = this.panel.getSR();
else {
var cpu = this.cpu;
var panel = this.panel;
switch(iReg) {
case DebuggerPDP11.REG_PSW:
value = this.cpu.getPSW();
break;
case DebuggerPDP11.REG_PIR:
value = cpu.regPIR;
break;
case DebuggerPDP11.REG_ERR:
value = cpu.regErr;
break;
case DebuggerPDP11.REG_SL:
value = cpu.regSL;
break;
case DebuggerPDP11.REG_MMR0:
value = panel.getMMR0();
break;
case DebuggerPDP11.REG_MMR1:
value = panel.getMMR1();
break;
case DebuggerPDP11.REG_MMR2:
value = panel.getMMR2();
break;
case DebuggerPDP11.REG_MMR3:
value = panel.getMMR3();
break;
case DebuggerPDP11.REG_AR:
if (panel) {
value = panel.getAR();
}
break;
case DebuggerPDP11.REG_DR:
if (panel) {
value = panel.getDR();
}
break;
case DebuggerPDP11.REG_SR:
if (panel && panel.hasSwitches()) {
value = panel.getSR();
}
break;
}
}
}
return value;
@ -1371,6 +1425,7 @@ if (DEBUGGER) {
* is calling us in a loop, in which case it will perform its own updateDisplays() when it's done.
*/
if (fUpdateDisplays !== false) {
if (this.panel && this.panel.stop) this.panel.stop();
this.cmp.updateDisplays(-1);
}
@ -2393,28 +2448,86 @@ if (DEBUGGER) {
else if (iReg >= 16 && iReg < 20) {
sReg = "S" + (iReg - 16) + '=' + this.toStrBase(cpu.regsAltStack[iReg - 16]);
}
else if (iReg == DebuggerPDP11.REG_PSW) {
sReg = "PS=" + this.toStrBase(cpu.getPSW());
}
else if (iReg == DebuggerPDP11.REG_SR && this.panel && this.panel.hasSwitches()) {
sReg = "SR=" + this.toStrBase(this.panel.getSR(), 3);
else {
switch(iReg) {
case DebuggerPDP11.REG_PSW:
sReg = "PS=" + this.toStrBase(cpu.getPSW());
break;
case DebuggerPDP11.REG_PIR:
sReg = "IR=" + this.toStrBase(cpu.regPIR);
break;
case DebuggerPDP11.REG_ERR:
sReg = "ER=" + this.toStrBase(cpu.regErr);
break;
case DebuggerPDP11.REG_SL:
sReg = "SL=" + this.toStrBase(cpu.regSL);
break;
case DebuggerPDP11.REG_MMR0:
sReg = "MMR0=" + this.toStrBase(cpu.getMMR0());
break;
case DebuggerPDP11.REG_MMR1:
sReg = "MMR1=" + this.toStrBase(cpu.getMMR1());
break;
case DebuggerPDP11.REG_MMR2:
sReg = "MMR2=" + this.toStrBase(cpu.getMMR2());
break;
case DebuggerPDP11.REG_MMR3:
sReg = "MMR3=" + this.toStrBase(cpu.getMMR3());
break;
case DebuggerPDP11.REG_AR:
if (this.panel) {
sReg = "AR=" + this.toStrBase(this.panel.getAR(), 3);
}
break;
case DebuggerPDP11.REG_DR:
if (this.panel) {
sReg = "DR=" + this.toStrBase(this.panel.getDR());
}
break;
case DebuggerPDP11.REG_SR:
if (this.panel && this.panel.hasSwitches()) {
sReg = "SR=" + this.toStrBase(this.panel.getSR(), 3);
}
break;
}
}
if (sReg) sReg += ' ';
return sReg;
};
/**
* getRegDump()
* getMiscDump()
*
* Sample register dump:
*
* R0=xxxx R1=xxxx R2=xxxx R3=xxxx R4=xxxx R5=xxxx
* SP=xxxx PC=xxxx PS=xxxx T0 N0 Z0 V0 C0
* MMR0=xxxxxx MMR1=xxxxxx MMR2=xxxxxx MMR3=xxxxxx ER=xxxxxx
*
* @this {DebuggerPDP11}
* @return {string}
*/
DebuggerPDP11.prototype.getRegDump = function()
DebuggerPDP11.prototype.getMiscDump = function()
{
var sDump = "";
sDump += this.getRegOutput(DebuggerPDP11.REG_MMR0) + this.getRegOutput(DebuggerPDP11.REG_MMR1);
sDump += this.getRegOutput(DebuggerPDP11.REG_MMR2) + this.getRegOutput(DebuggerPDP11.REG_MMR3) + this.getRegOutput(DebuggerPDP11.REG_ERR);
sDump += '\n';
sDump += this.getRegOutput(DebuggerPDP11.REG_SR) + this.getRegOutput(DebuggerPDP11.REG_AR) + this.getRegOutput(DebuggerPDP11.REG_DR);
return sDump;
};
/**
* getRegDump(fMisc)
*
* Sample register dump:
*
* R0=xxxxxx R1=xxxxxx R2=xxxxxx R3=xxxxxx R4=xxxxxx R5=xxxxxx
* SP=xxxxxx PC=xxxxxx PS=xxxxxx IR=xxxxxx SL=xxxxxx T0 N0 Z0 V0 C0
*
* @this {DebuggerPDP11}
* @param {boolean} [fMisc] (true to include misc registers)
* @return {string}
*/
DebuggerPDP11.prototype.getRegDump = function(fMisc)
{
var i;
var sDump = "";
@ -2423,8 +2536,9 @@ if (DEBUGGER) {
}
sDump += '\n';
sDump += this.getRegOutput(PDP11.REG.SP) + this.getRegOutput(PDP11.REG.PC);
sDump += this.getRegOutput(DebuggerPDP11.REG_PSW) + this.getRegOutput(DebuggerPDP11.REG_SR);
sDump += this.getRegOutput(DebuggerPDP11.REG_PSW) + this.getRegOutput(DebuggerPDP11.REG_PIR) + this.getRegOutput(DebuggerPDP11.REG_SL);
sDump += this.getFlagOutput('T') + this.getFlagOutput('N') + this.getFlagOutput('Z') + this.getFlagOutput('V') + this.getFlagOutput('C');
if (fMisc) sDump += '\n' + this.getMiscDump();
return sDump;
};
@ -3390,77 +3504,115 @@ if (DEBUGGER) {
if (asArgs && asArgs[1] == '?') {
this.println("register commands:");
this.println("\tr\tdump registers");
this.println("\trm\tdump misc registers");
this.println("\trx [#]\tset flag or register x to [#]");
return;
}
var fMisc = false;
var cpu = this.cpu;
if (fInstruction == null) fInstruction = true;
if (asArgs != null && asArgs.length > 1) {
var sReg = asArgs[1];
var sValue = null;
var i = sReg.indexOf('=');
if (i > 0) {
sValue = sReg.substr(i + 1);
sReg = sReg.substr(0, i);
}
else if (asArgs.length > 2) {
sValue = asArgs[2];
if (sReg == 'm') {
fMisc = true;
}
else {
this.println("missing value for " + asArgs[1]);
return;
}
var w = this.parseExpression(sValue);
if (w === undefined) return;
var sRegMatch = sReg.toUpperCase();
switch (sRegMatch) {
case "SP":
case "R6":
cpu.setSP(w);
break;
case "PC":
case "R7":
cpu.setPC(w);
this.dbgAddrNextCode = this.newAddr(cpu.getPC());
break;
case "N":
if (w) cpu.setNF(); else cpu.clearNF();
break;
case "Z":
if (w) cpu.setZF(); else cpu.clearZF();
break;
case "V":
if (w) cpu.setVF(); else cpu.clearVF();
break;
case "C":
if (w) cpu.setCF(); else cpu.clearCF();
break;
case "SR":
if (this.panel && this.panel.hasSwitches()) {
this.panel.setSR(w);
break;
var sValue = null;
var i = sReg.indexOf('=');
if (i > 0) {
sValue = sReg.substr(i + 1);
sReg = sReg.substr(0, i);
}
/* falls through */
default:
if (sRegMatch.charAt(0) == 'R') {
var iReg = +sRegMatch.charAt(1);
if (iReg >= 0 && iReg < 6) {
cpu.regsGen[iReg] = w & 0xffff;
else if (asArgs.length > 2) {
sValue = asArgs[2];
}
else {
this.println("missing value for " + asArgs[1]);
return;
}
var w = this.parseExpression(sValue);
if (w === undefined) return;
var sRegMatch = sReg.toUpperCase();
switch (sRegMatch) {
case "SP":
case "R6":
cpu.setSP(w);
break;
case "PC":
case "R7":
cpu.setPC(w);
this.dbgAddrNextCode = this.newAddr(cpu.getPC());
break;
case "N":
if (w) cpu.setNF(); else cpu.clearNF();
break;
case "Z":
if (w) cpu.setZF(); else cpu.clearZF();
break;
case "V":
if (w) cpu.setVF(); else cpu.clearVF();
break;
case "C":
if (w) cpu.setCF(); else cpu.clearCF();
break;
case "PS":
cpu.setPSW(w);
break;
case "IR":
cpu.setPIR(w);
break;
case "ER":
cpu.regErr = w;
fMisc = true;
break;
case "SL":
cpu.setSL(w);
break;
case "MMR0":
cpu.setMMR0(w);
fMisc = true;
break;
case "MMR3":
cpu.setMMR3(w);
fMisc = true;
break;
case "AR":
if (this.panel) this.panel.setAR(w);
fMisc = true;
break;
case "DR":
if (this.panel) this.panel.setDR(w);
fMisc = true;
break;
case "SR":
if (this.panel && this.panel.hasSwitches()) {
this.panel.setSR(w);
fMisc = true;
break;
}
/* falls through */
default:
if (sRegMatch.charAt(0) == 'R') {
var iReg = +sRegMatch.charAt(1);
if (iReg >= 0 && iReg < 6) {
cpu.regsGen[iReg] = w & 0xffff;
break;
}
}
this.println("unknown register: " + sReg);
return;
}
this.println("unknown register: " + sReg);
return;
this.cmp.updateDisplays();
this.println("updated registers:");
}
this.cmp.updateDisplays();
this.println("updated registers:");
}
this.println(this.getRegDump());
this.println(this.getRegDump(fMisc));
if (fInstruction) {
this.dbgAddrNextCode = this.newAddr(cpu.getPC());
@ -3716,7 +3868,7 @@ if (DEBUGGER) {
* a final updateDisplays().
*/
if (dbg.panel && dbg.panel.stop) dbg.panel.stop();
dbg.cmp.updateDisplays();
dbg.cmp.updateDisplays(-1);
dbg.setBusy(false);
}
);

View file

@ -323,7 +323,7 @@ var PDP11 = {
ENABLED: 0x0001, // 000001 address relocation enabled
PAGE_NUM: 0x000E, // 000016 page number of last fault
PAGE_D: 0x0010, // 000020 last fault occurred in D space
PAGE: 0x001E, // 000176 all of the PAGE bits
PAGE: 0x001E, // 000176 (all of the PAGE bits)
MODE: 0x0060, // 000140 processor mode as of last fault
COMPLETED: 0x0080, // 000200 last instruction completed (R/O)
DSTMODE: 0x0100, // 000400 only destination mode references will be relocated (aka MAINT bit)
@ -333,7 +333,7 @@ var PDP11 = {
ABORT_RO: 0x2000, // 020000 abort: read-only
ABORT_PL: 0x4000, // 040000 abort: page length
ABORT_NR: 0x8000, // 100000 abort: non-resident
ABORT: 0xE000, // 160000
ABORT: 0xE000, // 160000 (all of the ABORT bits)
UPDATE: 0xF0FE // Includes all of: ABORT, TRAP, COMPLETED, MODE, and PAGE bits
},
MMR1: { // 177574: general purpose auto-inc/auto-dec register

View file

@ -176,6 +176,50 @@ PanelPDP11.LED = {
B22: 'B22'
};
/**
* getAR()
*
* @this {PanelPDP11}
* @return {number} (current ADDRESS register)
*/
PanelPDP11.prototype.getAR = function()
{
return this.regAddr;
};
/**
* setAR(value)
*
* @this {PanelPDP11}
* @param {number} value (new ADDRESS register)
*/
PanelPDP11.prototype.setAR = function(value)
{
this.updateAddr(this.regAddr = value);
};
/**
* getDR()
*
* @this {PanelPDP11}
* @return {number} (current DISPLAY register)
*/
PanelPDP11.prototype.getDR = function()
{
return this.regDisplay;
};
/**
* setDR(value)
*
* @this {PanelPDP11}
* @param {number} value (new DISPLAY register)
*/
PanelPDP11.prototype.setDR = function(value)
{
this.updateData(this.regDisplay = value);
};
/**
* getSR()
*
@ -1004,7 +1048,7 @@ PanelPDP11.prototype.updateDisplay = function(nUpdate)
* TODO: There is currently no mechanism for selecting regData over regDisplay;
* we are acting as if the DATASEL switch setting is locked to "DISPLAY REGISTER".
*/
this.updateAddr(nUpdate > 0 && fRunning && !fWaiting? this.cpu.getPC() : this.regAddr);
this.updateAddr(nUpdate > 0 && fRunning && !fWaiting? this.cpu.getLastAddr() : this.regAddr);
this.updateData(this.regDisplay);
var bits = this.cpu.getMMUState();

View file

@ -244,6 +244,10 @@ SerialPortPDP11.prototype.setBinding = function(sType, sBinding, control, sValue
if (event.preventDefault) event.preventDefault();
var clipboardData = event.clipboardData || window.clipboardData;
if (clipboardData) {
/*
* NOTE: Multiple lines of pasted text will (at least on macOS) contain LFs instead of CRs;
* this is dealt with in receiveData() whenever it receives a string of characters.
*/
serial.receiveData(clipboardData.getData('Text'));
}
};
@ -522,8 +526,20 @@ SerialPortPDP11.prototype.receiveData = function(data)
this.abReceive.push(data);
}
else if (typeof data == "string") {
var b = 0, bPrev;
for (var i = 0; i < data.length; i++) {
this.abReceive.push(data.charCodeAt(i));
bPrev = b;
b = data.charCodeAt(i);
/*
* NOTE: Multiple lines of pasted text will (at least on macOS) contain LFs instead of CRs;
* we convert them to CRs below. Windows may do something different, but in the worst case,
* even if we receive CR/LF pairs, this code should keep the CRs and lose the LFs.
*/
if (b == str.ASCII.LF) {
if (bPrev == str.ASCII.CR) continue;
b = str.ASCII.CR;
}
this.abReceive.push(b);
}
}
else {

View file

@ -551,6 +551,10 @@ str.trim = function(s)
/*
* Any codes commented out in the following table are deemed "printable"
*/
str.ASCII = {
LF: 0x0A,
CR: 0x0D
};
str.aASCIICodes = {
0x00: "NUL",
0x01: "SOH", // (CTRL_A) Start of Heading

View file

@ -31,294 +31,297 @@
http://pcjs.org/modules/pdp11/lib/computer.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016
*/
for(var k,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,ca=["Math","log2"],da=0;da<ca.length-1;da++){var ea=ca[da];ea in ba||(ba[ea]={});ba=ba[ea]}var ga=ca[ca.length-1],ha=ba[ga],ia=ha?ha:function(a){return Math.log(a)/Math.LN2};
ia!=ha&&null!=ia&&aa(ba,ga,{configurable:!0,writable:!0,value:ia});var ka={163840:[40,1,8,,254],184320:[40,1,9,,252],327680:[40,2,8,,255],368640:[40,2,9,,253],737280:[80,2,9,,249],1228800:[80,2,15,,249],1474560:[80,2,18,,240],2949120:[80,2,36,,240],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]};
function la(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function qa(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function p(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
function ra(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function sa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ta(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ua={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function va(a){return a.replace(/[&<>"']/g,function(a){return ua[a]})}
function wa(a,b){return(a+" ").slice(0,b)}function xa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var ya={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
function za(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var Aa=Date.now||function(){return+new Date};function Ba(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function Da(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
for(var k,ba="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ca="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,da=["Math","log2"],ea=0;ea<da.length-1;ea++){var fa=da[ea];fa in ca||(ca[fa]={});ca=ca[fa]}var ha=da[da.length-1],ia=ca[ha],ja=ia?ia:function(a){return Math.log(a)/Math.LN2};
ja!=ia&&null!=ja&&ba(ca,ha,{configurable:!0,writable:!0,value:ja});var la={163840:[40,1,8,,254],184320:[40,1,9,,252],327680:[40,2,8,,255],368640:[40,2,9,,253],737280:[80,2,9,,249],1228800:[80,2,15,,249],1474560:[80,2,18,,240],2949120:[80,2,36,,240],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]};
function ma(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function ra(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function p(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
function sa(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function ta(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ua(a,b){return-1!==a.indexOf(b,a.length-b.length)}var va={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function wa(a){return a.replace(/[&<>"']/g,function(a){return va[a]})}
function xa(a,b){return(a+" ").slice(0,b)}function ya(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var za={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
function Aa(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var Ba=Date.now||function(){return+new Date};function Ca(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function Ea(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(l)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g}
function Ea(a,b){var c,d={ea:null,ga:null,Na:null,Ma:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Na=g.load;d.Ma=g.exec;if(e=g.bytes)d.ea=e;else if(e=g.words)for(d.ea=Array(2*e.length),f=c=0;c<e.length;c++)d.ea[f++]=e[c]&255,d.ea[f++]=e[c]>>8&255;else if(e=g.data)for(d.ea=Array(4*e.length),f=c=0;c<e.length;c++)d.ea[f++]=
function Fa(a,b){var c,d={ea:null,ga:null,Oa:null,Na:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Oa=g.load;d.Na=g.exec;if(e=g.bytes)d.ea=e;else if(e=g.words)for(d.ea=Array(2*e.length),f=c=0;c<e.length;c++)d.ea[f++]=e[c]&255,d.ea[f++]=e[c]>>8&255;else if(e=g.data)for(d.ea=Array(4*e.length),f=c=0;c<e.length;c++)d.ea[f++]=
e[c]&255,d.ea[f++]=e[c]>>8&255,d.ea[f++]=e[c]>>16&255,d.ea[f++]=e[c]>>24&255;else d.ea=g;d.ga=g.symbols;d.ea.length?1==d.ea.length&&(q(d.ea[0]),d=null):(q("Empty resource: "+a),d=null)}catch(h){q("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){q("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.ea=e)}return d}
function Fa(){return"http://"+(window?window.location.host:"www.pcjs.org")}function q(a){window&&window.alert(a)}function Ga(a){var b=!1;window&&(b=window.confirm(a));return b}var Ha=null;function Ia(){if(null==Ha){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ha=a}return Ha}
function Ja(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function La(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ra(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 Sa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Ta(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 Ua={init:[],show:[],exit:[]},Va=!1,Wa=!1,Xa=!0;function Ya(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Za(a){Ua.init.push(a)}
function $a(a){if(Xa)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 ab(a){!Xa&&a?(Xa=!0,Va&&bb("init"),Wa&&bb("show")):Xa=a}function bb(a){Ua[a]&&$a(Ua[a])}Ya("onload",function(){Va=!0;$a(Ua.init)});Ya("onpageshow",function(){Wa=!0;$a(Ua.show)});Ya(Ra("Opera")||Ra("iOS")?"onunload":"onbeforeunload",function(){$a(Ua.exit)});
function t(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.yc=b.comment;this.Yc=b;b=this.id.indexOf(".");0>b?this.Za=this.id:(this.Sa=this.id.substr(0,b),this.Za=this.id.substr(b+1));this[a]=c;this.w={ready:!1,bb:!1,ac:!1,ha:!1,error:!1};this.Tb=null;this.w.error=!1;this.G={};this.i=null;this.ka=d||0;u.push(this)}var cb=void 0,db={};
if(window){cb||(cb=window.location.search.substr(1));for(var eb,fb=/\+/g,gb=/([^&=]+)=?([^&]*)/g;eb=gb.exec(cb);)db[decodeURIComponent(eb[1].replace(fb," "))]=decodeURIComponent(eb[2].replace(fb," "))}function hb(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 z(a,b){b||(b=t);a.prototype=hb(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var pb=window.PCjs.Machines||(window.PCjs.Machines={}),u=window.PCjs.Components||(window.PCjs.Components=[])}else pb={},u=[];function qb(a,b,c){pb[a]&&b&&(pb[a][b]=c)}function rb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<u.length;b++){var d=u[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function sb(a){if(void 0!==a){var b;for(b=0;b<u.length;b++)if(u[b].id===a)return u[b]}return null}function tb(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<u.length;d++)if(c)c==u[d]&&(c=null);else if(!(a!=u[d].type||b&&u[d].id.indexOf(b)))return u[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=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),l=0;l<h.length;l++)switch(g=h[l],g){case "pdp11-binding":(g=A(f))&&g.binding&&a.sa(g.type,g.binding,f,g.value),l=h.length}}}}
function Ga(){return"http://"+(window?window.location.host:"www.pcjs.org")}function q(a){window&&window.alert(a)}function Ha(a){var b=!1;window&&(b=window.confirm(a));return b}var Ia=null;function Ja(){if(null==Ia){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ia=a}return Ia}
function Ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Ma(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Sa(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 Ta(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Ua(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 Va={init:[],show:[],exit:[]},Wa=!1,Xa=!1,Ya=!0;function Za(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function $a(a){Va.init.push(a)}
function ab(a){if(Ya)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 bb(a){!Ya&&a?(Ya=!0,Wa&&cb("init"),Xa&&cb("show")):Ya=a}function cb(a){Va[a]&&ab(Va[a])}Za("onload",function(){Wa=!0;ab(Va.init)});Za("onpageshow",function(){Xa=!0;ab(Va.show)});Za(Sa("Opera")||Sa("iOS")?"onunload":"onbeforeunload",function(){ab(Va.exit)});
function t(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Bc=b.comment;this.ad=b;b=this.id.indexOf(".");0>b?this.ab=this.id:(this.Ua=this.id.substr(0,b),this.ab=this.id.substr(b+1));this[a]=c;this.A={ready:!1,eb:!1,ec:!1,ha:!1,error:!1};this.Yb=null;this.A.error=!1;this.G={};this.i=null;this.ka=d||0;u.push(this)}var db=void 0,eb={};
if(window){db||(db=window.location.search.substr(1));for(var fb,gb=/\+/g,hb=/([^&=]+)=?([^&]*)/g;fb=hb.exec(db);)eb[decodeURIComponent(fb[1].replace(gb," "))]=decodeURIComponent(fb[2].replace(gb," "))}function ib(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 z(a,b){b||(b=t);a.prototype=ib(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var qb=window.PCjs.Machines||(window.PCjs.Machines={}),u=window.PCjs.Components||(window.PCjs.Components=[])}else qb={},u=[];function rb(a,b,c){qb[a]&&b&&(qb[a][b]=c)}function sb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<u.length;b++){var d=u[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function tb(a){if(void 0!==a){var b;for(b=0;b<u.length;b++)if(u[b].id===a)return u[b]}return null}function ub(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<u.length;d++)if(c)c==u[d]&&(c=null);else if(!(a!=u[d].type||b&&u[d].id.indexOf(b)))return u[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=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),l=0;l<h.length;l++)switch(g=h[l],g){case "pdp11-binding":(g=A(f))&&g.binding&&a.ua(g.type,g.binding,f,g.value),l=h.length}}}}
function D(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
t.prototype={constructor:t,parent:null,toString:function(){return this.name?this.name:this.id||this.type},sa:function(a,b,c){switch(b){case "clear":return this.G[b]||(this.G[b]=c,c.onclick=function(a){return function(){a.G.print&&(a.G.print.value="")}}(this)),!0;case "print":return this.G[b]||(this.Ta=this.G[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.P=function(a){this.j(a,this.Za)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.Za+": "+a)},P:function(a,b,c){c=c||this.type;b||q((c?c+": ":"")+a)},Ia:function(){return this.w.ha=!0},Ha:function(a,b){b&&(this.w.ha=!1);return!0}};function E(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.ka;var c=a.i.ka&b;return!!b&&c===b||!!(c&a.i.Qc)}return!1}
function ub(a,b){if(a.w.ac)return a.w.bb=!1,a.w.ac=!1;if(a.w.error)return a.j(a.toString()+" error"),!1;a.w.bb=b;return a.w.bb}function vb(a,b){a.w.bb&&(b?a.w.ac=!0:void 0===b&&a.j(a.toString()+" busy"));return a.w.bb}function H(a,b){a.w.error||(a.w.ready=!1!==b,a.w.ready&&(b=a.Tb,a.Tb=null,b&&b()))}function wb(a,b){b&&(a.w.ready?b():a.Tb=b);return a.w.ready}function xb(a){return a.w.error?(a.j(a.toString()+" error"),!0):!1}function yb(a,b){a.w.error=!0;a.P(b)}
t.prototype={constructor:t,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ua:function(a,b,c){switch(b){case "clear":return this.G[b]||(this.G[b]=c,c.onclick=function(a){return function(){a.G.print&&(a.G.print.value="")}}(this)),!0;case "print":return this.G[b]||(this.Va=this.G[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.P=function(a){this.j(a,this.ab)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.ab+": "+a)},P:function(a,b,c){c=c||this.type;b||q((c?c+": ":"")+a)},Ka:function(){return this.A.ha=!0},Ja:function(a,b){b&&(this.A.ha=!1);return!0}};function E(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.ka;var c=a.i.ka&b;return!!b&&c===b||!!(c&a.i.Tc)}return!1}
function vb(a,b){if(a.A.ec)return a.A.eb=!1,a.A.ec=!1;if(a.A.error)return a.j(a.toString()+" error"),!1;a.A.eb=b;return a.A.eb}function wb(a,b){a.A.eb&&(b?a.A.ec=!0:void 0===b&&a.j(a.toString()+" busy"));return a.A.eb}function H(a,b){a.A.error||(a.A.ready=!1!==b,a.A.ready&&(b=a.Yb,a.Yb=null,b&&b()))}function xb(a,b){b&&(a.A.ready?b():a.Yb=b);return a.A.ready}function yb(a){return a.A.error?(a.j(a.toString()+" error"),!0):!1}function zb(a,b){a.A.error=!0;a.P(b)}
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
var zb="undefined"!==typeof ArrayBuffer,Ab="UNKNOWN ABORT ILLEGAL RED YELLOW FAULT TRACE HALT OPCODE INTERRUPT".split(" "),Bb={cpu:1,trap:16,fault:32,bus:64,memory:128,rom:256,device:512,panel:1024,keyboard:65536,key:131072,paper:1048576,disk:4194304,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};
function Cb(a){t.call(this,"Panel",a,Cb,1024);this.f=this.B=this.Wa=this.D=this.H=this.I=0;this.L=this.M=this.K=!1;this.O=Db;this.A={};this.g={START:[1,1,!0,!1,this.ed],STEP:[1,1,!1,!1,this.fd],ENABLE:[1,1,!1,!1,this.ad],CONT:[1,1,!0,!1,this.Zc],DEP:[0,0,!0,!1,this.$c],EXAM:[1,1,!0,!1,this.bd],LOAD:[1,1,!0,!1,this.dd],TEST:[0,0,!0,!1,this.cd]};for(a=0;22>a;a++)this.g["S"+a]=[0,0,!1,!1,this.gd,a]}z(Cb);var Db=7;function Eb(a,b){return a.g[b]&&a.g[b][1]}k=Cb.prototype;k.reset=function(){this.stop()};
k.sa=function(a,b,c,d){if(this.C&&this.C.sa(a,b,c,d)||this.b&&this.b.sa(a,b,c,d)||this.i&&this.i.sa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.G[b]=c,this.I++,!0;default:return"led"==a||"rled"==a?(this.G[b]=c,this.A[b]=d?1:0,this.I++,!0):"switch"==a?(void 0===this.g[b]&&(this.g[b]=[d?1:0,d?1:0]),this.G[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,
b){return function(){Fb(a,b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){Gb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){Fb(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){Gb(a,b)}}(this,b),!0):this.parent.sa.call(this,a,b,c,d)}};k.Ga=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;Hb(b,this,Ib);Jb(b,this.reset.bind(this));Kb(this);Lb(this)};k.Ia=function(a,b){b||(Mb(),this.reset());return!0};k.Ha=function(){return!0};
function Nb(a,b,c){if(a=a.G[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function Kb(a,b){for(var c in a.A)Nb(a,c,null!=b?b:a.A[c])}function Ob(a,b,c){if(a=a.G[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function Lb(a){for(var b in a.g)Ob(a,b,a.g[b][1])}function Pb(a,b,c,d){a.G[b]&&(void 0===c&&(yb(a,"Value for "+b+" is invalid"),a.b.da()),c=8==(a.i&&a.i.ca||8)?qa(c,d):p(c,d),a.G[b].textContent!=c&&(a.G[b].textContent=c))}
function Fb(a,b){var c=a.g[b];Ob(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.L="DEP"==b,a.M="EXAM"==b)}function Gb(a,b){var c=a.g[b];c[2]&&c[3]&&(Ob(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}k.ed=function(a){a||this.b.w.W||(a=this.b,a.v.reset(),bc(a),Eb(this,"ENABLE")&&this.b.ib())};k.fd=function(){};k.ad=function(a){a||this.b.da()};
k.Zc=function(a){if(!a&&!this.b.w.W)if(Eb(this,"ENABLE"))this.b.ib();else{if((a=this.i)&&!vb(a,!0))ub(a,!0),a.jb(0,null),ub(a,!1);else try{var b=this.b.jb(1);0<b&&(cc(this.b,b),dc(this.b,b,!0),ec(this.b,b))}catch(c){"number"!=typeof c&&yb(this.b,c.stack||c.message)}this.stop();this.C&&this.C.pa()}};k.$c=function(a){a&&!this.b.w.W&&(this.L&&fc(this),a=gc(this,this.Wa),this.O==Db?this.v.Cb(this.f,a):this.b.Cb(this.f,a))};
k.bd=function(a){a||this.b.w.W||(this.M&&fc(this),a=this.O==Db?this.v.cb(this.f):this.b.cb(this.f),gc(this,a))};k.dd=function(a){a||this.b.w.W||hc(this,this.Wa)};k.cd=function(a){a?(this.K=!0,Kb(this,!0)):(this.K=!1,Kb(this),ic(this,0))};k.gd=function(a,b){this.Wa=a?this.Wa|1<<b:this.Wa&~(1<<b)};function fc(a){var b=1145>a.b.Va?8:16,c=65472<=a.f&&a.f<65472+b,b=c?1:2,c=c?15:a.v.Pa;Eb(a,"STEP")||(b=-b);hc(a,a.f&~c|a.f+b&c)}
function hc(a,b){a.f=b&a.v.Pa;b=a.f;for(var c=0;22>c;c++)jc(a,"A"+c,b&1<<c)}function gc(a,b){a.B=b&65535;b=a.B;for(var c=0;16>c;c++)jc(a,"D"+c,b&1<<c);return a.B}function jc(a,b,c){a.A[b]=c;a.K||Nb(a,b,c)}function kc(a){return void 0!==a.G.S0}function ic(a,b){if(kc(a)){a.Wa=b;for(var c=0;22>c;c++)a.g["S"+c][1]=b&1<<c?1:0;Lb(a)}}k.stop=function(){hc(this,this.b.u[7])};k.kc=function(a){this.f=a};k.setData=function(a,b){b?this.D=a:this.B=a};k.kd=function(a){return(a?this.Wa:this.D)&65535};
k.ee=function(a){this.D=a};var lc={},Ib=(lc[65400]=[null,null,Cb.prototype.kd,Cb.prototype.ee,"CNSW"],lc);function Mb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=sb(e.id);f||(a=!0,f=new Cb(e));B(f,d);a&&H(f)}}Za(Mb);
function mc(a,b,c){t.call(this,"Bus",a,mc,64);this.b=b;this.i=c;this.K=a.busWidth||16;this.C=0;this.A=[];this.g=null;this.H=1<<this.K;this.Pa=this.H-1;this.za=nc;this.ja=Math.log2(this.za);this.I=this.za>>2;this.v=this.za-1;this.D=this.H/this.za|0;this.ab=[];this.la=0;this.f=!1;this.cc=0;this.B=[];this.Nc=[oc,pc,qc,rc];a=new I(this);sc(a,this.i);this.Y=Array(this.D);for(b=0;b<this.D;b++)this.Y[b]=a;H(this)}z(mc);var nc=8192,tc=nc-1;
function oc(a,b){var c=-1,d=this.controller,e=d.ab[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.ab[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return this.i&&F(this.i,e[5])&&E(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!d.la),c;d.Fa(b,16,3);c=255;this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!d.la);return c}
function pc(a,b,c){var d=!1,e=this.controller,f=e.ab[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.ab[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d?this.i&&F(this.i,f[5])&&E(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!e.la):(e.Fa(c,16,5),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),
!0,!e.la))}function qc(a,b){var c=-1,d=this.controller;a=d.ab[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return this.i&&F(this.i,a[5])&&E(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!d.la),c;d.Fa(b,16,2);c=65535;this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!d.la);return c}
function rc(a,b,c){var d=!1,e=this.controller;a=e.ab[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d?this.i&&F(this.i,a[5])&&E(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!e.la):(e.Fa(c,16,4),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!e.la))}
function uc(a,b){if(b!=a.C){var c;a.C&&(c=(1<<a.C)-nc,vc(a,c,nc,a.A),a.C=0);b&&(a.C=b,c=1<<b,a.Pa=c-1,c-=nc,a.A=wc(a,c,nc),a.g?vc(a,c,nc,a.g):(xc(a,c,nc,yc,a),a.g=wc(a,c,nc)))}}k=mc.prototype;k.reset=function(){for(var a=0;a<this.B.length;a++)this.B[a]();uc(this,16)};k.Ia=function(a,b){b||this.reset();return!0};
function xc(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ja;0<g&&h<a.Y.length;){var l=a.Y[h],m=h*a.za,n=a.za-(f-m);n>g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.F)return l.Pb+=l.F-f,l.F=f,!0;if(f>=l.F+l.Pb){n=l.size-(f-m);n>g&&(n=g);l.Pb=f-l.F+n;f=m+a.za;g-=n;h++;continue}}return zc(1,f,g)}f=new I(a,f,n,a.za,d,e);sc(f,a.i,l);a.Y[h++]=f;f=m+a.za;g-=n}return 0>=g?(d==Ac&&(a.cc+=c),a.status((c>>10)+"Kb "+Bc[d]+" at "+qa(b)),!0):zc(2,b,c)}
function wc(a,b,c){var d=[];for(b>>>=a.ja;0<c&&b<a.Y.length;)d.push(a.Y[b++]),c-=a.za;return d}function vc(a,b,c,d){var e=0;for(b>>>=a.ja;0<c&&b<a.Y.length;){var f=d[e++];if(!f)break;a.Y[b++]=f;c-=a.za}}k.Ib=function(a){3932160<=a&&(a=Cc(this.b,a));return this.Y[(a&this.Pa)>>>this.ja].Vb(a&this.v,a)};k.Ub=function(a){3932160<=a&&(a=Cc(this.b,a));this.f=!1;this.la++;a=this.Y[(a&this.Pa)>>>this.ja].hc(a&this.v,a);this.la--;return a};
k.na=function(a){3932160<=a&&(a=Cc(this.b,a));return this.Y[(a&this.Pa)>>>this.ja].ra(a&this.v,a)};k.cb=function(a){3932160<=a&&(a=Cc(this.b,a));var b=a&this.v,c=(a&this.Pa)>>>this.ja;this.f=!1;this.la++;a=this.Y[c].ic(b,a);this.la--;return a};k.Bb=function(a,b){3932160<=a&&(a=Cc(this.b,a));this.Y[(a&this.Pa)>>>this.ja].Zb(a&this.v,b&255,a)};k.qb=function(a,b){3932160<=a&&(a=Cc(this.b,a));this.f=!1;this.la++;this.Y[(a&this.Pa)>>>this.ja].$b(a&this.v,b&255,a);this.la--};
k.hb=function(a,b){3932160<=a&&(a=Cc(this.b,a));this.Y[(a&this.Pa)>>>this.ja].Qb(a&this.v,b&65535,a)};k.Cb=function(a,b){3932160<=a&&(a=Cc(this.b,a));var c=a&this.v,d=(a&this.Pa)>>>this.ja;this.f=!1;this.la++;this.Y[d].mc(c,b&65535,a);this.la--};
function Dc(a){for(var b=0,c=[],d=0;d<a.D;d++){var e=a.Y[d];if(e.Ua||e.Sc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,l=[];g<e.length;){for(var m=e[g],n=g+1;n<e.length&&e[n]===m;)n++;l[h++]=n-g;l[h++]=m;g=n}l.length<e.length&&(e=l)}c[f]=e}}return c}function Ec(a,b,c,d,e,f,g,h,l){for(;b<=c;b+=2){var m=b&tc;if(void 0!==a.ab[m])return q("I/O address already registered: "+p(b,8,!0)),!1;a.ab[m]=[d,e,f,g,l||"unknown",h,!1]}return!0}
function Hb(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[6]&&f[6]>a.b.Va)){var g=f[0]?f[0].bind(b):null,h=f[1]?f[1].bind(b):null,l=f[2]?f[2].bind(b):null,m=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&l&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(l)),!h&&m&&(h=function(a){return function(b,c){return a(b,c)}.bind(b)}(m)));for(var n=f[4],v=f[5]||1,r=0;r<v;r++,e+=2)if(n&&1<v&&(n=f[4]+r),!Ec(a,e,e,g,h,l,m,b.ka||64,n||b.Za))return!1}}return!0}function Jb(a,b){a.B.push(b)}
k.Fa=function(a,b,c){this.f=!0;this.la||(this.i&&F(this.i,32)&&E(this.i,"memory fault ("+c+") on "+J(this.i,a),!0,!0),b&&(this.b.Ja|=b),this.b.ta(4,0,a))};function Fc(a){var b=a.f;a.f=!1;return b}function zc(a,b,c){q("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}function K(a){t.call(this,"Device",a,K,512);this.f={fa:0,lc:-1}}z(K);k=K.prototype;
k.Ga=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.i=d;var e=this;this.f.lc=Gc(c,function(){e.f.Kb|=128;e.f.Kb&64&&Hc(e.b,e.f.ce);e.C&&e.C.pa(1);Pc(e.b,e.f.lc,1E3/60)});this.f.ce=Qc(64,6);Hb(b,this,Rc);Jb(b,this.reset.bind(this));H(this)};k.reset=function(){this.f.Kb=128;Pc(this.b,this.f.lc,1E3/60,!0)};k.sd=function(){return this.f.Kb};k.me=function(a){this.f.Kb=a&192};k.ud=function(){var a=this.b;return a.Ba&-3199|a.$a<<5|a.lb<<1};k.oe=function(a){Sc(this.b,a&-129|this.b.Ba&128)};
k.vd=function(){var a=this.b;a.Ba&57344||(a.Hb=a.oa>>16&65535);a=a.Hb;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.wd=function(){var a=this.b;a.Ba&57344||(a.Jb=a.oa&65535);return a.Jb};k.xd=function(){return this.b.fb};k.pe=function(a){var b=this.b;1170>b.Va&&(a&=-49);b.fb!=a&&(b.fb=a,b.Ca=a&16?4194303:262143,Tc(b))};k.Yd=function(a){a=a>>1&63;var b=this.b.Ob[a>>1];return a&1?b>>16:b&65535};
k.Qe=function(a,b){b=b>>1&63;var c=b>>1;this.b.Ob[c]=b&1?this.b.Ob[c]&65535|(a&63)<<16:this.b.Ob[c]&-65536|a&65534};k.Rd=function(a){return this.b.V[1][a>>1&7]};k.Je=function(a,b){this.b.V[1][b>>1&7]=a&65295};k.Pd=function(a){return this.b.V[1][(a>>1&7)+8]};k.He=function(a,b){this.b.V[1][(b>>1&7)+8]=a&65295};k.Qd=function(a){return this.b.ya[1][a>>1&7]};k.Ie=function(a,b){b=b>>1&7;this.b.ya[1][b]=a;this.b.V[1][b]&=65295};k.Od=function(a){return this.b.ya[1][(a>>1&7)+8]};
k.Ge=function(a,b){b=(b>>1&7)+8;this.b.ya[1][b]=a;this.b.V[1][b]&=65295};k.rd=function(a){return this.b.V[0][a>>1&7]};k.le=function(a,b){this.b.V[0][b>>1&7]=a&65295};k.pd=function(a){return this.b.V[0][(a>>1&7)+8]};k.je=function(a,b){this.b.V[0][(b>>1&7)+8]=a&65295};k.qd=function(a){return this.b.ya[0][a>>1&7]};k.ke=function(a,b){b=b>>1&7;this.b.ya[0][b]=a;this.b.V[0][b]&=65295};k.od=function(a){return this.b.ya[0][(a>>1&7)+8]};k.ie=function(a,b){b=(b>>1&7)+8;this.b.ya[0][b]=a;this.b.V[0][b]&=65295};
k.Xd=function(a){return this.b.V[3][a>>1&7]};k.Pe=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.Vd=function(a){return this.b.V[3][(a>>1&7)+8]};k.Ne=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.Wd=function(a){return this.b.ya[3][a>>1&7]};k.Oe=function(a,b){b=b>>1&7;this.b.ya[3][b]=a;this.b.V[3][b]&=65295};k.Ud=function(a){return this.b.ya[3][(a>>1&7)+8]};k.Me=function(a,b){b=(b>>1&7)+8;this.b.ya[3][b]=a;this.b.V[3][b]&=65295};k.zb=function(a){a&=7;return this.b.N&2048?this.b.Xa[a]:this.b.u[a]};
k.Db=function(a,b){b&=7;this.b.N&2048?this.b.Xa[b]=a:this.b.u[b]=a};k.Cd=function(){return this.b.N&49152?this.b.Ka[0]:this.b.u[6]};k.ue=function(a){this.b.N&49152?this.b.Ka[0]=a:this.b.u[6]=a};k.Fd=function(){return this.b.u[7]};k.xe=function(a){this.b.u[7]=a};k.Ab=function(a){a&=7;return this.b.N&2048?this.b.u[a]:this.b.Xa[a]};k.Eb=function(a,b){b&=7;this.b.N&2048?this.b.u[b]=a:this.b.Xa[b]=a};k.Dd=function(){return 1==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ka[1]};
k.ve=function(a){1==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.Ka[1]=a};k.Ed=function(){return 3==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ka[3]};k.we=function(a){3==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.Ka[3]=a};k.md=function(a){return this.b.Gc[a-65504>>1]};k.ge=function(a,b){this.b.Gc[b-65504>>1]=a};k.Dc=function(a){if(65520==a){a=0;switch(Ac){case Ac:a=this.v.cc}a=(a>>6)-1}else a=0;return a};k.Kc=function(){};k.Td=function(){return 1};k.Le=function(){};k.ld=function(){return this.b.Ja};
k.fe=function(){this.b.Ja=0};k.td=function(){return this.b.Fc};k.ne=function(a,b){b&1||(a&=255);this.b.Fc=a};k.yd=function(a){return a?this.b.jc:0};k.qe=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.jc=a;b.J|=2};k.Sd=function(a){return a?this.b.Xb&65280:0};k.Ke=function(a){this.b.Xb=a|255};k.Bd=function(){return Uc(this.b)};k.te=function(a){Vc(this.b,a&-1793|Uc(this.b)&1792);this.b.J|=128};k.Jc=function(a,b){F(this)&&E(this,"writeIgnored("+qa(b)+"): "+qa(a),!0,!0)};
var L={},Rc=(L[61568]=[null,null,K.prototype.Yd,K.prototype.Qe,"UNIMAP",64,1170],L[62592]=[null,null,K.prototype.Rd,K.prototype.Je,"SIPDR",8,1145],L[62608]=[null,null,K.prototype.Pd,K.prototype.He,"SDPDR",8,1145],L[62624]=[null,null,K.prototype.Qd,K.prototype.Ie,"SIPAR",8,1145],L[62640]=[null,null,K.prototype.Od,K.prototype.Ge,"SDPAR",8,1145],L[62656]=[null,null,K.prototype.rd,K.prototype.le,"KIPDR",8,1145],L[62672]=[null,null,K.prototype.pd,K.prototype.je,"KDPDR",8,1145],L[62688]=[null,null,K.prototype.qd,
K.prototype.ke,"KIPAR",8,1145],L[62704]=[null,null,K.prototype.od,K.prototype.ie,"KDPAR",8,1145],L[62798]=[null,null,K.prototype.xd,K.prototype.pe,"MMR3",1,1145],L[65382]=[null,null,K.prototype.sd,K.prototype.me,"LKS"],L[65402]=[null,null,K.prototype.ud,K.prototype.oe,"MMR0",1,1145],L[65404]=[null,null,K.prototype.vd,K.prototype.Jc,"MMR1",1,1145],L[65406]=[null,null,K.prototype.wd,K.prototype.Jc,"MMR2",1,1145],L[65408]=[null,null,K.prototype.Xd,K.prototype.Pe,"UIPDR",8,1145],L[65424]=[null,null,K.prototype.Vd,
K.prototype.Ne,"UDPDR",8,1145],L[65440]=[null,null,K.prototype.Wd,K.prototype.Oe,"UIPAR",8,1145],L[65456]=[null,null,K.prototype.Ud,K.prototype.Me,"UDPAR",8,1145],L[65472]=[null,null,K.prototype.zb,K.prototype.Db,"R0SET0"],L[65473]=[null,null,K.prototype.zb,K.prototype.Db,"R1SET0"],L[65474]=[null,null,K.prototype.zb,K.prototype.Db,"R2SET0"],L[65475]=[null,null,K.prototype.zb,K.prototype.Db,"R3SET0"],L[65476]=[null,null,K.prototype.zb,K.prototype.Db,"R4SET0"],L[65477]=[null,null,K.prototype.zb,K.prototype.Db,
"R5SET0"],L[65478]=[null,null,K.prototype.Cd,K.prototype.ue,"R6KERNEL"],L[65479]=[null,null,K.prototype.Fd,K.prototype.xe,"R7KERNEL"],L[65480]=[null,null,K.prototype.Ab,K.prototype.Eb,"R0SET1",1,1145],L[65481]=[null,null,K.prototype.Ab,K.prototype.Eb,"R1SET1",1,1145],L[65482]=[null,null,K.prototype.Ab,K.prototype.Eb,"R2SET1",1,1145],L[65483]=[null,null,K.prototype.Ab,K.prototype.Eb,"R3SET1",1,1145],L[65484]=[null,null,K.prototype.Ab,K.prototype.Eb,"R4SET1",1,1145],L[65485]=[null,null,K.prototype.Ab,
K.prototype.Eb,"R5SET1",1,1145],L[65486]=[null,null,K.prototype.Dd,K.prototype.ve,"R6SUPER",1,1145],L[65487]=[null,null,K.prototype.Ed,K.prototype.we,"R6USER",1,1145],L[65504]=[null,null,K.prototype.md,K.prototype.ge,"CTRL",8,1170],L[65520]=[null,null,K.prototype.Dc,K.prototype.Kc,"LSIZE",1,1170],L[65522]=[null,null,K.prototype.Dc,K.prototype.Kc,"HSIZE",1,1170],L[65524]=[null,null,K.prototype.Td,K.prototype.Le,"SYSID",1,1170],L[65526]=[null,null,K.prototype.ld,K.prototype.fe,"CPUERR",1,1170],L[65528]=
[null,null,K.prototype.td,K.prototype.ne,"MB",1,1170],L[65530]=[null,null,K.prototype.yd,K.prototype.qe,"PIR"],L[65532]=[null,null,K.prototype.Sd,K.prototype.Ke,"SL"],L[65534]=[null,null,K.prototype.Bd,K.prototype.te,"PSW"],L);Za(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=A(d);switch(c.type){case "default":c=new K(c);B(c,d);break;case "pc11":c=new Wc(c);B(c,d);break;case "rl11":c=new M(c),B(c,d)}}});var Xc;
if(zb){var Yc=new ArrayBuffer(2);(new DataView(Yc)).setUint16(0,256,!0);Xc=256===(new Uint16Array(Yc))[0]}else Xc=!1;var Zc=Xc;
function I(a,b,c,d,e,f){this.v=a;this.id=$c+=2;this.b=null;this.F=b;this.Pb=c;this.size=d||0;this.type=e||ad;this.f=e==bd;this.controller=null;sc(this);this.Ua=this.Sc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],cd(this,f.Nc);else if(zb)this.B=new ArrayBuffer(this.size),this.D=new DataView(this.B,0,this.size),this.G=new Uint8Array(this.B,0,this.size),this.I=new Uint16Array(this.B,0,this.size>>1),this.b=new Int32Array(this.B,0,this.size>>2),cd(this,Zc?dd:ed);else{a=this.b=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;cd(this,fd)}else cd(this)}var ad=0,Ac=1,bd=2,yc=4,Bc=["NONE","RAM","ROM","VID","H/W"],$c=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(zb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.D.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(zb)for(b=0;b<a.length;b++)this.D.setInt32(b<<2,a[b],!0);else this.b=a;return this.Ua=!0}return!1},nb:function(a,b){b?this.C++||gd(this,hd,!1):this.g++||id(this,hd,!1)},K:function(a,b){this.i&&F(this.i,128)&&E(this.i,
"attempt to read invalid address "+J(this.i,b),!0);this.v.Fa(b,32,2);return 255},A:function(a,b,c){this.i&&F(this.i,128)&&E(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0);this.v.Fa(c,32,4)},L:function(a,b){return this.Vb(a++,b++)|this.Vb(a,b)<<8},H:function(a,b,c){this.Zb(a++,b&255,c++);this.Zb(a,b>>8,c)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ca:function(a,b){a&1&&this.v.Fa(b,64,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+
1]&255)<<8},ua:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Ua=!0},La:function(a,b,c){a&1&&this.v.Fa(c,64,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Ua=!0},O:function(a,b){if(this.i&&null!=this.F){var c=this.i;jd(c,this.F+a,1,c.M)&&c.da(!0)}return this.hc(a,b)},Sa:function(a,b){if(this.i&&null!=this.F){var c=this.i;jd(c,this.F+a,2,c.M)&&c.da(!0)}return this.ic(a,b)},Za:function(a,
b,c){if(this.i&&null!=this.F){var d=this.i;jd(d,this.F+a,1,d.D)&&d.da(!0)}this.f?this.A(a,b,c):this.$b(a,b,c)},xa:function(a,b,c){if(this.i&&null!=this.F){var d=this.i;jd(d,this.F+a,2,d.D)&&d.da(!0)}this.f?this.A(a,b,c):this.mc(a,b,c)},M:function(a){return this.G[a]},R:function(a,b){a=this.G[a];this.i&&F(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},X:function(a,b){a&1&&this.v.Fa(b,64,2);return this.D.getUint16(a,!0)},ba:function(a,b){a&1&&this.v.Fa(b,64,2);
a=this.I[a>>1];this.i&&F(this.i,128)&&E(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ia:function(a,b){this.G[a]=b;this.Ua=!0},ma:function(a,b,c){this.G[a]=b;this.Ua=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},wa:function(a,b,c){a&1&&this.v.Fa(c,64,4);this.D.setUint16(a,b,!0);this.Ua=!0},Ca:function(a,b,c){a&1&&this.v.Fa(c,64,4);this.I[a>>1]=b;this.Ua=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,
b)+")",!0)}};function sc(a,b,c){a.i=b;a.g=a.C=0;c&&((a.g=c.g)&&id(a,hd,!1),(a.C=c.C)&&gd(a,hd,!1))}function kd(a,b){b?--a.C||(a.Zb=a.f?a.A:a.$b,a.Qb=a.f?a.H:a.mc):--a.g||(a.Vb=a.hc,a.ra=a.ic)}function gd(a,b,c){c&&a.C||(a.Zb=!a.f&&b[1]||a.A,a.Qb=!a.f&&b[3]||a.H);if(c||void 0===c)a.$b=b[1]||a.A,a.mc=b[3]||a.H}function id(a,b,c){c&&a.g||(a.Vb=b[0]||a.K,a.ra=b[2]||a.L);if(c||void 0===c)a.hc=b[0]||a.K,a.ic=b[2]||a.L}function cd(a,b){b||(b=ld);id(a,b,void 0);gd(a,b,void 0)}
var ld=[],fd=[I.prototype.S,I.prototype.ua,I.prototype.ca,I.prototype.La],hd=[I.prototype.O,I.prototype.Za,I.prototype.Sa,I.prototype.xa];if(zb)var ed=[I.prototype.M,I.prototype.ia,I.prototype.X,I.prototype.wa],dd=[I.prototype.R,I.prototype.ma,I.prototype.ba,I.prototype.Ca];
function md(a,b){t.call(this,"CPU",a,md,1);b=a.cycles||b;var c=a.multiplier||1;this.tb=0;this.mb=b;this.eb=c;this.Fb=Math.round(this.mb/1E4)/100;this.pb=this.Fb*this.eb;this.w.W=!1;this.w.Yb=!1;this.w.sb=a.autoStart;this.w.ub=!1;this.Lb=this.ua=0;this.Mb=a.csStart;this.wb=a.csInterval;this.xb=a.csStop;this.K=[];this.Cc=this.be.bind(this);H(this)}z(md);var nd=["power","reset"];k=md.prototype;
k.Ga=function(a,b,c,d){this.C=a;this.v=b;this.i=d;this.A=a.A;for(b=0;b<nd.length;b++)(c=this.G[nd[b]])&&this.C.sa(null,nd[b],c);a=od(a,"autoStart");null!=a&&(this.w.sb="true"==a?!0:"false"==a?!1:!!a);H(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.Ia=function(a,b){if(!b){if(a&&this.restore){pd(this);if(!this.restore(a))return!1;qd(this)}else this.reset();this.i?(a=this.i,b=this.w.sb,a.kb=!0,a.j("Type ? for help with PDPjs Debugger commands"),rd(a),b||a.rb(),a.$a&&(b=a.$a,a.$a=null,sd(a,b))):this.j("No debugger detected")}return!0};k.Ha=function(a){return a?this.save():!0};k.sb=function(){return this.w.sb||!this.i&&void 0===this.G.run?(this.ib(),!0):!1};k.sc=function(){return 0};
function qd(a){void 0===a.Mb&&(a.Mb=0);void 0===a.wb&&(a.wb=-1);void 0===a.xb&&(a.xb=-1);a.w.ub=0<=a.Mb&&0<a.wb;a.w.ub&&(a.Lb=0,a.ua=a.Mb-a.ia)}function ec(a,b){if(a.w.ub){var c=!1;a.Lb=a.Lb+a.sc()|0;a.ua-=b;0>=a.ua&&(a.ua+=a.wb,c=!0);0<=a.xb&&a.xb<=td(a)&&(a.wb=a.xb=-1,qd(a),a.da(),c=!0);c&&a.j(td(a)+" cycles: checksum="+p(a.Lb))}}
k.sa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.G[b]=c,!0;case "run":return this.G[b]=c,c.onclick=function(){var a;if(a=d.C)if(a=d.C,a.w.ha)a=!0;else{var b=null,c,h=rb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.w.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.w.ha);c++);c==h.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.w.ready?"powered yet":"ready yet"+(b.Tb?" (waiting for notification)":""))+".");a=!1}a&&(d.w.W?d.da():d.ib())},
!0;case "speed":return this.G[b]=c,!0;case "setSpeed":return this.G[b]=c,c.onclick=function(){ud(d,d.eb<<1,!0)},c.textContent=this.pb.toFixed(2)+"Mhz",!0}return!1};k.pa=function(a){this.C&&this.C.pa(a)};function dc(a,b,c){a.ia+=b;c&&(a.ca=a.b=a.I=0)}function vd(a,b){var c=1;b&&1<a.eb&&a.ma&&(c=a.ma/a.Fb);a.zc=Math.round(1E3/30);a.ob=Math.floor(a.mb/30*c);b||(a.wa=a.ob);a.Gb=0}function td(a){return a.ia+a.X+a.ca-a.b}function pd(a){a.ma=0;a.Ac=0;a.ia=a.X=a.ca=a.b=a.I=0;qd(a);ud(a,1)}
function ud(a,b,c){var d=!1;if(void 0!==b){.8>a.ma/a.pb?b=1:d=!0;a.eb=b;b=a.Fb*a.eb;if(a.pb!=b){a.pb=b;b=a.pb.toFixed(2)+"Mhz";var e=a.G.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.C&&a.C.rb()}dc(a,a.X);a.X=0;a.S=Aa();a.ba=0;vd(a);return d}function Gc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function Pc(a,b,c,d){0<=b&&b<a.K.length&&(d||0>a.K[b][0])&&(c=a.mb*a.eb/1E3*c|0,a.w.W&&(c+=wd(a)),a.K[b][0]=c)}
function xd(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function cc(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function wd(a,b){var c=a.ca-=a.b;a.b=a.I=0;b&&(a.ca=0);return c}
k.be=function(){if(this.w.W){this.Gb>=this.mb&&vd(this,!0);this.La=0;this.kb=Aa();if(this.ba){var a=this.kb-this.ba;a>this.zc&&(this.S+=a,this.S>this.kb&&(this.S=this.kb))}try{do{var b=xd(this,this.w.ub?1:this.ob);try{this.jb(b)}catch(e){if("number"!=typeof e)throw e;}b=wd(this,!0);this.La+=b;this.X+=b;ec(this,b);cc(this,b);this.wa-=b;if(0>=this.wa){this.wa+=this.ob;15<=++this.Ac&&(this.pa(),this.Ac=0);break}}while(this.w.W)}catch(e){this.da();this.C&&this.C.stop(Aa(),td(this));yb(this,e.stack||e.message);
return}if(this.w.W){a=setTimeout;b=this.Cc;this.ba=Aa();var c=this.zc;this.La&&(c=Math.round(c*this.La/this.ob));var c=c-(this.ba-this.kb),d=this.ba-this.S;d&&(this.ma=Math.round(this.X/(10*d))/100,864E5<=d&&(this.ia=0,ud(this)));if(0>c||this.ma<this.pb)-1E3>c&&(this.S-=c),c=0;this.Gb+=this.La;this.ba+=c;a(b,c)}}};
k.ib=function(a){if(xb(this))return!1;if(this.w.W)return this.j(this.toString()+" busy"),!1;ud(this);this.w.W=!0;this.w.Yb=!0;var b=this.G.run;b&&(b.textContent="Halt");this.C&&(a&&this.C.rb(!0),this.C.start(this.S,td(this)));setTimeout(this.Cc,0);return!0};k.jb=function(){return 0};k.da=function(a){var b=!1;if(this.w.W){wd(this);dc(this,this.X);this.X=0;this.w.W=!1;if(b=this.G.run)b.textContent="Run";this.C&&this.C.stop(Aa(),td(this));b=!0}this.w.complete=a;return b};
function yd(a){this.Va=+a.model||1170;this.xc=a.addrReset||0;md.call(this,a,6666667);this.decode=1120==this.Va?zd.bind(this):Ad.bind(this);Bd(this);this.M=0;this.O=null;this.w.complete=!1}z(yd,md);k=yd.prototype;k.reset=function(){this.status("model "+this.Va);this.w.W&&this.da();Bd(this);pd(this);this.w.error=!1;this.parent.reset.call(this)};
function Bd(a){a.T=65536;a.U=32768;a.$=65535;a.Z=32768;a.N=15;a.u=[0,0,0,0,0,0,0,a.xc];a.Xa=[0,0,0,0,0,0];a.Ka=[0,0,0,0];a.B=0;a.lb=0;a.Xc=[4,2,0,1];a.V=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ya=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Ob=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0];a.Gc=[0,0,0,0,0,0,0,0];a.Fc=0;a.J=0;a.D=a.H=0;a.g=a.f=a.vb=0;a.xa=-1;bc(a)}function bc(a){a.Xb=255;a.Ja=0;a.jc=0;a.Ba=0;a.Hb=0;a.Jb=0;a.fb=0;a.L=0;a.$a=0;a.Ca=262143;a.oa=0;a.O=null;a.v&&Tc(a)}function Tc(a){a.L?(a.R=65536,a.vc=a.fb&16?4186112:253952,a.aa=a.Vc,a.ra=a.Zd,a.Qb=a.Re,uc(a.v,a.fb&16?22:18)):(a.R=0,a.vc=57344,a.aa=a.Uc,a.ra=a.Ec,a.Qb=a.Lc,uc(a.v,16))}
function Sc(a,b){b&=-3073;if(a.Ba!=b){b&57344&&!(a.Ba&57344)&&(a.Hb=a.oa>>16&65535,a.Jb=a.oa&65535);a.Ba=b;a.$a=b>>5&3;a.lb=b>>1&15;var c=0;b&257&&(c=4,b&1&&(c|=2));a.L!=c&&(a.L=c,Tc(a))}}k.sc=function(){return 0};k.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.ia,this.eb]);a.set(2,Dc(this.v));return a.data()};
k.restore=function(a){var b=a[1];this.ia=b[1];ud(this,b[3]);a:{b=this.v;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.I){for(var f=0,g=Array(b.I),h=0;h<e.length-1;)for(var l=e[h++],m=e[h++];l--;)g[f++]=m;e=g}f=b.Y[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Cd(a){return a.T&65536?1:0}function Dd(a){return a.U&32768?2:0}function Ed(a){return a.$&65535?0:4}function Fd(a){return a.Z&32768?8:0}
function Gd(a){var b=a.u[7];a.oa=b;var c=a.ra(b);a.u[7]=b+2&65535;return c}function Hd(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function O(a,b){a.u[7]=b&65535}function Qc(a,b){return{de:a,yb:b,next:null}}function Id(a,b){var c=a.O;if(c==b)a.O=b.next;else for(;c;){a=c.next;if(a==b){c.next=a.next;break}c=a}}function Hc(a,b){if(b!=a.O){var c=a.O;if(!c||c.yb<=b.yb)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.yb<=b.yb){b.next=d;c.next=b;break}c=d}while(c)}}a.J|=1}
function Jd(a){return a.J&64?(a.ta(168,64,-5),!0):a.J&32?(a.ta(4,32,-4),!0):a.J&16?(a.ta(12,16,-6),!0):!1}function Uc(a){return a.N=a.N&63728|Fd(a)|Ed(a)|Dd(a)|Cd(a)}function Vc(a,b){a.Z=b<<12;a.$=~b&4;a.U=b<<14;a.T=b<<16;if((b^a.N)&2048)for(var c=a.Xa.length;0<=--c;){var d=a.u[c];a.u[c]=a.Xa[c];a.Xa[c]=d}a.B=b>>14&3;c=a.N>>14&3;a.B!=c&&(a.Ka[c]=a.u[6],a.u[6]=a.Ka[a.B]);a.N=b;a.J|=2}function Q(a,b){a.J&128||(a.Z=a.$=b,a.U=0)}function Kd(a,b,c){a.J&128||(a.Z=a.$=a.T=b,a.U=c||0)}
function fe(a,b,c,d){a.J&128||(a.Z=a.$=a.T=b,a.U=(c^b)&(d^b))}function ge(a,b){a.J&128||(a.Z=a.$=a.T=b,a.U=a.Z^a.T>>1)}function he(a,b,c,d){a.J&128||(a.Z=a.$=a.T=b,a.U=(c^d)&(d^b))}
k.ta=function(a,b,c){if(!this.M){0>this.xa?this.xa=Uc(this):this.B||(a=4,this.Ja|=4,this.u[6]=4,c=-3);this.oa=a;this.B=0;var d=this.ra(a|this.R),e=this.ra(a+2&65535|this.R);Vc(this,e&-12289|this.xa>>2&12288);ie(this,this.xa);ie(this,this.u[7]);O(this,d);this.J&=~(b|18);this.J|=9;this.xa=-1;this.jd=a;this.hd=c;if(-3<=c)throw a;}};function je(a){var b=ke(a),c=ke(a)&-1793;a.N&49152&&(c=c&-225|a.N&63712);O(a,b);Vc(a,c);a.J&=-17}
function Cc(a,b){var c=b>>13&31;31>c&&a.fb&32&&(b=a.Ob[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
function le(a,b,c){var d,e,f;if(!(c&a.L))return f=b&65535,57344<=f&&(f|=a.vc),f;d=b>>13;a.fb&a.Xc[a.B]||(d&=7);e=a.V[a.B][d];f=(a.ya[a.B][d]<<6)+(b&8191)&a.Ca;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!=(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.V[a.B][d]=e;if(f!=(4194170&a.Ca)||a.B)a.$a=a.B,a.lb=d;b=!1;g&&(g&57344&&(0<=a.xa&&(g|=128),a.Ba&
57344||(g|=a.$a<<5|a.lb<<1,Sc(a,a.Ba&-61695|g)),b=!0),a.Ba&61440||!(f<(4191360&a.Ca)||f>(4194239&a.Ca))||(a.Ba|=4096,a.Ba&512&&(a.J|=64)),b&&a.ta(168,0,-1));return f}function me(a,b){return a.v.Ib(b)}function ke(a){var b=a.ra(a.u[6]|a.R);a.u[6]=a.u[6]+2&65535;return b}function ie(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.oa=a.oa&65535|(a.oa&-65536)<<8|16121856;ne(a,0,c);a.Qb(c,b)}function ne(a,b,c){!a.B&&c<=a.Xb&&(b||4<c)&&(1145<=a.Va&&c<=a.Xb-32?(a.Ja|=4,a.u[6]=4,a.ta(4,0,-3)):(a.Ja|=8,a.J|=32))}
function oe(a,b,c,d){var e,f,g=d&8?0:a.R;switch(b){case 0:return a.ta(4,0,-2),0;case 1:return 6==c&&d&4&&ne(a,b,a.u[6]),a.b-=3,7==c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!=c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!=c&&(e|=g);e=a.ra(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!=c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!=c&&(e|=g);e=a.ra(e)|g;a.b-=8;break;case 6:return e=a.ra(Hd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.ra(Hd(a,2)),e=e+
a.u[c]&65535,e=a.ra(e|a.R)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;a.oa=a.oa&65535|(a.oa&-65536)<<8|(f<<3&248|c)<<16;6==c&&0>f&&ne(a,b,a.u[6]);return e}k.Ub=function(a){if(!this.L)return this.v.Ub(a);this.M++;a=me(this,le(this,a,3));this.M--;return a};k.cb=function(a){if(!this.L)return this.v.cb(a);this.M++;a=this.Ec(le(this,a,2));this.M--;return a};k.qb=function(a,b){this.L?(this.M++,a=le(this,a,5),a&1&&this.b--,this.v.Bb(a,b),this.M--):this.v.qb(a,b)};
k.Cb=function(a,b){this.L?(this.M++,this.Lc(le(this,a,4),b),this.M--):this.v.Cb(a,b)};k.Uc=function(a,b,c){return oe(this,a,b,c)};k.Vc=function(a,b,c){return le(this,oe(this,a,b,c),c)};k.Ec=function(a){return this.v.na(a)};k.Zd=function(a){return this.v.na(le(this,a,2))};k.Lc=function(a,b){this.v.hb(a,b&65535)};k.Re=function(a,b){this.v.hb(le(this,a,4),b)};
function pe(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=oe(a,b,d,2),c&65536||61440!==(a.N&61440)&&(d&=65535),a.B=a.N>>12&3,c=a.ra(d|c&a.R),a.B=a.N>>14&3):c=6!=d||(a.N>>2&12288)===(a.N&12288)?a.u[d]:a.Ka[a.N>>12&3];return c}function qe(a,b,c,d){a.oa=a.oa&65535|1441792;var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=oe(a,b,e,4),c&65536||(e&=65535),a.B=a.N>>12&3,e=le(a,e|c&65536,4),a.B=a.N>>14&3,a.v.hb(e,d)):6!=e||(a.N>>2&12288)===(a.N&12288)?a.u[e]=d:a.Ka[a.N>>12&3]=d}
function re(a,b){b>>=6;var c=a.H=b&7;return(b=a.D=(b&56)>>3)?me(a,a.aa(b,c,3)):-c-1}function se(a,b){var c;b>>=6;var d=a.H=b&7;(b=a.D=(b&56)>>3)?c=a.v.na(a.aa(b,d,2)):c=-d-1;return c}function te(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return oe(a,b,c,8)}function ue(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?me(a,a.aa(b,c,3)):a.u[c]&255}function ve(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.v.na(a.aa(b,c,2)):a.u[c]}
function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.vb=a.aa(b,e,7),c=0>c?a.u[-c-1]&255:c,c=d.call(a,c,me(a,e)),e&1&&a.b--,a.v.Bb(e,c)):(b=a.u[e],c=0>c?a.u[-c-1]&255:c,a.u[e]=b&65280|d.call(a,c,b&255))}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.aa(b,e,6),a.v.hb(e,d.call(a,0>c?a.u[-c-1]:c,a.v.na(e)))):a.u[e]=d.call(a,0>c?a.u[-c-1]:c,a.u[e])}
function we(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.aa(b,e,5),e=c=0>c?a.u[-c-1]&255:c,d&1&&a.b--,a.v.Bb(d,e)):c?(c=0>c?a.u[-c-1]&255:c,a.u[e]=a.u[e]&~d|c<<24>>24&d):a.u[e]&=~d;return c}function xe(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.aa(b,d,4),a.v.hb(d,c=0>c?a.u[-c-1]:c)):a.u[d]=c=0>c?a.u[-c-1]:c;return c}function T(a,b,c){c&&(O(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
k.jb=function(a){this.w.complete=!0;var b=this.i?ye(this.i)?1:this.w.Yb?-1:0:0,c=a?this.w.Yb?0:1:-1;this.w.Yb=!1;this.ca=this.b=a;do{if(b){if(ze(this.i,this.u[7],c)){this.da();break}c||c++;b++}if(this.J){if(a=this.J&7)if(a=!1,this.J&2){this.J&=-3;var d=160,e=(this.jc&224)>>5,f=this.O&&this.O.yb>e?this.O:null;f&&(d=f.de,e=f.yb);e>(this.N&224)>>5?(this.J&4&&(Hd(this,2),this.J&=-5),this.ta(d,0,-9),e=!0):e=!1;e&&(f&&Id(this,f),a=!0)}else this.J&1&&this.J++;if(a){if(b&&ze(this.i,this.u[7],c)){this.da();
break}if(0>c)break}if(this.J&112&&Jd(this)){if(b&&ze(this.i,this.u[7],c)){this.da();break}if(0>c)break}}this.J=this.J&7|this.N&16;this.decode(Gd(this))}while(0<this.b);return this.w.complete?this.ca-this.b:void 0===this.w.complete?0:-1};Za(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new yd(d);B(d,c)}});function Ae(a,b){var c=b+a;fe(this,c,a,b);return c&65535}function Be(a,b){var c=b+a;fe(this,c<<8,a<<8,b<<8);return c&255}
function Ce(a,b){a=b<<1;ge(this,a);return a&65535}function De(a,b){a=b<<1;ge(this,a<<8);return a&255}function Ee(a,b){a=b&32768|b>>1|b<<16;ge(this,a);return a&65535}function Fe(a,b){a=b&128|b>>1|b<<8;ge(this,a<<8);return a&255}function Ge(a,b){a=b&~a;Q(this,a);return a}function He(a,b){a=b&~a;Q(this,a<<8);return a}function Ie(a,b){a|=b;Q(this,a);return a}function Je(a,b){a|=b;Q(this,a<<8);return a}function Ke(a,b){a=~b|65536;Kd(this,a);return a&65535}
function Le(a,b){a=~b|256;Kd(this,a<<8);return a&255}function Me(a,b){a=b-a;this.J&128||(this.Z=this.$=a,this.U=b&(b^a));return a&65535}function Ne(a,b){a=b-a;var c=a<<8;b<<=8;this.J&128||(this.Z=this.$=c,this.U=b&(b^c));return a&255}function Oe(a,b){a=b+a;this.J&128||(this.Z=this.$=a,this.U=a&(b^a));return a&65535}function Pe(a,b){a=b+a;var c=a<<8;this.J&128||(this.Z=this.$=c,this.U=c&(b<<8^c));return a&255}function Qe(a,b){a=-b;Kd(this,a,a&b&32768);return a&65535}
function Re(a,b){a=-b;Kd(this,a<<8,(a&b&128)<<8);return a&255}function Se(a,b){a=b<<1|this.T>>16&1;ge(this,a);return a&65535}function Te(a,b){a=b<<1|this.T>>16&1;ge(this,a<<8);return a&255}function Ue(a,b){a=(this.T&65536|b)>>1|b<<16;ge(this,a);return a&65535}function Ve(a,b){a=((this.T&65536)>>8|b)>>1|b<<8;ge(this,a<<8);return a&255}function We(a,b){var c=b-a;he(this,c,a,b);return c&65535}function Xe(a,b){var c=b-a;he(this,c<<8,a<<8,b<<8);return c&255}
function Ye(a,b){this.J&128||(this.Z=this.$=b&65280,this.U=this.T=0);return(b<<8|b>>8)&65535}function Ze(a,b){a^=b;Q(this,a);return a&65535}function $e(a){S(this,a,se(this,a),Ae);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
function af(a){var b=ve(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.T=this.U=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.T=c<<17-b,c>>=b;else if(b)if(16<b)this.U=c,c=0;else{this.T=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.U=32768)}this.u[a]=c&65535;this.Z=this.$=c;this.b-=(this.g?6:7)+b}
function bf(a){var b=ve(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.T=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.T=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.U=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.Z=d>>16;this.$=d>>16|d;this.b-=(this.g?6:7)+b}function cf(a){T(this,a,!Cd(this))}function df(a){T(this,a,Cd(this))}
function ef(a){S(this,a,se(this,a),Ge);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function ff(a){R(this,a,re(this,a),He);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function gf(a){S(this,a,se(this,a),Ie);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function hf(a){R(this,a,re(this,a),Je);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
function jf(a){var b=se(this,a);a=ve(this,a);Q(this,(0>b?this.u[-b-1]:b)&a);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function kf(a){var b=re(this,a);a=ue(this,a);Q(this,((0>b?this.u[-b-1]&255:b)&a)<<8);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function lf(a){T(this,a,Ed(this))}function mf(a){T(this,a,!Fd(this)==!Dd(this))}function nf(a){T(this,a,!Ed(this)&&!Fd(this)==!Dd(this))}function of(a){T(this,a,!Cd(this)&&!Ed(this))}
function pf(a){T(this,a,Ed(this)||!Fd(this)!=!Dd(this))}function qf(a){T(this,a,Cd(this)||Ed(this))}function rf(a){T(this,a,!Fd(this)!=!Dd(this))}function sf(a){T(this,a,Fd(this))}function tf(a){T(this,a,!Ed(this))}function uf(a){T(this,a,!Fd(this))}function vf(){this.ta(12,0,-8);this.b-=5}function wf(a){T(this,a,!0)}function xf(a){T(this,a,!Dd(this))}function yf(a){T(this,a,Dd(this))}function U(a){a&1&&(this.T=0);a&2&&(this.U=0);a&4&&(this.$=1);a&8&&(this.Z=0);this.b-=5}
function zf(a){var b=se(this,a);a=ve(this,a);var c=(b=0>b?this.u[-b-1]:b)-a;he(this,c,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function Af(a){var b=re(this,a);a=ue(this,a);var c=(b=(0>b?this.u[-b-1]&255:b)<<8)-(a<<=8);he(this,c,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}
function Bf(a){var b=ve(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.$=d>>16|d,this.Z=d>>16):(this.U=32768,this.$=d>>15|d,this.Z=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.$=this.Z=0,this.U=32768,this.T=65536,this.b-=7}function Cf(){this.ta(24,0,-8);this.b-=25}
function Df(){this.N&49152?(this.Ja|=128,this.ta(4,0,-7)):(this.A&&1120==this.Va&&this.A.setData(this.u[0],!0),this.i?Ef(this.i):this.da());this.b-=7}function Ff(){this.ta(16,0,-8);this.b-=25}var Gf=[0,7,7,10,7,11,9,13];function Hf(a){this.I=this.b;O(this,te(this,a));this.b=this.I-Gf[this.g]}var If=[0,14,14,17,14,18,16,20];function Jf(a){this.I=this.b;var b=te(this,a);a=a>>6&7;ie(this,this.u[a]);this.u[a]=this.u[7];O(this,b);this.b=this.I-If[this.g]}
var Kf=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Lf(a){var b=se(this,a);this.I=this.b;Q(this,xe(this,a,b));this.b=this.I-Kf[(this.D?8:0)+this.g]+(7!=this.f||this.g?0:2)}function Mf(a){var b=re(this,a);Q(this,we(this,a,b,65535)<<8);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}var Nf=[7,13,13,17,14,18,17,21];
function Of(a){var b=ve(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.J&128||(this.Z=b>>16,this.$=this.Z|b,this.U=0,this.T=-32768>b||32767<b?65536:0);this.b-=23}function Pf(){this.b-=5}function Qf(){this.N&49152||(this.v.reset(),bc(this),this.A&&this.A.setData(this.u[0],!0));this.b-=667}function Rf(a){if(a&8)V.call(this,a);else{var b=ke(this);a&=7;7==a?O(this,b):(O(this,this.u[a]),this.u[a]=b);this.b-=9}}
function Sf(){je(this);this.b-=13}function W(a){a&1&&(this.T=65536);a&2&&(this.U=32768);a&4&&(this.$=0);a&8&&(this.Z=32768);this.b-=5}function Tf(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)O(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function Uf(a){S(this,a,se(this,a),We);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function Vf(a){S(this,a,0,Ye);this.b-=this.g?9:3+(7==this.f?2:0)}function Wf(){this.ta(28,0,-8);this.b-=5}
function Xf(){this.A&&(this.A.kc(this.u[7],!0),this.A.setData(this.u[0],!0));this.J|=4;Hd(this,-2);this.b-=3}function Yf(a){S(this,a,this.u[a>>6&7],Ze);this.b-=this.g?9:3+(7==this.f?2:0)}function V(a){var b;if(b=this.i)b=this.i,F(b,1)?(E(b,"undefined opcode "+J(b,a),!0,!0),b=Ef(b)):b=!1;b||this.ta(8,0,-8)}function zd(a){Zf[a>>12].call(this,a)}function $f(a){ag[a>>6&3].call(this,a)}function bg(a){cg[a>>6&3].call(this,a)}function dg(a){eg[a>>6&3].call(this,a)}function fg(a){gg[a&15].call(this,a)}
function hg(a){ig[a&15].call(this,a)}function jg(a){kg[a>>6&3].call(this,a)}function lg(a){mg[a>>6&3].call(this,a)}function ng(a){og[a>>6&3].call(this,a)}
var Zf=[function(a){pg[a>>8&15].call(this,a)},Lf,zf,jf,ef,gf,$e,V,function(a){qg[a>>8&15].call(this,a)},Mf,Af,kf,ff,hf,Uf,V],pg=[function(a){rg[a>>4&15].call(this,a)},wf,tf,lf,mf,rf,nf,pf,Jf,Jf,$f,bg,dg,V,V,V],ag=[function(a){Kd(this,xe(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ke);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Oe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Me);this.b-=this.g?9:3+(7==this.f?2:0)}],cg=[function(a){S(this,a,0,
Qe);this.b-=this.g?11:6},function(a){S(this,a,Cd(this)?1:0,Ae);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,Cd(this)?1:0,We);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=ve(this,a);Kd(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],eg=[function(a){S(this,a,0,Ue);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Se);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ee);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ce);this.b-=this.g?9:3+(7==this.f?2:0)}],
rg=[function(a){sg[a&15].call(this,a)},V,V,V,Hf,Hf,Hf,Hf,Rf,V,fg,hg,Vf,Vf,Vf,Vf],sg=[Df,Xf,Sf,vf,Ff,Qf,V,V,V,V,V,V,V,V,V,V],gg=[Pf,function(){this.T=0;this.b-=5},function(){this.U=0;this.b-=5},U,function(){this.$=1;this.b-=5},U,U,U,function(){this.Z=0;this.b-=5},U,U,U,U,U,U,U],ig=[Pf,function(){this.T=65536;this.b-=5},function(){this.U=32768;this.b-=5},W,function(){this.$=0;this.b-=5},W,W,W,function(){this.Z=32768;this.b-=5},W,W,W,W,W,W,W],qg=[uf,sf,of,qf,xf,yf,cf,df,Cf,Wf,jg,lg,ng,V,V,V],kg=[function(a){Kd(this,
we(this,a,0,255));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Le);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Pe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Ne);this.b-=this.g?9:3+(7==this.f?2:0)}],mg=[function(a){R(this,a,0,Re);this.b-=this.g?11:6},function(a){R(this,a,Cd(this)?1:0,Be);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,Cd(this)?1:0,Xe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=ue(this,a);Kd(this,a<<8);this.b-=this.g?4:3+
(7==this.f?2:0)}],og=[function(a){R(this,a,0,Ve);this.b-=this.g?9+(this.vb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Te);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Fe);this.b-=this.g?9+(this.vb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,De);this.b-=this.g?9:3+(7==this.f?2:0)}];function Ad(a){tg[a>>12].call(this,a)}
var tg=[function(a){ug[a>>8&15].call(this,a)},Lf,zf,jf,ef,gf,$e,function(a){vg[a>>8&15].call(this,a)},function(a){wg[a>>8&15].call(this,a)},Mf,Af,kf,ff,hf,Uf,V],ug=[function(a){xg[a>>4&15].call(this,a)},wf,tf,lf,mf,rf,nf,pf,Jf,Jf,$f,bg,dg,function(a){yg[a>>6&3].call(this,a)},V,V],yg=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.ra(a|this.R);O(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=pe(this,a,0);ie(this,a);Q(this,a);this.b-=11},function(a){var b=ke(this);this.I=
this.b;qe(this,a,0,b);Q(this,b);this.b=this.I-Nf[this.g]},function(a){Q(this,xe(this,a,Fd(this)?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],xg=[function(a){zg[a&15].call(this,a)},V,V,V,Hf,Hf,Hf,Hf,Rf,function(a){a&8?(this.N&49152||(this.N=this.N&-2017|(a&7)<<5,this.J|=1),this.b-=5):V.call(this,a)},fg,hg,Vf,Vf,Vf,Vf],zg=[Df,Xf,function(){je(this);this.J|=this.N&16;this.b-=13},vf,Ff,Qf,Sf,function(){this.ta(8,0,-8)},V,V,V,V,V,V,V,V],vg=[Of,Of,Bf,Bf,af,af,bf,bf,Yf,Yf,V,V,V,V,Tf,Tf],wg=[uf,sf,of,qf,
xf,yf,cf,df,Cf,Wf,jg,lg,ng,function(a){Ag[a>>6&3].call(this,a)},V,V],Ag=[V,function(a){a=pe(this,a,65536);ie(this,a);Q(this,a);this.b-=11},function(a){var b=ke(this);this.I=this.b;qe(this,a,65536,b);Q(this,b);this.b=this.I-Nf[this.g]},V];
function Bg(a){t.call(this,"ROM",a,Bg,256);this.ga=this.g=null;this.B=a.addr;this.f=a.size;this.D=!1;this.A=a.alias;this.C=a.file;this.H=ra(this.C);if(this.C){a=this.C;var b=sa(this.H);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.C+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.P("Unable to load ROM resource (error "+f+": "+a+")"),c.C=null):(qb(c.Sa,a,b),(a=Ea(a,b))?(c.g=a.ea,c.ga=a.ga):c.C=null);Cg(c)})}}z(Bg);k=Bg.prototype;
k.Ga=function(a,b,c,d){this.v=b;this.b=c;this.i=d;Cg(this)};k.Ia=function(){this.ga&&(this.i&&Vg(this.i,this.id,this.B,this.f,this.ga),delete this.ga);return!0};k.Ha=function(){return!0};
function Cg(a){if(!wb(a)){if(a.C){if(!a.g||!a.v)return;a.f||(a.f=a.g.length);if(a.g.length!=a.f)yb(a,"ROM size ("+p(a.g.length,8,!0)+") does not match specified size ("+p(a.f,8,!0)+")");else{var b;a:{b=a.B;a.status(a.f+"-byte ROM at "+qa(b));if(57344<=b&&b<57344+nc){var c={};b=(c[b]=[Bg.prototype.Nd,Bg.prototype.Fe,null,null,null,a.f>>1],c);if(Hb(a.v,a,b)){b=a.D=!0;break a}}else if(xc(a.v,b,a.f,bd)){for(c=0;c<a.g.length;c++)a.v.qb(b+c,a.g[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.A?b.push(a.A):
null!=a.A&&a.A.length&&(b=a.A);for(c=0;c<b.length;c++){var d=a,e=b[c],f=wc(d.v,d.B,d.f);vc(d.v,e,d.f,f)}a.D||delete a.g}}}H(a)}}k.Nd=function(a){return this.g[a-this.B]};k.Fe=function(){};Za(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Bg(d);B(d,c)}});
function Wg(a){t.call(this,"RAM",a,Wg);this.ga=this.g=null;this.C=a.addr;this.B=a.size;this.Na=a.load;this.Ma=a.exec;this.A=!1;this.f=a.file;this.D=ra(this.f);if(this.f){a=this.f;var b=sa(this.D);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.P("Unable to load RAM resource (error "+f+": "+a+")"),c.f=null):(qb(c.Sa,a,b),(a=Ea(a,b))?(c.g=a.ea,c.ga=a.ga,null==c.Na&&(c.Na=a.Na),null==c.Ma&&(c.Ma=a.Ma)):c.f=null);Xg(c)})}}
z(Wg);Wg.prototype.Ga=function(a,b,c,d){this.v=b;this.b=c;this.i=d;Xg(this)};Wg.prototype.Ia=function(){this.ga&&(this.i&&Vg(this.i,this.id,this.C,this.B,this.ga),delete this.ga);return!0};Wg.prototype.Ha=function(){return!0};function Xg(a){if(a.v&&(!a.A&&a.B&&xc(a.v,a.C,a.B,Ac)&&(a.A=!0),!wb(a))){if(!a.A)q("No RAM allocated");else if(a.f){if(!a.g||!a.v)return;Yg(a,a.g,a.Na,a.Ma,a.C)}H(a)}}
Wg.prototype.reset=function(){if(this.A){for(var a=this.v,b=this.C,c=this.B,d=b&a.v,b=b>>>a.ja;0<c&&b<a.Y.length;){var e=a.Y[b];if(e.controller&&a.g&&a.g.length==a.A.length){var f=a.g.indexOf(e);0<=f&&(e=a.A[f])}if(e){var f=c,g=0,h,d=d||0,g=g&255;void 0===f&&(f=e.size);if(zb&&e.G)for(h=d;f--&&h<e.G.length;h++)e.G[h]=g;else for(h=d;f--&&h<e.size;h++)e.$b(d,g,e.F+d)}c-=a.za;b++;d=0}this.g&&Yg(this,this.g,this.Na,this.Ma,this.C,!0)}};
function Yg(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var l=b[h]&255|(b[h+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(h+6>=b.length)break;for(var h=h+2,m=b[h++]&255|(b[h++]&255)<<8,n=b[h++]&255|(b[h++]&255)<<8,l=l+((m&255)+(m>>8)+(n&255)+(n>>8)),v=h,r=m-=6;0<m&&h<b.length;)l+=b[h++]&255,m--;if(m||h>=b.length)break;l+=b[h++]&255;if(l&255)break;if(r)for(E(a,"loading "+p(r,4,!0)+" bytes at "+p(n,4,!0)+"-"+p(n+r-1,4,!0),1048576);r--;)a.b.qb(n++,b[v++]&255);else n&1?a.b.da():null==d&&
(d=n),null!=d&&E(a,"starting address: "+p(d,4,!0),1048576);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.b.qb(c+g,b[g]);g=!0}g&&null!=d&&(a=a.b,a.xc=d,a.v.reset(),bc(a),O(a,d),Vc(a,0),!f&&a.i&&(a.da()||rd(a.i)));return g}Za(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Wg(d);B(d,c)}});function Zg(a){t.call(this,"Keyboard",a,Zg,65536);H(this)}z(Zg);Zg.prototype.sa=function(){return!1};
Zg.prototype.Ga=function(a,b,c,d){this.C=a;this.b=c;this.i=d};Za(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Zg(d);B(d,c)}});
function X(a){this.O=a.baudReceive||9600;this.ca=a.baudTransmit||9600;this.ba=a.upperCase;this.A=this.D=null;this.S=a.tabSize;this.R=a.charBOL;this.H=0;t.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.D="";else{var c;a=$g;b&&(void 0===c&&(c="Panel"),(c=tb(c,this.id))&&(b=c.G[b])&&this.sa(null,a,b))}this.I=this.L=null;this.exports={connect:this.wc,receiveData:this.Wb}}z(X);var $g="buffer";k=X.prototype;
k.sa=function(a,b,c){var d=this;switch(b){case $g:return this.G[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.Wb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Wb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.Wb(a.getData("Text"))},
c.removeAttribute("readonly"),!0}return!1};k.Ga=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;var e=this;this.ma=Qc(48,4);this.X=Gc(this.b,function(){e.f&128||!e.B.length||(e.K=e.B.shift()&255,e.ba&&97<=e.K&&122>e.K&&(e.K-=32),e.f|=128,e.f&64&&Hc(e.b,e.ma))});this.M=Qc(52,4);this.ia=Gc(this.b,function(){e.g|=128;e.g&64&&Hc(e.b,e.M)});Hb(b,this,ah);Jb(b,this.reset.bind(this));H(this)};
k.wc=function(){if(!this.I){var a=od(this.C,"connection");if(a){var b=a.split("->");if(2==b.length){var c=xa(b[0]);if(c!=this.Za)return;b=xa(b[1]);if(this.I=sb(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.Sa+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.Ia=function(a,b){if(!b)if(this.wc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
k.Ha=function(a){return a?this.save():!0};k.reset=function(){bh(this)};k.save=function(){var a=new N(this);a.set(0,[]);return a.data()};k.restore=function(){return bh(this)};function bh(a){a.K=0;a.f=0;a.g=128;a.B=[];return!0}k.Wb=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);Pc(this.b,this.X,1E3/Math.round(this.O/10));return!0};k.Hd=function(){return this.f&65534};
k.ze=function(a){this.f=this.f&-112|a&111};k.Gd=function(){this.f&=-129;0<this.B.length&&Pc(this.b,this.X,1E3/Math.round(this.O/10));return this.K};k.ye=function(){};k.ae=function(){return this.g};k.Te=function(a){this.g&128&&(a&64?Hc(this.b,this.M):Id(this.b,this.M));this.g=this.g&-70|a&69};k.$d=function(){return 0};
k.Se=function(a){if(a&=255){E(this,"transmitByte("+p(a,2,!0)+")");this.L&&this.L.call(this.I,a);a&=127;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=ya[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.S||8,c=a-this.H%a,this.S&&(b=wa("",c)));this.R&&!this.H&&c&&(b=String.fromCharCode(this.R)+b);this.A.value+=b;this.A.scrollTop=this.A.scrollHeight;this.H+=c}else if(null!=this.D){if(10==a||1024<=this.D.length)this.j(this.D),
this.D="";10!=a&&(this.D+=String.fromCharCode(a))}this.g&=-129;Pc(this.b,this.ia,1E3/Math.round(this.ca/10))}};var ch={},ah=(ch[65392]=[null,null,X.prototype.Hd,X.prototype.ze,"RCSR"],ch[65394]=[null,null,X.prototype.Gd,X.prototype.ye,"RBUF"],ch[65396]=[null,null,X.prototype.ae,X.prototype.Te,"XCSR"],ch[65398]=[null,null,X.prototype.$d,X.prototype.Se,"XBUF"],ch);Za(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new X(d);B(d,c)}});
function Wc(a){t.call(this,"PC11",a,Wc);this.g=a.autoMount||null;this.D=0;this.ba=a.baudReceive||3600;this.K=this.L=this.f=0;this.I=[];this.H=dh;this.A=eh;this.M=this.B="";this.ea=this.Na=this.Ma=null;this.R=-1;this.O=!Ra("Mobi")&&window&&"FileReader"in window}z(Wc);var dh="",eh=0;k=Wc.prototype;
k.sa=function(a,b,c){var d=this,e=eh;switch(b){case "listTapes":return this.G[b]=c,c.onchange=function(){var a=d.G.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){q("PC11 option error: "+l.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.G[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.G[b]=c,c.onclick=
function(){var a=d.G.listTapes;a&&fh(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.O){c.parentNode.removeChild(c);break}this.G[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;fh(d,ra(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.G[b]=c,!0}return!1};
k.Ga=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;this.S=gh(a);var e=this;if((this.g=od(this.C,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){q("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.X=Qc(56,4);this.ca=Gc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.K<e.I.length&&(e.L=e.I[e.K++]&255,hh(e,e.K/e.I.length*100),e.f|=128,e.f&=-2049,e.f&64&&Hc(e.b,e.X))});Hb(b,this,ih);Jb(b,this.reset.bind(this));jh(this,"None",dh,!0);this.O&&
jh(this,"Local Tape","?");jh(this,"Remote Tape","??");kh(this)||H(this)};k.Ia=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.Ha=function(a){return a?this.save():!0};k.reset=function(){this.f&=-2241;this.L=0};function kh(a){a.D=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.G.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=ra(b,!0)}b&&c?lh(a,c,b,1,!0):mh(a)}return!!a.D}
function fh(a,b,c,d,e){if(c)if("?"==c)a.P('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"');a.H="??"}else a.H=c;lh(a,b,c,d,!1,e)}else nh(a,!1)}
function lh(a,b,c,d,e,f){var g=-1;if(a.B.toLowerCase()!=c.toLowerCase()||a.A!=d)g++,nh(a,!0),a.w.bb?a.P("PC11 busy"):(e&&(a.D++,F(a)&&E(a,"auto-loading tape: "+b)),oh(a,b,c,d,f)?g++:a.w.bb=!0);g&&ph(a,a.M,a.B,a.A,a.ea,a.Na,a.Ma)}
function oh(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),ph(a,b,c,d,e),a.H="?");mh(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=sa(c),f="json"==e||"gz"==e?encodeURI(c):Fa()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Da(f,null,!0,function(e,f,g){var h=0>g&&a.C&&!a.C.w.ha;g?a.P('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(qb(a.Sa,e,f),(e=Ea(e,f))&&ph(a,b,c,d,e.ea,e.Na,
e.Ma));a.w.bb=!1;a.D&&(a.D--,a.D||H(a));mh(a)})}function jh(a,b,c,d){if((a=a.G.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function mh(a){var b=a.G.listTapes;if(b&&b.options){a=a.H||a.B;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function hh(a,b){b|=0;if(b!==a.R){var c=a.G.readProgress;c&&(c=(c=D(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.R=b}}
function ph(a,b,c,d,e,f,g){a.M=b;a.B=c;a.A=d;a.ea=e;a.Na=f;a.Ma=g;2==d?a.S&&Yg(a.S,e,f,g)?a.status("tape loaded: "+b):(a.M="",a.B="",a.H=dh,a.A=eh,a.P("No load address available for tape: "+b)):(a.K=0,a.I=e,a.status("tape attached: "+b),hh(a,0))}function nh(a,b){if(a.B||!1===b)a.M="",a.B="",b||(a.A&&a.status(1==a.A?"tape detached":"tape unloaded"),a.H=dh,a.A=eh,mh(a))}k.save=function(){return(new N(this)).data()};k.restore=function(){return!0};k.Ad=function(){return this.f&65534};
k.se=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&Hc(this.b,this.X)):(this.f&=-129,this.f|=2048,this.L=0,Pc(this.b,this.ca,1E3/Math.round(this.ba/10))));this.f=this.f&-66|a&65};k.zd=function(){this.f&=-129;this.f|=2048;return this.L};k.re=function(){};var qh={},ih=(qh[65384]=[null,null,Wc.prototype.Ad,Wc.prototype.se,"PRS"],qh[65386]=[null,null,Wc.prototype.zd,Wc.prototype.re,"PRB"],qh);
function rh(a,b,c){t.call(this,"Disk",{id:a.Sa+".disk"+p(++sh,4)},rh,4194304);this.controller=a;this.C=a.C;this.i=a.i;this.A=b;this.Ya=b.name;this.fc=b.fc;th(this,c,b.va,b.Aa,b.qa,b.Oa);H(this)}var sh=0;z(rh);k=rh.prototype;k.Ga=function(a,b,c,d){this.i=d};
function th(a,b,c,d,e,f){a.mode=b;a.va=c;a.Aa=d;a.qa=e;a.Oa=f;a.b=[];if("preload"!=a.mode){b=Array(a.va);for(c=0;c<b.length;c++){d=Array(a.Aa);for(e=0;e<d.length;e++){f=Array(a.qa);for(var g=1;g<=f.length;g++)f[g-1]=uh(null,c,e,g,a.Oa,0);d[e]=f}b[c]=d}a.b=b}a.f=null}
function vh(a,b,c,d,e){var f=c;if(a.v)return!0;a.Ya=b;a.gb=c;a.Ic=ra(c);a.v=e;a.B=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ka[d];if(e){a.va=e[0];a.Aa=e[1];a.qa=e[2];a.Oa=e[3]||512;c=a.Oa>>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.va);for(d=0;d<a.b.length;d++)for(var r=a.b[d]=Array(a.Aa),w=0;w<r.length;w++)for(var y=r[w]=Array(a.qa),x=0;x<y.length;x++){for(var C=uh(null,d,w,x+1,a.Oa,0),ja=C.data,Ka=0;Ka<c;Ka++,f+=4)var P=ja[Ka]=b.getInt32(f,
!0),e=e+P&-1;C.Da=c;y[x]=C}a.f=e;c=a}else a.P("Unrecognized disk format ("+d+" bytes)");a.v&&(a.v.call(a.controller,a.A,c,a.Ya,a.gb),a.v=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=sa(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ta(c,"/")&&(d="dir"),f=Fa()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.fc?"":e)+"&format=json"));return!!Da(f,
null,!0,function(b,c,d){wh(a,b,c,d)})}
function wh(a,b,c,d){var e=null;a.g=!1;var f=0>d&&a.C&&!a.C.w.ha;if(d)a.controller.P('Unable to load disk "'+a.Ya+'" (error '+d+": "+b+")",f);else{qb(a.controller.Sa,b,c);try{if(0<ra(a.Ic,!0).toLowerCase().indexOf("-readonly"))a.g=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.g=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.Ya]:h=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(h.length)if(1==h.length)q(h[0]);else{a.va=h.length;a.Aa=h[0].length;a.qa=h[0][0].length;var l=h[0][0][0];a.Oa=l&&l.length||512;for(d=c=0;d<a.va;d++)for(f=0;f<a.Aa;f++)for(g=0;g<a.qa;g++)if(l=h[d][f][g]){var m=l.length;void 0===m&&(m=l.length=512);var m=m>>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var v=l.data;if(void 0===v){var r=l.bytes;if(void 0!==r&&r.length){for(var w=m<<2,y=r.length;y<w;y++)r[y]=n;xh(l,r)}else v=[],n=l.pattern=n|n<<8|n<<16|n<<24,l.data=v;delete l.bytes}uh(l,d,f);for(w=
0;w<v.length;w++)c=c+v[w]&-1}a.b=h;a.f=c;e=a}else q("Empty disk image: "+a.Ya)}catch(x){q("Disk image error ("+b+"): "+x.message)}}a.v&&(a.v.call(a.B,a.A,e,a.Ya,a.gb),a.v=null)}function uh(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.We=b;a.Xe=c;a.Ra=a.Da=0;a.Ua=!1;return a}
k.seek=function(a,b,c,d,e){d=null;var f=this.A,g=this.b[a];if(g){var h=g[b];if(!h&&f.Oc&&b<f.Aa)for(h=g[b]=Array(f.Pc),g=0;g<h.length;g++)h[g]=uh(null,a,b,g+1,f.Bc,0);if(h){for(g=0;g<h.length;g++)if(h[g]&&h[g].sector==c){d=h[g];break}!d&&f.Oc&&9==f.oc&&(d=h[g]=uh(null,a,b,f.oc,f.Bc,0))}}e&&e(d,!1);return d};function xh(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
k.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};k.write=function(a,b,c){if(this.g)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.Da?f<a.Ra?(a.Da+=a.Ra-f,a.Ra=f):f>=a.Ra+a.Da&&(a.Da+=f-(a.Ra+a.Da)+1):(a.Ra=f,a.Da=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
function yh(a,b){var c=a.Aa*a.qa,d=b/c|0;return d<a.va?(b%=c,a.seek(d,b/a.qa|0,b%a.qa+1)):null}function zh(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}
k.save=function(){var a=0,b=[];b[a++]=[this.gb,this.f,this.va,this.Aa,this.qa,this.Oa];if(!this.g)for(var c=this.b,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Da){for(var h=[],l=0,m=g.Ra,n=g.Ra+g.Da;m<n;)h[l++]=g.data[m++];b[a++]=[d,e,f,g.Ra,h]}}return b};
k.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.b.length&&6<=e.length?th(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.f&&e[1]!=this.f&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.f+")",b=-2));for(this.b.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],h=g[f++],l=g[f++],m=g[f++];if(h>=this.b.length||l>=this.b[h].length||m>=this.b[h][l].length){c="sector (CHS="+h+":"+l+":"+m+") out of range ("+
b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(h=this.b[h][l][m]){for(l=h.data.length;l<e;)h.data[l++]=h.pattern;l=0;h.Ra=e;for(h.Da=f.length;e<g;)h.data[e++]=f[l++];b++}}}0>b&&-2!=b&&this.controller.P("Unable to restore disk '"+this.Ya+": "+c);return b};
k.toJSON=function(){var a;a=0;for(var b;b=yh(this,a++);)Ah(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function Ah(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function M(a){t.call(this,"RL11",a,M,4194304);this.A=a.autoMount||null;this.H=0;this.f=Array(4);this.L=!Ra("Mobi")&&window&&"FileReader"in window}z(M);k=M.prototype;
k.sa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.G[b]=c,c.onchange=function(){var a=d.G.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){q("RL11 option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.G[b]=c,c.onchange=function(){var a=la(c.value,10);null!=a&&Bh(d,a)},!0;case "loadDrive":return this.G[b]=
c,c.onclick=function(){var a=d.G.listDisks;a&&Ch(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.L){c.parentNode.removeChild(c);break}this.G[b]=c;c.onclick=function(){var a=d.G.listDrives;if(a&&a.options&&d.f)if(a=d.f[la(a.value,10)||0])if(a=a.Ea){var b;b="";for(var c=0,h;h=yh(a,c++);)for(var l=0,m=h.length;l<m;l++)b+=String.fromCharCode(zh(a,h,l));b=btoa(b);a=a.Ic.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),
var Ab="undefined"!==typeof ArrayBuffer,Bb="UNKNOWN ABORT ILLEGAL RED YELLOW FAULT TRACE HALT OPCODE INTERRUPT".split(" "),Cb={cpu:1,trap:16,fault:32,bus:64,memory:128,rom:256,device:512,panel:1024,keyboard:65536,key:131072,paper:1048576,disk:4194304,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};
function Db(a){t.call(this,"Panel",a,Db,1024);this.sa=this.w=this.Ya=this.rb=this.B=this.D=0;this.I=this.K=this.H=!1;this.L=Eb;this.g={};this.f={START:[1,1,!0,!1,this.hd],STEP:[1,1,!1,!1,this.jd],ENABLE:[1,1,!1,!1,this.dd],CONT:[1,1,!0,!1,this.bd],DEP:[0,0,!0,!1,this.cd],EXAM:[1,1,!0,!1,this.ed],LOAD:[1,1,!0,!1,this.gd],TEST:[0,0,!0,!1,this.fd]};for(a=0;22>a;a++)this.f["S"+a]=[0,0,!1,!1,this.kd,a]}z(Db);var Eb=7;function Fb(a,b){return a.f[b]&&a.f[b][1]}k=Db.prototype;k.reset=function(){this.stop()};
k.ua=function(a,b,c,d){if(this.C&&this.C.ua(a,b,c,d)||this.b&&this.b.ua(a,b,c,d)||this.i&&this.i.ua(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.G[b]=c,this.D++,!0;default:return"led"==a||"rled"==a?(this.G[b]=c,this.g[b]=d?1:0,this.D++,!0):"switch"==a?(void 0===this.f[b]&&(this.f[b]=[d?1:0,d?1:0]),this.G[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,
b){return function(){Gb(a,b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){Hb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){Gb(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){Hb(a,b)}}(this,b),!0):this.parent.ua.call(this,a,b,c,d)}};k.Ia=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;Ib(b,this,Jb);Kb(b,this.reset.bind(this));Lb(this);Mb(this)};k.Ka=function(a,b){b||(Nb(),this.reset());return!0};k.Ja=function(){return!0};
function Ob(a,b,c){if(a=a.G[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function Lb(a,b){for(var c in a.g)Ob(a,c,null!=b?b:a.g[c])}function Pb(a,b,c){if(a=a.G[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function Mb(a){for(var b in a.f)Pb(a,b,a.f[b][1])}function Qb(a,b,c,d){a.G[b]&&(void 0===c&&(zb(a,"Value for "+b+" is invalid"),a.b.da()),c=8==(a.i&&a.i.ca||8)?ra(c,d):p(c,d),a.G[b].textContent!=c&&(a.G[b].textContent=c))}
function Gb(a,b){var c=a.f[b];Pb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.I="DEP"==b,a.K="EXAM"==b)}function Hb(a,b){var c=a.f[b];c[2]&&c[3]&&(Pb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}k.hd=function(a){a||this.b.A.W||(a=this.b,a.v.reset(),Rb(a),Fb(this,"ENABLE")&&this.b.jb())};k.jd=function(){};k.dd=function(a){a||this.b.da()};
k.bd=function(a){if(!a&&!this.b.A.W)if(Fb(this,"ENABLE"))this.b.jb();else{if((a=this.i)&&!wb(a,!0))vb(a,!0),a.kb(0,null),vb(a,!1);else try{var b=this.b.kb(1);0<b&&(dc(this.b,b),ec(this.b,b,!0),fc(this.b,b))}catch(c){"number"!=typeof c&&zb(this.b,c.stack||c.message)}this.stop();this.C&&this.C.pa()}};k.cd=function(a){a&&!this.b.A.W&&(this.I&&gc(this),a=hc(this,this.Ya),this.L==Eb?this.v.Fb(this.sa,a):this.b.Fb(this.sa,a))};
k.ed=function(a){a||this.b.A.W||(this.K&&gc(this),a=this.L==Eb?this.v.fb(this.sa):this.b.fb(this.sa),hc(this,a))};k.gd=function(a){a||this.b.A.W||ic(this,this.Ya)};k.fd=function(a){a?(this.H=!0,Lb(this,!0)):(this.H=!1,Lb(this),jc(this,0))};k.kd=function(a,b){this.Ya=a?this.Ya|1<<b:this.Ya&~(1<<b)};function gc(a){var b=1145>a.b.Xa?8:16,c=65472<=a.sa&&a.sa<65472+b,b=c?1:2,c=c?15:a.v.Qa;Fb(a,"STEP")||(b=-b);ic(a,a.sa&~c|a.sa+b&c)}
function ic(a,b){a.sa=b&a.v.Qa;b=a.sa;for(var c=0;22>c;c++)kc(a,"A"+c,b&1<<c)}function hc(a,b){a.w=b&65535;b=a.w;for(var c=0;16>c;c++)kc(a,"D"+c,b&1<<c);return a.w}function kc(a,b,c){a.g[b]=c;a.H||Ob(a,b,c)}function lc(a){return void 0!==a.G.S0}function jc(a,b){if(lc(a)){a.Ya=b;for(var c=0;22>c;c++)a.f["S"+c][1]=b&1<<c?1:0;Mb(a)}}k.stop=function(){ic(this,this.b.u[7])};k.nc=function(a){this.sa=a};k.setData=function(a,b){b?this.rb=a:this.w=a};k.nd=function(a){return(a?this.Ya:this.rb)&65535};
k.he=function(a){this.rb=a};var mc={},Jb=(mc[65400]=[null,null,Db.prototype.nd,Db.prototype.he,"CNSW"],mc);function Nb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=tb(e.id);f||(a=!0,f=new Db(e));B(f,d);a&&H(f)}}$a(Nb);
function nc(a,b,c){t.call(this,"Bus",a,nc,64);this.b=b;this.i=c;this.K=a.busWidth||16;this.C=0;this.w=[];this.g=null;this.H=1<<this.K;this.Qa=this.H-1;this.Ba=oc;this.ja=Math.log2(this.Ba);this.I=this.Ba>>2;this.v=this.Ba-1;this.D=this.H/this.Ba|0;this.cb=[];this.la=0;this.f=!1;this.gc=0;this.B=[];this.Qc=[pc,qc,rc,sc];a=new I(this);tc(a,this.i);this.Y=Array(this.D);for(b=0;b<this.D;b++)this.Y[b]=a;H(this)}z(nc);var oc=8192,uc=oc-1;
function pc(a,b){var c=-1,d=this.controller,e=d.cb[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.cb[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return this.i&&F(this.i,e[5])&&E(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!d.la),c;d.Ha(b,16,3);c=255;this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!d.la);return c}
function qc(a,b,c){var d=!1,e=this.controller,f=e.cb[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.cb[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d?this.i&&F(this.i,f[5])&&E(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!e.la):(e.Ha(c,16,5),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),
!0,!e.la))}function rc(a,b){var c=-1,d=this.controller;a=d.cb[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return this.i&&F(this.i,a[5])&&E(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!d.la),c;d.Ha(b,16,2);c=65535;this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!d.la);return c}
function sc(a,b,c){var d=!1,e=this.controller;a=e.cb[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d?this.i&&F(this.i,a[5])&&E(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!e.la):(e.Ha(c,16,4),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!e.la))}
function vc(a,b){if(b!=a.C){var c;a.C&&(c=(1<<a.C)-oc,wc(a,c,oc,a.w),a.C=0);b&&(a.C=b,c=1<<b,a.Qa=c-1,c-=oc,a.w=xc(a,c,oc),a.g?wc(a,c,oc,a.g):(yc(a,c,oc,zc,a),a.g=xc(a,c,oc)))}}k=nc.prototype;k.reset=function(){for(var a=0;a<this.B.length;a++)this.B[a]();vc(this,16)};k.Ka=function(a,b){b||this.reset();return!0};
function yc(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ja;0<g&&h<a.Y.length;){var l=a.Y[h],m=h*a.Ba,n=a.Ba-(f-m);n>g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.F)return l.Ub+=l.F-f,l.F=f,!0;if(f>=l.F+l.Ub){n=l.size-(f-m);n>g&&(n=g);l.Ub=f-l.F+n;f=m+a.Ba;g-=n;h++;continue}}return Ac(1,f,g)}f=new I(a,f,n,a.Ba,d,e);tc(f,a.i,l);a.Y[h++]=f;f=m+a.Ba;g-=n}return 0>=g?(d==Bc&&(a.gc+=c),a.status((c>>10)+"Kb "+Cc[d]+" at "+ra(b)),!0):Ac(2,b,c)}
function xc(a,b,c){var d=[];for(b>>>=a.ja;0<c&&b<a.Y.length;)d.push(a.Y[b++]),c-=a.Ba;return d}function wc(a,b,c,d){var e=0;for(b>>>=a.ja;0<c&&b<a.Y.length;){var f=d[e++];if(!f)break;a.Y[b++]=f;c-=a.Ba}}k.Lb=function(a){3932160<=a&&(a=Dc(this.b,a));return this.Y[(a&this.Qa)>>>this.ja].$b(a&this.v,a)};k.Zb=function(a){3932160<=a&&(a=Dc(this.b,a));this.f=!1;this.la++;a=this.Y[(a&this.Qa)>>>this.ja].lc(a&this.v,a);this.la--;return a};
k.na=function(a){3932160<=a&&(a=Dc(this.b,a));return this.Y[(a&this.Qa)>>>this.ja].ra(a&this.v,a)};k.fb=function(a){3932160<=a&&(a=Dc(this.b,a));var b=a&this.v,c=(a&this.Qa)>>>this.ja;this.f=!1;this.la++;a=this.Y[c].mc(b,a);this.la--;return a};k.Eb=function(a,b){3932160<=a&&(a=Dc(this.b,a));this.Y[(a&this.Qa)>>>this.ja].cc(a&this.v,b&255,a)};k.tb=function(a,b){3932160<=a&&(a=Dc(this.b,a));this.f=!1;this.la++;this.Y[(a&this.Qa)>>>this.ja].dc(a&this.v,b&255,a);this.la--};
k.ib=function(a,b){3932160<=a&&(a=Dc(this.b,a));this.Y[(a&this.Qa)>>>this.ja].Vb(a&this.v,b&65535,a)};k.Fb=function(a,b){3932160<=a&&(a=Dc(this.b,a));var c=a&this.v,d=(a&this.Qa)>>>this.ja;this.f=!1;this.la++;this.Y[d].pc(c,b&65535,a);this.la--};
function Ec(a){for(var b=0,c=[],d=0;d<a.D;d++){var e=a.Y[d];if(e.Wa||e.Vc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,l=[];g<e.length;){for(var m=e[g],n=g+1;n<e.length&&e[n]===m;)n++;l[h++]=n-g;l[h++]=m;g=n}l.length<e.length&&(e=l)}c[f]=e}}return c}function Fc(a,b,c,d,e,f,g,h,l){for(;b<=c;b+=2){var m=b&uc;if(void 0!==a.cb[m])return q("I/O address already registered: "+p(b,8,!0)),!1;a.cb[m]=[d,e,f,g,l||"unknown",h,!1]}return!0}
function Ib(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[6]&&f[6]>a.b.Xa)){var g=f[0]?f[0].bind(b):null,h=f[1]?f[1].bind(b):null,l=f[2]?f[2].bind(b):null,m=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&l&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(l)),!h&&m&&(h=function(a){return function(b,c){return a(b,c)}.bind(b)}(m)));for(var n=f[4],v=f[5]||1,r=0;r<v;r++,e+=2)if(n&&1<v&&(n=f[4]+r),!Fc(a,e,e,g,h,l,m,b.ka||64,n||b.ab))return!1}}return!0}function Kb(a,b){a.B.push(b)}
k.Ha=function(a,b,c){this.f=!0;this.la||(this.i&&F(this.i,32)&&E(this.i,"memory fault ("+c+") on "+J(this.i,a),!0,!0),b&&(this.b.ta|=b),this.b.va(4,0,a))};function Gc(a){var b=a.f;a.f=!1;return b}function Ac(a,b,c){q("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}function K(a){t.call(this,"Device",a,K,512);this.f={fa:0,oc:-1}}z(K);k=K.prototype;
k.Ia=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.i=d;var e=this;this.f.oc=Hc(c,function(){e.f.Ob|=128;e.f.Ob&64&&Ic(e.b,e.f.fe);e.C&&e.C.pa(1);Qc(e.b,e.f.oc,1E3/60)});this.f.fe=Rc(64,6);Ib(b,this,Sc);Kb(b,this.reset.bind(this));H(this)};k.reset=function(){this.f.Ob=128;Qc(this.b,this.f.oc,1E3/60,!0)};k.vd=function(){return this.f.Ob};k.pe=function(a){this.f.Ob=a&192};k.xd=function(){return Tc(this.b)};k.re=function(a){Uc(this.b,a&-129|this.b.Da&128)};k.yd=function(){return Vc(this.b)};
k.zd=function(){return Wc(this.b)};k.Ad=function(){return this.b.Ta};k.se=function(a){Xc(this.b,a)};k.ae=function(a){a=a>>1&63;var b=this.b.Tb[a>>1];return a&1?b>>16:b&65535};k.Te=function(a,b){b=b>>1&63;var c=b>>1;this.b.Tb[c]=b&1?this.b.Tb[c]&65535|(a&63)<<16:this.b.Tb[c]&-65536|a&65534};k.Ud=function(a){return this.b.V[1][a>>1&7]};k.Me=function(a,b){this.b.V[1][b>>1&7]=a&65295};k.Sd=function(a){return this.b.V[1][(a>>1&7)+8]};k.Ke=function(a,b){this.b.V[1][(b>>1&7)+8]=a&65295};
k.Td=function(a){return this.b.Aa[1][a>>1&7]};k.Le=function(a,b){b=b>>1&7;this.b.Aa[1][b]=a;this.b.V[1][b]&=65295};k.Rd=function(a){return this.b.Aa[1][(a>>1&7)+8]};k.Je=function(a,b){b=(b>>1&7)+8;this.b.Aa[1][b]=a;this.b.V[1][b]&=65295};k.ud=function(a){return this.b.V[0][a>>1&7]};k.oe=function(a,b){this.b.V[0][b>>1&7]=a&65295};k.sd=function(a){return this.b.V[0][(a>>1&7)+8]};k.me=function(a,b){this.b.V[0][(b>>1&7)+8]=a&65295};k.td=function(a){return this.b.Aa[0][a>>1&7]};
k.ne=function(a,b){b=b>>1&7;this.b.Aa[0][b]=a;this.b.V[0][b]&=65295};k.rd=function(a){return this.b.Aa[0][(a>>1&7)+8]};k.le=function(a,b){b=(b>>1&7)+8;this.b.Aa[0][b]=a;this.b.V[0][b]&=65295};k.$d=function(a){return this.b.V[3][a>>1&7]};k.Se=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.Yd=function(a){return this.b.V[3][(a>>1&7)+8]};k.Qe=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.Zd=function(a){return this.b.Aa[3][a>>1&7]};k.Re=function(a,b){b=b>>1&7;this.b.Aa[3][b]=a;this.b.V[3][b]&=65295};
k.Xd=function(a){return this.b.Aa[3][(a>>1&7)+8]};k.Pe=function(a,b){b=(b>>1&7)+8;this.b.Aa[3][b]=a;this.b.V[3][b]&=65295};k.Cb=function(a){a&=7;return this.b.N&2048?this.b.Za[a]:this.b.u[a]};k.Gb=function(a,b){b&=7;this.b.N&2048?this.b.Za[b]=a:this.b.u[b]=a};k.Fd=function(){return this.b.N&49152?this.b.La[0]:this.b.u[6]};k.xe=function(a){this.b.N&49152?this.b.La[0]=a:this.b.u[6]=a};k.Id=function(){return this.b.u[7]};k.Ae=function(a){this.b.u[7]=a};
k.Db=function(a){a&=7;return this.b.N&2048?this.b.u[a]:this.b.Za[a]};k.Hb=function(a,b){b&=7;this.b.N&2048?this.b.u[b]=a:this.b.Za[b]=a};k.Gd=function(){return 1==(this.b.N&49152)>>14?this.b.u[6]:this.b.La[1]};k.ye=function(a){1==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.La[1]=a};k.Hd=function(){return 3==(this.b.N&49152)>>14?this.b.u[6]:this.b.La[3]};k.ze=function(a){3==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.La[3]=a};k.pd=function(a){return this.b.Jc[a-65504>>1]};
k.je=function(a,b){this.b.Jc[b-65504>>1]=a};k.Gc=function(a){if(65520==a){a=0;switch(Bc){case Bc:a=this.v.gc}a=(a>>6)-1}else a=0;return a};k.Nc=function(){};k.Wd=function(){return 1};k.Oe=function(){};k.od=function(){return this.b.ta};k.ie=function(){this.b.ta=0};k.wd=function(){return this.b.Ic};k.qe=function(a,b){b&1||(a&=255);this.b.Ic=a};k.Bd=function(a){return a?this.b.Sb:0};k.te=function(a){Yc(this.b,a)};k.Vd=function(a){return a?this.b.sb&65280:0};k.Ne=function(a){this.b.sb=a|255};k.Ed=function(){return Zc(this.b)};
k.we=function(a){$c(this.b,a&-1793|Zc(this.b)&1792);this.b.J|=128};k.Mc=function(a,b){F(this)&&E(this,"writeIgnored("+ra(b)+"): "+ra(a),!0,!0)};
var L={},Sc=(L[61568]=[null,null,K.prototype.ae,K.prototype.Te,"UNIMAP",64,1170],L[62592]=[null,null,K.prototype.Ud,K.prototype.Me,"SIPDR",8,1145],L[62608]=[null,null,K.prototype.Sd,K.prototype.Ke,"SDPDR",8,1145],L[62624]=[null,null,K.prototype.Td,K.prototype.Le,"SIPAR",8,1145],L[62640]=[null,null,K.prototype.Rd,K.prototype.Je,"SDPAR",8,1145],L[62656]=[null,null,K.prototype.ud,K.prototype.oe,"KIPDR",8,1145],L[62672]=[null,null,K.prototype.sd,K.prototype.me,"KDPDR",8,1145],L[62688]=[null,null,K.prototype.td,
K.prototype.ne,"KIPAR",8,1145],L[62704]=[null,null,K.prototype.rd,K.prototype.le,"KDPAR",8,1145],L[62798]=[null,null,K.prototype.Ad,K.prototype.se,"MMR3",1,1145],L[65382]=[null,null,K.prototype.vd,K.prototype.pe,"LKS"],L[65402]=[null,null,K.prototype.xd,K.prototype.re,"MMR0",1,1145],L[65404]=[null,null,K.prototype.yd,K.prototype.Mc,"MMR1",1,1145],L[65406]=[null,null,K.prototype.zd,K.prototype.Mc,"MMR2",1,1145],L[65408]=[null,null,K.prototype.$d,K.prototype.Se,"UIPDR",8,1145],L[65424]=[null,null,K.prototype.Yd,
K.prototype.Qe,"UDPDR",8,1145],L[65440]=[null,null,K.prototype.Zd,K.prototype.Re,"UIPAR",8,1145],L[65456]=[null,null,K.prototype.Xd,K.prototype.Pe,"UDPAR",8,1145],L[65472]=[null,null,K.prototype.Cb,K.prototype.Gb,"R0SET0"],L[65473]=[null,null,K.prototype.Cb,K.prototype.Gb,"R1SET0"],L[65474]=[null,null,K.prototype.Cb,K.prototype.Gb,"R2SET0"],L[65475]=[null,null,K.prototype.Cb,K.prototype.Gb,"R3SET0"],L[65476]=[null,null,K.prototype.Cb,K.prototype.Gb,"R4SET0"],L[65477]=[null,null,K.prototype.Cb,K.prototype.Gb,
"R5SET0"],L[65478]=[null,null,K.prototype.Fd,K.prototype.xe,"R6KERNEL"],L[65479]=[null,null,K.prototype.Id,K.prototype.Ae,"R7KERNEL"],L[65480]=[null,null,K.prototype.Db,K.prototype.Hb,"R0SET1",1,1145],L[65481]=[null,null,K.prototype.Db,K.prototype.Hb,"R1SET1",1,1145],L[65482]=[null,null,K.prototype.Db,K.prototype.Hb,"R2SET1",1,1145],L[65483]=[null,null,K.prototype.Db,K.prototype.Hb,"R3SET1",1,1145],L[65484]=[null,null,K.prototype.Db,K.prototype.Hb,"R4SET1",1,1145],L[65485]=[null,null,K.prototype.Db,
K.prototype.Hb,"R5SET1",1,1145],L[65486]=[null,null,K.prototype.Gd,K.prototype.ye,"R6SUPER",1,1145],L[65487]=[null,null,K.prototype.Hd,K.prototype.ze,"R6USER",1,1145],L[65504]=[null,null,K.prototype.pd,K.prototype.je,"CTRL",8,1170],L[65520]=[null,null,K.prototype.Gc,K.prototype.Nc,"LSIZE",1,1170],L[65522]=[null,null,K.prototype.Gc,K.prototype.Nc,"HSIZE",1,1170],L[65524]=[null,null,K.prototype.Wd,K.prototype.Oe,"SYSID",1,1170],L[65526]=[null,null,K.prototype.od,K.prototype.ie,"CPUERR",1,1170],L[65528]=
[null,null,K.prototype.wd,K.prototype.qe,"MB",1,1170],L[65530]=[null,null,K.prototype.Bd,K.prototype.te,"PIR"],L[65532]=[null,null,K.prototype.Vd,K.prototype.Ne,"SL"],L[65534]=[null,null,K.prototype.Ed,K.prototype.we,"PSW"],L);$a(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=A(d);switch(c.type){case "default":c=new K(c);B(c,d);break;case "pc11":c=new ad(c);B(c,d);break;case "rl11":c=new M(c),B(c,d)}}});var bd;
if(Ab){var cd=new ArrayBuffer(2);(new DataView(cd)).setUint16(0,256,!0);bd=256===(new Uint16Array(cd))[0]}else bd=!1;var dd=bd;
function I(a,b,c,d,e,f){this.v=a;this.id=ed+=2;this.b=null;this.F=b;this.Ub=c;this.size=d||0;this.type=e||fd;this.f=e==gd;this.controller=null;tc(this);this.Wa=this.Vc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],hd(this,f.Qc);else if(Ab)this.B=new ArrayBuffer(this.size),this.D=new DataView(this.B,0,this.size),this.G=new Uint8Array(this.B,0,this.size),this.I=new Uint16Array(this.B,0,this.size>>1),this.b=new Int32Array(this.B,0,this.size>>2),hd(this,dd?id:jd);else{a=this.b=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;hd(this,kd)}else hd(this)}var fd=0,Bc=1,gd=2,zc=4,Cc=["NONE","RAM","ROM","VID","H/W"],ed=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ab)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.D.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(Ab)for(b=0;b<a.length;b++)this.D.setInt32(b<<2,a[b],!0);else this.b=a;return this.Wa=!0}return!1},ob:function(a,b){b?this.C++||ld(this,md,!1):this.g++||nd(this,md,!1)},K:function(a,b){this.i&&F(this.i,128)&&E(this.i,
"attempt to read invalid address "+J(this.i,b),!0);this.v.Ha(b,32,2);return 255},w:function(a,b,c){this.i&&F(this.i,128)&&E(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0);this.v.Ha(c,32,4)},L:function(a,b){return this.$b(a++,b++)|this.$b(a,b)<<8},H:function(a,b,c){this.cc(a++,b&255,c++);this.cc(a,b>>8,c)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ca:function(a,b){a&1&&this.v.Ha(b,64,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+
1]&255)<<8},wa:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Wa=!0},Ma:function(a,b,c){a&1&&this.v.Ha(c,64,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Wa=!0},O:function(a,b){if(this.i&&null!=this.F){var c=this.i;od(c,this.F+a,1,c.M)&&c.da(!0)}return this.lc(a,b)},Ua:function(a,b){if(this.i&&null!=this.F){var c=this.i;od(c,this.F+a,2,c.M)&&c.da(!0)}return this.mc(a,b)},ab:function(a,
b,c){if(this.i&&null!=this.F){var d=this.i;od(d,this.F+a,1,d.D)&&d.da(!0)}this.f?this.w(a,b,c):this.dc(a,b,c)},za:function(a,b,c){if(this.i&&null!=this.F){var d=this.i;od(d,this.F+a,2,d.D)&&d.da(!0)}this.f?this.w(a,b,c):this.pc(a,b,c)},M:function(a){return this.G[a]},R:function(a,b){a=this.G[a];this.i&&F(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},X:function(a,b){a&1&&this.v.Ha(b,64,2);return this.D.getUint16(a,!0)},ba:function(a,b){a&1&&this.v.Ha(b,64,2);
a=this.I[a>>1];this.i&&F(this.i,128)&&E(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ia:function(a,b){this.G[a]=b;this.Wa=!0},ma:function(a,b,c){this.G[a]=b;this.Wa=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},ya:function(a,b,c){a&1&&this.v.Ha(c,64,4);this.D.setUint16(a,b,!0);this.Wa=!0},Ea:function(a,b,c){a&1&&this.v.Ha(c,64,4);this.I[a>>1]=b;this.Wa=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,
b)+")",!0)}};function tc(a,b,c){a.i=b;a.g=a.C=0;c&&((a.g=c.g)&&nd(a,md,!1),(a.C=c.C)&&ld(a,md,!1))}function pd(a,b){b?--a.C||(a.cc=a.f?a.w:a.dc,a.Vb=a.f?a.H:a.pc):--a.g||(a.$b=a.lc,a.ra=a.mc)}function ld(a,b,c){c&&a.C||(a.cc=!a.f&&b[1]||a.w,a.Vb=!a.f&&b[3]||a.H);if(c||void 0===c)a.dc=b[1]||a.w,a.pc=b[3]||a.H}function nd(a,b,c){c&&a.g||(a.$b=b[0]||a.K,a.ra=b[2]||a.L);if(c||void 0===c)a.lc=b[0]||a.K,a.mc=b[2]||a.L}function hd(a,b){b||(b=qd);nd(a,b,void 0);ld(a,b,void 0)}
var qd=[],kd=[I.prototype.S,I.prototype.wa,I.prototype.ca,I.prototype.Ma],md=[I.prototype.O,I.prototype.ab,I.prototype.Ua,I.prototype.za];if(Ab)var jd=[I.prototype.M,I.prototype.ia,I.prototype.X,I.prototype.ya],id=[I.prototype.R,I.prototype.ma,I.prototype.ba,I.prototype.Ea];
function rd(a,b){t.call(this,"CPU",a,rd,1);b=a.cycles||b;var c=a.multiplier||1;this.wb=0;this.nb=b;this.gb=c;this.Ib=Math.round(this.nb/1E4)/100;this.qb=this.Ib*this.gb;this.A.W=!1;this.A.bc=!1;this.A.vb=a.autoStart;this.A.xb=!1;this.Pb=this.wa=0;this.Qb=a.csStart;this.zb=a.csInterval;this.Ab=a.csStop;this.K=[];this.Fc=this.ee.bind(this);H(this)}z(rd);var sd=["power","reset"];k=rd.prototype;
k.Ia=function(a,b,c,d){this.C=a;this.v=b;this.i=d;this.w=a.w;for(b=0;b<sd.length;b++)(c=this.G[sd[b]])&&this.C.ua(null,sd[b],c);a=td(a,"autoStart");null!=a&&(this.A.vb="true"==a?!0:"false"==a?!1:!!a);H(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.Ka=function(a,b){if(!b){if(a&&this.restore){ud(this);if(!this.restore(a))return!1;vd(this)}else this.reset();this.i?(a=this.i,b=this.A.vb,a.lb=!0,a.j("Type ? for help with PDPjs Debugger commands"),wd(a),b||a.ub(),a.bb&&(b=a.bb,a.bb=null,xd(a,b))):this.j("No debugger detected")}return!0};k.Ja=function(a){return a?this.save():!0};k.vb=function(){return this.A.vb||!this.i&&void 0===this.G.run?(this.jb(),!0):!1};k.vc=function(){return 0};
function vd(a){void 0===a.Qb&&(a.Qb=0);void 0===a.zb&&(a.zb=-1);void 0===a.Ab&&(a.Ab=-1);a.A.xb=0<=a.Qb&&0<a.zb;a.A.xb&&(a.Pb=0,a.wa=a.Qb-a.ia)}function fc(a,b){if(a.A.xb){var c=!1;a.Pb=a.Pb+a.vc()|0;a.wa-=b;0>=a.wa&&(a.wa+=a.zb,c=!0);0<=a.Ab&&a.Ab<=yd(a)&&(a.zb=a.Ab=-1,vd(a),a.da(),c=!0);c&&a.j(yd(a)+" cycles: checksum="+p(a.Pb))}}
k.ua=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.G[b]=c,!0;case "run":return this.G[b]=c,c.onclick=function(){var a;if(a=d.C)if(a=d.C,a.A.ha)a=!0;else{var b=null,c,h=sb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.A.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.A.ha);c++);c==h.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.A.ready?"powered yet":"ready yet"+(b.Yb?" (waiting for notification)":""))+".");a=!1}a&&(d.A.W?d.da():d.jb())},
!0;case "speed":return this.G[b]=c,!0;case "setSpeed":return this.G[b]=c,c.onclick=function(){zd(d,d.gb<<1,!0)},c.textContent=this.qb.toFixed(2)+"Mhz",!0}return!1};k.pa=function(a){this.C&&this.C.pa(a)};function ec(a,b,c){a.ia+=b;c&&(a.ca=a.b=a.I=0)}function Ad(a,b){var c=1;b&&1<a.gb&&a.ma&&(c=a.ma/a.Ib);a.Cc=Math.round(1E3/30);a.pb=Math.floor(a.nb/30*c);b||(a.ya=a.pb);a.Jb=0}function yd(a){return a.ia+a.X+a.ca-a.b}function ud(a){a.ma=0;a.Dc=0;a.ia=a.X=a.ca=a.b=a.I=0;vd(a);zd(a,1)}
function zd(a,b,c){var d=!1;if(void 0!==b){.8>a.ma/a.qb?b=1:d=!0;a.gb=b;b=a.Ib*a.gb;if(a.qb!=b){a.qb=b;b=a.qb.toFixed(2)+"Mhz";var e=a.G.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.C&&a.C.ub()}ec(a,a.X);a.X=0;a.S=Ba();a.ba=0;Ad(a);return d}function Hc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function Qc(a,b,c,d){0<=b&&b<a.K.length&&(d||0>a.K[b][0])&&(c=a.nb*a.gb/1E3*c|0,a.A.W&&(c+=Bd(a)),a.K[b][0]=c)}
function Cd(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function dc(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Bd(a,b){var c=a.ca-=a.b;a.b=a.I=0;b&&(a.ca=0);return c}
k.ee=function(){if(this.A.W){this.Jb>=this.nb&&Ad(this,!0);this.Ma=0;this.lb=Ba();if(this.ba){var a=this.lb-this.ba;a>this.Cc&&(this.S+=a,this.S>this.lb&&(this.S=this.lb))}try{do{var b=Cd(this,this.A.xb?1:this.pb);try{this.kb(b)}catch(e){if("number"!=typeof e)throw e;}b=Bd(this,!0);this.Ma+=b;this.X+=b;fc(this,b);dc(this,b);this.ya-=b;if(0>=this.ya){this.ya+=this.pb;15<=++this.Dc&&(this.pa(),this.Dc=0);break}}while(this.A.W)}catch(e){this.da();this.C&&this.C.stop(Ba(),yd(this));zb(this,e.stack||e.message);
return}if(this.A.W){a=setTimeout;b=this.Fc;this.ba=Ba();var c=this.Cc;this.Ma&&(c=Math.round(c*this.Ma/this.pb));var c=c-(this.ba-this.lb),d=this.ba-this.S;d&&(this.ma=Math.round(this.X/(10*d))/100,864E5<=d&&(this.ia=0,zd(this)));if(0>c||this.ma<this.qb)-1E3>c&&(this.S-=c),c=0;this.Jb+=this.Ma;this.ba+=c;a(b,c)}}};
k.jb=function(a){if(yb(this))return!1;if(this.A.W)return this.j(this.toString()+" busy"),!1;zd(this);this.A.W=!0;this.A.bc=!0;var b=this.G.run;b&&(b.textContent="Halt");this.C&&(a&&this.C.ub(!0),this.C.start(this.S,yd(this)));setTimeout(this.Fc,0);return!0};k.kb=function(){return 0};k.da=function(a){var b=!1;if(this.A.W){Bd(this);ec(this,this.X);this.X=0;this.A.W=!1;if(b=this.G.run)b.textContent="Run";this.C&&this.C.stop(Ba(),yd(this));b=!0}this.A.complete=a;return b};
function Dd(a){this.Xa=+a.model||1170;this.Ac=a.addrReset||0;rd.call(this,a,6666667);this.decode=1120==this.Xa?Ed.bind(this):Fd.bind(this);Gd(this);this.M=0;this.O=null;this.A.complete=!1}z(Dd,rd);k=Dd.prototype;k.reset=function(){this.status("model "+this.Xa);this.A.W&&this.da();Gd(this);ud(this);this.A.error=!1;this.parent.reset.call(this)};
function Gd(a){a.T=65536;a.U=32768;a.$=65535;a.Z=32768;a.N=15;a.u=[0,0,0,0,0,0,0,a.Ac];a.Za=[0,0,0,0,0,0];a.La=[0,0,0,0];a.B=0;a.mb=0;a.$c=[4,2,0,1];a.V=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.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]];a.Tb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0];a.Jc=[0,0,0,0,0,0,0,0];a.Ic=0;a.J=0;a.D=a.H=0;a.g=a.f=a.yb=0;a.za=-1;Rb(a)}function Rb(a){a.Da=0;a.Kb=0;a.Mb=0;a.Ta=0;a.ta=0;a.Sb=0;a.sb=255;a.L=0;a.bb=0;a.Ea=262143;a.Nb=0;a.oa=0;a.O=null;a.v&&Hd(a)}function Hd(a){a.L?(a.R=65536,a.yc=a.Ta&16?4186112:253952,a.aa=a.Yc,a.ra=a.be,a.Vb=a.Ue,vc(a.v,a.Ta&16?22:18)):(a.R=0,a.yc=57344,a.aa=a.Xc,a.ra=a.Hc,a.Vb=a.Oc,vc(a.v,16))}function Tc(a){return a.Da&-3199|a.bb<<5|a.mb<<1}
function Uc(a,b){b&=-3073;if(a.Da!=b){b&57344&&!(a.Da&57344)&&(a.Kb=a.oa>>16&65535,a.Mb=a.oa&65535);a.Da=b;a.bb=b>>5&3;a.mb=b>>1&15;var c=0;b&257&&(c=4,b&1&&(c|=2));a.L!=c&&(a.L=c,Hd(a))}}function Vc(a){a.Da&57344||(a.Kb=a.oa>>16&65535);a=a.Kb;a&65280&&(a=(a<<8|a>>8)&65535);return a}function Wc(a){a.Da&57344||(a.Mb=a.oa&65535);return a.Mb}function Xc(a,b){1170>a.Xa&&(b&=-49);a.Ta!=b&&(a.Ta=b,a.Ea=b&16?4194303:262143,Hd(a))}k.vc=function(){return 0};
k.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.ia,this.gb]);a.set(2,Ec(this.v));return a.data()};k.restore=function(a){var b=a[1];this.ia=b[1];zd(this,b[3]);a:{b=this.v;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.I){for(var f=0,g=Array(b.I),h=0;h<e.length-1;)for(var l=e[h++],m=e[h++];l--;)g[f++]=m;e=g}f=b.Y[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Id(a){return a.T&65536?1:0}
function Jd(a){return a.U&32768?2:0}function Kd(a){return a.$&65535?0:4}function Ld(a){return a.Z&32768?8:0}function Md(a){var b=a.u[7];a.oa=b;var c=a.ra(b);a.u[7]=b+2&65535;return c}function Nd(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function O(a,b){a.u[7]=b&65535}function Rc(a,b){return{ge:a,Bb:b,next:null}}function Od(a,b){var c=a.O;if(c==b)a.O=b.next;else for(;c;){a=c.next;if(a==b){c.next=a.next;break}c=a}}
function Ic(a,b){if(b!=a.O){var c=a.O;if(!c||c.Bb<=b.Bb)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.Bb<=b.Bb){b.next=d;c.next=b;break}c=d}while(c)}}a.J|=1}function je(a){return a.J&64?(a.va(168,64,-5),!0):a.J&32?(a.va(4,32,-4),!0):a.J&16?(a.va(12,16,-6),!0):!1}function Zc(a){return a.N=a.N&63728|Ld(a)|Kd(a)|Jd(a)|Id(a)}
function $c(a,b){a.Z=b<<12;a.$=~b&4;a.U=b<<14;a.T=b<<16;if((b^a.N)&2048)for(var c=a.Za.length;0<=--c;){var d=a.u[c];a.u[c]=a.Za[c];a.Za[c]=d}a.B=b>>14&3;c=a.N>>14&3;a.B!=c&&(a.La[c]=a.u[6],a.u[6]=a.La[a.B]);a.N=b;a.J|=2}function Yc(a,b){if(b&=65024){var c=b>>9;do b+=34;while(c>>=1)}a.Sb=b;a.J|=2}function Q(a,b){a.J&128||(a.Z=a.$=b,a.U=0)}function ke(a,b,c){a.J&128||(a.Z=a.$=a.T=b,a.U=c||0)}function le(a,b,c,d){a.J&128||(a.Z=a.$=a.T=b,a.U=(c^b)&(d^b))}
function me(a,b){a.J&128||(a.Z=a.$=a.T=b,a.U=a.Z^a.T>>1)}function ne(a,b,c,d){a.J&128||(a.Z=a.$=a.T=b,a.U=(c^d)&(d^b))}k.va=function(a,b,c){if(!this.M){0>this.za?this.za=Zc(this):this.B||(a=4,this.ta|=4,this.u[6]=4,c=-3);this.oa=a;this.B=0;var d=this.ra(a|this.R),e=this.ra(a+2&65535|this.R);$c(this,e&-12289|this.za>>2&12288);oe(this,this.za);oe(this,this.u[7]);O(this,d);this.J&=~(b|18);this.J|=9;this.za=-1;this.md=a;this.ld=c;if(-3<=c)throw a;}};
function pe(a){var b=qe(a),c=qe(a)&-1793;a.N&49152&&(c=c&-225|a.N&63712);O(a,b);$c(a,c);a.J&=-17}function Dc(a,b){var c=b>>13&31;31>c&&a.Ta&32&&(b=a.Tb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
function re(a,b,c){var d,e,f;if(!(c&a.L))return f=b&65535,57344<=f&&(f|=a.yc),f;d=b>>13;a.Ta&a.$c[a.B]||(d&=7);e=a.V[a.B][d];f=(a.Aa[a.B][d]<<6)+(b&8191)&a.Ea;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!=(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.V[a.B][d]=e;if(f!=(4194170&a.Ea)||a.B)a.bb=a.B,a.mb=d;b=!1;g&&(g&57344&&(0<=a.za&&(g|=128),a.Da&
57344||(g|=a.bb<<5|a.mb<<1,Uc(a,a.Da&-61695|g),b=!0)),a.Da&61440||!(f<(4191360&a.Ea)||f>(4194239&a.Ea))||(a.Da|=4096,a.Da&512&&(a.J|=64)),b&&a.va(168,0,-1));return f}function se(a,b){return a.v.Lb(b)}function qe(a){var b=a.ra(a.u[6]|a.R);a.u[6]=a.u[6]+2&65535;return b}function oe(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.oa=a.oa&65535|(a.oa&-65536)<<8|16121856;te(a,0,c);a.Vb(c,b)}function te(a,b,c){!a.B&&c<=a.sb&&(b||4<c)&&(1145<=a.Xa&&c<=a.sb-32?(a.ta|=4,a.u[6]=4,a.va(4,0,-3)):(a.ta|=8,a.J|=32))}
function ue(a,b,c,d){var e,f,g=d&8?0:a.R;switch(b){case 0:return a.va(4,0,-2),0;case 1:return 6==c&&d&4&&te(a,b,a.u[6]),a.b-=3,7==c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!=c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!=c&&(e|=g);e=a.ra(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!=c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!=c&&(e|=g);e=a.ra(e)|g;a.b-=8;break;case 6:return e=a.ra(Nd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.ra(Nd(a,2)),e=e+
a.u[c]&65535,e=a.ra(e|a.R)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;a.oa=a.oa&65535|(a.oa&-65536)<<8|(f<<3&248|c)<<16;6==c&&0>f&&te(a,b,a.u[6]);return e}k.Zb=function(a){if(!this.L)return this.v.Zb(a);this.M++;a=se(this,re(this,a,3));this.M--;return a};k.fb=function(a){if(!this.L)return this.v.fb(a);this.M++;a=this.Hc(re(this,a,2));this.M--;return a};k.tb=function(a,b){this.L?(this.M++,a=re(this,a,5),a&1&&this.b--,this.v.Eb(a,b),this.M--):this.v.tb(a,b)};
k.Fb=function(a,b){this.L?(this.M++,this.Oc(re(this,a,4),b),this.M--):this.v.Fb(a,b)};k.Xc=function(a,b,c){return ue(this,a,b,c)};k.Yc=function(a,b,c){return re(this,ue(this,a,b,c),c)};k.Hc=function(a){return this.v.na(this.Nb=a)};k.be=function(a){return this.v.na(this.Nb=re(this,a,2))};k.Oc=function(a,b){this.v.ib(this.Nb=a,b&65535)};k.Ue=function(a,b){this.v.ib(this.Nb=re(this,a,4),b)};
function ve(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=ue(a,b,d,2),c&65536||61440!==(a.N&61440)&&(d&=65535),a.B=a.N>>12&3,c=a.ra(d|c&a.R),a.B=a.N>>14&3):c=6!=d||(a.N>>2&12288)===(a.N&12288)?a.u[d]:a.La[a.N>>12&3];return c}function we(a,b,c,d){a.oa=a.oa&65535|1441792;var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=ue(a,b,e,4),c&65536||(e&=65535),a.B=a.N>>12&3,e=re(a,e|c&65536,4),a.B=a.N>>14&3,a.v.ib(e,d)):6!=e||(a.N>>2&12288)===(a.N&12288)?a.u[e]=d:a.La[a.N>>12&3]=d}
function xe(a,b){b>>=6;var c=a.H=b&7;return(b=a.D=(b&56)>>3)?se(a,a.aa(b,c,3)):-c-1}function ye(a,b){var c;b>>=6;var d=a.H=b&7;(b=a.D=(b&56)>>3)?c=a.v.na(a.aa(b,d,2)):c=-d-1;return c}function ze(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return ue(a,b,c,8)}function Ae(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?se(a,a.aa(b,c,3)):a.u[c]&255}function Be(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.v.na(a.aa(b,c,2)):a.u[c]}
function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.yb=a.aa(b,e,7),c=0>c?a.u[-c-1]&255:c,c=d.call(a,c,se(a,e)),e&1&&a.b--,a.v.Eb(e,c)):(b=a.u[e],c=0>c?a.u[-c-1]&255:c,a.u[e]=b&65280|d.call(a,c,b&255))}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.aa(b,e,6),a.v.ib(e,d.call(a,0>c?a.u[-c-1]:c,a.v.na(e)))):a.u[e]=d.call(a,0>c?a.u[-c-1]:c,a.u[e])}
function Ce(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.aa(b,e,5),e=c=0>c?a.u[-c-1]&255:c,d&1&&a.b--,a.v.Eb(d,e)):c?(c=0>c?a.u[-c-1]&255:c,a.u[e]=a.u[e]&~d|c<<24>>24&d):a.u[e]&=~d;return c}function De(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.aa(b,d,4),a.v.ib(d,c=0>c?a.u[-c-1]:c)):a.u[d]=c=0>c?a.u[-c-1]:c;return c}function T(a,b,c){c&&(O(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
k.kb=function(a){this.A.complete=!0;var b=this.i?Ee(this.i)?1:this.A.bc?-1:0:0,c=a?this.A.bc?0:1:-1;this.A.bc=!1;this.ca=this.b=a;do{if(b){if(Fe(this.i,this.u[7],c)){this.da();break}c||c++;b++}if(this.J){if(a=this.J&7)if(a=!1,this.J&2){this.J&=-3;var d=160,e=(this.Sb&224)>>5,f=this.O&&this.O.Bb>e?this.O:null;f&&(d=f.ge,e=f.Bb);e>(this.N&224)>>5?(this.J&4&&(Nd(this,2),this.J&=-5),this.va(d,0,-9),e=!0):e=!1;e&&(f&&Od(this,f),a=!0)}else this.J&1&&this.J++;if(a){if(b&&Fe(this.i,this.u[7],c)){this.da();
break}if(0>c)break}if(this.J&112&&je(this)){if(b&&Fe(this.i,this.u[7],c)){this.da();break}if(0>c)break}}this.J=this.J&7|this.N&16;this.decode(Md(this))}while(0<this.b);return this.A.complete?this.ca-this.b:void 0===this.A.complete?0:-1};$a(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Dd(d);B(d,c)}});function Ge(a,b){var c=b+a;le(this,c,a,b);return c&65535}function He(a,b){var c=b+a;le(this,c<<8,a<<8,b<<8);return c&255}
function Ie(a,b){a=b<<1;me(this,a);return a&65535}function Je(a,b){a=b<<1;me(this,a<<8);return a&255}function Ke(a,b){a=b&32768|b>>1|b<<16;me(this,a);return a&65535}function Le(a,b){a=b&128|b>>1|b<<8;me(this,a<<8);return a&255}function Me(a,b){a=b&~a;Q(this,a);return a}function Ne(a,b){a=b&~a;Q(this,a<<8);return a}function Oe(a,b){a|=b;Q(this,a);return a}function Pe(a,b){a|=b;Q(this,a<<8);return a}function Qe(a,b){a=~b|65536;ke(this,a);return a&65535}
function Re(a,b){a=~b|256;ke(this,a<<8);return a&255}function Se(a,b){a=b-a;this.J&128||(this.Z=this.$=a,this.U=b&(b^a));return a&65535}function Te(a,b){a=b-a;var c=a<<8;b<<=8;this.J&128||(this.Z=this.$=c,this.U=b&(b^c));return a&255}function Ue(a,b){a=b+a;this.J&128||(this.Z=this.$=a,this.U=a&(b^a));return a&65535}function Ve(a,b){a=b+a;var c=a<<8;this.J&128||(this.Z=this.$=c,this.U=c&(b<<8^c));return a&255}function We(a,b){a=-b;ke(this,a,a&b&32768);return a&65535}
function Xe(a,b){a=-b;ke(this,a<<8,(a&b&128)<<8);return a&255}function Ye(a,b){a=b<<1|this.T>>16&1;me(this,a);return a&65535}function Ze(a,b){a=b<<1|this.T>>16&1;me(this,a<<8);return a&255}function $e(a,b){a=(this.T&65536|b)>>1|b<<16;me(this,a);return a&65535}function af(a,b){a=((this.T&65536)>>8|b)>>1|b<<8;me(this,a<<8);return a&255}function bf(a,b){var c=b-a;ne(this,c,a,b);return c&65535}function cf(a,b){var c=b-a;ne(this,c<<8,a<<8,b<<8);return c&255}
function df(a,b){this.J&128||(this.Z=this.$=b&65280,this.U=this.T=0);return(b<<8|b>>8)&65535}function ef(a,b){a^=b;Q(this,a);return a&65535}function ff(a){S(this,a,ye(this,a),Ge);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
function gf(a){var b=Be(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.T=this.U=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.T=c<<17-b,c>>=b;else if(b)if(16<b)this.U=c,c=0;else{this.T=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.U=32768)}this.u[a]=c&65535;this.Z=this.$=c;this.b-=(this.g?6:7)+b}
function hf(a){var b=Be(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.T=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.T=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.U=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.Z=d>>16;this.$=d>>16|d;this.b-=(this.g?6:7)+b}function jf(a){T(this,a,!Id(this))}function kf(a){T(this,a,Id(this))}
function lf(a){S(this,a,ye(this,a),Me);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function mf(a){R(this,a,xe(this,a),Ne);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function nf(a){S(this,a,ye(this,a),Oe);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function of(a){R(this,a,xe(this,a),Pe);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
function pf(a){var b=ye(this,a);a=Be(this,a);Q(this,(0>b?this.u[-b-1]:b)&a);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function qf(a){var b=xe(this,a);a=Ae(this,a);Q(this,((0>b?this.u[-b-1]&255:b)&a)<<8);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function rf(a){T(this,a,Kd(this))}function sf(a){T(this,a,!Ld(this)==!Jd(this))}function tf(a){T(this,a,!Kd(this)&&!Ld(this)==!Jd(this))}function uf(a){T(this,a,!Id(this)&&!Kd(this))}
function vf(a){T(this,a,Kd(this)||!Ld(this)!=!Jd(this))}function wf(a){T(this,a,Id(this)||Kd(this))}function xf(a){T(this,a,!Ld(this)!=!Jd(this))}function yf(a){T(this,a,Ld(this))}function zf(a){T(this,a,!Kd(this))}function Af(a){T(this,a,!Ld(this))}function Bf(){this.va(12,0,-8);this.b-=5}function Cf(a){T(this,a,!0)}function Df(a){T(this,a,!Jd(this))}function Ef(a){T(this,a,Jd(this))}function U(a){a&1&&(this.T=0);a&2&&(this.U=0);a&4&&(this.$=1);a&8&&(this.Z=0);this.b-=5}
function Ff(a){var b=ye(this,a);a=Be(this,a);var c=(b=0>b?this.u[-b-1]:b)-a;ne(this,c,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function Gf(a){var b=xe(this,a);a=Ae(this,a);var c=(b=(0>b?this.u[-b-1]&255:b)<<8)-(a<<=8);ne(this,c,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}
function Hf(a){var b=Be(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.$=d>>16|d,this.Z=d>>16):(this.U=32768,this.$=d>>15|d,this.Z=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.$=this.Z=0,this.U=32768,this.T=65536,this.b-=7}function If(){this.va(24,0,-8);this.b-=25}
function Jf(){this.N&49152?(this.ta|=128,this.va(4,0,-7)):(this.w&&1120==this.Xa&&this.w.setData(this.u[0],!0),this.i?Kf(this.i):this.da());this.b-=7}function Lf(){this.va(16,0,-8);this.b-=25}var Mf=[0,7,7,10,7,11,9,13];function Nf(a){this.I=this.b;O(this,ze(this,a));this.b=this.I-Mf[this.g]}var Of=[0,14,14,17,14,18,16,20];function Pf(a){this.I=this.b;var b=ze(this,a);a=a>>6&7;oe(this,this.u[a]);this.u[a]=this.u[7];O(this,b);this.b=this.I-Of[this.g]}
var Qf=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Rf(a){var b=ye(this,a);this.I=this.b;Q(this,De(this,a,b));this.b=this.I-Qf[(this.D?8:0)+this.g]+(7!=this.f||this.g?0:2)}function Sf(a){var b=xe(this,a);Q(this,Ce(this,a,b,65535)<<8);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}var Tf=[7,13,13,17,14,18,17,21];
function Uf(a){var b=Be(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.J&128||(this.Z=b>>16,this.$=this.Z|b,this.U=0,this.T=-32768>b||32767<b?65536:0);this.b-=23}function Vf(){this.b-=5}function Wf(){this.N&49152||(this.v.reset(),Rb(this),this.w&&this.w.setData(this.u[0],!0));this.b-=667}function Xf(a){if(a&8)V.call(this,a);else{var b=qe(this);a&=7;7==a?O(this,b):(O(this,this.u[a]),this.u[a]=b);this.b-=9}}
function Yf(){pe(this);this.b-=13}function W(a){a&1&&(this.T=65536);a&2&&(this.U=32768);a&4&&(this.$=0);a&8&&(this.Z=32768);this.b-=5}function Zf(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)O(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function $f(a){S(this,a,ye(this,a),bf);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function ag(a){S(this,a,0,df);this.b-=this.g?9:3+(7==this.f?2:0)}function bg(){this.va(28,0,-8);this.b-=5}
function cg(){this.w&&(this.w.nc(this.u[7],!0),this.w.setData(this.u[0],!0));this.J|=4;Nd(this,-2);this.b-=3}function dg(a){S(this,a,this.u[a>>6&7],ef);this.b-=this.g?9:3+(7==this.f?2:0)}function V(a){var b;if(b=this.i)b=this.i,F(b,1)?(E(b,"undefined opcode "+J(b,a),!0,!0),b=Kf(b)):b=!1;b||this.va(8,0,-8)}function Ed(a){eg[a>>12].call(this,a)}function fg(a){gg[a>>6&3].call(this,a)}function hg(a){ig[a>>6&3].call(this,a)}function jg(a){kg[a>>6&3].call(this,a)}function lg(a){mg[a&15].call(this,a)}
function ng(a){og[a&15].call(this,a)}function pg(a){qg[a>>6&3].call(this,a)}function rg(a){sg[a>>6&3].call(this,a)}function tg(a){ug[a>>6&3].call(this,a)}
var eg=[function(a){vg[a>>8&15].call(this,a)},Rf,Ff,pf,lf,nf,ff,V,function(a){wg[a>>8&15].call(this,a)},Sf,Gf,qf,mf,of,$f,V],vg=[function(a){xg[a>>4&15].call(this,a)},Cf,zf,rf,sf,xf,tf,vf,Pf,Pf,fg,hg,jg,V,V,V],gg=[function(a){ke(this,De(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Qe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Ue);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Se);this.b-=this.g?9:3+(7==this.f?2:0)}],ig=[function(a){S(this,a,0,
We);this.b-=this.g?11:6},function(a){S(this,a,Id(this)?1:0,Ge);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,Id(this)?1:0,bf);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Be(this,a);ke(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],kg=[function(a){S(this,a,0,$e);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ye);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ke);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ie);this.b-=this.g?9:3+(7==this.f?2:0)}],
xg=[function(a){yg[a&15].call(this,a)},V,V,V,Nf,Nf,Nf,Nf,Xf,V,lg,ng,ag,ag,ag,ag],yg=[Jf,cg,Yf,Bf,Lf,Wf,V,V,V,V,V,V,V,V,V,V],mg=[Vf,function(){this.T=0;this.b-=5},function(){this.U=0;this.b-=5},U,function(){this.$=1;this.b-=5},U,U,U,function(){this.Z=0;this.b-=5},U,U,U,U,U,U,U],og=[Vf,function(){this.T=65536;this.b-=5},function(){this.U=32768;this.b-=5},W,function(){this.$=0;this.b-=5},W,W,W,function(){this.Z=32768;this.b-=5},W,W,W,W,W,W,W],wg=[Af,yf,uf,wf,Df,Ef,jf,kf,If,bg,pg,rg,tg,V,V,V],qg=[function(a){ke(this,
Ce(this,a,0,255));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Te);this.b-=this.g?9:3+(7==this.f?2:0)}],sg=[function(a){R(this,a,0,Xe);this.b-=this.g?11:6},function(a){R(this,a,Id(this)?1:0,He);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,Id(this)?1:0,cf);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Ae(this,a);ke(this,a<<8);this.b-=this.g?4:3+
(7==this.f?2:0)}],ug=[function(a){R(this,a,0,af);this.b-=this.g?9+(this.yb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Ze);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Le);this.b-=this.g?9+(this.yb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Je);this.b-=this.g?9:3+(7==this.f?2:0)}];function Fd(a){zg[a>>12].call(this,a)}
var zg=[function(a){Ag[a>>8&15].call(this,a)},Rf,Ff,pf,lf,nf,ff,function(a){Bg[a>>8&15].call(this,a)},function(a){Cg[a>>8&15].call(this,a)},Sf,Gf,qf,mf,of,$f,V],Ag=[function(a){Dg[a>>4&15].call(this,a)},Cf,zf,rf,sf,xf,tf,vf,Pf,Pf,fg,hg,jg,function(a){Eg[a>>6&3].call(this,a)},V,V],Eg=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.ra(a|this.R);O(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=ve(this,a,0);oe(this,a);Q(this,a);this.b-=11},function(a){var b=qe(this);this.I=
this.b;we(this,a,0,b);Q(this,b);this.b=this.I-Tf[this.g]},function(a){Q(this,De(this,a,Ld(this)?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Dg=[function(a){Fg[a&15].call(this,a)},V,V,V,Nf,Nf,Nf,Nf,Xf,function(a){a&8?(this.N&49152||(this.N=this.N&-2017|(a&7)<<5,this.J|=1),this.b-=5):V.call(this,a)},lg,ng,ag,ag,ag,ag],Fg=[Jf,cg,function(){pe(this);this.J|=this.N&16;this.b-=13},Bf,Lf,Wf,Yf,function(){this.va(8,0,-8)},V,V,V,V,V,V,V,V],Bg=[Uf,Uf,Hf,Hf,gf,gf,hf,hf,dg,dg,V,V,V,V,Zf,Zf],Cg=[Af,yf,uf,wf,
Df,Ef,jf,kf,If,bg,pg,rg,tg,function(a){Gg[a>>6&3].call(this,a)},V,V],Gg=[V,function(a){a=ve(this,a,65536);oe(this,a);Q(this,a);this.b-=11},function(a){var b=qe(this);this.I=this.b;we(this,a,65536,b);Q(this,b);this.b=this.I-Tf[this.g]},V];
function Hg(a){t.call(this,"ROM",a,Hg,256);this.ga=this.g=null;this.B=a.addr;this.f=a.size;this.D=!1;this.w=a.alias;this.C=a.file;this.H=sa(this.C);if(this.C){a=this.C;var b=ta(this.H);"json"!=b&&"hex"!=b&&(a=Ga()+"/api/v1/dump?file="+this.C+"&format=bytes&decimal=true");var c=this;Ea(a,null,!0,function(a,b,f){f?(c.P("Unable to load ROM resource (error "+f+": "+a+")"),c.C=null):(rb(c.Ua,a,b),(a=Fa(a,b))?(c.g=a.ea,c.ga=a.ga):c.C=null);$g(c)})}}z(Hg);k=Hg.prototype;
k.Ia=function(a,b,c,d){this.v=b;this.b=c;this.i=d;$g(this)};k.Ka=function(){this.ga&&(this.i&&ah(this.i,this.id,this.B,this.f,this.ga),delete this.ga);return!0};k.Ja=function(){return!0};
function $g(a){if(!xb(a)){if(a.C){if(!a.g||!a.v)return;a.f||(a.f=a.g.length);if(a.g.length!=a.f)zb(a,"ROM size ("+p(a.g.length,8,!0)+") does not match specified size ("+p(a.f,8,!0)+")");else{var b;a:{b=a.B;a.status(a.f+"-byte ROM at "+ra(b));if(57344<=b&&b<57344+oc){var c={};b=(c[b]=[Hg.prototype.Qd,Hg.prototype.Ie,null,null,null,a.f>>1],c);if(Ib(a.v,a,b)){b=a.D=!0;break a}}else if(yc(a.v,b,a.f,gd)){for(c=0;c<a.g.length;c++)a.v.tb(b+c,a.g[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.w?b.push(a.w):
null!=a.w&&a.w.length&&(b=a.w);for(c=0;c<b.length;c++){var d=a,e=b[c],f=xc(d.v,d.B,d.f);wc(d.v,e,d.f,f)}a.D||delete a.g}}}H(a)}}k.Qd=function(a){return this.g[a-this.B]};k.Ie=function(){};$a(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Hg(d);B(d,c)}});
function bh(a){t.call(this,"RAM",a,bh);this.ga=this.g=null;this.C=a.addr;this.B=a.size;this.Oa=a.load;this.Na=a.exec;this.w=!1;this.f=a.file;this.D=sa(this.f);if(this.f){a=this.f;var b=ta(this.D);"json"!=b&&"hex"!=b&&(a=Ga()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Ea(a,null,!0,function(a,b,f){f?(c.P("Unable to load RAM resource (error "+f+": "+a+")"),c.f=null):(rb(c.Ua,a,b),(a=Fa(a,b))?(c.g=a.ea,c.ga=a.ga,null==c.Oa&&(c.Oa=a.Oa),null==c.Na&&(c.Na=a.Na)):c.f=null);ch(c)})}}
z(bh);bh.prototype.Ia=function(a,b,c,d){this.v=b;this.b=c;this.i=d;ch(this)};bh.prototype.Ka=function(){this.ga&&(this.i&&ah(this.i,this.id,this.C,this.B,this.ga),delete this.ga);return!0};bh.prototype.Ja=function(){return!0};function ch(a){if(a.v&&(!a.w&&a.B&&yc(a.v,a.C,a.B,Bc)&&(a.w=!0),!xb(a))){if(!a.w)q("No RAM allocated");else if(a.f){if(!a.g||!a.v)return;dh(a,a.g,a.Oa,a.Na,a.C)}H(a)}}
bh.prototype.reset=function(){if(this.w){for(var a=this.v,b=this.C,c=this.B,d=b&a.v,b=b>>>a.ja;0<c&&b<a.Y.length;){var e=a.Y[b];if(e.controller&&a.g&&a.g.length==a.w.length){var f=a.g.indexOf(e);0<=f&&(e=a.w[f])}if(e){var f=c,g=0,h,d=d||0,g=g&255;void 0===f&&(f=e.size);if(Ab&&e.G)for(h=d;f--&&h<e.G.length;h++)e.G[h]=g;else for(h=d;f--&&h<e.size;h++)e.dc(d,g,e.F+d)}c-=a.Ba;b++;d=0}this.g&&dh(this,this.g,this.Oa,this.Na,this.C,!0)}};
function dh(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var l=b[h]&255|(b[h+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(h+6>=b.length)break;for(var h=h+2,m=b[h++]&255|(b[h++]&255)<<8,n=b[h++]&255|(b[h++]&255)<<8,l=l+((m&255)+(m>>8)+(n&255)+(n>>8)),v=h,r=m-=6;0<m&&h<b.length;)l+=b[h++]&255,m--;if(m||h>=b.length)break;l+=b[h++]&255;if(l&255)break;if(r)for(E(a,"loading "+p(r,4,!0)+" bytes at "+p(n,4,!0)+"-"+p(n+r-1,4,!0),1048576);r--;)a.b.tb(n++,b[v++]&255);else n&1?a.b.da():null==d&&
(d=n),null!=d&&E(a,"starting address: "+p(d,4,!0),1048576);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.b.tb(c+g,b[g]);g=!0}g&&null!=d&&(a=a.b,a.Ac=d,a.v.reset(),Rb(a),O(a,d),$c(a,0),!f&&a.i&&(a.da()||wd(a.i)));return g}$a(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new bh(d);B(d,c)}});function eh(a){t.call(this,"Keyboard",a,eh,65536);H(this)}z(eh);eh.prototype.ua=function(){return!1};
eh.prototype.Ia=function(a,b,c,d){this.C=a;this.b=c;this.i=d};$a(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new eh(d);B(d,c)}});
function X(a){this.O=a.baudReceive||9600;this.ca=a.baudTransmit||9600;this.ba=a.upperCase;this.w=this.D=null;this.S=a.tabSize;this.R=a.charBOL;this.H=0;t.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.D="";else{var c;a=fh;b&&(void 0===c&&(c="Panel"),(c=ub(c,this.id))&&(b=c.G[b])&&this.ua(null,a,b))}this.I=this.L=null;this.exports={connect:this.zc,receiveData:this.ac}}z(X);var fh="buffer";k=X.prototype;
k.ua=function(a,b,c){var d=this;switch(b){case fh:return this.G[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.ac(b);return!0},c.onkeypress=function(a){a=a||window.event;d.ac(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.ac(a.getData("Text"))},
c.removeAttribute("readonly"),!0}return!1};k.Ia=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;var e=this;this.ma=Rc(48,4);this.X=Hc(this.b,function(){e.f&128||!e.B.length||(e.K=e.B.shift()&255,e.ba&&97<=e.K&&122>e.K&&(e.K-=32),e.f|=128,e.f&64&&Ic(e.b,e.ma))});this.M=Rc(52,4);this.ia=Hc(this.b,function(){e.g|=128;e.g&64&&Ic(e.b,e.M)});Ib(b,this,gh);Kb(b,this.reset.bind(this));H(this)};
k.zc=function(){if(!this.I){var a=td(this.C,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ya(b[0]);if(c!=this.ab)return;b=ya(b[1]);if(this.I=tb(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.Ua+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.Ka=function(a,b){if(!b)if(this.zc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
k.Ja=function(a){return a?this.save():!0};k.reset=function(){hh(this)};k.save=function(){var a=new N(this);a.set(0,[]);return a.data()};k.restore=function(){return hh(this)};function hh(a){a.K=0;a.f=0;a.g=128;a.B=[];return!0}k.ac=function(a){if("number"==typeof a)this.B.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d<a.length;d++){c=b;b=a.charCodeAt(d);if(10==b){if(13==c)continue;b=13}this.B.push(b)}else this.B=this.B.concat(a);Qc(this.b,this.X,1E3/Math.round(this.O/10));return!0};
k.Kd=function(){return this.f&65534};k.Ce=function(a){this.f=this.f&-112|a&111};k.Jd=function(){this.f&=-129;0<this.B.length&&Qc(this.b,this.X,1E3/Math.round(this.O/10));return this.K};k.Be=function(){};k.de=function(){return this.g};k.We=function(a){this.g&128&&(a&64?Ic(this.b,this.M):Od(this.b,this.M));this.g=this.g&-70|a&69};k.ce=function(){return 0};
k.Ve=function(a){if(a&=255){E(this,"transmitByte("+p(a,2,!0)+")");this.L&&this.L.call(this.I,a);a&=127;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=za[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.S||8,c=a-this.H%a,this.S&&(b=xa("",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.D){if(10==a||1024<=this.D.length)this.j(this.D),
this.D="";10!=a&&(this.D+=String.fromCharCode(a))}this.g&=-129;Qc(this.b,this.ia,1E3/Math.round(this.ca/10))}};var ih={},gh=(ih[65392]=[null,null,X.prototype.Kd,X.prototype.Ce,"RCSR"],ih[65394]=[null,null,X.prototype.Jd,X.prototype.Be,"RBUF"],ih[65396]=[null,null,X.prototype.de,X.prototype.We,"XCSR"],ih[65398]=[null,null,X.prototype.ce,X.prototype.Ve,"XBUF"],ih);$a(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new X(d);B(d,c)}});
function ad(a){t.call(this,"PC11",a,ad);this.g=a.autoMount||null;this.D=0;this.ba=a.baudReceive||3600;this.K=this.L=this.f=0;this.I=[];this.H=jh;this.w=kh;this.M=this.B="";this.ea=this.Oa=this.Na=null;this.R=-1;this.O=!Sa("Mobi")&&window&&"FileReader"in window}z(ad);var jh="",kh=0;k=ad.prototype;
k.ua=function(a,b,c){var d=this,e=kh;switch(b){case "listTapes":return this.G[b]=c,c.onchange=function(){var a=d.G.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){q("PC11 option error: "+l.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.G[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.G[b]=c,c.onclick=
function(){var a=d.G.listTapes;a&&lh(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.O){c.parentNode.removeChild(c);break}this.G[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;lh(d,sa(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.G[b]=c,!0}return!1};
k.Ia=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;this.S=mh(a);var e=this;if((this.g=td(this.C,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){q("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.X=Rc(56,4);this.ca=Hc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.K<e.I.length&&(e.L=e.I[e.K++]&255,nh(e,e.K/e.I.length*100),e.f|=128,e.f&=-2049,e.f&64&&Ic(e.b,e.X))});Ib(b,this,oh);Kb(b,this.reset.bind(this));ph(this,"None",jh,!0);this.O&&
ph(this,"Local Tape","?");ph(this,"Remote Tape","??");qh(this)||H(this)};k.Ka=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.Ja=function(a){return a?this.save():!0};k.reset=function(){this.f&=-2241;this.L=0};function qh(a){a.D=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.G.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=sa(b,!0)}b&&c?rh(a,c,b,1,!0):sh(a)}return!!a.D}
function lh(a,b,c,d,e){if(c)if("?"==c)a.P('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=sa(c);a.status("Attempting to load "+c+' as "'+b+'"');a.H="??"}else a.H=c;rh(a,b,c,d,!1,e)}else th(a,!1)}
function rh(a,b,c,d,e,f){var g=-1;if(a.B.toLowerCase()!=c.toLowerCase()||a.w!=d)g++,th(a,!0),a.A.eb?a.P("PC11 busy"):(e&&(a.D++,F(a)&&E(a,"auto-loading tape: "+b)),uh(a,b,c,d,f)?g++:a.A.eb=!0);g&&vh(a,a.M,a.B,a.w,a.ea,a.Oa,a.Na)}
function uh(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),vh(a,b,c,d,e),a.H="?");sh(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=ta(c),f="json"==e||"gz"==e?encodeURI(c):Ga()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Ea(f,null,!0,function(e,f,g){var h=0>g&&a.C&&!a.C.A.ha;g?a.P('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(rb(a.Ua,e,f),(e=Fa(e,f))&&vh(a,b,c,d,e.ea,e.Oa,
e.Na));a.A.eb=!1;a.D&&(a.D--,a.D||H(a));sh(a)})}function ph(a,b,c,d){if((a=a.G.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function sh(a){var b=a.G.listTapes;if(b&&b.options){a=a.H||a.B;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function nh(a,b){b|=0;if(b!==a.R){var c=a.G.readProgress;c&&(c=(c=D(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.R=b}}
function vh(a,b,c,d,e,f,g){a.M=b;a.B=c;a.w=d;a.ea=e;a.Oa=f;a.Na=g;2==d?a.S&&dh(a.S,e,f,g)?a.status("tape loaded: "+b):(a.M="",a.B="",a.H=jh,a.w=kh,a.P("No load address available for tape: "+b)):(a.K=0,a.I=e,a.status("tape attached: "+b),nh(a,0))}function th(a,b){if(a.B||!1===b)a.M="",a.B="",b||(a.w&&a.status(1==a.w?"tape detached":"tape unloaded"),a.H=jh,a.w=kh,sh(a))}k.save=function(){return(new N(this)).data()};k.restore=function(){return!0};k.Dd=function(){return this.f&65534};
k.ve=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&Ic(this.b,this.X)):(this.f&=-129,this.f|=2048,this.L=0,Qc(this.b,this.ca,1E3/Math.round(this.ba/10))));this.f=this.f&-66|a&65};k.Cd=function(){this.f&=-129;this.f|=2048;return this.L};k.ue=function(){};var wh={},oh=(wh[65384]=[null,null,ad.prototype.Dd,ad.prototype.ve,"PRS"],wh[65386]=[null,null,ad.prototype.Cd,ad.prototype.ue,"PRB"],wh);
function xh(a,b,c){t.call(this,"Disk",{id:a.Ua+".disk"+p(++yh,4)},xh,4194304);this.controller=a;this.C=a.C;this.i=a.i;this.w=b;this.$a=b.name;this.jc=b.jc;zh(this,c,b.xa,b.Ca,b.qa,b.Pa);H(this)}var yh=0;z(xh);k=xh.prototype;k.Ia=function(a,b,c,d){this.i=d};
function zh(a,b,c,d,e,f){a.mode=b;a.xa=c;a.Ca=d;a.qa=e;a.Pa=f;a.b=[];if("preload"!=a.mode){b=Array(a.xa);for(c=0;c<b.length;c++){d=Array(a.Ca);for(e=0;e<d.length;e++){f=Array(a.qa);for(var g=1;g<=f.length;g++)f[g-1]=Ah(null,c,e,g,a.Pa,0);d[e]=f}b[c]=d}a.b=b}a.f=null}
function Bh(a,b,c,d,e){var f=c;if(a.v)return!0;a.$a=b;a.hb=c;a.Lc=sa(c);a.v=e;a.B=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=la[d];if(e){a.xa=e[0];a.Ca=e[1];a.qa=e[2];a.Pa=e[3]||512;c=a.Pa>>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.xa);for(d=0;d<a.b.length;d++)for(var r=a.b[d]=Array(a.Ca),w=0;w<r.length;w++)for(var y=r[w]=Array(a.qa),x=0;x<y.length;x++){for(var C=Ah(null,d,w,x+1,a.Pa,0),ka=C.data,La=0;La<c;La++,f+=4)var P=ka[La]=b.getInt32(f,
!0),e=e+P&-1;C.Fa=c;y[x]=C}a.f=e;c=a}else a.P("Unrecognized disk format ("+d+" bytes)");a.v&&(a.v.call(a.controller,a.w,c,a.$a,a.hb),a.v=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=ta(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ua(c,"/")&&(d="dir"),f=Ga()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.jc?"":e)+"&format=json"));return!!Ea(f,
null,!0,function(b,c,d){Ch(a,b,c,d)})}
function Ch(a,b,c,d){var e=null;a.g=!1;var f=0>d&&a.C&&!a.C.A.ha;if(d)a.controller.P('Unable to load disk "'+a.$a+'" (error '+d+": "+b+")",f);else{rb(a.controller.Ua,b,c);try{if(0<sa(a.Lc,!0).toLowerCase().indexOf("-readonly"))a.g=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.g=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.$a]:h=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(h.length)if(1==h.length)q(h[0]);else{a.xa=h.length;a.Ca=h[0].length;a.qa=h[0][0].length;var l=h[0][0][0];a.Pa=l&&l.length||512;for(d=c=0;d<a.xa;d++)for(f=0;f<a.Ca;f++)for(g=0;g<a.qa;g++)if(l=h[d][f][g]){var m=l.length;void 0===m&&(m=l.length=512);var m=m>>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var v=l.data;if(void 0===v){var r=l.bytes;if(void 0!==r&&r.length){for(var w=m<<2,y=r.length;y<w;y++)r[y]=n;Dh(l,r)}else v=[],n=l.pattern=n|n<<8|n<<16|n<<24,l.data=v;delete l.bytes}Ah(l,d,f);for(w=
0;w<v.length;w++)c=c+v[w]&-1}a.b=h;a.f=c;e=a}else q("Empty disk image: "+a.$a)}catch(x){q("Disk image error ("+b+"): "+x.message)}}a.v&&(a.v.call(a.B,a.w,e,a.$a,a.hb),a.v=null)}function Ah(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.Ze=b;a.$e=c;a.Sa=a.Fa=0;a.Wa=!1;return a}
k.seek=function(a,b,c,d,e){d=null;var f=this.w,g=this.b[a];if(g){var h=g[b];if(!h&&f.Rc&&b<f.Ca)for(h=g[b]=Array(f.Sc),g=0;g<h.length;g++)h[g]=Ah(null,a,b,g+1,f.Ec,0);if(h){for(g=0;g<h.length;g++)if(h[g]&&h[g].sector==c){d=h[g];break}!d&&f.Rc&&9==f.rc&&(d=h[g]=Ah(null,a,b,f.rc,f.Ec,0))}}e&&e(d,!1);return d};function Dh(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
k.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};k.write=function(a,b,c){if(this.g)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.Fa?f<a.Sa?(a.Fa+=a.Sa-f,a.Sa=f):f>=a.Sa+a.Fa&&(a.Fa+=f-(a.Sa+a.Fa)+1):(a.Sa=f,a.Fa=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
function Eh(a,b){var c=a.Ca*a.qa,d=b/c|0;return d<a.xa?(b%=c,a.seek(d,b/a.qa|0,b%a.qa+1)):null}function Fh(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}
k.save=function(){var a=0,b=[];b[a++]=[this.hb,this.f,this.xa,this.Ca,this.qa,this.Pa];if(!this.g)for(var c=this.b,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Fa){for(var h=[],l=0,m=g.Sa,n=g.Sa+g.Fa;m<n;)h[l++]=g.data[m++];b[a++]=[d,e,f,g.Sa,h]}}return b};
k.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.b.length&&6<=e.length?zh(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.f&&e[1]!=this.f&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.f+")",b=-2));for(this.b.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],h=g[f++],l=g[f++],m=g[f++];if(h>=this.b.length||l>=this.b[h].length||m>=this.b[h][l].length){c="sector (CHS="+h+":"+l+":"+m+") out of range ("+
b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(h=this.b[h][l][m]){for(l=h.data.length;l<e;)h.data[l++]=h.pattern;l=0;h.Sa=e;for(h.Fa=f.length;e<g;)h.data[e++]=f[l++];b++}}}0>b&&-2!=b&&this.controller.P("Unable to restore disk '"+this.$a+": "+c);return b};
k.toJSON=function(){var a;a=0;for(var b;b=Eh(this,a++);)Gh(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function Gh(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function M(a){t.call(this,"RL11",a,M,4194304);this.w=a.autoMount||null;this.H=0;this.f=Array(4);this.L=!Sa("Mobi")&&window&&"FileReader"in window}z(M);k=M.prototype;
k.ua=function(a,b,c){var d=this;switch(b){case "listDisks":return this.G[b]=c,c.onchange=function(){var a=d.G.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){q("RL11 option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.G[b]=c,c.onchange=function(){var a=ma(c.value,10);null!=a&&Hh(d,a)},!0;case "loadDrive":return this.G[b]=
c,c.onclick=function(){var a=d.G.listDisks;a&&Ih(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.L){c.parentNode.removeChild(c);break}this.G[b]=c;c.onclick=function(){var a=d.G.listDrives;if(a&&a.options&&d.f)if(a=d.f[ma(a.value,10)||0])if(a=a.Ga){var b;b="";for(var c=0,h;h=Eh(a,c++);)for(var l=0,m=h.length;l<m;l++)b+=String.fromCharCode(Fh(a,h,l));b=btoa(b);a=a.Lc.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),
"string"!=typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");q(a)}else d.P("No disk loaded in drive.");else d.P("No disk drive selected.")};return!0;case "mountDrive":if(this.L)return this.G[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=
!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Ch(d,ra(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
k.Ga=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;if((this.A=od(this.C,"autoMount")||this.A)&&"string"==typeof this.A)try{this.A=eval("("+this.A+")")}catch(e){q("RL11 auto-mount error: "+e.message+" ("+this.A+")"),this.A=null}Dh(this);this.O=Qc(112,5);Hb(b,this,Eh);Jb(b,this.reset.bind(this));Fh(this,"None","",!0);this.L&&Fh(this,"Local Disk","?");Fh(this,"Remote Disk","??");Gh(this)||H(this)};
k.Ia=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.C.rc){for(a=0;a<this.f.length;a++)Hh(this,a,!0);Gh(this,!0)}}else if(!this.restore(a))return!1;if(a=this.G.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Bh(this,0)}}return!0};k.Ha=function(a){return a?this.save():!0};k.reset=function(){Dh(this)};k.save=function(){return(new N(this)).data()};
k.restore=function(a){return Dh(this,a[0])};function Gh(a,b){b||(a.H=0);if(a.A)for(var c in a.A){var d=a.A[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.G.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=ra(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.f.length)){!Ih(a,g,f,e,!0)&&b&&H(a,!1);continue}a.P("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.H}
function Ch(a,b,c,d){var e=a.G.listDrives,e=e&&la(e.value,10);if(void 0===e||0>e||e>=a.f.length)a.P("Unable to load the selected drive");else if(c)if("?"==c)a.P('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"')}Ih(a,e,b,c,!1,d)}else Hh(a,e)}
function Ih(a,b,c,d,e,f){var g=-1,h=a.f[b];h.gb.toLowerCase()!=d.toLowerCase()&&(g++,Hh(a,b,!0),h.ec?a.P("RL11 busy"):(h.ec=!0,e&&(h.dc=!0,a.H++,F(a)&&E(a,"auto-loading disk: "+c)),h.Rb=!!f,vh(new rh(a,h,"preload"),c,d,f,a.Tc)&&g++));return g}
k.Tc=function(a,b,c,d,e){var f;a.ec=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.va||f[1]>a.Aa)&&(this.P('Disk "'+c+'" too large for drive '+("RL"+a.gc)),b=null);b?(a.Ea=b,a.Ya=c,a.gb=d,this.P('Mounted disk "'+c+'" in drive '+("RL"+a.gc),a.dc||e),this.C&&this.C.rb()):a.Rb=!1;a.dc&&(a.dc=!1,--this.H||H(this));Bh(this,a.gc)};
function Fh(a,b,c,d){if((a=a.G.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function Bh(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.G.listDisks;a=a.G.listDrives;if(d&&a&&d.options&&a.options&&(a=la(a.value,10),c=c.Rb?"?":c.gb,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Hh(a,b,c){var d=a.f[b];if(d.Ea||!1===c)d.Ya="",d.gb="",d.Ea=null,d.Rb=!1,c||(a.P("Drive RL"+b+" unloaded",c),Bh(a,b))}
function Dh(a,b){var c=0;b||(b=[]);a.fa=b[c++]||0;a.I=b[c++]||0;a.g=b[c++]||0;a.B=b[c++]||0;a.D=b[c++]||0;a.K=b[c]||0;for(b=0;b<a.f.length;b++){var d=a.f[b];void 0===d&&(d=a.f[b]={});c=a;d.gc=b;d.ec=d.Rb=!1;d.name=c.Za;d.va=512;d.Aa=2;d.qa=40;d.Oa=256;d.fc=!0;d.Ve=0;d.Ue=0;d.oc=1;d.Pc=d.qa;d.Bc=d.Oa;d.Ye=0;d.$e=null;d.Ea||(d.gb="");d.status=29|(512==d.va?128:0)}return!0}
k.Rc=function(a,b,c,d,e,f){this.I=f&65535;this.fa=this.fa&-49|f>>12&48;this.K=f>>16&63;this.B=this.g=b<<7|(c?64:0)|d&63;this.D=65536-e&65535;a&&(this.fa=this.fa|a|32768);return!0};
k.nd=function(a,b,c,d,e,f,g){var h=0,l=a.Ea,m=null,n;l||(h=5120,e=0);for(;e--;){if(!m){m=a.Ea.seek(b,c,d+1);if(!m){h=5120;break}n=0}var v,r;if(0>(v=a.Ea.read(m,n++))||0>(r=a.Ea.read(m,n++))){h=5120;break}this.v.hb(f,v|r<<8);if(Fc(this.v)){h=8192;break}f+=2;if(n>=l.Oa&&(m=null,++d>=l.qa&&(d=0,++c>=l.Aa&&(c=0,++b>=l.va)))){h=5120;break}}return g(h,b,c,d,e,f)};
k.he=function(a,b,c,d,e,f,g){var h=0,l=a.Ea,m=null,n;l||(h=5120,e=0);for(;e--;){var v=this.v.na(f);if(Fc(this.v)){h=8192;break}f+=2;if(!m){m=a.Ea.seek(b,c,d+1,!0);if(!m){h=5120;break}n=0}if(!a.Ea.write(m,n++,v&255)||!a.Ea.write(m,n++,v>>8)){h=5120;break}if(n>=l.Oa&&(m=null,++d>=l.qa&&(d=0,++c>=l.Aa&&(c=0,++b>=l.va)))){h=5120;break}}return g(h,b,c,d,e,f)};k.Kd=function(){return this.fa&65535};
k.Ce=function(a){this.fa=this.fa&-1023|a&1022;this.M=this.M&-4|(a&48)>>4;if(!(this.fa&128)){var b;a=!0;var c=this.f[(this.fa&768)>>8],d,e,f,g;this.fa&=-2;switch(this.fa&14){case 4:this.g&8&&(this.fa&=63);this.D=c.status|this.B&64;break;case 6:1==(this.g&3)&&(b=this.g&65408,c=(this.g&16)<<2,this.B=this.g&4?this.B+b:this.B-b,this.g=this.B=this.B&65408|c);break;case 8:this.D=this.B;break;case 12:b=this.nd;case 10:b||(b=this.he),d=this.g>>7,e=this.g&64?1:0,f=this.g&63,d>=c.va||f>=c.qa?this.fa|=37888:
(g=(this.K&63)<<16|this.I,a=65536-this.D&65535,a=b.call(this,c,d,e,f,a,g,this.Rc.bind(this)))}a&&(this.fa|=129,this.fa&64&&Hc(this.b,this.O))}};k.Id=function(){return this.I};k.Ae=function(a){this.I=a&65534};k.Ld=function(){return this.g};k.De=function(a){this.g=a};k.Md=function(){return this.D};k.Ee=function(a){this.D=a};k.Jd=function(){return this.K};k.Be=function(a){this.K=a&63};
var Jh={},Eh=(Jh[63744]=[null,null,M.prototype.Kd,M.prototype.Ce,"RLCS"],Jh[63746]=[null,null,M.prototype.Id,M.prototype.Ae,"RLBA"],Jh[63748]=[null,null,M.prototype.Ld,M.prototype.De,"RLDA"],Jh[63750]=[null,null,M.prototype.Md,M.prototype.Ee,"RLMP"],Jh[63752]=[null,null,M.prototype.Jd,M.prototype.Be,"RLBE"],Jh);function Kh(a){t.call(this,"Debugger",a,Kh);this.ca=a.base||16;this.Ca=!1;this.K=0;this.R=!1;this.B=-1;this.g=[];this.X={}}z(Kh);
var Lh={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Kh.prototype.tc=function(){return-1};Kh.prototype.uc=function(){};
function Mh(a,b,c,d){if(c)if(b){0>a.B&&a.g.length&&(a.B=0);if(0>a.B||b!=a.g[a.B])a.g.splice(0,0,b),a.B=0;a.B--}else a.R?b="end":b=a.g[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(xa(b.substring(c,f))),c=f+1}}return a}
function Nh(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;
!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Ih(d,sa(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
k.Ia=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;if((this.w=td(this.C,"autoMount")||this.w)&&"string"==typeof this.w)try{this.w=eval("("+this.w+")")}catch(e){q("RL11 auto-mount error: "+e.message+" ("+this.w+")"),this.w=null}Jh(this);this.O=Rc(112,5);Ib(b,this,Kh);Kb(b,this.reset.bind(this));Lh(this,"None","",!0);this.L&&Lh(this,"Local Disk","?");Lh(this,"Remote Disk","??");Mh(this)||H(this)};
k.Ka=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.C.uc){for(a=0;a<this.f.length;a++)Nh(this,a,!0);Mh(this,!0)}}else if(!this.restore(a))return!1;if(a=this.G.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Hh(this,0)}}return!0};k.Ja=function(a){return a?this.save():!0};k.reset=function(){Jh(this)};k.save=function(){return(new N(this)).data()};
k.restore=function(a){return Jh(this,a[0])};function Mh(a,b){b||(a.H=0);if(a.w)for(var c in a.w){var d=a.w[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.G.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=sa(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.f.length)){!Oh(a,g,f,e,!0)&&b&&H(a,!1);continue}a.P("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.H}
function Ih(a,b,c,d){var e=a.G.listDrives,e=e&&ma(e.value,10);if(void 0===e||0>e||e>=a.f.length)a.P("Unable to load the selected drive");else if(c)if("?"==c)a.P('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=sa(c);a.status("Attempting to load "+c+' as "'+b+'"')}Oh(a,e,b,c,!1,d)}else Nh(a,e)}
function Oh(a,b,c,d,e,f){var g=-1,h=a.f[b];h.hb.toLowerCase()!=d.toLowerCase()&&(g++,Nh(a,b,!0),h.ic?a.P("RL11 busy"):(h.ic=!0,e&&(h.hc=!0,a.H++,F(a)&&E(a,"auto-loading disk: "+c)),h.Wb=!!f,Bh(new xh(a,h,"preload"),c,d,f,a.Wc)&&g++));return g}
k.Wc=function(a,b,c,d,e){var f;a.ic=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.xa||f[1]>a.Ca)&&(this.P('Disk "'+c+'" too large for drive '+("RL"+a.kc)),b=null);b?(a.Ga=b,a.$a=c,a.hb=d,this.P('Mounted disk "'+c+'" in drive '+("RL"+a.kc),a.hc||e),this.C&&this.C.ub()):a.Wb=!1;a.hc&&(a.hc=!1,--this.H||H(this));Hh(this,a.kc)};
function Lh(a,b,c,d){if((a=a.G.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function Hh(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.G.listDisks;a=a.G.listDrives;if(d&&a&&d.options&&a.options&&(a=ma(a.value,10),c=c.Wb?"?":c.hb,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Nh(a,b,c){var d=a.f[b];if(d.Ga||!1===c)d.$a="",d.hb="",d.Ga=null,d.Wb=!1,c||(a.P("Drive RL"+b+" unloaded",c),Hh(a,b))}
function Jh(a,b){var c=0;b||(b=[]);a.fa=b[c++]||0;a.I=b[c++]||0;a.g=b[c++]||0;a.B=b[c++]||0;a.D=b[c++]||0;a.K=b[c]||0;for(b=0;b<a.f.length;b++){var d=a.f[b];void 0===d&&(d=a.f[b]={});c=a;d.kc=b;d.ic=d.Wb=!1;d.name=c.ab;d.xa=512;d.Ca=2;d.qa=40;d.Pa=256;d.jc=!0;d.Ye=0;d.Xe=0;d.rc=1;d.Sc=d.qa;d.Ec=d.Pa;d.af=0;d.cf=null;d.Ga||(d.hb="");d.status=29|(512==d.xa?128:0)}return!0}
k.Uc=function(a,b,c,d,e,f){this.I=f&65535;this.fa=this.fa&-49|f>>12&48;this.K=f>>16&63;this.B=this.g=b<<7|(c?64:0)|d&63;this.D=65536-e&65535;a&&(this.fa=this.fa|a|32768);return!0};
k.qd=function(a,b,c,d,e,f,g){var h=0,l=a.Ga,m=null,n;l||(h=5120,e=0);for(;e--;){if(!m){m=a.Ga.seek(b,c,d+1);if(!m){h=5120;break}n=0}var v,r;if(0>(v=a.Ga.read(m,n++))||0>(r=a.Ga.read(m,n++))){h=5120;break}this.v.ib(f,v|r<<8);if(Gc(this.v)){h=8192;break}f+=2;if(n>=l.Pa&&(m=null,++d>=l.qa&&(d=0,++c>=l.Ca&&(c=0,++b>=l.xa)))){h=5120;break}}return g(h,b,c,d,e,f)};
k.ke=function(a,b,c,d,e,f,g){var h=0,l=a.Ga,m=null,n;l||(h=5120,e=0);for(;e--;){var v=this.v.na(f);if(Gc(this.v)){h=8192;break}f+=2;if(!m){m=a.Ga.seek(b,c,d+1,!0);if(!m){h=5120;break}n=0}if(!a.Ga.write(m,n++,v&255)||!a.Ga.write(m,n++,v>>8)){h=5120;break}if(n>=l.Pa&&(m=null,++d>=l.qa&&(d=0,++c>=l.Ca&&(c=0,++b>=l.xa)))){h=5120;break}}return g(h,b,c,d,e,f)};k.Nd=function(){return this.fa&65535};
k.Fe=function(a){this.fa=this.fa&-1023|a&1022;this.M=this.M&-4|(a&48)>>4;if(!(this.fa&128)){var b;a=!0;var c=this.f[(this.fa&768)>>8],d,e,f,g;this.fa&=-2;switch(this.fa&14){case 4:this.g&8&&(this.fa&=63);this.D=c.status|this.B&64;break;case 6:1==(this.g&3)&&(b=this.g&65408,c=(this.g&16)<<2,this.B=this.g&4?this.B+b:this.B-b,this.g=this.B=this.B&65408|c);break;case 8:this.D=this.B;break;case 12:b=this.qd;case 10:b||(b=this.ke),d=this.g>>7,e=this.g&64?1:0,f=this.g&63,d>=c.xa||f>=c.qa?this.fa|=37888:
(g=(this.K&63)<<16|this.I,a=65536-this.D&65535,a=b.call(this,c,d,e,f,a,g,this.Uc.bind(this)))}a&&(this.fa|=129,this.fa&64&&Ic(this.b,this.O))}};k.Ld=function(){return this.I};k.De=function(a){this.I=a&65534};k.Od=function(){return this.g};k.Ge=function(a){this.g=a};k.Pd=function(){return this.D};k.He=function(a){this.D=a};k.Md=function(){return this.K};k.Ee=function(a){this.K=a&63};
var Ph={},Kh=(Ph[63744]=[null,null,M.prototype.Nd,M.prototype.Fe,"RLCS"],Ph[63746]=[null,null,M.prototype.Ld,M.prototype.De,"RLBA"],Ph[63748]=[null,null,M.prototype.Od,M.prototype.Ge,"RLDA"],Ph[63750]=[null,null,M.prototype.Pd,M.prototype.He,"RLMP"],Ph[63752]=[null,null,M.prototype.Md,M.prototype.Ee,"RLBE"],Ph);function Qh(a){t.call(this,"Debugger",a,Qh);this.ca=a.base||16;this.Ea=!1;this.K=0;this.R=!1;this.B=-1;this.g=[];this.X={}}z(Qh);
var Rh={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Qh.prototype.wc=function(){return-1};Qh.prototype.xc=function(){};
function Sh(a,b,c,d){if(c)if(b){0>a.B&&a.g.length&&(a.B=0);if(0>a.B||b!=a.g[a.B])a.g.splice(0,0,b),a.B=0;a.B--}else a.R?b="end":b=a.g[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(ya(b.substring(c,f))),c=f+1}}return a}
function Th(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 Oh(a,b,c){var d;if(b){b=Ph(a,b);for(var e=0,f=!1,g=b,h=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var n=m[e++],v=n.length,n=xa(n);if(!n){f=!0;break}n=Qh(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}h.push(n);if(e==m.length)break;var n=m[e++],r=n.length;l.length&&Lh[n]<Lh[l[l.length-1]]&&Nh(h,l,1);l.push(n);b=b.substr(v+r)}Nh(h,l)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&Rh(a,null,
d))}return d}function Ph(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=Oh(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
function Qh(a,b,c,d){var e;null!=b?(e=a.tc(b),0<=e?e=a.uc(e):(e=a.X[b],null==e&&(e=la(b,a.ca))),null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)):d||a.j("missing "+(c||"value"));return e}
function Rh(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var l=d&255,m=8,n="";m?32<m&&(m=32):m=32;if(null==l||isNaN(l))for(;0<m--;)n="?"+n;else for(;0<m--;)n=(l&1?"1":"0")+n,l>>=1;g=n+g;d>>=8}d=p(c,0,!0)+" "+c+". "+qa(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function Sh(a,b){if(b)return Rh(a,b,a.X[b]);var c=0;for(b in a.X)Rh(a,b,a.X[b]),c++;return 0<c}
function J(a,b,c,d){switch(a.ca){case 8:a=qa(b,3*c-(2<c?1:0));break;case 10:a=b.toString();break;default:a=p(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
function Th(a){Kh.call(this,a);this.kb=!1;this.Ca=!0;this.L=Y(0);this.lb=Y(0);this.O=Y(0);this.I=[];this.f=this.M=this.D=[];Uh(this);this.ua=0;Vh(this);this.La={};Wh(this,a.messages);this.$a=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return sd(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return sd(b,a)})}z(Th,Kh);
var Xh={"?":"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"},Yh=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
Zh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106,32768],35072:[107,32768]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,
63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},$h=[0],ai=
[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=Th.prototype;
k.Ga=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.A=a.A;(a=od(a,"messages"))&&Wh(this,a);this.tb=Zh;this.Fb=1145>this.b.Va?ai:[];bi(this,function(a){a:{var b=d.v.Y,c=a[0],e=a=0,l=b.length;if(c){a=d.aa(ci(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.v.ja;l=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.j("..."):(c=n.type,m=Bc[c],n&&d.j(p(n.id,8)+" %"+
p(e<<d.v.ja,8)+" %%"+p(n.F,8)+" "+p(n.Pb,4,!0)+" "+p(n.size,4,!0)+" "+m),c!=ad&&(c=-1),m=0);a+=d.v.za;e++}}});H(this)};
k.sa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ma=this.G[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",sd(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.B<d.g.length-1&&(b=d.g[++d.B])):40==a.keyCode&&(0<d.B?b=d.g[--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.G[b]=c,Ta(c,function(){if(d.ma){var a=d.ma.value;
d.ma.value="";sd(d,a,!0);return!0}return!1}),!0;case "step":return this.G[b]=c,Ta(c,function(a){var b=!1;vb(d,!0)||(ub(d,!0),b=d.jb(a?1:0,null),ub(d,!1));return b}),!0}return!1};k.rb=function(a){if(this.ma){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.ma.focus();!a&&window&&window.scrollTo(b,c)}};k.aa=function(a){a=a&&a.F;null==a&&(a=-1);return a};k.Ib=function(a,b){var c=255,d=this.aa(a,!1,1);-1!==d&&(c=a.Sb?this.v.Ub(d):this.b.Ub(d),b&&di(a,b));return c};
k.na=function(a,b){var c=65535,d=this.aa(a,!1,2);-1!==d&&(c=a.Sb?this.v.cb(d):this.b.cb(d),b&&di(a,b));return c};k.Bb=function(a,b,c){var d=this.aa(a,!0,1);-1!==d&&(a.Sb?this.v.qb(d,b):this.b.qb(d,b),c&&di(a,c),this.C.pa(-1))};k.hb=function(a,b,c){var d=this.aa(a,!0,2);-1!==d&&(a.Sb?this.v.Cb(d,b):this.b.Cb(d,b),c&&di(a,c),this.C.pa(-1))};function Y(a,b){return{F:a,Sb:b,Qa:!1}}k.kc=function(a,b){a.F=b;a.Qa=!1;return a};function ei(a){return[a.F,a.Qa]}function fi(a){return{F:a[0],Qa:a[1]}}
function ci(a,b,c){var d,e=(c?a.L:a.lb).F;c=!1;if(void 0!==b){b=Ph(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.I.length;e++){var g=a.I[e].ga[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Y(d));break}}if(d=f)return d;e=Oh(a,b,void 0)}null!=e&&(d=Y(e,c));return d}function gi(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Mc=Mh(a,b.Hc=c[2]))}function di(a,b){null!=a.F&&(a.F+=b||1)}
function Wh(a,b){a.i=a;a.ka=a.Qc=536870912;a.ia=null;a.wa=[];b=Mh(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in Bb){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.ka|=Bb[c],a.j(c+" messages enabled"))}}function bi(a,b){for(var c in Bb)if(64==Bb[c]){a.La[c]=b;break}}
k.tc=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;case "SR":b=21;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function hi(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.uc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Xa[a-8]:20>a?b=this.b.Ka[a-16]:20==a?b=Uc(this.b):21==a&&this.A&&kc(this.A)&&(b=this.A.Wa));return b};
k.message=function(a,b){b&&(a+=" @"+J(this,Y(this.b.oa&65535).F));if(this.ka&1073741824)this.wa.push(a);else if(!this.ia||a!=this.ia){this.ia=a;if(this.ka&-2147483648&&this.b&&this.b.w.W||vb(this,!0))this.da(),a+=" (cpu halted)";this.j(a);this.b&&(a=this.b,wd(a),a.wa=0,a.pa())}};
function Vh(a){var b;if(!ye(a))a.H&&a.H.length&&a.j("instruction history buffer freed"),a.ba=0,a.H=[];else if(!a.H||!a.H.length){a.H=Array(1E3);for(b=0;b<a.H.length;b++)a.H[b]=Y();a.ba=0;a.j("instruction history buffer allocated")}}k.ib=function(a,b){if(!ii(this,b))return!1;this.b.ib(a);return!0};
k.jb=function(a,b,c){if(!ii(this))return!1;null===b&&(b=!this.vb||"tr"==this.vb);this.K=0;a||ye(this)&&ze(this,this.b.u[7],0);try{a=xd(this.b,a);var d=this.b.jb(a);0<d&&(cc(this.b,d),this.K+=d,dc(this.b,d,!0),ec(this.b,d),this.xa++)}catch(e){"number"!=typeof e&&(this.K=0,yb(this.b,e.stack||e.message))}!1!==c&&this.C.pa(-1);rd(this,b||!1);return 0<this.K};k.da=function(a){this.b&&this.b.da(a)};
function rd(a,b){if(a.kb){void 0===b&&(b=!0);var c;c=a.b;if(c=c.J&8?c.jd|c.hd<<8:0){var d=c>>8;a.j("trapped to "+J(a,c&255,1)+" ("+(0>d?Ab[-d]:J(a,d))+")")}a.L=Y(a.b.u[7]);b&&1!=a.S?ji(a):ki(a)}}function ii(a,b){var c;(c=!a.b||!wb(a.b))||(c=a.b,c.w.ha?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.w.W?(b||a.j("cpu busy or unavailable, command ignored"),!1):!xb(a.b)}k.Ia=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
k.Ha=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){Vh(this);this.xa=0;this.ia=null;this.K=0;this.L=Y(this.b.u[7]);this.w.W=!1;li(this);a||rd(this)};k.save=function(){var a=new N(this);a.set(0,ei(this.L));a.set(1,ei(this.O));a.set(2,[this.g,this.R,this.ka]);a.set(3,this.I);return a.data()};
k.restore=function(a){var b=0;void 0!==a[2]&&(this.L=fi(a[b++]),this.O=fi(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.R=a[b][1],this.ka|=a[b][2]);a[3]&&(this.I=a[3]);return!0};k.start=function(a,b){this.S||this.j("running");this.w.W=!0;this.Gb=a;this.Hb=b};
k.stop=function(a,b){if(this.w.W){this.w.W=!1;this.K=b-this.Hb;if(!this.S){b="stopped";if(this.K){a-=this.Gb;var c=0<a?Math.round(1E3*this.K/a):0;b+=" (";ye(this)&&(b+=this.xa+" instructions, ",this.xa=0);b+=this.K+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}rd(this,!0);this.rb();li(this,this.b.u[7]);this.ia=null}};function ye(a){return 1<a.f.length||!!a.ua}
function ze(a,b,c){var d=-1;c||(d=a.b.cb(b),0==d&&(b=Hd(a.b,2)));if(0<c&&(a.ua&&!--a.ua||jd(a,b,1,a.f)))return!0;0<=c&&a.H.length&&(a.xa++,0>d&&(d=a.b.cb(b)),65535!=(d&65535)&&(a.kc(a.H[a.ba],b),++a.ba==a.H.length&&(a.ba=0)));return!1}function Ef(a){var b=a.b;if(b.w.W)throw O(b,a.b.oa&65535),a.da(),-1;return!1}
function Uh(a){var b,c;a.f=["bp"];if(a.M)for(b=1;b<a.M.length;b++){c=a.M[b];var d=a.v;c=a.aa(c);kd(d.Y[c>>>d.ja],!1)}a.M=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.v,c=a.aa(c),kd(d.Y[c>>>d.ja],!0);a.D=["bw"];a.mb=0}k.nb=function(a,b,c){var d=!0;c||mi(this,a,b,!1,!0);if(a!=this.f){var e=this.aa(b);if(-1===e)this.j("invalid address: "+J(this,b.F)),d=!1;else{var f=this.v;f.Y[e>>>f.ja].nb(e&f.v,a==this.D)}}d&&(a.push(b),c?b.Qa=!0:(ni(this,a,a.length-1,"set"),Vh(this)));return d};
function mi(a,b,c,d,e){var f=!1;c=a.aa(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.aa(h)&&(!d||h.Qa)){f=!0;h.Qa||e||ni(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.v,kd(d.Y[c>>>d.ja],b==a.D));h.Qa||Vh(a);break}}return f}function oi(a,b){for(var c=1;c<b.length;c++)ni(a,b,c);return b.length-1}function ni(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.F)+(d?" "+d:c.Hc?' "'+c.Hc+'"':""))}
function li(a,b){if(void 0!==b)jd(a,b,1,a.f,!0),a.S=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Qa){if(!mi(a,a.f,c,!0))break;b=0}}}
function jd(a,b,c,d,e){var f=!1;if(!a.mb++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Qa)for(var l=a.aa(h)&65535,m=0;m<c;m++)if(b+m==l){var n,f=!0;h.Qa&&(mi(a,d,h,!0),e=!0);if(n=h.Mc){for(var f=!1,v=0;v<n.length;v++)if(!pi(a,n[v],!0)){if(n[v].indexOf("if")){f=!0;break}for(var r=v+1;r<n.length&&n[r].indexOf("else");r++)v++;if(r==n.length){f=!0;break}}a.b.w.W||(f=!0)}if(f){e||ni(a,d,g,"hit");break}}}a.mb--;return f}
function qi(a,b,c,d){var e=Y(b.F),f=a.na(b,2),g,h;for(h in a.tb)if(g=a.tb[h][f&h])break;g||(g=$h);var l=g[0];0<=a.Fb.indexOf(l)&&(g=$h,l=g[0]);var m=h="",n=Yh[l],v=g.length-1;l||v||(h=J(a,f));for(l=1;l<=v;l++){var r=g[l];if(void 0!==r){var w;w=a;var y=r,r=b,x="",C=y&61440;if(4096==C)r=r.F+((f&255)<<24>>23)&65535,x=J(w,r);else if(8192==C)r=r.F-((f&63)<<1)&65535,x=J(w,r);else if(12288==C)x=J(w,f&7,1);else if(24576==C)x=J(w,f&63,1);else if(32768==C)x=J(w,f&255,1);else if(C=f&y,y&4032&&(C>>=6,y>>=6),
y&63)switch(y=C&7,C&56){case 0:x=hi(y);break;case 8:x="@"+hi(y);break;case 16:7>y?x="("+hi(y)+")+":(C=w.na(r,2),x="#"+J(w,C,0,!0));break;case 24:7>y?x="@("+hi(y)+")+":(C=w.na(r,2),x="@#"+J(w,C,0,!0));break;case 32:x="-("+hi(y)+")";break;case 40:x="@-("+hi(y)+")";break;case 48:C=w.na(r,2);x=J(w,C,0,!0)+"("+hi(y)+")";7==y&&(x=J(w,C+r.F&65535));break;case 56:C=w.na(r,2),x="@"+J(w,C)+"("+hi(y)+")",7==y&&(x="@"+J(w,C+r.F&65535))}w=x;if(!w||!w.length){h="INVALID";break}"string"!=typeof w&&(m=w[1],w=w[0]);
0<h.length&&(h+=",");h+=w||"???"}}f="";g=J(a,e.F)+":";if(-1!==e.F&&-1!==b.F){do if(f+=" "+J(a,a.na(e,2)),null==e.F)break;while(e.F!=b.F)}g+=wa(f,24);g+=wa(n,5);h&&(g+=" "+h);if(c||m)g=wa(g,60)+";"+(c||""),g=a.b.w.ub?g+("cycles="+td(a.b).toString()+" cs="+p(a.b.Lb)):g+(null!=d?"="+d.toString():""),m&&(g+=" @"+m);return g}function ri(a,b){switch(b){case "N":a=Fd(a.b);break;case "Z":a=Ed(a.b);break;case "V":a=Dd(a.b);break;case "C":a=Cd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function si(a,b){var c="",d=a.b;8>b?(c=hi(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Xa[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.Ka[b-16]):20==b?c="PS="+J(a,Uc(d)):21==b&&a.A&&kc(a.A)&&(c="SR="+J(a,a.A.Wa,3));c&&(c+=" ");return c}function ti(a){var b,c="";for(b=0;6>b;b++)c+=si(a,b);c=c+"\n"+(si(a,6)+si(a,7));c+=si(a,20)+si(a,21);return c+=ri(a,"T")+ri(a,"N")+ri(a,"Z")+ri(a,"V")+ri(a,"C")}k.pc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function Vg(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var l=h.o,m=h.a;if(void 0!==l){var n=f,l=[l>>>0,g],v=za(n,l,a.pc);0>v&&n.splice(-(v+1),0,l)}m&&(h.a=m.replace(/''/g,'"'))}a.I.push({Ze:b,F:c,Wc:d,ga:e,nc:f})}function ui(a,b,c){var d=[],e=a.aa(b)>>>0;for(b=0;b<a.I.length;b++){var f=a.I[b],g=f.F>>>0,h=f.Wc;if(e>=g&&e<g+h){e=za(f.nc,[e-g],a.pc);0<=e?vi(a,b,e,d):c&&(e=~e,vi(a,b,e-1,d),vi(a,b,e,d));break}}return d}
function vi(a,b,c,d){var e={},f=a.I[b].nc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.I[b].ga[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function wi(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Sh(a)||a.j("no variables"),!0;if(!c[2])return Sh(a,c[1]);if(!c[3])return delete a.X[c[1]],!0;b=Oh(a,c[3]);return void 0!==b?(a.X[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
function xi(a,b,c){var d=null;if(b=ci(a,b,!0)){a.aa(b);var e=ui(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.F-e[1])&&(g=" + "+p(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.j(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.F)&&(g=" - "+p(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
function ji(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}f=Oh(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":O(d,f);a.L=Y(d.u[7]);break;case "N":d.Z=f?32768:0;break;case "Z":d.$=
f?0:1;break;case "V":d.U=f?32768:0;break;case "C":d.T=f?65536:0;break;case "SR":if(a.A&&kc(a.A)){ic(a.A,f);break}default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=f&65535;break}a.j("unknown register: "+e);return}a.C.pa();a.j("updated registers:")}a.j(ti(a));c&&(a.L=Y(d.u[7]),ki(a,J(a,a.L.F)))}}function yi(a,b){b=xa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):Rh(a,null,c[2].charCodeAt(0)):Oh(a,b,!0)}
function zi(a,b,c){if("?"==c)a.j("trace commands:"),a.j("\tt [#]\ttrace # instructions"),a.j("\ttr [#]\ttrace # instructions with register updates"),a.j("\ttc [#]\ttrace # cycles"),a.j("note: bn [#] to break after # instructions is much faster");else{var d="t"!=b;c=Qh(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);a.vb=b;Sa(c,function(){return ub(a,!0)&&a.jb(e,d,!1)},function(){a.A&&a.A.stop&&a.A.stop();a.C.pa();ub(a,!1)})}}
function ki(a,b,c,d){if(b=ci(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=Qh(a,c.substr(1)),null!=c&&(d=c);else{d=ci(a,c,!0);if(!d||d.F<b.F)return;e=d.F-b.F;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=vb(a,!1)||a.S?a.K:null;var g=null!=f?"cycles":null,h=ui(a,b),l=b.F;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.j(m)}h[3]&&(g=h[3],f=null);f=qi(a,b,g,f);a.j(f);a.L=b;e-=b.F-l;c++}}}
function pi(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.R&&(a.j("ended assemble at "+J(a,a.O.F)),a.L=a.O,a.R=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(wb(a)&&0<b.length){a.R&&(b="a "+J(a,a.O.F)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],l=h.charAt(0),m=1;m<h.length;m++){var n=h.charAt(m);if("?"==l||"r"==l||"a">n||"z"<n){g[0]=h.substr(m);g.unshift(h.substr(0,m));break}}switch(g[0].charAt(0)){case "a":var v=
ci(a,g[1],!0);if(v)if(a.O=v,void 0===g[2])a.j("begin assemble at "+J(a,v.F)),a.R=!0,a.C.pa();else{var r;a.j("not supported yet");r=[];if(r.length){for(var w=0;w<r.length;w++)a.Bb(v,r[w],1);a.j(qi(a,a.O))}}break;case "b":a:{var y=g[0],x=g[1],C=b;if("?"==x)a.j("breakpoint commands:"),a.j("\tbp [#]\tset exec breakpoint at addr #"),a.j("\tbr [#]\tset read breakpoint at addr #"),a.j("\tbw [#]\tset write breakpoint at addr #"),a.j("\tbc [#]\tclear breakpoint at addr #"),a.j("\tbl\tlist all breakpoints"),
a.j("\tbn [#]\tbreak after # instruction(s)");else{var ja=y.charAt(1);if("l"==ja){var Ka;Ka=0+oi(a,a.f);Ka+=oi(a,a.M);(Ka+=oi(a,a.D))||a.j("no breakpoints")}else if("n"==ja)a.ua=Qh(a,x),a.j("break after "+a.ua+" instruction(s)");else if(void 0===x)a.j("missing breakpoint address");else{var P=Y();if("*"!=x&&(P=ci(a,x,!0),!P))break a;"c"==ja?null==P.F?(Uh(a),a.j("all breakpoints cleared")):mi(a,a.f,P)||mi(a,a.M,P)||mi(a,a.D,P)||a.j("breakpoint missing: "+J(a,P.F)):null!=P.F&&(gi(a,P,C),"p"==ja?a.nb(a.f,
P):"r"==ja?a.nb(a.M,P):"w"==ja?a.nb(a.D,P):a.j("unknown breakpoint command: "+ja))}}}break;case "c":a.Ta&&(a.Ta.value="");break;case "d":a:{var ib,Ma=g[0],ma=g[1],Na=g[2],Si=g[3];if("?"==ma){var jb="";for(ib in Bb)a.La[ib]&&(jb&&(jb+=","),jb+=ib);jb+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
jb.length&&a.j("dump extension commands:\n\t"+jb)}else if("state"==ma){var Dg=Ai(a.C,!0);"console"==Na?console.log(Dg):(a.Ta&&(a.Ta.value=""),a.j(Dg))}else if("symbols"==ma)for(var Ld=0;Ld<a.I.length;Ld++){var Md=a.I[Ld],kb;for(kb in Md.ga)if("."!=kb.charAt(0)){var Eg=Md.ga[kb].o;if(void 0!==Eg){var Fg=Md.ga[kb].l;Fg&&(kb=Fg);a.j(J(a,Eg)+" "+kb)}}}else{if("d"==Ma){for(ib in Bb)if(g[1]==ib){var Gg=a.La[ib];Gg?(g.shift(),g.shift(),Gg(g)):a.j("no dump registered for "+ma);break a}ma||(Ma=a.Jb||"dw")}else a.Jb=
Ma;if("dh"==Ma){var Hg=ma,Ig=Na,Jg="",Kg=0,fa=a.ba,na=a.H;if(na.length){var Z=+Hg||a.ob,Qb=+Ig||10;isNaN(Z)?Z=Qb:Jg="more ";Z>na.length&&(a.j("note: only "+na.length+" available"),Z=na.length);fa-=Z;0>fa&&(null==na[na.length-1].F?(Z=fa+Z,fa=0):fa+=na.length);var Nd=[];"call"==Ig&&(Qb=1E5,Nd=["CALL"]);for(void 0!==Hg&&a.j(Z+" instructions earlier:");0<Qb&&fa!=a.ba;){var Lg=na[fa++];if(null==Lg.F)break;var Rb=Y(Lg.F),Ti=Z--,Mg=qi(a,Rb,"history",Ti);(!Nd.length||0<=Mg.indexOf(Nd[0]))&&a.j(Mg);Rb.bc&&
(fa+=Rb.bc,Qb-=Rb.bc,Z-=Rb.bc);fa>=na.length&&(fa=0);a.ob=Z;Kg++;Qb--}}Kg||(a.j("no "+Jg+"history available"),a.ob=void 0)}else{var lb=ci(a,ma);if(lb){var Sb=0,Od=!1,Pd="ds"==Ma;Na&&(Od=!0,"l"==Na.charAt(0)&&(Od=!1,Na=Na.substr(1)||Si),Sb=Qh(a,Na)>>>0,65536<Sb&&(Sb=65536));for(var mb="dd"==Ma?4:"db"==Ma?1:2,Ic=(Od?Sb-lb.F:mb*Sb)||128,Qd=Pd?16:a.ca,Ui=(Ic+Qd-1)/Qd|0||1,Oa="";Ui--&&0<Ic;){for(var Pa="",Rd="",ma=J(a,lb.F),Jc=Qd,Tb=0,Ub=0;0<Jc&&0<Ic;){var nb=1,Kc=1==mb?a.Ib(lb,nb):a.na(lb,nb=2),Tb=Tb|
Kc<<(Ub<<3),Ub=Ub+nb;Ub==mb&&(Pd?(Pa&&(Pa+=","),Pa+="0x"+p(Tb,2*mb)):(Pa+=J(a,Tb,mb),Pa+=1==mb?9==Jc?"-":" ":" "),Tb=Ub=0);Jc-=nb;for(Ic-=nb;nb--;)var Sd=Kc&255,Rd=Rd+(32<=Sd&&128>Sd?String.fromCharCode(Sd):"."),Kc=Kc>>8}Oa&&(Oa+="\n");Oa=Pd?Oa+(Pa+","):Oa+(ma+" "+Pa+(0==Jc?" "+Rd:""))}Oa&&a.j(Oa);a.lb=lb}}}}break;case "e":if("else"==g[0])break;var ob,Td,Ud,Vd,Wd=g[0],Xd=g[1];"eb"==Wd?(ob=1,Td=255,Ud=a.Ib,Vd=a.Bb):"e"==Wd||"ew"==Wd?(ob=2,Td=65535,Ud=a.na,Vd=a.hb):Xd=null;if(null==Xd)a.j("edit memory commands:"),
a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var Lc=ci(a,Xd);if(Lc)for(var Mc=2;Mc<g.length;Mc++){var Vb=Oh(a,g[Mc]);if(void 0===Vb){a.j("unrecognized value: "+g[Mc]);break}Vb&~Td&&a.j("warning: "+p(Vb)+" exceeds "+ob+"-byte value");a.j("changing "+J(a,Lc.F)+(F(a,64)?"":" from "+J(a,Ud.call(a,Lc),ob))+" to "+J(a,Vb,ob));Vd.call(a,Lc,Vb,ob)}}break;case "g":a:{var Ng=g[1],Vi=b;if(void 0!==Ng){var Yd=ci(a,Ng,!0);if(!Yd)break a;gi(a,Yd,Vi);a.nb(a.f,
Yd,!0)}a.ib(!0,c)}break;case "h":a.w.W?(c||a.j("halting"),a.da()):vb(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var Zd;var Wb=b.substr(2),Wb=xa(Wb);Oh(a,Wb)?(c||a.j("true: "+Wb),Zd=!0):(c||a.j("false: "+Wb),Zd=!1);Zd||(d=!1);break}f=!0;break;case "k":var Wi=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var $d=0,ae=Y(),Xb=Y(a.b.u[6]);for(a.j("stack trace for "+J(a,Xb.F));10>$d;){for(var Qa=null,Xi=256;65536>
Xb.F>>>0;){ae.F=a.na(Xb,2);if(null==Xb.F||!Xi--)break;if(!(ae.F&1)){for(var Yi=a,Nc=ae,Og=null,Yb=Nc.F,Pg=Yb,be=1;6>=be&&Yb;be++){if(2<be){Nc.F=Yb;var Oc=qi(Yi,Nc);if(0<=Oc.indexOf("JSR")){var Qg=Oc.indexOf(" ");if(Yb+(Oc.indexOf(" ",Qg+1)-Qg-1)/2==Pg){Og=Oc;break}}}Yb-=2}Nc.F=Pg;if(Qa=Og)break}}if(!Qa||null==Qa)break;var Rg=null;if("ks"==Wi){var Sg=Qa.match(/[0-9A-F]+$/);Sg&&(Rg=xi(a,Sg[0]))}Qa=wa(Qa,50)+" ;"+(Rg||"stack="+J(a,Xb.F));a.j(Qa);$d++}$d||a.j("no return addresses found")}break;case "l":if("ln"==
g[0]){xi(a,g[1],!0);break}f=!0;break;case "m":a:{var oa,pa=null,G=g[1];"?"==G&&(G=void 0);if(void 0!==G){var Ca=0;if("all"==G)Ca=1878917119,G=null;else if("on"==G)pa=!0,G=null;else if("off"==G)pa=!1,G=null;else{"keys"==G&&(G="key");"kbd"==G&&(G="keyboard");for(oa in Bb)if(G==oa){Ca=Bb[oa];pa=!!(a.ka&Ca);break}if(!Ca){a.j("unknown message category: "+G);break a}}if(Ca)if("on"==g[2])a.ka|=Ca,pa=!0;else if("off"==g[2]&&(a.ka&=~Ca,pa=!1,1073741824==Ca)){for(var ce=0;ce<a.wa.length;ce++)a.j(a.wa[ce]);
a.wa=[]}}var Zi=0,Zb="";for(oa in Bb)if(!G||G==oa){var $i=!!(a.ka&Bb[oa]);if(null===pa||pa==$i)Zb&&(Zb+=","),++Zi%10||(Zb+="\n\t"),"key"==oa&&(oa="keys"),Zb+=oa}void 0===G&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==pa?pa?"messages on: ":"messages off: ":"message categories:\n\t")+(Zb||"none"));Vh(a)}break;case "p":if("print"==g[0]){yi(a,b.substr(5));break}var aj="pr"==g[0]?1:0;if(a.S)a.j("step in progress");else{var Tg=Y(a.b.u[7]);a.Ib(Tg);a.S?(a.nb(a.f,
Tg,!0),a.ib()||(a.C&&a.C.rb(),a.S=0)):zi(a,aj?"tr":"t")}break;case "r":if("reset"==b){a.C&&a.C.reset();break}ji(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var $b=+g[2];if(8==$b||10==$b||16==$b)a.ca=$b;else{a.j("invalid base: "+$b);break}}a.j("default base: "+a.ca);break;case "cs":var ac;void 0!==g[3]&&(ac=+g[3]);switch(g[2]){case "int":a.b.wb=ac;break;case "start":a.b.Mb=ac;break;case "stop":a.b.xb=ac;break;default:a.j("unknown cs option");break a}void 0!==ac&&qd(a.b);a.j("checksums "+
(a.b.w.ub?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(ud(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.pb.toFixed(2)+"Mhz")+" ("+a.b.eb+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),
a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":zi(a,g[0],g[1]);break;case "u":ki(a,g[1],g[2],8);break;case "v":if("var"==g[0]){wi(a,b.substr(3))||(d=!1);break}if("ver"==g[0]){a.j("PDPjs version 1.30.3 ("+a.b.Va+",RELEASE"+(zb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){yi(a,b.substr(1));break}var de="commands:",ee;for(ee in Xh)de+="\n"+wa(ee,9)+Xh[ee];ye(a)||(de+="\nnote: history disabled if no exec breakpoints");a.j(de);
break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(Ug){a.j("debugger error: "+(Ug.stack||Ug.message)),d=!1}return d}function sd(a,b,c){b=Mh(a,b,c);for(var d in b)if(!pi(a,b[+d]))return!1;return!0}Za(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Th(d);B(d,c)}});
function Bi(a,b,c){t.call(this,"Computer",a,Bi,67108864);this.w.ha=!1;Ci(this,b);this.L=od(this,"autoPower",a);this.C=0;this.X=a.busWidth||a.buswidth;this.f=Di;this.I=null;this.D=this.R=!1;this.ba=od(this,"url")||"";(Math.random()+.1).toString(36);this.g=Ei(this);if(this.b=tb("CPU",this.id)){this.i=tb("Debugger",this.id);this.v=new mc({id:this.Sa+".bus",busWidth:this.X},this.b,this.i);var d,e=rb(this.id);if((this.A=tb("Panel",this.id))&&this.A.Ta)for(b=0;b<e.length;b++)d=e[b],d.P=this.A.P,d.j=this.A.j,
d.Ta=this.A.Ta;this.j("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ga&&d.Ga(this,this.v,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=od(this,"state")||(f=!0,a.state))b=this.M=a,f||(this.D=!0,this.f=Di),this.f&&(this.K=
new N(this,"1.30.3"),Fi(this.K)?b=null:delete this.K);!b&&this.f&&(b=Gi(this))&&(this.D=!0);if(b){var g=this;Da(b,null,!0,function(a,b,c){c?(g.H=null,g.D=!1,g.P("Unable to load machine state from server (error "+c+(b?": "+xa(b):"")+")")):(g.I=b,g.R=!0);H(g)})}else H(this);this.G.power||(this.L=!0);!c&&this.L&&Hi(this,this.Nb)}else q("Unable to find CPU component")}z(Bi);var Di=0;
function Ci(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.S=b}function od(a,b,c){var d=b.toLowerCase(),d=db[b]||db[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Hi(a,b,c){for(var d=rb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!wb(f)){wb(f,function(){Hi(a,b,c)});return}}b.call(a,c)}
function Ii(a,b){var c=new N(a,"1.30.3","validate");if(Fi(c)&&Ji(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())}}k=Bi.prototype;
k.Nb=function(a){void 0===a&&(a=this.f||(this.I?1:Di));if(!this.C){this.C++;var b=!1,c=!1;this.O=!1;var d=this.K||new N(this,"1.30.3");if(-1==a)b=!0;else if(a>Di){if(Fi(d,this.I)){this.B=new N(this,"1.30.3","failsafe");Fi(this.B)&&(Ki(this,d),a=2,Li(this.B));this.B.set("timestamp",Ba());Mi(this.B);var e=this.f&&!this.D;if(1==a||Ga("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Ji(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Fi(d,g):("error"==
f&&"no machine state"!=g?(this.P("Error: "+g),"unable to verify user"==g&&(La("user",""),this.g=null)):this.j(f+": "+g),Li(d),Fi(d)?(c=Ji(d),e=!0):c=!1))}e&&Ii(this,c?d:null)}else 2==a&&d.clear()}else Ii(this);delete this.I;delete this.K}e=rb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Ni(this,g,d,b,c));b=[d,a,c];-1!=a?Hi(this,this.qc,b):this.qc(b)}};
function Ni(a,b,c,d,e){if(!b.w.ha){b.w.ha=!0;if(b.Ia){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.Ia(f,d)&&f&&(q("Unable to restore state for "+b.type),a.M&&!a.R?(c.clear(),a.f=Di,window&&window.location.reload()):a.O=!0,b.Ia(null),e=!1)}if(!d&&b.yc)for(a=b.yc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
k.qc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ca=!0;this.w.ha=!0;var d=this.G.power;d&&(d.textContent="Shutdown");this.b&&(Ni(this,this.b,b,c,a),this.pa(),this.b.sb());this.O&&(Ki(this,b),b.clear());!c&&this.B&&(this.B.clear(),delete this.B);this.C=0};
function Ki(a,b){if(Ga("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.3"};d.url=a.ba;d.user=c;d.type="bug";d.data=b;Da("http://www.pcjs.org/api/v1/report",d,!0)}}
function Ai(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new N(a,"1.30.3"),g=new N(a,"1.30.3","validate"),h=Ba();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Ha&&(c&&a.b.da(),d=a.b.Ha(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.w.ha=!1,!1===d&&(e=null)));for(var h=rb(a.id),l=0;l<h.length;l++){var m=h[l];m.w.ha&&(m.Ha&&(d=m.Ha(b,c),"object"===typeof d&&f.set(m.id,
d)),c&&(m.w.ha=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&Oi(a,a.g,f.toString()),Mi(g)&&Mi(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.w.ha=!1,b=a.G.power)&&(b.textContent="Power");a.C=0;return e}
k.reset=function(){this.v&&this.v.reset&&(E(this,"Resetting "+this.v.type),this.v.reset());this.b&&this.b.reset&&(E(this,"Resetting "+this.b.type),this.b.reset());for(var a=rb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.v&&c!==this.b&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}this.pa(-1)};k.start=function(a,b){for(var c=rb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.pa(-1)};
k.stop=function(a,b){for(var c=rb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.pa(-1)};
k.pa=function(a){if(this.b){var b=this.b,c=a||0,d=b.G.speed;d&&(0>=c||30<=(b.tb+=c))&&(d.textContent=b.w.W?b.ma.toFixed(2)+"Mhz":"Stopped",b.tb=0)}if(this.A&&(b=this.A,a=a||0,b.I)){c=b.b.w.W;d=!!(b.b.J&4);if(0>=a||60<=(b.H+=a)){for(var e=0;e<b.b.u.length;e++)Pb(b,"R"+e,b.b.u[e]);e=Uc(b.b);Pb(b,"PS",e);Pb(b,"NF",e&8?1:0,1);Pb(b,"ZF",e&4?1:0,1);Pb(b,"VF",e&2?1:0,1);Pb(b,"CF",e&1?1:0,1);b.H=0}hc(b,0<a&&c&&!d?b.b.u[7]:b.f);gc(b,b.D);a=b.b;a=a.L?a.fb&16?1:2:4;jc(b,"B22",a&1);jc(b,"B18",a&2);jc(b,"B16",
function Uh(a,b,c){var d;if(b){b=Vh(a,b);for(var e=0,f=!1,g=b,h=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var n=m[e++],v=n.length,n=ya(n);if(!n){f=!0;break}n=Wh(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}h.push(n);if(e==m.length)break;var n=m[e++],r=n.length;l.length&&Rh[n]<Rh[l[l.length-1]]&&Th(h,l,1);l.push(n);b=b.substr(v+r)}Th(h,l)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&Xh(a,null,
d))}return d}function Vh(a,b){for(var c,d=a.Ea?"(":"{",e=a.Ea?")":"}",f=new RegExp(a.Ea?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=Uh(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
function Wh(a,b,c,d){var e;null!=b?(e=a.wc(b),0<=e?e=a.xc(e):(e=a.X[b],null==e&&(e=ma(b,a.ca))),null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)):d||a.j("missing "+(c||"value"));return e}
function Xh(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var l=d&255,m=8,n="";m?32<m&&(m=32):m=32;if(null==l||isNaN(l))for(;0<m--;)n="?"+n;else for(;0<m--;)n=(l&1?"1":"0")+n,l>>=1;g=n+g;d>>=8}d=p(c,0,!0)+" "+c+". "+ra(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function Yh(a,b){if(b)return Xh(a,b,a.X[b]);var c=0;for(b in a.X)Xh(a,b,a.X[b]),c++;return 0<c}
function J(a,b,c,d){switch(a.ca){case 8:a=ra(b,3*c-(2<c?1:0));break;case 10:a=b.toString();break;default:a=p(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
function Zh(a){Qh.call(this,a);this.lb=!1;this.Ea=!0;this.L=Y(0);this.mb=Y(0);this.O=Y(0);this.I=[];this.f=this.M=this.D=[];$h(this);this.wa=0;ai(this);this.Ma={};bi(this,a.messages);this.bb=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return xd(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return xd(b,a)})}z(Zh,Qh);
var ci={"?":"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"},di=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
ei={SP:6,PC:7,PS:20,IR:21,ER:22,SL:23,MMR0:24,MMR1:25,MMR2:26,MMR3:27,AR:28,DR:29,SR:30},fi={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],
768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106,32768],35072:[107,32768]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],
35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],
183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},gi=[0],hi=[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=Zh.prototype;
k.Ia=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.w=a.w;(a=td(a,"messages"))&&bi(this,a);this.wb=fi;this.Ib=1145>this.b.Xa?hi:[];ii(this,function(a){a:{var b=d.v.Y,c=a[0],e=a=0,l=b.length;if(c){a=d.aa(ji(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.v.ja;l=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.j("..."):(c=n.type,m=Cc[c],n&&d.j(p(n.id,8)+" %"+
p(e<<d.v.ja,8)+" %%"+p(n.F,8)+" "+p(n.Ub,4,!0)+" "+p(n.size,4,!0)+" "+m),c!=fd&&(c=-1),m=0);a+=d.v.Ba;e++}}});H(this)};
k.ua=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ma=this.G[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",xd(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.B<d.g.length-1&&(b=d.g[++d.B])):40==a.keyCode&&(0<d.B?b=d.g[--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.G[b]=c,Ua(c,function(){if(d.ma){var a=d.ma.value;
d.ma.value="";xd(d,a,!0);return!0}return!1}),!0;case "step":return this.G[b]=c,Ua(c,function(a){var b=!1;wb(d,!0)||(vb(d,!0),b=d.kb(a?1:0,null),vb(d,!1));return b}),!0}return!1};k.ub=function(a){if(this.ma){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.ma.focus();!a&&window&&window.scrollTo(b,c)}};k.aa=function(a){a=a&&a.F;null==a&&(a=-1);return a};k.Lb=function(a,b){var c=255,d=this.aa(a,!1,1);-1!==d&&(c=a.Xb?this.v.Zb(d):this.b.Zb(d),b&&ki(a,b));return c};
k.na=function(a,b){var c=65535,d=this.aa(a,!1,2);-1!==d&&(c=a.Xb?this.v.fb(d):this.b.fb(d),b&&ki(a,b));return c};k.Eb=function(a,b,c){var d=this.aa(a,!0,1);-1!==d&&(a.Xb?this.v.tb(d,b):this.b.tb(d,b),c&&ki(a,c),this.C.pa(-1))};k.ib=function(a,b,c){var d=this.aa(a,!0,2);-1!==d&&(a.Xb?this.v.Fb(d,b):this.b.Fb(d,b),c&&ki(a,c),this.C.pa(-1))};function Y(a,b){return{F:a,Xb:b,Ra:!1}}k.nc=function(a,b){a.F=b;a.Ra=!1;return a};function li(a){return[a.F,a.Ra]}function mi(a){return{F:a[0],Ra:a[1]}}
function ji(a,b,c){var d,e=(c?a.L:a.mb).F;c=!1;if(void 0!==b){b=Vh(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.I.length;e++){var g=a.I[e].ga[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Y(d));break}}if(d=f)return d;e=Uh(a,b,void 0)}null!=e&&(d=Y(e,c));return d}function ni(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Pc=Sh(a,b.Kc=c[2]))}function ki(a,b){null!=a.F&&(a.F+=b||1)}
function bi(a,b){a.i=a;a.ka=a.Tc=536870912;a.ia=null;a.ya=[];b=Sh(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in Cb){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.ka|=Cb[c],a.j(c+" messages enabled"))}}function ii(a,b){for(var c in Cb)if(64==Cb[c]){a.Ma[c]=b;break}}
k.wc=function(a){a=a.toUpperCase();var b=ei[a];null==b&&(b=-1,"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b))&&(b=-1);return b};function oi(a){return 6>a?"R"+a:6==a?"SP":"PC"}
k.xc=function(a){var b;if(0<=a)if(8>a)b=this.b.u[a];else if(16>a)b=this.b.Za[a-8];else if(20>a)b=this.b.La[a-16];else{var c=this.b,d=this.w;switch(a){case 20:b=Zc(this.b);break;case 21:b=c.Sb;break;case 22:b=c.ta;break;case 23:b=c.sb;break;case 24:b=Tc(d);break;case 25:b=Vc(d);break;case 26:b=Wc(d);break;case 27:b=d.Ta;break;case 28:d&&(b=d.sa);break;case 29:d&&(b=d.rb);break;case 30:d&&lc(d)&&(b=d.Ya)}}return b};
k.message=function(a,b){b&&(a+=" @"+J(this,Y(this.b.oa&65535).F));if(this.ka&1073741824)this.ya.push(a);else if(!this.ia||a!=this.ia){this.ia=a;if(this.ka&-2147483648&&this.b&&this.b.A.W||wb(this,!0))this.da(),a+=" (cpu halted)";this.j(a);this.b&&(a=this.b,Bd(a),a.ya=0,a.pa())}};
function ai(a){var b;if(!Ee(a))a.H&&a.H.length&&a.j("instruction history buffer freed"),a.ba=0,a.H=[];else if(!a.H||!a.H.length){a.H=Array(1E3);for(b=0;b<a.H.length;b++)a.H[b]=Y();a.ba=0;a.j("instruction history buffer allocated")}}k.jb=function(a,b){if(!pi(this,b))return!1;this.b.jb(a);return!0};
k.kb=function(a,b,c){if(!pi(this))return!1;null===b&&(b=!this.yb||"tr"==this.yb);this.K=0;a||Ee(this)&&Fe(this,this.b.u[7],0);try{a=Cd(this.b,a);var d=this.b.kb(a);0<d&&(dc(this.b,d),this.K+=d,ec(this.b,d,!0),fc(this.b,d),this.za++)}catch(e){"number"!=typeof e&&(this.K=0,zb(this.b,e.stack||e.message))}!1!==c&&(this.w&&this.w.stop&&this.w.stop(),this.C.pa(-1));wd(this,b||!1);return 0<this.K};k.da=function(a){this.b&&this.b.da(a)};
function wd(a,b){if(a.lb){void 0===b&&(b=!0);var c;c=a.b;if(c=c.J&8?c.md|c.ld<<8:0){var d=c>>8;a.j("trapped to "+J(a,c&255,1)+" ("+(0>d?Bb[-d]:J(a,d))+")")}a.L=Y(a.b.u[7]);b&&1!=a.S?qi(a):ri(a)}}function pi(a,b){var c;(c=!a.b||!xb(a.b))||(c=a.b,c.A.ha?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.A.W?(b||a.j("cpu busy or unavailable, command ignored"),!1):!yb(a.b)}k.Ka=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
k.Ja=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){ai(this);this.za=0;this.ia=null;this.K=0;this.L=Y(this.b.u[7]);this.A.W=!1;si(this);a||wd(this)};k.save=function(){var a=new N(this);a.set(0,li(this.L));a.set(1,li(this.O));a.set(2,[this.g,this.R,this.ka]);a.set(3,this.I);return a.data()};
k.restore=function(a){var b=0;void 0!==a[2]&&(this.L=mi(a[b++]),this.O=mi(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.R=a[b][1],this.ka|=a[b][2]);a[3]&&(this.I=a[3]);return!0};k.start=function(a,b){this.S||this.j("running");this.A.W=!0;this.Jb=a;this.Kb=b};
k.stop=function(a,b){if(this.A.W){this.A.W=!1;this.K=b-this.Kb;if(!this.S){b="stopped";if(this.K){a-=this.Jb;var c=0<a?Math.round(1E3*this.K/a):0;b+=" (";Ee(this)&&(b+=this.za+" instructions, ",this.za=0);b+=this.K+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}wd(this,!0);this.ub();si(this,this.b.u[7]);this.ia=null}};function Ee(a){return 1<a.f.length||!!a.wa}
function Fe(a,b,c){var d=-1;c||(d=a.b.fb(b),0==d&&(b=Nd(a.b,2)));if(0<c&&(a.wa&&!--a.wa||od(a,b,1,a.f)))return!0;0<=c&&a.H.length&&(a.za++,0>d&&(d=a.b.fb(b)),65535!=(d&65535)&&(a.nc(a.H[a.ba],b),++a.ba==a.H.length&&(a.ba=0)));return!1}function Kf(a){var b=a.b;if(b.A.W)throw O(b,a.b.oa&65535),a.da(),-1;return!1}
function $h(a){var b,c;a.f=["bp"];if(a.M)for(b=1;b<a.M.length;b++){c=a.M[b];var d=a.v;c=a.aa(c);pd(d.Y[c>>>d.ja],!1)}a.M=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.v,c=a.aa(c),pd(d.Y[c>>>d.ja],!0);a.D=["bw"];a.nb=0}k.ob=function(a,b,c){var d=!0;c||ti(this,a,b,!1,!0);if(a!=this.f){var e=this.aa(b);if(-1===e)this.j("invalid address: "+J(this,b.F)),d=!1;else{var f=this.v;f.Y[e>>>f.ja].ob(e&f.v,a==this.D)}}d&&(a.push(b),c?b.Ra=!0:(ui(this,a,a.length-1,"set"),ai(this)));return d};
function ti(a,b,c,d,e){var f=!1;c=a.aa(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.aa(h)&&(!d||h.Ra)){f=!0;h.Ra||e||ui(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.v,pd(d.Y[c>>>d.ja],b==a.D));h.Ra||ai(a);break}}return f}function vi(a,b){for(var c=1;c<b.length;c++)ui(a,b,c);return b.length-1}function ui(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.F)+(d?" "+d:c.Kc?' "'+c.Kc+'"':""))}
function si(a,b){if(void 0!==b)od(a,b,1,a.f,!0),a.S=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ra){if(!ti(a,a.f,c,!0))break;b=0}}}
function od(a,b,c,d,e){var f=!1;if(!a.nb++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Ra)for(var l=a.aa(h)&65535,m=0;m<c;m++)if(b+m==l){var n,f=!0;h.Ra&&(ti(a,d,h,!0),e=!0);if(n=h.Pc){for(var f=!1,v=0;v<n.length;v++)if(!wi(a,n[v],!0)){if(n[v].indexOf("if")){f=!0;break}for(var r=v+1;r<n.length&&n[r].indexOf("else");r++)v++;if(r==n.length){f=!0;break}}a.b.A.W||(f=!0)}if(f){e||ui(a,d,g,"hit");break}}}a.nb--;return f}
function xi(a,b,c,d){var e=Y(b.F),f=a.na(b,2),g,h;for(h in a.wb)if(g=a.wb[h][f&h])break;g||(g=gi);var l=g[0];0<=a.Ib.indexOf(l)&&(g=gi,l=g[0]);var m=h="",n=di[l],v=g.length-1;l||v||(h=J(a,f));for(l=1;l<=v;l++){var r=g[l];if(void 0!==r){var w;w=a;var y=r,r=b,x="",C=y&61440;if(4096==C)r=r.F+((f&255)<<24>>23)&65535,x=J(w,r);else if(8192==C)r=r.F-((f&63)<<1)&65535,x=J(w,r);else if(12288==C)x=J(w,f&7,1);else if(24576==C)x=J(w,f&63,1);else if(32768==C)x=J(w,f&255,1);else if(C=f&y,y&4032&&(C>>=6,y>>=6),
y&63)switch(y=C&7,C&56){case 0:x=oi(y);break;case 8:x="@"+oi(y);break;case 16:7>y?x="("+oi(y)+")+":(C=w.na(r,2),x="#"+J(w,C,0,!0));break;case 24:7>y?x="@("+oi(y)+")+":(C=w.na(r,2),x="@#"+J(w,C,0,!0));break;case 32:x="-("+oi(y)+")";break;case 40:x="@-("+oi(y)+")";break;case 48:C=w.na(r,2);x=J(w,C,0,!0)+"("+oi(y)+")";7==y&&(x=J(w,C+r.F&65535));break;case 56:C=w.na(r,2),x="@"+J(w,C)+"("+oi(y)+")",7==y&&(x="@"+J(w,C+r.F&65535))}w=x;if(!w||!w.length){h="INVALID";break}"string"!=typeof w&&(m=w[1],w=w[0]);
0<h.length&&(h+=",");h+=w||"???"}}f="";g=J(a,e.F)+":";if(-1!==e.F&&-1!==b.F){do if(f+=" "+J(a,a.na(e,2)),null==e.F)break;while(e.F!=b.F)}g+=xa(f,24);g+=xa(n,5);h&&(g+=" "+h);if(c||m)g=xa(g,60)+";"+(c||""),g=a.b.A.xb?g+("cycles="+yd(a.b).toString()+" cs="+p(a.b.Pb)):g+(null!=d?"="+d.toString():""),m&&(g+=" @"+m);return g}function yi(a,b){switch(b){case "N":a=Ld(a.b);break;case "Z":a=Kd(a.b);break;case "V":a=Jd(a.b);break;case "C":a=Id(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function Z(a,b){var c="",d=a.b;if(8>b)c=oi(b),c+="="+J(a,d.u[b]);else if(13>b)c="A"+(b-8)+"="+J(a,d.Za[b-8]);else if(16<=b&&20>b)c="S"+(b-16)+"="+J(a,d.La[b-16]);else switch(b){case 20:c="PS="+J(a,Zc(d));break;case 21:c="IR="+J(a,d.Sb);break;case 22:c="ER="+J(a,d.ta);break;case 23:c="SL="+J(a,d.sb);break;case 24:c="MMR0="+J(a,Tc(d));break;case 25:c="MMR1="+J(a,Vc(d));break;case 26:c="MMR2="+J(a,Wc(d));break;case 27:c="MMR3="+J(a,d.Ta);break;case 28:a.w&&(c="AR="+J(a,a.w.sa,3));break;case 29:a.w&&
(c="DR="+J(a,a.w.rb));break;case 30:a.w&&lc(a.w)&&(c="SR="+J(a,a.w.Ya,3))}c&&(c+=" ");return c}function zi(a,b){var c,d="";for(c=0;6>c;c++)d+=Z(a,c);d=d+"\n"+(Z(a,6)+Z(a,7));d+=Z(a,20)+Z(a,21)+Z(a,23);d+=yi(a,"T")+yi(a,"N")+yi(a,"Z")+yi(a,"V")+yi(a,"C");b&&(b=d,c=""+(Z(a,24)+Z(a,25)),c+=Z(a,26)+Z(a,27)+Z(a,22),c=c+"\n"+(Z(a,30)+Z(a,28)+Z(a,29)),d=b+("\n"+c));return d}k.sc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function ah(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var l=h.o,m=h.a;if(void 0!==l){var n=f,l=[l>>>0,g],v=Aa(n,l,a.sc);0>v&&n.splice(-(v+1),0,l)}m&&(h.a=m.replace(/''/g,'"'))}a.I.push({bf:b,F:c,Zc:d,ga:e,qc:f})}function Ai(a,b,c){var d=[],e=a.aa(b)>>>0;for(b=0;b<a.I.length;b++){var f=a.I[b],g=f.F>>>0,h=f.Zc;if(e>=g&&e<g+h){e=Aa(f.qc,[e-g],a.sc);0<=e?Bi(a,b,e,d):c&&(e=~e,Bi(a,b,e-1,d),Bi(a,b,e,d));break}}return d}
function Bi(a,b,c,d){var e={},f=a.I[b].qc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.I[b].ga[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function Ci(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Yh(a)||a.j("no variables"),!0;if(!c[2])return Yh(a,c[1]);if(!c[3])return delete a.X[c[1]],!0;b=Uh(a,c[3]);return void 0!==b?(a.X[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
function Di(a,b,c){var d=null;if(b=ji(a,b,!0)){a.aa(b);var e=Ai(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.F-e[1])&&(g=" + "+p(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.j(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.F)&&(g=" - "+p(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
function qi(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trm\tdump misc registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=!1,e=a.b;null==c&&(c=!0);if(b&&1<b.length){var f=b[1];if("m"==f)d=!0;else{var g=f.indexOf("=");if(0<g)b=f.substr(g+1),f=f.substr(0,g);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}g=Uh(a,b);if(void 0===g)return;b=f.toUpperCase();switch(b){case "SP":case "R6":e.u[6]=g&65535;break;case "PC":case "R7":O(e,
g);a.L=Y(e.u[7]);break;case "N":e.Z=g?32768:0;break;case "Z":e.$=g?0:1;break;case "V":e.U=g?32768:0;break;case "C":e.T=g?65536:0;break;case "PS":$c(e,g);break;case "IR":Yc(e,g);break;case "ER":e.ta=g;d=!0;break;case "SL":e.sb=g|255;break;case "MMR0":Uc(e,g);d=!0;break;case "MMR3":Xc(e,g);d=!0;break;case "AR":a.w&&(d=a.w,ic(d,d.sa=g));d=!0;break;case "DR":a.w&&(d=a.w,hc(d,d.rb=g));d=!0;break;case "SR":if(a.w&&lc(a.w)){jc(a.w,g);d=!0;break}default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){e.u[b]=
g&65535;break}a.j("unknown register: "+f);return}a.C.pa();a.j("updated registers:")}}a.j(zi(a,d));c&&(a.L=Y(e.u[7]),ri(a,J(a,a.L.F)))}}function Ei(a,b){b=ya(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):Xh(a,null,c[2].charCodeAt(0)):Uh(a,b,!0)}
function Fi(a,b,c){if("?"==c)a.j("trace commands:"),a.j("\tt [#]\ttrace # instructions"),a.j("\ttr [#]\ttrace # instructions with register updates"),a.j("\ttc [#]\ttrace # cycles"),a.j("note: bn [#] to break after # instructions is much faster");else{var d="t"!=b;c=Wh(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);a.yb=b;Ta(c,function(){return vb(a,!0)&&a.kb(e,d,!1)},function(){a.w&&a.w.stop&&a.w.stop();a.C.pa(-1);vb(a,!1)})}}
function ri(a,b,c,d){if(b=ji(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=Wh(a,c.substr(1)),null!=c&&(d=c);else{d=ji(a,c,!0);if(!d||d.F<b.F)return;e=d.F-b.F;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=wb(a,!1)||a.S?a.K:null;var g=null!=f?"cycles":null,h=Ai(a,b),l=b.F;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.j(m)}h[3]&&(g=h[3],f=null);f=xi(a,b,g,f);a.j(f);a.L=b;e-=b.F-l;c++}}}
function wi(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.R&&(a.j("ended assemble at "+J(a,a.O.F)),a.L=a.O,a.R=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(xb(a)&&0<b.length){a.R&&(b="a "+J(a,a.O.F)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],l=h.charAt(0),m=1;m<h.length;m++){var n=h.charAt(m);if("?"==l||"r"==l||"a">n||"z"<n){g[0]=h.substr(m);g.unshift(h.substr(0,m));break}}switch(g[0].charAt(0)){case "a":var v=
ji(a,g[1],!0);if(v)if(a.O=v,void 0===g[2])a.j("begin assemble at "+J(a,v.F)),a.R=!0,a.C.pa();else{var r;a.j("not supported yet");r=[];if(r.length){for(var w=0;w<r.length;w++)a.Eb(v,r[w],1);a.j(xi(a,a.O))}}break;case "b":a:{var y=g[0],x=g[1],C=b;if("?"==x)a.j("breakpoint commands:"),a.j("\tbp [#]\tset exec breakpoint at addr #"),a.j("\tbr [#]\tset read breakpoint at addr #"),a.j("\tbw [#]\tset write breakpoint at addr #"),a.j("\tbc [#]\tclear breakpoint at addr #"),a.j("\tbl\tlist all breakpoints"),
a.j("\tbn [#]\tbreak after # instruction(s)");else{var ka=y.charAt(1);if("l"==ka){var La;La=0+vi(a,a.f);La+=vi(a,a.M);(La+=vi(a,a.D))||a.j("no breakpoints")}else if("n"==ka)a.wa=Wh(a,x),a.j("break after "+a.wa+" instruction(s)");else if(void 0===x)a.j("missing breakpoint address");else{var P=Y();if("*"!=x&&(P=ji(a,x,!0),!P))break a;"c"==ka?null==P.F?($h(a),a.j("all breakpoints cleared")):ti(a,a.f,P)||ti(a,a.M,P)||ti(a,a.D,P)||a.j("breakpoint missing: "+J(a,P.F)):null!=P.F&&(ni(a,P,C),"p"==ka?a.ob(a.f,
P):"r"==ka?a.ob(a.M,P):"w"==ka?a.ob(a.D,P):a.j("unknown breakpoint command: "+ka))}}}break;case "c":a.Va&&(a.Va.value="");break;case "d":a:{var jb,Na=g[0],na=g[1],Oa=g[2],Yi=g[3];if("?"==na){var kb="";for(jb in Cb)a.Ma[jb]&&(kb&&(kb+=","),kb+=jb);kb+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
kb.length&&a.j("dump extension commands:\n\t"+kb)}else if("state"==na){var Ig=Gi(a.C,!0);"console"==Oa?console.log(Ig):(a.Va&&(a.Va.value=""),a.j(Ig))}else if("symbols"==na)for(var Pd=0;Pd<a.I.length;Pd++){var Qd=a.I[Pd],lb;for(lb in Qd.ga)if("."!=lb.charAt(0)){var Jg=Qd.ga[lb].o;if(void 0!==Jg){var Kg=Qd.ga[lb].l;Kg&&(lb=Kg);a.j(J(a,Jg)+" "+lb)}}}else{if("d"==Na){for(jb in Cb)if(g[1]==jb){var Lg=a.Ma[jb];Lg?(g.shift(),g.shift(),Lg(g)):a.j("no dump registered for "+na);break a}na||(Na=a.Mb||"dw")}else a.Mb=
Na;if("dh"==Na){var Mg=na,Ng=Oa,Og="",Pg=0,ga=a.ba,oa=a.H;if(oa.length){var aa=+Mg||a.pb,Sb=+Ng||10;isNaN(aa)?aa=Sb:Og="more ";aa>oa.length&&(a.j("note: only "+oa.length+" available"),aa=oa.length);ga-=aa;0>ga&&(null==oa[oa.length-1].F?(aa=ga+aa,ga=0):ga+=oa.length);var Rd=[];"call"==Ng&&(Sb=1E5,Rd=["CALL"]);for(void 0!==Mg&&a.j(aa+" instructions earlier:");0<Sb&&ga!=a.ba;){var Qg=oa[ga++];if(null==Qg.F)break;var Tb=Y(Qg.F),Zi=aa--,Rg=xi(a,Tb,"history",Zi);(!Rd.length||0<=Rg.indexOf(Rd[0]))&&a.j(Rg);
Tb.fc&&(ga+=Tb.fc,Sb-=Tb.fc,aa-=Tb.fc);ga>=oa.length&&(ga=0);a.pb=aa;Pg++;Sb--}}Pg||(a.j("no "+Og+"history available"),a.pb=void 0)}else{var mb=ji(a,na);if(mb){var Ub=0,Sd=!1,Td="ds"==Na;Oa&&(Sd=!0,"l"==Oa.charAt(0)&&(Sd=!1,Oa=Oa.substr(1)||Yi),Ub=Wh(a,Oa)>>>0,65536<Ub&&(Ub=65536));for(var nb="dd"==Na?4:"db"==Na?1:2,Jc=(Sd?Ub-mb.F:nb*Ub)||128,Ud=Td?16:a.ca,$i=(Jc+Ud-1)/Ud|0||1,Pa="";$i--&&0<Jc;){for(var Qa="",Vd="",na=J(a,mb.F),Kc=Ud,Vb=0,Wb=0;0<Kc&&0<Jc;){var ob=1,Lc=1==nb?a.Lb(mb,ob):a.na(mb,ob=
2),Vb=Vb|Lc<<(Wb<<3),Wb=Wb+ob;Wb==nb&&(Td?(Qa&&(Qa+=","),Qa+="0x"+p(Vb,2*nb)):(Qa+=J(a,Vb,nb),Qa+=1==nb?9==Kc?"-":" ":" "),Vb=Wb=0);Kc-=ob;for(Jc-=ob;ob--;)var Wd=Lc&255,Vd=Vd+(32<=Wd&&128>Wd?String.fromCharCode(Wd):"."),Lc=Lc>>8}Pa&&(Pa+="\n");Pa=Td?Pa+(Qa+","):Pa+(na+" "+Qa+(0==Kc?" "+Vd:""))}Pa&&a.j(Pa);a.mb=mb}}}}break;case "e":if("else"==g[0])break;var pb,Xd,Yd,Zd,$d=g[0],ae=g[1];"eb"==$d?(pb=1,Xd=255,Yd=a.Lb,Zd=a.Eb):"e"==$d||"ew"==$d?(pb=2,Xd=65535,Yd=a.na,Zd=a.ib):ae=null;if(null==ae)a.j("edit memory commands:"),
a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var Mc=ji(a,ae);if(Mc)for(var Nc=2;Nc<g.length;Nc++){var Xb=Uh(a,g[Nc]);if(void 0===Xb){a.j("unrecognized value: "+g[Nc]);break}Xb&~Xd&&a.j("warning: "+p(Xb)+" exceeds "+pb+"-byte value");a.j("changing "+J(a,Mc.F)+(F(a,64)?"":" from "+J(a,Yd.call(a,Mc),pb))+" to "+J(a,Xb,pb));Zd.call(a,Mc,Xb,pb)}}break;case "g":a:{var Sg=g[1],aj=b;if(void 0!==Sg){var be=ji(a,Sg,!0);if(!be)break a;ni(a,be,aj);a.ob(a.f,
be,!0)}a.jb(!0,c)}break;case "h":a.A.W?(c||a.j("halting"),a.da()):wb(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var ce;var Yb=b.substr(2),Yb=ya(Yb);Uh(a,Yb)?(c||a.j("true: "+Yb),ce=!0):(c||a.j("false: "+Yb),ce=!1);ce||(d=!1);break}f=!0;break;case "k":var bj=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var de=0,ee=Y(),Zb=Y(a.b.u[6]);for(a.j("stack trace for "+J(a,Zb.F));10>de;){for(var Ra=null,cj=256;65536>
Zb.F>>>0;){ee.F=a.na(Zb,2);if(null==Zb.F||!cj--)break;if(!(ee.F&1)){for(var dj=a,Oc=ee,Tg=null,$b=Oc.F,Ug=$b,fe=1;6>=fe&&$b;fe++){if(2<fe){Oc.F=$b;var Pc=xi(dj,Oc);if(0<=Pc.indexOf("JSR")){var Vg=Pc.indexOf(" ");if($b+(Pc.indexOf(" ",Vg+1)-Vg-1)/2==Ug){Tg=Pc;break}}}$b-=2}Oc.F=Ug;if(Ra=Tg)break}}if(!Ra||null==Ra)break;var Wg=null;if("ks"==bj){var Xg=Ra.match(/[0-9A-F]+$/);Xg&&(Wg=Di(a,Xg[0]))}Ra=xa(Ra,50)+" ;"+(Wg||"stack="+J(a,Zb.F));a.j(Ra);de++}de||a.j("no return addresses found")}break;case "l":if("ln"==
g[0]){Di(a,g[1],!0);break}f=!0;break;case "m":a:{var pa,qa=null,G=g[1];"?"==G&&(G=void 0);if(void 0!==G){var Da=0;if("all"==G)Da=1878917119,G=null;else if("on"==G)qa=!0,G=null;else if("off"==G)qa=!1,G=null;else{"keys"==G&&(G="key");"kbd"==G&&(G="keyboard");for(pa in Cb)if(G==pa){Da=Cb[pa];qa=!!(a.ka&Da);break}if(!Da){a.j("unknown message category: "+G);break a}}if(Da)if("on"==g[2])a.ka|=Da,qa=!0;else if("off"==g[2]&&(a.ka&=~Da,qa=!1,1073741824==Da)){for(var ge=0;ge<a.ya.length;ge++)a.j(a.ya[ge]);
a.ya=[]}}var ej=0,ac="";for(pa in Cb)if(!G||G==pa){var fj=!!(a.ka&Cb[pa]);if(null===qa||qa==fj)ac&&(ac+=","),++ej%10||(ac+="\n\t"),"key"==pa&&(pa="keys"),ac+=pa}void 0===G&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==qa?qa?"messages on: ":"messages off: ":"message categories:\n\t")+(ac||"none"));ai(a)}break;case "p":if("print"==g[0]){Ei(a,b.substr(5));break}var gj="pr"==g[0]?1:0;if(a.S)a.j("step in progress");else{var Yg=Y(a.b.u[7]);a.Lb(Yg);a.S?(a.ob(a.f,
Yg,!0),a.jb()||(a.C&&a.C.ub(),a.S=0)):Fi(a,gj?"tr":"t")}break;case "r":if("reset"==b){a.C&&a.C.reset();break}qi(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var bc=+g[2];if(8==bc||10==bc||16==bc)a.ca=bc;else{a.j("invalid base: "+bc);break}}a.j("default base: "+a.ca);break;case "cs":var cc;void 0!==g[3]&&(cc=+g[3]);switch(g[2]){case "int":a.b.zb=cc;break;case "start":a.b.Qb=cc;break;case "stop":a.b.Ab=cc;break;default:a.j("unknown cs option");break a}void 0!==cc&&vd(a.b);a.j("checksums "+
(a.b.A.xb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(zd(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.qb.toFixed(2)+"Mhz")+" ("+a.b.gb+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),
a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":Fi(a,g[0],g[1]);break;case "u":ri(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Ci(a,b.substr(3))||(d=!1);break}if("ver"==g[0]){a.j("PDPjs version 1.30.3 ("+a.b.Xa+",RELEASE"+(Ab?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){Ei(a,b.substr(1));break}var he="commands:",ie;for(ie in ci)he+="\n"+xa(ie,9)+ci[ie];Ee(a)||(he+="\nnote: history disabled if no exec breakpoints");a.j(he);
break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(Zg){a.j("debugger error: "+(Zg.stack||Zg.message)),d=!1}return d}function xd(a,b,c){b=Sh(a,b,c);for(var d in b)if(!wi(a,b[+d]))return!1;return!0}$a(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Zh(d);B(d,c)}});
function Hi(a,b,c){t.call(this,"Computer",a,Hi,67108864);this.A.ha=!1;Ii(this,b);this.L=td(this,"autoPower",a);this.C=0;this.X=a.busWidth||a.buswidth;this.f=Ji;this.I=null;this.D=this.R=!1;this.ba=td(this,"url")||"";(Math.random()+.1).toString(36);this.g=Ki(this);if(this.b=ub("CPU",this.id)){this.i=ub("Debugger",this.id);this.v=new nc({id:this.Ua+".bus",busWidth:this.X},this.b,this.i);var d,e=sb(this.id);if((this.w=ub("Panel",this.id))&&this.w.Va)for(b=0;b<e.length;b++)d=e[b],d.P=this.w.P,d.j=this.w.j,
d.Va=this.w.Va;this.j("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ia&&d.Ia(this,this.v,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=td(this,"state")||(f=!0,a.state))b=this.M=a,f||(this.D=!0,this.f=Ji),this.f&&(this.K=
new N(this,"1.30.3"),Li(this.K)?b=null:delete this.K);!b&&this.f&&(b=Mi(this))&&(this.D=!0);if(b){var g=this;Ea(b,null,!0,function(a,b,c){c?(g.H=null,g.D=!1,g.P("Unable to load machine state from server (error "+c+(b?": "+ya(b):"")+")")):(g.I=b,g.R=!0);H(g)})}else H(this);this.G.power||(this.L=!0);!c&&this.L&&Ni(this,this.Rb)}else q("Unable to find CPU component")}z(Hi);var Ji=0;
function Ii(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.S=b}function td(a,b,c){var d=b.toLowerCase(),d=eb[b]||eb[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Ni(a,b,c){for(var d=sb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!xb(f)){xb(f,function(){Ni(a,b,c)});return}}b.call(a,c)}
function Oi(a,b){var c=new N(a,"1.30.3","validate");if(Li(c)&&Pi(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())}}k=Hi.prototype;
k.Rb=function(a){void 0===a&&(a=this.f||(this.I?1:Ji));if(!this.C){this.C++;var b=!1,c=!1;this.O=!1;var d=this.K||new N(this,"1.30.3");if(-1==a)b=!0;else if(a>Ji){if(Li(d,this.I)){this.B=new N(this,"1.30.3","failsafe");Li(this.B)&&(Qi(this,d),a=2,Ri(this.B));this.B.set("timestamp",Ca());Si(this.B);var e=this.f&&!this.D;if(1==a||Ha("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Pi(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Li(d,g):("error"==
f&&"no machine state"!=g?(this.P("Error: "+g),"unable to verify user"==g&&(Ma("user",""),this.g=null)):this.j(f+": "+g),Ri(d),Li(d)?(c=Pi(d),e=!0):c=!1))}e&&Oi(this,c?d:null)}else 2==a&&d.clear()}else Oi(this);delete this.I;delete this.K}e=sb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Ti(this,g,d,b,c));b=[d,a,c];-1!=a?Ni(this,this.tc,b):this.tc(b)}};
function Ti(a,b,c,d,e){if(!b.A.ha){b.A.ha=!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.M&&!a.R?(c.clear(),a.f=Ji,window&&window.location.reload()):a.O=!0,b.Ka(null),e=!1)}if(!d&&b.Bc)for(a=b.Bc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
k.tc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ca=!0;this.A.ha=!0;var d=this.G.power;d&&(d.textContent="Shutdown");this.b&&(Ti(this,this.b,b,c,a),this.pa(),this.b.vb());this.O&&(Qi(this,b),b.clear());!c&&this.B&&(this.B.clear(),delete this.B);this.C=0};
function Qi(a,b){if(Ha("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.3"};d.url=a.ba;d.user=c;d.type="bug";d.data=b;Ea("http://www.pcjs.org/api/v1/report",d,!0)}}
function Gi(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new N(a,"1.30.3"),g=new N(a,"1.30.3","validate"),h=Ca();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Ja&&(c&&a.b.da(),d=a.b.Ja(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.A.ha=!1,!1===d&&(e=null)));for(var h=sb(a.id),l=0;l<h.length;l++){var m=h[l];m.A.ha&&(m.Ja&&(d=m.Ja(b,c),"object"===typeof d&&f.set(m.id,
d)),c&&(m.A.ha=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&Ui(a,a.g,f.toString()),Si(g)&&Si(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.A.ha=!1,b=a.G.power)&&(b.textContent="Power");a.C=0;return e}
k.reset=function(){this.v&&this.v.reset&&(E(this,"Resetting "+this.v.type),this.v.reset());this.b&&this.b.reset&&(E(this,"Resetting "+this.b.type),this.b.reset());for(var a=sb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.v&&c!==this.b&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}this.pa(-1)};k.start=function(a,b){for(var c=sb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.pa(-1)};
k.stop=function(a,b){for(var c=sb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.pa(-1)};
k.pa=function(a){if(this.b){var b=this.b,c=a||0,d=b.G.speed;d&&(0>=c||30<=(b.wb+=c))&&(d.textContent=b.A.W?b.ma.toFixed(2)+"Mhz":"Stopped",b.wb=0)}if(this.w&&(b=this.w,a=a||0,b.D)){c=b.b.A.W;d=!!(b.b.J&4);if(0>=a||60<=(b.B+=a)){for(var e=0;e<b.b.u.length;e++)Qb(b,"R"+e,b.b.u[e]);e=Zc(b.b);Qb(b,"PS",e);Qb(b,"NF",e&8?1:0,1);Qb(b,"ZF",e&4?1:0,1);Qb(b,"VF",e&2?1:0,1);Qb(b,"CF",e&1?1:0,1);b.B=0}ic(b,0<a&&c&&!d?b.b.Nb:b.sa);hc(b,b.rb);a=b.b;a=a.L?a.Ta&16?1:2:4;kc(b,"B22",a&1);kc(b,"B18",a&2);kc(b,"B16",
a&4)}};
k.sa=function(a,b,c){var d=this;switch(b){case "power":return this.G[b]=c,c.onclick=function(){d.C||(d.w.ha?Ai(d,!1,!0):Hi(d,d.Nb))},!0;case "reset":return this.G[b]=c,c.onclick=function(){if(d.w.ha&&!d.C)if(d.f&&!d.H){var a=Ga("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Ai(d,a,!0);!a&&d.M?window&&window.location.reload():(a||(d.rc=!0),d.Nb(Di),d.rc=!1)}else d.reset(),d.b&&d.b.sb()},!0;case "save":if(ta(Fa(),"pcjs.org"))c.parentNode.removeChild(c);else return this.G[b]=
c,c.onclick=function(){var a=Ei(d,!0);if(a){var b=!!(d.f&&!d.H||d.M),c=Ai(d,b);b?Oi(d,a,c):d.P("Resume disabled, machine state not saved")}},!0}return!1};
function Ei(a,b){var c=a.g;c||((c=Ja("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=Pi(a,c))||a.P("The user ID is invalid.")):b&&a.P("Browser local storage is not available"));return c}
function Pi(a,b){a.g=null;b=Da(Fa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(La("user",b.data),a.g=b.data)}catch(d){q(d.message+" ("+c+")")}return a.g}function Gi(a){var b=null;a.g&&(b=Fa()+"/api/v1/user?req=load&user="+a.g+"&state="+Qi(a,"1.30.3"));return b}
function Oi(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Qi(a,"1.30.3");d.data=c;b=Da(Fa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.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),La("user",""),a.g=null)}}
function gh(a){var b;a=rb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.rb=function(a){if(this.Ta){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Ta.focus();!a&&window&&window.scrollTo(b,c)}};Za(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new Bi(g,d,!0);B(g,f);g.L&&Hi(g,g.Nb)}});
Ua.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=tb("Computer",c.id))&&c.ca&&!c.w.ha&&c.Nb(-1)}});Ua.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=tb("Computer",c.id))&&c.w.ha&&Ai(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=Qi(a,b,c);this.i=a.i;Li(this,a.Yc)}function Qi(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){Li(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 Li(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Mi(a){var b=!0;if(Ia()){var c=JSON.stringify(a[a.id]);La(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Ji(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function Fi(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ia()&&(b=Ja(a.key))?(a[a.id]=b,a.b=!0):!1}var Ri=0;
function bj(a,b,c,d,e,f){e("Loading "+a+"...");Da(a,null,!0,function(g,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),f(h,null)):cj(h,a,b,c,d,e,f)})}
function cj(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(qb(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(n){f=null,a=n.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?dj(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
function dj(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Da(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(g=g.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);dj(a,b,c)}})}else c(a,null)}
function ej(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=va(a))}function f(a){e("Error: "+a);l&&(--Ri||ab(!0));l=!1}var g,h,l=!0;Ri++;pb[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=m:v.appendChild(document.createTextNode(m));n.appendChild(v)}c||
(c="/versions/pdpjs/1.30.3/components.xsl");m=function(d,h){h?bj(c,null,null,!1,e,function(d,l){l?(qb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--Ri||ab(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--Ri||ab(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?bj(b,a,d,!0,e,m):cj(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(r){f(r.message)}return l}window.embedPDP11=function(a,b,c,d){ab(!1);return ej(a,b,c,d)};window.enableEvents=ab;window.sendEvent=bb;})();//# sourceMappingURL=/tmp/pdpjs/1.30.3/pdp11-dbg.map
k.ua=function(a,b,c){var d=this;switch(b){case "power":return this.G[b]=c,c.onclick=function(){d.C||(d.A.ha?Gi(d,!1,!0):Ni(d,d.Rb))},!0;case "reset":return this.G[b]=c,c.onclick=function(){if(d.A.ha&&!d.C)if(d.f&&!d.H){var a=Ha("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Gi(d,a,!0);!a&&d.M?window&&window.location.reload():(a||(d.uc=!0),d.Rb(Ji),d.uc=!1)}else d.reset(),d.b&&d.b.vb()},!0;case "save":if(ua(Ga(),"pcjs.org"))c.parentNode.removeChild(c);else return this.G[b]=
c,c.onclick=function(){var a=Ki(d,!0);if(a){var b=!!(d.f&&!d.H||d.M),c=Gi(d,b);b?Ui(d,a,c):d.P("Resume disabled, machine state not saved")}},!0}return!1};
function Ki(a,b){var c=a.g;c||((c=Ka("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Vi(a,c))||a.P("The user ID is invalid.")):b&&a.P("Browser local storage is not available"));return c}
function Vi(a,b){a.g=null;b=Ea(Ga()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ma("user",b.data),a.g=b.data)}catch(d){q(d.message+" ("+c+")")}return a.g}function Mi(a){var b=null;a.g&&(b=Ga()+"/api/v1/user?req=load&user="+a.g+"&state="+Wi(a,"1.30.3"));return b}
function Ui(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Wi(a,"1.30.3");d.data=c;b=Ea(Ga()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.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),Ma("user",""),a.g=null)}}
function mh(a){var b;a=sb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.ub=function(a){if(this.Va){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Va.focus();!a&&window&&window.scrollTo(b,c)}};$a(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new Hi(g,d,!0);B(g,f);g.L&&Ni(g,g.Rb)}});
Va.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=ub("Computer",c.id))&&c.ca&&!c.A.ha&&c.Rb(-1)}});Va.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=ub("Computer",c.id))&&c.A.ha&&Gi(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=Wi(a,b,c);this.i=a.i;Ri(this,a.ad)}function Wi(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){Ri(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 Ri(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Si(a){var b=!0;if(Ja()){var c=JSON.stringify(a[a.id]);Ma(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Pi(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function Li(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ja()&&(b=Ka(a.key))?(a[a.id]=b,a.b=!0):!1}var Xi=0;
function hj(a,b,c,d,e,f){e("Loading "+a+"...");Ea(a,null,!0,function(g,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),f(h,null)):ij(h,a,b,c,d,e,f)})}
function ij(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(rb(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(n){f=null,a=n.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?jj(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
function jj(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Ea(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(g=g.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);jj(a,b,c)}})}else c(a,null)}
function kj(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=wa(a))}function f(a){e("Error: "+a);l&&(--Xi||bb(!0));l=!1}var g,h,l=!0;Xi++;qb[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=m:v.appendChild(document.createTextNode(m));n.appendChild(v)}c||
(c="/versions/pdpjs/1.30.3/components.xsl");m=function(d,h){h?hj(c,null,null,!1,e,function(d,l){l?(rb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--Xi||bb(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--Xi||bb(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?hj(b,a,d,!0,e,m):ij(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(r){f(r.message)}return l}window.embedPDP11=function(a,b,c,d){bb(!1);return kj(a,b,c,d)};window.enableEvents=bb;window.sendEvent=cb;})();//# sourceMappingURL=/tmp/pdpjs/1.30.3/pdp11-dbg.map

View file

@ -45,86 +45,86 @@ d.K[f++]=e[c]>>8&255,d.K[f++]=e[c]>>16&255,d.K[f++]=e[c]>>24&255;else d.K=g;d.W=
function v(){return"http://"+(window?window.location.host:"www.pcjs.org")}function t(a){window&&window.alert(a)}function ua(a){var b=!1;window&&(b=window.confirm(a));return b}var va=null;function wa(){if(null==va){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}va=a}return va}
function za(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Aa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ba(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var x={init:[],show:[],exit:[]},Ca=!1,Da=!1,Ea=!0;
function Fa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ga(a){x.init.push(a)}function Ha(a){if(Ea)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ia(a){!Ea&&a?(Ea=!0,Ca&&Ja("init"),Da&&Ja("show")):Ea=a}function Ja(a){x[a]&&Ha(x[a])}Fa("onload",function(){Ca=!0;Ha(x.init)});Fa("onpageshow",function(){Da=!0;Ha(x.show)});
Fa(Ba("Opera")||Ba("iOS")?"onunload":"onbeforeunload",function(){Ha(x.exit)});function y(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Sb=b.comment;this.sd=b;b=this.id.indexOf(".");0>b?this.za=this.id:(this.qa=this.id.substr(0,b),this.za=this.id.substr(b+1));this[a]=c;this.j={ready:!1,Da:!1,sb:!1,N:!1,error:!1};this.jb=null;this.j.error=!1;this.o={};this.F=null;this.pd=d||0;z.push(this)}var Ka=void 0,La={};
Fa(Ba("Opera")||Ba("iOS")?"onunload":"onbeforeunload",function(){Ha(x.exit)});function y(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Tb=b.comment;this.td=b;b=this.id.indexOf(".");0>b?this.za=this.id:(this.qa=this.id.substr(0,b),this.za=this.id.substr(b+1));this[a]=c;this.j={ready:!1,Da:!1,tb:!1,N:!1,error:!1};this.kb=null;this.j.error=!1;this.o={};this.F=null;this.qd=d||0;z.push(this)}var Ka=void 0,La={};
if(window){Ka||(Ka=window.location.search.substr(1));for(var Ma,Na=/\+/g,Oa=/([^&=]+)=?([^&]*)/g;Ma=Oa.exec(Ka);)La[decodeURIComponent(Ma[1].replace(Na," "))]=decodeURIComponent(Ma[2].replace(Na," "))}function Pa(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function A(a,b){b||(b=y);a.prototype=Pa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Qa=window.PCjs.Machines||(window.PCjs.Machines={}),z=window.PCjs.Components||(window.PCjs.Components=[])}else Qa={},z=[];function Ra(a,b,c){Qa[a]&&b&&(Qa[a][b]=c)}function B(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<z.length;b++){var d=z[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function Sa(a){if(void 0!==a){var b;for(b=0;b<z.length;b++)if(z[b].id===a)return z[b]}return null}function Ta(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<z.length;d++)if(c)c==z[d]&&(c=null);else if(!(a!=z[d].type||b&&z[d].id.indexOf(b)))return z[d]}return null}function C(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
function D(a,b){b=E(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var k=g.split(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pdp11-binding":(g=C(f))&&g.binding&&a.$(g.type,g.binding,f,g.value),l=k.length}}}}
function E(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
y.prototype={constructor:y,parent:null,toString:function(){return this.name?this.name:this.id||this.type},$:function(a,b,c){switch(b){case "clear":return this.o[b]||(this.o[b]=c,c.onclick=function(a){return function(){a.o.print&&(a.o.print.value="")}}(this)),!0;case "print":return this.o[b]||(this.Wa=this.o[b]=c,c.value="",this.T=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.G=function(a){this.T(a,this.za)}),!0;default:return!1}},log:function(){},T:function(){},status:function(a){this.T(this.za+": "+a)},G:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},la:function(){return this.j.N=!0},ka:function(a,b){b&&(this.j.N=!1);return!0}};function Ua(a,b){a.j.sb?(a.j.Da=!1,a.j.sb=!1):a.j.error?a.T(a.toString()+" error"):a.j.Da=b}function F(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.jb,a.jb=null,b&&b()))}
function Va(a,b){b&&(a.j.ready?b():a.jb=b);return a.j.ready}function Wa(a,b){a.j.error=!0;a.G(b)}Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
this.G=function(a){this.T(a,this.za)}),!0;default:return!1}},log:function(){},T:function(){},status:function(a){this.T(this.za+": "+a)},G:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},la:function(){return this.j.N=!0},ka:function(a,b){b&&(this.j.N=!1);return!0}};function Ua(a,b){a.j.tb?(a.j.Da=!1,a.j.tb=!1):a.j.error?a.T(a.toString()+" error"):a.j.Da=b}function F(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.kb,a.kb=null,b&&b()))}
function Va(a,b){b&&(a.j.ready?b():a.kb=b);return a.j.ready}function Wa(a,b){a.j.error=!0;a.G(b)}Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});var Xa="undefined"!==typeof ArrayBuffer;
function Ya(a){y.call(this,"Panel",a,Ya,1024);this.ea=this.i=this.c=this.m=this.s=this.v=0;this.A=this.B=this.w=!1;this.D=Za;this.g={};this.b={START:[1,1,!0,!1,this.tc],STEP:[1,1,!1,!1,this.uc],ENABLE:[1,1,!1,!1,this.pc],CONT:[1,1,!0,!1,this.nc],DEP:[0,0,!0,!1,this.oc],EXAM:[1,1,!0,!1,this.qc],LOAD:[1,1,!0,!1,this.sc],TEST:[0,0,!0,!1,this.rc]};for(a=0;22>a;a++)this.b["S"+a]=[0,0,!1,!1,this.vc,a]}A(Ya);var Za=7;function $a(a,b){return a.b[b]&&a.b[b][1]}h=Ya.prototype;h.reset=function(){this.stop()};
function Ya(a){y.call(this,"Panel",a,Ya,1024);this.ea=this.i=this.c=this.m=this.s=this.v=0;this.A=this.B=this.w=!1;this.D=Za;this.g={};this.b={START:[1,1,!0,!1,this.uc],STEP:[1,1,!1,!1,this.vc],ENABLE:[1,1,!1,!1,this.qc],CONT:[1,1,!0,!1,this.oc],DEP:[0,0,!0,!1,this.pc],EXAM:[1,1,!0,!1,this.rc],LOAD:[1,1,!0,!1,this.tc],TEST:[0,0,!0,!1,this.sc]};for(a=0;22>a;a++)this.b["S"+a]=[0,0,!1,!1,this.wc,a]}A(Ya);var Za=7;function $a(a,b){return a.b[b]&&a.b[b][1]}h=Ya.prototype;h.reset=function(){this.stop()};
h.$=function(a,b,c,d){if(this.l&&this.l.$(a,b,c,d)||this.a&&this.a.$(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.o[b]=c,this.v++,!0;default:return"led"==a||"rled"==a?(this.o[b]=c,this.g[b]=d?1:0,this.v++,!0):"switch"==a?(void 0===this.b[b]&&(this.b[b]=[d?1:0,d?1:0]),this.o[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,b){return function(){ab(a,b)}}(this,
b),a.onmouseup=a.onmouseout=function(a,b){return function(){bb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){ab(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){bb(a,b)}}(this,b),!0):this.parent.$.call(this,a,b,c,d)}};h.ja=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.F=d;cb(b,this,db);eb(b,this.reset.bind(this));fb(this);gb(this)};h.la=function(a,b){b||(hb(),this.reset());return!0};h.ka=function(){return!0};
function ib(a,b,c){if(a=a.o[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function fb(a,b){for(var c in a.g)ib(a,c,null!=b?b:a.g[c])}function jb(a,b,c){if(a=a.o[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function gb(a){for(var b in a.b)jb(a,b,a.b[b][1])}function kb(a,b,c,d){a.o[b]&&(void 0===c&&(Wa(a,"Value for "+b+" is invalid"),G(a.a)),c=8==(a.F&&a.F.h||8)?ka(c,d):m(c,d),a.o[b].textContent!=c&&(a.o[b].textContent=c))}
function ab(a,b){var c=a.b[b];jb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.A="DEP"==b,a.B="EXAM"==b)}function bb(a,b){var c=a.b[b];c[2]&&c[3]&&(jb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.tc=function(a){a||this.a.j.P||(a=this.a,a.h.reset(),lb(a),$a(this,"ENABLE")&&mb(this.a))};h.uc=function(){};h.pc=function(a){a||G(this.a)};
h.nc=function(a){if(!a&&!this.a.j.P)if($a(this,"ENABLE"))mb(this.a);else{a=this.F;var b;if(b=a)a.j.Da&&(a.j.sb=!0),b=!a.j.Da;if(b)Ua(a,!0),a.pb(0,null),Ua(a,!1);else try{var c=this.a.pb(1);0<c&&(nb(this.a,c),ob(this.a,c,!0),pb(this.a,c))}catch(d){"number"!=typeof d&&Wa(this.a,d.stack||d.message)}this.stop();this.l&&this.l.ya()}};h.oc=function(a){a&&!this.a.j.P&&(this.A&&qb(this),a=rb(this,this.c),this.D==Za?this.h.ob(this.ea,a):this.a.ob(this.ea,a))};
h.qc=function(a){a||this.a.j.P||(this.B&&qb(this),a=this.D==Za?this.h.lb(this.ea):this.a.lb(this.ea),rb(this,a))};h.sc=function(a){a||this.a.j.P||sb(this,this.c)};h.rc=function(a){if(a)this.w=!0,fb(this,!0);else if(this.w=!1,fb(this),void 0!==this.o.S0){for(a=this.c=0;22>a;a++)this.b["S"+a][1]=0&1<<a?1:0;gb(this)}};h.vc=function(a,b){this.c=a?this.c|1<<b:this.c&~(1<<b)};
function qb(a){var b=1145>a.a.Ea?8:16,c=65472<=a.ea&&a.ea<65472+b,b=c?1:2,c=c?15:a.h.oa;$a(a,"STEP")||(b=-b);sb(a,a.ea&~c|a.ea+b&c)}function sb(a,b){a.ea=b&a.h.oa;b=a.ea;for(var c=0;22>c;c++)tb(a,"A"+c,b&1<<c)}function rb(a,b){a.i=b&65535;b=a.i;for(var c=0;16>c;c++)tb(a,"D"+c,b&1<<c);return a.i}function tb(a,b,c){a.g[b]=c;a.w||ib(a,b,c)}h.stop=function(){sb(this,this.a.f[7])};h.setData=function(a,b){b?this.m=a:this.i=a};h.wc=function(a){return(a?this.c:this.m)&65535};h.ud=function(a){this.m=a};
var ub={},db=(ub[65400]=[null,null,Ya.prototype.wc,Ya.prototype.ud,"CNSW"],ub);function hb(){for(var a=!1,b=E(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=C(d),f=Sa(e.id);f||(a=!0,f=new Ya(e));D(f,d);a&&F(f)}}Ga(hb);
function vb(a,b,c){y.call(this,"Bus",a,vb,64);this.a=b;this.F=c;this.I=a.busWidth||16;this.s=0;this.v=[];this.i=null;this.B=1<<this.I;this.oa=this.B-1;this.b=H;this.c=Math.log2(this.b);this.D=this.b>>2;this.l=this.b-1;this.A=this.B/this.b|0;this.Aa=[];this.g=0;this.m=!1;this.tb=0;this.w=[];this.fc=[wb,xb,yb,zb];a=new I(this);Ab(a,this.F);this.h=Array(this.A);for(b=0;b<this.A;b++)this.h[b]=a;F(this)}A(vb);var H=8192,Bb=H-1;
function ab(a,b){var c=a.b[b];jb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.A="DEP"==b,a.B="EXAM"==b)}function bb(a,b){var c=a.b[b];c[2]&&c[3]&&(jb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.uc=function(a){a||this.a.j.P||(a=this.a,a.h.reset(),lb(a),$a(this,"ENABLE")&&mb(this.a))};h.vc=function(){};h.qc=function(a){a||G(this.a)};
h.oc=function(a){if(!a&&!this.a.j.P)if($a(this,"ENABLE"))mb(this.a);else{a=this.F;var b;if(b=a)a.j.Da&&(a.j.tb=!0),b=!a.j.Da;if(b)Ua(a,!0),a.qb(0,null),Ua(a,!1);else try{var c=this.a.qb(1);0<c&&(nb(this.a,c),ob(this.a,c,!0),pb(this.a,c))}catch(d){"number"!=typeof d&&Wa(this.a,d.stack||d.message)}this.stop();this.l&&this.l.ya()}};h.pc=function(a){a&&!this.a.j.P&&(this.A&&qb(this),a=rb(this,this.c),this.D==Za?this.h.pb(this.ea,a):this.a.pb(this.ea,a))};
h.rc=function(a){a||this.a.j.P||(this.B&&qb(this),a=this.D==Za?this.h.mb(this.ea):this.a.mb(this.ea),rb(this,a))};h.tc=function(a){a||this.a.j.P||sb(this,this.c)};h.sc=function(a){if(a)this.w=!0,fb(this,!0);else if(this.w=!1,fb(this),void 0!==this.o.S0){for(a=this.c=0;22>a;a++)this.b["S"+a][1]=0&1<<a?1:0;gb(this)}};h.wc=function(a,b){this.c=a?this.c|1<<b:this.c&~(1<<b)};
function qb(a){var b=1145>a.a.Ea?8:16,c=65472<=a.ea&&a.ea<65472+b,b=c?1:2,c=c?15:a.h.oa;$a(a,"STEP")||(b=-b);sb(a,a.ea&~c|a.ea+b&c)}function sb(a,b){a.ea=b&a.h.oa;b=a.ea;for(var c=0;22>c;c++)tb(a,"A"+c,b&1<<c)}function rb(a,b){a.i=b&65535;b=a.i;for(var c=0;16>c;c++)tb(a,"D"+c,b&1<<c);return a.i}function tb(a,b,c){a.g[b]=c;a.w||ib(a,b,c)}h.stop=function(){sb(this,this.a.f[7])};h.setData=function(a,b){b?this.m=a:this.i=a};h.xc=function(a){return(a?this.c:this.m)&65535};h.vd=function(a){this.m=a};
var ub={},db=(ub[65400]=[null,null,Ya.prototype.xc,Ya.prototype.vd,"CNSW"],ub);function hb(){for(var a=!1,b=E(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=C(d),f=Sa(e.id);f||(a=!0,f=new Ya(e));D(f,d);a&&F(f)}}Ga(hb);
function vb(a,b,c){y.call(this,"Bus",a,vb,64);this.a=b;this.F=c;this.I=a.busWidth||16;this.s=0;this.v=[];this.i=null;this.B=1<<this.I;this.oa=this.B-1;this.b=H;this.c=Math.log2(this.b);this.D=this.b>>2;this.l=this.b-1;this.A=this.B/this.b|0;this.Aa=[];this.g=0;this.m=!1;this.ub=0;this.w=[];this.gc=[wb,xb,yb,zb];a=new I(this);Ab(a,this.F);this.h=Array(this.A);for(b=0;b<this.A;b++)this.h[b]=a;F(this)}A(vb);var H=8192,Bb=H-1;
function wb(a,b){var c=-1,d=this.controller,e=d.Aa[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.Aa[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return c;J(d,b,16);return 255}
function xb(a,b,c){var d=!1,e=this.controller,f=e.Aa[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Aa[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d||J(e,c,16)}function yb(a,b){var c=-1,d=this.controller;a=d.Aa[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return c;J(d,b,16);return 65535}
function zb(a,b,c){var d=!1,e=this.controller;a=e.Aa[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d||J(e,c,16)}function Cb(a,b){if(b!=a.s){var c;a.s&&(c=(1<<a.s)-H,Db(a,c,H,a.v),a.s=0);b&&(a.s=b,c=1<<b,a.oa=c-1,c-=H,a.v=Eb(a,c,H),a.i?Db(a,c,H,a.i):(Fb(a,c,H,Gb,a),a.i=Eb(a,c,H)))}}h=vb.prototype;h.reset=function(){for(var a=0;a<this.w.length;a++)this.w[a]();Cb(this,16)};h.la=function(a,b){b||this.reset();return!0};
function Fb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.c;0<g&&k<a.h.length;){var l=a.h[k],n=k*a.b,p=a.b-(f-n);p>g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.Ka)return l.qb+=l.Ka-f,l.Ka=f,!0;if(f>=l.Ka+l.qb){p=l.size-(f-n);p>g&&(p=g);l.qb=f-l.Ka+p;f=n+a.b;g-=p;k++;continue}}return Hb(1,f,g)}f=new I(a,f,p,a.b,d,e);Ab(f,a.F,l);a.h[k++]=f;f=n+a.b;g-=p}return 0>=g?(d==Ib&&(a.tb+=c),a.status((c>>10)+"Kb "+Jb[d]+" at "+ka(b)),!0):Hb(2,b,c)}
function Eb(a,b,c){var d=[];for(b>>>=a.c;0<c&&b<a.h.length;)d.push(a.h[b++]),c-=a.b;return d}function Db(a,b,c,d){var e=0;for(b>>>=a.c;0<c&&b<a.h.length;){var f=d[e++];if(!f)break;a.h[b++]=f;c-=a.b}}function Kb(a,b){3932160<=b&&(b=Lb(a.a,b));return a.h[(b&a.oa)>>>a.c].Eb(b&a.l,b)}function Mb(a,b){3932160<=b&&(b=Lb(a.a,b));return a.h[(b&a.oa)>>>a.c].V(b&a.l,b)}h.lb=function(a){3932160<=a&&(a=Lb(this.a,a));var b=a&this.l,c=(a&this.oa)>>>this.c;this.m=!1;this.g++;a=this.h[c].Wb(b,a);this.g--;return a};
function Nb(a,b,c){3932160<=b&&(b=Lb(a.a,b));a.h[(b&a.oa)>>>a.c].Ib(b&a.l,c&255,b)}h.Za=function(a,b){3932160<=a&&(a=Lb(this.a,a));this.m=!1;this.g++;this.h[(a&this.oa)>>>this.c].Jb(a&this.l,b&255,a);this.g--};function Ob(a,b,c){3932160<=b&&(b=Lb(a.a,b));a.h[(b&a.oa)>>>a.c].rb(b&a.l,c&65535,b)}h.ob=function(a,b){3932160<=a&&(a=Lb(this.a,a));var c=a&this.l,d=(a&this.oa)>>>this.c;this.m=!1;this.g++;this.h[d].dc(c,b&65535,a);this.g--};
function Pb(a){for(var b=0,c=[],d=0;d<a.A;d++){var e=a.h[d];if(e.wa||e.jc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,k=0,l=[];g<e.length;){for(var n=e[g],p=g+1;p<e.length&&e[p]===n;)p++;l[k++]=p-g;l[k++]=n;g=p}l.length<e.length&&(e=l)}c[f]=e}}return c}function Qb(a,b,c,d,e,f,g,k,l){for(;b<=c;b+=2){var n=b&Bb;if(void 0!==a.Aa[n])return t("I/O address already registered: "+m(b,8,!0)),!1;a.Aa[n]=[d,e,f,g,l||"unknown",k,!1]}return!0}
function cb(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[6]&&f[6]>a.a.Ea)){var g=f[0]?f[0].bind(b):null,k=f[1]?f[1].bind(b):null,l=f[2]?f[2].bind(b):null,n=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&l&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(l)),!k&&n&&(k=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));for(var p=f[4],u=f[5]||1,w=0;w<u;w++,e+=2)if(p&&1<u&&(p=f[4]+w),!Qb(a,e,e,g,k,l,n,b.pd||64,p||b.za))return!1}}return!0}function eb(a,b){a.w.push(b)}
function J(a,b,c){a.m=!0;a.g||(c&&(a.a.fa|=c),K(a.a,4,0,b))}function Rb(a){var b=a.m;a.m=!1;return b}function Hb(a,b,c){t("Memory block error ("+a+": "+m(b)+","+m(c)+")");return!1}function L(a){y.call(this,"Device",a,L,512);this.b={L:0,Hb:-1}}A(L);h=L.prototype;h.ja=function(a,b,c,d){this.h=b;this.l=a;this.a=c;this.F=d;var e=this;this.b.Hb=Sb(c,function(){e.b.Xa|=128;e.b.Xa&64&&Tb(e.a,e.b.qd);e.l&&e.l.ya(1);Ub(e.a,e.b.Hb,1E3/60)});this.b.qd=Vb(64,6);cb(b,this,Wb);eb(b,this.reset.bind(this));F(this)};
h.reset=function(){this.b.Xa=128;Ub(this.a,this.b.Hb,1E3/60,!0)};h.Ec=function(){return this.b.Xa};h.Cd=function(a){this.b.Xa=a&192};h.Gc=function(){var a=this.a;return a.Z&-3199|a.ab<<5|a.bb<<1};h.Ed=function(a){Xb(this.a,a&-129|this.a.Z&128)};h.Hc=function(){var a=this.a;a.Z&57344||(a.Cb=a.A>>16&65535);a=a.Cb;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Ic=function(){var a=this.a;a.Z&57344||(a.Db=a.A&65535);return a.Db};h.Jc=function(){return this.a.Ba};
h.Fd=function(a){var b=this.a;1170>b.Ea&&(a&=-49);b.Ba!=a&&(b.Ba=a,b.Ra=a&16?4194303:262143,Yb(b))};h.kd=function(a){a=a>>1&63;var b=this.a.$a[a>>1];return a&1?b>>16:b&65535};h.fe=function(a,b){b=b>>1&63;var c=b>>1;this.a.$a[c]=b&1?this.a.$a[c]&65535|(a&63)<<16:this.a.$a[c]&-65536|a&65534};h.cd=function(a){return this.a.H[1][a>>1&7]};h.Zd=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.ad=function(a){return this.a.H[1][(a>>1&7)+8]};h.Xd=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};
h.bd=function(a){return this.a.X[1][a>>1&7]};h.Yd=function(a,b){b=b>>1&7;this.a.X[1][b]=a;this.a.H[1][b]&=65295};h.$c=function(a){return this.a.X[1][(a>>1&7)+8]};h.Wd=function(a,b){b=(b>>1&7)+8;this.a.X[1][b]=a;this.a.H[1][b]&=65295};h.Dc=function(a){return this.a.H[0][a>>1&7]};h.Bd=function(a,b){this.a.H[0][b>>1&7]=a&65295};h.Bc=function(a){return this.a.H[0][(a>>1&7)+8]};h.zd=function(a,b){this.a.H[0][(b>>1&7)+8]=a&65295};h.Cc=function(a){return this.a.X[0][a>>1&7]};
h.Ad=function(a,b){b=b>>1&7;this.a.X[0][b]=a;this.a.H[0][b]&=65295};h.Ac=function(a){return this.a.X[0][(a>>1&7)+8]};h.yd=function(a,b){b=(b>>1&7)+8;this.a.X[0][b]=a;this.a.H[0][b]&=65295};h.jd=function(a){return this.a.H[3][a>>1&7]};h.ee=function(a,b){this.a.H[3][b>>1&7]=a&65295};h.gd=function(a){return this.a.H[3][(a>>1&7)+8]};h.ce=function(a,b){this.a.H[3][(b>>1&7)+8]=a&65295};h.hd=function(a){return this.a.X[3][a>>1&7]};h.de=function(a,b){b=b>>1&7;this.a.X[3][b]=a;this.a.H[3][b]&=65295};
h.fd=function(a){return this.a.X[3][(a>>1&7)+8]};h.be=function(a,b){b=(b>>1&7)+8;this.a.X[3][b]=a;this.a.H[3][b]&=65295};h.Ma=function(a){a&=7;return this.a.C&2048?this.a.Fa[a]:this.a.f[a]};h.Oa=function(a,b){b&=7;this.a.C&2048?this.a.Fa[b]=a:this.a.f[b]=a};h.Oc=function(){return this.a.C&49152?this.a.pa[0]:this.a.f[6]};h.Kd=function(a){this.a.C&49152?this.a.pa[0]=a:this.a.f[6]=a};h.Rc=function(){return this.a.f[7]};h.Nd=function(a){this.a.f[7]=a};
h.Na=function(a){a&=7;return this.a.C&2048?this.a.f[a]:this.a.Fa[a]};h.Pa=function(a,b){b&=7;this.a.C&2048?this.a.f[b]=a:this.a.Fa[b]=a};h.Pc=function(){return 1==(this.a.C&49152)>>14?this.a.f[6]:this.a.pa[1]};h.Ld=function(a){1==(this.a.C&49152)>>14?this.a.f[6]=a:this.a.pa[1]=a};h.Qc=function(){return 3==(this.a.C&49152)>>14?this.a.f[6]:this.a.pa[3]};h.Md=function(a){3==(this.a.C&49152)>>14?this.a.f[6]=a:this.a.pa[3]=a};h.yc=function(a){return this.a.Zb[a-65504>>1]};
h.wd=function(a,b){this.a.Zb[b-65504>>1]=a};h.Vb=function(a){if(65520==a){a=0;switch(Ib){case Ib:a=this.h.tb}a=(a>>6)-1}else a=0;return a};h.cc=function(){};h.ed=function(){return 1};h.ae=function(){};h.xc=function(){return this.a.fa};h.vd=function(){this.a.fa=0};h.Fc=function(){return this.a.Yb};h.Dd=function(a,b){b&1||(a&=255);this.a.Yb=a};h.Kc=function(a){return a?this.a.Fb:0};h.Gd=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Fb=a;b.u|=2};
h.dd=function(a){return a?this.a.nb&65280:0};h.$d=function(a){this.a.nb=a|255};h.Nc=function(){return Zb(this.a)};h.Jd=function(a){$b(this.a,a&-1793|Zb(this.a)&1792);this.a.u|=128};h.bc=function(){};
var M={},Wb=(M[61568]=[null,null,L.prototype.kd,L.prototype.fe,"UNIMAP",64,1170],M[62592]=[null,null,L.prototype.cd,L.prototype.Zd,"SIPDR",8,1145],M[62608]=[null,null,L.prototype.ad,L.prototype.Xd,"SDPDR",8,1145],M[62624]=[null,null,L.prototype.bd,L.prototype.Yd,"SIPAR",8,1145],M[62640]=[null,null,L.prototype.$c,L.prototype.Wd,"SDPAR",8,1145],M[62656]=[null,null,L.prototype.Dc,L.prototype.Bd,"KIPDR",8,1145],M[62672]=[null,null,L.prototype.Bc,L.prototype.zd,"KDPDR",8,1145],M[62688]=[null,null,L.prototype.Cc,
L.prototype.Ad,"KIPAR",8,1145],M[62704]=[null,null,L.prototype.Ac,L.prototype.yd,"KDPAR",8,1145],M[62798]=[null,null,L.prototype.Jc,L.prototype.Fd,"MMR3",1,1145],M[65382]=[null,null,L.prototype.Ec,L.prototype.Cd,"LKS"],M[65402]=[null,null,L.prototype.Gc,L.prototype.Ed,"MMR0",1,1145],M[65404]=[null,null,L.prototype.Hc,L.prototype.bc,"MMR1",1,1145],M[65406]=[null,null,L.prototype.Ic,L.prototype.bc,"MMR2",1,1145],M[65408]=[null,null,L.prototype.jd,L.prototype.ee,"UIPDR",8,1145],M[65424]=[null,null,L.prototype.gd,
L.prototype.ce,"UDPDR",8,1145],M[65440]=[null,null,L.prototype.hd,L.prototype.de,"UIPAR",8,1145],M[65456]=[null,null,L.prototype.fd,L.prototype.be,"UDPAR",8,1145],M[65472]=[null,null,L.prototype.Ma,L.prototype.Oa,"R0SET0"],M[65473]=[null,null,L.prototype.Ma,L.prototype.Oa,"R1SET0"],M[65474]=[null,null,L.prototype.Ma,L.prototype.Oa,"R2SET0"],M[65475]=[null,null,L.prototype.Ma,L.prototype.Oa,"R3SET0"],M[65476]=[null,null,L.prototype.Ma,L.prototype.Oa,"R4SET0"],M[65477]=[null,null,L.prototype.Ma,L.prototype.Oa,
"R5SET0"],M[65478]=[null,null,L.prototype.Oc,L.prototype.Kd,"R6KERNEL"],M[65479]=[null,null,L.prototype.Rc,L.prototype.Nd,"R7KERNEL"],M[65480]=[null,null,L.prototype.Na,L.prototype.Pa,"R0SET1",1,1145],M[65481]=[null,null,L.prototype.Na,L.prototype.Pa,"R1SET1",1,1145],M[65482]=[null,null,L.prototype.Na,L.prototype.Pa,"R2SET1",1,1145],M[65483]=[null,null,L.prototype.Na,L.prototype.Pa,"R3SET1",1,1145],M[65484]=[null,null,L.prototype.Na,L.prototype.Pa,"R4SET1",1,1145],M[65485]=[null,null,L.prototype.Na,
L.prototype.Pa,"R5SET1",1,1145],M[65486]=[null,null,L.prototype.Pc,L.prototype.Ld,"R6SUPER",1,1145],M[65487]=[null,null,L.prototype.Qc,L.prototype.Md,"R6USER",1,1145],M[65504]=[null,null,L.prototype.yc,L.prototype.wd,"CTRL",8,1170],M[65520]=[null,null,L.prototype.Vb,L.prototype.cc,"LSIZE",1,1170],M[65522]=[null,null,L.prototype.Vb,L.prototype.cc,"HSIZE",1,1170],M[65524]=[null,null,L.prototype.ed,L.prototype.ae,"SYSID",1,1170],M[65526]=[null,null,L.prototype.xc,L.prototype.vd,"CPUERR",1,1170],M[65528]=
[null,null,L.prototype.Fc,L.prototype.Dd,"MB",1,1170],M[65530]=[null,null,L.prototype.Kc,L.prototype.Gd,"PIR"],M[65532]=[null,null,L.prototype.dd,L.prototype.$d,"SL"],M[65534]=[null,null,L.prototype.Nc,L.prototype.Jd,"PSW"],M);Ga(function(){for(var a=E(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=C(d);switch(c.type){case "default":c=new L(c);D(c,d);break;case "pc11":c=new ac(c);D(c,d);break;case "rl11":c=new N(c),D(c,d)}}});var bc;
function Fb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.c;0<g&&k<a.h.length;){var l=a.h[k],n=k*a.b,p=a.b-(f-n);p>g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.Ka)return l.rb+=l.Ka-f,l.Ka=f,!0;if(f>=l.Ka+l.rb){p=l.size-(f-n);p>g&&(p=g);l.rb=f-l.Ka+p;f=n+a.b;g-=p;k++;continue}}return Hb(1,f,g)}f=new I(a,f,p,a.b,d,e);Ab(f,a.F,l);a.h[k++]=f;f=n+a.b;g-=p}return 0>=g?(d==Ib&&(a.ub+=c),a.status((c>>10)+"Kb "+Jb[d]+" at "+ka(b)),!0):Hb(2,b,c)}
function Eb(a,b,c){var d=[];for(b>>>=a.c;0<c&&b<a.h.length;)d.push(a.h[b++]),c-=a.b;return d}function Db(a,b,c,d){var e=0;for(b>>>=a.c;0<c&&b<a.h.length;){var f=d[e++];if(!f)break;a.h[b++]=f;c-=a.b}}function Kb(a,b){3932160<=b&&(b=Lb(a.a,b));return a.h[(b&a.oa)>>>a.c].Fb(b&a.l,b)}function Mb(a,b){3932160<=b&&(b=Lb(a.a,b));return a.h[(b&a.oa)>>>a.c].V(b&a.l,b)}h.mb=function(a){3932160<=a&&(a=Lb(this.a,a));var b=a&this.l,c=(a&this.oa)>>>this.c;this.m=!1;this.g++;a=this.h[c].Xb(b,a);this.g--;return a};
function Nb(a,b,c){3932160<=b&&(b=Lb(a.a,b));a.h[(b&a.oa)>>>a.c].Jb(b&a.l,c&255,b)}h.$a=function(a,b){3932160<=a&&(a=Lb(this.a,a));this.m=!1;this.g++;this.h[(a&this.oa)>>>this.c].Kb(a&this.l,b&255,a);this.g--};function Ob(a,b,c){3932160<=b&&(b=Lb(a.a,b));a.h[(b&a.oa)>>>a.c].sb(b&a.l,c&65535,b)}h.pb=function(a,b){3932160<=a&&(a=Lb(this.a,a));var c=a&this.l,d=(a&this.oa)>>>this.c;this.m=!1;this.g++;this.h[d].ec(c,b&65535,a);this.g--};
function Pb(a){for(var b=0,c=[],d=0;d<a.A;d++){var e=a.h[d];if(e.wa||e.kc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,k=0,l=[];g<e.length;){for(var n=e[g],p=g+1;p<e.length&&e[p]===n;)p++;l[k++]=p-g;l[k++]=n;g=p}l.length<e.length&&(e=l)}c[f]=e}}return c}function Qb(a,b,c,d,e,f,g,k,l){for(;b<=c;b+=2){var n=b&Bb;if(void 0!==a.Aa[n])return t("I/O address already registered: "+m(b,8,!0)),!1;a.Aa[n]=[d,e,f,g,l||"unknown",k,!1]}return!0}
function cb(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[6]&&f[6]>a.a.Ea)){var g=f[0]?f[0].bind(b):null,k=f[1]?f[1].bind(b):null,l=f[2]?f[2].bind(b):null,n=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&l&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(l)),!k&&n&&(k=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));for(var p=f[4],u=f[5]||1,w=0;w<u;w++,e+=2)if(p&&1<u&&(p=f[4]+w),!Qb(a,e,e,g,k,l,n,b.qd||64,p||b.za))return!1}}return!0}function eb(a,b){a.w.push(b)}
function J(a,b,c){a.m=!0;a.g||(c&&(a.a.fa|=c),K(a.a,4,0,b))}function Rb(a){var b=a.m;a.m=!1;return b}function Hb(a,b,c){t("Memory block error ("+a+": "+m(b)+","+m(c)+")");return!1}function L(a){y.call(this,"Device",a,L,512);this.b={L:0,Ib:-1}}A(L);h=L.prototype;h.ja=function(a,b,c,d){this.h=b;this.l=a;this.a=c;this.F=d;var e=this;this.b.Ib=Sb(c,function(){e.b.Ya|=128;e.b.Ya&64&&Tb(e.a,e.b.rd);e.l&&e.l.ya(1);Ub(e.a,e.b.Ib,1E3/60)});this.b.rd=Vb(64,6);cb(b,this,Wb);eb(b,this.reset.bind(this));F(this)};
h.reset=function(){this.b.Ya=128;Ub(this.a,this.b.Ib,1E3/60,!0)};h.Fc=function(){return this.b.Ya};h.Dd=function(a){this.b.Ya=a&192};h.Hc=function(){var a=this.a;return a.Z&-3199|a.bb<<5|a.cb<<1};h.Fd=function(a){Xb(this.a,a&-129|this.a.Z&128)};h.Ic=function(){var a=this.a;a.Z&57344||(a.Db=a.A>>16&65535);a=a.Db;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Jc=function(){var a=this.a;a.Z&57344||(a.Eb=a.A&65535);return a.Eb};h.Kc=function(){return this.a.Ba};
h.Gd=function(a){var b=this.a;1170>b.Ea&&(a&=-49);b.Ba!=a&&(b.Ba=a,b.Ra=a&16?4194303:262143,Yb(b))};h.ld=function(a){a=a>>1&63;var b=this.a.ab[a>>1];return a&1?b>>16:b&65535};h.ge=function(a,b){b=b>>1&63;var c=b>>1;this.a.ab[c]=b&1?this.a.ab[c]&65535|(a&63)<<16:this.a.ab[c]&-65536|a&65534};h.dd=function(a){return this.a.H[1][a>>1&7]};h.$d=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.bd=function(a){return this.a.H[1][(a>>1&7)+8]};h.Yd=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};
h.cd=function(a){return this.a.X[1][a>>1&7]};h.Zd=function(a,b){b=b>>1&7;this.a.X[1][b]=a;this.a.H[1][b]&=65295};h.ad=function(a){return this.a.X[1][(a>>1&7)+8]};h.Xd=function(a,b){b=(b>>1&7)+8;this.a.X[1][b]=a;this.a.H[1][b]&=65295};h.Ec=function(a){return this.a.H[0][a>>1&7]};h.Cd=function(a,b){this.a.H[0][b>>1&7]=a&65295};h.Cc=function(a){return this.a.H[0][(a>>1&7)+8]};h.Ad=function(a,b){this.a.H[0][(b>>1&7)+8]=a&65295};h.Dc=function(a){return this.a.X[0][a>>1&7]};
h.Bd=function(a,b){b=b>>1&7;this.a.X[0][b]=a;this.a.H[0][b]&=65295};h.Bc=function(a){return this.a.X[0][(a>>1&7)+8]};h.zd=function(a,b){b=(b>>1&7)+8;this.a.X[0][b]=a;this.a.H[0][b]&=65295};h.kd=function(a){return this.a.H[3][a>>1&7]};h.fe=function(a,b){this.a.H[3][b>>1&7]=a&65295};h.hd=function(a){return this.a.H[3][(a>>1&7)+8]};h.de=function(a,b){this.a.H[3][(b>>1&7)+8]=a&65295};h.jd=function(a){return this.a.X[3][a>>1&7]};h.ee=function(a,b){b=b>>1&7;this.a.X[3][b]=a;this.a.H[3][b]&=65295};
h.gd=function(a){return this.a.X[3][(a>>1&7)+8]};h.ce=function(a,b){b=(b>>1&7)+8;this.a.X[3][b]=a;this.a.H[3][b]&=65295};h.Ma=function(a){a&=7;return this.a.C&2048?this.a.Fa[a]:this.a.f[a]};h.Oa=function(a,b){b&=7;this.a.C&2048?this.a.Fa[b]=a:this.a.f[b]=a};h.Pc=function(){return this.a.C&49152?this.a.pa[0]:this.a.f[6]};h.Ld=function(a){this.a.C&49152?this.a.pa[0]=a:this.a.f[6]=a};h.Sc=function(){return this.a.f[7]};h.Od=function(a){this.a.f[7]=a};
h.Na=function(a){a&=7;return this.a.C&2048?this.a.f[a]:this.a.Fa[a]};h.Pa=function(a,b){b&=7;this.a.C&2048?this.a.f[b]=a:this.a.Fa[b]=a};h.Qc=function(){return 1==(this.a.C&49152)>>14?this.a.f[6]:this.a.pa[1]};h.Md=function(a){1==(this.a.C&49152)>>14?this.a.f[6]=a:this.a.pa[1]=a};h.Rc=function(){return 3==(this.a.C&49152)>>14?this.a.f[6]:this.a.pa[3]};h.Nd=function(a){3==(this.a.C&49152)>>14?this.a.f[6]=a:this.a.pa[3]=a};h.zc=function(a){return this.a.$b[a-65504>>1]};
h.xd=function(a,b){this.a.$b[b-65504>>1]=a};h.Wb=function(a){if(65520==a){a=0;switch(Ib){case Ib:a=this.h.ub}a=(a>>6)-1}else a=0;return a};h.dc=function(){};h.fd=function(){return 1};h.be=function(){};h.yc=function(){return this.a.fa};h.wd=function(){this.a.fa=0};h.Gc=function(){return this.a.Zb};h.Ed=function(a,b){b&1||(a&=255);this.a.Zb=a};h.Lc=function(a){return a?this.a.Gb:0};h.Hd=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Gb=a;b.u|=2};
h.ed=function(a){return a?this.a.ob&65280:0};h.ae=function(a){this.a.ob=a|255};h.Oc=function(){return Zb(this.a)};h.Kd=function(a){$b(this.a,a&-1793|Zb(this.a)&1792);this.a.u|=128};h.cc=function(){};
var M={},Wb=(M[61568]=[null,null,L.prototype.ld,L.prototype.ge,"UNIMAP",64,1170],M[62592]=[null,null,L.prototype.dd,L.prototype.$d,"SIPDR",8,1145],M[62608]=[null,null,L.prototype.bd,L.prototype.Yd,"SDPDR",8,1145],M[62624]=[null,null,L.prototype.cd,L.prototype.Zd,"SIPAR",8,1145],M[62640]=[null,null,L.prototype.ad,L.prototype.Xd,"SDPAR",8,1145],M[62656]=[null,null,L.prototype.Ec,L.prototype.Cd,"KIPDR",8,1145],M[62672]=[null,null,L.prototype.Cc,L.prototype.Ad,"KDPDR",8,1145],M[62688]=[null,null,L.prototype.Dc,
L.prototype.Bd,"KIPAR",8,1145],M[62704]=[null,null,L.prototype.Bc,L.prototype.zd,"KDPAR",8,1145],M[62798]=[null,null,L.prototype.Kc,L.prototype.Gd,"MMR3",1,1145],M[65382]=[null,null,L.prototype.Fc,L.prototype.Dd,"LKS"],M[65402]=[null,null,L.prototype.Hc,L.prototype.Fd,"MMR0",1,1145],M[65404]=[null,null,L.prototype.Ic,L.prototype.cc,"MMR1",1,1145],M[65406]=[null,null,L.prototype.Jc,L.prototype.cc,"MMR2",1,1145],M[65408]=[null,null,L.prototype.kd,L.prototype.fe,"UIPDR",8,1145],M[65424]=[null,null,L.prototype.hd,
L.prototype.de,"UDPDR",8,1145],M[65440]=[null,null,L.prototype.jd,L.prototype.ee,"UIPAR",8,1145],M[65456]=[null,null,L.prototype.gd,L.prototype.ce,"UDPAR",8,1145],M[65472]=[null,null,L.prototype.Ma,L.prototype.Oa,"R0SET0"],M[65473]=[null,null,L.prototype.Ma,L.prototype.Oa,"R1SET0"],M[65474]=[null,null,L.prototype.Ma,L.prototype.Oa,"R2SET0"],M[65475]=[null,null,L.prototype.Ma,L.prototype.Oa,"R3SET0"],M[65476]=[null,null,L.prototype.Ma,L.prototype.Oa,"R4SET0"],M[65477]=[null,null,L.prototype.Ma,L.prototype.Oa,
"R5SET0"],M[65478]=[null,null,L.prototype.Pc,L.prototype.Ld,"R6KERNEL"],M[65479]=[null,null,L.prototype.Sc,L.prototype.Od,"R7KERNEL"],M[65480]=[null,null,L.prototype.Na,L.prototype.Pa,"R0SET1",1,1145],M[65481]=[null,null,L.prototype.Na,L.prototype.Pa,"R1SET1",1,1145],M[65482]=[null,null,L.prototype.Na,L.prototype.Pa,"R2SET1",1,1145],M[65483]=[null,null,L.prototype.Na,L.prototype.Pa,"R3SET1",1,1145],M[65484]=[null,null,L.prototype.Na,L.prototype.Pa,"R4SET1",1,1145],M[65485]=[null,null,L.prototype.Na,
L.prototype.Pa,"R5SET1",1,1145],M[65486]=[null,null,L.prototype.Qc,L.prototype.Md,"R6SUPER",1,1145],M[65487]=[null,null,L.prototype.Rc,L.prototype.Nd,"R6USER",1,1145],M[65504]=[null,null,L.prototype.zc,L.prototype.xd,"CTRL",8,1170],M[65520]=[null,null,L.prototype.Wb,L.prototype.dc,"LSIZE",1,1170],M[65522]=[null,null,L.prototype.Wb,L.prototype.dc,"HSIZE",1,1170],M[65524]=[null,null,L.prototype.fd,L.prototype.be,"SYSID",1,1170],M[65526]=[null,null,L.prototype.yc,L.prototype.wd,"CPUERR",1,1170],M[65528]=
[null,null,L.prototype.Gc,L.prototype.Ed,"MB",1,1170],M[65530]=[null,null,L.prototype.Lc,L.prototype.Hd,"PIR"],M[65532]=[null,null,L.prototype.ed,L.prototype.ae,"SL"],M[65534]=[null,null,L.prototype.Oc,L.prototype.Kd,"PSW"],M);Ga(function(){for(var a=E(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=C(d);switch(c.type){case "default":c=new L(c);D(c,d);break;case "pc11":c=new ac(c);D(c,d);break;case "rl11":c=new N(c),D(c,d)}}});var bc;
if(Xa){var cc=new ArrayBuffer(2);(new DataView(cc)).setUint16(0,256,!0);bc=256===(new Uint16Array(cc))[0]}else bc=!1;var dc=bc;
function I(a,b,c,d,e,f){this.h=a;this.id=ec+=2;this.a=null;this.Ka=b;this.qb=c;this.size=d||0;this.type=e||fc;this.l=e==gc;this.controller=null;Ab(this);this.wa=this.jc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],hc(this,f.fc);else if(Xa)this.b=new ArrayBuffer(this.size),this.c=new DataView(this.b,0,this.size),this.o=new Uint8Array(this.b,0,this.size),this.s=new Uint16Array(this.b,0,this.size>>1),this.a=new Int32Array(this.b,0,this.size>>2),hc(this,dc?ic:jc);else{a=this.a=Array(this.size>>
function I(a,b,c,d,e,f){this.h=a;this.id=ec+=2;this.a=null;this.Ka=b;this.rb=c;this.size=d||0;this.type=e||fc;this.l=e==gc;this.controller=null;Ab(this);this.wa=this.kc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],hc(this,f.gc);else if(Xa)this.b=new ArrayBuffer(this.size),this.c=new DataView(this.b,0,this.size),this.o=new Uint8Array(this.b,0,this.size),this.s=new Uint16Array(this.b,0,this.size>>1),this.a=new Int32Array(this.b,0,this.size>>2),hc(this,dc?ic:jc);else{a=this.a=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;hc(this,kc)}else hc(this)}var fc=0,Ib=1,gc=2,Gb=4,Jb=["NONE","RAM","ROM","VID","H/W"],ec=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Xa)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.c.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Xa)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.wa=!0}return!1},v:function(a,b){J(this.h,b,32);return 255},g:function(a,b,c){J(this.h,c,32)},w:function(a,b){return this.Eb(a++,b++)|
this.Eb(a,b)<<8},A:function(a,b,c){this.Ib(a++,b&255,c++);this.Ib(a,b>>8,c)},M:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ba:function(a,b){a&1&&J(this.h,b,64);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},sa:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.wa=!0},za:function(a,b,c){a&1&&J(this.h,c,64);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.wa=!0},D:function(a,b){return this.I(a,b)},R:function(a,b){return this.Wb(a,b)},qa:function(a,b,c){this.l?this.g(a,b,c):this.Jb(a,b,c)},ua:function(a,b,c){this.l?this.g(a,b,c):this.dc(a,b,c)},B:function(a){return this.o[a]},J:function(a){return this.o[a]},O:function(a,b){a&1&&J(this.h,b,64);return this.c.getUint16(a,!0)},aa:function(a,b){a&1&&J(this.h,b,64);return this.s[a>>1]},ma:function(a,b){this.o[a]=b;this.wa=!0},ra:function(a,b){this.o[a]=b;this.wa=!0},ta:function(a,b,c){a&1&&J(this.h,
c,64);this.c.setUint16(a,b,!0);this.wa=!0},va:function(a,b,c){a&1&&J(this.h,c,64);this.s[a>>1]=b;this.wa=!0}};function Ab(a,b,c){a.F=b;a.i=a.m=0;c&&((a.i=c.i)&&nc(a,oc,!1),(a.m=c.m)&&pc(a,oc,!1))}function pc(a,b,c){c&&a.m||(a.Ib=!a.l&&b[1]||a.g,a.rb=!a.l&&b[3]||a.A);if(c||void 0===c)a.Jb=b[1]||a.g,a.dc=b[3]||a.A}function nc(a,b,c){c&&a.i||(a.Eb=b[0]||a.v,a.V=b[2]||a.w);if(c||void 0===c)a.I=b[0]||a.v,a.Wb=b[2]||a.w}function hc(a,b){b||(b=qc);nc(a,b,void 0);pc(a,b,void 0)}
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Xa)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.c.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Xa)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.wa=!0}return!1},v:function(a,b){J(this.h,b,32);return 255},g:function(a,b,c){J(this.h,c,32)},w:function(a,b){return this.Fb(a++,b++)|
this.Fb(a,b)<<8},A:function(a,b,c){this.Jb(a++,b&255,c++);this.Jb(a,b>>8,c)},M:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ba:function(a,b){a&1&&J(this.h,b,64);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},sa:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.wa=!0},za:function(a,b,c){a&1&&J(this.h,c,64);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.wa=!0},D:function(a,b){return this.I(a,b)},R:function(a,b){return this.Xb(a,b)},qa:function(a,b,c){this.l?this.g(a,b,c):this.Kb(a,b,c)},ua:function(a,b,c){this.l?this.g(a,b,c):this.ec(a,b,c)},B:function(a){return this.o[a]},J:function(a){return this.o[a]},O:function(a,b){a&1&&J(this.h,b,64);return this.c.getUint16(a,!0)},aa:function(a,b){a&1&&J(this.h,b,64);return this.s[a>>1]},ma:function(a,b){this.o[a]=b;this.wa=!0},ra:function(a,b){this.o[a]=b;this.wa=!0},ta:function(a,b,c){a&1&&J(this.h,
c,64);this.c.setUint16(a,b,!0);this.wa=!0},va:function(a,b,c){a&1&&J(this.h,c,64);this.s[a>>1]=b;this.wa=!0}};function Ab(a,b,c){a.F=b;a.i=a.m=0;c&&((a.i=c.i)&&nc(a,oc,!1),(a.m=c.m)&&pc(a,oc,!1))}function pc(a,b,c){c&&a.m||(a.Jb=!a.l&&b[1]||a.g,a.sb=!a.l&&b[3]||a.A);if(c||void 0===c)a.Kb=b[1]||a.g,a.ec=b[3]||a.A}function nc(a,b,c){c&&a.i||(a.Fb=b[0]||a.v,a.V=b[2]||a.w);if(c||void 0===c)a.I=b[0]||a.v,a.Xb=b[2]||a.w}function hc(a,b){b||(b=qc);nc(a,b,void 0);pc(a,b,void 0)}
var qc=[],kc=[I.prototype.M,I.prototype.sa,I.prototype.ba,I.prototype.za],oc=[I.prototype.D,I.prototype.qa,I.prototype.R,I.prototype.ua];if(Xa)var jc=[I.prototype.B,I.prototype.ma,I.prototype.O,I.prototype.ta],ic=[I.prototype.J,I.prototype.ra,I.prototype.aa,I.prototype.va];
function rc(a,b){y.call(this,"CPU",a,rc,1);b=a.cycles||b;var c=a.multiplier||1;this.xb=0;this.ib=b;this.ta=c;this.Ab=Math.round(this.ib/1E4)/100;this.Ha=this.Ab*this.ta;this.j.P=!1;this.j.Gb=!1;this.j.Va=a.autoStart;this.j.eb=!1;this.fb=this.Ia=0;this.gb=a.csStart;this.Sa=a.csInterval;this.Ta=a.csStop;this.J=[];this.ac=this.od.bind(this);F(this)}A(rc);var sc=["power","reset"];h=rc.prototype;
function rc(a,b){y.call(this,"CPU",a,rc,1);b=a.cycles||b;var c=a.multiplier||1;this.yb=0;this.jb=b;this.ta=c;this.Bb=Math.round(this.jb/1E4)/100;this.Ha=this.Bb*this.ta;this.j.P=!1;this.j.Hb=!1;this.j.Va=a.autoStart;this.j.fb=!1;this.gb=this.Ia=0;this.hb=a.csStart;this.Sa=a.csInterval;this.Ta=a.csStop;this.J=[];this.bc=this.pd.bind(this);F(this)}A(rc);var sc=["power","reset"];h=rc.prototype;
h.ja=function(a,b,c,d){this.l=a;this.h=b;this.F=d;this.w=a.w;for(b=0;b<sc.length;b++)(c=this.o[sc[b]])&&this.l.$(null,sc[b],c);a=tc(a,"autoStart");null!=a&&(this.j.Va="true"==a?!0:"false"==a?!1:!!a);F(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.la=function(a,b){if(!b){if(a&&this.restore){uc(this);if(!this.restore(a))return!1;vc(this)}else this.reset();this.T("No debugger detected")}return!0};h.ka=function(a){return a?this.save():!0};
h.Va=function(){return this.j.Va||void 0===this.o.run?(mb(this),!0):!1};h.Nb=function(){return 0};function vc(a){void 0===a.gb&&(a.gb=0);void 0===a.Sa&&(a.Sa=-1);void 0===a.Ta&&(a.Ta=-1);a.j.eb=0<=a.gb&&0<a.Sa;a.j.eb&&(a.fb=0,a.Ia=a.gb-a.va)}function pb(a,b){if(a.j.eb){var c=!1;a.fb=a.fb+a.Nb()|0;a.Ia-=b;0>=a.Ia&&(a.Ia+=a.Sa,c=!0);0<=a.Ta&&a.Ta<=wc(a)&&(a.Sa=a.Ta=-1,vc(a),G(a),c=!0);c&&a.T(wc(a)+" cycles: checksum="+m(a.fb))}}
h.$=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.o[b]=c,!0;case "run":return this.o[b]=c,c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.j.N)a=!0;else{var b=null,c,k=B(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.j.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.j.N);c++);c==k.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.j.ready?"powered yet":"ready yet"+(b.jb?" (waiting for notification)":""))+".");a=!1}a&&(d.j.P?G(d):mb(d))},!0;case "speed":return this.o[b]=
c,!0;case "setSpeed":return this.o[b]=c,c.onclick=function(){xc(d,d.ta<<1,!0)},c.textContent=this.Ha.toFixed(2)+"Mhz",!0}return!1};h.ya=function(a){this.l&&this.l.ya(a)};function ob(a,b,c){a.va+=b;c&&(a.sa=a.a=a.I=0)}function yc(a,b){var c=1;b&&1<a.ta&&a.Ga&&(c=a.Ga/a.Ab);a.Tb=Math.round(1E3/30);a.kb=Math.floor(a.ib/30*c);b||(a.Ua=a.kb);a.Bb=0}function wc(a){return a.va+a.ma+a.sa-a.a}function uc(a){a.Ga=0;a.Ub=0;a.va=a.ma=a.sa=a.a=a.I=0;vc(a);xc(a,1)}
function xc(a,b,c){if(void 0!==b){.8>a.Ga/a.Ha&&(b=1);a.ta=b;b=a.Ab*a.ta;if(a.Ha!=b){a.Ha=b;b=a.Ha.toFixed(2)+"Mhz";var d=a.o.setSpeed;d&&(d.textContent=b);a.T("target speed: "+b)}c&&a.l&&zc(a.l)}ob(a,a.ma);a.ma=0;a.ba=ra();a.ra=0;yc(a)}function Sb(a,b){var c=a.J.length;a.J.push([-1,b]);return c}function Ub(a,b,c,d){0<=b&&b<a.J.length&&(d||0>a.J[b][0])&&(c=a.ib*a.ta/1E3*c|0,a.j.P&&(c+=Ac(a)),a.J[b][0]=c)}
h.Va=function(){return this.j.Va||void 0===this.o.run?(mb(this),!0):!1};h.Ob=function(){return 0};function vc(a){void 0===a.hb&&(a.hb=0);void 0===a.Sa&&(a.Sa=-1);void 0===a.Ta&&(a.Ta=-1);a.j.fb=0<=a.hb&&0<a.Sa;a.j.fb&&(a.gb=0,a.Ia=a.hb-a.va)}function pb(a,b){if(a.j.fb){var c=!1;a.gb=a.gb+a.Ob()|0;a.Ia-=b;0>=a.Ia&&(a.Ia+=a.Sa,c=!0);0<=a.Ta&&a.Ta<=wc(a)&&(a.Sa=a.Ta=-1,vc(a),G(a),c=!0);c&&a.T(wc(a)+" cycles: checksum="+m(a.gb))}}
h.$=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.o[b]=c,!0;case "run":return this.o[b]=c,c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.j.N)a=!0;else{var b=null,c,k=B(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.j.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.j.N);c++);c==k.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.j.ready?"powered yet":"ready yet"+(b.kb?" (waiting for notification)":""))+".");a=!1}a&&(d.j.P?G(d):mb(d))},!0;case "speed":return this.o[b]=
c,!0;case "setSpeed":return this.o[b]=c,c.onclick=function(){xc(d,d.ta<<1,!0)},c.textContent=this.Ha.toFixed(2)+"Mhz",!0}return!1};h.ya=function(a){this.l&&this.l.ya(a)};function ob(a,b,c){a.va+=b;c&&(a.sa=a.a=a.I=0)}function yc(a,b){var c=1;b&&1<a.ta&&a.Ga&&(c=a.Ga/a.Bb);a.Ub=Math.round(1E3/30);a.lb=Math.floor(a.jb/30*c);b||(a.Ua=a.lb);a.Cb=0}function wc(a){return a.va+a.ma+a.sa-a.a}function uc(a){a.Ga=0;a.Vb=0;a.va=a.ma=a.sa=a.a=a.I=0;vc(a);xc(a,1)}
function xc(a,b,c){if(void 0!==b){.8>a.Ga/a.Ha&&(b=1);a.ta=b;b=a.Bb*a.ta;if(a.Ha!=b){a.Ha=b;b=a.Ha.toFixed(2)+"Mhz";var d=a.o.setSpeed;d&&(d.textContent=b);a.T("target speed: "+b)}c&&a.l&&zc(a.l)}ob(a,a.ma);a.ma=0;a.ba=ra();a.ra=0;yc(a)}function Sb(a,b){var c=a.J.length;a.J.push([-1,b]);return c}function Ub(a,b,c,d){0<=b&&b<a.J.length&&(d||0>a.J[b][0])&&(c=a.jb*a.ta/1E3*c|0,a.j.P&&(c+=Ac(a)),a.J[b][0]=c)}
function nb(a,b){for(var c=a.J.length-1;0<=c;c--){var d=a.J[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Ac(a,b){var c=a.sa-=a.a;a.a=a.I=0;b&&(a.sa=0);return c}
h.od=function(){if(this.j.P){this.Bb>=this.ib&&yc(this,!0);this.Qa=0;this.cb=ra();if(this.ra){var a=this.cb-this.ra;a>this.Tb&&(this.ba+=a,this.ba>this.cb&&(this.ba=this.cb))}try{do{for(var b,c=this.j.eb?1:this.kb,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.pb(b)}catch(f){if("number"!=typeof f)throw f;}b=Ac(this,!0);this.Qa+=b;this.ma+=b;pb(this,b);nb(this,b);this.Ua-=b;if(0>=this.Ua){this.Ua+=this.kb;15<=++this.Ub&&(this.ya(),this.Ub=0);break}}while(this.j.P)}catch(f){G(this);
this.l&&this.l.stop(ra(),wc(this));Wa(this,f.stack||f.message);return}if(this.j.P){a=setTimeout;b=this.ac;this.ra=ra();c=this.Tb;this.Qa&&(c=Math.round(c*this.Qa/this.kb));c-=this.ra-this.cb;if(d=this.ra-this.ba)this.Ga=Math.round(this.ma/(10*d))/100,864E5<=d&&(this.va=0,xc(this));if(0>c||this.Ga<this.Ha)-1E3>c&&(this.ba-=c),c=0;this.Bb+=this.Qa;this.ra+=c;a(b,c)}}};
function mb(a){var b;a.j.error?(a.T(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.P)a.T(a.toString()+" busy");else{xc(a);a.j.P=!0;a.j.Gb=!0;if(b=a.o.run)b.textContent="Halt";a.l&&a.l.start(a.ba,wc(a));setTimeout(a.ac,0)}}h.pb=function(){return 0};function G(a){var b=!1;if(a.j.P){Ac(a);ob(a,a.ma);a.ma=0;a.j.P=!1;if(b=a.o.run)b.textContent="Run";a.l&&a.l.stop(ra(),wc(a));b=!0}a.j.complete=void 0;return b}
function Bc(a){this.Ea=+a.model||1170;this.Rb=a.addrReset||0;rc.call(this,a,6666667);this.decode=1120==this.Ea?Cc.bind(this):Dc.bind(this);Ec(this);this.ua=0;this.O=null;this.j.complete=!1}A(Bc,rc);h=Bc.prototype;h.reset=function(){this.status("model "+this.Ea);this.j.P&&G(this);Ec(this);uc(this);this.j.error=!1;this.parent.reset.call(this)};
function Ec(a){a.m=65536;a.g=32768;a.i=65535;a.s=32768;a.C=15;a.f=[0,0,0,0,0,0,0,a.Rb];a.Fa=[0,0,0,0,0,0];a.pa=[0,0,0,0];a.v=0;a.bb=0;a.rd=[4,2,0,1];a.H=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.X=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.$a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0];a.Zb=[0,0,0,0,0,0,0,0];a.Yb=0;a.u=0;a.B=a.D=0;a.c=a.b=a.zb=0;a.Ja=-1;lb(a)}function lb(a){a.nb=255;a.fa=0;a.Fb=0;a.Z=0;a.Cb=0;a.Db=0;a.Ba=0;a.aa=0;a.ab=0;a.Ra=262143;a.A=0;a.O=null;a.h&&Yb(a)}function Yb(a){a.aa?(a.R=65536,a.Qb=a.Ba&16?4186112:253952,a.M=a.mc,a.V=a.ld,a.rb=a.ge,Cb(a.h,a.Ba&16?22:18)):(a.R=0,a.Qb=57344,a.M=a.lc,a.V=a.Xb,a.rb=a.ec,Cb(a.h,16))}
function Xb(a,b){b&=-3073;if(a.Z!=b){b&57344&&!(a.Z&57344)&&(a.Cb=a.A>>16&65535,a.Db=a.A&65535);a.Z=b;a.ab=b>>5&3;a.bb=b>>1&15;var c=0;b&257&&(c=4,b&1&&(c|=2));a.aa!=c&&(a.aa=c,Yb(a))}}h.Nb=function(){return 0};h.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.va,this.ta]);a.set(2,Pb(this.h));return a.data()};
h.pd=function(){if(this.j.P){this.Cb>=this.jb&&yc(this,!0);this.Qa=0;this.eb=ra();if(this.ra){var a=this.eb-this.ra;a>this.Ub&&(this.ba+=a,this.ba>this.eb&&(this.ba=this.eb))}try{do{for(var b,c=this.j.fb?1:this.lb,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.qb(b)}catch(f){if("number"!=typeof f)throw f;}b=Ac(this,!0);this.Qa+=b;this.ma+=b;pb(this,b);nb(this,b);this.Ua-=b;if(0>=this.Ua){this.Ua+=this.lb;15<=++this.Vb&&(this.ya(),this.Vb=0);break}}while(this.j.P)}catch(f){G(this);
this.l&&this.l.stop(ra(),wc(this));Wa(this,f.stack||f.message);return}if(this.j.P){a=setTimeout;b=this.bc;this.ra=ra();c=this.Ub;this.Qa&&(c=Math.round(c*this.Qa/this.lb));c-=this.ra-this.eb;if(d=this.ra-this.ba)this.Ga=Math.round(this.ma/(10*d))/100,864E5<=d&&(this.va=0,xc(this));if(0>c||this.Ga<this.Ha)-1E3>c&&(this.ba-=c),c=0;this.Cb+=this.Qa;this.ra+=c;a(b,c)}}};
function mb(a){var b;a.j.error?(a.T(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.P)a.T(a.toString()+" busy");else{xc(a);a.j.P=!0;a.j.Hb=!0;if(b=a.o.run)b.textContent="Halt";a.l&&a.l.start(a.ba,wc(a));setTimeout(a.bc,0)}}h.qb=function(){return 0};function G(a){var b=!1;if(a.j.P){Ac(a);ob(a,a.ma);a.ma=0;a.j.P=!1;if(b=a.o.run)b.textContent="Run";a.l&&a.l.stop(ra(),wc(a));b=!0}a.j.complete=void 0;return b}
function Bc(a){this.Ea=+a.model||1170;this.Sb=a.addrReset||0;rc.call(this,a,6666667);this.decode=1120==this.Ea?Cc.bind(this):Dc.bind(this);Ec(this);this.ua=0;this.O=null;this.j.complete=!1}A(Bc,rc);h=Bc.prototype;h.reset=function(){this.status("model "+this.Ea);this.j.P&&G(this);Ec(this);uc(this);this.j.error=!1;this.parent.reset.call(this)};
function Ec(a){a.m=65536;a.g=32768;a.i=65535;a.s=32768;a.C=15;a.f=[0,0,0,0,0,0,0,a.Sb];a.Fa=[0,0,0,0,0,0];a.pa=[0,0,0,0];a.v=0;a.cb=0;a.sd=[4,2,0,1];a.H=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.X=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ab=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0];a.$b=[0,0,0,0,0,0,0,0];a.Zb=0;a.u=0;a.B=a.D=0;a.c=a.b=a.Ab=0;a.Ja=-1;lb(a)}function lb(a){a.Z=0;a.Db=0;a.Eb=0;a.Ba=0;a.fa=0;a.Gb=0;a.ob=255;a.aa=0;a.bb=0;a.Ra=262143;a.Xa=0;a.A=0;a.O=null;a.h&&Yb(a)}function Yb(a){a.aa?(a.R=65536,a.Rb=a.Ba&16?4186112:253952,a.M=a.nc,a.V=a.md,a.sb=a.he,Cb(a.h,a.Ba&16?22:18)):(a.R=0,a.Rb=57344,a.M=a.mc,a.V=a.Yb,a.sb=a.fc,Cb(a.h,16))}
function Xb(a,b){b&=-3073;if(a.Z!=b){b&57344&&!(a.Z&57344)&&(a.Db=a.A>>16&65535,a.Eb=a.A&65535);a.Z=b;a.bb=b>>5&3;a.cb=b>>1&15;var c=0;b&257&&(c=4,b&1&&(c|=2));a.aa!=c&&(a.aa=c,Yb(a))}}h.Ob=function(){return 0};h.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.va,this.ta]);a.set(2,Pb(this.h));return a.data()};
h.restore=function(a){var b=a[1];this.va=b[1];xc(this,b[3]);a:{b=this.h;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.D){for(var f=0,g=Array(b.D),k=0;k<e.length-1;)for(var l=e[k++],n=e[k++];l--;)g[f++]=n;e=g}f=b.h[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function P(a){return a.m&65536?1:0}function Fc(a){return a.s&32768?8:0}function Gc(a){var b=a.f[7];a.A=b;var c=a.V(b);a.f[7]=b+2&65535;return c}
function Hc(a,b){var c=a.f[7];a.f[7]=c+b&65535;return c}function Q(a,b){a.f[7]=b&65535}function Vb(a,b){return{td:a,La:b,next:null}}function Ic(a,b){var c=a.O;if(c==b)a.O=b.next;else for(;c;){a=c.next;if(a==b){c.next=a.next;break}c=a}}function Tb(a,b){if(b!=a.O){var c=a.O;if(!c||c.La<=b.La)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.La<=b.La){b.next=d;c.next=b;break}c=d}while(c)}}a.u|=1}function Jc(a){return a.u&64?(K(a,168,64,-5),!0):a.u&32?(K(a,4,32,-4),!0):a.u&16?(K(a,12,16,-6),!0):!1}
function Hc(a,b){var c=a.f[7];a.f[7]=c+b&65535;return c}function Q(a,b){a.f[7]=b&65535}function Vb(a,b){return{ud:a,La:b,next:null}}function Ic(a,b){var c=a.O;if(c==b)a.O=b.next;else for(;c;){a=c.next;if(a==b){c.next=a.next;break}c=a}}function Tb(a,b){if(b!=a.O){var c=a.O;if(!c||c.La<=b.La)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.La<=b.La){b.next=d;c.next=b;break}c=d}while(c)}}a.u|=1}function Jc(a){return a.u&64?(K(a,168,64,-5),!0):a.u&32?(K(a,4,32,-4),!0):a.u&16?(K(a,12,16,-6),!0):!1}
function Zb(a){return a.C=a.C&63728|Fc(a)|(a.i&65535?0:4)|(a.g&32768?2:0)|P(a)}function $b(a,b){a.s=b<<12;a.i=~b&4;a.g=b<<14;a.m=b<<16;if((b^a.C)&2048)for(var c=a.Fa.length;0<=--c;){var d=a.f[c];a.f[c]=a.Fa[c];a.Fa[c]=d}a.v=b>>14&3;c=a.C>>14&3;a.v!=c&&(a.pa[c]=a.f[6],a.f[6]=a.pa[a.v]);a.C=b;a.u|=2}function R(a,b){a.u&128||(a.s=a.i=b,a.g=0)}function Kc(a,b,c){a.u&128||(a.s=a.i=a.m=b,a.g=c||0)}function Lc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.g=(c^b)&(d^b))}
function Mc(a,b){a.u&128||(a.s=a.i=a.m=b,a.g=a.s^a.m>>1)}function Nc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.g=(c^d)&(d^b))}function K(a,b,c,d){if(!a.ua){0>a.Ja?a.Ja=Zb(a):a.v||(b=4,a.fa|=4,a.f[6]=4,d=-3);a.A=b;a.v=0;var e=a.V(b|a.R),f=a.V(b+2&65535|a.R);$b(a,f&-12289|a.Ja>>2&12288);Oc(a,a.Ja);Oc(a,a.f[7]);Q(a,e);a.u&=~(c|18);a.u|=9;a.Ja=-1;if(-3<=d)throw b;}}function Pc(a){var b=Qc(a),c=Qc(a)&-1793;a.C&49152&&(c=c&-225|a.C&63712);Q(a,b);$b(a,c);a.u&=-17}
function Lb(a,b){var c=b>>13&31;31>c&&a.Ba&32&&(b=a.$a[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
function Rc(a,b,c){var d,e,f;if(!(c&a.aa))return f=b&65535,57344<=f&&(f|=a.Qb),f;d=b>>13;a.Ba&a.rd[a.v]||(d&=7);e=a.H[a.v][d];f=(a.X[a.v][d]<<6)+(b&8191)&a.Ra;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!=(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.H[a.v][d]=e;if(f!=(4194170&a.Ra)||a.v)a.ab=a.v,a.bb=d;b=!1;g&&(g&57344&&(0<=a.Ja&&(g|=128),a.Z&
57344||(g|=a.ab<<5|a.bb<<1,Xb(a,a.Z&-61695|g)),b=!0),a.Z&61440||!(f<(4191360&a.Ra)||f>(4194239&a.Ra))||(a.Z|=4096,a.Z&512&&(a.u|=64)),b&&K(a,168,0,-1));return f}function Qc(a){var b=a.V(a.f[6]|a.R);a.f[6]=a.f[6]+2&65535;return b}function Oc(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.A=a.A&65535|(a.A&-65536)<<8|16121856;Sc(a,0,c);a.rb(c,b)}function Sc(a,b,c){!a.v&&c<=a.nb&&(b||4<c)&&(1145<=a.Ea&&c<=a.nb-32?(a.fa|=4,a.f[6]=4,K(a,4,0,-3)):(a.fa|=8,a.u|=32))}
function Lb(a,b){var c=b>>13&31;31>c&&a.Ba&32&&(b=a.ab[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
function Rc(a,b,c){var d,e,f;if(!(c&a.aa))return f=b&65535,57344<=f&&(f|=a.Rb),f;d=b>>13;a.Ba&a.sd[a.v]||(d&=7);e=a.H[a.v][d];f=(a.X[a.v][d]<<6)+(b&8191)&a.Ra;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!=(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.H[a.v][d]=e;if(f!=(4194170&a.Ra)||a.v)a.bb=a.v,a.cb=d;b=!1;g&&(g&57344&&(0<=a.Ja&&(g|=128),a.Z&
57344||(g|=a.bb<<5|a.cb<<1,Xb(a,a.Z&-61695|g),b=!0)),a.Z&61440||!(f<(4191360&a.Ra)||f>(4194239&a.Ra))||(a.Z|=4096,a.Z&512&&(a.u|=64)),b&&K(a,168,0,-1));return f}function Qc(a){var b=a.V(a.f[6]|a.R);a.f[6]=a.f[6]+2&65535;return b}function Oc(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.A=a.A&65535|(a.A&-65536)<<8|16121856;Sc(a,0,c);a.sb(c,b)}function Sc(a,b,c){!a.v&&c<=a.ob&&(b||4<c)&&(1145<=a.Ea&&c<=a.ob-32?(a.fa|=4,a.f[6]=4,K(a,4,0,-3)):(a.fa|=8,a.u|=32))}
function Tc(a,b,c,d){var e,f,g=d&8?0:a.R;switch(b){case 0:return K(a,4,0,-2),0;case 1:return 6==c&&d&4&&Sc(a,b,a.f[6]),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.V(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.V(e)|g;a.a-=8;break;case 6:return e=a.V(Hc(a,2)),e=e+a.f[c]&65535|g,a.a-=6,e;case 7:return e=a.V(Hc(a,2)),e=e+a.f[c]&
65535,e=a.V(e|a.R)|g,a.a-=10,e}a.f[c]=a.f[c]+f&65535;a.A=a.A&65535|(a.A&-65536)<<8|(f<<3&248|c)<<16;6==c&&0>f&&Sc(a,b,a.f[6]);return e}h.lb=function(a){if(!this.aa)return this.h.lb(a);this.ua++;a=this.Xb(Rc(this,a,2));this.ua--;return a};h.Za=function(a,b){this.aa?(this.ua++,a=Rc(this,a,5),a&1&&this.a--,Nb(this.h,a,b),this.ua--):this.h.Za(a,b)};h.ob=function(a,b){this.aa?(this.ua++,this.ec(Rc(this,a,4),b),this.ua--):this.h.ob(a,b)};h.lc=function(a,b,c){return Tc(this,a,b,c)};
h.mc=function(a,b,c){return Rc(this,Tc(this,a,b,c),c)};h.Xb=function(a){return Mb(this.h,a)};h.ld=function(a){return Mb(this.h,Rc(this,a,2))};h.ec=function(a,b){Ob(this.h,a,b&65535)};h.ge=function(a,b){Ob(this.h,Rc(this,a,4),b)};function Uc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=Tc(a,b,d,2),c&65536||61440!==(a.C&61440)&&(d&=65535),a.v=a.C>>12&3,c=a.V(d|c&a.R),a.v=a.C>>14&3):c=6!=d||(a.C>>2&12288)===(a.C&12288)?a.f[d]:a.pa[a.C>>12&3];return c}
65535,e=a.V(e|a.R)|g,a.a-=10,e}a.f[c]=a.f[c]+f&65535;a.A=a.A&65535|(a.A&-65536)<<8|(f<<3&248|c)<<16;6==c&&0>f&&Sc(a,b,a.f[6]);return e}h.mb=function(a){if(!this.aa)return this.h.mb(a);this.ua++;a=this.Yb(Rc(this,a,2));this.ua--;return a};h.$a=function(a,b){this.aa?(this.ua++,a=Rc(this,a,5),a&1&&this.a--,Nb(this.h,a,b),this.ua--):this.h.$a(a,b)};h.pb=function(a,b){this.aa?(this.ua++,this.fc(Rc(this,a,4),b),this.ua--):this.h.pb(a,b)};h.mc=function(a,b,c){return Tc(this,a,b,c)};
h.nc=function(a,b,c){return Rc(this,Tc(this,a,b,c),c)};h.Yb=function(a){return Mb(this.h,this.Xa=a)};h.md=function(a){return Mb(this.h,this.Xa=Rc(this,a,2))};h.fc=function(a,b){Ob(this.h,this.Xa=a,b&65535)};h.he=function(a,b){Ob(this.h,this.Xa=Rc(this,a,4),b)};function Uc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=Tc(a,b,d,2),c&65536||61440!==(a.C&61440)&&(d&=65535),a.v=a.C>>12&3,c=a.V(d|c&a.R),a.v=a.C>>14&3):c=6!=d||(a.C>>2&12288)===(a.C&12288)?a.f[d]:a.pa[a.C>>12&3];return c}
function Vc(a,b,c,d){a.A=a.A&65535|1441792;var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=Tc(a,b,e,4),c&65536||(e&=65535),a.v=a.C>>12&3,e=Rc(a,e|c&65536,4),a.v=a.C>>14&3,Ob(a.h,e,d)):6!=e||(a.C>>2&12288)===(a.C&12288)?a.f[e]=d:a.pa[a.C>>12&3]=d}function Wc(a,b){b>>=6;var c=a.D=b&7;(b=a.B=(b&56)>>3)?(c=a.M(b,c,3),a=Kb(a.h,c)):a=-c-1;return a}function Xc(a,b){var c;b>>=6;var d=a.D=b&7;(b=a.B=(b&56)>>3)?c=Mb(a.h,a.M(b,d,2)):c=-d-1;return c}function Yc(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return Tc(a,b,c,8)}
function Zc(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.M(b,c,3),a=Kb(a.h,c)):a=a.f[c]&255;return a}function $c(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?Mb(a.h,a.M(b,c,2)):a.f[c]}function S(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.zb=a.M(b,e,7),c=0>c?a.f[-c-1]&255:c,c=d.call(a,c,Kb(a.h,e)),e&1&&a.a--,Nb(a.h,e,c)):(b=a.f[e],c=0>c?a.f[-c-1]&255:c,a.f[e]=b&65280|d.call(a,c,b&255))}
function Zc(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.M(b,c,3),a=Kb(a.h,c)):a=a.f[c]&255;return a}function $c(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?Mb(a.h,a.M(b,c,2)):a.f[c]}function S(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.Ab=a.M(b,e,7),c=0>c?a.f[-c-1]&255:c,c=d.call(a,c,Kb(a.h,e)),e&1&&a.a--,Nb(a.h,e,c)):(b=a.f[e],c=0>c?a.f[-c-1]&255:c,a.f[e]=b&65280|d.call(a,c,b&255))}
function U(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.M(b,e,6),Ob(a.h,e,d.call(a,0>c?a.f[-c-1]:c,Mb(a.h,e)))):a.f[e]=d.call(a,0>c?a.f[-c-1]:c,a.f[e])}function ad(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(d=a.M(b,e,5),e=c=0>c?a.f[-c-1]&255:c,d&1&&a.a--,Nb(a.h,d,e)):c?(c=0>c?a.f[-c-1]&255:c,a.f[e]=a.f[e]&~d|c<<24>>24&d):a.f[e]&=~d;return c}function bd(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=a.M(b,d,4),Ob(a.h,d,c=0>c?a.f[-c-1]:c)):a.f[d]=c=0>c?a.f[-c-1]:c;return c}
function V(a,b,c){c&&(Q(a,a.f[7]+(b<<24>>23)),a.a-=2);a.a-=3}
h.pb=function(a){this.j.complete=!0;var b=a?this.j.Gb?0:1:-1;this.j.Gb=!1;this.sa=this.a=a;do{if(this.u){if(a=this.u&7){a=!1;if(this.u&2){this.u&=-3;var c=160,d=(this.Fb&224)>>5,e=this.O&&this.O.La>d?this.O:null;e&&(c=e.td,d=e.La);d>(this.C&224)>>5?(this.u&4&&(Hc(this,2),this.u&=-5),K(this,c,0,-9),d=!0):d=!1;d&&(e&&Ic(this,e),a=!0)}else this.u&1&&this.u++;a=a&&0>b}if(a)break;if(this.u&112&&Jc(this)&&0>b)break}this.u=this.u&7|this.C&16;this.decode(Gc(this))}while(0<this.a);return this.j.complete?this.sa-
h.qb=function(a){this.j.complete=!0;var b=a?this.j.Hb?0:1:-1;this.j.Hb=!1;this.sa=this.a=a;do{if(this.u){if(a=this.u&7){a=!1;if(this.u&2){this.u&=-3;var c=160,d=(this.Gb&224)>>5,e=this.O&&this.O.La>d?this.O:null;e&&(c=e.ud,d=e.La);d>(this.C&224)>>5?(this.u&4&&(Hc(this,2),this.u&=-5),K(this,c,0,-9),d=!0):d=!1;d&&(e&&Ic(this,e),a=!0)}else this.u&1&&this.u++;a=a&&0>b}if(a)break;if(this.u&112&&Jc(this)&&0>b)break}this.u=this.u&7|this.C&16;this.decode(Gc(this))}while(0<this.a);return this.j.complete?this.sa-
this.a:void 0===this.j.complete?0:-1};Ga(function(){for(var a=E(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Bc(d);D(d,c)}});function cd(a,b){var c=b+a;Lc(this,c,a,b);return c&65535}function dd(a,b){var c=b+a;Lc(this,c<<8,a<<8,b<<8);return c&255}function ed(a,b){a=b<<1;Mc(this,a);return a&65535}function fd(a,b){a=b<<1;Mc(this,a<<8);return a&255}function gd(a,b){a=b&32768|b>>1|b<<16;Mc(this,a);return a&65535}function hd(a,b){a=b&128|b>>1|b<<8;Mc(this,a<<8);return a&255}
function id(a,b){a=b&~a;R(this,a);return a}function jd(a,b){a=b&~a;R(this,a<<8);return a}function kd(a,b){a|=b;R(this,a);return a}function ld(a,b){a|=b;R(this,a<<8);return a}function md(a,b){a=~b|65536;Kc(this,a);return a&65535}function nd(a,b){a=~b|256;Kc(this,a<<8);return a&255}function od(a,b){a=b-a;this.u&128||(this.s=this.i=a,this.g=b&(b^a));return a&65535}function pd(a,b){a=b-a;var c=a<<8;b<<=8;this.u&128||(this.s=this.i=c,this.g=b&(b^c));return a&255}
function qd(a,b){a=b+a;this.u&128||(this.s=this.i=a,this.g=a&(b^a));return a&65535}function rd(a,b){a=b+a;var c=a<<8;this.u&128||(this.s=this.i=c,this.g=c&(b<<8^c));return a&255}function sd(a,b){a=-b;Kc(this,a,a&b&32768);return a&65535}function td(a,b){a=-b;Kc(this,a<<8,(a&b&128)<<8);return a&255}function ud(a,b){a=b<<1|this.m>>16&1;Mc(this,a);return a&65535}function vd(a,b){a=b<<1|this.m>>16&1;Mc(this,a<<8);return a&255}function wd(a,b){a=(this.m&65536|b)>>1|b<<16;Mc(this,a);return a&65535}
@ -146,27 +146,27 @@ var ze=[function(a){Qe[a>>8&15].call(this,a)},le,ae,Ld,Hd,Jd,Cd,Y,function(a){Re
sd);this.a-=this.c?11:6},function(a){U(this,a,P(this)?1:0,cd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,P(this)?1:0,yd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=$c(this,a);Kc(this,a);this.a-=this.c?4:3+(7==this.b?2:0)}],Fe=[function(a){U(this,a,0,wd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,ud);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,gd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,ed);this.a-=this.c?9:3+(7==this.b?2:0)}],
Se=[function(a){Te[a&15].call(this,a)},Y,Y,Y,he,he,he,he,re,Y,Ge,Ie,ve,ve,ve,ve],Te=[ee,xe,se,Xd,fe,qe,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y],He=[pe,function(){this.m=0;this.a-=5},function(){this.g=0;this.a-=5},W,function(){this.i=1;this.a-=5},W,W,W,function(){this.s=0;this.a-=5},W,W,W,W,W,W,W],Je=[pe,function(){this.m=65536;this.a-=5},function(){this.g=32768;this.a-=5},X,function(){this.i=0;this.a-=5},X,X,X,function(){this.s=32768;this.a-=5},X,X,X,X,X,X,X],Re=[Wd,Ud,Qd,Sd,Zd,$d,Fd,Gd,de,we,Ke,Me,Oe,Y,Y,Y],Le=[function(a){Kc(this,
ad(this,a,0,255));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,0,nd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,1,rd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,1,pd);this.a-=this.c?9:3+(7==this.b?2:0)}],Ne=[function(a){S(this,a,0,td);this.a-=this.c?11:6},function(a){S(this,a,P(this)?1:0,dd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,P(this)?1:0,zd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Zc(this,a);Kc(this,a<<8);this.a-=this.c?4:3+(7==
this.b?2:0)}],Pe=[function(a){S(this,a,0,xd);this.a-=this.c?9+(this.zb&1):3+(7==this.b?2:0)},function(a){S(this,a,0,vd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,0,hd);this.a-=this.c?9+(this.zb&1):3+(7==this.b?2:0)},function(a){S(this,a,0,fd);this.a-=this.c?9:3+(7==this.b?2:0)}];function Dc(a){Ue[a>>12].call(this,a)}
this.b?2:0)}],Pe=[function(a){S(this,a,0,xd);this.a-=this.c?9+(this.Ab&1):3+(7==this.b?2:0)},function(a){S(this,a,0,vd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,0,hd);this.a-=this.c?9+(this.Ab&1):3+(7==this.b?2:0)},function(a){S(this,a,0,fd);this.a-=this.c?9:3+(7==this.b?2:0)}];function Dc(a){Ue[a>>12].call(this,a)}
var Ue=[function(a){Ve[a>>8&15].call(this,a)},le,ae,Ld,Hd,Jd,Cd,function(a){We[a>>8&15].call(this,a)},function(a){Xe[a>>8&15].call(this,a)},me,be,Md,Id,Kd,ue,Y],Ve=[function(a){Ye[a>>4&15].call(this,a)},Yd,Vd,Nd,Od,Td,Pd,Rd,je,je,Ae,Ce,Ee,function(a){Ze[a>>6&3].call(this,a)},Y,Y],Ze=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=this.V(a|this.R);Q(this,this.f[5]);this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=Uc(this,a,0);Oc(this,a);R(this,a);this.a-=11},function(a){var b=Qc(this);this.I=
this.a;Vc(this,a,0,b);R(this,b);this.a=this.I-ne[this.c]},function(a){R(this,bd(this,a,Fc(this)?65535:0));this.a-=this.c?9:3+(7==this.b?2:0)}],Ye=[function(a){$e[a&15].call(this,a)},Y,Y,Y,he,he,he,he,re,function(a){a&8?(this.C&49152||(this.C=this.C&-2017|(a&7)<<5,this.u|=1),this.a-=5):K(this,8,0,-8)},Ge,Ie,ve,ve,ve,ve],$e=[ee,xe,function(){Pc(this);this.u|=this.C&16;this.a-=13},Xd,fe,qe,se,function(){K(this,8,0,-8)},Y,Y,Y,Y,Y,Y,Y,Y],We=[oe,oe,ce,ce,Dd,Dd,Ed,Ed,ye,ye,Y,Y,Y,Y,te,te],Xe=[Wd,Ud,Qd,Sd,
Zd,$d,Fd,Gd,de,we,Ke,Me,Oe,function(a){af[a>>6&3].call(this,a)},Y,Y],af=[Y,function(a){a=Uc(this,a,65536);Oc(this,a);R(this,a);this.a-=11},function(a){var b=Qc(this);this.I=this.a;Vc(this,a,65536,b);R(this,b);this.a=this.I-ne[this.c]},Y];
function bf(a){y.call(this,"ROM",a,bf,256);this.W=this.c=null;this.i=a.addr;this.b=a.size;this.m=!1;this.g=a.alias;this.l=a.file;this.s=q(this.l);if(this.l){a=this.l;var b=la(this.s);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.l+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?(c.G("Unable to load ROM resource (error "+f+": "+a+")"),c.l=null):(Ra(c.qa,a,b),(a=ta(a,b))?(c.c=a.K,c.W=a.W):c.l=null);cf(c)})}}A(bf);h=bf.prototype;
h.ja=function(a,b,c,d){this.h=b;this.a=c;this.F=d;cf(this)};h.la=function(){this.W&&(this.F&&this.F.a(this.id,this.i,this.b,this.W),delete this.W);return!0};h.ka=function(){return!0};
function cf(a){if(!Va(a)){if(a.l){if(!a.c||!a.h)return;a.b||(a.b=a.c.length);if(a.c.length!=a.b)Wa(a,"ROM size ("+m(a.c.length,8,!0)+") does not match specified size ("+m(a.b,8,!0)+")");else{var b;a:{b=a.i;a.status(a.b+"-byte ROM at "+ka(b));if(57344<=b&&b<57344+H){var c={};b=(c[b]=[bf.prototype.Zc,bf.prototype.Vd,null,null,null,a.b>>1],c);if(cb(a.h,a,b)){b=a.m=!0;break a}}else if(Fb(a.h,b,a.b,gc)){for(c=0;c<a.c.length;c++)a.h.Za(b+c,a.c[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.g?b.push(a.g):
null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){var d=a,e=b[c],f=Eb(d.h,d.i,d.b);Db(d.h,e,d.b,f)}a.m||delete a.c}}}F(a)}}h.Zc=function(a){return this.c[a-this.i]};h.Vd=function(){};Ga(function(){for(var a=E(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new bf(d);D(d,c)}});
function cf(a){if(!Va(a)){if(a.l){if(!a.c||!a.h)return;a.b||(a.b=a.c.length);if(a.c.length!=a.b)Wa(a,"ROM size ("+m(a.c.length,8,!0)+") does not match specified size ("+m(a.b,8,!0)+")");else{var b;a:{b=a.i;a.status(a.b+"-byte ROM at "+ka(b));if(57344<=b&&b<57344+H){var c={};b=(c[b]=[bf.prototype.$c,bf.prototype.Wd,null,null,null,a.b>>1],c);if(cb(a.h,a,b)){b=a.m=!0;break a}}else if(Fb(a.h,b,a.b,gc)){for(c=0;c<a.c.length;c++)a.h.$a(b+c,a.c[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.g?b.push(a.g):
null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){var d=a,e=b[c],f=Eb(d.h,d.i,d.b);Db(d.h,e,d.b,f)}a.m||delete a.c}}}F(a)}}h.$c=function(a){return this.c[a-this.i]};h.Wd=function(){};Ga(function(){for(var a=E(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new bf(d);D(d,c)}});
function df(a){y.call(this,"RAM",a,df);this.W=this.c=null;this.l=a.addr;this.i=a.size;this.ha=a.load;this.ga=a.exec;this.g=!1;this.b=a.file;this.m=q(this.b);if(this.b){a=this.b;var b=la(this.m);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?(c.G("Unable to load RAM resource (error "+f+": "+a+")"),c.b=null):(Ra(c.qa,a,b),(a=ta(a,b))?(c.c=a.K,c.W=a.W,null==c.ha&&(c.ha=a.ha),null==c.ga&&(c.ga=a.ga)):c.b=null);ef(c)})}}A(df);
df.prototype.ja=function(a,b,c,d){this.h=b;this.a=c;this.F=d;ef(this)};df.prototype.la=function(){this.W&&(this.F&&this.F.a(this.id,this.l,this.i,this.W),delete this.W);return!0};df.prototype.ka=function(){return!0};function ef(a){if(a.h&&(!a.g&&a.i&&Fb(a.h,a.l,a.i,Ib)&&(a.g=!0),!Va(a))){if(!a.g)t("No RAM allocated");else if(a.b){if(!a.c||!a.h)return;ff(a,a.c,a.ha,a.ga,a.l)}F(a)}}
df.prototype.reset=function(){if(this.g){for(var a=this.h,b=this.l,c=this.i,d=b&a.l,b=b>>>a.c;0<c&&b<a.h.length;){var e=a.h[b];if(e.controller&&a.i&&a.i.length==a.v.length){var f=a.i.indexOf(e);0<=f&&(e=a.v[f])}if(e){var f=c,g=0,k,d=d||0,g=g&255;void 0===f&&(f=e.size);if(Xa&&e.o)for(k=d;f--&&k<e.o.length;k++)e.o[k]=g;else for(k=d;f--&&k<e.size;k++)e.Jb(d,g,e.Ka+d)}c-=a.b;b++;d=0}this.c&&ff(this,this.c,this.ha,this.ga,this.l,!0)}};
function ff(a,b,c,d,e,f){var g=!1;if(null==c)for(var k=0;k<b.length-1;){var l=b[k]&255|(b[k+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(k+6>=b.length)break;for(var k=k+2,n=b[k++]&255|(b[k++]&255)<<8,p=b[k++]&255|(b[k++]&255)<<8,l=l+((n&255)+(n>>8)+(p&255)+(p>>8)),u=k,w=n-=6;0<n&&k<b.length;)l+=b[k++]&255,n--;if(n||k>=b.length)break;l+=b[k++]&255;if(l&255)break;if(w)for(;w--;)a.a.Za(p++,b[u++]&255);else p&1?G(a.a):null==d&&(d=p);g=!0}else k++;else k+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.a.Za(c+
g,b[g]);g=!0}g&&null!=d&&(a=a.a,a.Rb=d,a.h.reset(),lb(a),Q(a,d),$b(a,0),!f&&a.F&&(G(a)||a.F.c()));return g}Ga(function(){for(var a=E(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new df(d);D(d,c)}});function gf(a){y.call(this,"Keyboard",a,gf,65536);F(this)}A(gf);gf.prototype.$=function(){return!1};gf.prototype.ja=function(a,b,c,d){this.l=a;this.a=c;this.F=d};Ga(function(){for(var a=E(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new gf(d);D(d,c)}});
function Z(a){this.D=a.baudReceive||9600;this.R=a.baudTransmit||9600;this.O=a.upperCase;this.g=this.m=null;this.J=a.tabSize;this.I=a.charBOL;this.s=0;y.call(this,"SerialPort",a,Z,8388608);var b=a.binding;if("console"==b)this.m="";else{var c;a=hf;b&&(void 0===c&&(c="Panel"),(c=Ta(c,this.id))&&(b=c.o[b])&&this.$(null,a,b))}this.v=this.A=null;this.exports={connect:this.Ob,receiveData:this.mb}}A(Z);var hf="buffer";h=Z.prototype;
h.$=function(a,b,c){var d=this;switch(b){case hf:return this.o[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.mb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.mb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.mb(a.getData("Text"))},
df.prototype.reset=function(){if(this.g){for(var a=this.h,b=this.l,c=this.i,d=b&a.l,b=b>>>a.c;0<c&&b<a.h.length;){var e=a.h[b];if(e.controller&&a.i&&a.i.length==a.v.length){var f=a.i.indexOf(e);0<=f&&(e=a.v[f])}if(e){var f=c,g=0,k,d=d||0,g=g&255;void 0===f&&(f=e.size);if(Xa&&e.o)for(k=d;f--&&k<e.o.length;k++)e.o[k]=g;else for(k=d;f--&&k<e.size;k++)e.Kb(d,g,e.Ka+d)}c-=a.b;b++;d=0}this.c&&ff(this,this.c,this.ha,this.ga,this.l,!0)}};
function ff(a,b,c,d,e,f){var g=!1;if(null==c)for(var k=0;k<b.length-1;){var l=b[k]&255|(b[k+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(k+6>=b.length)break;for(var k=k+2,n=b[k++]&255|(b[k++]&255)<<8,p=b[k++]&255|(b[k++]&255)<<8,l=l+((n&255)+(n>>8)+(p&255)+(p>>8)),u=k,w=n-=6;0<n&&k<b.length;)l+=b[k++]&255,n--;if(n||k>=b.length)break;l+=b[k++]&255;if(l&255)break;if(w)for(;w--;)a.a.$a(p++,b[u++]&255);else p&1?G(a.a):null==d&&(d=p);g=!0}else k++;else k+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.a.$a(c+
g,b[g]);g=!0}g&&null!=d&&(a=a.a,a.Sb=d,a.h.reset(),lb(a),Q(a,d),$b(a,0),!f&&a.F&&(G(a)||a.F.c()));return g}Ga(function(){for(var a=E(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new df(d);D(d,c)}});function gf(a){y.call(this,"Keyboard",a,gf,65536);F(this)}A(gf);gf.prototype.$=function(){return!1};gf.prototype.ja=function(a,b,c,d){this.l=a;this.a=c;this.F=d};Ga(function(){for(var a=E(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new gf(d);D(d,c)}});
function Z(a){this.D=a.baudReceive||9600;this.R=a.baudTransmit||9600;this.O=a.upperCase;this.g=this.m=null;this.J=a.tabSize;this.I=a.charBOL;this.s=0;y.call(this,"SerialPort",a,Z,8388608);var b=a.binding;if("console"==b)this.m="";else{var c;a=hf;b&&(void 0===c&&(c="Panel"),(c=Ta(c,this.id))&&(b=c.o[b])&&this.$(null,a,b))}this.v=this.A=null;this.exports={connect:this.Pb,receiveData:this.nb}}A(Z);var hf="buffer";h=Z.prototype;
h.$=function(a,b,c){var d=this;switch(b){case hf:return this.o[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.nb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.nb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.nb(a.getData("Text"))},
c.removeAttribute("readonly"),!0}return!1};h.ja=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.F=d;var e=this;this.ba=Vb(48,4);this.M=Sb(this.a,function(){e.b&128||!e.i.length||(e.w=e.i.shift()&255,e.O&&97<=e.w&&122>e.w&&(e.w-=32),e.b|=128,e.b&64&&Tb(e.a,e.ba))});this.B=Vb(52,4);this.aa=Sb(this.a,function(){e.c|=128;e.c&64&&Tb(e.a,e.B)});cb(b,this,jf);eb(b,this.reset.bind(this));F(this)};
h.Ob=function(){if(!this.v){var a=tc(this.l,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.za)return;b=pa(b[1]);if(this.v=Sa(b)){var d=this.v.exports;if(d){var e=d.connect;e&&e.call(this.v);if(this.A=d.receiveData){this.status(this.qa+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.la=function(a,b){if(!b)if(this.Ob(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.ka=function(a){return a?this.save():!0};h.reset=function(){kf(this)};h.save=function(){var a=new O(this);a.set(0,[]);return a.data()};h.restore=function(){return kf(this)};function kf(a){a.w=0;a.b=0;a.c=128;a.i=[];return!0}h.mb=function(a){if("number"==typeof a)this.i.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.i.push(a.charCodeAt(b));else this.i=this.i.concat(a);Ub(this.a,this.M,1E3/Math.round(this.D/10));return!0};h.Tc=function(){return this.b&65534};
h.Pd=function(a){this.b=this.b&-112|a&111};h.Sc=function(){this.b&=-129;0<this.i.length&&Ub(this.a,this.M,1E3/Math.round(this.D/10));return this.w};h.Od=function(){};h.nd=function(){return this.c};h.ie=function(a){this.c&128&&(a&64?Tb(this.a,this.B):Ic(this.a,this.B));this.c=this.c&-70|a&69};h.md=function(){return 0};
h.he=function(a){if(a&=255){this.A&&this.A.call(this.v,a);a&=127;if(this.g)if(13==a)this.s=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.s&&this.s--;else{var b;b=(b=qa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.J||8,c=a-this.s%a,this.J&&(b=" ".slice(0,c)));this.I&&!this.s&&c&&(b=String.fromCharCode(this.I)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.s+=c}else if(null!=this.m){if(10==a||1024<=
this.m.length)this.T(this.m),this.m="";10!=a&&(this.m+=String.fromCharCode(a))}this.c&=-129;Ub(this.a,this.aa,1E3/Math.round(this.R/10))}};var lf={},jf=(lf[65392]=[null,null,Z.prototype.Tc,Z.prototype.Pd,"RCSR"],lf[65394]=[null,null,Z.prototype.Sc,Z.prototype.Od,"RBUF"],lf[65396]=[null,null,Z.prototype.nd,Z.prototype.ie,"XCSR"],lf[65398]=[null,null,Z.prototype.md,Z.prototype.he,"XBUF"],lf);Ga(function(){for(var a=E(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Z(d);D(d,c)}});
h.Pb=function(){if(!this.v){var a=tc(this.l,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.za)return;b=pa(b[1]);if(this.v=Sa(b)){var d=this.v.exports;if(d){var e=d.connect;e&&e.call(this.v);if(this.A=d.receiveData){this.status(this.qa+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.la=function(a,b){if(!b)if(this.Pb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.ka=function(a){return a?this.save():!0};h.reset=function(){kf(this)};h.save=function(){var a=new O(this);a.set(0,[]);return a.data()};h.restore=function(){return kf(this)};function kf(a){a.w=0;a.b=0;a.c=128;a.i=[];return!0}h.nb=function(a){if("number"==typeof a)this.i.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d<a.length;d++){c=b;b=a.charCodeAt(d);if(10==b){if(13==c)continue;b=13}this.i.push(b)}else this.i=this.i.concat(a);Ub(this.a,this.M,1E3/Math.round(this.D/10));return!0};
h.Uc=function(){return this.b&65534};h.Qd=function(a){this.b=this.b&-112|a&111};h.Tc=function(){this.b&=-129;0<this.i.length&&Ub(this.a,this.M,1E3/Math.round(this.D/10));return this.w};h.Pd=function(){};h.od=function(){return this.c};h.je=function(a){this.c&128&&(a&64?Tb(this.a,this.B):Ic(this.a,this.B));this.c=this.c&-70|a&69};h.nd=function(){return 0};
h.ie=function(a){if(a&=255){this.A&&this.A.call(this.v,a);a&=127;if(this.g)if(13==a)this.s=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.s&&this.s--;else{var b;b=(b=qa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.J||8,c=a-this.s%a,this.J&&(b=" ".slice(0,c)));this.I&&!this.s&&c&&(b=String.fromCharCode(this.I)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.s+=c}else if(null!=this.m){if(10==a||1024<=
this.m.length)this.T(this.m),this.m="";10!=a&&(this.m+=String.fromCharCode(a))}this.c&=-129;Ub(this.a,this.aa,1E3/Math.round(this.R/10))}};var lf={},jf=(lf[65392]=[null,null,Z.prototype.Uc,Z.prototype.Qd,"RCSR"],lf[65394]=[null,null,Z.prototype.Tc,Z.prototype.Pd,"RBUF"],lf[65396]=[null,null,Z.prototype.od,Z.prototype.je,"XCSR"],lf[65398]=[null,null,Z.prototype.nd,Z.prototype.ie,"XBUF"],lf);Ga(function(){for(var a=E(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Z(d);D(d,c)}});
function ac(a){y.call(this,"PC11",a,ac);this.c=a.autoMount||null;this.m=0;this.O=a.baudReceive||3600;this.w=this.A=this.b=0;this.v=[];this.s=mf;this.g=nf;this.B=this.i="";this.K=this.ha=this.ga=null;this.I=-1;this.D=!Ba("Mobi")&&window&&"FileReader"in window}A(ac);var mf="",nf=0;h=ac.prototype;
h.$=function(a,b,c){var d=this,e=nf;switch(b){case "listTapes":return this.o[b]=c,c.onchange=function(){var a=d.o.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){t("PC11 option error: "+l.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.o[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.o[b]=c,c.onclick=function(){var a=
d.o.listTapes;a&&of(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.D){c.parentNode.removeChild(c);break}this.o[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;of(d,q(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.o[b]=c,!0}return!1};
@ -176,16 +176,16 @@ function of(a,b,c,d,e){if(c)if("?"==c)a.G('Use "Choose File" and "Mount" to sele
function xf(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),yf(a,b,c,d,e),a.s="?");vf(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=la(c),f="json"==e||"gz"==e?encodeURI(c):v()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!r(f,null,!0,function(e,f,g){var k=0>g&&a.l&&!a.l.j.N;g?a.G('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(Ra(a.qa,e,f),(e=ta(e,f))&&yf(a,b,c,d,e.K,e.ha,e.ga));
a.j.Da=!1;a.m&&(a.m--,a.m||F(a));vf(a)})}function sf(a,b,c,d){if((a=a.o.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}function vf(a){var b=a.o.listTapes;if(b&&b.options){a=a.s||a.i;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}
function qf(a,b){b|=0;if(b!==a.I){var c=a.o.readProgress;c&&(c=(c=E(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.I=b}}function yf(a,b,c,d,e,f,g){a.B=b;a.i=c;a.g=d;a.K=e;a.ha=f;a.ga=g;2==d?a.J&&ff(a.J,e,f,g)?a.status("tape loaded: "+b):(a.B="",a.i="",a.s=mf,a.g=nf,a.G("No load address available for tape: "+b)):(a.w=0,a.v=e,a.status("tape attached: "+b),qf(a,0))}
function wf(a,b){if(a.i||!1===b)a.B="",a.i="",b||(a.g&&a.status(1==a.g?"tape detached":"tape unloaded"),a.s=mf,a.g=nf,vf(a))}h.save=function(){return(new O(this)).data()};h.restore=function(){return!0};h.Mc=function(){return this.b&65534};h.Id=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&Tb(this.a,this.M)):(this.b&=-129,this.b|=2048,this.A=0,Ub(this.a,this.R,1E3/Math.round(this.O/10))));this.b=this.b&-66|a&65};h.Lc=function(){this.b&=-129;this.b|=2048;return this.A};h.Hd=function(){};
var zf={},rf=(zf[65384]=[null,null,ac.prototype.Mc,ac.prototype.Id,"PRS"],zf[65386]=[null,null,ac.prototype.Lc,ac.prototype.Hd,"PRB"],zf);function Af(a,b,c){y.call(this,"Disk",{id:a.qa+".disk"+m(++Bf,4)},Af,4194304);this.controller=a;this.l=a.l;this.F=a.F;this.g=b;this.xa=b.name;this.wb=b.wb;Cf(this,c,b.U,b.Y,b.S,b.ia);F(this)}var Bf=0;A(Af);h=Af.prototype;h.ja=function(a,b,c,d){this.F=d};
function wf(a,b){if(a.i||!1===b)a.B="",a.i="",b||(a.g&&a.status(1==a.g?"tape detached":"tape unloaded"),a.s=mf,a.g=nf,vf(a))}h.save=function(){return(new O(this)).data()};h.restore=function(){return!0};h.Nc=function(){return this.b&65534};h.Jd=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&Tb(this.a,this.M)):(this.b&=-129,this.b|=2048,this.A=0,Ub(this.a,this.R,1E3/Math.round(this.O/10))));this.b=this.b&-66|a&65};h.Mc=function(){this.b&=-129;this.b|=2048;return this.A};h.Id=function(){};
var zf={},rf=(zf[65384]=[null,null,ac.prototype.Nc,ac.prototype.Jd,"PRS"],zf[65386]=[null,null,ac.prototype.Mc,ac.prototype.Id,"PRB"],zf);function Af(a,b,c){y.call(this,"Disk",{id:a.qa+".disk"+m(++Bf,4)},Af,4194304);this.controller=a;this.l=a.l;this.F=a.F;this.g=b;this.xa=b.name;this.xb=b.xb;Cf(this,c,b.U,b.Y,b.S,b.ia);F(this)}var Bf=0;A(Af);h=Af.prototype;h.ja=function(a,b,c,d){this.F=d};
function Cf(a,b,c,d,e,f){a.mode=b;a.U=c;a.Y=d;a.S=e;a.ia=f;a.a=[];if("preload"!=a.mode){b=Array(a.U);for(c=0;c<b.length;c++){d=Array(a.Y);for(e=0;e<d.length;e++){f=Array(a.S);for(var g=1;g<=f.length;g++)f[g-1]=Df(null,c,e,g,a.ia,0);d[e]=f}b[c]=d}a.a=b}a.b=null}
function Ef(a,b,c,d,e){var f=c;if(a.h)return!0;a.xa=b;a.Ca=c;a.$b=q(c);a.h=e;a.i=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ia[d];if(e){a.U=e[0];a.Y=e[1];a.S=e[2];a.ia=e[3]||512;c=a.ia>>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.U);for(d=0;d<a.a.length;d++)for(var w=a.a[d]=Array(a.Y),T=0;T<w.length;T++)for(var xa=w[T]=Array(a.S),ya=0;ya<xa.length;ya++){for(var lc=Df(null,d,T,ya+1,a.ia,0),fg=lc.data,mc=0;mc<c;mc++,f+=4)var gg=fg[mc]=b.getInt32(f,
!0),e=e+gg&-1;lc.ca=c;xa[ya]=lc}a.b=e;c=a}else a.G("Unrecognized disk format ("+d+" bytes)");a.h&&(a.h.call(a.controller,a.g,c,a.xa,a.Ca),a.h=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=la(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ma(c,"/")&&(d="dir"),f=v()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.wb?"":e)+"&format=json"));return!!r(f,
function Ef(a,b,c,d,e){var f=c;if(a.h)return!0;a.xa=b;a.Ca=c;a.ac=q(c);a.h=e;a.i=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ia[d];if(e){a.U=e[0];a.Y=e[1];a.S=e[2];a.ia=e[3]||512;c=a.ia>>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.U);for(d=0;d<a.a.length;d++)for(var w=a.a[d]=Array(a.Y),T=0;T<w.length;T++)for(var xa=w[T]=Array(a.S),ya=0;ya<xa.length;ya++){for(var lc=Df(null,d,T,ya+1,a.ia,0),fg=lc.data,mc=0;mc<c;mc++,f+=4)var gg=fg[mc]=b.getInt32(f,
!0),e=e+gg&-1;lc.ca=c;xa[ya]=lc}a.b=e;c=a}else a.G("Unrecognized disk format ("+d+" bytes)");a.h&&(a.h.call(a.controller,a.g,c,a.xa,a.Ca),a.h=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=la(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ma(c,"/")&&(d="dir"),f=v()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.xb?"":e)+"&format=json"));return!!r(f,
null,!0,function(b,c,d){Ff(a,b,c,d)})}
function Ff(a,b,c,d){var e=null;a.c=!1;var f=0>d&&a.l&&!a.l.j.N;if(d)a.controller.G('Unable to load disk "'+a.xa+'" (error '+d+": "+b+")",f);else{Ra(a.controller.qa,b,c);try{if(0<q(a.$b,!0).toLowerCase().indexOf("-readonly"))a.c=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.c=!0)}var k;"<"==c.substr(0,1)?k=["Missing disk image: "+a.xa]:k=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
function Ff(a,b,c,d){var e=null;a.c=!1;var f=0>d&&a.l&&!a.l.j.N;if(d)a.controller.G('Unable to load disk "'+a.xa+'" (error '+d+": "+b+")",f);else{Ra(a.controller.qa,b,c);try{if(0<q(a.ac,!0).toLowerCase().indexOf("-readonly"))a.c=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.c=!0)}var k;"<"==c.substr(0,1)?k=["Missing disk image: "+a.xa]:k=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(k.length)if(1==k.length)t(k[0]);else{a.U=k.length;a.Y=k[0].length;a.S=k[0][0].length;var l=k[0][0][0];a.ia=l&&l.length||512;for(d=c=0;d<a.U;d++)for(f=0;f<a.Y;f++)for(g=0;g<a.S;g++)if(l=k[d][f][g]){var n=l.length;void 0===n&&(n=l.length=512);var n=n>>2,p=l.pattern;void 0===p&&(p=l.pattern=0);var u=l.data;if(void 0===u){var w=l.bytes;if(void 0!==w&&w.length){for(var T=n<<2,xa=w.length;xa<T;xa++)w[xa]=p;Gf(l,w)}else u=[],p=l.pattern=p|p<<8|p<<16|p<<24,l.data=u;delete l.bytes}Df(l,d,f);for(T=
0;T<u.length;T++)c=c+u[T]&-1}a.a=k;a.b=c;e=a}else t("Empty disk image: "+a.xa)}catch(ya){t("Disk image error ("+b+"): "+ya.message)}}a.h&&(a.h.call(a.i,a.g,e,a.xa,a.Ca),a.h=null)}function Df(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.le=b;a.me=c;a.na=a.ca=0;a.wa=!1;return a}
h.seek=function(a,b,c,d,e){d=null;var f=this.g,g=this.a[a];if(g){var k=g[b];if(!k&&f.gc&&b<f.Y)for(k=g[b]=Array(f.hc),g=0;g<k.length;g++)k[g]=Df(null,a,b,g+1,f.Pb,0);if(k){for(g=0;g<k.length;g++)if(k[g]&&k[g].sector==c){d=k[g];break}!d&&f.gc&&9==f.Kb&&(d=k[g]=Df(null,a,b,f.Kb,f.Pb,0))}}e&&e(d,!1);return d};function Gf(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
0;T<u.length;T++)c=c+u[T]&-1}a.a=k;a.b=c;e=a}else t("Empty disk image: "+a.xa)}catch(ya){t("Disk image error ("+b+"): "+ya.message)}}a.h&&(a.h.call(a.i,a.g,e,a.xa,a.Ca),a.h=null)}function Df(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.me=b;a.ne=c;a.na=a.ca=0;a.wa=!1;return a}
h.seek=function(a,b,c,d,e){d=null;var f=this.g,g=this.a[a];if(g){var k=g[b];if(!k&&f.hc&&b<f.Y)for(k=g[b]=Array(f.ic),g=0;g<k.length;g++)k[g]=Df(null,a,b,g+1,f.Qb,0);if(k){for(g=0;g<k.length;g++)if(k[g]&&k[g].sector==c){d=k[g];break}!d&&f.hc&&9==f.Lb&&(d=k[g]=Df(null,a,b,f.Lb,f.Qb,0))}}e&&e(d,!1);return d};function Gf(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
h.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.c)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.ca?f<a.na?(a.ca+=a.na-f,a.na=f):f>=a.na+a.ca&&(a.ca+=f-(a.na+a.ca)+1):(a.na=f,a.ca=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
function Hf(a,b){var c=a.Y*a.S,d=b/c|0;return d<a.U?(b%=c,a.seek(d,b/a.S|0,b%a.S+1)):null}function If(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}h.save=function(){var a=0,b=[];b[a++]=[this.Ca,this.b,this.U,this.Y,this.S,this.ia];if(!this.c)for(var c=this.a,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.ca){for(var k=[],l=0,n=g.na,p=g.na+g.ca;n<p;)k[l++]=g.data[n++];b[a++]=[d,e,f,g.na,k]}}return b};
h.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.a.length&&6<=e.length?Cf(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.b&&e[1]!=this.b&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.b+")",b=-2));for(this.a.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],k=g[f++],l=g[f++],n=g[f++];if(k>=this.a.length||l>=this.a[k].length||n>=this.a[k][l].length){c="sector (CHS="+k+":"+l+":"+n+") out of range ("+
@ -193,46 +193,46 @@ b+" changes applied)";b=-1;break}if(this.c){c="unable to modify write-protected
h.toJSON=function(){var a;a=0;for(var b;b=Hf(this,a++);)Jf(b);a=JSON.stringify(this.a,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function Jf(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function N(a){y.call(this,"RL11",a,N,4194304);this.g=a.autoMount||null;this.s=0;this.b=Array(4);this.A=!Ba("Mobi")&&window&&"FileReader"in window}A(N);h=N.prototype;
h.$=function(a,b,c){var d=this;switch(b){case "listDisks":return this.o[b]=c,c.onchange=function(){var a=d.o.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){t("RL11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.o[b]=c,c.onchange=function(){var a=ja(c.value);null!=a&&Kf(d,a)},!0;case "loadDrive":return this.o[b]=
c,c.onclick=function(){var a=d.o.listDisks;a&&Lf(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.A){c.parentNode.removeChild(c);break}this.o[b]=c;c.onclick=function(){var a=d.o.listDrives;if(a&&a.options&&d.b)if(a=d.b[ja(a.value)||0])if(a=a.da){var b;b="";for(var c=0,k;k=Hf(a,c++);)for(var l=0,n=k.length;l<n;l++)b+=String.fromCharCode(If(a,k,l));b=btoa(b);a=a.$b.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),"string"!=
c,c.onclick=function(){var a=d.o.listDisks;a&&Lf(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.A){c.parentNode.removeChild(c);break}this.o[b]=c;c.onclick=function(){var a=d.o.listDrives;if(a&&a.options&&d.b)if(a=d.b[ja(a.value)||0])if(a=a.da){var b;b="";for(var c=0,k;k=Hf(a,c++);)for(var l=0,n=k.length;l<n;l++)b+=String.fromCharCode(If(a,k,l));b=btoa(b);a=a.ac.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),"string"!=
typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");t(a)}else d.G("No disk loaded in drive.");else d.G("No disk drive selected.")};return!0;case "mountDrive":if(this.A)return this.o[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),
c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Lf(d,q(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
h.ja=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.F=d;if((this.g=tc(this.l,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(e){t("RL11 auto-mount error: "+e.message+" ("+this.g+")"),this.g=null}Mf(this);this.D=Vb(112,5);cb(b,this,Nf);eb(b,this.reset.bind(this));Of(this,"None","",!0);this.A&&Of(this,"Local Disk","?");Of(this,"Remote Disk","??");Pf(this)||F(this)};
h.la=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.l.Mb){for(a=0;a<this.b.length;a++)Qf(this,a,!0);Pf(this,!0)}}else if(!this.restore(a))return!1;if(a=this.o.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Kf(this,0)}}return!0};h.ka=function(a){return a?this.save():!0};h.reset=function(){Mf(this)};h.save=function(){return(new O(this)).data()};
h.la=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.l.Nb){for(a=0;a<this.b.length;a++)Qf(this,a,!0);Pf(this,!0)}}else if(!this.restore(a))return!1;if(a=this.o.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Kf(this,0)}}return!0};h.ka=function(a){return a?this.save():!0};h.reset=function(){Mf(this)};h.save=function(){return(new O(this)).data()};
h.restore=function(a){return Mf(this,a[0])};function Pf(a,b){b||(a.s=0);if(a.g)for(var c in a.g){var d=a.g[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.o.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var k=f.options[g];if(k.value==e){f=k.text;break a}}f=q(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.b.length)){!Rf(a,g,f,e,!0)&&b&&F(a,!1);continue}a.G("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.s}
function Lf(a,b,c,d){var e=a.o.listDrives,e=e&&ja(e.value);if(void 0===e||0>e||e>=a.b.length)a.G("Unable to load the selected drive");else if(c)if("?"==c)a.G('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=q(c);a.status("Attempting to load "+c+' as "'+b+'"')}Rf(a,e,b,c,!1,d)}else Qf(a,e)}
function Rf(a,b,c,d,e,f){var g=-1,k=a.b[b];k.Ca.toLowerCase()!=d.toLowerCase()&&(g++,Qf(a,b,!0),k.vb?a.G("RL11 busy"):(k.vb=!0,e&&(k.ub=!0,a.s++),k.hb=!!f,Ef(new Af(a,k,"preload"),c,d,f,a.kc)&&g++));return g}
h.kc=function(a,b,c,d,e){var f;a.vb=!1;b&&(f=b.a.length?[b.a.length,b.a[0].length,b.a[0][0].length,b.a[0][0][0].length]:[0,0,0,0],b&&f[0]>a.U||f[1]>a.Y)&&(this.G('Disk "'+c+'" too large for drive '+("RL"+a.yb)),b=null);b?(a.da=b,a.xa=c,a.Ca=d,this.G('Mounted disk "'+c+'" in drive '+("RL"+a.yb),a.ub||e),this.l&&zc(this.l)):a.hb=!1;a.ub&&(a.ub=!1,--this.s||F(this));Kf(this,a.yb)};
function Rf(a,b,c,d,e,f){var g=-1,k=a.b[b];k.Ca.toLowerCase()!=d.toLowerCase()&&(g++,Qf(a,b,!0),k.wb?a.G("RL11 busy"):(k.wb=!0,e&&(k.vb=!0,a.s++),k.ib=!!f,Ef(new Af(a,k,"preload"),c,d,f,a.lc)&&g++));return g}
h.lc=function(a,b,c,d,e){var f;a.wb=!1;b&&(f=b.a.length?[b.a.length,b.a[0].length,b.a[0][0].length,b.a[0][0][0].length]:[0,0,0,0],b&&f[0]>a.U||f[1]>a.Y)&&(this.G('Disk "'+c+'" too large for drive '+("RL"+a.zb)),b=null);b?(a.da=b,a.xa=c,a.Ca=d,this.G('Mounted disk "'+c+'" in drive '+("RL"+a.zb),a.vb||e),this.l&&zc(this.l)):a.ib=!1;a.vb&&(a.vb=!1,--this.s||F(this));Kf(this,a.zb)};
function Of(a,b,c,d){if((a=a.o.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function Kf(a,b){if(0<=b&&b<a.b.length){var c=a.b[b],d=a.o.listDisks;a=a.o.listDrives;if(d&&a&&d.options&&a.options&&(a=ja(a.value),c=c.hb?"?":c.Ca,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Qf(a,b,c){var d=a.b[b];if(d.da||!1===c)d.xa="",d.Ca="",d.da=null,d.hb=!1,c||(a.G("Drive RL"+b+" unloaded",c),Kf(a,b))}
function Mf(a,b){var c=0;b||(b=[]);a.L=b[c++]||0;a.v=b[c++]||0;a.c=b[c++]||0;a.i=b[c++]||0;a.m=b[c++]||0;a.w=b[c]||0;for(b=0;b<a.b.length;b++){var d=a.b[b];void 0===d&&(d=a.b[b]={});c=a;d.yb=b;d.vb=d.hb=!1;d.name=c.za;d.U=512;d.Y=2;d.S=40;d.ia=256;d.wb=!0;d.ke=0;d.je=0;d.Kb=1;d.hc=d.S;d.Pb=d.ia;d.ne=0;d.oe=null;d.da||(d.Ca="");d.status=29|(512==d.U?128:0)}return!0}
h.ic=function(a,b,c,d,e,f){this.v=f&65535;this.L=this.L&-49|f>>12&48;this.w=f>>16&63;this.i=this.c=b<<7|(c?64:0)|d&63;this.m=65536-e&65535;a&&(this.L=this.L|a|32768);return!0};
h.zc=function(a,b,c,d,e,f,g){var k=0,l=a.da,n=null,p;l||(k=5120,e=0);for(;e--;){if(!n){n=a.da.seek(b,c,d+1);if(!n){k=5120;break}p=0}var u,w;if(0>(u=a.da.read(n,p++))||0>(w=a.da.read(n,p++))){k=5120;break}Ob(this.h,f,u|w<<8);if(Rb(this.h)){k=8192;break}f+=2;if(p>=l.ia&&(n=null,++d>=l.S&&(d=0,++c>=l.Y&&(c=0,++b>=l.U)))){k=5120;break}}return g(k,b,c,d,e,f)};
h.xd=function(a,b,c,d,e,f,g){var k=0,l=a.da,n=null,p;l||(k=5120,e=0);for(;e--;){var u=Mb(this.h,f);if(Rb(this.h)){k=8192;break}f+=2;if(!n){n=a.da.seek(b,c,d+1,!0);if(!n){k=5120;break}p=0}if(!a.da.write(n,p++,u&255)||!a.da.write(n,p++,u>>8)){k=5120;break}if(p>=l.ia&&(n=null,++d>=l.S&&(d=0,++c>=l.Y&&(c=0,++b>=l.U)))){k=5120;break}}return g(k,b,c,d,e,f)};h.Wc=function(){return this.L&65535};
h.Sd=function(a){this.L=this.L&-1023|a&1022;this.B=this.B&-4|(a&48)>>4;if(!(this.L&128)){var b;a=!0;var c=this.b[(this.L&768)>>8],d,e,f,g;this.L&=-2;switch(this.L&14){case 4:this.c&8&&(this.L&=63);this.m=c.status|this.i&64;break;case 6:1==(this.c&3)&&(b=this.c&65408,c=(this.c&16)<<2,this.i=this.c&4?this.i+b:this.i-b,this.c=this.i=this.i&65408|c);break;case 8:this.m=this.i;break;case 12:b=this.zc;case 10:b||(b=this.xd),d=this.c>>7,e=this.c&64?1:0,f=this.c&63,d>=c.U||f>=c.S?this.L|=37888:(g=(this.w&
63)<<16|this.v,a=65536-this.m&65535,a=b.call(this,c,d,e,f,a,g,this.ic.bind(this)))}a&&(this.L|=129,this.L&64&&Tb(this.a,this.D))}};h.Uc=function(){return this.v};h.Qd=function(a){this.v=a&65534};h.Xc=function(){return this.c};h.Td=function(a){this.c=a};h.Yc=function(){return this.m};h.Ud=function(a){this.m=a};h.Vc=function(){return this.w};h.Rd=function(a){this.w=a&63};
var Sf={},Nf=(Sf[63744]=[null,null,N.prototype.Wc,N.prototype.Sd,"RLCS"],Sf[63746]=[null,null,N.prototype.Uc,N.prototype.Qd,"RLBA"],Sf[63748]=[null,null,N.prototype.Xc,N.prototype.Td,"RLDA"],Sf[63750]=[null,null,N.prototype.Yc,N.prototype.Ud,"RLMP"],Sf[63752]=[null,null,N.prototype.Vc,N.prototype.Rd,"RLBE"],Sf);
function Kf(a,b){if(0<=b&&b<a.b.length){var c=a.b[b],d=a.o.listDisks;a=a.o.listDrives;if(d&&a&&d.options&&a.options&&(a=ja(a.value),c=c.ib?"?":c.Ca,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Qf(a,b,c){var d=a.b[b];if(d.da||!1===c)d.xa="",d.Ca="",d.da=null,d.ib=!1,c||(a.G("Drive RL"+b+" unloaded",c),Kf(a,b))}
function Mf(a,b){var c=0;b||(b=[]);a.L=b[c++]||0;a.v=b[c++]||0;a.c=b[c++]||0;a.i=b[c++]||0;a.m=b[c++]||0;a.w=b[c]||0;for(b=0;b<a.b.length;b++){var d=a.b[b];void 0===d&&(d=a.b[b]={});c=a;d.zb=b;d.wb=d.ib=!1;d.name=c.za;d.U=512;d.Y=2;d.S=40;d.ia=256;d.xb=!0;d.le=0;d.ke=0;d.Lb=1;d.ic=d.S;d.Qb=d.ia;d.oe=0;d.pe=null;d.da||(d.Ca="");d.status=29|(512==d.U?128:0)}return!0}
h.jc=function(a,b,c,d,e,f){this.v=f&65535;this.L=this.L&-49|f>>12&48;this.w=f>>16&63;this.i=this.c=b<<7|(c?64:0)|d&63;this.m=65536-e&65535;a&&(this.L=this.L|a|32768);return!0};
h.Ac=function(a,b,c,d,e,f,g){var k=0,l=a.da,n=null,p;l||(k=5120,e=0);for(;e--;){if(!n){n=a.da.seek(b,c,d+1);if(!n){k=5120;break}p=0}var u,w;if(0>(u=a.da.read(n,p++))||0>(w=a.da.read(n,p++))){k=5120;break}Ob(this.h,f,u|w<<8);if(Rb(this.h)){k=8192;break}f+=2;if(p>=l.ia&&(n=null,++d>=l.S&&(d=0,++c>=l.Y&&(c=0,++b>=l.U)))){k=5120;break}}return g(k,b,c,d,e,f)};
h.yd=function(a,b,c,d,e,f,g){var k=0,l=a.da,n=null,p;l||(k=5120,e=0);for(;e--;){var u=Mb(this.h,f);if(Rb(this.h)){k=8192;break}f+=2;if(!n){n=a.da.seek(b,c,d+1,!0);if(!n){k=5120;break}p=0}if(!a.da.write(n,p++,u&255)||!a.da.write(n,p++,u>>8)){k=5120;break}if(p>=l.ia&&(n=null,++d>=l.S&&(d=0,++c>=l.Y&&(c=0,++b>=l.U)))){k=5120;break}}return g(k,b,c,d,e,f)};h.Xc=function(){return this.L&65535};
h.Td=function(a){this.L=this.L&-1023|a&1022;this.B=this.B&-4|(a&48)>>4;if(!(this.L&128)){var b;a=!0;var c=this.b[(this.L&768)>>8],d,e,f,g;this.L&=-2;switch(this.L&14){case 4:this.c&8&&(this.L&=63);this.m=c.status|this.i&64;break;case 6:1==(this.c&3)&&(b=this.c&65408,c=(this.c&16)<<2,this.i=this.c&4?this.i+b:this.i-b,this.c=this.i=this.i&65408|c);break;case 8:this.m=this.i;break;case 12:b=this.Ac;case 10:b||(b=this.yd),d=this.c>>7,e=this.c&64?1:0,f=this.c&63,d>=c.U||f>=c.S?this.L|=37888:(g=(this.w&
63)<<16|this.v,a=65536-this.m&65535,a=b.call(this,c,d,e,f,a,g,this.jc.bind(this)))}a&&(this.L|=129,this.L&64&&Tb(this.a,this.D))}};h.Vc=function(){return this.v};h.Rd=function(a){this.v=a&65534};h.Yc=function(){return this.c};h.Ud=function(a){this.c=a};h.Zc=function(){return this.m};h.Vd=function(a){this.m=a};h.Wc=function(){return this.w};h.Sd=function(a){this.w=a&63};
var Sf={},Nf=(Sf[63744]=[null,null,N.prototype.Xc,N.prototype.Td,"RLCS"],Sf[63746]=[null,null,N.prototype.Vc,N.prototype.Rd,"RLBA"],Sf[63748]=[null,null,N.prototype.Yc,N.prototype.Ud,"RLDA"],Sf[63750]=[null,null,N.prototype.Zc,N.prototype.Vd,"RLMP"],Sf[63752]=[null,null,N.prototype.Wc,N.prototype.Sd,"RLBE"],Sf);
function Tf(a,b,c){y.call(this,"Computer",a,Tf,67108864);this.j.N=!1;Uf(this,b);this.A=tc(this,"autoPower",a);this.l=0;this.M=a.busWidth||a.buswidth;this.b=Vf;this.s=null;this.i=this.I=!1;this.O=tc(this,"url")||"";(Math.random()+.1).toString(36);this.c=Wf(this);if(this.a=Ta("CPU",this.id)){this.F=Ta("Debugger",this.id);this.h=new vb({id:this.qa+".bus",busWidth:this.M},this.a,this.F);var d,e=B(this.id);if((this.w=Ta("Panel",this.id))&&this.w.Wa)for(b=0;b<e.length;b++)d=e[b],d.G=this.w.G,d.T=this.w.T,
d.Wa=this.w.Wa;this.T("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.T("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.ja&&d.ja(this,this.h,this.a,this.F);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.m=d:this.b=parseInt(d,10));var f;if(a=tc(this,"state")||(f=!0,a.state))b=this.B=a,f||(this.i=!0,this.b=Vf),this.b&&(this.v=
new O(this,"1.30.3"),Xf(this.v)?b=null:delete this.v);!b&&this.b&&(b=Yf(this))&&(this.i=!0);if(b){var g=this;r(b,null,!0,function(a,b,c){c?(g.m=null,g.i=!1,g.G("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.s=b,g.I=!0);F(g)})}else F(this);this.o.power||(this.A=!0);!c&&this.A&&Zf(this,this.Ya)}else t("Unable to find CPU component")}A(Tf);var Vf=0;
new O(this,"1.30.3"),Xf(this.v)?b=null:delete this.v);!b&&this.b&&(b=Yf(this))&&(this.i=!0);if(b){var g=this;r(b,null,!0,function(a,b,c){c?(g.m=null,g.i=!1,g.G("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.s=b,g.I=!0);F(g)})}else F(this);this.o.power||(this.A=!0);!c&&this.A&&Zf(this,this.Za)}else t("Unable to find CPU component")}A(Tf);var Vf=0;
function Uf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.J=b}function tc(a,b,c){var d=b.toLowerCase(),d=La[b]||La[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 Zf(a,b,c){for(var d=B(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Va(f)){Va(f,function(){Zf(a,b,c)});return}}b.call(a,c)}
function $f(a,b){var c=new O(a,"1.30.3","validate");if(Xf(c)&&ag(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.G("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=Tf.prototype;
h.Ya=function(a){void 0===a&&(a=this.b||(this.s?1:Vf));if(!this.l){this.l++;var b=!1,c=!1;this.D=!1;var d=this.v||new O(this,"1.30.3");if(-1==a)b=!0;else if(a>Vf){if(Xf(d,this.s)){this.g=new O(this,"1.30.3","failsafe");Xf(this.g)&&(bg(this,d),a=2,cg(this.g));this.g.set("timestamp",sa());dg(this.g);var e=this.b&&!this.i;if(1==a||ua("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=ag(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Xf(d,g):("error"==
f&&"no machine state"!=g?(this.G("Error: "+g),"unable to verify user"==g&&(Aa("user",""),this.c=null)):this.T(f+": "+g),cg(d),Xf(d)?(c=ag(d),e=!0):c=!1))}e&&$f(this,c?d:null)}else 2==a&&d.clear()}else $f(this);delete this.s;delete this.v}e=B(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=eg(this,g,d,b,c));b=[d,a,c];-1!=a?Zf(this,this.Lb,b):this.Lb(b)}};
function eg(a,b,c,d,e){if(!b.j.N){b.j.N=!0;if(b.la){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.la(f,d)&&f&&(t("Unable to restore state for "+b.type),a.B&&!a.I?(c.clear(),a.b=Vf,window&&window.location.reload()):a.D=!0,b.la(null),e=!1)}if(!d&&b.Sb)for(a=b.Sb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Lb=function(a){var b=a[0],c=0>a[1];a=a[2];this.R=!0;this.j.N=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(eg(this,this.a,b,c,a),this.ya(),this.a.Va());this.D&&(bg(this,b),b.clear());!c&&this.g&&(this.g.clear(),delete this.g);this.l=0};
h.Za=function(a){void 0===a&&(a=this.b||(this.s?1:Vf));if(!this.l){this.l++;var b=!1,c=!1;this.D=!1;var d=this.v||new O(this,"1.30.3");if(-1==a)b=!0;else if(a>Vf){if(Xf(d,this.s)){this.g=new O(this,"1.30.3","failsafe");Xf(this.g)&&(bg(this,d),a=2,cg(this.g));this.g.set("timestamp",sa());dg(this.g);var e=this.b&&!this.i;if(1==a||ua("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=ag(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Xf(d,g):("error"==
f&&"no machine state"!=g?(this.G("Error: "+g),"unable to verify user"==g&&(Aa("user",""),this.c=null)):this.T(f+": "+g),cg(d),Xf(d)?(c=ag(d),e=!0):c=!1))}e&&$f(this,c?d:null)}else 2==a&&d.clear()}else $f(this);delete this.s;delete this.v}e=B(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=eg(this,g,d,b,c));b=[d,a,c];-1!=a?Zf(this,this.Mb,b):this.Mb(b)}};
function eg(a,b,c,d,e){if(!b.j.N){b.j.N=!0;if(b.la){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.la(f,d)&&f&&(t("Unable to restore state for "+b.type),a.B&&!a.I?(c.clear(),a.b=Vf,window&&window.location.reload()):a.D=!0,b.la(null),e=!1)}if(!d&&b.Tb)for(a=b.Tb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Mb=function(a){var b=a[0],c=0>a[1];a=a[2];this.R=!0;this.j.N=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(eg(this,this.a,b,c,a),this.ya(),this.a.Va());this.D&&(bg(this,b),b.clear());!c&&this.g&&(this.g.clear(),delete this.g);this.l=0};
function bg(a,b){if(ua("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.3"};d.url=a.O;d.user=c;d.type="bug";d.data=b;r("http://www.pcjs.org/api/v1/report",d,!0)}}
function hg(a,b,c){var d,e="none";if(a.l)return null;a.l--;var f=new O(a,"1.30.3"),g=new O(a,"1.30.3","validate"),k=sa();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.ka&&(c&&G(a.a),d=a.a.ka(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.j.N=!1,!1===d&&(e=null)));for(var k=B(a.id),l=0;l<k.length;l++){var n=k[l];n.j.N&&(n.ka&&(d=n.ka(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.j.N=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.c&&ig(a,a.c,f.toString()),dg(g)&&dg(f)||(e=null,d=k=!0)):a.b&&(d=!0,k=3==a.b),d&&f.clear(k)):e=f.toString());c&&(a.j.N=!1,b=a.o.power)&&(b.textContent="Power");a.l=0;return e}h.reset=function(){this.h&&this.h.reset&&this.h.reset();this.a&&this.a.reset&&this.a.reset();for(var a=B(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.h&&c!==this.a&&c.reset&&c.reset()}this.ya(-1)};
h.start=function(a,b){for(var c=B(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.ya(-1)};h.stop=function(a,b){for(var c=B(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.ya(-1)};
h.ya=function(a){if(this.a){var b=this.a,c=a||0,d=b.o.speed;d&&(0>=c||30<=(b.xb+=c))&&(d.textContent=b.j.P?b.Ga.toFixed(2)+"Mhz":"Stopped",b.xb=0)}if(this.w&&(b=this.w,a=a||0,b.v)){c=b.a.j.P;d=!!(b.a.u&4);if(0>=a||60<=(b.s+=a)){for(var e=0;e<b.a.f.length;e++)kb(b,"R"+e,b.a.f[e]);e=Zb(b.a);kb(b,"PS",e);kb(b,"NF",e&8?1:0,1);kb(b,"ZF",e&4?1:0,1);kb(b,"VF",e&2?1:0,1);kb(b,"CF",e&1?1:0,1);b.s=0}sb(b,0<a&&c&&!d?b.a.f[7]:b.ea);rb(b,b.m);a=b.a;a=a.aa?a.Ba&16?1:2:4;tb(b,"B22",a&1);tb(b,"B18",a&2);tb(b,"B16",
h.ya=function(a){if(this.a){var b=this.a,c=a||0,d=b.o.speed;d&&(0>=c||30<=(b.yb+=c))&&(d.textContent=b.j.P?b.Ga.toFixed(2)+"Mhz":"Stopped",b.yb=0)}if(this.w&&(b=this.w,a=a||0,b.v)){c=b.a.j.P;d=!!(b.a.u&4);if(0>=a||60<=(b.s+=a)){for(var e=0;e<b.a.f.length;e++)kb(b,"R"+e,b.a.f[e]);e=Zb(b.a);kb(b,"PS",e);kb(b,"NF",e&8?1:0,1);kb(b,"ZF",e&4?1:0,1);kb(b,"VF",e&2?1:0,1);kb(b,"CF",e&1?1:0,1);b.s=0}sb(b,0<a&&c&&!d?b.a.Xa:b.ea);rb(b,b.m);a=b.a;a=a.aa?a.Ba&16?1:2:4;tb(b,"B22",a&1);tb(b,"B18",a&2);tb(b,"B16",
a&4)}};
h.$=function(a,b,c){var d=this;switch(b){case "power":return this.o[b]=c,c.onclick=function(){d.l||(d.j.N?hg(d,!1,!0):Zf(d,d.Ya))},!0;case "reset":return this.o[b]=c,c.onclick=function(){if(d.j.N&&!d.l)if(d.b&&!d.m){var a=ua("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");hg(d,a,!0);!a&&d.B?window&&window.location.reload():(a||(d.Mb=!0),d.Ya(Vf),d.Mb=!1)}else d.reset(),d.a&&d.a.Va()},!0;case "save":if(ma(v(),"pcjs.org"))c.parentNode.removeChild(c);else return this.o[b]=
h.$=function(a,b,c){var d=this;switch(b){case "power":return this.o[b]=c,c.onclick=function(){d.l||(d.j.N?hg(d,!1,!0):Zf(d,d.Za))},!0;case "reset":return this.o[b]=c,c.onclick=function(){if(d.j.N&&!d.l)if(d.b&&!d.m){var a=ua("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");hg(d,a,!0);!a&&d.B?window&&window.location.reload():(a||(d.Nb=!0),d.Za(Vf),d.Nb=!1)}else d.reset(),d.a&&d.a.Va()},!0;case "save":if(ma(v(),"pcjs.org"))c.parentNode.removeChild(c);else return this.o[b]=
c,c.onclick=function(){var a=Wf(d,!0);if(a){var b=!!(d.b&&!d.m||d.B),c=hg(d,b);b?ig(d,a,c):d.G("Resume disabled, machine state not saved")}},!0}return!1};
function Wf(a,b){var c=a.c;c||((c=za("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=jg(a,c))||a.G("The user ID is invalid.")):b&&a.G("Browser local storage is not available"));return c}
function jg(a,b){a.c=null;b=r(v()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Aa("user",b.data),a.c=b.data)}catch(d){t(d.message+" ("+c+")")}return a.c}function Yf(a){var b=null;a.c&&(b=v()+"/api/v1/user?req=load&user="+a.c+"&state="+kg(a,"1.30.3"));return b}
function ig(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=kg(a,"1.30.3");d.data=c;b=r(v()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.G("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.G(c),Aa("user",""),a.c=null)}}
function pf(a){var b;a=B(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}function zc(a){if(a.Wa){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Wa.focus();window&&window.scrollTo(b,c)}}Ga(function(){for(var a=E(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=C(c),c=E(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=C(f),g=new Tf(g,d,!0);D(g,f);g.A&&Zf(g,g.Ya)}});
x.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Ta("Computer",c.id))&&c.R&&!c.j.N&&c.Ya(-1)}});x.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Ta("Computer",c.id))&&c.j.N&&hg(c,!(!c.b||c.m),!0)}});function O(a,b,c){this.id=a.id;this.key=kg(a,b,c);this.F=a.F;cg(this,a.sd)}function kg(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}
function pf(a){var b;a=B(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}function zc(a){if(a.Wa){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Wa.focus();window&&window.scrollTo(b,c)}}Ga(function(){for(var a=E(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=C(c),c=E(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=C(f),g=new Tf(g,d,!0);D(g,f);g.A&&Zf(g,g.Za)}});
x.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Ta("Computer",c.id))&&c.R&&!c.j.N&&c.Za(-1)}});x.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Ta("Computer",c.id))&&c.j.N&&hg(c,!(!c.b||c.m),!0)}});function O(a,b,c){this.id=a.id;this.key=kg(a,b,c);this.F=a.F;cg(this,a.td)}function kg(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
O.prototype={constructor:O,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){cg(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 cg(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function dg(a){var b=!0;if(wa()){var c=JSON.stringify(a[a.id]);Aa(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function ag(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Xf(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:wa()&&(b=za(a.key))?(a[a.id]=b,a.a=!0):!1}var lg=0;
function mg(a,b,c,d,e,f){e("Loading "+a+"...");r(a,null,!0,function(g,k,l){l?(k||(k="unable to load "+a+" ("+l+")"),f(k,null)):ng(k,a,b,c,d,e,f)})}