Improved IOPAGE management

This commit is contained in:
Jeff Parsons 2016-10-08 11:09:14 -07:00 committed by Jeff Parsons
commit ae4fbeb489
7 changed files with 469 additions and 422 deletions

View file

@ -42,7 +42,7 @@ if (NODE) {
}
/**
* BusPDP11(cpu, dbg)
* BusPDP11(parmsBus, cpu, dbg)
*
* The BusPDP11 component manages physical memory and I/O address spaces.
*
@ -69,8 +69,18 @@ function BusPDP11(parmsBus, cpu, dbg)
this.cpu = cpu;
this.dbg = dbg;
/*
* Supported values for nBusWidth are 16 (default), 18, and 22. This represents the maximum size
* of the bus for the life of the machine, regardless what memory management mode the CPU has enabled.
*/
this.nBusWidth = parmsBus['busWidth'] || 16;
/*
* This controls the location of the IOPAGE (ie, at the top of 16-bit, 18-bit, or 22-bit address range).
* It is managed by setIOPageRange(). initMemory() establishes the default (16).
*/
this.nIOPageRange = 0; // zero means no IOPAGE access (yet)
/*
* Compute all BusPDP11 memory block parameters, based on the width of the bus. The entire
* address space is divided into blocks, using a block size that is (hopefully) appropriate to
@ -130,10 +140,26 @@ function BusPDP11(parmsBus, cpu, dbg)
*/
this.aIOHandlers = [];
this.fIOBreakAll = false;
/*
* Array of RESET notification handlers registered by Device components.
*/
this.afnReset = [];
/*
* Allocate empty Memory blocks to span the entire physical address space.
* Before we can add any memory blocks that declare our component as a custom memory controller,
* we must initialize the array that the getControllerAccess() method supplies to the Memory component.
*/
this.afnIOPage = [
BusPDP11.IOController.readByte,
BusPDP11.IOController.writeByte,
BusPDP11.IOController.readWord,
BusPDP11.IOController.writeWord
];
/*
* We're ready to allocate empty Memory blocks to span the entire physical address space, including the
* initial location of the IOPAGE.
*/
this.initMemory();
@ -142,7 +168,7 @@ function BusPDP11(parmsBus, cpu, dbg)
Component.subclass(BusPDP11);
BusPDP11.IOPAGE_VIRT = 0xE000; /*000160000*/
BusPDP11.IOPAGE_16BIT = 0xE000; /*000160000*/ // eg, PDP-11/20
BusPDP11.IOPAGE_18BIT = 0x3E000; /*000760000*/ // eg, PDP-11/45
BusPDP11.IOPAGE_UNIBUS = 0x3C0000; /*017000000*/
BusPDP11.IOPAGE_22BIT = 0x3FE000; /*017760000*/ // eg, PDP-11/70
@ -365,18 +391,31 @@ BusPDP11.prototype.initMemory = function()
for (var iBlock = 0; iBlock < this.nBlockTotal; iBlock++) {
this.aMemBlocks[iBlock] = block;
}
this.afnIOPage = new Array(4);
this.afnIOPage[0] = BusPDP11.IOController.readByte;
this.afnIOPage[1] = BusPDP11.IOController.writeByte;
this.afnIOPage[2] = BusPDP11.IOController.readWord;
this.afnIOPage[3] = BusPDP11.IOController.writeWord;
/*
* Map IOPAGE at the top of the address space (as determined by nBusWidth), as well as at IOPAGE_VIRT
* (which is the only place that 16-bit code can reach the IOPAGE when memory management is not enabled).
*/
var addr = this.addrTotal - BusPDP11.IOPAGE_LENGTH;
this.addMemory(addr, BusPDP11.IOPAGE_LENGTH, MemoryPDP11.TYPE.CONTROLLER, this);
this.addMemory(BusPDP11.IOPAGE_VIRT, BusPDP11.IOPAGE_LENGTH, MemoryPDP11.TYPE.CONTROLLER, this);
this.setIOPageRange(16);
};
/**
* setIOPageRange(nRange)
*
* We can define the IOPAGE address range with a single number, because the size of the IOPAGE is fixed at 8Kb.
* The bottom of the range is (2 ^ nRange) - IOPAGE_LENGTH, and the top is (2 ^ nRange) - 1.
*
* @this {BusPDP11}
* @param {number} nRange (16, 18 or 22)
*/
BusPDP11.prototype.setIOPageRange = function(nRange)
{
if (nRange != this.nIOPageRange) {
var addr;
if (this.nIOPageRange) {
addr = (1 << this.nIOPageRange) - BusPDP11.IOPAGE_LENGTH;
if (!this.removeMemory(addr, BusPDP11.IOPAGE_LENGTH)) return;
this.nIOPageRange = 0;
}
addr = (1 << nRange) - BusPDP11.IOPAGE_LENGTH;
if (!this.addMemory(addr, BusPDP11.IOPAGE_LENGTH, MemoryPDP11.TYPE.CONTROLLER, this)) return;
this.nIOPageRange = nRange;
}
};
/**
@ -390,6 +429,9 @@ BusPDP11.prototype.initMemory = function()
*/
BusPDP11.prototype.getControllerBuffer = function(addr)
{
/*
* No buffer is required; all accesses go to a registered I/O handler or the bit-bucket.
*/
return [null, 0];
};

View file

@ -197,11 +197,6 @@ CPUPDP11.prototype.initBus = function(cmp, bus, cpu, dbg)
if (control) this.cmp.setBinding(null, CPUPDP11.BUTTONS[i], control);
}
/*
* Attach the ChipSet component to the CPU so that it can be notified whenever the CPU stops and starts.
*/
this.chipset = null; // /** @type {ChipSetPDP11} */ (cmp.getMachineComponent("ChipSet"));
/*
* We've already saved the parmsCPU 'autoStart' setting, but there may be a machine (or URL) override.
*/
@ -210,12 +205,27 @@ CPUPDP11.prototype.initBus = function(cmp, bus, cpu, dbg)
this.flags.autoStart = (sAutoStart == "true"? true : (sAutoStart == "false"? false : !!sAutoStart));
}
this.initBusComplete();
this.setReady();
};
/**
* initBusComplete()
*
* Stub for Bus finalization (overridden by the CPUStatePDP11 component).
*
* @this {CPUPDP11}
*/
CPUPDP11.prototype.initBusComplete = function()
{
};
/**
* reset()
*
* Stub for reset notification (overridden by the CPUStatePDP11 component).
*
* @this {CPUPDP11}
*/
CPUPDP11.prototype.reset = function()
@ -225,7 +235,7 @@ CPUPDP11.prototype.reset = function()
/**
* save()
*
* This is a placeholder for save support (overridden by the CPUStatePDP11 component).
* Stub for save support (overridden by the CPUStatePDP11 component).
*
* @this {CPUPDP11}
* @return {Object|null}
@ -238,7 +248,7 @@ CPUPDP11.prototype.save = function()
/**
* restore(data)
*
* This is a placeholder for restore support (overridden by the CPUStatePDP11 component).
* Stub for restore support (overridden by the CPUStatePDP11 component).
*
* @this {CPUPDP11}
* @param {Object} data
@ -552,40 +562,6 @@ CPUPDP11.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
return fBound;
};
/**
* setBurstCycles(nCycles)
*
* This function is used by the ChipSet component whenever a very low timer count is set,
* in anticipation of the timer requiring an update sooner than the normal nCyclesPerYield
* period in runCPU() would normally provide.
*
* NOTE: In this context, "timer" refers to a timer chip (eg, an Intel 8253) being emulated by
* by the ChipSet component, not the timers managed by the CPU (eg, addTimer(), setTimer(), etc).
*
* @this {CPUPDP11}
* @param {number} nCycles is the target number of cycles to drop the current burst to
* @return {boolean}
*/
CPUPDP11.prototype.setBurstCycles = function(nCycles)
{
if (this.flags.running) {
var nDelta = this.nStepCycles - nCycles;
/*
* NOTE: If nDelta is negative, we will actually be increasing nStepCycles and nBurstCycles.
* Which is OK, but if we're also taking snapshots of the cycle counts, to make sure that instruction
* costs are being properly assessed, then we need to update nSnapCycles as well.
*
* TODO: If the delta is negative, we could simply ignore the request, but we must first carefully
* consider the impact on the ChipSet timers, if any.
*/
// if (DEBUG) this.nSnapCycles -= nDelta;
this.nStepCycles -= nDelta;
this.nBurstCycles -= nDelta;
return true;
}
return false;
};
/**
* addCycles(nCycles, fEndStep)
*
@ -1183,7 +1159,6 @@ CPUPDP11.prototype.startCPU = function(fUpdateFocus)
this.setSpeed();
this.flags.running = true;
this.flags.starting = true;
if (this.chipset) this.chipset.start();
var controlRun = this.bindings["run"];
if (controlRun) controlRun.textContent = "Halt";
if (this.cmp) {
@ -1227,7 +1202,6 @@ CPUPDP11.prototype.stopCPU = function(fComplete)
this.addCycles(this.nRunCycles);
this.nRunCycles = 0;
this.flags.running = false;
if (this.chipset) this.chipset.stop();
var controlRun = this.bindings["run"];
if (controlRun) controlRun.textContent = "Run";
if (this.cmp) {

View file

@ -98,6 +98,17 @@ Component.subclass(CPUStatePDP11, CPUPDP11);
*/
var InterruptEvent;
/**
* initBusComplete()
*
* @this {CPUStatePDP11}
*/
CPUStatePDP11.prototype.initBusComplete = function()
{
this.assert(this.bus);
this.setMemoryAccess();
};
/**
* initProcessor()
*
@ -216,11 +227,12 @@ CPUStatePDP11.prototype.resetRegs = function()
/** @type {Array.<InterruptEvent>} */
this.interruptQueue = [];
this.opFlags |= PDP11.OPFLAG.INTQ;
this.initMemoryAccess();
if (this.bus) this.setMemoryAccess();
};
/**
* initMemoryAccess()
* setMemoryAccess()
*
* Define handlers and DSPACE setting appropriate for the current MMU mode, in order to eliminate
* unnecessary calls to mapVirtualToPhysical().
@ -231,18 +243,20 @@ CPUStatePDP11.prototype.resetRegs = function()
*
* @this {CPUStatePDP11}
*/
CPUStatePDP11.prototype.initMemoryAccess = function()
CPUStatePDP11.prototype.setMemoryAccess = function()
{
if (this.mmuEnable) {
this.addrDSpace = PDP11.ACCESS.DSPACE;
this.getAddrByMode = this.getVirtualAddrByMode;
this.readWordFromAddr = this.readWordFromVirtual;
this.writeWordToAddr = this.writeWordToVirtual;
this.bus.setIOPageRange((this.regMMR3 & PDP11.MMR3.MMU_22BIT)? 22 : 18);
} else {
this.addrDSpace = 0;
this.getAddrByMode = this.getPhysicalAddrByMode;
this.readWordFromAddr = this.readWordFromPhysical;
this.writeWordToAddr = this.writeWordToPhysical;
this.bus.setIOPageRange(16);
}
};
@ -265,19 +279,23 @@ CPUStatePDP11.prototype.getMMR0 = function()
*/
CPUStatePDP11.prototype.setMMR0 = function(newMMR0)
{
this.regMMR0 = newMMR0 &= 0xf381;
this.mmuLastMode = (newMMR0 >> 5) & 3;
this.mmuLastPage = (newMMR0 >> 1) & 0xf;
if (newMMR0 & 0x101) {
if (newMMR0 & 0x1) {
this.mmuEnable = PDP11.ACCESS.READ | PDP11.ACCESS.WRITE;
} else {
this.mmuEnable = PDP11.ACCESS.WRITE;
newMMR0 &= 0xf381;
if (this.regMMR0 != newMMR0) {
this.regMMR0 = newMMR0;
this.mmuLastMode = (newMMR0 >> 5) & 3;
this.mmuLastPage = (newMMR0 >> 1) & 0xf;
var mmuEnable = 0;
if (newMMR0 & 0x101) {
mmuEnable = PDP11.ACCESS.WRITE;
if (newMMR0 & 0x1) {
mmuEnable |= PDP11.ACCESS.READ;
}
}
if (this.mmuEnable != mmuEnable) {
this.mmuEnable = mmuEnable;
this.setMemoryAccess();
}
} else {
this.mmuEnable = 0;
}
this.initMemoryAccess();
};
/**
@ -309,13 +327,16 @@ CPUStatePDP11.prototype.setMMR3 = function(newMMR3)
if (this.cpuType !== 70) {
newMMR3 &= ~(PDP11.MMR3.MMU_22BIT | PDP11.MMR3.UNIBUS_MAP);
}
this.regMMR3 = newMMR3;
if (this.regMMR3 & PDP11.MMR3.MMU_22BIT) {
this.mmuMask = 0x3fffff;
this.mmuMemorySize = BusPDP11.MAX_MEMORY;
} else {
this.mmuMask = 0x3ffff;
this.mmuMemorySize = BusPDP11.IOPAGE_18BIT;
if (this.regMMR3 != newMMR3) {
this.regMMR3 = newMMR3;
if (newMMR3 & PDP11.MMR3.MMU_22BIT) {
this.mmuMask = 0x3fffff;
this.mmuMemorySize = BusPDP11.MAX_MEMORY;
} else {
this.mmuMask = 0x3ffff;
this.mmuMemorySize = BusPDP11.IOPAGE_18BIT;
}
this.setMemoryAccess();
}
};
@ -1515,7 +1536,7 @@ CPUStatePDP11.prototype.getAddress = function(mode, reg, accessFlags)
/**
* getPhysicalAddrByMode(mode, reg, accessFlags)
*
* This is a handler set up by initMemoryAccess(). All calls should go through getAddrByMode().
* This is a handler set up by setMemoryAccess(). All calls should go through getAddrByMode().
*
* @this {CPUStatePDP11}
* @param {number} mode
@ -1531,7 +1552,7 @@ CPUStatePDP11.prototype.getPhysicalAddrByMode = function(mode, reg, accessFlags)
/**
* getVirtualAddrByMode(mode, reg, accessFlags)
*
* This is a handler set up by initMemoryAccess(). All calls should go through getAddrByMode().
* This is a handler set up by setMemoryAccess(). All calls should go through getAddrByMode().
*
* @this {CPUStatePDP11}
* @param {number} mode
@ -1547,7 +1568,7 @@ CPUStatePDP11.prototype.getVirtualAddrByMode = function(mode, reg, accessFlags)
/**
* readWordFromPhysical(physicalAddress)
*
* This is a handler set up by initMemoryAccess(). All calls should go through readWordFromAddr().
* This is a handler set up by setMemoryAccess(). All calls should go through readWordFromAddr().
*
* @this {CPUStatePDP11}
* @param {number} physicalAddress
@ -1561,7 +1582,7 @@ CPUStatePDP11.prototype.readWordFromPhysical = function(physicalAddress)
/**
* readWordFromVirtual(virtualAddress)
*
* This is a handler set up by initMemoryAccess(). All calls should go through readWordFromAddr().
* This is a handler set up by setMemoryAccess(). All calls should go through readWordFromAddr().
*
* @this {CPUStatePDP11}
* @param {number} virtualAddress (input address is 17 bit (I&D))
@ -1575,7 +1596,7 @@ CPUStatePDP11.prototype.readWordFromVirtual = function(virtualAddress)
/**
* writeWordToPhysical(physicalAddress, data)
*
* This is a handler set up by initMemoryAccess(). All calls should go through writeWordToAddr().
* This is a handler set up by setMemoryAccess(). All calls should go through writeWordToAddr().
*
* @this {CPUStatePDP11}
* @param {number} physicalAddress
@ -1589,7 +1610,7 @@ CPUStatePDP11.prototype.writeWordToPhysical = function(physicalAddress, data)
/**
* writeWordToVirtual(virtualAddress, data)
*
* This is a handler set up by initMemoryAccess(). All calls should go through writeWordToAddr().
* This is a handler set up by setMemoryAccess(). All calls should go through writeWordToAddr().
*
* @this {CPUStatePDP11}
* @param {number} virtualAddress (input address is 17 bit (I&D))
@ -1659,7 +1680,7 @@ CPUStatePDP11.prototype.writeWordToPrevSpace = function(opCode, accessFlags, dat
* TODO: Consider replacing the following code with writeWordToAddr(), by adding optional mmuMode
* parameters for each of the discrete mapVirtualToPhysical() and bus.setWord() operations, because
* as it stands, this is the only remaining call to mapVirtualToPhysical() outside of our
* initMemoryAccess() handlers.
* setMemoryAccess() handlers.
*/
this.mmuMode = (this.regPSW >> 12) & 3;
addr = this.mapVirtualToPhysical(addr | (accessFlags & PDP11.ACCESS.DSPACE), PDP11.ACCESS.WRITE);

View file

@ -79,16 +79,24 @@ var BYTEARRAYS = false;
var TYPEDARRAYS = (typeof ArrayBuffer !== 'undefined');
/**
* WORDBUS forces the Bus and Memory interfaces to assume even addresses when accessing words. Since PDPjs inherited
* its Bus component from PCx86, it originally supported both aligned and unaligned word accesses by default, but since
* the PDP-11 requires aligned (even) word addresses, we can turn off support for unaligned accesses and get some
* performance gains.
* MEMFAULT forces the Memory interfaces to signal a CPU fault when a word is accessed using an odd (unaligned) address.
*
* When WORDBUS is true, the Bus and Memory components simply ignore the low bit of word addresses, because it is the
* CPU, not the Bus, that's responsible for validating addresses and generating the appropriate traps.
* Since PDPjs inherited its Bus component from PCx86, it included support for both aligned and unaligned word accesses
* by default. However, the PDP-11 adds a wrinkle: when an odd address is used to access a memory word, a BUS_ERROR trap
* must be generated. Note that odd IOPAGE word accesses are fine; this only affects the Memory component.
*
* Don't worry that the source code looks MORE complicated rather than LESS with the additional WORDBUS checks, because
* the Closure Compiler eliminates those checks and throws away the (unreachable) code blocks that deal with unaligned
* When the MMU is enabled, these checks may also be performed at a higher level, eliminating the need for them at the
* physical memory level.
*/
var MEMFAULT = true;
/**
* WORDBUS turns off support for unaligned memory words. Whereas MEMFAULT necessarily slows down memory word accesses
* slightly, WORDBUS is able to speed them up slightly, by assuming that all word accesses (which didn't fault) must be
* aligned. This affects all word accesses, even IOPAGE accesses, because it also eliminates cross-block boundary checks.
*
* Don't worry that the source code looks MORE complicated rather than LESS with the additional MEMFAULT and WORDBUS checks,
* because the Closure Compiler eliminates those checks and throws away the (unreachable) code blocks that deal with unaligned
* accesses.
*/
var WORDBUS = true;
@ -109,6 +117,7 @@ var PDP11 = {
MAXDEBUG: MAXDEBUG, // shared
PRIVATE: PRIVATE, // shared
TYPEDARRAYS:TYPEDARRAYS,
MEMFAULT: MEMFAULT,
WORDBUS: WORDBUS,
SITEHOST: SITEHOST, // shared
XMLVERSION: XMLVERSION, // shared

View file

@ -623,7 +623,7 @@ MemoryPDP11.prototype = {
* @return {number}
*/
readWordMemory: function readWordMemory(off, addr) {
if (PDP11.WORDBUS && (off & 0x1)) {
if (PDP11.MEMFAULT && (off & 0x1)) {
this.cpu.fault(addr);
}
if (BYTEARRAYS) {
@ -667,7 +667,7 @@ MemoryPDP11.prototype = {
* @param {number} addr
*/
writeWordMemory: function writeWordMemory(off, w, addr) {
if (PDP11.WORDBUS && (off & 0x1)) {
if (PDP11.MEMFAULT && (off & 0x1)) {
this.cpu.fault(addr);
}
if (BYTEARRAYS) {
@ -777,7 +777,7 @@ MemoryPDP11.prototype = {
* @return {number}
*/
readWordBE: function readWordBE(off, addr) {
if (PDP11.WORDBUS && (off & 0x1)) {
if (PDP11.MEMFAULT && (off & 0x1)) {
this.cpu.fault(addr);
}
return this.dv.getUint16(off, true);
@ -791,15 +791,15 @@ MemoryPDP11.prototype = {
* @return {number}
*/
readWordLE: function readWordLE(off, addr) {
var w;
if (PDP11.MEMFAULT && (off & 0x1)) {
this.cpu.fault(addr);
}
/*
* TODO: For non-WORDBUS machines, it remains to be seen if there's any advantage to checking the offset
* for an aligned read vs. always reading the bytes separately.
*/
var w;
if (PDP11.WORDBUS && (off & 0x1)) {
this.cpu.fault(addr);
}
if (!(off & 0x1)) {
if (PDP11.WORDBUS || !(off & 0x1)) {
w = this.aw[off >> 1];
} else {
w = this.ab[off] | (this.ab[off+1] << 8);
@ -845,7 +845,7 @@ MemoryPDP11.prototype = {
* @param {number} w
*/
writeWordBE: function writeWordBE(off, w, addr) {
if (PDP11.WORDBUS && (off & 0x1)) {
if (PDP11.MEMFAULT && (off & 0x1)) {
this.cpu.fault(addr);
}
this.dv.setUint16(off, w, true);
@ -860,14 +860,14 @@ MemoryPDP11.prototype = {
* @param {number} w
*/
writeWordLE: function writeWordLE(off, w, addr) {
if (PDP11.MEMFAULT && (off & 0x1)) {
this.cpu.fault(addr);
}
/*
* TODO: For non-WORDBUS machines, it remains to be seen if there's any advantage to checking the offset
* for an aligned write vs. always writing the bytes separately.
*/
if (PDP11.WORDBUS && (off & 0x1)) {
this.cpu.fault(addr);
}
if (!(off & 0x1)) {
if (PDP11.WORDBUS || !(off & 0x1)) {
this.aw[off >> 1] = w;
} else {
this.ab[off] = w;

View file

@ -693,211 +693,211 @@ function m(a){window&&window.alert(a)}function va(a){var b=!1;window&&(b=window.
function Ca(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Da(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Ea(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Fa(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Ga={init:[],show:[],exit:[]},Ha=!1,Ia=!1,Ja=!0;function Ka(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function La(a){Ga.init.push(a)}
function Ma(a){if(Ja)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){m(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Sa(a){!Ja&&a?(Ja=!0,Ha&&Ta("init"),Ia&&Ta("show")):Ja=a}function Ta(a){Ga[a]&&Ma(Ga[a])}Ka("onload",function(){Ha=!0;Ma(Ga.init)});Ka("onpageshow",function(){Ia=!0;Ma(Ga.show)});Ka(Da("Opera")||Da("iOS")?"onunload":"onbeforeunload",function(){Ma(Ga.exit)});
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Rb=b.comment;this.xc=b;b=this.id.indexOf(".");0>b?this.Ya=this.id:(this.zb=this.id.substr(0,b),this.Ya=this.id.substr(b+1));this[a]=c;this.v={ready:!1,ib:!1,xb:!1,fa:!1,error:!1};this.rb=null;this.v.error=!1;this.J={};this.j=null;this.ha=d||0;t.push(this)}var Ua=void 0,Va={};
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Nb=b.comment;this.xc=b;b=this.id.indexOf(".");0>b?this.Xa=this.id:(this.xb=this.id.substr(0,b),this.Xa=this.id.substr(b+1));this[a]=c;this.v={ready:!1,hb:!1,yb:!1,fa:!1,error:!1};this.qb=null;this.v.error=!1;this.J={};this.j=null;this.ha=d||0;t.push(this)}var Ua=void 0,Va={};
if(window){Ua||(Ua=window.location.search.substr(1));for(var Wa,Xa=/\+/g,Ya=/([^&=]+)=?([^&]*)/g;Wa=Ya.exec(Ua);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function Za(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function y(a,b){b||(b=r);a.prototype=Za(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var $a=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else $a={},t=[];function ab(a,b,c){$a[a]&&b&&($a[a][b]=c)}function bb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<t.length;b++){var d=t[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function cb(a){if(void 0!==a){var b;for(b=0;b<t.length;b++)if(t[b].id===a)return t[b]}return null}function db(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<t.length;d++)if(c)c==t[d]&&(c=null);else if(!(a!=t[d].type||b&&t[d].id.indexOf(b)))return t[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){m(c.message+" ("+a+")")}return b}
function eb(a,b){b=A(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var l=g.split(" "),n=0;n<l.length;n++)switch(g=l[n],g){case "pdp11-binding":(g=z(f))&&g.binding&&a.ja(g.type,g.binding,f,g.value),n=l.length}}}}
function A(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ja:function(a,b,c){switch(b){case "clear":return this.J[b]||(this.J[b]=c,c.onclick=function(a){return function(){a.J.print&&(a.J.print.value="")}}(this)),!0;case "print":return this.J[b]||(this.Ta=this.J[b]=c,c.value="",this.i=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.na=function(a){this.i(a,this.Ya)}),!0;default:return!1}},log:function(){},i:function(){},status:function(a){this.i(this.Ya+": "+a)},na:function(a,b,c){c=c||this.type;b||m((c?c+": ":"")+a)},Ca:function(){return this.v.fa=!0},Ba:function(a,b){b&&(this.v.fa=!1);return!0}};function D(a,b,c,d){a.j&&(!0===c||F(a,c|0))&&a.j.message(b,d)}function F(a,b){if(a.j){a===a.j?b|=0:b=b||a.ha;var c=a.j.ha&b;return!!b&&c===b||!!(c&a.j.qc)}return!1}
function fb(a,b){if(a.v.xb)return a.v.ib=!1,a.v.xb=!1;if(a.v.error)return a.i(a.toString()+" error"),!1;a.v.ib=b;return a.v.ib}function gb(a,b){a.v.ib&&(b?a.v.xb=!0:void 0===b&&a.i(a.toString()+" busy"));return a.v.ib}function G(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.rb;a.rb=null;b&&b()}}function hb(a,b){b&&(a.v.ready?b():a.rb=b);return a.v.ready}function ib(a){return a.v.error?(a.i(a.toString()+" error"),!0):!1}function vb(a,b){a.v.error=!0;a.na(b)}
this.na=function(a){this.i(a,this.Xa)}),!0;default:return!1}},log:function(){},i:function(){},status:function(a){this.i(this.Xa+": "+a)},na:function(a,b,c){c=c||this.type;b||m((c?c+": ":"")+a)},Ca:function(){return this.v.fa=!0},Ba:function(a,b){b&&(this.v.fa=!1);return!0}};function D(a,b,c,d){a.j&&(!0===c||F(a,c|0))&&a.j.message(b,d)}function F(a,b){if(a.j){a===a.j?b|=0:b=b||a.ha;var c=a.j.ha&b;return!!b&&c===b||!!(c&a.j.qc)}return!1}
function fb(a,b){if(a.v.yb)return a.v.hb=!1,a.v.yb=!1;if(a.v.error)return a.i(a.toString()+" error"),!1;a.v.hb=b;return a.v.hb}function gb(a,b){a.v.hb&&(b?a.v.yb=!0:void 0===b&&a.i(a.toString()+" busy"));return a.v.hb}function G(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.qb;a.qb=null;b&&b()}}function hb(a,b){b&&(a.v.ready?b():a.qb=b);return a.v.ready}function ib(a){return a.v.error?(a.i(a.toString()+" error"),!0):!1}function vb(a,b){a.v.error=!0;a.na(b)}
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
var wb="undefined"!==typeof ArrayBuffer,xb={cpu:1,trap:16,bus:64,mem:128,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function yb(a){r.call(this,"Panel",a,yb)}y(yb);h=yb.prototype;h.ja=function(a,b,c,d){return this.F&&this.F.ja(a,b,c,d)||this.b&&this.b.ja(a,b,c,d)||this.j&&this.j.ja(a,b,c,d)?!0:this.parent.ja.call(this,a,b,c,d)};h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.b=c;this.j=d};
h.Ca=function(a,b){b||zb();return!0};h.Ba=function(){return!0};h.za=function(){};function zb(){for(var a=!1,b=A(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=cb(e.id);f||(a=!0,f=new yb(e));eb(f,d);a&&G(f)}}La(zb);
function Ab(a,b,c){r.call(this,"Bus",a,Ab,64);this.b=b;this.j=c;this.C=a.busWidth||16;this.B=Math.pow(2,this.C);this.g=this.B-1|0;this.Z=(this.C>>1)+2;10>this.Z&&(this.Z=10);15<this.Z&&(this.Z=15);this.ya=1<<this.Z;this.G=this.ya>>2;this.f=this.ya-1;this.A=this.B/this.ya|0;this.Ka=[];this.F=[];a=new H(this.b);Bb(a,this.j);this.X=Array(this.A);for(b=0;b<this.A;b++)this.X[b]=a;this.gb=Array(4);this.gb[0]=Cb;this.gb[1]=Db;this.gb[2]=Eb;this.gb[3]=Fb;Gb(this,this.B-8192,8192,Hb,this);Gb(this,57344,8192,
Hb,this);G(this)}y(Ab);function Cb(a,b){var c=-1,d=this.controller,e=d.Ka[a];e?e[0]?c=e[0](b)&255:e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.Ka[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.j&&F(this.j,64)&&D(this.j,e[4]+".readByte("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=Ib(d,b|4186112,-1,1);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to byte @"+I(this.j,b)+": "+I(this.j,c),!0,!0);return c}
function Db(a,b,c){var d=!1,e=this.controller,f=e.Ka[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](c):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.Ka[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](c):0,f[3](a&255|b<<8,c),d=!0);d?this.j&&F(this.j,64)&&D(this.j,f[4]+".writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(Ib(e,c|4186112,b,1),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to byte @"+I(this.j,c)+": "+I(this.j,b),!0,!0))}
function Eb(a,b){var c=-1,d=this.controller;(a=d.Ka[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.j&&F(this.j,64)&&D(this.j,a[4]+".readWord("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=Ib(d,b|4186112,-1,0);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to word @"+I(this.j,b)+": "+I(this.j,c),!0,!0);return c}
function Fb(a,b,c){var d=!1,e=this.controller;if(a=e.Ka[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.j&&F(this.j,64)&&D(this.j,a[4]+".writeWord("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(Ib(e,c|4186112,b,0),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to word @"+I(this.j,c)+": "+I(this.j,b),!0,!0))}h=Ab.prototype;h.reset=function(){for(var a=0;a<this.F.length;a++)this.F[a]()};
function Ib(a,b,c,d){a.j&&F(a.j,536870912)&&D(a.j,"warning: unrecognized I/O access("+I(a.j,b)+","+I(a.j,c)+","+d+")",!0,!0);a.b.O(4,b)}h.Ca=function(a,b){b||this.reset();return!0};
function Gb(a,b,c,d,e){for(var f=b,g=c,l=f>>>a.Z;0<g&&l<a.X.length;){var n=a.X[l],p=l*a.ya,q=a.ya-(f-p);q>g&&(q=g);if(n&&n.size){if(n.type==d&&n.controller==e){if(f+g<=n.w)return n.qb+=n.w-f,n.w=f,!0;if(f>=n.w+n.qb){q=n.size-(f-p);q>g&&(q=g);n.qb=f-n.w+q;f=p+a.ya;g-=q;l++;continue}}return Jb(1,f,g)}f=new H(a.b,f,q,a.ya,d,e);Bb(f,a.j,n);a.X[l++]=f;f=p+a.ya;g-=q}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Kb[d]+" at "+k(b,8,!0)),!0):Jb(2,b,c)}
h.Ua=function(a){return this.X[(a&this.g)>>>this.Z].ub(a&this.f,a)};h.ma=function(a){return this.X[(a&this.g)>>>this.Z].dc(a&this.f,a)};function Lb(a,b){return a.X[(b&a.g)>>>a.Z].Db(b&a.f,b)}h.ob=function(a,b){this.X[(a&this.g)>>>this.Z].vb(a&this.f,b&255,a)};h.Xa=function(a,b){this.X[(a&this.g)>>>this.Z].oc(a&this.f,b&65535,a)};
function Mb(a){for(var b=0,c=[],d=0;d<a.A;d++){var e=a.X[d];if(e.La||e.sc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,l=0,n=[];g<e.length;){for(var p=e[g],q=g+1;q<e.length&&e[q]===p;)q++;n[l++]=q-g;n[l++]=p;g=q}n.length<e.length&&(e=n)}c[f]=e}}return c}
function Nb(a,b,c){for(var d in c){var e=c[d];if(!(e[5]&&e[5]>a.b.Xb))for(var f=e[0]?e[0].bind(b):null,g=e[1]?e[1].bind(b):null,l=e[2]?e[2].bind(b):null,n=e[3]?e[3].bind(b):null,p=a,q=+d,e=e[4],v=+d;v<=q;v+=2){var u=v&8191;void 0!==p.Ka[u]?m("I/O address already registered: "+k(v,8,!0)):p.Ka[u]=[f,g,l,n,e||"unknown",!1]}}}function Ob(a,b){a.F.push(b)}function Jb(a,b,c){m("Memory block error ("+a+": "+k(b)+","+k(c)+")");return!1}
function J(a){r.call(this,"Device",a,J);this.g={data:0,Gd:0,tb:20,Jd:0};this.f={Hd:0,Ib:-1}}y(J);h=J.prototype;h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;var e=this;this.f.Ib=Pb(this.b,function(){e.f.Ma|=128;e.f.Ma&64&&(Qb(e.b,0,6,64),Rb(e.b,e.f.Ib,1E3/60))});Nb(b,this,K);Ob(b,this.reset.bind(this));G(this)};h.Gc=function(){var a=this.f.Ma;this.f.Ma&=-129;return a};h.kd=function(a){this.f.Ma=a;a&64&&Rb(this.b,this.f.Ib,1E3/60);this.f.Ma=a&-129};
h.Ic=function(){var a=this.b;return a.G&62337|a.wa<<5|a.xa<<1};h.md=function(a){var b=this.b;b.G=a&=62337;b.wa=a>>5&3;b.xa=a>>1&15;b.Bb=a&257?a&1?6:4:0;Sb(b);Tb(this)};h.Jc=function(){var a=this.b.Oa;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Kc=function(){return this.b.Fb};h.Lc=function(){return this.b.Wa};h.nd=function(a){var b=this.b;b.Wa=a;b.Wa&16?(b.jb=4194303,b.Ia=3915776):(b.jb=262143,b.Ia=253952);Tb(this)};function Tb(a){a.g.tb=a.g.tb&-8|(a.b.Bb?a.b.Wa&16?1:2:4)}
h.Tc=function(a){return this.b.S[1][a>>1&7]};h.vd=function(a,b){this.b.S[1][b>>1&7]=a&65295};h.Rc=function(a){return this.b.S[1][(a>>1&7)+8]};h.td=function(a,b){this.b.S[1][(b>>1&7)+8]=a&65295};h.Sc=function(a){return this.b.pa[1][a>>1&7]};h.ud=function(a,b){b=b>>1&7;this.b.pa[1][b]=a;this.b.S[1][b]&=65295};h.Qc=function(a){return this.b.pa[1][(a>>1&7)+8]};h.sd=function(a,b){b=(b>>1&7)+8;this.b.pa[1][b]=a;this.b.S[1][b]&=65295};h.Fc=function(a){return this.b.S[0][a>>1&7]};
h.jd=function(a,b){this.b.S[0][b>>1&7]=a&65295};h.Dc=function(a){return this.b.S[0][(a>>1&7)+8]};h.gd=function(a,b){this.b.S[0][(b>>1&7)+8]=a&65295};h.Ec=function(a){return this.b.pa[0][a>>1&7]};h.hd=function(a,b){b=b>>1&7;this.b.pa[0][b]=a;this.b.S[0][b]&=65295};h.Cc=function(a){return this.b.pa[0][(a>>1&7)+8]};h.fd=function(a,b){b=(b>>1&7)+8;this.b.pa[0][b]=a;this.b.S[0][b]&=65295};h.Zc=function(a){return this.b.S[3][a>>1&7]};h.Bd=function(a,b){this.b.S[3][b>>1&7]=a&65295};
h.Xc=function(a){return this.b.S[3][(a>>1&7)+8]};h.zd=function(a,b){this.b.S[3][(b>>1&7)+8]=a&65295};h.Yc=function(a){return this.b.pa[3][a>>1&7]};h.Ad=function(a,b){b=b>>1&7;this.b.pa[3][b]=a;this.b.S[3][b]&=65295};h.Wc=function(a){return this.b.pa[3][(a>>1&7)+8]};h.yd=function(a,b){b=(b>>1&7)+8;this.b.pa[3][b]=a;this.b.S[3][b]&=65295};h.ra=function(a){a&=7;return this.b.K&2048?this.b.Ha[a]:this.b.u[a]};h.ua=function(a,b){b&=7;this.b.K&2048?this.b.Ha[b]=a:this.b.u[b]=a};
h.Zb=function(){return this.b.K&49152?this.b.ta[0]:this.b.u[6]};h.jc=function(a){this.b.K&49152?this.b.ta[0]=a:this.b.u[6]=a};h.bc=function(){return this.b.u[7]};h.mc=function(a){this.b.u[7]=a};h.sa=function(a){a&=7;return this.b.K&2048?this.b.u[a]:this.b.Ha[a]};h.va=function(a,b){b&=7;this.b.K&2048?this.b.u[b]=a:this.b.Ha[b]=a};h.$b=function(){return 1==(this.b.K&49152)>>14?this.b.u[6]:this.b.ta[1]};h.kc=function(a){1==(this.b.K&49152)>>14?this.b.u[6]=a:this.b.ta[1]=a};
h.ac=function(){return 3==(this.b.K&49152)>>14?this.b.u[6]:this.b.ta[3]};h.lc=function(a){3==(this.b.K&49152)>>14?this.b.u[6]=a:this.b.ta[3]=a};h.Bc=function(a){return this.b.gc[a-65504>>1]};h.ed=function(a,b){this.b.gc[b-65504>>1]=a};h.cc=function(a){return 65520==a?61183:0};h.nc=function(){};h.Vc=function(){return 1};h.xd=function(){};h.Ac=function(){return this.b.$};h.dd=function(){this.b.$=0};h.Hc=function(){return this.b.fc};h.ld=function(a,b){b&1||(a&=255);this.b.fc=a};h.Mc=function(){return this.b.Gb};
h.od=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Gb=a;b.D|=2};h.Uc=function(){return this.b.Pa&65280};h.wd=function(a){this.b.Pa=a|255};h.Nc=function(){return Ub(this.b)};h.pd=function(a){Vb(this.b,a&-1809|Ub(this.b)&1808);this.b.D|=128};h.reset=function(){this.g.tb=this.g.tb&-120|20;this.f.Ma=0};
function Ab(a,b,c){r.call(this,"Bus",a,Ab,64);this.b=b;this.j=c;this.C=a.busWidth||16;this.B=0;this.G=Math.pow(2,this.C);this.g=this.G-1|0;this.Y=(this.C>>1)+2;10>this.Y&&(this.Y=10);15<this.Y&&(this.Y=15);this.qa=1<<this.Y;this.H=this.qa>>2;this.f=this.qa-1;this.A=this.G/this.qa|0;this.Ka=[];this.F=[];this.pc=[Bb,Cb,Db,Eb];a=new H(this.b);Fb(a,this.j);this.P=Array(this.A);for(b=0;b<this.A;b++)this.P[b]=a;Gb(this,16);G(this)}y(Ab);
function Bb(a,b){var c=-1,d=this.controller,e=d.Ka[a];e?e[0]?c=e[0](b)&255:e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.Ka[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.j&&F(this.j,64)&&D(this.j,e[4]+".readByte("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=Hb(d,b|4186112,-1,1);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to byte @"+I(this.j,b)+": "+I(this.j,c),!0,!0);return c}
function Cb(a,b,c){var d=!1,e=this.controller,f=e.Ka[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](c):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.Ka[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](c):0,f[3](a&255|b<<8,c),d=!0);d?this.j&&F(this.j,64)&&D(this.j,f[4]+".writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(Hb(e,c|4186112,b,1),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to byte @"+I(this.j,c)+": "+I(this.j,b),!0,!0))}
function Db(a,b){var c=-1,d=this.controller;(a=d.Ka[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.j&&F(this.j,64)&&D(this.j,a[4]+".readWord("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=Hb(d,b|4186112,-1,0);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to word @"+I(this.j,b)+": "+I(this.j,c),!0,!0);return c}
function Eb(a,b,c){var d=!1,e=this.controller;if(a=e.Ka[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.j&&F(this.j,64)&&D(this.j,a[4]+".writeWord("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(Hb(e,c|4186112,b,0),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to word @"+I(this.j,c)+": "+I(this.j,b),!0,!0))}
function Gb(a,b){if(b!=a.B){var c;if(a.B){c=(1<<a.B)-8192;var d=c;c=8192;if(d&a.f||!c||c&a.f)c=Ib(2,d,c);else{for(var e=d>>>a.Y;0<c;){var f=a.P[e],d=new H(a.b,d);Fb(d,a.j,f);a.P[e++]=d;d=e*a.qa;c-=a.qa}c=!0}if(!c)return;a.B=0}Jb(a,(1<<b)-8192,8192,Kb,a)&&(a.B=b)}}h=Ab.prototype;h.reset=function(){for(var a=0;a<this.F.length;a++)this.F[a]()};function Hb(a,b,c,d){a.j&&F(a.j,536870912)&&D(a.j,"warning: unrecognized I/O access("+I(a.j,b)+","+I(a.j,c)+","+d+")",!0,!0);a.b.O(4,b)}
h.Ca=function(a,b){b||this.reset();return!0};function Jb(a,b,c,d,e){for(var f=b,g=c,l=f>>>a.Y;0<g&&l<a.P.length;){var n=a.P[l],p=l*a.qa,q=a.qa-(f-p);q>g&&(q=g);if(n&&n.size){if(n.type==d&&n.controller==e){if(f+g<=n.w)return n.ob+=n.w-f,n.w=f,!0;if(f>=n.w+n.ob){q=n.size-(f-p);q>g&&(q=g);n.ob=f-n.w+q;f=p+a.qa;g-=q;l++;continue}}return Ib(1,f,g)}f=new H(a.b,f,q,a.qa,d,e);Fb(f,a.j,n);a.P[l++]=f;f=p+a.qa;g-=q}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Lb[d]+" at "+k(b,8,!0)),!0):Ib(2,b,c)}
h.Ua=function(a){return this.P[(a&this.g)>>>this.Y].ub(a&this.f,a)};h.ma=function(a){return this.P[(a&this.g)>>>this.Y].cc(a&this.f,a)};function Mb(a,b){return a.P[(b&a.g)>>>a.Y].Cb(b&a.f,b)}h.mb=function(a,b){this.P[(a&this.g)>>>this.Y].vb(a&this.f,b&255,a)};h.Wa=function(a,b){this.P[(a&this.g)>>>this.Y].nc(a&this.f,b&65535,a)};
function Nb(a){for(var b=0,c=[],d=0;d<a.A;d++){var e=a.P[d];if(e.La||e.sc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,l=0,n=[];g<e.length;){for(var p=e[g],q=g+1;q<e.length&&e[q]===p;)q++;n[l++]=q-g;n[l++]=p;g=q}n.length<e.length&&(e=n)}c[f]=e}}return c}
function Ob(a,b,c){for(var d in c){var e=c[d];if(!(e[5]&&e[5]>a.b.Wb))for(var f=e[0]?e[0].bind(b):null,g=e[1]?e[1].bind(b):null,l=e[2]?e[2].bind(b):null,n=e[3]?e[3].bind(b):null,p=a,q=+d,e=e[4],v=+d;v<=q;v+=2){var u=v&8191;void 0!==p.Ka[u]?m("I/O address already registered: "+k(v,8,!0)):p.Ka[u]=[f,g,l,n,e||"unknown",!1]}}}function Pb(a,b){a.F.push(b)}function Ib(a,b,c){m("Memory block error ("+a+": "+k(b)+","+k(c)+")");return!1}
function J(a){r.call(this,"Device",a,J);this.g={data:0,Gd:0,sb:20,Jd:0};this.f={Hd:0,Hb:-1}}y(J);h=J.prototype;h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;var e=this;this.f.Hb=Qb(this.b,function(){e.f.Ma|=128;e.f.Ma&64&&(Rb(e.b,0,6,64),Sb(e.b,e.f.Hb,1E3/60))});Ob(b,this,K);Pb(b,this.reset.bind(this));G(this)};h.Gc=function(){var a=this.f.Ma;this.f.Ma&=-129;return a};h.kd=function(a){this.f.Ma=a;a&64&&Sb(this.b,this.f.Hb,1E3/60);this.f.Ma=a&-129};
h.Ic=function(){var a=this.b;return a.G&62337|a.wa<<5|a.xa<<1};h.md=function(a){var b=this.b;a&=62337;if(b.G!=a){b.G=a;b.wa=a>>5&3;b.xa=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.tb!=c&&(b.tb=c,Tb(b))}Ub(this)};h.Jc=function(){var a=this.b.Oa;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Kc=function(){return this.b.Eb};h.Lc=function(){return this.b.Pa};h.nd=function(a){var b=this.b;b.Pa!=a&&(b.Pa=a,a&16?(b.ab=4194303,b.ya=3915776):(b.ab=262143,b.ya=253952),Tb(b));Ub(this)};
function Ub(a){a.g.sb=a.g.sb&-8|(a.b.tb?a.b.Pa&16?1:2:4)}h.Tc=function(a){return this.b.T[1][a>>1&7]};h.vd=function(a,b){this.b.T[1][b>>1&7]=a&65295};h.Rc=function(a){return this.b.T[1][(a>>1&7)+8]};h.td=function(a,b){this.b.T[1][(b>>1&7)+8]=a&65295};h.Sc=function(a){return this.b.pa[1][a>>1&7]};h.ud=function(a,b){b=b>>1&7;this.b.pa[1][b]=a;this.b.T[1][b]&=65295};h.Qc=function(a){return this.b.pa[1][(a>>1&7)+8]};h.sd=function(a,b){b=(b>>1&7)+8;this.b.pa[1][b]=a;this.b.T[1][b]&=65295};
h.Fc=function(a){return this.b.T[0][a>>1&7]};h.jd=function(a,b){this.b.T[0][b>>1&7]=a&65295};h.Dc=function(a){return this.b.T[0][(a>>1&7)+8]};h.gd=function(a,b){this.b.T[0][(b>>1&7)+8]=a&65295};h.Ec=function(a){return this.b.pa[0][a>>1&7]};h.hd=function(a,b){b=b>>1&7;this.b.pa[0][b]=a;this.b.T[0][b]&=65295};h.Cc=function(a){return this.b.pa[0][(a>>1&7)+8]};h.fd=function(a,b){b=(b>>1&7)+8;this.b.pa[0][b]=a;this.b.T[0][b]&=65295};h.Zc=function(a){return this.b.T[3][a>>1&7]};
h.Bd=function(a,b){this.b.T[3][b>>1&7]=a&65295};h.Xc=function(a){return this.b.T[3][(a>>1&7)+8]};h.zd=function(a,b){this.b.T[3][(b>>1&7)+8]=a&65295};h.Yc=function(a){return this.b.pa[3][a>>1&7]};h.Ad=function(a,b){b=b>>1&7;this.b.pa[3][b]=a;this.b.T[3][b]&=65295};h.Wc=function(a){return this.b.pa[3][(a>>1&7)+8]};h.yd=function(a,b){b=(b>>1&7)+8;this.b.pa[3][b]=a;this.b.T[3][b]&=65295};h.ra=function(a){a&=7;return this.b.K&2048?this.b.Ha[a]:this.b.u[a]};
h.ua=function(a,b){b&=7;this.b.K&2048?this.b.Ha[b]=a:this.b.u[b]=a};h.Yb=function(){return this.b.K&49152?this.b.ta[0]:this.b.u[6]};h.ic=function(a){this.b.K&49152?this.b.ta[0]=a:this.b.u[6]=a};h.ac=function(){return this.b.u[7]};h.lc=function(a){this.b.u[7]=a};h.sa=function(a){a&=7;return this.b.K&2048?this.b.u[a]:this.b.Ha[a]};h.va=function(a,b){b&=7;this.b.K&2048?this.b.u[b]=a:this.b.Ha[b]=a};h.Zb=function(){return 1==(this.b.K&49152)>>14?this.b.u[6]:this.b.ta[1]};
h.jc=function(a){1==(this.b.K&49152)>>14?this.b.u[6]=a:this.b.ta[1]=a};h.$b=function(){return 3==(this.b.K&49152)>>14?this.b.u[6]:this.b.ta[3]};h.kc=function(a){3==(this.b.K&49152)>>14?this.b.u[6]=a:this.b.ta[3]=a};h.Bc=function(a){return this.b.fc[a-65504>>1]};h.ed=function(a,b){this.b.fc[b-65504>>1]=a};h.bc=function(a){return 65520==a?61183:0};h.mc=function(){};h.Vc=function(){return 1};h.xd=function(){};h.Ac=function(){return this.b.$};h.dd=function(){this.b.$=0};h.Hc=function(){return this.b.ec};
h.ld=function(a,b){b&1||(a&=255);this.b.ec=a};h.Mc=function(){return this.b.Fb};h.od=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Fb=a;b.D|=2};h.Uc=function(){return this.b.Qa&65280};h.wd=function(a){this.b.Qa=a|255};h.Nc=function(){return Vb(this.b)};h.pd=function(a){Wb(this.b,a&-1809|Vb(this.b)&1808);this.b.D|=128};h.reset=function(){this.g.sb=this.g.sb&-120|20;this.f.Ma=0};
var L={},K=(L[62592]=[null,null,J.prototype.Tc,J.prototype.vd,"SISDR"],L[62608]=[null,null,J.prototype.Rc,J.prototype.td,"SDSDR"],L[62624]=[null,null,J.prototype.Sc,J.prototype.ud,"SISAR"],L[62640]=[null,null,J.prototype.Qc,J.prototype.sd,"SDSAR"],L[62656]=[null,null,J.prototype.Fc,J.prototype.jd,"KISDR"],L[62672]=[null,null,J.prototype.Dc,J.prototype.gd,"KDSDR"],L[62688]=[null,null,J.prototype.Ec,J.prototype.hd,"KISAR"],L[62704]=[null,null,J.prototype.Cc,J.prototype.fd,"KDSAR"],L[62798]=[null,null,
J.prototype.Lc,J.prototype.nd,"MMR3"],L[65382]=[null,null,J.prototype.Gc,J.prototype.kd,"LKS"],L[65402]=[null,null,J.prototype.Ic,J.prototype.md,"MMR0"],L[65404]=[null,null,J.prototype.Jc,null,"MMR1"],L[65406]=[null,null,J.prototype.Kc,null,"MMR2"],L[65408]=[null,null,J.prototype.Zc,J.prototype.Bd,"UISDR"],L[65424]=[null,null,J.prototype.Xc,J.prototype.zd,"UDSDR"],L[65440]=[null,null,J.prototype.Yc,J.prototype.Ad,"UISAR"],L[65456]=[null,null,J.prototype.Wc,J.prototype.yd,"UDSAR"],L[65472]=[J.prototype.ra,
J.prototype.ua,J.prototype.ra,J.prototype.ua,"R0SET0"],L[65473]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R1SET0"],L[65474]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R2SET0"],L[65475]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R3SET0"],L[65476]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R4SET0"],L[65477]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R5SET0"],L[65478]=[J.prototype.Zb,J.prototype.jc,J.prototype.Zb,
J.prototype.jc,"R6KERNEL"],L[65479]=[J.prototype.bc,J.prototype.mc,J.prototype.bc,J.prototype.mc,"R7KERNEL"],L[65480]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R0SET1"],L[65481]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R1SET1"],L[65482]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R2SET1"],L[65483]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R3SET1"],L[65484]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R4SET1"],
L[65485]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R5SET1"],L[65486]=[J.prototype.$b,J.prototype.kc,J.prototype.$b,J.prototype.kc,"R6SUPER"],L[65487]=[J.prototype.ac,J.prototype.lc,J.prototype.ac,J.prototype.lc,"R6USER"],L[65504]=[null,null,J.prototype.Bc,J.prototype.ed,"CTRL",1170],L[65520]=[null,null,J.prototype.cc,J.prototype.nc,"LSIZE",1170],L[65522]=[null,null,J.prototype.cc,J.prototype.nc,"HSIZE",1170],L[65524]=[null,null,J.prototype.Vc,J.prototype.xd,"SYSID",1170],L[65526]=
J.prototype.ua,J.prototype.ra,J.prototype.ua,"R0SET0"],L[65473]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R1SET0"],L[65474]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R2SET0"],L[65475]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R3SET0"],L[65476]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R4SET0"],L[65477]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R5SET0"],L[65478]=[J.prototype.Yb,J.prototype.ic,J.prototype.Yb,
J.prototype.ic,"R6KERNEL"],L[65479]=[J.prototype.ac,J.prototype.lc,J.prototype.ac,J.prototype.lc,"R7KERNEL"],L[65480]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R0SET1"],L[65481]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R1SET1"],L[65482]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R2SET1"],L[65483]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R3SET1"],L[65484]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R4SET1"],
L[65485]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R5SET1"],L[65486]=[J.prototype.Zb,J.prototype.jc,J.prototype.Zb,J.prototype.jc,"R6SUPER"],L[65487]=[J.prototype.$b,J.prototype.kc,J.prototype.$b,J.prototype.kc,"R6USER"],L[65504]=[null,null,J.prototype.Bc,J.prototype.ed,"CTRL",1170],L[65520]=[null,null,J.prototype.bc,J.prototype.mc,"LSIZE",1170],L[65522]=[null,null,J.prototype.bc,J.prototype.mc,"HSIZE",1170],L[65524]=[null,null,J.prototype.Vc,J.prototype.xd,"SYSID",1170],L[65526]=
[null,null,J.prototype.Ac,J.prototype.dd,"CPUERR",1170],L[65528]=[null,null,J.prototype.Hc,J.prototype.ld,"MB",1170],L[65530]=[null,null,J.prototype.Mc,J.prototype.od,"PIR"],L[65532]=[null,null,J.prototype.Uc,J.prototype.wd,"SL"],L[65534]=[null,null,J.prototype.Nc,J.prototype.pd,"PSW"],L);K[62594]=K[62592];K[62596]=K[62592];K[62598]=K[62592];K[62600]=K[62592];K[62602]=K[62592];K[62604]=K[62592];K[62606]=K[62592];K[62610]=K[62608];K[62612]=K[62608];K[62614]=K[62608];K[62616]=K[62608];K[62618]=K[62608];
K[62620]=K[62608];K[62622]=K[62608];K[62626]=K[62624];K[62628]=K[62624];K[62630]=K[62624];K[62632]=K[62624];K[62634]=K[62624];K[62636]=K[62624];K[62638]=K[62624];K[62642]=K[62640];K[62644]=K[62640];K[62646]=K[62640];K[62648]=K[62640];K[62650]=K[62640];K[62652]=K[62640];K[62654]=K[62640];K[62658]=K[62656];K[62660]=K[62656];K[62662]=K[62656];K[62664]=K[62656];K[62666]=K[62656];K[62668]=K[62656];K[62670]=K[62656];K[62674]=K[62672];K[62676]=K[62672];K[62678]=K[62672];K[62680]=K[62672];K[62682]=K[62672];
K[62684]=K[62672];K[62686]=K[62672];K[62690]=K[62688];K[62692]=K[62688];K[62694]=K[62688];K[62696]=K[62688];K[62698]=K[62688];K[62700]=K[62688];K[62702]=K[62688];K[62706]=K[62704];K[62708]=K[62704];K[62710]=K[62704];K[62712]=K[62704];K[62714]=K[62704];K[62716]=K[62704];K[62718]=K[62704];K[65410]=K[65408];K[65412]=K[65408];K[65414]=K[65408];K[65416]=K[65408];K[65418]=K[65408];K[65420]=K[65408];K[65422]=K[65408];K[65426]=K[65424];K[65428]=K[65424];K[65430]=K[65424];K[65432]=K[65424];K[65434]=K[65424];
K[65436]=K[65424];K[65438]=K[65424];K[65442]=K[65440];K[65444]=K[65440];K[65446]=K[65440];K[65448]=K[65440];K[65450]=K[65440];K[65452]=K[65440];K[65454]=K[65440];K[65458]=K[65456];K[65460]=K[65456];K[65462]=K[65456];K[65464]=K[65456];K[65466]=K[65456];K[65468]=K[65456];K[65470]=K[65456];K[65506]=K[65504];K[65508]=K[65504];K[65510]=K[65504];K[65512]=K[65504];K[65514]=K[65504];K[65516]=K[65504];K[65518]=K[65504];
La(function(){for(var a=A(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=z(c);switch(d.name){case "default":d=new J(d),eb(d,c)}}});var Wb;if(wb){var fc=new ArrayBuffer(2);(new DataView(fc)).setUint16(0,256,!0);Wb=256===(new Uint16Array(fc))[0]}else Wb=!1;var gc=Wb;
function H(a,b,c,d,e,f){this.b=a;this.id=hc+=2;this.f=null;this.w=b;this.qb=c;this.size=d||0;this.type=e||ic;this.B=e==jc;this.controller=null;Bb(this);this.La=this.sc=!1;if(d)if(f)this.controller=f,this.f=null,kc(this,f.gb);else if(wb)this.C=new ArrayBuffer(d),this.G=new DataView(this.C,0,d),this.g=new Uint8Array(this.C,0,d),this.I=new Uint16Array(this.C,0,d>>1),this.f=new Int32Array(this.C,0,d>>2),kc(this,gc?lc:mc);else{this.f=Array(d>>2);for(a=0;a<this.f.length;a++)this.f[a]=0;kc(this,nc)}else kc(this)}
var ic=0,jc=2,Hb=4,Kb=["NONE","RAM","ROM","VID","H/W"],hc=0;
H.prototype={constructor:H,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(wb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.G.getInt32(b<<2,!0);else a=this.f;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(wb)for(b=0;b<a.length;b++)this.G.setInt32(b<<2,a[b],!0);else this.f=a;return this.La=!0}return!1},Sa:function(a,b){b?this.F++||oc(this,pc,!1):this.J++||qc(this,pc,!1)},L:function(){this.j&&F(this.j,128)&&(D(this.j,"attempt to read invalid block %"+
k(this.w),!0),this.j.ea());return 255},A:function(a,b){this.j&&F(this.j,128)&&(D(this.j,"attempt to write "+k(b,4,!0)+" to invalid block %"+k(this.w),!0),this.j.ea())},M:function(a,b){return this.ub(a++,b++)|this.ub(a,b)<<8},H:function(a,b,c){this.vb(a++,b&255,c++);this.vb(a,b>>8,c)},W:function(a){return this.f[a>>2]>>>((a&3)<<3)&255},ga:function(a,b){a&1&&this.b.O(4,b);b=a>>2;a=(a&3)<<3;var c=this.f[b]>>a;return 24>a?c&65535:c&255|(this.f[b+1]&255)<<8},oa:function(a,b){var c=a>>2;a=(a&3)<<3;this.f[c]=
this.f[c]&~(255<<a)|b<<a;this.La=!0},Ya:function(a,b,c){a&1&&this.b.O(4,c);c=a>>2;a=(a&3)<<3;24>a?this.f[c]=this.f[c]&~(65535<<a)|b<<a:(this.f[c]=this.f[c]&16777215|b<<24,c++,this.f[c]=this.f[c]&-256|b>>8);this.La=!0},T:function(a,b){if(this.j&&null!=this.w){var c=this.j;rc(c,this.w+a,1,c.N)&&c.ea(!0)}return this.Cb(a,b)},ca:function(a,b){if(this.j&&null!=this.w){var c=this.j;rc(c,this.w+a,2,c.N)&&c.ea(!0)}return this.Db(a,b)},ka:function(a,b,c){if(this.j&&null!=this.w){var d=this.j;rc(d,this.w+a,
1,d.G)&&d.ea(!0)}this.B?this.A(a,b,c):this.wb(a,b,c)},wa:function(a,b,c){if(this.j&&null!=this.w){var d=this.j;rc(d,this.w+a,2,d.G)&&d.ea(!0)}this.B?this.A(a,b,c):this.Jb(a,b,c)},N:function(a){return this.g[a]},V:function(a,b){a=this.g[a];this.j&&F(this.j,128)&&D(this.j,"Memory.readByte("+I(this.j,b)+"): "+I(this.j,a),!0);return a},aa:function(a,b){a&1&&this.b.O(4,b);return this.G.getUint16(a,!0)},da:function(a,b){a&1&&this.b.O(4,b);a=a&1?this.g[a]|this.g[a+1]<<8:this.I[a>>1];this.j&&F(this.j,128)&&
D(this.j,"Memory.readWord("+I(this.j,b)+"): "+I(this.j,a),!0);return a},ia:function(a,b){this.g[a]=b;this.La=!0},la:function(a,b,c){this.g[a]=b;this.La=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0)},qa:function(a,b,c){a&1&&this.b.O(4,c);this.G.setUint16(a,b,!0);this.La=!0},xa:function(a,b,c){a&1&&this.b.O(4,c);a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.I[a>>1]=b;this.La=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeWord("+I(this.j,c)+","+I(this.j,b)+")",
!0)}};function Bb(a,b,c){a.j=b;a.J=a.F=0;c&&((a.J=c.J)&&qc(a,pc,!1),(a.F=c.F)&&oc(a,pc,!1))}function sc(a,b){b?--a.F||(a.vb=a.B?a.A:a.wb,a.oc=a.B?a.H:a.Jb):--a.J||(a.ub=a.Cb,a.dc=a.Db)}function oc(a,b,c){c&&a.F||(a.vb=!a.B&&b[1]||a.A,a.oc=!a.B&&b[3]||a.H);if(c||void 0===c)a.wb=b[1]||a.A,a.Jb=b[3]||a.H}function qc(a,b,c){c&&a.J||(a.ub=b[0]||a.L,a.dc=b[2]||a.M);if(c||void 0===c)a.Cb=b[0]||a.L,a.Db=b[2]||a.M}function kc(a,b){b||(b=tc);qc(a,b,void 0);oc(a,b,void 0)}
var tc=[],nc=[H.prototype.W,H.prototype.oa,H.prototype.ga,H.prototype.Ya],pc=[H.prototype.T,H.prototype.ka,H.prototype.ca,H.prototype.wa];if(wb)var mc=[H.prototype.N,H.prototype.ia,H.prototype.aa,H.prototype.qa],lc=[H.prototype.V,H.prototype.la,H.prototype.da,H.prototype.xa];
function uc(a,b){r.call(this,"CPU",a,uc,1);var c=a.multiplier||1;this.Qa=a.cycles||b;this.Na=c;this.ab=Math.round(this.Qa/1E4)/100;this.Va=this.ab*this.Na;this.v.ba=!1;this.v.Hb=!1;this.v.hb=a.autoStart;this.v.Mb=!1;this.v.$a=!1;this.lb=this.ia=0;this.mb=a.csStart;this.bb=a.csInterval;this.cb=a.csStop;this.L=[];this.Vb=this.cd.bind(this);G(this)}y(uc);var vc=["power","reset"];h=uc.prototype;
h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.j=d;for(b=0;b<vc.length;b++)(c=this.J[vc[b]])&&this.F.ja(null,vc[b],c);this.oa=null;a=wc(a,"autoStart");null!=a&&(this.v.hb="true"==a?!0:"false"==a?!1:!!a);G(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};
h.Ca=function(a,b){if(!b){if(a&&this.restore){xc(this);if(!this.restore(a))return!1;yc(this)}else this.reset();this.j?(a=this.j,a.i("Type ? for help with PDP11 Debugger commands"),a.za(),a.Ja&&(b=a.Ja,a.Ja=null,zc(a,b))):this.i("No debugger detected")}M(this);return!0};h.Ba=function(a){return a?this.save():!0};h.hb=function(){return this.v.hb||!this.j&&void 0===this.J.run?(this.eb(!0),!0):!1};h.Ob=function(){return 0};
function yc(a){void 0===a.mb&&(a.mb=0);void 0===a.bb&&(a.bb=-1);void 0===a.cb&&(a.cb=-1);a.v.$a=0<=a.mb&&0<a.bb;a.v.$a&&(a.lb=0,a.ia=a.mb-a.ga)}function Ac(a,b){if(a.v.$a){var c=!1;a.lb=a.lb+a.Ob()|0;a.ia-=b;0>=a.ia&&(a.ia+=a.bb,c=!0);0<=a.cb&&a.cb<=Bc(a)&&(a.bb=a.cb=-1,yc(a),a.ea(),c=!0);c&&a.i(Bc(a)+" cycles: checksum="+k(a.lb))}}
function Cc(a,b,c,d){if(a.J[b]){void 0===c&&(vb(a,"Value for "+b+" is invalid"),a.ea());var e=a.j&&a.j.ia||8;c=!a.v.ba||a.v.Mb?8==e?ba(c,d):k(c,d):"--------".substr(0,d||4);a.J[b].textContent!=c&&(a.J[b].textContent=c)}}
h.ja=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.J[b]=c;a=!0;break;case "run":this.J[b]=c;c.onclick=function(){var a;if(a=d.F)if(a=d.F,a.v.fa)a=!0;else{var b=null,c,l=bb(a.id);for(c=0;c<l.length&&(b=l[c],b===a||b.v.ready);c++);if(c==l.length)for(c=0;c<l.length&&(b=l[c],b===a||b.v.fa);c++);c==l.length&&(b=a);m("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.rb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ba?d.ea():d.eb())};
a=!0;break;case "speed":this.J[b]=c;a=!0;break;case "setSpeed":this.J[b]=c,c.onclick=function(){Dc(d,d.Na<<1,!0)},c.textContent=this.Va.toFixed(2)+"Mhz",a=!0}return a};function Ec(a,b,c){a.ga+=b;c&&(a.N=a.b=0)}function Fc(a,b){var c=1;b&&1<a.Na&&a.ca&&(c=a.ca/a.ab);a.Sb=Math.round(1E3/30);a.Ra=Math.floor(a.Qa/30*c);b||(a.ka=a.Ra);a.kb=0}function Bc(a){return a.ga+a.W+a.N-a.b}function xc(a){a.ca=0;a.Ub=0;a.ga=a.W=a.N=a.b=0;yc(a);Dc(a,1)}
function Dc(a,b,c){var d=!1;if(void 0!==b){.8>a.ca/a.Va?b=1:d=!0;a.Na=b;b=a.ab*a.Na;if(a.Va!=b){a.Va=b;b=a.Va.toFixed(2)+"Mhz";var e=a.J.setSpeed;e&&(e.textContent=b);a.i("target speed: "+b)}c&&a.F&&a.F.pb()}Ec(a,a.W);a.W=0;a.V=ra();a.da=0;Fc(a);return d}function Pb(a,b){var c=a.L.length;a.L.push([-1,b]);return c}function Rb(a,b,c){0<=b&&b<a.L.length&&0>a.L[b][0]&&(c*=a.Qa*a.Na/1E3,a.L[b][0]=c)}function Gc(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||b>d[0]&&(b=d[0])}return b}
function Hc(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}
h.cd=function(){if(this.v.ba){this.kb>=this.Qa&&Fc(this,!0);this.qa=0;this.Ja=ra();if(this.da){var a=this.Ja-this.da;a>this.Sb&&(this.V+=a,this.V>this.Ja&&(this.V=this.Ja))}try{do{var b=Gc(this,this.v.$a?1:this.Ra);try{this.fb(b)}catch(e){if("number"!=typeof e)throw e;}var c=this.N-this.b;Hc(this,c);this.qa+=c;this.W+=c;Ec(this,0,!0);Ac(this,c);this.ka-=c;if(0>=this.ka){this.ka+=this.Ra;15<=++this.Ub&&(this.F&&this.F.za(),this.Ub=0);break}}while(this.v.ba)}catch(e){this.ea();M(this);this.F&&this.F.stop(ra(),
Bc(this));vb(this,e.stack||e.message);return}if(this.v.ba){a=setTimeout;b=this.Vb;this.da=ra();c=this.Sb;this.qa&&(c=Math.round(c*this.qa/this.Ra));var c=c-(this.da-this.Ja),d=this.da-this.V;d&&(this.ca=Math.round(this.W/(10*d))/100,864E5<=d&&(this.ga=0,Dc(this)));if(0>c||this.ca<this.Va)-1E3>c&&(this.V-=c),c=0;this.kb+=this.qa;this.da+=c;a(b,c)}}};
h.eb=function(a){if(ib(this))return!1;if(this.v.ba)return this.i(this.toString()+" busy"),!1;Dc(this);this.v.ba=!0;this.v.Hb=!0;this.oa&&this.oa.start();var b=this.J.run;b&&(b.textContent="Halt");this.F&&(a&&this.F.pb(!0),this.F.start(this.V,Bc(this)));M(this,!0);setTimeout(this.Vb,0);return!0};h.fb=function(){return 0};
h.ea=function(a){if(this.v.ba){this.N-=this.b;this.b=0;Ec(this,this.W);this.W=0;this.v.ba=!1;this.oa&&this.oa.stop();var b=this.J.run;b&&(b.textContent="Run");this.F&&this.F.stop(ra(),Bc(this));M(this)}this.v.complete=a};function M(a,b){a.F&&a.F.za(b)}
function Ic(a){this.Xb=+a.model||1170;this.yc=a.resetAddr||0;uc.call(this,a,6666667);this.sb=0;this.decode=bd.bind(this);this.P=65536;this.R=32768;this.Y=65535;this.U=32768;this.K=15;this.u=[0,0,0,0,0,0,0,this.yc];this.Ha=[0,0,0,0,0,0];this.ta=[0,0,0,0];this.xa=this.C=0;this.wc=[4,2,0,1];this.S=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.pa=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.zc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.gc=[0,0,0,0,0,0,0,0];this.g=this.f=this.Za=this.H=this.I=this.D=this.fc=0;this.la=-1;cd(this);this.v.complete=this.v.rc=!1}y(Ic,uc);h=Ic.prototype;h.reset=function(){this.v.ba&&this.ea();cd(this);xc(this);this.v.error=!1;this.parent.reset.call(this)};
function cd(a){a.Pa=255;a.$=0;a.Gb=0;a.G=0;a.Oa=0;a.Fb=0;a.Wa=0;a.Bb=0;a.wa=0;a.jb=262143;a.Ia=253952;a.A=[];a.D|=2;Sb(a)}function Sb(a){a.Bb?(a.aa=65536,a.M=a.uc,a.T=a.ec,a.Wb=a.Dd):(a.aa=0,a.M=a.tc,a.T=a.$c,a.Wb=a.Cd)}h.Ob=function(){return 0};h.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.ga,this.Na]);a.set(2,Mb(this.B));return a.data()};
h.restore=function(a){var b=a[1];this.ga=b[1];Dc(this,b[3]);a:{b=this.B;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.G){for(var f=0,g=Array(b.G),l=0;l<e.length-1;)for(var n=e[l++],p=e[l++];n--;)g[f++]=p;e=g}f=b.X[d];if(!f||!f.restore(e)){m("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
h.ja=function(a,b,c){switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":this.J[b]=c;this.sb++;a=!0;break;default:a=this.parent.ja.call(this,a,b,c)}return a};
h.za=function(a){if(this.sb&&(a||!this.v.ba||this.v.Mb)){for(a=0;a<this.u.length;a++)Cc(this,"R"+a,this.u[a]);a=Ub(this);Cc(this,"PS",a);Cc(this,"NF",a&8?1:0,1);Cc(this,"ZF",a&4?1:0,1);Cc(this,"VF",a&2?1:0,1);Cc(this,"CF",a&1?1:0,1)}if(a=this.J.speed)a.textContent=this.v.ba&&this.ca?this.ca.toFixed(2)+"Mhz":"Stopped"};function dd(a){return a.P&65536?1:0}function ed(a){return a.R&32768?2:0}function fd(a){return a.Y&65535?0:4}h.Fa=function(){return this.U&32768?8:0};
function gd(a){var b=a.T(a.u[7]);a.u[7]=a.u[7]+2&65535;return b}function hd(a,b){a.u[7]=b&65535}function Qb(a,b,c,d,e){for(var f=a.A.length;0<f--;)if(a.A[f].ic===d){0<f&&(a.A[f-1].Ea+=a.A[f].Ea);a.A.splice(f,1);break}if(0<=b){for(f=a.A.length;0<f--;){if(a.A[f].Ea>b){a.A[f].Ea-=b;break}b-=a.A[f].Ea}a.A.splice(f+1,0,{Ea:b,Yb:c<<5&224,ic:d,Ab:e})}a.D|=2}function Ub(a){return a.K=a.K&63728|a.Fa()|fd(a)|ed(a)|dd(a)}
function Vb(a,b){a.U=b<<12;a.Y=~b&4;a.R=b<<14;a.P=b<<16;if((b^a.K)&2048)for(var c=a.Ha.length;0<=--c;){var d=a.u[c];a.u[c]=a.Ha[c];a.Ha[c]=d}a.C=b>>14&3;c=a.K>>14&3;a.C!=c&&(a.ta[c]=a.u[6],a.u[6]=a.ta[a.C]);a.D|=2;a.K=b}function O(a,b){a.D&128||(a.U=a.Y=b,a.R=0)}function id(a,b,c){a.D&128||(a.U=a.Y=a.P=b,a.R=c||0)}function jd(a,b,c,d){a.D&128||(a.U=a.Y=a.P=b,a.R=(c^b)&(d^b))}function kd(a,b){a.D&128||(a.U=a.Y=a.P=b,a.R=a.U^a.P>>1)}function ld(a,b,c,d){a.D&128||(a.U=a.Y=a.P=b,a.R=(c^d)&(d^b))}
h.O=function(a){var b=!1;0>this.la?this.la=Ub(this):this.C||(a=4,b=!0);this.G&57344||(this.Oa=63222,this.Fb=a);this.C=0;var c=this.T(a|this.aa),d=this.T(a+2&65535|this.aa);Vb(this,d&-12289|this.la>>2&12288);b&&(this.$|=4,this.u[6]=4);md(this,this.la);md(this,this.u[7]);hd(this,c);this.D&=-113;this.la=-1;throw a;};function nd(a){var b=od(a),c=od(a)&-1793;a.K&49152&&(c=c&-225|a.K&63712);hd(a,b);Vb(a,c);a.D&=-17}
function pd(a,b,c){var d,e,f,g=0;d=b>>13;a.Wa&a.wc[a.C]||(d&=7);e=a.S[a.C][d];f=(a.pa[a.C][d]<<6)+(b&8191)&a.jb;if(f<a.Ia)f&1&&!(c&1)&&(a.$|=64,a.O(4,10));else if(a.Wa&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var l=f>>13&31;31>l?a.Wa&32&&(f=a.zc[l]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Ia&&4186112>f&&(a.$|=32,a.O(4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:
128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.S[a.C][d]=e;if(4194170!==f||a.C)a.wa=a.C,a.xa=d;g&&(g&57344&&(0<=a.la&&(g|=128),a.G&57344||(a.G=a.G|g|a.wa<<5|a.xa<<1),a.O(168,16)),a.G&61440||!(4191360>f||4194239<f)||(a.G|=4096,a.G&512&&(a.D|=32)));return f}function od(a){var b=a.T(a.u[6]|a.aa);a.u[6]=a.u[6]+2&65535;return b}
function md(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.G&57344||(a.Oa=a.Oa<<8|246);!a.C&&c<=a.Pa&&4<c&&(c<=a.Pa-32?(a.$|=4,a.u[6]=4,a.O(4,18)):(a.$|=8,a.D|=4));a.Wb(c,b)}
function qd(a,b,c,d){var e,f,g=d&8?0:a.aa;switch(b){case 0:return a.O(4,20),0;case 1:return 6===c&&!a.C&&d&4&&(a.u[6]<=a.Pa||65534<=a.u[6])&&(a.u[6]<=a.Pa-32||65534<=a.u[6]?(a.$|=4,a.u[6]=4,a.O(4,22)):(a.$|=8,a.D|=64)),a.b-=3,7===c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!==c&&(e|=g);e=a.T(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!==c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!==c&&(e|=g);e=a.T(e)|g;a.b-=
8;break;case 6:return e=gd(a),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=gd(a),e=e+a.u[c]&65535,e=a.T(e|a.aa)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.G&57344||(a.Oa=a.Oa<<8|f<<3&248|c);6==c&&!a.C&&d&4&&0>=f&&(a.u[6]<=a.Pa||65534<=a.u[6])&&(a.u[6]<=a.Pa-32?(a.$|=4,a.u[6]=4,a.O(4,24)):(a.$|=8,a.D|=64));return e}h.tc=function(a,b,c){return qd(this,a,b,c)};h.uc=function(a,b,c){return pd(this,qd(this,a,b,c),c)};h.$c=function(a){return this.B.ma(a)};h.ec=function(a){return this.B.ma(pd(this,a,2))};
h.Cd=function(a,b){this.B.Xa(a,b&65535)};h.Dd=function(a,b){this.B.Xa(pd(this,a,4),b)};function rd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=qd(a,b,d,2),c&65536||61440!==(a.K&61440)&&(d&=65535),a.C=a.K>>12&3,c=a.T(d|c&a.aa),a.C=a.K>>14&3):c=6!=d||(a.K>>2&12288)===(a.K&12288)?a.u[d]:a.ta[a.K>>12&3];return c}
function sd(a,b,c,d){a.G&57344||(a.Oa=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=qd(a,b,e,4),c&65536||(e&=65535),a.C=a.K>>12&3,e=pd(a,e|c&65536,4),a.C=a.K>>14&3,a.B.Xa(e,d)):6!=e||(a.K>>2&12288)===(a.K&12288)?a.u[e]=d:a.ta[a.K>>12&3]=d}function td(a,b){b>>=6;var c=a.I=b&7;(b=a.H=(b&56)>>3)?(c=a.M(b,c,3),a=a.B.Ua(c)):a=a.u[c]&255;return a}function ud(a,b){b>>=6;var c=a.I=b&7;return(b=a.H=(b&56)>>3)?a.B.ma(a.M(b,c,2)):a.u[c]}function vd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return qd(a,b,c,8)}
function wd(a,b){var c=a.f=b&7;(b=a.g=(b&56)>>3)?(c=a.M(b,c,3),a=a.B.Ua(c)):a=a.u[c]&255;return a}function xd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.B.ma(a.M(b,c,2)):a.u[c]}function P(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.Za=a.M(b,e,7),c=d.call(a,c,a.B.Ua(e)),e&1&&a.b--,a.B.ob(e,c&255)):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function Q(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.M(b,e,6),a.B.Xa(e,d.call(a,c,a.B.ma(e)))):a.u[e]=d.call(a,c,a.u[e])}
function yd(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.M(b,e,5),d&1&&a.b--,a.B.ob(d,c&255)):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}function zd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.B.Xa(a.M(b,d,4),c):a.u[d]=c&65535;return c}function R(a,b,c){c&&(hd(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
h.fb=function(a){this.v.complete=!0;var b=this.v.rc=this.j&&Ad(this.j),c=a?this.v.Hb?0:1:-1;this.v.Hb=!1;this.N=this.b=a;do{if(b){if(Bd(this.j,this.u[7],c)){this.ea();break}c=1}if(this.D&&(this.D&112&&(this.D&32?this.O(168,28):this.D&64?this.O(4,30):this.D&16&&this.O(12,32),this.D&=-113),this.D&7))if(this.D&2){this.D&=-3;a=null;for(var d=this.Gb&224,e=this.A.length;0<=--e;){if(0<this.A[e].Ea){this.A[e].Ea--;this.D|=2;break}if(this.A[e].Ab){if(!this.A[e].Ab()){this.A.splice(e,1);continue}this.A[e].Ab=
null}this.A[e].Yb>d&&(d=this.A[e].Yb,a=this.A[e],this.A.splice(e,1))}d>(this.K&224)&&(this.D&4&&(this.u[7]=this.u[7]+2&65535,this.D&=-5),a?this.O(a.ic,26):this.O(160,26))}else this.D&1&&this.D++;this.G&57344||(this.Oa=0,this.Fb=this.u[7]);this.D=this.D&7|this.K&16;this.decode(gd(this))}while(0<this.b);return this.v.complete?this.N-this.b:void 0===this.v.complete?0:-1};La(function(){for(var a=A(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Ic(d);eb(d,c)}});
function Cd(a,b){var c=b+a;jd(this,c,a,b);return c&65535}function Dd(a,b){var c=b+a;jd(this,c<<8,a<<8,b<<8);return c&255}function Ed(a,b){a=b<<1;kd(this,a);return a&65535}function Fd(a,b){a=b<<1;kd(this,a<<8);return a&255}function Gd(a,b){a=b&32768|b>>1|b<<16;kd(this,a);return a&65535}function Hd(a,b){a=b&2048|b>>1|b<<8;kd(this,a<<8);return a&255}function Id(a,b){a=b&~a;O(this,a);return a}function Jd(a,b){a=b&~a;O(this,a<<8);return a}function Kd(a,b){a|=b;O(this,a);return a}
function Ld(a,b){a|=b;O(this,a<<8);return a}function Md(a,b){a=~b|65536;id(this,a);return a&65535}function Nd(a,b){a=~b|256;id(this,a<<8);return a&255}function Od(a,b){a=b-a;this.D&128||(this.U=this.Y=a,this.R=b&(b^a));return a&65535}function Pd(a,b){a=b-a;var c=a<<8;b<<=8;this.D&128||(this.U=this.Y=c,this.R=b&(b^c));return a&255}function Qd(a,b){a=b+a;this.D&128||(this.U=this.Y=a,this.R=a&(b^a));return a&65535}
function Rd(a,b){a=b+a;var c=a<<8;this.D&128||(this.U=this.Y=c,this.R=c&(b<<8^c));return a&255}function Sd(a,b){a=-b;id(this,a,a&b&32768);return a&65535}function Td(a,b){a=-b;id(this,a<<8,(a&b&128)<<8);return a&255}function Ud(a,b){a=b<<1|this.P>>16&1;kd(this,a);return a&65535}function Vd(a,b){a=b<<1|this.P>>16&1;kd(this,a<<8);return a&255}function Wd(a,b){a=(this.P&65536|b)>>1|b<<16;kd(this,a);return a&65535}function Xd(a,b){a=((this.P&65536)>>8|b)>>1|b<<8;kd(this,a<<8);return a&255}
function Yd(a,b){var c=b-a;ld(this,c,a,b);return c&65535}function Zd(a,b){var c=b-a;ld(this,c<<8,a<<8,b<<8);return c&255}function $d(a,b){this.D&128||(this.U=this.Y=b&65280,this.R=this.P=0);return(b<<8|b>>8)&65535}function ae(a,b){a^=b;O(this,a);return a&65535}
function be(a){var b=xd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.P=this.R=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.P=c<<17-b,c>>=b;else if(b)if(16<b)this.R=c,c=0;else{this.P=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.R=32768)}this.u[a]=c&65535;this.U=this.Y=c;this.b-=(this.g?6:7)+b}
function ce(a){var b=xd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.P=this.R=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.P=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.P=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.R=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.U=d>>16;this.Y=d>>16|d;this.b-=(this.g?6:7)+b}function S(a){a&1&&(this.P=0);a&2&&(this.R=0);a&4&&(this.Y=1);a&8&&(this.U=0);this.b-=5}
function de(a){var b=xd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.P=this.R=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.Y=d>>16|d,this.U=d>>16):(this.R=32768,this.Y=d>>15|d,this.U=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.Y=this.U=0,this.R=32768,this.P=65536,this.b-=7}var ee=[0,7,7,10,7,11,9,13];function fe(a){var b=this.b;hd(this,vd(this,a));this.b=b-ee[this.g]}
var ge=[0,14,14,17,14,18,16,20];function he(a){var b=this.b,c=vd(this,a);a=a>>6&7;md(this,this.u[a]);this.u[a]=this.u[7];hd(this,c);this.b=b-ge[this.g]}var ie=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],je=[7,13,13,17,14,18,17,21];function ke(a){var b=xd(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.D&128||(this.U=b>>16,this.Y=this.U|b,this.R=0,this.P=-32768>b||32767<b?65536:0);this.b-=23}
function le(){this.b-=5}function T(a){a&1&&(this.P=65536);a&2&&(this.R=32768);a&4&&(this.Y=0);a&8&&(this.U=32768);this.b-=5}function me(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)hd(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function ne(a){Q(this,a,0,$d);this.b-=this.g?9:3+(7==this.f?2:0)}function oe(a){Q(this,a,ud(this,a),ae);this.b-=this.g?9:3+(7==this.f?2:0)}function V(){this.O(8,6)}function bd(a){pe[a>>12].call(this,a)}
var pe=[function(a){qe[a>>8&15].call(this,a)},function(a){var b=ud(this,a),c=this.b;O(this,zd(this,a,b));this.b=c-ie[(this.H?8:0)+this.g]+(7!=this.f||this.g?0:2)},function(a){var b=ud(this,a);a=xd(this,a);ld(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){O(this,ud(this,a)&xd(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){Q(this,a,ud(this,a),Id);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?
2:0)},function(a){Q(this,a,ud(this,a),Kd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){Q(this,a,ud(this,a),Cd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){re[a>>8&15].call(this,a)},function(a){se[a>>8&15].call(this,a)},function(a){var b=td(this,a);O(this,yd(this,a,b,1)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){var b=td(this,a)<<8;a=wd(this,a)<<8;ld(this,b-a,a,b);this.b-=this.g?
4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){O(this,(td(this,a)&wd(this,a))<<8);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){P(this,a,td(this,a),Jd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){P(this,a,td(this,a),Ld);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){Q(this,a,ud(this,a),Yd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},V],qe=
[function(a){Me[a>>4&15].call(this,a)},function(a){R(this,a,!0)},function(a){R(this,a,!fd(this))},function(a){R(this,a,fd(this))},function(a){R(this,a,!this.Fa()==!ed(this))},function(a){R(this,a,!this.Fa()!=!ed(this))},function(a){R(this,a,!fd(this)&&!this.Fa()==!ed(this))},function(a){R(this,a,fd(this)||!this.Fa()!=!ed(this))},he,he,function(a){Ne[a>>6&3].call(this,a)},function(a){Oe[a>>6&3].call(this,a)},function(a){Pe[a>>6&3].call(this,a)},function(a){Qe[a>>6&3].call(this,a)},V,V],Ne=[function(a){id(this,
zd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Md);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,Qd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,Od);this.b-=this.g?9:3+(7==this.f?2:0)}],Oe=[function(a){Q(this,a,0,Sd);this.b-=this.g?11:6},function(a){Q(this,a,dd(this)?1:0,Cd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,dd(this)?1:0,Yd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=xd(this,a);id(this,a);this.b-=this.g?4:3+(7==this.f?
2:0)}],Pe=[function(a){Q(this,a,0,Wd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Ud);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Gd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Ed);this.b-=this.g?9:3+(7==this.f?2:0)}],Qe=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.ec(a|65536);hd(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=rd(this,a,0);md(this,a);O(this,a);this.b-=11},function(a){var b=od(this),c=this.b;sd(this,a,
0,b);O(this,b);this.b=c-je[this.g]},function(a){O(this,zd(this,a,this.Fa?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Me=[function(a){Re[a&15].call(this,a)},V,V,V,fe,fe,fe,fe,function(a){if(a&8)this.O(8,6);else{var b=od(this);a&=7;hd(this,this.u[a]);this.u[a]=b;this.b-=9}},function(a){a&8?(this.K&49152||(this.K=this.K&-2017|(a&7)<<5,this.D|=1),this.b-=5):this.O(8,6)},function(a){Se[a&15].call(this,a)},function(a){Te[a&15].call(this,a)},ne,ne,ne,ne],Re=[function(){this.K&49152?(this.$|=128,this.O(4,
3)):this.ea();this.b-=7},function(){this.D|=4;this.u[7]=this.u[7]+-2&65535;this.b-=3},function(){nd(this);this.D|=this.K&16;this.b-=13},function(){this.O(12,1);this.b-=5},function(){this.O(16,4);this.b-=25},function(){this.K&49152||(cd(this),this.B.reset());this.b-=667},function(){nd(this);this.b-=13},V,V,V,V,V,V,V,V,V],Se=[le,function(){this.P=0;this.b-=5},function(){this.R=0;this.b-=5},S,function(){this.Y=1;this.b-=5},S,S,S,function(){this.U=0;this.b-=5},S,S,S,S,S,S,S],Te=[le,function(){this.P=
65536;this.b-=5},function(){this.R=32768;this.b-=5},T,function(){this.Y=0;this.b-=5},T,T,T,function(){this.U=32768;this.b-=5},T,T,T,T,T,T,T],re=[ke,ke,de,de,be,be,ce,ce,oe,oe,V,V,V,V,me,me],se=[function(a){R(this,a,!this.Fa())},function(a){R(this,a,this.Fa())},function(a){R(this,a,!dd(this)&&!fd(this))},function(a){R(this,a,dd(this)||fd(this))},function(a){R(this,a,!ed(this))},function(a){R(this,a,ed(this))},function(a){R(this,a,!dd(this))},function(a){R(this,a,dd(this))},function(){this.O(24,2);
this.b-=25},function(){this.O(28,5);this.b-=5},function(a){Ue[a>>6&3].call(this,a)},function(a){Ve[a>>6&3].call(this,a)},function(a){We[a>>6&3].call(this,a)},function(a){Xe[a>>6&3].call(this,a)},V,V],Ue=[function(a){id(this,yd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Nd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,1,Rd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,1,Pd);this.b-=this.g?9:3+(7==this.f?2:0)}],Ve=[function(a){P(this,a,0,Td);this.b-=
this.g?11:6},function(a){P(this,a,dd(this)?1:0,Dd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,dd(this)?1:0,Zd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=wd(this,a);id(this,a<<8);this.b-=this.g?4:3+(7==this.f?2:0)}],We=[function(a){P(this,a,0,Xd);this.b-=this.g?9+(this.Za&1):3+(7==this.f?2:0)},function(a){P(this,a,0,Vd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Hd);this.b-=this.g?9+(this.Za&1):3+(7==this.f?2:0)},function(a){P(this,a,0,Fd);this.b-=this.g?9:3+(7==
this.f?2:0)}],Xe=[V,function(a){a=rd(this,a,65536);md(this,a);O(this,a);this.b-=11},function(a){var b=od(this),c=this.b;sd(this,a,65536,b);O(this,b);this.b=c-je[this.g]},V];function Ye(a){r.call(this,"ROM",a,Ye);this.f=null;this.C=a.addr;this.g=a.size;this.G=a.writable;this.F=a.alias;this.A=a.file;this.H=da(this.A);if(this.A){a=this.A;var b=ea(this.H);"json"!=b&&"hex"!=b&&(a=ga()+"/api/v1/dump?file="+this.A+"&format=bytes&decimal=true");var c=this;ua(a,null,!0,function(a,b,f){Ze(c,a,b,f)})}}y(Ye);
Ye.prototype.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;$e(this)};Ye.prototype.Ca=function(){if(this.Da){if(this.j){var a=this.j,b=this.id,c=this.C,d=this.g,e=this.Da,f=[],g;for(g in e){var l=e[g];"number"==typeof l&&(e[g]=l={o:l});var n=l.o,p=l.a;if(void 0!==n){var q=f,n=[n>>>0,g],v=qa(q,n,a.Lb);0>v&&q.splice(-(v+1),0,n)}p&&(l.a=p.replace(/''/g,'"'))}a.H.push({Id:b,w:c,vc:d,Da:e,Kb:f})}delete this.Da}return!0};Ye.prototype.Ba=function(){return!0};
function Ze(a,b,c,d){if(d)a.na("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.zb,b,c);var e;if("["==c.charAt(0)||"{"==c.charAt(0))try{var f,g,l=eval("("+c+")");if(f=l.bytes)a.f=f;else if(f=l.words)for(a.f=Array(2*f.length),g=e=0;e<f.length;e++)a.f[g++]=f[e]&255,a.f[g++]=f[e]>>8&255;else if(f=l.data)for(a.f=Array(4*f.length),g=e=0;e<f.length;e++)a.f[g++]=f[e]&255,a.f[g++]=f[e]>>8&255,a.f[g++]=f[e]>>16&255,a.f[g++]=f[e]>>24&255;else a.f=l;a.Da=l.symbols;if(!a.f.length){m("Empty ROM: "+
b);return}if(1==a.f.length){m(a.f[0]);return}}catch(n){a.na("ROM data error: "+n.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.f=Array(b.length),e=0;e<b.length;e++)a.f[e]=aa(b[e],16);$e(a)}}
function $e(a){if(!hb(a))if(!a.A)G(a);else if(a.f&&a.B){a.g||(a.g=a.f.length);if(a.f.length!=a.g)vb(a,"ROM size ("+k(a.f.length,8,!0)+") does not match specified size ("+k(a.g,8,!0)+")");else{var b;b=a.C;if(Gb(a.B,b,a.g,a.G?1:jc)){var c;for(c=0;c<a.f.length;c++){a.j&&a.j.g++;var d=a.B,e=b+c;d.X[(e&d.g)>>>d.Z].wb(e&d.f,a.f[c]&255,e);a.j&&a.j.g--}b=!0}else b=!1;if(b){b=[];"number"==typeof a.F?b.push(a.F):null!=a.F&&a.F.length&&(b=a.F);for(c=0;c<b.length;c++){for(var f=a,d=b[c],e=f.B,g=f.g,l=[],n=f.C>>>
e.Z;0<g&&n<e.X.length;)l.push(e.X[n++]),g-=e.ya;e=f.B;f=f.g;g=0;for(d>>>=e.Z;0<f&&d<e.X.length;){n=l[g++];if(!n)break;e.X[d++]=n;f-=e.ya}}delete a.f}}G(a)}}La(function(){for(var a=A(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Ye(d);eb(d,c)}});function af(a){r.call(this,"RAM",a,af);this.F=a.addr;this.g=a.size;this.f=!1}y(af);h=af.prototype;h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;G(this)};h.Ca=function(a,b){b||this.reset();return!0};
h.Ba=function(a){return a?this.save():!0};h.reset=function(){!this.f&&this.g&&Gb(this.B,this.F,this.g,1)&&(this.f=!0);this.f||m("No RAM allocated")};h.save=function(){return null};h.restore=function(){return!0};La(function(){for(var a=A(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new af(d);eb(d,c)}});function bf(a){r.call(this,"Keyboard",a,bf,65536);G(this)}y(bf);bf.prototype.ja=function(){return!1};bf.prototype.Ga=function(a,b,c,d){this.F=a;this.b=c;this.j=d;this.oa=null};
La(function(){for(var a=A(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new bf(d);eb(d,c)}});function W(a){this.A=this.G=null;this.V=a.tabSize;this.M=a.charBOL;this.H=0;r.call(this,"SerialPort",a,W,8388608);var b=a.binding;if("console"==b)this.G="";else{var c;a=cf;b&&(void 0===c&&(c="Panel"),(c=db(c,this.id))&&(b=c.J[b])&&this.ja(null,a,b))}this.I=this.L=null;this.exports={connect:this.Tb,receiveData:this.Eb}}y(W);var cf="buffer";h=W.prototype;
h.ja=function(a,b,c){var d=this;switch(b){case cf:return this.J[b]=this.A=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.Eb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Eb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.b=c;this.j=d;var e=this;this.W=Pb(this.b,function(){e.f&128||!e.C.length||(e.T=e.C.shift(),e.f|=128,e.f&64&&Qb(e.b,40,4,48))});this.N=function(){e.g|=128;return!!(e.g&64)};Nb(b,this,df);G(this)};
h.Tb=function(){if(!this.I){var a=wc(this.F,"connection");if(a){var b=a.split("->");if(2==b.length){var c=oa(b[0]);if(c!=this.Ya)return;b=oa(b[1]);if(this.I=cb(b)){var d=this.I.exports;if(d){var e=d.connect;e&&e.call(this.I);if(this.L=d.receiveData){this.status(this.zb+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.Ca=function(a,b){if(!b)if(this.Tb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.Ba=function(a){return a?this.save():!0};h.reset=function(){ef(this)};h.save=function(){var a=new N(this);a.set(0,[]);return a.data()};h.restore=function(){return ef(this)};function ef(a){a.T=0;a.f=0;a.g=128;a.C=[];return!0}h.Eb=function(a){if("number"==typeof a)this.C.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.C.push(a.charCodeAt(b));else this.C=this.C.concat(a);Rb(this.b,this.W,50);return!0};h.Pc=function(){return this.f&65535};h.rd=function(a){this.f=this.f&-112|a&111};
h.Oc=function(){this.f&=-129;0<this.C.length&&Rb(this.b,this.W,50);return this.T};h.qd=function(){};h.bd=function(){return this.g};h.Fd=function(a){128==(this.g&192)&&a&64&&Qb(this.b,8,4,52,this.N);this.g=this.g&-70|a&69};h.ad=function(){return 0};
h.Ed=function(a){if(a&=255){D(this,"transmitByte("+k(a,2,!0)+")");this.L&&this.L.call(this.I,a);if(this.A)if(13==a)this.H=0;else if(8==a)this.A.value=this.A.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=pa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.V||8,c=a-this.H%a,this.V&&(b=na("",c)));this.M&&!this.H&&c&&(b=String.fromCharCode(this.M)+b);this.A.value+=b;this.A.scrollTop=this.A.scrollHeight;this.H+=c}else if(null!=this.G){if(10==a||1024<=this.G.length)this.i(this.G),
this.G="";10!=a&&(this.G+=String.fromCharCode(a))}this.g&=-129;Qb(this.b,100,4,52,this.N)}};var ff={},df=(ff[65392]=[null,null,W.prototype.Pc,W.prototype.rd,"RCSR"],ff[65394]=[null,null,W.prototype.Oc,W.prototype.qd,"RBUF"],ff[65396]=[null,null,W.prototype.bd,W.prototype.Fd,"XCSR"],ff[65398]=[null,null,W.prototype.ad,W.prototype.Ed,"XBUF"],ff);La(function(){for(var a=A(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new W(d);eb(d,c)}});
function gf(a){r.call(this,"Debugger",a,gf);this.ia=a.base||16;this.xa=!1;this.T=this.wa=this.I=0;this.W=!1;this.C=-1;this.A=[];this.ca={}}y(gf);var hf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};gf.prototype.Pb=function(){return-1};gf.prototype.Qb=function(){};
function jf(a,b,c,d){if(c)if(b){0>a.C&&a.A.length&&(a.C=0);if(0>a.C||b!=a.A[a.C])a.A.splice(0,0,b),a.C=0;a.C--}else a.W?b="end":b=a.A[a.C+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(oa(b.substring(c,f))),c=f+1}}return a}
function kf(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
La(function(){for(var a=A(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=z(c);switch(d.name){case "default":d=new J(d),eb(d,c)}}});var Xb;if(wb){var gc=new ArrayBuffer(2);(new DataView(gc)).setUint16(0,256,!0);Xb=256===(new Uint16Array(gc))[0]}else Xb=!1;var hc=Xb;
function H(a,b,c,d,e,f){this.b=a;this.id=ic+=2;this.f=null;this.w=b;this.ob=c;this.size=d||0;this.type=e||jc;this.g=e==kc;this.controller=null;Fb(this);this.La=this.sc=!1;if(d)if(f)this.controller=f,this.f=null,lc(this,f.pc);else if(wb)this.A=new ArrayBuffer(d),this.G=new DataView(this.A,0,d),this.C=new Uint8Array(this.A,0,d),this.I=new Uint16Array(this.A,0,d>>1),this.f=new Int32Array(this.A,0,d>>2),lc(this,hc?mc:nc);else{this.f=Array(d>>2);for(a=0;a<this.f.length;a++)this.f[a]=0;lc(this,oc)}else lc(this)}
var jc=0,kc=2,Kb=4,Lb=["NONE","RAM","ROM","VID","H/W"],ic=0;
H.prototype={constructor:H,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(wb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.G.getInt32(b<<2,!0);else a=this.f;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(wb)for(b=0;b<a.length;b++)this.G.setInt32(b<<2,a[b],!0);else this.f=a;return this.La=!0}return!1},Sa:function(a,b){b?this.J++||pc(this,qc,!1):this.B++||rc(this,qc,!1)},L:function(){this.j&&F(this.j,128)&&(D(this.j,"attempt to read invalid block %"+
k(this.w),!0),this.j.ea());return 255},F:function(a,b){this.j&&F(this.j,128)&&(D(this.j,"attempt to write "+k(b,4,!0)+" to invalid block %"+k(this.w),!0),this.j.ea())},M:function(a,b){return this.ub(a++,b++)|this.ub(a,b)<<8},H:function(a,b,c){this.vb(a++,b&255,c++);this.vb(a,b>>8,c)},X:function(a){return this.f[a>>2]>>>((a&3)<<3)&255},ga:function(a,b){a&1&&this.b.O(4,b);b=a>>2;a=(a&3)<<3;var c=this.f[b]>>a;return 24>a?c&65535:c&255|(this.f[b+1]&255)<<8},oa:function(a,b){var c=a>>2;a=(a&3)<<3;this.f[c]=
this.f[c]&~(255<<a)|b<<a;this.La=!0},Xa:function(a,b,c){a&1&&this.b.O(4,c);c=a>>2;a=(a&3)<<3;24>a?this.f[c]=this.f[c]&~(65535<<a)|b<<a:(this.f[c]=this.f[c]&16777215|b<<24,c++,this.f[c]=this.f[c]&-256|b>>8);this.La=!0},U:function(a,b){if(this.j&&null!=this.w){var c=this.j;sc(c,this.w+a,1,c.N)&&c.ea(!0)}return this.Bb(a,b)},ca:function(a,b){if(this.j&&null!=this.w){var c=this.j;sc(c,this.w+a,2,c.N)&&c.ea(!0)}return this.Cb(a,b)},ka:function(a,b,c){if(this.j&&null!=this.w){var d=this.j;sc(d,this.w+a,
1,d.G)&&d.ea(!0)}this.g?this.F(a,b,c):this.wb(a,b,c)},xa:function(a,b,c){if(this.j&&null!=this.w){var d=this.j;sc(d,this.w+a,2,d.G)&&d.ea(!0)}this.g?this.F(a,b,c):this.Ib(a,b,c)},N:function(a){return this.C[a]},W:function(a,b){a=this.C[a];this.j&&F(this.j,128)&&D(this.j,"Memory.readByte("+I(this.j,b)+"): "+I(this.j,a),!0);return a},aa:function(a,b){a&1&&this.b.O(4,b);return this.G.getUint16(a,!0)},da:function(a,b){a&1&&this.b.O(4,b);a=this.I[a>>1];this.j&&F(this.j,128)&&D(this.j,"Memory.readWord("+
I(this.j,b)+"): "+I(this.j,a),!0);return a},ia:function(a,b){this.C[a]=b;this.La=!0},la:function(a,b,c){this.C[a]=b;this.La=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0)},wa:function(a,b,c){a&1&&this.b.O(4,c);this.G.setUint16(a,b,!0);this.La=!0},ya:function(a,b,c){a&1&&this.b.O(4,c);this.I[a>>1]=b;this.La=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeWord("+I(this.j,c)+","+I(this.j,b)+")",!0)}};
function Fb(a,b,c){a.j=b;a.B=a.J=0;c&&((a.B=c.B)&&rc(a,qc,!1),(a.J=c.J)&&pc(a,qc,!1))}function tc(a,b){b?--a.J||(a.vb=a.g?a.F:a.wb,a.nc=a.g?a.H:a.Ib):--a.B||(a.ub=a.Bb,a.cc=a.Cb)}function pc(a,b,c){c&&a.J||(a.vb=!a.g&&b[1]||a.F,a.nc=!a.g&&b[3]||a.H);if(c||void 0===c)a.wb=b[1]||a.F,a.Ib=b[3]||a.H}function rc(a,b,c){c&&a.B||(a.ub=b[0]||a.L,a.cc=b[2]||a.M);if(c||void 0===c)a.Bb=b[0]||a.L,a.Cb=b[2]||a.M}function lc(a,b){b||(b=uc);rc(a,b,void 0);pc(a,b,void 0)}
var uc=[],oc=[H.prototype.X,H.prototype.oa,H.prototype.ga,H.prototype.Xa],qc=[H.prototype.U,H.prototype.ka,H.prototype.ca,H.prototype.xa];if(wb)var nc=[H.prototype.N,H.prototype.ia,H.prototype.aa,H.prototype.wa],mc=[H.prototype.W,H.prototype.la,H.prototype.da,H.prototype.ya];
function vc(a,b){r.call(this,"CPU",a,vc,1);var c=a.multiplier||1;this.Ja=a.cycles||b;this.Na=c;this.Za=Math.round(this.Ja/1E4)/100;this.Va=this.Za*this.Na;this.v.ba=!1;this.v.Gb=!1;this.v.gb=a.autoStart;this.v.Lb=!1;this.v.$a=!1;this.jb=this.ia=0;this.kb=a.csStart;this.bb=a.csInterval;this.cb=a.csStop;this.L=[];this.Ub=this.cd.bind(this);G(this)}y(vc);var wc=["power","reset"];h=vc.prototype;
h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.j=d;for(b=0;b<wc.length;b++)(c=this.J[wc[b]])&&this.F.ja(null,wc[b],c);a=xc(a,"autoStart");null!=a&&(this.v.gb="true"==a?!0:"false"==a?!1:!!a);this.Sb();G(this)};h.Sb=function(){};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};
h.Ca=function(a,b){if(!b){if(a&&this.restore){yc(this);if(!this.restore(a))return!1;zc(this)}else this.reset();this.j?(a=this.j,a.i("Type ? for help with PDP11 Debugger commands"),a.za(),a.Ja&&(b=a.Ja,a.Ja=null,Ac(a,b))):this.i("No debugger detected")}M(this);return!0};h.Ba=function(a){return a?this.save():!0};h.gb=function(){return this.v.gb||!this.j&&void 0===this.J.run?(this.eb(!0),!0):!1};h.Ob=function(){return 0};
function zc(a){void 0===a.kb&&(a.kb=0);void 0===a.bb&&(a.bb=-1);void 0===a.cb&&(a.cb=-1);a.v.$a=0<=a.kb&&0<a.bb;a.v.$a&&(a.jb=0,a.ia=a.kb-a.ga)}function Bc(a,b){if(a.v.$a){var c=!1;a.jb=a.jb+a.Ob()|0;a.ia-=b;0>=a.ia&&(a.ia+=a.bb,c=!0);0<=a.cb&&a.cb<=Cc(a)&&(a.bb=a.cb=-1,zc(a),a.ea(),c=!0);c&&a.i(Cc(a)+" cycles: checksum="+k(a.jb))}}
function Dc(a,b,c,d){if(a.J[b]){void 0===c&&(vb(a,"Value for "+b+" is invalid"),a.ea());var e=a.j&&a.j.ia||8;c=!a.v.ba||a.v.Lb?8==e?ba(c,d):k(c,d):"--------".substr(0,d||4);a.J[b].textContent!=c&&(a.J[b].textContent=c)}}
h.ja=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.J[b]=c;a=!0;break;case "run":this.J[b]=c;c.onclick=function(){var a;if(a=d.F)if(a=d.F,a.v.fa)a=!0;else{var b=null,c,l=bb(a.id);for(c=0;c<l.length&&(b=l[c],b===a||b.v.ready);c++);if(c==l.length)for(c=0;c<l.length&&(b=l[c],b===a||b.v.fa);c++);c==l.length&&(b=a);m("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.qb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ba?d.ea():d.eb())};
a=!0;break;case "speed":this.J[b]=c;a=!0;break;case "setSpeed":this.J[b]=c,c.onclick=function(){Ec(d,d.Na<<1,!0)},c.textContent=this.Va.toFixed(2)+"Mhz",a=!0}return a};function Fc(a,b,c){a.ga+=b;c&&(a.N=a.b=0)}function Gc(a,b){var c=1;b&&1<a.Na&&a.ca&&(c=a.ca/a.Za);a.rb=Math.round(1E3/30);a.Ra=Math.floor(a.Ja/30*c);b||(a.ka=a.Ra);a.ib=0}function Cc(a){return a.ga+a.X+a.N-a.b}function yc(a){a.ca=0;a.Rb=0;a.ga=a.X=a.N=a.b=0;zc(a);Ec(a,1)}
function Ec(a,b,c){var d=!1;if(void 0!==b){.8>a.ca/a.Va?b=1:d=!0;a.Na=b;b=a.Za*a.Na;if(a.Va!=b){a.Va=b;b=a.Va.toFixed(2)+"Mhz";var e=a.J.setSpeed;e&&(e.textContent=b);a.i("target speed: "+b)}c&&a.F&&a.F.nb()}Fc(a,a.X);a.X=0;a.W=ra();a.da=0;Gc(a);return d}function Qb(a,b){var c=a.L.length;a.L.push([-1,b]);return c}function Sb(a,b,c){0<=b&&b<a.L.length&&0>a.L[b][0]&&(c*=a.Ja*a.Na/1E3,a.L[b][0]=c)}function Hc(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||b>d[0]&&(b=d[0])}return b}
function Ic(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}
h.cd=function(){if(this.v.ba){this.ib>=this.Ja&&Gc(this,!0);this.oa=0;this.Ia=ra();if(this.da){var a=this.Ia-this.da;a>this.rb&&(this.W+=a,this.W>this.Ia&&(this.W=this.Ia))}try{do{var b=Hc(this,this.v.$a?1:this.Ra);try{this.fb(b)}catch(e){if("number"!=typeof e)throw e;}var c=this.N-this.b;Ic(this,c);this.oa+=c;this.X+=c;Fc(this,0,!0);Bc(this,c);this.ka-=c;if(0>=this.ka){this.ka+=this.Ra;15<=++this.Rb&&(this.F&&this.F.za(),this.Rb=0);break}}while(this.v.ba)}catch(e){this.ea();M(this);this.F&&this.F.stop(ra(),
Cc(this));vb(this,e.stack||e.message);return}if(this.v.ba){a=setTimeout;b=this.Ub;this.da=ra();c=this.rb;this.oa&&(c=Math.round(c*this.oa/this.Ra));var c=c-(this.da-this.Ia),d=this.da-this.W;d&&(this.ca=Math.round(this.X/(10*d))/100,864E5<=d&&(this.ga=0,Ec(this)));if(0>c||this.ca<this.Va)-1E3>c&&(this.W-=c),c=0;this.ib+=this.oa;this.da+=c;a(b,c)}}};
h.eb=function(a){if(ib(this))return!1;if(this.v.ba)return this.i(this.toString()+" busy"),!1;Ec(this);this.v.ba=!0;this.v.Gb=!0;var b=this.J.run;b&&(b.textContent="Halt");this.F&&(a&&this.F.nb(!0),this.F.start(this.W,Cc(this)));M(this,!0);setTimeout(this.Ub,0);return!0};h.fb=function(){return 0};h.ea=function(a){if(this.v.ba){this.N-=this.b;this.b=0;Fc(this,this.X);this.X=0;this.v.ba=!1;var b=this.J.run;b&&(b.textContent="Run");this.F&&this.F.stop(ra(),Cc(this));M(this)}this.v.complete=a};
function M(a,b){a.F&&a.F.za(b)}
function Jc(a){this.Wb=+a.model||1170;this.yc=a.resetAddr||0;vc.call(this,a,6666667);this.pb=0;this.decode=Kc.bind(this);this.R=65536;this.S=32768;this.Z=65535;this.V=32768;this.K=15;this.u=[0,0,0,0,0,0,0,this.yc];this.Ha=[0,0,0,0,0,0];this.ta=[0,0,0,0];this.xa=this.C=0;this.vc=[4,2,0,1];this.T=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.pa=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.zc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.fc=[0,0,0,0,0,0,0,0];this.g=this.f=this.Ya=this.H=this.I=this.D=this.ec=0;this.la=-1;Lc(this);this.v.complete=this.v.rc=!1}y(Jc,vc);h=Jc.prototype;h.Sb=function(){Tb(this)};h.reset=function(){this.v.ba&&this.ea();Lc(this);yc(this);this.v.error=!1;this.parent.reset.call(this)};
function Lc(a){a.Qa=255;a.$=0;a.Fb=0;a.G=0;a.Oa=0;a.Eb=0;a.Pa=0;a.tb=0;a.wa=0;a.ab=262143;a.ya=253952;a.A=[];a.D|=2;a.B&&Tb(a)}function Tb(a){a.tb?(a.aa=65536,a.M=a.uc,a.U=a.dc,a.Vb=a.Dd,Gb(a.B,a.Pa&16?22:18)):(a.aa=0,a.M=a.tc,a.U=a.$c,a.Vb=a.Cd,Gb(a.B,16))}h.Ob=function(){return 0};h.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.ga,this.Na]);a.set(2,Nb(this.B));return a.data()};
h.restore=function(a){var b=a[1];this.ga=b[1];Ec(this,b[3]);a:{b=this.B;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.H){for(var f=0,g=Array(b.H),l=0;l<e.length-1;)for(var n=e[l++],p=e[l++];n--;)g[f++]=p;e=g}f=b.P[d];if(!f||!f.restore(e)){m("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
h.ja=function(a,b,c){switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":this.J[b]=c;this.pb++;a=!0;break;default:a=this.parent.ja.call(this,a,b,c)}return a};
h.za=function(a){if(this.pb&&(a||!this.v.ba||this.v.Lb)){for(a=0;a<this.u.length;a++)Dc(this,"R"+a,this.u[a]);a=Vb(this);Dc(this,"PS",a);Dc(this,"NF",a&8?1:0,1);Dc(this,"ZF",a&4?1:0,1);Dc(this,"VF",a&2?1:0,1);Dc(this,"CF",a&1?1:0,1)}if(a=this.J.speed)a.textContent=this.v.ba&&this.ca?this.ca.toFixed(2)+"Mhz":"Stopped"};function ed(a){return a.R&65536?1:0}function fd(a){return a.S&32768?2:0}function gd(a){return a.Z&65535?0:4}h.Fa=function(){return this.V&32768?8:0};
function hd(a){var b=a.U(a.u[7]);a.u[7]=a.u[7]+2&65535;return b}function id(a,b){a.u[7]=b&65535}function Rb(a,b,c,d,e){for(var f=a.A.length;0<f--;)if(a.A[f].hc===d){0<f&&(a.A[f-1].Ea+=a.A[f].Ea);a.A.splice(f,1);break}if(0<=b){for(f=a.A.length;0<f--;){if(a.A[f].Ea>b){a.A[f].Ea-=b;break}b-=a.A[f].Ea}a.A.splice(f+1,0,{Ea:b,Xb:c<<5&224,hc:d,Ab:e})}a.D|=2}function Vb(a){return a.K=a.K&63728|a.Fa()|gd(a)|fd(a)|ed(a)}
function Wb(a,b){a.V=b<<12;a.Z=~b&4;a.S=b<<14;a.R=b<<16;if((b^a.K)&2048)for(var c=a.Ha.length;0<=--c;){var d=a.u[c];a.u[c]=a.Ha[c];a.Ha[c]=d}a.C=b>>14&3;c=a.K>>14&3;a.C!=c&&(a.ta[c]=a.u[6],a.u[6]=a.ta[a.C]);a.D|=2;a.K=b}function O(a,b){a.D&128||(a.V=a.Z=b,a.S=0)}function jd(a,b,c){a.D&128||(a.V=a.Z=a.R=b,a.S=c||0)}function kd(a,b,c,d){a.D&128||(a.V=a.Z=a.R=b,a.S=(c^b)&(d^b))}function ld(a,b){a.D&128||(a.V=a.Z=a.R=b,a.S=a.V^a.R>>1)}function md(a,b,c,d){a.D&128||(a.V=a.Z=a.R=b,a.S=(c^d)&(d^b))}
h.O=function(a){var b=!1;0>this.la?this.la=Vb(this):this.C||(a=4,b=!0);this.G&57344||(this.Oa=63222,this.Eb=a);this.C=0;var c=this.U(a|this.aa),d=this.U(a+2&65535|this.aa);Wb(this,d&-12289|this.la>>2&12288);b&&(this.$|=4,this.u[6]=4);nd(this,this.la);nd(this,this.u[7]);id(this,c);this.D&=-113;this.la=-1;throw a;};function od(a){var b=pd(a),c=pd(a)&-1793;a.K&49152&&(c=c&-225|a.K&63712);id(a,b);Wb(a,c);a.D&=-17}
function qd(a,b,c){var d,e,f,g=0;d=b>>13;a.Pa&a.vc[a.C]||(d&=7);e=a.T[a.C][d];f=(a.pa[a.C][d]<<6)+(b&8191)&a.ab;if(f<a.ya)f&1&&!(c&1)&&(a.$|=64,a.O(4,10));else if(a.Pa&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var l=f>>13&31;31>l?a.Pa&32&&(f=a.zc[l]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.ya&&4186112>f&&(a.$|=32,a.O(4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:
128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.T[a.C][d]=e;if(4194170!==f||a.C)a.wa=a.C,a.xa=d;g&&(g&57344&&(0<=a.la&&(g|=128),a.G&57344||(a.G=a.G|g|a.wa<<5|a.xa<<1),a.O(168,16)),a.G&61440||!(4191360>f||4194239<f)||(a.G|=4096,a.G&512&&(a.D|=32)));return f}function pd(a){var b=a.U(a.u[6]|a.aa);a.u[6]=a.u[6]+2&65535;return b}
function nd(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.G&57344||(a.Oa=a.Oa<<8|246);!a.C&&c<=a.Qa&&4<c&&(c<=a.Qa-32?(a.$|=4,a.u[6]=4,a.O(4,18)):(a.$|=8,a.D|=4));a.Vb(c,b)}
function rd(a,b,c,d){var e,f,g=d&8?0:a.aa;switch(b){case 0:return a.O(4,20),0;case 1:return 6===c&&!a.C&&d&4&&(a.u[6]<=a.Qa||65534<=a.u[6])&&(a.u[6]<=a.Qa-32||65534<=a.u[6]?(a.$|=4,a.u[6]=4,a.O(4,22)):(a.$|=8,a.D|=64)),a.b-=3,7===c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!==c&&(e|=g);e=a.U(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.U(e)|g;a.b-=
8;break;case 6:return e=hd(a),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=hd(a),e=e+a.u[c]&65535,e=a.U(e|a.aa)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.G&57344||(a.Oa=a.Oa<<8|f<<3&248|c);6==c&&!a.C&&d&4&&0>=f&&(a.u[6]<=a.Qa||65534<=a.u[6])&&(a.u[6]<=a.Qa-32?(a.$|=4,a.u[6]=4,a.O(4,24)):(a.$|=8,a.D|=64));return e}h.tc=function(a,b,c){return rd(this,a,b,c)};h.uc=function(a,b,c){return qd(this,rd(this,a,b,c),c)};h.$c=function(a){return this.B.ma(a)};h.dc=function(a){return this.B.ma(qd(this,a,2))};
h.Cd=function(a,b){this.B.Wa(a,b&65535)};h.Dd=function(a,b){this.B.Wa(qd(this,a,4),b)};function sd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=rd(a,b,d,2),c&65536||61440!==(a.K&61440)&&(d&=65535),a.C=a.K>>12&3,c=a.U(d|c&a.aa),a.C=a.K>>14&3):c=6!=d||(a.K>>2&12288)===(a.K&12288)?a.u[d]:a.ta[a.K>>12&3];return c}
function td(a,b,c,d){a.G&57344||(a.Oa=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=rd(a,b,e,4),c&65536||(e&=65535),a.C=a.K>>12&3,e=qd(a,e|c&65536,4),a.C=a.K>>14&3,a.B.Wa(e,d)):6!=e||(a.K>>2&12288)===(a.K&12288)?a.u[e]=d:a.ta[a.K>>12&3]=d}function ud(a,b){b>>=6;var c=a.I=b&7;(b=a.H=(b&56)>>3)?(c=a.M(b,c,3),a=a.B.Ua(c)):a=a.u[c]&255;return a}function vd(a,b){b>>=6;var c=a.I=b&7;return(b=a.H=(b&56)>>3)?a.B.ma(a.M(b,c,2)):a.u[c]}function wd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return rd(a,b,c,8)}
function xd(a,b){var c=a.f=b&7;(b=a.g=(b&56)>>3)?(c=a.M(b,c,3),a=a.B.Ua(c)):a=a.u[c]&255;return a}function yd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.B.ma(a.M(b,c,2)):a.u[c]}function P(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.Ya=a.M(b,e,7),c=d.call(a,c,a.B.Ua(e)),e&1&&a.b--,a.B.mb(e,c&255)):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function Q(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.M(b,e,6),a.B.Wa(e,d.call(a,c,a.B.ma(e)))):a.u[e]=d.call(a,c,a.u[e])}
function zd(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.M(b,e,5),d&1&&a.b--,a.B.mb(d,c&255)):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}function Ad(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.B.Wa(a.M(b,d,4),c):a.u[d]=c&65535;return c}function R(a,b,c){c&&(id(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
h.fb=function(a){this.v.complete=!0;var b=this.v.rc=this.j&&Bd(this.j),c=a?this.v.Gb?0:1:-1;this.v.Gb=!1;this.N=this.b=a;do{if(b){if(Cd(this.j,this.u[7],c)){this.ea();break}c=1}if(this.D&&(this.D&112&&(this.D&32?this.O(168,28):this.D&64?this.O(4,30):this.D&16&&this.O(12,32),this.D&=-113),this.D&7))if(this.D&2){this.D&=-3;a=null;for(var d=this.Fb&224,e=this.A.length;0<=--e;){if(0<this.A[e].Ea){this.A[e].Ea--;this.D|=2;break}if(this.A[e].Ab){if(!this.A[e].Ab()){this.A.splice(e,1);continue}this.A[e].Ab=
null}this.A[e].Xb>d&&(d=this.A[e].Xb,a=this.A[e],this.A.splice(e,1))}d>(this.K&224)&&(this.D&4&&(this.u[7]=this.u[7]+2&65535,this.D&=-5),a?this.O(a.hc,26):this.O(160,26))}else this.D&1&&this.D++;this.G&57344||(this.Oa=0,this.Eb=this.u[7]);this.D=this.D&7|this.K&16;this.decode(hd(this))}while(0<this.b);return this.v.complete?this.N-this.b:void 0===this.v.complete?0:-1};La(function(){for(var a=A(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Jc(d);eb(d,c)}});
function Dd(a,b){var c=b+a;kd(this,c,a,b);return c&65535}function Ed(a,b){var c=b+a;kd(this,c<<8,a<<8,b<<8);return c&255}function Fd(a,b){a=b<<1;ld(this,a);return a&65535}function Gd(a,b){a=b<<1;ld(this,a<<8);return a&255}function Hd(a,b){a=b&32768|b>>1|b<<16;ld(this,a);return a&65535}function Id(a,b){a=b&2048|b>>1|b<<8;ld(this,a<<8);return a&255}function Jd(a,b){a=b&~a;O(this,a);return a}function Kd(a,b){a=b&~a;O(this,a<<8);return a}function Ld(a,b){a|=b;O(this,a);return a}
function Md(a,b){a|=b;O(this,a<<8);return a}function Nd(a,b){a=~b|65536;jd(this,a);return a&65535}function Od(a,b){a=~b|256;jd(this,a<<8);return a&255}function Pd(a,b){a=b-a;this.D&128||(this.V=this.Z=a,this.S=b&(b^a));return a&65535}function Qd(a,b){a=b-a;var c=a<<8;b<<=8;this.D&128||(this.V=this.Z=c,this.S=b&(b^c));return a&255}function Rd(a,b){a=b+a;this.D&128||(this.V=this.Z=a,this.S=a&(b^a));return a&65535}
function Sd(a,b){a=b+a;var c=a<<8;this.D&128||(this.V=this.Z=c,this.S=c&(b<<8^c));return a&255}function Td(a,b){a=-b;jd(this,a,a&b&32768);return a&65535}function Ud(a,b){a=-b;jd(this,a<<8,(a&b&128)<<8);return a&255}function Vd(a,b){a=b<<1|this.R>>16&1;ld(this,a);return a&65535}function Wd(a,b){a=b<<1|this.R>>16&1;ld(this,a<<8);return a&255}function Xd(a,b){a=(this.R&65536|b)>>1|b<<16;ld(this,a);return a&65535}function Yd(a,b){a=((this.R&65536)>>8|b)>>1|b<<8;ld(this,a<<8);return a&255}
function Zd(a,b){var c=b-a;md(this,c,a,b);return c&65535}function $d(a,b){var c=b-a;md(this,c<<8,a<<8,b<<8);return c&255}function ae(a,b){this.D&128||(this.V=this.Z=b&65280,this.S=this.R=0);return(b<<8|b>>8)&65535}function be(a,b){a^=b;O(this,a);return a&65535}
function ce(a){var b=yd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.R=this.S=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.R=c<<17-b,c>>=b;else if(b)if(16<b)this.S=c,c=0;else{this.R=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.S=32768)}this.u[a]=c&65535;this.V=this.Z=c;this.b-=(this.g?6:7)+b}
function de(a){var b=yd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.R=this.S=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.R=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.R=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.S=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.V=d>>16;this.Z=d>>16|d;this.b-=(this.g?6:7)+b}function S(a){a&1&&(this.R=0);a&2&&(this.S=0);a&4&&(this.Z=1);a&8&&(this.V=0);this.b-=5}
function ee(a){var b=yd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.R=this.S=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.Z=d>>16|d,this.V=d>>16):(this.S=32768,this.Z=d>>15|d,this.V=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.Z=this.V=0,this.S=32768,this.R=65536,this.b-=7}var fe=[0,7,7,10,7,11,9,13];function ge(a){var b=this.b;id(this,wd(this,a));this.b=b-fe[this.g]}
var he=[0,14,14,17,14,18,16,20];function ie(a){var b=this.b,c=wd(this,a);a=a>>6&7;nd(this,this.u[a]);this.u[a]=this.u[7];id(this,c);this.b=b-he[this.g]}var je=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],ke=[7,13,13,17,14,18,17,21];function le(a){var b=yd(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.D&128||(this.V=b>>16,this.Z=this.V|b,this.S=0,this.R=-32768>b||32767<b?65536:0);this.b-=23}
function me(){this.b-=5}function T(a){a&1&&(this.R=65536);a&2&&(this.S=32768);a&4&&(this.Z=0);a&8&&(this.V=32768);this.b-=5}function ne(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)id(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function oe(a){Q(this,a,0,ae);this.b-=this.g?9:3+(7==this.f?2:0)}function pe(a){Q(this,a,vd(this,a),be);this.b-=this.g?9:3+(7==this.f?2:0)}function V(){this.O(8,6)}function Kc(a){qe[a>>12].call(this,a)}
var qe=[function(a){re[a>>8&15].call(this,a)},function(a){var b=vd(this,a),c=this.b;O(this,Ad(this,a,b));this.b=c-je[(this.H?8:0)+this.g]+(7!=this.f||this.g?0:2)},function(a){var b=vd(this,a);a=yd(this,a);md(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){O(this,vd(this,a)&yd(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){Q(this,a,vd(this,a),Jd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?
2:0)},function(a){Q(this,a,vd(this,a),Ld);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){Q(this,a,vd(this,a),Dd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){se[a>>8&15].call(this,a)},function(a){Me[a>>8&15].call(this,a)},function(a){var b=ud(this,a);O(this,zd(this,a,b,1)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){var b=ud(this,a)<<8;a=xd(this,a)<<8;md(this,b-a,a,b);this.b-=this.g?
4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){O(this,(ud(this,a)&xd(this,a))<<8);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){P(this,a,ud(this,a),Kd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){P(this,a,ud(this,a),Md);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){Q(this,a,vd(this,a),Zd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},V],re=
[function(a){Ne[a>>4&15].call(this,a)},function(a){R(this,a,!0)},function(a){R(this,a,!gd(this))},function(a){R(this,a,gd(this))},function(a){R(this,a,!this.Fa()==!fd(this))},function(a){R(this,a,!this.Fa()!=!fd(this))},function(a){R(this,a,!gd(this)&&!this.Fa()==!fd(this))},function(a){R(this,a,gd(this)||!this.Fa()!=!fd(this))},ie,ie,function(a){Oe[a>>6&3].call(this,a)},function(a){Pe[a>>6&3].call(this,a)},function(a){Qe[a>>6&3].call(this,a)},function(a){Re[a>>6&3].call(this,a)},V,V],Oe=[function(a){jd(this,
Ad(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Nd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,Rd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,Pd);this.b-=this.g?9:3+(7==this.f?2:0)}],Pe=[function(a){Q(this,a,0,Td);this.b-=this.g?11:6},function(a){Q(this,a,ed(this)?1:0,Dd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,ed(this)?1:0,Zd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=yd(this,a);jd(this,a);this.b-=this.g?4:3+(7==this.f?
2:0)}],Qe=[function(a){Q(this,a,0,Xd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Vd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Hd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Fd);this.b-=this.g?9:3+(7==this.f?2:0)}],Re=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.dc(a|65536);id(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=sd(this,a,0);nd(this,a);O(this,a);this.b-=11},function(a){var b=pd(this),c=this.b;td(this,a,
0,b);O(this,b);this.b=c-ke[this.g]},function(a){O(this,Ad(this,a,this.Fa?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Ne=[function(a){Se[a&15].call(this,a)},V,V,V,ge,ge,ge,ge,function(a){if(a&8)this.O(8,6);else{var b=pd(this);a&=7;id(this,this.u[a]);this.u[a]=b;this.b-=9}},function(a){a&8?(this.K&49152||(this.K=this.K&-2017|(a&7)<<5,this.D|=1),this.b-=5):this.O(8,6)},function(a){Te[a&15].call(this,a)},function(a){Ue[a&15].call(this,a)},oe,oe,oe,oe],Se=[function(){this.K&49152?(this.$|=128,this.O(4,
3)):this.ea();this.b-=7},function(){this.D|=4;this.u[7]=this.u[7]+-2&65535;this.b-=3},function(){od(this);this.D|=this.K&16;this.b-=13},function(){this.O(12,1);this.b-=5},function(){this.O(16,4);this.b-=25},function(){this.K&49152||(Lc(this),this.B.reset());this.b-=667},function(){od(this);this.b-=13},V,V,V,V,V,V,V,V,V],Te=[me,function(){this.R=0;this.b-=5},function(){this.S=0;this.b-=5},S,function(){this.Z=1;this.b-=5},S,S,S,function(){this.V=0;this.b-=5},S,S,S,S,S,S,S],Ue=[me,function(){this.R=
65536;this.b-=5},function(){this.S=32768;this.b-=5},T,function(){this.Z=0;this.b-=5},T,T,T,function(){this.V=32768;this.b-=5},T,T,T,T,T,T,T],se=[le,le,ee,ee,ce,ce,de,de,pe,pe,V,V,V,V,ne,ne],Me=[function(a){R(this,a,!this.Fa())},function(a){R(this,a,this.Fa())},function(a){R(this,a,!ed(this)&&!gd(this))},function(a){R(this,a,ed(this)||gd(this))},function(a){R(this,a,!fd(this))},function(a){R(this,a,fd(this))},function(a){R(this,a,!ed(this))},function(a){R(this,a,ed(this))},function(){this.O(24,2);
this.b-=25},function(){this.O(28,5);this.b-=5},function(a){Ve[a>>6&3].call(this,a)},function(a){We[a>>6&3].call(this,a)},function(a){Xe[a>>6&3].call(this,a)},function(a){Ye[a>>6&3].call(this,a)},V,V],Ve=[function(a){jd(this,zd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Od);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,1,Sd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,1,Qd);this.b-=this.g?9:3+(7==this.f?2:0)}],We=[function(a){P(this,a,0,Ud);this.b-=
this.g?11:6},function(a){P(this,a,ed(this)?1:0,Ed);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,ed(this)?1:0,$d);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=xd(this,a);jd(this,a<<8);this.b-=this.g?4:3+(7==this.f?2:0)}],Xe=[function(a){P(this,a,0,Yd);this.b-=this.g?9+(this.Ya&1):3+(7==this.f?2:0)},function(a){P(this,a,0,Wd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Id);this.b-=this.g?9+(this.Ya&1):3+(7==this.f?2:0)},function(a){P(this,a,0,Gd);this.b-=this.g?9:3+(7==
this.f?2:0)}],Ye=[V,function(a){a=sd(this,a,65536);nd(this,a);O(this,a);this.b-=11},function(a){var b=pd(this),c=this.b;td(this,a,65536,b);O(this,b);this.b=c-ke[this.g]},V];function Ze(a){r.call(this,"ROM",a,Ze);this.f=null;this.C=a.addr;this.g=a.size;this.G=a.writable;this.F=a.alias;this.A=a.file;this.H=da(this.A);if(this.A){a=this.A;var b=ea(this.H);"json"!=b&&"hex"!=b&&(a=ga()+"/api/v1/dump?file="+this.A+"&format=bytes&decimal=true");var c=this;ua(a,null,!0,function(a,b,f){$e(c,a,b,f)})}}y(Ze);
Ze.prototype.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;af(this)};Ze.prototype.Ca=function(){if(this.Da){if(this.j){var a=this.j,b=this.id,c=this.C,d=this.g,e=this.Da,f=[],g;for(g in e){var l=e[g];"number"==typeof l&&(e[g]=l={o:l});var n=l.o,p=l.a;if(void 0!==n){var q=f,n=[n>>>0,g],v=qa(q,n,a.Kb);0>v&&q.splice(-(v+1),0,n)}p&&(l.a=p.replace(/''/g,'"'))}a.H.push({Id:b,w:c,wc:d,Da:e,Jb:f})}delete this.Da}return!0};Ze.prototype.Ba=function(){return!0};
function $e(a,b,c,d){if(d)a.na("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.xb,b,c);var e;if("["==c.charAt(0)||"{"==c.charAt(0))try{var f,g,l=eval("("+c+")");if(f=l.bytes)a.f=f;else if(f=l.words)for(a.f=Array(2*f.length),g=e=0;e<f.length;e++)a.f[g++]=f[e]&255,a.f[g++]=f[e]>>8&255;else if(f=l.data)for(a.f=Array(4*f.length),g=e=0;e<f.length;e++)a.f[g++]=f[e]&255,a.f[g++]=f[e]>>8&255,a.f[g++]=f[e]>>16&255,a.f[g++]=f[e]>>24&255;else a.f=l;a.Da=l.symbols;if(!a.f.length){m("Empty ROM: "+
b);return}if(1==a.f.length){m(a.f[0]);return}}catch(n){a.na("ROM data error: "+n.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.f=Array(b.length),e=0;e<b.length;e++)a.f[e]=aa(b[e],16);af(a)}}
function af(a){if(!hb(a))if(!a.A)G(a);else if(a.f&&a.B){a.g||(a.g=a.f.length);if(a.f.length!=a.g)vb(a,"ROM size ("+k(a.f.length,8,!0)+") does not match specified size ("+k(a.g,8,!0)+")");else{var b;b=a.C;if(Jb(a.B,b,a.g,a.G?1:kc)){var c;for(c=0;c<a.f.length;c++){a.j&&a.j.g++;var d=a.B,e=b+c;d.P[(e&d.g)>>>d.Y].wb(e&d.f,a.f[c]&255,e);a.j&&a.j.g--}b=!0}else b=!1;if(b){b=[];"number"==typeof a.F?b.push(a.F):null!=a.F&&a.F.length&&(b=a.F);for(c=0;c<b.length;c++){for(var f=a,d=b[c],e=f.B,g=f.g,l=[],n=f.C>>>
e.Y;0<g&&n<e.P.length;)l.push(e.P[n++]),g-=e.qa;e=f.B;f=f.g;g=0;for(d>>>=e.Y;0<f&&d<e.P.length;){n=l[g++];if(!n)break;e.P[d++]=n;f-=e.qa}}delete a.f}}G(a)}}La(function(){for(var a=A(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Ze(d);eb(d,c)}});function bf(a){r.call(this,"RAM",a,bf);this.F=a.addr;this.g=a.size;this.f=!1}y(bf);h=bf.prototype;h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;G(this)};h.Ca=function(a,b){b||this.reset();return!0};
h.Ba=function(a){return a?this.save():!0};h.reset=function(){!this.f&&this.g&&Jb(this.B,this.F,this.g,1)&&(this.f=!0);this.f||m("No RAM allocated")};h.save=function(){return null};h.restore=function(){return!0};La(function(){for(var a=A(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new bf(d);eb(d,c)}});function cf(a){r.call(this,"Keyboard",a,cf,65536);G(this)}y(cf);cf.prototype.ja=function(){return!1};cf.prototype.Ga=function(a,b,c,d){this.F=a;this.b=c;this.j=d};
La(function(){for(var a=A(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new cf(d);eb(d,c)}});function W(a){this.A=this.G=null;this.W=a.tabSize;this.M=a.charBOL;this.H=0;r.call(this,"SerialPort",a,W,8388608);var b=a.binding;if("console"==b)this.G="";else{var c;a=df;b&&(void 0===c&&(c="Panel"),(c=db(c,this.id))&&(b=c.J[b])&&this.ja(null,a,b))}this.I=this.L=null;this.exports={connect:this.Tb,receiveData:this.Db}}y(W);var df="buffer";h=W.prototype;
h.ja=function(a,b,c){var d=this;switch(b){case df:return this.J[b]=this.A=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.Db(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Db(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.b=c;this.j=d;var e=this;this.X=Qb(this.b,function(){e.f&128||!e.C.length||(e.U=e.C.shift(),e.f|=128,e.f&64&&Rb(e.b,40,4,48))});this.N=function(){e.g|=128;return!!(e.g&64)};Ob(b,this,ef);G(this)};
h.Tb=function(){if(!this.I){var a=xc(this.F,"connection");if(a){var b=a.split("->");if(2==b.length){var c=oa(b[0]);if(c!=this.Xa)return;b=oa(b[1]);if(this.I=cb(b)){var d=this.I.exports;if(d){var e=d.connect;e&&e.call(this.I);if(this.L=d.receiveData){this.status(this.xb+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.Ca=function(a,b){if(!b)if(this.Tb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.Ba=function(a){return a?this.save():!0};h.reset=function(){ff(this)};h.save=function(){var a=new N(this);a.set(0,[]);return a.data()};h.restore=function(){return ff(this)};function ff(a){a.U=0;a.f=0;a.g=128;a.C=[];return!0}h.Db=function(a){if("number"==typeof a)this.C.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.C.push(a.charCodeAt(b));else this.C=this.C.concat(a);Sb(this.b,this.X,50);return!0};h.Pc=function(){return this.f&65535};h.rd=function(a){this.f=this.f&-112|a&111};
h.Oc=function(){this.f&=-129;0<this.C.length&&Sb(this.b,this.X,50);return this.U};h.qd=function(){};h.bd=function(){return this.g};h.Fd=function(a){128==(this.g&192)&&a&64&&Rb(this.b,8,4,52,this.N);this.g=this.g&-70|a&69};h.ad=function(){return 0};
h.Ed=function(a){if(a&=255){D(this,"transmitByte("+k(a,2,!0)+")");this.L&&this.L.call(this.I,a);if(this.A)if(13==a)this.H=0;else if(8==a)this.A.value=this.A.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=pa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.W||8,c=a-this.H%a,this.W&&(b=na("",c)));this.M&&!this.H&&c&&(b=String.fromCharCode(this.M)+b);this.A.value+=b;this.A.scrollTop=this.A.scrollHeight;this.H+=c}else if(null!=this.G){if(10==a||1024<=this.G.length)this.i(this.G),
this.G="";10!=a&&(this.G+=String.fromCharCode(a))}this.g&=-129;Rb(this.b,100,4,52,this.N)}};var gf={},ef=(gf[65392]=[null,null,W.prototype.Pc,W.prototype.rd,"RCSR"],gf[65394]=[null,null,W.prototype.Oc,W.prototype.qd,"RBUF"],gf[65396]=[null,null,W.prototype.bd,W.prototype.Fd,"XCSR"],gf[65398]=[null,null,W.prototype.ad,W.prototype.Ed,"XBUF"],gf);La(function(){for(var a=A(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new W(d);eb(d,c)}});
function hf(a){r.call(this,"Debugger",a,hf);this.ia=a.base||16;this.ya=!1;this.U=this.xa=this.I=0;this.X=!1;this.C=-1;this.A=[];this.ca={}}y(hf);var jf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};hf.prototype.Pb=function(){return-1};hf.prototype.Qb=function(){};
function kf(a,b,c,d){if(c)if(b){0>a.C&&a.A.length&&(a.C=0);if(0>a.C||b!=a.A[a.C])a.A.splice(0,0,b),a.C=0;a.C--}else a.X?b="end":b=a.A[a.C+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(oa(b.substring(c,f))),c=f+1}}return a}
function lf(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 lf(a,b,c){var d;if(b){b=mf(a,b);for(var e=0,f=!1,g=b,l=[],n=[],p=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<p.length;){var q=p[e++],v=q.length,q=oa(q);if(!q){f=!0;break}q=nf(a,q,null,!1===c);if(void 0===q){f=!0;c=!1;break}l.push(q);if(e==p.length)break;var q=p[e++],u=q.length;n.length&&hf[q]<hf[n[n.length-1]]&&kf(l,n,1);n.push(q);b=b.substr(v+u)}kf(l,n)&&1==l.length||(f=!0);f?c&&a.i("error parsing '"+g+"' at character "+(g.length-b.length)):(d=l.pop(),c&&of(a,null,
d))}return d}function mf(a,b){for(var c,d=a.xa?"(":"{",e=a.xa?")":"}",f=new RegExp(a.xa?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=lf(a,c[1]);b=b.replace(d+c[1]+e,null!=g?I(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.T-a.wa}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
function nf(a,b,c,d){var e;null!=b?(e=a.Pb(b),0<=e?e=a.Qb(e):(e=a.ca[b],null==e&&(e=aa(b,a.ia))),null!=e||d||a.i("invalid "+(c?c:"value")+": "+b)):d||a.i("missing "+(c||"value"));return e}
function of(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var l=0;l<f;l++){g&&(g=","+g);var n=d&255,p=8,q="";p?32<p&&(p=32):p=32;if(null==n||isNaN(n))for(;0<p--;)q="?"+q;else for(;0<p--;)q=(n&1?"1":"0")+q,n>>=1;g=q+g;d>>=8}d=k(c,0,!0)+" "+c+". "+ba(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.i((null!=b?b+": ":"")+d);return e}function pf(a,b){if(b)return of(a,b,a.ca[b]);var c=0;for(b in a.ca)of(a,b,a.ca[b]),c++;return 0<c}
function mf(a,b,c){var d;if(b){b=nf(a,b);for(var e=0,f=!1,g=b,l=[],n=[],p=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<p.length;){var q=p[e++],v=q.length,q=oa(q);if(!q){f=!0;break}q=of(a,q,null,!1===c);if(void 0===q){f=!0;c=!1;break}l.push(q);if(e==p.length)break;var q=p[e++],u=q.length;n.length&&jf[q]<jf[n[n.length-1]]&&lf(l,n,1);n.push(q);b=b.substr(v+u)}lf(l,n)&&1==l.length||(f=!0);f?c&&a.i("error parsing '"+g+"' at character "+(g.length-b.length)):(d=l.pop(),c&&pf(a,null,
d))}return d}function nf(a,b){for(var c,d=a.ya?"(":"{",e=a.ya?")":"}",f=new RegExp(a.ya?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=mf(a,c[1]);b=b.replace(d+c[1]+e,null!=g?I(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.U-a.xa}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
function of(a,b,c,d){var e;null!=b?(e=a.Pb(b),0<=e?e=a.Qb(e):(e=a.ca[b],null==e&&(e=aa(b,a.ia))),null!=e||d||a.i("invalid "+(c?c:"value")+": "+b)):d||a.i("missing "+(c||"value"));return e}
function pf(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var l=0;l<f;l++){g&&(g=","+g);var n=d&255,p=8,q="";p?32<p&&(p=32):p=32;if(null==n||isNaN(n))for(;0<p--;)q="?"+q;else for(;0<p--;)q=(n&1?"1":"0")+q,n>>=1;g=q+g;d>>=8}d=k(c,0,!0)+" "+c+". "+ba(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.i((null!=b?b+": ":"")+d);return e}function qf(a,b){if(b)return pf(a,b,a.ca[b]);var c=0;for(b in a.ca)pf(a,b,a.ca[b]),c++;return 0<c}
function I(a,b,c,d){switch(a.ia){case 8:a=ba(b,3*c);break;case 10:a=b.toString();break;default:a=k(b,2*c)}d&&"0"==a.charAt(0)&&(a=a.replace(/^0+([0-9A-F]+)$/i,"$1"));return a}
function qf(a){gf.call(this,a);this.xa=!0;this.M=X(0);this.Qa=X(0);this.V=X(0);this.H=[];this.f=this.N=this.G=[];rf(this);this.la=0;sf(this);this.Ia={};tf(this,a.messages);this.Ja=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return zc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return zc(b,a)})}y(qf,gf);
var uf={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},vf="NONE ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
wf={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
function rf(a){hf.call(this,a);this.ya=!0;this.M=X(0);this.Ra=X(0);this.W=X(0);this.H=[];this.f=this.N=this.G=[];sf(this);this.la=0;tf(this);this.Ia={};uf(this,a.messages);this.Ja=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Ac(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Ac(b,a)})}y(rf,hf);
var vf={"?":"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"},wf="NONE ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
xf={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106],35072:[107]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,63],35904:[72,
63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}};h=qf.prototype;
h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.F=a;(a=wc(a,"messages"))&&tf(this,a);this.ab=wf;xf(this,function(a){a:{var b=d.B.X,c=a[0],e=a=0,n=b.length;if(c){a=Y(yf(d,c));if(-1===a){d.i("invalid address: "+c);break a}e=a>>>d.B.Z;n=1}d.i("blockid physical blockaddr used size type");d.i("-------- --------- ---------- ------ ------ ----");for(var c=-1,p=0;n--;){var q=b[e];q.type==c?p++||d.i("..."):(c=q.type,p=Kb[c],q&&d.i(k(q.id,8)+" %"+k(e<<d.B.Z,8)+" %%"+k(q.w,8)+" "+k(q.qb,4,
!0)+" "+k(q.size,4,!0)+" "+p),c!=ic&&(c=-1),p=0);a+=d.B.ya;e++}}});G(this)};
h.ja=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ka=this.J[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",zc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.C<d.A.length-1&&(b=d.A[++d.C])):40==a.keyCode&&(0<d.C?b=d.A[--d.C]:(b="",d.C=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.J[b]=c,Fa(c,function(){if(d.ka){var a=d.ka.value;
d.ka.value="";zc(d,a,!0);return!0}return!1}),!0;case "step":return this.J[b]=c,Fa(c,function(a){var b=!1;gb(d,!0)||(fb(d,!0),b=d.fb(a?1:0),fb(d,!1));return b}),!0}return!1};h.pb=function(){this.ka&&this.ka.focus()};function Y(a){a=a&&a.w;null==a&&(a=-1);return a}h.Ua=function(a,b){var c=255,d=Y(a);-1!==d&&(this.g++,c=this.B,c=c.X[(d&c.g)>>>c.Z].Cb(d&c.f,d),this.g--,b&&zf(a,b));return c};h.ma=function(a,b){var c=65535,d=Y(a);-1!==d&&(this.g++,c=Lb(this.B,d),this.g--,b&&zf(a,b));return c};
h.ob=function(a,b,c){var d=Y(a);if(-1!==d){this.g++;var e=this.B;e.X[(d&e.g)>>>e.Z].wb(d&e.f,b&255,d);this.g--;c&&zf(a,c);M(this.b,!0)}};h.Xa=function(a,b,c){var d=Y(a);if(-1!==d){this.g++;var e=this.B;e.X[(d&e.g)>>>e.Z].Jb(d&e.f,b&65535,d);this.g--;c&&zf(a,c);M(this.b,!0)}};function X(a){return{w:a,Aa:!1}}function Af(a){return[a.w,a.Aa]}function Bf(a){return{w:a[0],Aa:a[1]}}
function yf(a,b,c){var d;c=(c?a.M:a.Qa).w;if(void 0!==b){d=b=mf(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.H.length;c++){var f=a.H[c].Da[d];if(void 0!==f){d=f.o;void 0!==d&&(e=X(d));break}}if(d=e)return d;c=lf(a,b,void 0)}null!=c&&(d=X(c));return d}function Cf(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.pc=jf(a,b.hc=c[2]))}function zf(a,b){null!=a.w&&(a.w+=b||1)}
function tf(a,b){a.j=a;a.ha=a.qc=536870912;a.oa=null;a.qa=[];a.g=0;b=jf(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in xb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.ha|=xb[c],a.i(c+" messages enabled"))}}function xf(a,b){for(var c in xb)if(64==xb[c]){a.Ia[c]=b;break}}
h.Pb=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function Df(a){return 6>a?"R"+a:6==a?"SP":"PC"}h.Qb=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ha[a-8]:20>a?b=this.b.ta[a-16]:20==a&&(b=Ub(this.b)));return b};
h.message=function(a,b){this.g||(b&&(a+=" @"+I(this,X(this.b.u[7]).w)),this.ha&1073741824?this.qa.push(a):this.oa&&a==this.oa||(this.oa=a,this.ha&-2147483648&&(this.ea(),a+=" (cpu halted)"),this.i(a),this.b&&(a=this.b,a.N-=a.b,a.b=0,a.ka=0,M(a))))};
function sf(a){var b;if(Ad(a)){if(!a.L||!a.L.length){a.L=Array(1E3);for(b=0;b<a.L.length;b++)a.L[b]=X();a.ga=0;a.i("instruction history buffer allocated")}if(!a.da||!a.da.length)for(a.da=Array(256),b=0;b<a.da.length;b++)a.da[b]=[b,0]}else a.L&&a.L.length&&a.i("instruction history buffer freed"),a.ga=0,a.L=[],a.da=[]}h.eb=function(a){if(!Ef(this))return!1;this.b.eb(a);return!0};
h.fb=function(a,b,c){if(!Ef(this))return!1;this.I=0;a||Ad(this)&&Bd(this,this.b.u[7],0);try{a=Gc(this.b,a);var d=this.b.fb(a);0<d&&(Hc(this.b,a),this.I+=d,Ec(this.b,d,!0),Ac(this.b,d),this.T++)}catch(e){"number"!=typeof e&&(this.I=0,vb(this.b,e.stack||e.message))}!1!==c&&M(this.b);this.za(b||!1);return 0<this.I};h.ea=function(a){this.b&&this.b.ea(a)};h.za=function(a){void 0===a&&(a=!0);this.M=X(this.b.u[7]);a&&1!=this.aa?Ff(this):Gf(this)};
function Ef(a){var b;if(b=a.b&&hb(a.b))b=a.b,b.v.fa?b=!0:(b.i(b.toString()+" not powered"),b=!1);return b&&!a.b.v.ba?!ib(a.b):!1}h.Ca=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};h.Ba=function(a,b){b&&this.i(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){sf(this);this.T=this.wa=0;this.oa=null;this.I=0;this.M=X(this.b.u[7]);this.v.ba=!1;Hf(this);a||this.za()};
h.save=function(){var a=new N(this);a.set(0,Af(this.M));a.set(1,Af(this.V));a.set(2,[this.A,this.W,this.ha]);a.set(3,this.H);return a.data()};h.restore=function(a){var b=0;void 0!==a[2]&&(this.M=Bf(a[b++]),this.V=Bf(a[b++]),this.A=a[b][0],"string"==typeof this.A&&(this.A=[this.A]),this.W=a[b][1],this.ha|=a[b][2]);a[3]&&(this.H=a[3]);return!0};h.start=function(a,b){this.aa||this.i("running");this.v.ba=!0;this.jb=a;this.kb=b};
h.stop=function(a,b){if(this.v.ba){this.v.ba=!1;this.I=b-this.kb;if(!this.aa){b="stopped";if(this.I){a-=this.jb;var c=0<a?Math.round(1E3*this.I/a):0;b+=" (";Ad(this)&&(b+=this.T+" opcodes, ",this.wa-=this.T,this.T=0);b+=this.I+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.i(b)}this.za(!0);this.pb();Hf(this,this.b.u[7])}};function Ad(a){return 1<a.f.length||!!a.la}
function Bd(a,b,c){var d=a.b;if(0<c&&(a.la&&!--a.la||rc(a,b,1,a.f)))return!0;0<=c&&a.da.length&&(a.T++,a.g++,b=Lb(a.B,b),a.g--,null!=b&&(b=a.L[a.ga],b.w=d.u[7],b.Aa=!1,++a.ga==a.L.length&&(a.ga=0)));return!1}function rf(a){var b,c;a.f=["bp"];if(a.N)for(b=1;b<a.N.length;b++){c=a.N[b];var d=a.B;sc(d.X[Y(c)>>>d.Z],!1)}a.N=["br"];if(a.G)for(b=1;b<a.G.length;b++)c=a.G[b],d=a.B,sc(d.X[Y(c)>>>d.Z],!0);a.G=["bw"];a.Ra=0}
h.Sa=function(a,b,c){var d=!0;c||If(this,a,b,!1,!0);if(a!=this.f){var e=Y(b);if(-1===e)this.i("invalid address: "+I(this,b.w)),d=!1;else{var f=this.B;f.X[e>>>f.Z].Sa(e&f.f,a==this.G)}}d&&(a.push(b),c?b.Aa=!0:(Jf(this,a,a.length-1,"set"),sf(this)));return d};function If(a,b,c,d,e){var f=!1;c=Y(c);for(var g=1;g<b.length;g++){var l=b[g];if(c==Y(l)&&(!d||l.Aa)){f=!0;l.Aa||e||Jf(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.B,sc(d.X[c>>>d.Z],b==a.G));l.Aa||sf(a);break}}return f}
function Kf(a,b){for(var c=1;c<b.length;c++)Jf(a,b,c);return b.length-1}function Jf(a,b,c,d){c=b[c];a.i(b[0]+" "+I(a,c.w)+(d?" "+d:c.hc?' "'+c.hc+'"':""))}function Hf(a,b){if(void 0!==b)rc(a,b,1,a.f,!0),a.aa=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Aa){if(!If(a,a.f,c,!0))break;b=0}}}
function rc(a,b,c,d,e){var f=!1;if(!a.Ra++)for(var g=1;!f&&g<d.length;g++){var l=d[g];if(!e||l.Aa)for(var n=Y(l),p=0;p<c;p++)if(b+p==n){var q,f=!0;l.Aa&&(If(a,d,l,!0),e=!0);if(q=l.pc){for(var f=!1,v=0;v<q.length;v++)if(!Lf(a,q[v],!0)){if(q[v].indexOf("if")){f=!0;break}for(var u=v+1;u<q.length&&q[u].indexOf("else");u++)v++;if(u==q.length){f=!0;break}}a.b.v.ba||(f=!0)}if(f){e||Jf(a,d,g,"hit");break}}}a.Ra--;return f}
function Mf(a,b,c,d){var e=X(b.w),f=a.ma(b,2),g,l;for(l in a.ab)if(g=a.ab[l][f&l])break;g||(g=[0]);for(var n=l="",p=vf[g[0]],q=g.length-1,v=1;v<=q;v++){var u=g[v];if(void 0!==u){var w;w=a;var B=u,u=b,x="",C=B&61440;if(4096==C)u=u.w+((f&255)<<24>>23)&65535,x=I(w,u);else if(8192==C)u=u.w-((f&63)<<1)&65535,x=I(w,u);else if(12288==C)x=I(w,f&7,1);else if(24576==C)x=I(w,f&63,1);else if(C=f&B,B&4032&&(C>>=6,B>>=6),B&63)switch(B=C&7,C&56){case 0:x=Df(B);break;case 8:x="@"+Df(B);break;case 16:7>B?x="("+Df(B)+
")+":(C=w.ma(u,2),x="#"+I(w,C,0,!0));break;case 24:7>B?x="@("+Df(B)+")+":(C=w.ma(u,2),x="@#"+I(w,C,0,!0));break;case 32:x="-("+Df(B)+")";break;case 40:x="@-("+Df(B)+")";break;case 48:C=w.ma(u,2);x=I(w,C,0,!0)+"("+Df(B)+")";7==B&&(x=[x,I(w,C+u.w&65535)]);break;case 56:C=w.ma(u,2),x="@"+I(w,C)+"("+Df(B)+")",7==B&&(x=[x,I(w,C+u.w&65535)])}w=x;if(!w||!w.length){l="INVALID";break}"string"!=typeof w&&(n=w[1],w=w[0]);0<l.length&&(l+=",");l+=w||"???"}}f="";g=I(a,e.w)+":";if(-1!==e.w&&-1!==b.w){do if(f+=" "+
I(a,a.ma(e,2)),null==e.w)break;while(e.w!=b.w)}g+=na(f,24);g+=na(p,5);l&&(g+=" "+l);if(c||n)g=na(g,60)+";"+(c||""),g=a.b.v.$a?g+("cycles="+Bc(a.b).toString()+" cs="+k(a.b.lb)):g+(null!=d?"="+d.toString():""),n&&(g+=" @"+n);return g}function Nf(a,b){switch(b){case "N":a=a.b.Fa();break;case "Z":a=fd(a.b);break;case "V":a=ed(a.b);break;case "C":a=dd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function Of(a,b){var c="",d=a.b;8>b?(c=Df(b),c+="="+I(a,d.u[b])):13>b?c="A"+(b-8)+"="+I(a,d.Ha[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+I(a,d.ta[b-16]):20==b&&(c="PS="+I(a,Ub(d)));c&&(c+=" ");return c}function Pf(a){var b,c="";for(b=0;6>b;b++)c+=Of(a,b);c=c+"\n"+(Of(a,6)+Of(a,7)+Of(a,20));return c+=Nf(a,"T")+Nf(a,"N")+Nf(a,"Z")+Nf(a,"V")+Nf(a,"C")}h.Lb=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function Qf(a,b,c){var d=[],e=Y(b)>>>0;for(b=0;b<a.H.length;b++){var f=a.H[b],g=f.w>>>0,l=f.vc;if(e>=g&&e<g+l){e=qa(f.Kb,[e-g],a.Lb);0<=e?Rf(a,b,e,d):c&&(e=~e,Rf(a,b,e-1,d),Rf(a,b,e,d));break}}return d}function Rf(a,b,c,d){var e={},f=a.H[b].Kb,g=0,l=null;0<=c&&c<f.length&&(g=f[c][0],l=f[c][1]);l&&(e=a.H[b].Da[l],l="."==l.charAt(0)?null:e.l||l);d.push(l);d.push(g);d.push(e.a);d.push(e.c)}
function Sf(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return pf(a)||a.i("no variables"),!0;if(!c[2])return pf(a,c[1]);if(!c[3])return delete a.ca[c[1]],!0;b=lf(a,c[3]);return void 0!==b?(a.ca[c[1]]=b,!0):!1}a.i("invalid assignment:"+b);return!1}
function Tf(a,b,c){var d=null;if(b=yf(a,b,!0)){var e=Qf(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.w-e[1])&&(g=" + "+k(f,4,!0)),f=e[0]+" ("+I(a,e[1])+")"+g,c&&a.i(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.w)&&(g=" - "+k(f,4,!0)),f=e[4]+" ("+I(a,e[5])+")"+g,c&&a.i(f),d||(d=f))}else c&&a.i("no symbols")}return d}
function Ff(a,b){var c;if(b&&"?"==b[1])a.i("register commands:"),a.i("\tr\tdump registers"),a.i("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.i("missing value for "+b[1]);return}f=lf(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":hd(d,f);a.M=X(d.u[7]);break;case "N":d.U=f?32768:0;break;
case "Z":d.Y=f?0:1;break;case "V":d.R=f?32768:0;break;case "C":d.P=f?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=f&65535;break}a.i("unknown register: "+e);return}M(d);a.i("updated registers:")}a.i(Pf(a));c&&(a.M=X(d.u[7]),Gf(a,I(a,a.M.w)))}}function Uf(a,b){b=oa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.i(c[2]):of(a,null,c[2].charCodeAt(0)):lf(a,b,!0)}
function Vf(a,b,c){var d="t"!=b;c=nf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ea(c,function(){return fb(a,!0)&&a.fb(e,d,!1)},function(){M(a.b);fb(a,!1)})}
function Gf(a,b,c,d){if(b=yf(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=yf(a,c,!0);if(!d||d.w<b.w)return;e=d.w-b.w;if(256<e){a.i("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=gb(a,!1)||a.aa?a.I:null;var g=null!=f?"cycles":null,l=Qf(a,b),n=b.w;if(l[0]&&d&&(!c&&d||0>l[0].indexOf("+"))){var p=l[0]+":";l[2]&&(p+=" "+l[2]);a.i(p)}l[3]&&(g=l[3],f=null);f=Mf(a,b,g,f);a.i(f);a.M=b;e-=b.w-n;c++}}}
function Lf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.i(">> "+b):(a.W&&(a.i("ended assemble at "+I(a,a.V.w)),a.M=a.V,a.W=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.oa=null;if(hb(a)&&0<b.length){a.W&&(b="a "+I(a,a.V.w)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");if(g&&g.length)for(var l=g[0],n=l.charAt(0),p=1;p<l.length;p++){var q=l.charAt(p);if("?"==n||"r"==n||"a">q||"z"<q){g[0]=l.substr(p);g.unshift(l.substr(0,p));break}}g[0]=g[0].toLowerCase();switch(g[0].charAt(0)){case "a":var v=
yf(a,g[1],!0);if(v)if(a.V=v,void 0===g[2])a.i("begin assemble at "+I(a,v.w)),a.W=!0,M(a.b);else{var u;a.i("not supported yet");u=[];if(u.length){for(var w=0;w<u.length;w++)a.ob(v,u[w],1);a.i(Mf(a,a.V))}}break;case "b":a:{var B=g[0],x=g[1],C=b;if("?"==x)a.i("breakpoint commands:"),a.i("\tbp [a]\tset exec breakpoint at addr [a]"),a.i("\tbr [a]\tset read breakpoint at addr [a]"),a.i("\tbw [a]\tset write breakpoint at addr [a]"),a.i("\tbc [a]\tclear breakpoint at addr [a]"),a.i("\tbl\tlist all breakpoints"),
a.i("\tbn [n]\tbreak after [n] instruction(s)");else{var ya=B.charAt(1);if("l"==ya){var Jc;Jc=0+Kf(a,a.f);Jc+=Kf(a,a.N);(Jc+=Kf(a,a.G))||a.i("no breakpoints")}else if("n"==ya)a.la=nf(a,x),a.i("break after "+a.la+" instruction(s)");else if(void 0===x)a.i("missing breakpoint address");else{var U=X();if("*"!=x&&(U=yf(a,x,!0),!U))break a;"c"==ya?null==U.w?(rf(a),a.i("all breakpoints cleared")):If(a,a.f,U)||If(a,a.N,U)||If(a,a.G,U)||a.i("breakpoint missing: "+I(a,U.w)):null!=U.w&&(Cf(a,U,C),"p"==ya?a.Sa(a.f,
U):"r"==ya?a.Sa(a.N,U):"w"==ya?a.Sa(a.G,U):a.i("unknown breakpoint command: "+ya))}}}break;case "c":a.Ta&&(a.Ta.value="");break;case "d":a:{var Na,Oa=g[0],ia=g[1],za=g[2],ng=g[3];if("?"==ia){var Pa="";for(Na in xb)a.Ia[Na]&&(Pa&&(Pa+=","),Pa+=Na);Pa+=",state,symbols";a.i("dump memory commands:");a.i("\tdb [a] [#] dump # bytes at address a");a.i("\tdw [a] [#] dump # words at address a");a.i("\tdd [a] [#] dump # dwords at address a");a.i("\tdh [#] [#] dump # instructions from history");
Pa.length&&a.i("dump extension commands:\n\t"+Pa)}else if("state"==ia){var te=Wf(a.F,!0);"console"==za?console.log(te):(a.Ta&&(a.Ta.value=""),a.i(te))}else if("symbols"==ia)for(var Kc=0;Kc<a.H.length;Kc++){var Lc=a.H[Kc],Qa;for(Qa in Lc.Da)if("."!=Qa.charAt(0)){var ue=Lc.Da[Qa].o;if(void 0!==ue){var ve=Lc.Da[Qa].l;ve&&(Qa=ve);a.i(I(a,ue)+" "+Qa)}}}else{if("d"==Oa){for(Na in xb)if(g[1]==Na){var we=a.Ia[Na];we?(g.shift(),g.shift(),we(g)):a.i("no dump registered for "+ia);break a}ia||(Oa=a.sb||"db")}else a.sb=
Oa;if("dh"==Oa){var xe=ia,ye=za,ze="",Ae=0,ca=a.ga,ja=a.L;if(ja.length){var Z=+xe||a.Za,jb=+ye||10;isNaN(Z)?Z=jb:ze="more ";Z>ja.length&&(a.i("note: only "+ja.length+" available"),Z=ja.length);ca-=Z;0>ca&&(null==ja[ja.length-1].w?(Z=ca+Z,ca=0):ca+=ja.length);var Mc=[];"call"==ye&&(jb=1E5,Mc=["CALL"]);for(void 0!==xe&&a.i(Z+" instructions earlier:");0<jb&&ca!=a.ga;){var Be=ja[ca++];if(null==Be.w)break;var kb=X(Be.w),og=Z--,Ce=Mf(a,kb,"history",og);(!Mc.length||0<=Ce.indexOf(Mc[0]))&&a.i(Ce);kb.yb&&
(ca+=kb.yb,jb-=kb.yb,Z-=kb.yb);ca>=ja.length&&(ca=0);a.Za=Z;Ae++;jb--}}Ae||(a.i("no "+ze+"history available"),a.Za=void 0)}else{var Xb=yf(a,ia);if(Xb){var Yb=0;za&&("l"==za.charAt(0)&&(za=za.substr(1)||ng),Yb=nf(a,za)>>>0,65536<Yb&&(Yb=65536));for(var lb="",mb="dd"==Oa?4:"dw"==Oa?2:1,Zb=mb*Yb||128,pg=Zb+15>>4||1;pg--&&0<Zb;){var $b=0,Nc=0,nb,Oc="",De="",ia=I(a,Xb.w);for(nb=4==mb?16:a.ia;0<nb&&0<Zb;nb--){var ac=a.Ua(Xb,1),$b=$b|ac<<(Nc++<<3);Nc==mb&&(Oc+=I(a,$b,mb),Oc+=1==mb?9==nb?"-":" ":" ",$b=
Nc=0);De+=32<=ac&&128>ac?String.fromCharCode(ac):".";Zb--}lb&&(lb+="\n");lb+=ia+" "+Oc+(0==nb?" "+De:"")}lb&&a.i(lb);a.Qa=Xb}}}}break;case "e":if("else"==g[0])break;var Ra,Pc,Qc,Rc,Sc=g[0],Tc=g[1];"eb"==Sc?(Ra=1,Pc=255,Qc=a.Ua,Rc=a.ob):"e"==Sc||"ew"==Sc?(Ra=2,Pc=65535,Qc=a.ma,Rc=a.Xa):Tc=null;if(null==Tc)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a");else{var bc=yf(a,Tc);if(bc)for(var cc=2;cc<g.length;cc++){var ob=lf(a,g[cc]);
if(void 0===ob){a.i("unrecognized value: "+g[cc]);break}ob&~Pc&&a.i("warning: "+k(ob)+" exceeds "+Ra+"-byte value");var qg=Qc.call(a,bc);a.i("changing "+I(a,bc.w)+" from "+I(a,qg,Ra)+" to "+I(a,ob,Ra));Rc.call(a,bc,ob,Ra)}}break;case "g":a:{var Ee=g[1],rg=b;if(void 0!==Ee){var Uc=yf(a,Ee,!0);if(!Uc)break a;Cf(a,Uc,rg);a.Sa(a.f,Uc,!0)}a.eb(!0)||c||a.i("cpu busy or unavailable, run command ignored")}break;case "h":a.v.ba?(c||a.i("halting"),a.ea()):gb(a,!0)||c||a.i("already halted");break;case "i":if("if"==
g[0]){var Vc;var pb=b.substr(2),pb=oa(pb);lf(a,pb)?(c||a.i("true: "+pb),Vc=!0):(c||a.i("false: "+pb),Vc=!1);Vc||(d=!1);break}f=!0;break;case "k":var sg=g[0];if("?"==g[1])a.i("stack trace commands:"),a.i("\tk\tshow frame addresses"),a.i("\tks\tshow symbol information");else{var Wc=0,Xc=X(),qb=X(a.b.u[6]);for(a.i("stack trace for "+I(a,qb.w));10>Wc;){for(var Aa=null,tg=256;65536>qb.w>>>0;){Xc.w=a.ma(qb,2);if(null==qb.w||!tg--)break;if(!(Xc.w&1)){for(var ug=a,dc=Xc,Fe=null,rb=dc.w,Ge=rb,Yc=1;6>=Yc&&
rb;Yc++){if(2<Yc){dc.w=rb;var ec=Mf(ug,dc);if(0<=ec.indexOf("JSR")){var He=ec.indexOf(" ");if(rb+(ec.indexOf(" ",He+1)-He-1)/2==Ge){Fe=ec;break}}}rb-=2}dc.w=Ge;if(Aa=Fe)break}}if(!Aa||null==Aa)break;var Ie=null;if("ks"==sg){var Je=Aa.match(/[0-9A-F]+$/);Je&&(Ie=Tf(a,Je[0]))}Aa=na(Aa,50)+" ;"+(Ie||"stack="+I(a,qb.w));a.i(Aa);Wc++}Wc||a.i("no return addresses found")}break;case "l":if("ln"==g[0]){Tf(a,g[1],!0);break}f=!0;break;case "m":a:{var ka,la=null,E=g[1];"?"==E&&(E=void 0);if(void 0!==E){var ta=
0;if("all"==E)ta=1878917119,E=null;else if("on"==E)la=!0,E=null;else if("off"==E)la=!1,E=null;else{"keys"==E&&(E="key");"kbd"==E&&(E="keyboard");for(ka in xb)if(E==ka){ta=xb[ka];la=!!(a.ha&ta);break}if(!ta){a.i("unknown message category: "+E);break a}}if(ta)if("on"==g[2])a.ha|=ta,la=!0;else if("off"==g[2]&&(a.ha&=~ta,la=!1,1073741824==ta)){for(var Zc=0;Zc<a.qa.length;Zc++)a.i(a.qa[Zc]);a.qa=[]}}var vg=0,sb="";for(ka in xb)if(!E||E==ka){var wg=!!(a.ha&xb[ka]);if(null===la||la==wg)sb&&(sb+=","),++vg%
10||(sb+="\n\t"),"key"==ka&&(ka="keys"),sb+=ka}void 0===E&&a.i("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.i((null!==la?la?"messages on: ":"messages off: ":"message categories:\n\t")+(sb||"none"));sf(a)}break;case "p":if("print"==g[0]){Uf(a,b.substr(5));break}var xg="pr"==g[0]?1:0;if(a.aa)a.i("step in progress");else{var Ke=X(a.b.u[7]);a.Ua(Ke);a.aa?(a.Sa(a.f,Ke,!0),a.eb()||(a.F&&a.F.pb(),a.aa=0)):Vf(a,xg?"tr":"t")}break;case "r":if("reset"==b){a.F&&a.F.reset();break}Ff(a,
g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var tb=+g[2];if(8==tb||10==tb||16==tb)a.ia=tb;else{a.i("invalid base: "+tb);break}}a.i("default base: "+a.ia);break;case "cs":var ub;void 0!==g[3]&&(ub=+g[3]);switch(g[2]){case "int":a.b.bb=ub;break;case "start":a.b.mb=ub;break;case "stop":a.b.cb=ub;break;default:a.i("unknown cs option");break a}void 0!==ub&&yc(a.b);a.i("checksums "+(a.b.v.$a?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Dc(a.b,+g[2])||a.i("warning: using 1x multiplier, previous target not reached"));
a.i("target speed: "+(a.b.Va.toFixed(2)+"Mhz")+" ("+a.b.Na+"x)");break;default:if(g[1]){a.i("unknown option: "+g[1]);break}case "?":a.i("debugger options:"),a.i("\tbase #\t\tset default base to #"),a.i("\tcs int #\tset checksum cycle interval to #"),a.i("\tcs start #\tset checksum cycle start count to #"),a.i("\tcs stop #\tset checksum cycle stop count to #"),a.i("\tsp #\t\tset speed multiplier to #")}break;case "t":Vf(a,g[0],g[1]);break;case "u":Gf(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Sf(a,
b.substr(3))||(d=!1);break}if("ver"==g[0]){a.i("PDPjs version 1.30.1 ("+a.b.Xb+",RELEASE"+(wb?",TYPEDARRAYS":",LONGARRAYS")+")");a.i(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){Uf(a,b.substr(1));break}var $c="commands:",ad;for(ad in uf)$c+="\n"+na(ad,9)+uf[ad];Ad(a)||($c+="\nnote: history disabled if no exec breakpoints");a.i($c);break;default:f=!0}f&&(a.i("unknown command: "+b),d=!1)}}catch(Le){a.i("debugger error: "+(Le.stack||Le.message)),d=!1}return d}
function zc(a,b,c){b=jf(a,b,c);for(var d in b)if(!Lf(a,b[+d]))return!1;return!0}La(function(){for(var a=A(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new qf(d);eb(d,c)}});
function Xf(a,b,c){r.call(this,"Computer",a,Xf,67108864);this.v.fa=!1;Yf(this,b);this.M=wc(this,"autoPower",a);this.F=0;this.aa=a.busWidth||a.buswidth;this.f=Zf;this.I=null;this.G=this.V=!1;this.ca=wc(this,"url")||"";(Math.random()+.1).toString(36);this.g=$f(this);if(this.b=db("CPU",this.id)){this.j=db("Debugger",this.id);this.B=new Ab({id:this.zb+".bus",busWidth:this.aa},this.b,this.j);var d,e=bb(this.id);if((this.A=db("Panel",this.id))&&this.A.Ta)for(b=0;b<e.length;b++)d=e[b],d.na=this.A.na,d.i=
this.A.i,d.Ta=this.A.Ta;this.i("PDPjs v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.i("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ga&&d.Ga(this,this.B,this.b,this.j);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=wc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.G=!0,this.f=Zf),this.f&&
(this.L=new N(this,"1.30.1"),ag(this.L)?b=null:delete this.L);!b&&this.f&&(b=bg(this))&&(this.G=!0);if(b){var g=this;ua(b,null,!0,function(a,b,c){c?(g.H=null,g.G=!1,g.na("Unable to load machine state from server (error "+c+(b?": "+oa(b):"")+")")):(g.I=b,g.V=!0);G(g)})}else G(this);this.J.power||(this.M=!0);!c&&this.M&&cg(this,this.nb)}else m("Unable to find CPU component")}y(Xf);var Zf=0;
function Yf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){m(d.message+" ("+c+")")}}a.W=b}function wc(a,b,c){var d=b.toLowerCase(),d=Va[b]||Va[d];void 0===d&&a.W&&(d=a.W[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function cg(a,b,c){for(var d=bb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!hb(f)){hb(f,function(){cg(a,b,c)});return}}b.call(a,c)}
function dg(a,b){var c=new N(a,"1.30.1","validate");if(ag(c)&&eg(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.na("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=Xf.prototype;
h.nb=function(a){void 0===a&&(a=this.f||(this.I?1:Zf));if(!this.F){this.F++;var b=!1,c=!1;this.T=!1;var d=this.L||new N(this,"1.30.1");if(-1==a)b=!0;else if(a>Zf){if(ag(d,this.I)){this.C=new N(this,"1.30.1","failsafe");ag(this.C)&&(fg(this,d),a=2,gg(this.C));this.C.set("timestamp",sa());hg(this.C);var e=this.f&&!this.G;if(1==a||va("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=eg(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?ag(d,g):("error"==
f&&"no machine state"!=g?(this.na("Error: "+g),"unable to verify user"==g&&(Ca("user",""),this.g=null)):this.i(f+": "+g),gg(d),ag(d)?(c=eg(d),e=!0):c=!1))}e&&dg(this,c?d:null)}else 2==a&&d.clear()}else dg(this);delete this.I;delete this.L}e=bb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=ig(this,g,d,b,c));b=[d,a,c];-1!=a?cg(this,this.Nb,b):this.Nb(b)}};
function ig(a,b,c,d,e){if(!b.v.fa){b.v.fa=!0;if(b.Ca){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Ca(f,d)&&f&&(m("Unable to restore state for "+b.type),a.N&&!a.V?(c.clear(),a.f=Zf,window&&window.location.reload()):a.T=!0,b.Ca(null),e=!1)}if(!d&&b.Rb)for(a=b.Rb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Nb=function(a){var b=a[0],c=0>a[1];a=a[2];this.da=!0;this.v.fa=!0;var d=this.J.power;d&&(d.textContent="Shutdown");this.b&&(ig(this,this.b,b,c,a),this.b.hb());this.T&&(fg(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.F=0};
function fg(a,b){if(va("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.1"};d.url=a.ca;d.user=c;d.type="bug";d.data=b;ua("http://www.pcjs.org/api/v1/report",d,!0)}}
function Wf(a,b,c){var d,e="none";if(a.F)return null;a.F--;var f=new N(a,"1.30.1"),g=new N(a,"1.30.1","validate"),l=sa();g.set("timestamp",l);f.set("timestamp",l);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Ba&&(c&&a.b.ea(),d=a.b.Ba(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.fa=!1,!1===d&&(e=null)));for(var l=bb(a.id),n=0;n<l.length;n++){var p=l[n];p.v.fa&&(p.Ba&&(d=p.Ba(b,c),"object"===typeof d&&f.set(p.id,
d)),c&&(p.v.fa=!1,!1===d&&(e=null)))}e&&(c?(l=d=!1,b?(a.g&&jg(a,a.g,f.toString()),hg(g)&&hg(f)||(e=null,d=l=!0)):a.f&&(d=!0,l=3==a.f),d&&f.clear(l)):e=f.toString());c&&(a.v.fa=!1,b=a.J.power)&&(b.textContent="Power");a.F=0;return e}h.reset=function(){this.B&&this.B.reset&&(D(this,"Resetting "+this.B.type),this.B.reset());for(var a=bb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.B&&c.reset&&(D(this,"Resetting "+c.type),c.reset())}};
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=rf.prototype;
h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.F=a;(a=xc(a,"messages"))&&uf(this,a);this.ab=xf;yf(this,function(a){a:{var b=d.B.P,c=a[0],e=a=0,n=b.length;if(c){a=Y(zf(d,c));if(-1===a){d.i("invalid address: "+c);break a}e=a>>>d.B.Y;n=1}d.i("blockid physical blockaddr used size type");d.i("-------- --------- ---------- ------ ------ ----");for(var c=-1,p=0;n--;){var q=b[e];q.type==c?p++||d.i("..."):(c=q.type,p=Lb[c],q&&d.i(k(q.id,8)+" %"+k(e<<d.B.Y,8)+" %%"+k(q.w,8)+" "+k(q.ob,4,
!0)+" "+k(q.size,4,!0)+" "+p),c!=jc&&(c=-1),p=0);a+=d.B.qa;e++}}});G(this)};
h.ja=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ka=this.J[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Ac(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.C<d.A.length-1&&(b=d.A[++d.C])):40==a.keyCode&&(0<d.C?b=d.A[--d.C]:(b="",d.C=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.J[b]=c,Fa(c,function(){if(d.ka){var a=d.ka.value;
d.ka.value="";Ac(d,a,!0);return!0}return!1}),!0;case "step":return this.J[b]=c,Fa(c,function(a){var b=!1;gb(d,!0)||(fb(d,!0),b=d.fb(a?1:0),fb(d,!1));return b}),!0}return!1};h.nb=function(){this.ka&&this.ka.focus()};function Y(a){a=a&&a.w;null==a&&(a=-1);return a}h.Ua=function(a,b){var c=255,d=Y(a);-1!==d&&(this.g++,c=this.B,c=c.P[(d&c.g)>>>c.Y].Bb(d&c.f,d),this.g--,b&&Af(a,b));return c};h.ma=function(a,b){var c=65535,d=Y(a);-1!==d&&(this.g++,c=Mb(this.B,d),this.g--,b&&Af(a,b));return c};
h.mb=function(a,b,c){var d=Y(a);if(-1!==d){this.g++;var e=this.B;e.P[(d&e.g)>>>e.Y].wb(d&e.f,b&255,d);this.g--;c&&Af(a,c);M(this.b,!0)}};h.Wa=function(a,b,c){var d=Y(a);if(-1!==d){this.g++;var e=this.B;e.P[(d&e.g)>>>e.Y].Ib(d&e.f,b&65535,d);this.g--;c&&Af(a,c);M(this.b,!0)}};function X(a){return{w:a,Aa:!1}}function Bf(a){return[a.w,a.Aa]}function Cf(a){return{w:a[0],Aa:a[1]}}
function zf(a,b,c){var d;c=(c?a.M:a.Ra).w;if(void 0!==b){d=b=nf(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.H.length;c++){var f=a.H[c].Da[d];if(void 0!==f){d=f.o;void 0!==d&&(e=X(d));break}}if(d=e)return d;c=mf(a,b,void 0)}null!=c&&(d=X(c));return d}function Df(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.oc=kf(a,b.gc=c[2]))}function Af(a,b){null!=a.w&&(a.w+=b||1)}
function uf(a,b){a.j=a;a.ha=a.qc=536870912;a.oa=null;a.wa=[];a.g=0;b=kf(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in xb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.ha|=xb[c],a.i(c+" messages enabled"))}}function yf(a,b){for(var c in xb)if(64==xb[c]){a.Ia[c]=b;break}}
h.Pb=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function Ef(a){return 6>a?"R"+a:6==a?"SP":"PC"}h.Qb=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ha[a-8]:20>a?b=this.b.ta[a-16]:20==a&&(b=Vb(this.b)));return b};
h.message=function(a,b){this.g||(b&&(a+=" @"+I(this,X(this.b.u[7]).w)),this.ha&1073741824?this.wa.push(a):this.oa&&a==this.oa||(this.oa=a,this.ha&-2147483648&&(this.ea(),a+=" (cpu halted)"),this.i(a),this.b&&(a=this.b,a.N-=a.b,a.b=0,a.ka=0,M(a))))};
function tf(a){var b;if(Bd(a)){if(!a.L||!a.L.length){a.L=Array(1E3);for(b=0;b<a.L.length;b++)a.L[b]=X();a.ga=0;a.i("instruction history buffer allocated")}if(!a.da||!a.da.length)for(a.da=Array(256),b=0;b<a.da.length;b++)a.da[b]=[b,0]}else a.L&&a.L.length&&a.i("instruction history buffer freed"),a.ga=0,a.L=[],a.da=[]}h.eb=function(a){if(!Ff(this))return!1;this.b.eb(a);return!0};
h.fb=function(a,b,c){if(!Ff(this))return!1;this.I=0;a||Bd(this)&&Cd(this,this.b.u[7],0);try{a=Hc(this.b,a);var d=this.b.fb(a);0<d&&(Ic(this.b,a),this.I+=d,Fc(this.b,d,!0),Bc(this.b,d),this.U++)}catch(e){"number"!=typeof e&&(this.I=0,vb(this.b,e.stack||e.message))}!1!==c&&M(this.b);this.za(b||!1);return 0<this.I};h.ea=function(a){this.b&&this.b.ea(a)};h.za=function(a){void 0===a&&(a=!0);this.M=X(this.b.u[7]);a&&1!=this.aa?Gf(this):Hf(this)};
function Ff(a){var b;if(b=a.b&&hb(a.b))b=a.b,b.v.fa?b=!0:(b.i(b.toString()+" not powered"),b=!1);return b&&!a.b.v.ba?!ib(a.b):!1}h.Ca=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};h.Ba=function(a,b){b&&this.i(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){tf(this);this.U=this.xa=0;this.oa=null;this.I=0;this.M=X(this.b.u[7]);this.v.ba=!1;If(this);a||this.za()};
h.save=function(){var a=new N(this);a.set(0,Bf(this.M));a.set(1,Bf(this.W));a.set(2,[this.A,this.X,this.ha]);a.set(3,this.H);return a.data()};h.restore=function(a){var b=0;void 0!==a[2]&&(this.M=Cf(a[b++]),this.W=Cf(a[b++]),this.A=a[b][0],"string"==typeof this.A&&(this.A=[this.A]),this.X=a[b][1],this.ha|=a[b][2]);a[3]&&(this.H=a[3]);return!0};h.start=function(a,b){this.aa||this.i("running");this.v.ba=!0;this.ib=a;this.pb=b};
h.stop=function(a,b){if(this.v.ba){this.v.ba=!1;this.I=b-this.pb;if(!this.aa){b="stopped";if(this.I){a-=this.ib;var c=0<a?Math.round(1E3*this.I/a):0;b+=" (";Bd(this)&&(b+=this.U+" opcodes, ",this.xa-=this.U,this.U=0);b+=this.I+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.i(b)}this.za(!0);this.nb();If(this,this.b.u[7])}};function Bd(a){return 1<a.f.length||!!a.la}
function Cd(a,b,c){var d=a.b;if(0<c&&(a.la&&!--a.la||sc(a,b,1,a.f)))return!0;0<=c&&a.da.length&&(a.U++,a.g++,b=Mb(a.B,b),a.g--,null!=b&&(b=a.L[a.ga],b.w=d.u[7],b.Aa=!1,++a.ga==a.L.length&&(a.ga=0)));return!1}function sf(a){var b,c;a.f=["bp"];if(a.N)for(b=1;b<a.N.length;b++){c=a.N[b];var d=a.B;tc(d.P[Y(c)>>>d.Y],!1)}a.N=["br"];if(a.G)for(b=1;b<a.G.length;b++)c=a.G[b],d=a.B,tc(d.P[Y(c)>>>d.Y],!0);a.G=["bw"];a.Ya=0}
h.Sa=function(a,b,c){var d=!0;c||Jf(this,a,b,!1,!0);if(a!=this.f){var e=Y(b);if(-1===e)this.i("invalid address: "+I(this,b.w)),d=!1;else{var f=this.B;f.P[e>>>f.Y].Sa(e&f.f,a==this.G)}}d&&(a.push(b),c?b.Aa=!0:(Kf(this,a,a.length-1,"set"),tf(this)));return d};function Jf(a,b,c,d,e){var f=!1;c=Y(c);for(var g=1;g<b.length;g++){var l=b[g];if(c==Y(l)&&(!d||l.Aa)){f=!0;l.Aa||e||Kf(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.B,tc(d.P[c>>>d.Y],b==a.G));l.Aa||tf(a);break}}return f}
function Lf(a,b){for(var c=1;c<b.length;c++)Kf(a,b,c);return b.length-1}function Kf(a,b,c,d){c=b[c];a.i(b[0]+" "+I(a,c.w)+(d?" "+d:c.gc?' "'+c.gc+'"':""))}function If(a,b){if(void 0!==b)sc(a,b,1,a.f,!0),a.aa=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Aa){if(!Jf(a,a.f,c,!0))break;b=0}}}
function sc(a,b,c,d,e){var f=!1;if(!a.Ya++)for(var g=1;!f&&g<d.length;g++){var l=d[g];if(!e||l.Aa)for(var n=Y(l),p=0;p<c;p++)if(b+p==n){var q,f=!0;l.Aa&&(Jf(a,d,l,!0),e=!0);if(q=l.oc){for(var f=!1,v=0;v<q.length;v++)if(!Mf(a,q[v],!0)){if(q[v].indexOf("if")){f=!0;break}for(var u=v+1;u<q.length&&q[u].indexOf("else");u++)v++;if(u==q.length){f=!0;break}}a.b.v.ba||(f=!0)}if(f){e||Kf(a,d,g,"hit");break}}}a.Ya--;return f}
function Nf(a,b,c,d){var e=X(b.w),f=a.ma(b,2),g,l;for(l in a.ab)if(g=a.ab[l][f&l])break;g||(g=[0]);for(var n=l="",p=wf[g[0]],q=g.length-1,v=1;v<=q;v++){var u=g[v];if(void 0!==u){var w;w=a;var B=u,u=b,x="",C=B&61440;if(4096==C)u=u.w+((f&255)<<24>>23)&65535,x=I(w,u);else if(8192==C)u=u.w-((f&63)<<1)&65535,x=I(w,u);else if(12288==C)x=I(w,f&7,1);else if(24576==C)x=I(w,f&63,1);else if(C=f&B,B&4032&&(C>>=6,B>>=6),B&63)switch(B=C&7,C&56){case 0:x=Ef(B);break;case 8:x="@"+Ef(B);break;case 16:7>B?x="("+Ef(B)+
")+":(C=w.ma(u,2),x="#"+I(w,C,0,!0));break;case 24:7>B?x="@("+Ef(B)+")+":(C=w.ma(u,2),x="@#"+I(w,C,0,!0));break;case 32:x="-("+Ef(B)+")";break;case 40:x="@-("+Ef(B)+")";break;case 48:C=w.ma(u,2);x=I(w,C,0,!0)+"("+Ef(B)+")";7==B&&(x=[x,I(w,C+u.w&65535)]);break;case 56:C=w.ma(u,2),x="@"+I(w,C)+"("+Ef(B)+")",7==B&&(x=[x,I(w,C+u.w&65535)])}w=x;if(!w||!w.length){l="INVALID";break}"string"!=typeof w&&(n=w[1],w=w[0]);0<l.length&&(l+=",");l+=w||"???"}}f="";g=I(a,e.w)+":";if(-1!==e.w&&-1!==b.w){do if(f+=" "+
I(a,a.ma(e,2)),null==e.w)break;while(e.w!=b.w)}g+=na(f,24);g+=na(p,5);l&&(g+=" "+l);if(c||n)g=na(g,60)+";"+(c||""),g=a.b.v.$a?g+("cycles="+Cc(a.b).toString()+" cs="+k(a.b.jb)):g+(null!=d?"="+d.toString():""),n&&(g+=" @"+n);return g}function Of(a,b){switch(b){case "N":a=a.b.Fa();break;case "Z":a=gd(a.b);break;case "V":a=fd(a.b);break;case "C":a=ed(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function Pf(a,b){var c="",d=a.b;8>b?(c=Ef(b),c+="="+I(a,d.u[b])):13>b?c="A"+(b-8)+"="+I(a,d.Ha[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+I(a,d.ta[b-16]):20==b&&(c="PS="+I(a,Vb(d)));c&&(c+=" ");return c}function Qf(a){var b,c="";for(b=0;6>b;b++)c+=Pf(a,b);c=c+"\n"+(Pf(a,6)+Pf(a,7)+Pf(a,20));return c+=Of(a,"T")+Of(a,"N")+Of(a,"Z")+Of(a,"V")+Of(a,"C")}h.Kb=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function Rf(a,b,c){var d=[],e=Y(b)>>>0;for(b=0;b<a.H.length;b++){var f=a.H[b],g=f.w>>>0,l=f.wc;if(e>=g&&e<g+l){e=qa(f.Jb,[e-g],a.Kb);0<=e?Sf(a,b,e,d):c&&(e=~e,Sf(a,b,e-1,d),Sf(a,b,e,d));break}}return d}function Sf(a,b,c,d){var e={},f=a.H[b].Jb,g=0,l=null;0<=c&&c<f.length&&(g=f[c][0],l=f[c][1]);l&&(e=a.H[b].Da[l],l="."==l.charAt(0)?null:e.l||l);d.push(l);d.push(g);d.push(e.a);d.push(e.c)}
function Tf(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return qf(a)||a.i("no variables"),!0;if(!c[2])return qf(a,c[1]);if(!c[3])return delete a.ca[c[1]],!0;b=mf(a,c[3]);return void 0!==b?(a.ca[c[1]]=b,!0):!1}a.i("invalid assignment:"+b);return!1}
function Uf(a,b,c){var d=null;if(b=zf(a,b,!0)){var e=Rf(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.w-e[1])&&(g=" + "+k(f,4,!0)),f=e[0]+" ("+I(a,e[1])+")"+g,c&&a.i(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.w)&&(g=" - "+k(f,4,!0)),f=e[4]+" ("+I(a,e[5])+")"+g,c&&a.i(f),d||(d=f))}else c&&a.i("no symbols")}return d}
function Gf(a,b){var c;if(b&&"?"==b[1])a.i("register commands:"),a.i("\tr\tdump registers"),a.i("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.i("missing value for "+b[1]);return}f=mf(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":id(d,f);a.M=X(d.u[7]);break;case "N":d.V=f?32768:0;break;
case "Z":d.Z=f?0:1;break;case "V":d.S=f?32768:0;break;case "C":d.R=f?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=f&65535;break}a.i("unknown register: "+e);return}M(d);a.i("updated registers:")}a.i(Qf(a));c&&(a.M=X(d.u[7]),Hf(a,I(a,a.M.w)))}}function Vf(a,b){b=oa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.i(c[2]):pf(a,null,c[2].charCodeAt(0)):mf(a,b,!0)}
function Wf(a,b,c){var d="t"!=b;c=of(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ea(c,function(){return fb(a,!0)&&a.fb(e,d,!1)},function(){M(a.b);fb(a,!1)})}
function Hf(a,b,c,d){if(b=zf(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=zf(a,c,!0);if(!d||d.w<b.w)return;e=d.w-b.w;if(256<e){a.i("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=gb(a,!1)||a.aa?a.I:null;var g=null!=f?"cycles":null,l=Rf(a,b),n=b.w;if(l[0]&&d&&(!c&&d||0>l[0].indexOf("+"))){var p=l[0]+":";l[2]&&(p+=" "+l[2]);a.i(p)}l[3]&&(g=l[3],f=null);f=Nf(a,b,g,f);a.i(f);a.M=b;e-=b.w-n;c++}}}
function Mf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.i(">> "+b):(a.X&&(a.i("ended assemble at "+I(a,a.W.w)),a.M=a.W,a.X=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.oa=null;if(hb(a)&&0<b.length){a.X&&(b="a "+I(a,a.W.w)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");if(g&&g.length)for(var l=g[0],n=l.charAt(0),p=1;p<l.length;p++){var q=l.charAt(p);if("?"==n||"r"==n||"a">q||"z"<q){g[0]=l.substr(p);g.unshift(l.substr(0,p));break}}g[0]=g[0].toLowerCase();switch(g[0].charAt(0)){case "a":var v=
zf(a,g[1],!0);if(v)if(a.W=v,void 0===g[2])a.i("begin assemble at "+I(a,v.w)),a.X=!0,M(a.b);else{var u;a.i("not supported yet");u=[];if(u.length){for(var w=0;w<u.length;w++)a.mb(v,u[w],1);a.i(Nf(a,a.W))}}break;case "b":a:{var B=g[0],x=g[1],C=b;if("?"==x)a.i("breakpoint commands:"),a.i("\tbp [a]\tset exec breakpoint at addr [a]"),a.i("\tbr [a]\tset read breakpoint at addr [a]"),a.i("\tbw [a]\tset write breakpoint at addr [a]"),a.i("\tbc [a]\tclear breakpoint at addr [a]"),a.i("\tbl\tlist all breakpoints"),
a.i("\tbn [n]\tbreak after [n] instruction(s)");else{var ya=B.charAt(1);if("l"==ya){var Mc;Mc=0+Lf(a,a.f);Mc+=Lf(a,a.N);(Mc+=Lf(a,a.G))||a.i("no breakpoints")}else if("n"==ya)a.la=of(a,x),a.i("break after "+a.la+" instruction(s)");else if(void 0===x)a.i("missing breakpoint address");else{var U=X();if("*"!=x&&(U=zf(a,x,!0),!U))break a;"c"==ya?null==U.w?(sf(a),a.i("all breakpoints cleared")):Jf(a,a.f,U)||Jf(a,a.N,U)||Jf(a,a.G,U)||a.i("breakpoint missing: "+I(a,U.w)):null!=U.w&&(Df(a,U,C),"p"==ya?a.Sa(a.f,
U):"r"==ya?a.Sa(a.N,U):"w"==ya?a.Sa(a.G,U):a.i("unknown breakpoint command: "+ya))}}}break;case "c":a.Ta&&(a.Ta.value="");break;case "d":a:{var Na,Oa=g[0],ia=g[1],za=g[2],og=g[3];if("?"==ia){var Pa="";for(Na in xb)a.Ia[Na]&&(Pa&&(Pa+=","),Pa+=Na);Pa+=",state,symbols";a.i("dump memory commands:");a.i("\tdb [a] [#] dump # bytes at address a");a.i("\tdw [a] [#] dump # words at address a");a.i("\tdd [a] [#] dump # dwords at address a");a.i("\tdh [#] [#] dump # instructions from history");
Pa.length&&a.i("dump extension commands:\n\t"+Pa)}else if("state"==ia){var te=Xf(a.F,!0);"console"==za?console.log(te):(a.Ta&&(a.Ta.value=""),a.i(te))}else if("symbols"==ia)for(var Nc=0;Nc<a.H.length;Nc++){var Oc=a.H[Nc],Qa;for(Qa in Oc.Da)if("."!=Qa.charAt(0)){var ue=Oc.Da[Qa].o;if(void 0!==ue){var ve=Oc.Da[Qa].l;ve&&(Qa=ve);a.i(I(a,ue)+" "+Qa)}}}else{if("d"==Oa){for(Na in xb)if(g[1]==Na){var we=a.Ia[Na];we?(g.shift(),g.shift(),we(g)):a.i("no dump registered for "+ia);break a}ia||(Oa=a.rb||"db")}else a.rb=
Oa;if("dh"==Oa){var xe=ia,ye=za,ze="",Ae=0,ca=a.ga,ja=a.L;if(ja.length){var Z=+xe||a.Za,jb=+ye||10;isNaN(Z)?Z=jb:ze="more ";Z>ja.length&&(a.i("note: only "+ja.length+" available"),Z=ja.length);ca-=Z;0>ca&&(null==ja[ja.length-1].w?(Z=ca+Z,ca=0):ca+=ja.length);var Pc=[];"call"==ye&&(jb=1E5,Pc=["CALL"]);for(void 0!==xe&&a.i(Z+" instructions earlier:");0<jb&&ca!=a.ga;){var Be=ja[ca++];if(null==Be.w)break;var kb=X(Be.w),pg=Z--,Ce=Nf(a,kb,"history",pg);(!Pc.length||0<=Ce.indexOf(Pc[0]))&&a.i(Ce);kb.zb&&
(ca+=kb.zb,jb-=kb.zb,Z-=kb.zb);ca>=ja.length&&(ca=0);a.Za=Z;Ae++;jb--}}Ae||(a.i("no "+ze+"history available"),a.Za=void 0)}else{var Yb=zf(a,ia);if(Yb){var Zb=0;za&&("l"==za.charAt(0)&&(za=za.substr(1)||og),Zb=of(a,za)>>>0,65536<Zb&&(Zb=65536));for(var lb="",mb="dd"==Oa?4:"dw"==Oa?2:1,$b=mb*Zb||128,qg=$b+15>>4||1;qg--&&0<$b;){var ac=0,Qc=0,nb,Rc="",De="",ia=I(a,Yb.w);for(nb=4==mb?16:a.ia;0<nb&&0<$b;nb--){var bc=a.Ua(Yb,1),ac=ac|bc<<(Qc++<<3);Qc==mb&&(Rc+=I(a,ac,mb),Rc+=1==mb?9==nb?"-":" ":" ",ac=
Qc=0);De+=32<=bc&&128>bc?String.fromCharCode(bc):".";$b--}lb&&(lb+="\n");lb+=ia+" "+Rc+(0==nb?" "+De:"")}lb&&a.i(lb);a.Ra=Yb}}}}break;case "e":if("else"==g[0])break;var Ra,Sc,Tc,Uc,Vc=g[0],Wc=g[1];"eb"==Vc?(Ra=1,Sc=255,Tc=a.Ua,Uc=a.mb):"e"==Vc||"ew"==Vc?(Ra=2,Sc=65535,Tc=a.ma,Uc=a.Wa):Wc=null;if(null==Wc)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a");else{var cc=zf(a,Wc);if(cc)for(var dc=2;dc<g.length;dc++){var ob=mf(a,g[dc]);
if(void 0===ob){a.i("unrecognized value: "+g[dc]);break}ob&~Sc&&a.i("warning: "+k(ob)+" exceeds "+Ra+"-byte value");var rg=Tc.call(a,cc);a.i("changing "+I(a,cc.w)+" from "+I(a,rg,Ra)+" to "+I(a,ob,Ra));Uc.call(a,cc,ob,Ra)}}break;case "g":a:{var Ee=g[1],sg=b;if(void 0!==Ee){var Xc=zf(a,Ee,!0);if(!Xc)break a;Df(a,Xc,sg);a.Sa(a.f,Xc,!0)}a.eb(!0)||c||a.i("cpu busy or unavailable, run command ignored")}break;case "h":a.v.ba?(c||a.i("halting"),a.ea()):gb(a,!0)||c||a.i("already halted");break;case "i":if("if"==
g[0]){var Yc;var pb=b.substr(2),pb=oa(pb);mf(a,pb)?(c||a.i("true: "+pb),Yc=!0):(c||a.i("false: "+pb),Yc=!1);Yc||(d=!1);break}f=!0;break;case "k":var tg=g[0];if("?"==g[1])a.i("stack trace commands:"),a.i("\tk\tshow frame addresses"),a.i("\tks\tshow symbol information");else{var Zc=0,$c=X(),qb=X(a.b.u[6]);for(a.i("stack trace for "+I(a,qb.w));10>Zc;){for(var Aa=null,ug=256;65536>qb.w>>>0;){$c.w=a.ma(qb,2);if(null==qb.w||!ug--)break;if(!($c.w&1)){for(var vg=a,ec=$c,Fe=null,rb=ec.w,Ge=rb,ad=1;6>=ad&&
rb;ad++){if(2<ad){ec.w=rb;var fc=Nf(vg,ec);if(0<=fc.indexOf("JSR")){var He=fc.indexOf(" ");if(rb+(fc.indexOf(" ",He+1)-He-1)/2==Ge){Fe=fc;break}}}rb-=2}ec.w=Ge;if(Aa=Fe)break}}if(!Aa||null==Aa)break;var Ie=null;if("ks"==tg){var Je=Aa.match(/[0-9A-F]+$/);Je&&(Ie=Uf(a,Je[0]))}Aa=na(Aa,50)+" ;"+(Ie||"stack="+I(a,qb.w));a.i(Aa);Zc++}Zc||a.i("no return addresses found")}break;case "l":if("ln"==g[0]){Uf(a,g[1],!0);break}f=!0;break;case "m":a:{var ka,la=null,E=g[1];"?"==E&&(E=void 0);if(void 0!==E){var ta=
0;if("all"==E)ta=1878917119,E=null;else if("on"==E)la=!0,E=null;else if("off"==E)la=!1,E=null;else{"keys"==E&&(E="key");"kbd"==E&&(E="keyboard");for(ka in xb)if(E==ka){ta=xb[ka];la=!!(a.ha&ta);break}if(!ta){a.i("unknown message category: "+E);break a}}if(ta)if("on"==g[2])a.ha|=ta,la=!0;else if("off"==g[2]&&(a.ha&=~ta,la=!1,1073741824==ta)){for(var bd=0;bd<a.wa.length;bd++)a.i(a.wa[bd]);a.wa=[]}}var wg=0,sb="";for(ka in xb)if(!E||E==ka){var xg=!!(a.ha&xb[ka]);if(null===la||la==xg)sb&&(sb+=","),++wg%
10||(sb+="\n\t"),"key"==ka&&(ka="keys"),sb+=ka}void 0===E&&a.i("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.i((null!==la?la?"messages on: ":"messages off: ":"message categories:\n\t")+(sb||"none"));tf(a)}break;case "p":if("print"==g[0]){Vf(a,b.substr(5));break}var yg="pr"==g[0]?1:0;if(a.aa)a.i("step in progress");else{var Ke=X(a.b.u[7]);a.Ua(Ke);a.aa?(a.Sa(a.f,Ke,!0),a.eb()||(a.F&&a.F.nb(),a.aa=0)):Wf(a,yg?"tr":"t")}break;case "r":if("reset"==b){a.F&&a.F.reset();break}Gf(a,
g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var tb=+g[2];if(8==tb||10==tb||16==tb)a.ia=tb;else{a.i("invalid base: "+tb);break}}a.i("default base: "+a.ia);break;case "cs":var ub;void 0!==g[3]&&(ub=+g[3]);switch(g[2]){case "int":a.b.bb=ub;break;case "start":a.b.kb=ub;break;case "stop":a.b.cb=ub;break;default:a.i("unknown cs option");break a}void 0!==ub&&zc(a.b);a.i("checksums "+(a.b.v.$a?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Ec(a.b,+g[2])||a.i("warning: using 1x multiplier, previous target not reached"));
a.i("target speed: "+(a.b.Va.toFixed(2)+"Mhz")+" ("+a.b.Na+"x)");break;default:if(g[1]){a.i("unknown option: "+g[1]);break}case "?":a.i("debugger options:"),a.i("\tbase #\t\tset default base to #"),a.i("\tcs int #\tset checksum cycle interval to #"),a.i("\tcs start #\tset checksum cycle start count to #"),a.i("\tcs stop #\tset checksum cycle stop count to #"),a.i("\tsp #\t\tset speed multiplier to #")}break;case "t":Wf(a,g[0],g[1]);break;case "u":Hf(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Tf(a,
b.substr(3))||(d=!1);break}if("ver"==g[0]){a.i("PDPjs version 1.30.1 ("+a.b.Wb+",RELEASE"+(wb?",TYPEDARRAYS":",LONGARRAYS")+")");a.i(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){Vf(a,b.substr(1));break}var cd="commands:",dd;for(dd in vf)cd+="\n"+na(dd,9)+vf[dd];Bd(a)||(cd+="\nnote: history disabled if no exec breakpoints");a.i(cd);break;default:f=!0}f&&(a.i("unknown command: "+b),d=!1)}}catch(Le){a.i("debugger error: "+(Le.stack||Le.message)),d=!1}return d}
function Ac(a,b,c){b=kf(a,b,c);for(var d in b)if(!Mf(a,b[+d]))return!1;return!0}La(function(){for(var a=A(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new rf(d);eb(d,c)}});
function Yf(a,b,c){r.call(this,"Computer",a,Yf,67108864);this.v.fa=!1;Zf(this,b);this.M=xc(this,"autoPower",a);this.F=0;this.aa=a.busWidth||a.buswidth;this.f=$f;this.I=null;this.G=this.W=!1;this.ca=xc(this,"url")||"";(Math.random()+.1).toString(36);this.g=ag(this);if(this.b=db("CPU",this.id)){this.j=db("Debugger",this.id);this.B=new Ab({id:this.xb+".bus",busWidth:this.aa},this.b,this.j);var d,e=bb(this.id);if((this.A=db("Panel",this.id))&&this.A.Ta)for(b=0;b<e.length;b++)d=e[b],d.na=this.A.na,d.i=
this.A.i,d.Ta=this.A.Ta;this.i("PDPjs v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.i("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ga&&d.Ga(this,this.B,this.b,this.j);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=xc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.G=!0,this.f=$f),this.f&&
(this.L=new N(this,"1.30.1"),bg(this.L)?b=null:delete this.L);!b&&this.f&&(b=cg(this))&&(this.G=!0);if(b){var g=this;ua(b,null,!0,function(a,b,c){c?(g.H=null,g.G=!1,g.na("Unable to load machine state from server (error "+c+(b?": "+oa(b):"")+")")):(g.I=b,g.W=!0);G(g)})}else G(this);this.J.power||(this.M=!0);!c&&this.M&&dg(this,this.lb)}else m("Unable to find CPU component")}y(Yf);var $f=0;
function Zf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){m(d.message+" ("+c+")")}}a.X=b}function xc(a,b,c){var d=b.toLowerCase(),d=Va[b]||Va[d];void 0===d&&a.X&&(d=a.X[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function dg(a,b,c){for(var d=bb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!hb(f)){hb(f,function(){dg(a,b,c)});return}}b.call(a,c)}
function eg(a,b){var c=new N(a,"1.30.1","validate");if(bg(c)&&fg(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.na("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=Yf.prototype;
h.lb=function(a){void 0===a&&(a=this.f||(this.I?1:$f));if(!this.F){this.F++;var b=!1,c=!1;this.U=!1;var d=this.L||new N(this,"1.30.1");if(-1==a)b=!0;else if(a>$f){if(bg(d,this.I)){this.C=new N(this,"1.30.1","failsafe");bg(this.C)&&(gg(this,d),a=2,hg(this.C));this.C.set("timestamp",sa());ig(this.C);var e=this.f&&!this.G;if(1==a||va("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=fg(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?bg(d,g):("error"==
f&&"no machine state"!=g?(this.na("Error: "+g),"unable to verify user"==g&&(Ca("user",""),this.g=null)):this.i(f+": "+g),hg(d),bg(d)?(c=fg(d),e=!0):c=!1))}e&&eg(this,c?d:null)}else 2==a&&d.clear()}else eg(this);delete this.I;delete this.L}e=bb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=jg(this,g,d,b,c));b=[d,a,c];-1!=a?dg(this,this.Mb,b):this.Mb(b)}};
function jg(a,b,c,d,e){if(!b.v.fa){b.v.fa=!0;if(b.Ca){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Ca(f,d)&&f&&(m("Unable to restore state for "+b.type),a.N&&!a.W?(c.clear(),a.f=$f,window&&window.location.reload()):a.U=!0,b.Ca(null),e=!1)}if(!d&&b.Nb)for(a=b.Nb.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.da=!0;this.v.fa=!0;var d=this.J.power;d&&(d.textContent="Shutdown");this.b&&(jg(this,this.b,b,c,a),this.b.gb());this.U&&(gg(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.F=0};
function gg(a,b){if(va("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.1"};d.url=a.ca;d.user=c;d.type="bug";d.data=b;ua("http://www.pcjs.org/api/v1/report",d,!0)}}
function Xf(a,b,c){var d,e="none";if(a.F)return null;a.F--;var f=new N(a,"1.30.1"),g=new N(a,"1.30.1","validate"),l=sa();g.set("timestamp",l);f.set("timestamp",l);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Ba&&(c&&a.b.ea(),d=a.b.Ba(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.fa=!1,!1===d&&(e=null)));for(var l=bb(a.id),n=0;n<l.length;n++){var p=l[n];p.v.fa&&(p.Ba&&(d=p.Ba(b,c),"object"===typeof d&&f.set(p.id,
d)),c&&(p.v.fa=!1,!1===d&&(e=null)))}e&&(c?(l=d=!1,b?(a.g&&kg(a,a.g,f.toString()),ig(g)&&ig(f)||(e=null,d=l=!0)):a.f&&(d=!0,l=3==a.f),d&&f.clear(l)):e=f.toString());c&&(a.v.fa=!1,b=a.J.power)&&(b.textContent="Power");a.F=0;return e}h.reset=function(){this.B&&this.B.reset&&(D(this,"Resetting "+this.B.type),this.B.reset());for(var a=bb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.B&&c.reset&&(D(this,"Resetting "+c.type),c.reset())}};
h.start=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};h.stop=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
h.ja=function(a,b,c){var d=this;switch(b){case "power":return this.J[b]=c,c.onclick=function(){d.F||(d.v.fa?Wf(d,!1,!0):cg(d,d.nb))},!0;case "reset":return this.J[b]=c,c.onclick=function(){if(d.v.fa&&!d.F)if(d.f&&!d.H){var a=va("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Wf(d,a,!0);!a&&d.N?window&&window.location.reload():d.nb(Zf)}else d.reset(),d.b&&d.b.hb()},!0;case "save":if(fa())c.parentNode.removeChild(c);else return this.J[b]=
c,c.onclick=function(){var a=$f(d,!0);if(a){var b=!!(d.f&&!d.H||d.N),c=Wf(d,b);b?jg(d,a,c):d.na("Resume disabled, machine state not saved")}},!0}return!1};
function $f(a,b){var c=a.g;c||((c=Ba("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=kg(a,c))||a.na("The user ID is invalid.")):b&&a.na("Browser local storage is not available"));return c}
function kg(a,b){a.g=null;b=ua(ga()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ca("user",b.data),a.g=b.data)}catch(d){m(d.message+" ("+c+")")}return a.g}function bg(a){var b=null;a.g&&(b=ga()+"/api/v1/user?req=load&user="+a.g+"&state="+lg(a,"1.30.1"));return b}
function jg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=lg(a,"1.30.1");d.data=c;b=ua(ga()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.na("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.na(c),Ca("user",""),a.g=null)}}h.pb=function(){};
h.za=function(a){this.b&&this.b.za(a);this.A&&this.A.za(a)};La(function(){for(var a=A(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=A(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=z(f),g=new Xf(g,d,!0);eb(g,f);g.M&&cg(g,g.nb)}});Ga.show.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=db("Computer",c.id))&&c.da&&!c.v.fa&&c.nb(-1)}});
Ga.exit.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=db("Computer",c.id))&&c.v.fa&&Wf(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=lg(a,b,c);this.j=a.j;gg(this,a.xc)}function lg(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
N.prototype={constructor:N,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){gg(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function gg(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function hg(a){var b=!0;if(xa()){var c=JSON.stringify(a[a.id]);Ca(a.key,c)||(m("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function eg(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){m(c.message||c),b=!1}return b}function ag(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:xa()&&(b=Ba(a.key))?(a[a.id]=b,a.b=!0):!1}var mg=0;
function yg(a,b,c,d,e,f){e("Loading "+a+"...");ua(a,null,!0,function(g,l,n){n?(l||(l="unable to load "+a+" ("+n+")"),f(l,null)):zg(l,a,b,c,d,e,f)})}
function zg(a,b,c,d,e,f,g){function l(a,f){if(f)g(f,null);else{c&&(ab(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){f=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Ag(a,f,l):l(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Ag(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");ua(e,null,!0,function(f,g,l){if(l||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+l+")");else{if(f=d[3])if(l=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var n=l[0],p,q=/( [a-z]+=)(['"])(.*?)\2/g;p=q.exec(f);)n=0>n.indexOf(p[1])?n.replace(">",p[0]+">"):n.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);l[0]!=n&&(g=g.replace(l[0],n))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);Ag(a,b,c)}})}else c(a,null)}
function Bg(a,b,c,d){function e(a){if(void 0===l){var b=g&&A(g,"machine-warning");l=b&&b[0]||g}l&&(l.innerHTML=ma(a))}function f(a){e("Error: "+a);n&&(--mg||Sa(!0));n=!1}var g,l,n=!0;mg++;$a[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=p:v.appendChild(document.createTextNode(p));q.appendChild(v)}c||
(c="/versions/pdp11/1.30.1/components.xsl");p=function(d,l){l?yg(c,null,null,!1,e,function(d,n){n?(ab(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(n=l.transformNode(n))?(g.outerHTML=n,--mg||Sa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(n),(n=d.transformToFragment(l,document))?g.parentNode?(g.parentNode.replaceChild(n,g),--mg||Sa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?yg(b,a,d,!0,e,p):zg(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(u){f(u.message)}return n}window.embedPDP11=function(a,b,c,d){Sa(!1);return Bg(a,b,c,d)};window.enableEvents=Sa;window.sendEvent=Ta;})();
h.ja=function(a,b,c){var d=this;switch(b){case "power":return this.J[b]=c,c.onclick=function(){d.F||(d.v.fa?Xf(d,!1,!0):dg(d,d.lb))},!0;case "reset":return this.J[b]=c,c.onclick=function(){if(d.v.fa&&!d.F)if(d.f&&!d.H){var a=va("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Xf(d,a,!0);!a&&d.N?window&&window.location.reload():d.lb($f)}else d.reset(),d.b&&d.b.gb()},!0;case "save":if(fa())c.parentNode.removeChild(c);else return this.J[b]=
c,c.onclick=function(){var a=ag(d,!0);if(a){var b=!!(d.f&&!d.H||d.N),c=Xf(d,b);b?kg(d,a,c):d.na("Resume disabled, machine state not saved")}},!0}return!1};
function ag(a,b){var c=a.g;c||((c=Ba("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=lg(a,c))||a.na("The user ID is invalid.")):b&&a.na("Browser local storage is not available"));return c}
function lg(a,b){a.g=null;b=ua(ga()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ca("user",b.data),a.g=b.data)}catch(d){m(d.message+" ("+c+")")}return a.g}function cg(a){var b=null;a.g&&(b=ga()+"/api/v1/user?req=load&user="+a.g+"&state="+mg(a,"1.30.1"));return b}
function kg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=mg(a,"1.30.1");d.data=c;b=ua(ga()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.na("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.na(c),Ca("user",""),a.g=null)}}h.nb=function(){};
h.za=function(a){this.b&&this.b.za(a);this.A&&this.A.za(a)};La(function(){for(var a=A(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=A(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=z(f),g=new Yf(g,d,!0);eb(g,f);g.M&&dg(g,g.lb)}});Ga.show.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=db("Computer",c.id))&&c.da&&!c.v.fa&&c.lb(-1)}});
Ga.exit.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=db("Computer",c.id))&&c.v.fa&&Xf(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=mg(a,b,c);this.j=a.j;hg(this,a.xc)}function mg(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){hg(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 hg(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function ig(a){var b=!0;if(xa()){var c=JSON.stringify(a[a.id]);Ca(a.key,c)||(m("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function fg(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){m(c.message||c),b=!1}return b}function bg(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:xa()&&(b=Ba(a.key))?(a[a.id]=b,a.b=!0):!1}var ng=0;
function zg(a,b,c,d,e,f){e("Loading "+a+"...");ua(a,null,!0,function(g,l,n){n?(l||(l="unable to load "+a+" ("+n+")"),f(l,null)):Ag(l,a,b,c,d,e,f)})}
function Ag(a,b,c,d,e,f,g){function l(a,f){if(f)g(f,null);else{c&&(ab(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){f=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Bg(a,f,l):l(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Bg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");ua(e,null,!0,function(f,g,l){if(l||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+l+")");else{if(f=d[3])if(l=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var n=l[0],p,q=/( [a-z]+=)(['"])(.*?)\2/g;p=q.exec(f);)n=0>n.indexOf(p[1])?n.replace(">",p[0]+">"):n.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);l[0]!=n&&(g=g.replace(l[0],n))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);Bg(a,b,c)}})}else c(a,null)}
function Cg(a,b,c,d){function e(a){if(void 0===l){var b=g&&A(g,"machine-warning");l=b&&b[0]||g}l&&(l.innerHTML=ma(a))}function f(a){e("Error: "+a);n&&(--ng||Sa(!0));n=!1}var g,l,n=!0;ng++;$a[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=p:v.appendChild(document.createTextNode(p));q.appendChild(v)}c||
(c="/versions/pdp11/1.30.1/components.xsl");p=function(d,l){l?zg(c,null,null,!1,e,function(d,n){n?(ab(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(n=l.transformNode(n))?(g.outerHTML=n,--ng||Sa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(n),(n=d.transformToFragment(l,document))?g.parentNode?(g.parentNode.replaceChild(n,g),--ng||Sa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?zg(b,a,d,!0,e,p):Ag(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(u){f(u.message)}return n}window.embedPDP11=function(a,b,c,d){Sa(!1);return Cg(a,b,c,d)};window.enableEvents=Sa;window.sendEvent=Ta;})();

View file

@ -692,141 +692,142 @@ typeof b){var n="",q;for(q in b)b.hasOwnProperty(q)&&(n&&(n+="&"),n+=q+"="+encod
function p(a){window&&window.alert(a)}function la(a){var b=!1;window&&(b=window.confirm(a));return b}var ma=null;function na(){if(null==ma){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}ma=a}return ma}function oa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
function pa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function qa(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var r={init:[],show:[],exit:[]},ra=!1,sa=!1,ta=!0;function ua(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function u(a){r.init.push(a)}
function va(a){if(ta)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){p(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function wa(a){!ta&&a?(ta=!0,ra&&xa("init"),sa&&xa("show")):ta=a}function xa(a){r[a]&&va(r[a])}ua("onload",function(){ra=!0;va(r.init)});ua("onpageshow",function(){sa=!0;va(r.show)});ua(qa("Opera")||qa("iOS")?"onunload":"onbeforeunload",function(){va(r.exit)});
function v(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.kb=b.comment;this.Nb=b;b=this.id.indexOf(".");0>b?this.Fa=this.id:(this.Va=this.id.substr(0,b),this.Fa=this.id.substr(b+1));this[a]=c;this.i={ready:!1,Yc:!1,Zc:!1,L:!1,error:!1};this.Oa=null;this.i.error=!1;this.w={};this.I=null;w.push(this)}var ya=void 0,za={};
function v(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.jb=b.comment;this.Nb=b;b=this.id.indexOf(".");0>b?this.Da=this.id:(this.Ua=this.id.substr(0,b),this.Da=this.id.substr(b+1));this[a]=c;this.i={ready:!1,Yc:!1,Zc:!1,L:!1,error:!1};this.Ma=null;this.i.error=!1;this.w={};this.I=null;w.push(this)}var ya=void 0,za={};
if(window){ya||(ya=window.location.search.substr(1));for(var Aa,Ca=/\+/g,Da=/([^&=]+)=?([^&]*)/g;Aa=Da.exec(ya);)za[decodeURIComponent(Aa[1].replace(Ca," "))]=decodeURIComponent(Aa[2].replace(Ca," "))}function Ea(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function x(a,b){b||(b=v);a.prototype=Ea(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Fa=window.PCjs.Machines||(window.PCjs.Machines={}),w=window.PCjs.Components||(window.PCjs.Components=[])}else Fa={},w=[];function Ga(a,b,c){Fa[a]&&b&&(Fa[a][b]=c)}function y(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<w.length;b++){var d=w[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function Ha(a){if(void 0!==a){var b;for(b=0;b<w.length;b++)if(w[b].id===a)return w[b]}return null}function z(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<w.length;d++)if(c)c==w[d]&&(c=null);else if(!(a!=w[d].type||b&&w[d].id.indexOf(b)))return w[d]}return null}function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){p(c.message+" ("+a+")")}return b}
function B(a,b){b=C(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var k=f.getAttribute("class");if(k)for(var m=k.split(" "),n=0;n<m.length;n++)switch(k=m[n],k){case "pdp11-binding":(k=A(f))&&k.binding&&a.R(k.type,k.binding,f,k.value),n=m.length}}}}
function C(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
v.prototype={constructor:v,parent:null,toString:function(){return this.name?this.name:this.id||this.type},R:function(a,b,c){switch(b){case "clear":return this.w[b]||(this.w[b]=c,c.onclick=function(a){return function(){a.w.print&&(a.w.print.value="")}}(this)),!0;case "print":return this.w[b]||(this.Ta=this.w[b]=c,c.value="",this.M=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.K=function(a){this.M(a,this.Fa)}),!0;default:return!1}},log:function(){},M:function(){},status:function(a){this.M(this.Fa+": "+a)},K:function(a,b,c){c=c||this.type;b||p((c?c+": ":"")+a)},ha:function(){return this.i.L=!0},ga:function(a,b){b&&(this.i.L=!1);return!0}};function D(a){if(!a.i.error&&(a.i.ready=!0,a.i.ready)){var b=a.Oa;a.Oa=null;b&&b()}}function Ia(a,b){b&&(a.i.ready?b():a.Oa=b);return a.i.ready}
v.prototype={constructor:v,parent:null,toString:function(){return this.name?this.name:this.id||this.type},R:function(a,b,c){switch(b){case "clear":return this.w[b]||(this.w[b]=c,c.onclick=function(a){return function(){a.w.print&&(a.w.print.value="")}}(this)),!0;case "print":return this.w[b]||(this.Sa=this.w[b]=c,c.value="",this.M=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.K=function(a){this.M(a,this.Da)}),!0;default:return!1}},log:function(){},M:function(){},status:function(a){this.M(this.Da+": "+a)},K:function(a,b,c){c=c||this.type;b||p((c?c+": ":"")+a)},ha:function(){return this.i.L=!0},ga:function(a,b){b&&(this.i.L=!1);return!0}};function D(a){if(!a.i.error&&(a.i.ready=!0,a.i.ready)){var b=a.Ma;a.Ma=null;b&&b()}}function Ia(a,b){b&&(a.i.ready?b():a.Ma=b);return a.i.ready}
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});var Ja="undefined"!==typeof ArrayBuffer;function Ka(a){v.call(this,"Panel",a,Ka)}x(Ka);g=Ka.prototype;
g.R=function(a,b,c,d){return this.A&&this.A.R(a,b,c,d)||this.b&&this.b.R(a,b,c,d)?!0:this.parent.R.call(this,a,b,c,d)};g.oa=function(a,b,c,d){this.A=a;this.o=b;this.b=c;this.I=d};g.ha=function(a,b){b||La();return!0};g.ga=function(){return!0};g.wa=function(){};function La(){for(var a=!1,b=C(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=Ha(e.id);f||(a=!0,f=new Ka(e));B(f,d);a&&D(f)}}u(La);
function Ma(a,b,c){v.call(this,"Bus",a,Ma);this.b=b;this.I=c;this.u=a.busWidth||16;this.l=Math.pow(2,this.u);this.h=this.l-1|0;this.c=(this.u>>1)+2;10>this.c&&(this.c=10);15<this.c&&(this.c=15);this.g=1<<this.c;this.A=this.g>>2;this.o=this.g-1;this.s=this.l/this.g|0;this.la=[];this.m=[];a=new E(this.b);Na(a,this.I);this.a=Array(this.s);for(b=0;b<this.s;b++)this.a[b]=a;this.Ba=Array(4);this.Ba[0]=Oa;this.Ba[1]=Pa;this.Ba[2]=Qa;this.Ba[3]=Ra;Sa(this,this.l-8192,8192,Ta,this);Sa(this,57344,8192,Ta,this);
D(this)}x(Ma);function Oa(a,b){var c=-1,d=this.controller,e=d.la[a];e?e[0]?c=e[0](b)&255:e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.la[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return c;F(d.b,4)}function Pa(a,b,c){var d=!1,e=this.controller,f=e.la[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](c):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.la[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](c):0,f[3](a&255|b<<8,c),d=!0);d||F(e.b,4)}
function Qa(a,b){var c=-1,d=this.controller;(a=d.la[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return c;F(d.b,4)}function Ra(a,b,c){var d=!1,e=this.controller;if(a=e.la[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d||F(e.b,4)}Ma.prototype.reset=function(){for(var a=0;a<this.m.length;a++)this.m[a]()};Ma.prototype.ha=function(a,b){b||this.reset();return!0};
function Sa(a,b,c,d,e){for(var f=b,k=c,m=f>>>a.c;0<k&&m<a.a.length;){var n=a.a[m],q=m*a.g,t=a.g-(f-q);t>k&&(t=k);if(n&&n.size){if(n.type==d&&n.controller==e){if(f+k<=n.Aa)return n.Qa+=n.Aa-f,n.Aa=f,!0;if(f>=n.Aa+n.Qa){t=n.size-(f-q);t>k&&(t=k);n.Qa=f-n.Aa+t;f=q+a.g;k-=t;m++;continue}}return Ua(1,f,k)}f=new E(a.b,f,t,a.g,d,e);Na(f,a.I,n);a.a[m++]=f;f=q+a.g;k-=t}return 0>=k?(a.status(Math.floor(c/1024)+"Kb "+Va[d]+" at "+h(b,8,!0)),!0):Ua(2,b,c)}
function Wa(a,b){return a.a[(b&a.h)>>>a.c].$a(b&a.o,b)}function Xa(a,b){return a.a[(b&a.h)>>>a.c].nc(b&a.o,b)}function Ya(a,b,c){a.a[(b&a.h)>>>a.c].Sc(b&a.o,c&65535,b)}function Za(a){for(var b=0,c=[],d=0;d<a.s;d++){var e=a.a[d];if(e.ma||e.Ib){c[b++]=d;var f=b++;if(e=e.save()){for(var k=0,m=0,n=[];k<e.length;){for(var q=e[k],t=k+1;t<e.length&&e[t]===q;)t++;n[m++]=t-k;n[m++]=q;k=t}n.length<e.length&&(e=n)}c[f]=e}}return c}
function $a(a,b,c){for(var d in c){var e=c[d];if(!(e[5]&&e[5]>a.b.Mb))for(var f=e[0]?e[0].bind(b):null,k=e[1]?e[1].bind(b):null,m=e[2]?e[2].bind(b):null,n=e[3]?e[3].bind(b):null,q=a,t=+d,e=e[4],J=+d;J<=t;J+=2){var Ba=J&8191;void 0!==q.la[Ba]?p("I/O address already registered: "+h(J,8,!0)):q.la[Ba]=[f,k,m,n,e||"unknown",!1]}}}function ab(a,b){a.m.push(b)}function Ua(a,b,c){p("Memory block error ("+a+": "+h(b)+","+h(c)+")");return!1}
function G(a){v.call(this,"Device",a,G);this.c={data:0,Xc:0,Pa:20,ad:0};this.a={$c:0,eb:-1}}x(G);g=G.prototype;g.oa=function(a,b,c,d){this.o=b;this.b=c;this.I=d;var e=this;this.a.eb=bb(this.b,function(){e.a.pa|=128;e.a.pa&64&&(cb(e.b,0,6,64),db(e.b,e.a.eb,1E3/60))});$a(b,this,H);ab(b,this.reset.bind(this));D(this)};g.Ub=function(){var a=this.a.pa;this.a.pa&=-129;return a};g.Ac=function(a){this.a.pa=a;a&64&&db(this.b,this.a.eb,1E3/60);this.a.pa=a&-129};
g.Wb=function(){var a=this.b;return a.D&62337|a.Ga<<5|a.Ha<<1};g.Cc=function(a){var b=this.b;b.D=a&=62337;b.Ga=a>>5&3;b.Ha=a>>1&15;b.Za=a&257?a&1?6:4:0;eb(b);fb(this)};g.Xb=function(){var a=this.b.qa;a&65280&&(a=(a<<8|a>>8)&65535);return a};g.Yb=function(){return this.b.bb};g.Zb=function(){return this.b.ua};g.Dc=function(a){var b=this.b;b.ua=a;b.ua&16?(b.Xa=4194303,b.Ia=3915776):(b.Xa=262143,b.Ia=253952);fb(this)};function fb(a){a.c.Pa=a.c.Pa&-8|(a.b.Za?a.b.ua&16?1:2:4)}
g.gc=function(a){return this.b.C[1][a>>1&7]};g.Lc=function(a,b){this.b.C[1][b>>1&7]=a&65295};g.ec=function(a){return this.b.C[1][(a>>1&7)+8]};g.Jc=function(a,b){this.b.C[1][(b>>1&7)+8]=a&65295};g.fc=function(a){return this.b.P[1][a>>1&7]};g.Kc=function(a,b){b=b>>1&7;this.b.P[1][b]=a;this.b.C[1][b]&=65295};g.dc=function(a){return this.b.P[1][(a>>1&7)+8]};g.Ic=function(a,b){b=(b>>1&7)+8;this.b.P[1][b]=a;this.b.C[1][b]&=65295};g.Tb=function(a){return this.b.C[0][a>>1&7]};
g.zc=function(a,b){this.b.C[0][b>>1&7]=a&65295};g.Rb=function(a){return this.b.C[0][(a>>1&7)+8]};g.xc=function(a,b){this.b.C[0][(b>>1&7)+8]=a&65295};g.Sb=function(a){return this.b.P[0][a>>1&7]};g.yc=function(a,b){b=b>>1&7;this.b.P[0][b]=a;this.b.C[0][b]&=65295};g.Qb=function(a){return this.b.P[0][(a>>1&7)+8]};g.wc=function(a,b){b=(b>>1&7)+8;this.b.P[0][b]=a;this.b.C[0][b]&=65295};g.mc=function(a){return this.b.C[3][a>>1&7]};g.Rc=function(a,b){this.b.C[3][b>>1&7]=a&65295};
g.kc=function(a){return this.b.C[3][(a>>1&7)+8]};g.Pc=function(a,b){this.b.C[3][(b>>1&7)+8]=a&65295};g.lc=function(a){return this.b.P[3][a>>1&7]};g.Qc=function(a,b){b=b>>1&7;this.b.P[3][b]=a;this.b.C[3][b]&=65295};g.jc=function(a){return this.b.P[3][(a>>1&7)+8]};g.Oc=function(a,b){b=(b>>1&7)+8;this.b.P[3][b]=a;this.b.C[3][b]&=65295};g.T=function(a){a&=7;return this.b.v&2048?this.b.va[a]:this.b.f[a]};g.W=function(a,b){b&=7;this.b.v&2048?this.b.va[b]=a:this.b.f[b]=a};
g.qb=function(){return this.b.v&49152?this.b.Z[0]:this.b.f[6]};g.Cb=function(a){this.b.v&49152?this.b.Z[0]=a:this.b.f[6]=a};g.tb=function(){return this.b.f[7]};g.Fb=function(a){this.b.f[7]=a};g.U=function(a){a&=7;return this.b.v&2048?this.b.f[a]:this.b.va[a]};g.X=function(a,b){b&=7;this.b.v&2048?this.b.f[b]=a:this.b.va[b]=a};g.rb=function(){return 1==(this.b.v&49152)>>14?this.b.f[6]:this.b.Z[1]};g.Db=function(a){1==(this.b.v&49152)>>14?this.b.f[6]=a:this.b.Z[1]=a};
g.sb=function(){return 3==(this.b.v&49152)>>14?this.b.f[6]:this.b.Z[3]};g.Eb=function(a){3==(this.b.v&49152)>>14?this.b.f[6]=a:this.b.Z[3]=a};g.Pb=function(a){return this.b.xb[a-65504>>1]};g.vc=function(a,b){this.b.xb[b-65504>>1]=a};g.ub=function(a){return 65520==a?61183:0};g.Gb=function(){};g.ic=function(){return 1};g.Nc=function(){};g.Ob=function(){return this.b.F};g.uc=function(){this.b.F=0};g.Vb=function(){return this.b.wb};g.Bc=function(a,b){b&1||(a&=255);this.b.wb=a};g.$b=function(){return this.b.cb};
g.Ec=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.cb=a;b.j|=2};g.hc=function(){return this.b.ra&65280};g.Mc=function(a){this.b.ra=a|255};g.ac=function(){return gb(this.b)};g.Fc=function(a){hb(this.b,a&-1809|gb(this.b)&1808);this.b.j|=128};g.reset=function(){this.c.Pa=this.c.Pa&-120|20;this.a.pa=0};
var I={},H=(I[62592]=[null,null,G.prototype.gc,G.prototype.Lc,"SISDR"],I[62608]=[null,null,G.prototype.ec,G.prototype.Jc,"SDSDR"],I[62624]=[null,null,G.prototype.fc,G.prototype.Kc,"SISAR"],I[62640]=[null,null,G.prototype.dc,G.prototype.Ic,"SDSAR"],I[62656]=[null,null,G.prototype.Tb,G.prototype.zc,"KISDR"],I[62672]=[null,null,G.prototype.Rb,G.prototype.xc,"KDSDR"],I[62688]=[null,null,G.prototype.Sb,G.prototype.yc,"KISAR"],I[62704]=[null,null,G.prototype.Qb,G.prototype.wc,"KDSAR"],I[62798]=[null,null,
G.prototype.Zb,G.prototype.Dc,"MMR3"],I[65382]=[null,null,G.prototype.Ub,G.prototype.Ac,"LKS"],I[65402]=[null,null,G.prototype.Wb,G.prototype.Cc,"MMR0"],I[65404]=[null,null,G.prototype.Xb,null,"MMR1"],I[65406]=[null,null,G.prototype.Yb,null,"MMR2"],I[65408]=[null,null,G.prototype.mc,G.prototype.Rc,"UISDR"],I[65424]=[null,null,G.prototype.kc,G.prototype.Pc,"UDSDR"],I[65440]=[null,null,G.prototype.lc,G.prototype.Qc,"UISAR"],I[65456]=[null,null,G.prototype.jc,G.prototype.Oc,"UDSAR"],I[65472]=[G.prototype.T,
G.prototype.W,G.prototype.T,G.prototype.W,"R0SET0"],I[65473]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R1SET0"],I[65474]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R2SET0"],I[65475]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R3SET0"],I[65476]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R4SET0"],I[65477]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R5SET0"],I[65478]=[G.prototype.qb,G.prototype.Cb,G.prototype.qb,G.prototype.Cb,
"R6KERNEL"],I[65479]=[G.prototype.tb,G.prototype.Fb,G.prototype.tb,G.prototype.Fb,"R7KERNEL"],I[65480]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R0SET1"],I[65481]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R1SET1"],I[65482]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R2SET1"],I[65483]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R3SET1"],I[65484]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R4SET1"],I[65485]=[G.prototype.U,G.prototype.X,
G.prototype.U,G.prototype.X,"R5SET1"],I[65486]=[G.prototype.rb,G.prototype.Db,G.prototype.rb,G.prototype.Db,"R6SUPER"],I[65487]=[G.prototype.sb,G.prototype.Eb,G.prototype.sb,G.prototype.Eb,"R6USER"],I[65504]=[null,null,G.prototype.Pb,G.prototype.vc,"CTRL",1170],I[65520]=[null,null,G.prototype.ub,G.prototype.Gb,"LSIZE",1170],I[65522]=[null,null,G.prototype.ub,G.prototype.Gb,"HSIZE",1170],I[65524]=[null,null,G.prototype.ic,G.prototype.Nc,"SYSID",1170],I[65526]=[null,null,G.prototype.Ob,G.prototype.uc,
"CPUERR",1170],I[65528]=[null,null,G.prototype.Vb,G.prototype.Bc,"MB",1170],I[65530]=[null,null,G.prototype.$b,G.prototype.Ec,"PIR"],I[65532]=[null,null,G.prototype.hc,G.prototype.Mc,"SL"],I[65534]=[null,null,G.prototype.ac,G.prototype.Fc,"PSW"],I);H[62594]=H[62592];H[62596]=H[62592];H[62598]=H[62592];H[62600]=H[62592];H[62602]=H[62592];H[62604]=H[62592];H[62606]=H[62592];H[62610]=H[62608];H[62612]=H[62608];H[62614]=H[62608];H[62616]=H[62608];H[62618]=H[62608];H[62620]=H[62608];H[62622]=H[62608];
g.R=function(a,b,c,d){return this.B&&this.B.R(a,b,c,d)||this.b&&this.b.R(a,b,c,d)?!0:this.parent.R.call(this,a,b,c,d)};g.oa=function(a,b,c,d){this.B=a;this.m=b;this.b=c;this.I=d};g.ha=function(a,b){b||La();return!0};g.ga=function(){return!0};g.wa=function(){};function La(){for(var a=!1,b=C(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=Ha(e.id);f||(a=!0,f=new Ka(e));B(f,d);a&&D(f)}}u(La);
function Ma(a,b,c){v.call(this,"Bus",a,Ma);this.b=b;this.I=c;this.u=a.busWidth||16;this.l=0;this.B=Math.pow(2,this.u);this.h=this.B-1|0;this.c=(this.u>>1)+2;10>this.c&&(this.c=10);15<this.c&&(this.c=15);this.g=1<<this.c;this.A=this.g>>2;this.m=this.g-1;this.s=this.B/this.g|0;this.la=[];this.o=[];this.Gb=[Na,Oa,Pa,Qa];a=new E(this.b);Ra(a,this.I);this.a=Array(this.s);for(b=0;b<this.s;b++)this.a[b]=a;Sa(this,16);D(this)}x(Ma);
function Na(a,b){var c=-1,d=this.controller,e=d.la[a];e?e[0]?c=e[0](b)&255:e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.la[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return c;F(d.b,4)}function Oa(a,b,c){var d=!1,e=this.controller,f=e.la[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](c):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.la[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](c):0,f[3](a&255|b<<8,c),d=!0);d||F(e.b,4)}
function Pa(a,b){var c=-1,d=this.controller;(a=d.la[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return c;F(d.b,4)}function Qa(a,b,c){var d=!1,e=this.controller;if(a=e.la[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d||F(e.b,4)}
function Sa(a,b){if(b!=a.l){var c;if(a.l){c=(1<<a.l)-8192;var d=c;c=8192;if(d&a.m||!c||c&a.m)c=Ta(2,d,c);else{for(var e=d>>>a.c;0<c;){var f=a.a[e],d=new E(a.b,d);Ra(d,a.I,f);a.a[e++]=d;d=e*a.g;c-=a.g}c=!0}if(!c)return;a.l=0}Ua(a,(1<<b)-8192,8192,Va,a)&&(a.l=b)}}Ma.prototype.reset=function(){for(var a=0;a<this.o.length;a++)this.o[a]()};Ma.prototype.ha=function(a,b){b||this.reset();return!0};
function Ua(a,b,c,d,e){for(var f=b,k=c,m=f>>>a.c;0<k&&m<a.a.length;){var n=a.a[m],q=m*a.g,t=a.g-(f-q);t>k&&(t=k);if(n&&n.size){if(n.type==d&&n.controller==e){if(f+k<=n.za)return n.Pa+=n.za-f,n.za=f,!0;if(f>=n.za+n.Pa){t=n.size-(f-q);t>k&&(t=k);n.Pa=f-n.za+t;f=q+a.g;k-=t;m++;continue}}return Ta(1,f,k)}f=new E(a.b,f,t,a.g,d,e);Ra(f,a.I,n);a.a[m++]=f;f=q+a.g;k-=t}return 0>=k?(a.status(Math.floor(c/1024)+"Kb "+Wa[d]+" at "+h(b,8,!0)),!0):Ta(2,b,c)}
function Xa(a,b){return a.a[(b&a.h)>>>a.c].Ya(b&a.m,b)}function Ya(a,b){return a.a[(b&a.h)>>>a.c].oc(b&a.m,b)}function Za(a,b,c){a.a[(b&a.h)>>>a.c].Sc(b&a.m,c&65535,b)}function $a(a){for(var b=0,c=[],d=0;d<a.s;d++){var e=a.a[d];if(e.ma||e.Ib){c[b++]=d;var f=b++;if(e=e.save()){for(var k=0,m=0,n=[];k<e.length;){for(var q=e[k],t=k+1;t<e.length&&e[t]===q;)t++;n[m++]=t-k;n[m++]=q;k=t}n.length<e.length&&(e=n)}c[f]=e}}return c}
function ab(a,b,c){for(var d in c){var e=c[d];if(!(e[5]&&e[5]>a.b.Mb))for(var f=e[0]?e[0].bind(b):null,k=e[1]?e[1].bind(b):null,m=e[2]?e[2].bind(b):null,n=e[3]?e[3].bind(b):null,q=a,t=+d,e=e[4],J=+d;J<=t;J+=2){var Ba=J&8191;void 0!==q.la[Ba]?p("I/O address already registered: "+h(J,8,!0)):q.la[Ba]=[f,k,m,n,e||"unknown",!1]}}}function bb(a,b){a.o.push(b)}function Ta(a,b,c){p("Memory block error ("+a+": "+h(b)+","+h(c)+")");return!1}
function G(a){v.call(this,"Device",a,G);this.c={data:0,Xc:0,Na:20,ad:0};this.a={$c:0,bb:-1}}x(G);g=G.prototype;g.oa=function(a,b,c,d){this.m=b;this.b=c;this.I=d;var e=this;this.a.bb=cb(this.b,function(){e.a.pa|=128;e.a.pa&64&&(db(e.b,0,6,64),eb(e.b,e.a.bb,1E3/60))});ab(b,this,H);bb(b,this.reset.bind(this));D(this)};g.Vb=function(){var a=this.a.pa;this.a.pa&=-129;return a};g.Ac=function(a){this.a.pa=a;a&64&&eb(this.b,this.a.bb,1E3/60);this.a.pa=a&-129};
g.Xb=function(){var a=this.b;return a.D&62337|a.Ea<<5|a.Fa<<1};g.Cc=function(a){var b=this.b;a&=62337;if(b.D!=a){b.D=a;b.Ea=a>>5&3;b.Fa=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Oa!=c&&(b.Oa=c,fb(b))}gb(this)};g.Yb=function(){var a=this.b.qa;a&65280&&(a=(a<<8|a>>8)&65535);return a};g.Zb=function(){return this.b.$a};g.$b=function(){return this.b.ra};g.Dc=function(a){var b=this.b;b.ra!=a&&(b.ra=a,a&16?(b.Wa=4194303,b.Ga=3915776):(b.Wa=262143,b.Ga=253952),fb(b));gb(this)};
function gb(a){a.c.Na=a.c.Na&-8|(a.b.Oa?a.b.ra&16?1:2:4)}g.hc=function(a){return this.b.C[1][a>>1&7]};g.Lc=function(a,b){this.b.C[1][b>>1&7]=a&65295};g.fc=function(a){return this.b.C[1][(a>>1&7)+8]};g.Jc=function(a,b){this.b.C[1][(b>>1&7)+8]=a&65295};g.gc=function(a){return this.b.P[1][a>>1&7]};g.Kc=function(a,b){b=b>>1&7;this.b.P[1][b]=a;this.b.C[1][b]&=65295};g.ec=function(a){return this.b.P[1][(a>>1&7)+8]};g.Ic=function(a,b){b=(b>>1&7)+8;this.b.P[1][b]=a;this.b.C[1][b]&=65295};
g.Ub=function(a){return this.b.C[0][a>>1&7]};g.zc=function(a,b){this.b.C[0][b>>1&7]=a&65295};g.Sb=function(a){return this.b.C[0][(a>>1&7)+8]};g.xc=function(a,b){this.b.C[0][(b>>1&7)+8]=a&65295};g.Tb=function(a){return this.b.P[0][a>>1&7]};g.yc=function(a,b){b=b>>1&7;this.b.P[0][b]=a;this.b.C[0][b]&=65295};g.Rb=function(a){return this.b.P[0][(a>>1&7)+8]};g.wc=function(a,b){b=(b>>1&7)+8;this.b.P[0][b]=a;this.b.C[0][b]&=65295};g.nc=function(a){return this.b.C[3][a>>1&7]};
g.Rc=function(a,b){this.b.C[3][b>>1&7]=a&65295};g.lc=function(a){return this.b.C[3][(a>>1&7)+8]};g.Pc=function(a,b){this.b.C[3][(b>>1&7)+8]=a&65295};g.mc=function(a){return this.b.P[3][a>>1&7]};g.Qc=function(a,b){b=b>>1&7;this.b.P[3][b]=a;this.b.C[3][b]&=65295};g.kc=function(a){return this.b.P[3][(a>>1&7)+8]};g.Oc=function(a,b){b=(b>>1&7)+8;this.b.P[3][b]=a;this.b.C[3][b]&=65295};g.T=function(a){a&=7;return this.b.v&2048?this.b.va[a]:this.b.f[a]};
g.W=function(a,b){b&=7;this.b.v&2048?this.b.va[b]=a:this.b.f[b]=a};g.pb=function(){return this.b.v&49152?this.b.Z[0]:this.b.f[6]};g.Bb=function(a){this.b.v&49152?this.b.Z[0]=a:this.b.f[6]=a};g.sb=function(){return this.b.f[7]};g.Eb=function(a){this.b.f[7]=a};g.U=function(a){a&=7;return this.b.v&2048?this.b.f[a]:this.b.va[a]};g.X=function(a,b){b&=7;this.b.v&2048?this.b.f[b]=a:this.b.va[b]=a};g.qb=function(){return 1==(this.b.v&49152)>>14?this.b.f[6]:this.b.Z[1]};
g.Cb=function(a){1==(this.b.v&49152)>>14?this.b.f[6]=a:this.b.Z[1]=a};g.rb=function(){return 3==(this.b.v&49152)>>14?this.b.f[6]:this.b.Z[3]};g.Db=function(a){3==(this.b.v&49152)>>14?this.b.f[6]=a:this.b.Z[3]=a};g.Qb=function(a){return this.b.wb[a-65504>>1]};g.vc=function(a,b){this.b.wb[b-65504>>1]=a};g.tb=function(a){return 65520==a?61183:0};g.Fb=function(){};g.jc=function(){return 1};g.Nc=function(){};g.Pb=function(){return this.b.F};g.uc=function(){this.b.F=0};g.Wb=function(){return this.b.vb};
g.Bc=function(a,b){b&1||(a&=255);this.b.vb=a};g.ac=function(){return this.b.ab};g.Ec=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.ab=a;b.j|=2};g.ic=function(){return this.b.sa&65280};g.Mc=function(a){this.b.sa=a|255};g.bc=function(){return hb(this.b)};g.Fc=function(a){ib(this.b,a&-1809|hb(this.b)&1808);this.b.j|=128};g.reset=function(){this.c.Na=this.c.Na&-120|20;this.a.pa=0};
var I={},H=(I[62592]=[null,null,G.prototype.hc,G.prototype.Lc,"SISDR"],I[62608]=[null,null,G.prototype.fc,G.prototype.Jc,"SDSDR"],I[62624]=[null,null,G.prototype.gc,G.prototype.Kc,"SISAR"],I[62640]=[null,null,G.prototype.ec,G.prototype.Ic,"SDSAR"],I[62656]=[null,null,G.prototype.Ub,G.prototype.zc,"KISDR"],I[62672]=[null,null,G.prototype.Sb,G.prototype.xc,"KDSDR"],I[62688]=[null,null,G.prototype.Tb,G.prototype.yc,"KISAR"],I[62704]=[null,null,G.prototype.Rb,G.prototype.wc,"KDSAR"],I[62798]=[null,null,
G.prototype.$b,G.prototype.Dc,"MMR3"],I[65382]=[null,null,G.prototype.Vb,G.prototype.Ac,"LKS"],I[65402]=[null,null,G.prototype.Xb,G.prototype.Cc,"MMR0"],I[65404]=[null,null,G.prototype.Yb,null,"MMR1"],I[65406]=[null,null,G.prototype.Zb,null,"MMR2"],I[65408]=[null,null,G.prototype.nc,G.prototype.Rc,"UISDR"],I[65424]=[null,null,G.prototype.lc,G.prototype.Pc,"UDSDR"],I[65440]=[null,null,G.prototype.mc,G.prototype.Qc,"UISAR"],I[65456]=[null,null,G.prototype.kc,G.prototype.Oc,"UDSAR"],I[65472]=[G.prototype.T,
G.prototype.W,G.prototype.T,G.prototype.W,"R0SET0"],I[65473]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R1SET0"],I[65474]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R2SET0"],I[65475]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R3SET0"],I[65476]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R4SET0"],I[65477]=[G.prototype.T,G.prototype.W,G.prototype.T,G.prototype.W,"R5SET0"],I[65478]=[G.prototype.pb,G.prototype.Bb,G.prototype.pb,G.prototype.Bb,
"R6KERNEL"],I[65479]=[G.prototype.sb,G.prototype.Eb,G.prototype.sb,G.prototype.Eb,"R7KERNEL"],I[65480]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R0SET1"],I[65481]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R1SET1"],I[65482]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R2SET1"],I[65483]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R3SET1"],I[65484]=[G.prototype.U,G.prototype.X,G.prototype.U,G.prototype.X,"R4SET1"],I[65485]=[G.prototype.U,G.prototype.X,
G.prototype.U,G.prototype.X,"R5SET1"],I[65486]=[G.prototype.qb,G.prototype.Cb,G.prototype.qb,G.prototype.Cb,"R6SUPER"],I[65487]=[G.prototype.rb,G.prototype.Db,G.prototype.rb,G.prototype.Db,"R6USER"],I[65504]=[null,null,G.prototype.Qb,G.prototype.vc,"CTRL",1170],I[65520]=[null,null,G.prototype.tb,G.prototype.Fb,"LSIZE",1170],I[65522]=[null,null,G.prototype.tb,G.prototype.Fb,"HSIZE",1170],I[65524]=[null,null,G.prototype.jc,G.prototype.Nc,"SYSID",1170],I[65526]=[null,null,G.prototype.Pb,G.prototype.uc,
"CPUERR",1170],I[65528]=[null,null,G.prototype.Wb,G.prototype.Bc,"MB",1170],I[65530]=[null,null,G.prototype.ac,G.prototype.Ec,"PIR"],I[65532]=[null,null,G.prototype.ic,G.prototype.Mc,"SL"],I[65534]=[null,null,G.prototype.bc,G.prototype.Fc,"PSW"],I);H[62594]=H[62592];H[62596]=H[62592];H[62598]=H[62592];H[62600]=H[62592];H[62602]=H[62592];H[62604]=H[62592];H[62606]=H[62592];H[62610]=H[62608];H[62612]=H[62608];H[62614]=H[62608];H[62616]=H[62608];H[62618]=H[62608];H[62620]=H[62608];H[62622]=H[62608];
H[62626]=H[62624];H[62628]=H[62624];H[62630]=H[62624];H[62632]=H[62624];H[62634]=H[62624];H[62636]=H[62624];H[62638]=H[62624];H[62642]=H[62640];H[62644]=H[62640];H[62646]=H[62640];H[62648]=H[62640];H[62650]=H[62640];H[62652]=H[62640];H[62654]=H[62640];H[62658]=H[62656];H[62660]=H[62656];H[62662]=H[62656];H[62664]=H[62656];H[62666]=H[62656];H[62668]=H[62656];H[62670]=H[62656];H[62674]=H[62672];H[62676]=H[62672];H[62678]=H[62672];H[62680]=H[62672];H[62682]=H[62672];H[62684]=H[62672];H[62686]=H[62672];
H[62690]=H[62688];H[62692]=H[62688];H[62694]=H[62688];H[62696]=H[62688];H[62698]=H[62688];H[62700]=H[62688];H[62702]=H[62688];H[62706]=H[62704];H[62708]=H[62704];H[62710]=H[62704];H[62712]=H[62704];H[62714]=H[62704];H[62716]=H[62704];H[62718]=H[62704];H[65410]=H[65408];H[65412]=H[65408];H[65414]=H[65408];H[65416]=H[65408];H[65418]=H[65408];H[65420]=H[65408];H[65422]=H[65408];H[65426]=H[65424];H[65428]=H[65424];H[65430]=H[65424];H[65432]=H[65424];H[65434]=H[65424];H[65436]=H[65424];H[65438]=H[65424];
H[65442]=H[65440];H[65444]=H[65440];H[65446]=H[65440];H[65448]=H[65440];H[65450]=H[65440];H[65452]=H[65440];H[65454]=H[65440];H[65458]=H[65456];H[65460]=H[65456];H[65462]=H[65456];H[65464]=H[65456];H[65466]=H[65456];H[65468]=H[65456];H[65470]=H[65456];H[65506]=H[65504];H[65508]=H[65504];H[65510]=H[65504];H[65512]=H[65504];H[65514]=H[65504];H[65516]=H[65504];H[65518]=H[65504];
u(function(){for(var a=C(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=A(c);switch(d.name){case "default":d=new G(d),B(d,c)}}});var ib;if(Ja){var jb=new ArrayBuffer(2);(new DataView(jb)).setUint16(0,256,!0);ib=256===(new Uint16Array(jb))[0]}else ib=!1;var kb=ib;
function E(a,b,c,d,e,f){this.b=a;this.id=lb+=2;this.a=null;this.Aa=b;this.Qa=c;this.size=d||0;this.type=e||mb;this.h=e==nb;this.controller=null;Na(this);this.ma=this.Ib=!1;if(d)if(f)this.controller=f,this.a=null,ob(this,f.Ba);else if(Ja)this.g=new ArrayBuffer(d),this.o=new DataView(this.g,0,d),this.c=new Uint8Array(this.g,0,d),this.m=new Uint16Array(this.g,0,d>>1),this.a=new Int32Array(this.g,0,d>>2),ob(this,kb?pb:qb);else{this.a=Array(d>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;ob(this,rb)}else ob(this)}
var mb=0,nb=2,Ta=4,Va=["NONE","RAM","ROM","VID","H/W"],lb=0;
E.prototype={constructor:E,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ja)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.o.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Ja)for(b=0;b<a.length;b++)this.o.setInt32(b<<2,a[b],!0);else this.a=a;return this.ma=!0}return!1},s:function(){return 255},A:function(){},u:function(a,b){return this.$a(a++,b++)|this.$a(a,b)<<8},B:function(a,b,c){this.Ra(a++,
b&255,c++);this.Ra(a,b>>8,c)},N:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},aa:function(a){a&1&&F(this.b,4);var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},ea:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.ma=!0},ta:function(a,b){a&1&&F(this.b,4);var c=a>>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<<a)|b<<a:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|b>>8);this.ma=!0},G:function(a,b){return this.H(a,
b)},S:function(a,b){return this.Y(a,b)},ca:function(a,b,c){this.h||this.Bb(a,b,c)},ja:function(a,b,c){this.h||this.ka(a,b,c)},D:function(a){return this.c[a]},J:function(a){return this.c[a]},O:function(a){a&1&&F(this.b,4);return this.o.getUint16(a,!0)},$:function(a){a&1&&F(this.b,4);return a&1?this.c[a]|this.c[a+1]<<8:this.m[a>>1]},ba:function(a,b){this.c[a]=b;this.ma=!0},da:function(a,b){this.c[a]=b;this.ma=!0},ia:function(a,b){a&1&&F(this.b,4);this.o.setUint16(a,b,!0);this.ma=!0},sa:function(a,b){a&
1&&F(this.b,4);a&1?(this.c[a]=b,this.c[a+1]=b>>8):this.m[a>>1]=b;this.ma=!0}};function Na(a,b,c){a.I=b;a.w=a.l=0;c&&((a.w=c.w)&&sb(a,tb,!1),(a.l=c.l)&&ub(a,tb,!1))}function ub(a,b,c){c&&a.l||(a.Ra=!a.h&&b[1]||a.A,a.Sc=!a.h&&b[3]||a.B);if(c||void 0===c)a.Bb=b[1]||a.A,a.ka=b[3]||a.B}function sb(a,b,c){c&&a.w||(a.$a=b[0]||a.s,a.nc=b[2]||a.u);if(c||void 0===c)a.H=b[0]||a.s,a.Y=b[2]||a.u}function ob(a,b){b||(b=vb);sb(a,b,void 0);ub(a,b,void 0)}
var vb=[],rb=[E.prototype.N,E.prototype.ea,E.prototype.aa,E.prototype.ta],tb=[E.prototype.G,E.prototype.ca,E.prototype.S,E.prototype.ja];if(Ja)var qb=[E.prototype.D,E.prototype.ba,E.prototype.O,E.prototype.ia],pb=[E.prototype.J,E.prototype.da,E.prototype.$,E.prototype.sa];
function wb(a,b){v.call(this,"CPU",a,wb);var c=a.multiplier||1;this.La=a.cycles||b;this.da=c;this.Wa=Math.round(this.La/1E4)/100;this.ia=this.Wa*this.da;this.i.V=!1;this.i.yb=!1;this.i.Ca=a.autoStart;this.i.fb=!1;this.i.Ma=!1;this.Ja=this.ja=0;this.Ka=a.csStart;this.ta=a.csInterval;this.xa=a.csStop;this.J=[];this.nb=this.rc.bind(this);D(this)}x(wb);var xb=["power","reset"];g=wb.prototype;
g.oa=function(a,b,c,d){this.A=a;this.o=b;this.I=d;for(b=0;b<xb.length;b++)(c=this.w[xb[b]])&&this.A.R(null,xb[b],c);this.sa=null;a=yb(a,"autoStart");null!=a&&(this.i.Ca="true"==a?!0:"false"==a?!1:!!a);D(this)};g.reset=function(){};g.save=function(){return null};g.restore=function(){return!1};g.ha=function(a,b){if(!b){if(a&&this.restore){zb(this);if(!this.restore(a))return!1;Ab(this)}else this.reset();this.M("No debugger detected")}Bb(this);return!0};g.ga=function(a){return a?this.save():!0};
g.Ca=function(){return this.i.Ca||void 0===this.w.run?(Cb(this),!0):!1};g.hb=function(){return 0};function Ab(a){void 0===a.Ka&&(a.Ka=0);void 0===a.ta&&(a.ta=-1);void 0===a.xa&&(a.xa=-1);a.i.Ma=0<=a.Ka&&0<a.ta;a.i.Ma&&(a.Ja=0,a.ja=a.Ka-a.ea)}
function K(a,b,c,d){if(a.w[b]){void 0===c&&(a.i.error=!0,a.K("Value for "+b+" is invalid"),L(a));var e=a.I&&a.I.c||8;if(!a.i.V||a.i.fb)if(8==e){e="";d?11<d&&(d=11):d=c&-65536?11:6;if(null==c||isNaN(c))for(;0<d--;)e="?"+e;else for(;0<d--;)e=String.fromCharCode((c&7)+48)+e,c>>=3;d=""+e}else d=h(c,d);else d="--------".substr(0,d||4);a.w[b].textContent!=d&&(a.w[b].textContent=d)}}
g.R=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.w[b]=c;a=!0;break;case "run":this.w[b]=c;c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.i.L)a=!0;else{var b=null,c,m=y(a.id);for(c=0;c<m.length&&(b=m[c],b===a||b.i.ready);c++);if(c==m.length)for(c=0;c<m.length&&(b=m[c],b===a||b.i.L);c++);c==m.length&&(b=a);p("The "+b.type+" component ("+b.id+") is not "+(b.i.ready?"powered yet":"ready yet"+(b.Oa?" (waiting for notification)":""))+".");a=!1}a&&(d.i.V?L(d):Cb(d))};a=!0;break;
case "speed":this.w[b]=c;a=!0;break;case "setSpeed":this.w[b]=c,c.onclick=function(){Db(d,d.da<<1)},c.textContent=this.ia.toFixed(2)+"Mhz",a=!0}return a};function Eb(a,b,c){a.ea+=b;c&&(a.ca=a.a=0)}function Fb(a,b){var c=1;b&&1<a.da&&a.aa&&(c=a.aa/a.Wa);a.lb=Math.round(1E3/30);a.Na=Math.floor(a.La/30*c);b||(a.ya=a.Na);a.Ya=0}function Gb(a){return a.ea+a.Y+a.ca-a.a}function zb(a){a.aa=0;a.mb=0;a.ea=a.Y=a.ca=a.a=0;Ab(a);Db(a,1)}
function Db(a,b){if(void 0!==b&&(.8>a.aa/a.ia&&(b=1),a.da=b,b=a.Wa*a.da,a.ia!=b)){a.ia=b;b=a.ia.toFixed(2)+"Mhz";var c=a.w.setSpeed;c&&(c.textContent=b);a.M("target speed: "+b)}Eb(a,a.Y);a.Y=0;a.S=ja();a.ba=0;Fb(a)}function bb(a,b){var c=a.J.length;a.J.push([-1,b]);return c}function db(a,b,c){0<=b&&b<a.J.length&&0>a.J[b][0]&&(c*=a.La*a.da/1E3,a.J[b][0]=c)}
g.rc=function(){if(this.i.V){this.Ya>=this.La&&Fb(this,!0);this.za=0;this.Ea=ja();if(this.ba){var a=this.Ea-this.ba;a>this.lb&&(this.S+=a,this.S>this.Ea&&(this.S=this.Ea))}try{do{for(var b,c=this.i.Ma?1:this.Na,d=this.J.length-1;0<=d;d--){var e=this.J[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.zb(b)}catch(q){if("number"!=typeof q)throw q;}for(var f=this.ca-this.a,a=f,k=this.J.length-1;0<=k;k--){var m=this.J[k];0>m[0]||(m[0]-=a,0>=m[0]&&(m[0]=-1,m[1]()))}this.za+=f;this.Y+=f;Eb(this,0,!0);a=f;if(this.i.Ma){var n=
!1;this.Ja=this.Ja+this.hb()|0;this.ja-=a;0>=this.ja&&(this.ja+=this.ta,n=!0);0<=this.xa&&this.xa<=Gb(this)&&(this.ta=this.xa=-1,Ab(this),L(this),n=!0);n&&this.M(Gb(this)+" cycles: checksum="+h(this.Ja))}this.ya-=f;if(0>=this.ya){this.ya+=this.Na;15<=++this.mb&&(this.A&&this.A.wa(),this.mb=0);break}}while(this.i.V)}catch(q){L(this);Bb(this);this.A&&this.A.stop(ja(),Gb(this));b=q.stack||q.message;this.i.error=!0;this.K(b);return}if(this.i.V){b=setTimeout;c=this.nb;this.ba=ja();d=this.lb;this.za&&(d=
Math.round(d*this.za/this.Na));d-=this.ba-this.Ea;if(e=this.ba-this.S)this.aa=Math.round(this.Y/(10*e))/100,864E5<=e&&(this.ea=0,Db(this));if(0>d||this.aa<this.ia)-1E3>d&&(this.S-=d),d=0;this.Ya+=this.za;this.ba+=d;b(c,d)}}};function Cb(a){var b;a.i.error?(a.M(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.i.V)a.M(a.toString()+" busy");else{Db(a);a.i.V=!0;a.i.yb=!0;a.sa&&a.sa.start();if(b=a.w.run)b.textContent="Halt";a.A&&a.A.start(a.S,Gb(a));Bb(a,!0);setTimeout(a.nb,0)}}g.zb=function(){return 0};
function L(a){if(a.i.V){a.ca-=a.a;a.a=0;Eb(a,a.Y);a.Y=0;a.i.V=!1;a.sa&&a.sa.stop();var b=a.w.run;b&&(b.textContent="Run");a.A&&a.A.stop(ja(),Gb(a));Bb(a)}a.i.complete=void 0}function Bb(a,b){a.A&&a.A.wa(b)}
function Hb(a){this.Mb=+a.model||1170;this.sc=a.resetAddr||0;wb.call(this,a,6666667);this.jb=0;this.decode=Ib.bind(this);this.m=65536;this.h=32768;this.l=65535;this.s=32768;this.v=15;this.f=[0,0,0,0,0,0,0,this.sc];this.va=[0,0,0,0,0,0];this.Z=[0,0,0,0];this.Ha=this.B=0;this.Lb=[4,2,0,1];this.C=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.P=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.tc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.xb=[0,0,0,0,0,0,0,0];this.g=this.c=this.Ua=this.G=this.H=this.j=this.wb=0;this.ka=-1;Jb(this);this.i.complete=this.i.Hb=!1}x(Hb,wb);g=Hb.prototype;g.reset=function(){this.i.V&&L(this);Jb(this);zb(this);this.i.error=!1;this.parent.reset.call(this)};
function Jb(a){a.ra=255;a.F=0;a.cb=0;a.D=0;a.qa=0;a.bb=0;a.ua=0;a.Za=0;a.Ga=0;a.Xa=262143;a.Ia=253952;a.u=[];a.j|=2;eb(a)}function eb(a){a.Za?(a.$=65536,a.N=a.Kb,a.O=a.vb,a.ob=a.Uc):(a.$=0,a.N=a.Jb,a.O=a.oc,a.ob=a.Tc)}g.hb=function(){return 0};g.save=function(){var a=new M(this);a.set(0,[]);a.set(1,[this.ea,this.da]);a.set(2,Za(this.o));return a.data()};
g.restore=function(a){var b=a[1];this.ea=b[1];Db(this,b[3]);a:{b=this.o;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.A){for(var f=0,k=Array(b.A),m=0;m<e.length-1;)for(var n=e[m++],q=e[m++];n--;)k[f++]=q;e=k}f=b.a[d];if(!f||!f.restore(e)){p("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
g.R=function(a,b,c){switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":this.w[b]=c;this.jb++;a=!0;break;default:a=this.parent.R.call(this,a,b,c)}return a};
g.wa=function(a){if(this.jb&&(a||!this.i.V||this.i.fb)){for(a=0;a<this.f.length;a++)K(this,"R"+a,this.f[a]);a=gb(this);K(this,"PS",a);K(this,"NF",a&8?1:0,1);K(this,"ZF",a&4?1:0,1);K(this,"VF",a&2?1:0,1);K(this,"CF",a&1?1:0,1)}if(a=this.w.speed)a.textContent=this.i.V&&this.aa?this.aa.toFixed(2)+"Mhz":"Stopped"};function N(a){return a.m&65536?1:0}g.na=function(){return this.s&32768?8:0};function Kb(a){var b=a.O(a.f[7]);a.f[7]=a.f[7]+2&65535;return b}
function cb(a,b,c,d,e){for(var f=a.u.length;0<f--;)if(a.u[f].Ab===d){0<f&&(a.u[f-1].fa+=a.u[f].fa);a.u.splice(f,1);break}if(0<=b){for(f=a.u.length;0<f--;){if(a.u[f].fa>b){a.u[f].fa-=b;break}b-=a.u[f].fa}a.u.splice(f+1,0,{fa:b,pb:c<<5&224,Ab:d,Sa:e})}a.j|=2}function gb(a){return a.v=a.v&63728|a.na()|(a.l&65535?0:4)|(a.h&32768?2:0)|N(a)}
function hb(a,b){a.s=b<<12;a.l=~b&4;a.h=b<<14;a.m=b<<16;if((b^a.v)&2048)for(var c=a.va.length;0<=--c;){var d=a.f[c];a.f[c]=a.va[c];a.va[c]=d}a.B=b>>14&3;c=a.v>>14&3;a.B!=c&&(a.Z[c]=a.f[6],a.f[6]=a.Z[a.B]);a.j|=2;a.v=b}function O(a,b){a.j&128||(a.s=a.l=b,a.h=0)}function P(a,b,c){a.j&128||(a.s=a.l=a.m=b,a.h=c||0)}function Lb(a,b,c,d){a.j&128||(a.s=a.l=a.m=b,a.h=(c^b)&(d^b))}function Q(a,b){a.j&128||(a.s=a.l=a.m=b,a.h=a.s^a.m>>1)}function Mb(a,b,c,d){a.j&128||(a.s=a.l=a.m=b,a.h=(c^d)&(d^b))}
function F(a,b){var c=!1;0>a.ka?a.ka=gb(a):a.B||(b=4,c=!0);a.D&57344||(a.qa=63222,a.bb=b);a.B=0;var d=a.O(b|a.$),e=a.O(b+2&65535|a.$);hb(a,e&-12289|a.ka>>2&12288);c&&(a.F|=4,a.f[6]=4);Nb(a,a.ka);Nb(a,a.f[7]);a.f[7]=d&65535;a.j&=-113;a.ka=-1;throw b;}function Ob(a){var b=Pb(a),c=Pb(a)&-1793;a.v&49152&&(c=c&-225|a.v&63712);a.f[7]=b&65535;hb(a,c);a.j&=-17}
function Qb(a,b,c){var d,e,f,k=0;d=b>>13;a.ua&a.Lb[a.B]||(d&=7);e=a.C[a.B][d];f=(a.P[a.B][d]<<6)+(b&8191)&a.Xa;if(f<a.Ia)f&1&&!(c&1)&&(a.F|=64,F(a,4));else if(a.ua&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var m=f>>13&31;31>m?a.ua&32&&(f=a.tc[m]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Ia&&4186112>f&&(a.F|=32,F(a,4))}switch(e&7){case 1:k=4096;case 2:e|=128;c&4&&(k=8192);break;case 4:k=4096;case 5:c&4&&(k=4096);case 6:e|=c&4?192:128;break;
default:k=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(k|=16384):(b&8128)>(e>>2&8128)&&(k|=16384));a.C[a.B][d]=e;if(4194170!==f||a.B)a.Ga=a.B,a.Ha=d;k&&(k&57344&&(0<=a.ka&&(k|=128),a.D&57344||(a.D=a.D|k|a.Ga<<5|a.Ha<<1),F(a,168)),a.D&61440||!(4191360>f||4194239<f)||(a.D|=4096,a.D&512&&(a.j|=32)));return f}function Pb(a){var b=a.O(a.f[6]|a.$);a.f[6]=a.f[6]+2&65535;return b}
function Nb(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.D&57344||(a.qa=a.qa<<8|246);!a.B&&c<=a.ra&&4<c&&(c<=a.ra-32?(a.F|=4,a.f[6]=4,F(a,4)):(a.F|=8,a.j|=4));a.ob(c,b)}
function Rb(a,b,c,d){var e,f,k=d&8?0:a.$;switch(b){case 0:return F(a,4),0;case 1:return 6===c&&!a.B&&d&4&&(a.f[6]<=a.ra||65534<=a.f[6])&&(a.f[6]<=a.ra-32||65534<=a.f[6]?(a.F|=4,a.f[6]=4,F(a,4)):(a.F|=8,a.j|=64)),a.a-=3,7===c?a.f[c]:a.f[c]|k;case 2:f=2;e=a.f[c];7!==c&&(e|=k,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.f[c];7!==c&&(e|=k);e=a.O(e);e|=k;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.f[c]+f&65535;7!==c&&(e|=k);a.a-=4;break;case 5:f=-2;e=a.f[c]-2&65535;7!==c&&(e|=k);e=a.O(e)|k;a.a-=8;break;
case 6:return e=Kb(a),e=e+a.f[c]&65535|k,a.a-=6,e;case 7:return e=Kb(a),e=e+a.f[c]&65535,e=a.O(e|a.$)|k,a.a-=10,e}a.f[c]=a.f[c]+f&65535;!k||a.D&57344||(a.qa=a.qa<<8|f<<3&248|c);6==c&&!a.B&&d&4&&0>=f&&(a.f[6]<=a.ra||65534<=a.f[6])&&(a.f[6]<=a.ra-32?(a.F|=4,a.f[6]=4,F(a,4)):(a.F|=8,a.j|=64));return e}g.Jb=function(a,b,c){return Rb(this,a,b,c)};g.Kb=function(a,b,c){return Qb(this,Rb(this,a,b,c),c)};g.oc=function(a){return Xa(this.o,a)};g.vb=function(a){return Xa(this.o,Qb(this,a,2))};
g.Tc=function(a,b){Ya(this.o,a,b&65535)};g.Uc=function(a,b){Ya(this.o,Qb(this,a,4),b)};function Sb(a,b,c){var d=a.c=b&7;(b=a.g=(b&56)>>3)?(d=Rb(a,b,d,2),c&65536||61440!==(a.v&61440)&&(d&=65535),a.B=a.v>>12&3,c=a.O(d|c&a.$),a.B=a.v>>14&3):c=6!=d||(a.v>>2&12288)===(a.v&12288)?a.f[d]:a.Z[a.v>>12&3];return c}
function Tb(a,b,c,d){a.D&57344||(a.qa=22);var e=a.c=b&7;(b=a.g=(b&56)>>3)?(e=Rb(a,b,e,4),c&65536||(e&=65535),a.B=a.v>>12&3,e=Qb(a,e|c&65536,4),a.B=a.v>>14&3,Ya(a.o,e,d)):6!=e||(a.v>>2&12288)===(a.v&12288)?a.f[e]=d:a.Z[a.v>>12&3]=d}function Ub(a,b){b>>=6;var c=a.H=b&7;(b=a.G=(b&56)>>3)?(c=a.N(b,c,3),a=Wa(a.o,c)):a=a.f[c]&255;return a}function R(a,b){b>>=6;var c=a.H=b&7;return(b=a.G=(b&56)>>3)?Xa(a.o,a.N(b,c,2)):a.f[c]}function Vb(a,b){var c=a.c=b&7;b=a.g=(b&56)>>3;return Rb(a,b,c,8)}
function Wb(a,b){var c=a.c=b&7;(b=a.g=(b&56)>>3)?(c=a.N(b,c,3),a=Wa(a.o,c)):a=a.f[c]&255;return a}function S(a,b){var c=a.c=b&7;return(b=a.g=(b&56)>>3)?Xa(a.o,a.N(b,c,2)):a.f[c]}function T(a,b,c,d){var e=a.c=b&7;(b=a.g=(b&56)>>3)?(e=a.Ua=a.N(b,e,7),c=d.call(a,c,Wa(a.o,e)),e&1&&a.a--,a=a.o,a.a[(e&a.h)>>>a.c].Ra(e&a.o,c&255,e)):a.f[e]=a.f[e]&65280|d.call(a,c,a.f[e])}function U(a,b,c,d){var e=a.c=b&7;(b=a.g=(b&56)>>3)?(e=a.N(b,e,6),Ya(a.o,e,d.call(a,c,Xa(a.o,e)))):a.f[e]=d.call(a,c,a.f[e])}
function Xb(a,b,c,d){var e=a.c=b&7;(b=a.g=(b&56)>>3)?(d=a.N(b,e,5),d&1&&a.a--,a=a.o,a.a[(d&a.h)>>>a.c].Ra(d&a.o,c&255,d)):a.f[e]=c?d&1?c<<24>>24&65535:a.f[e]&-256|c&255:a.f[e]&-256;return c}function Yb(a,b,c){var d=a.c=b&7;(b=a.g=(b&56)>>3)?Ya(a.o,a.N(b,d,4),c):a.f[d]=c&65535;return c}function V(a,b,c){c&&(a.f[7]=a.f[7]+(b<<24>>23)&65535,a.a-=2);a.a-=3}
g.zb=function(a){this.i.complete=!0;this.i.Hb=!1;this.i.yb=!1;this.ca=this.a=a;do{if(this.j&&(this.j&112&&(this.j&32?F(this,168):this.j&64?F(this,4):this.j&16&&F(this,12),this.j&=-113),this.j&7))if(this.j&2){this.j&=-3;a=null;for(var b=this.cb&224,c=this.u.length;0<=--c;){if(0<this.u[c].fa){this.u[c].fa--;this.j|=2;break}if(this.u[c].Sa){if(!this.u[c].Sa()){this.u.splice(c,1);continue}this.u[c].Sa=null}this.u[c].pb>b&&(b=this.u[c].pb,a=this.u[c],this.u.splice(c,1))}b>(this.v&224)&&(this.j&4&&(this.f[7]=
this.f[7]+2&65535,this.j&=-5),a?F(this,a.Ab):F(this,160))}else this.j&1&&this.j++;this.D&57344||(this.qa=0,this.bb=this.f[7]);this.j=this.j&7|this.v&16;this.decode(Kb(this))}while(0<this.a);return this.i.complete?this.ca-this.a:void 0===this.i.complete?0:-1};u(function(){for(var a=C(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Hb(d);B(d,c)}});function Zb(a,b){var c=b+a;Lb(this,c,a,b);return c&65535}function $b(a,b){var c=b+a;Lb(this,c<<8,a<<8,b<<8);return c&255}
function ac(a,b){a=b<<1;Q(this,a);return a&65535}function bc(a,b){a=b<<1;Q(this,a<<8);return a&255}function cc(a,b){a=b&32768|b>>1|b<<16;Q(this,a);return a&65535}function dc(a,b){a=b&2048|b>>1|b<<8;Q(this,a<<8);return a&255}function ec(a,b){a=b&~a;O(this,a);return a}function fc(a,b){a=b&~a;O(this,a<<8);return a}function gc(a,b){a|=b;O(this,a);return a}function hc(a,b){a|=b;O(this,a<<8);return a}function ic(a,b){a=~b|65536;P(this,a);return a&65535}
function jc(a,b){a=~b|256;P(this,a<<8);return a&255}function kc(a,b){a=b-a;this.j&128||(this.s=this.l=a,this.h=b&(b^a));return a&65535}function lc(a,b){a=b-a;var c=a<<8;b<<=8;this.j&128||(this.s=this.l=c,this.h=b&(b^c));return a&255}function mc(a,b){a=b+a;this.j&128||(this.s=this.l=a,this.h=a&(b^a));return a&65535}function nc(a,b){a=b+a;var c=a<<8;this.j&128||(this.s=this.l=c,this.h=c&(b<<8^c));return a&255}function oc(a,b){a=-b;P(this,a,a&b&32768);return a&65535}
function pc(a,b){a=-b;P(this,a<<8,(a&b&128)<<8);return a&255}function qc(a,b){a=b<<1|this.m>>16&1;Q(this,a);return a&65535}function rc(a,b){a=b<<1|this.m>>16&1;Q(this,a<<8);return a&255}function sc(a,b){a=(this.m&65536|b)>>1|b<<16;Q(this,a);return a&65535}function tc(a,b){a=((this.m&65536)>>8|b)>>1|b<<8;Q(this,a<<8);return a&255}function uc(a,b){var c=b-a;Mb(this,c,a,b);return c&65535}function vc(a,b){var c=b-a;Mb(this,c<<8,a<<8,b<<8);return c&255}
function wc(a,b){this.j&128||(this.s=this.l=b&65280,this.h=this.m=0);return(b<<8|b>>8)&65535}function xc(a,b){a^=b;O(this,a);return a&65535}function yc(a){var b=S(this,a);a=a>>6&7;var c=this.f[a];c&32768&&(c|=4294901760);this.m=this.h=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.m=c<<17-b,c>>=b;else if(b)if(16<b)this.h=c,c=0;else{this.m=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.h=32768)}this.f[a]=c&65535;this.s=this.l=c;this.a-=(this.g?6:7)+b}
function zc(a){var b=S(this,a);a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.m=this.h=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.m=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.m=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.h=32768)):d=c;this.f[a]=d>>16&65535;this.f[a|1]=d&65535;this.s=d>>16;this.l=d>>16|d;this.a-=(this.g?6:7)+b}function W(a){a&1&&(this.m=0);a&2&&(this.h=0);a&4&&(this.l=1);a&8&&(this.s=0);this.a-=5}
function Ac(a){var b=S(this,a);if(b){a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.m=this.h=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.f[a]=d&65535,this.f[a|1]=c-d*b&65535,this.l=d>>16|d,this.s=d>>16):(this.h=32768,this.l=d>>15|d,this.s=c>>16,-1===b&&65534===this.f[a]&&(this.f[a]=this.f[a|1]=1));this.a-=53}else this.l=this.s=0,this.h=32768,this.m=65536,this.a-=7}var Bc=[0,7,7,10,7,11,9,13];function Cc(a){var b=this.a;a=Vb(this,a);this.f[7]=a&65535;this.a=b-Bc[this.g]}
var Dc=[0,14,14,17,14,18,16,20];function Ec(a){var b=this.a,c=Vb(this,a);a=a>>6&7;Nb(this,this.f[a]);this.f[a]=this.f[7];this.f[7]=c&65535;this.a=b-Dc[this.g]}var Fc=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],Gc=[7,13,13,17,14,18,17,21];function Hc(a){var b=S(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.f[a];c&32768&&(c|=-65536);b=~~(b*c);this.f[a]=b>>16&65535;this.f[a|1]=b&65535;this.j&128||(this.s=b>>16,this.l=this.s|b,this.h=0,this.m=-32768>b||32767<b?65536:0);this.a-=23}
function Ic(){this.a-=5}function X(a){a&1&&(this.m=65536);a&2&&(this.h=32768);a&4&&(this.l=0);a&8&&(this.s=32768);this.a-=5}function Jc(a){var b=(a&448)>>6;if(this.f[b]=this.f[b]-1&65535)this.f[7]=this.f[7]-((a&63)<<1)&65535,this.a+=1;this.a-=6}function Kc(a){U(this,a,0,wc);this.a-=this.g?9:3+(7==this.c?2:0)}function Lc(a){U(this,a,R(this,a),xc);this.a-=this.g?9:3+(7==this.c?2:0)}function Y(){F(this,8)}function Ib(a){Mc[a>>12].call(this,a)}
var Mc=[function(a){Nc[a>>8&15].call(this,a)},function(a){var b=R(this,a),c=this.a;O(this,Yb(this,a,b));this.a=c-Fc[(this.G?8:0)+this.g]+(7!=this.c||this.g?0:2)},function(a){var b=R(this,a);a=S(this,a);Mb(this,b-a,a,b);this.a-=this.g?4+(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){O(this,R(this,a)&S(this,a));this.a-=this.g?4+(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){U(this,a,R(this,a),ec);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?
2:0)},function(a){U(this,a,R(this,a),gc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){U(this,a,R(this,a),Zb);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){Oc[a>>8&15].call(this,a)},function(a){Pc[a>>8&15].call(this,a)},function(a){var b=Ub(this,a);O(this,Xb(this,a,b,1)<<8);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){var b=Ub(this,a)<<8;a=Wb(this,a)<<8;Mb(this,b-a,a,b);this.a-=this.g?4+
(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){O(this,(Ub(this,a)&Wb(this,a))<<8);this.a-=this.g?4+(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){T(this,a,Ub(this,a),fc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){T(this,a,Ub(this,a),hc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){U(this,a,R(this,a),uc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},Y],Nc=[function(a){Qc[a>>
4&15].call(this,a)},function(a){V(this,a,!0)},function(a){V(this,a,!!(this.l&65535))},function(a){V(this,a,this.l&65535?0:4)},function(a){V(this,a,!this.na()==!(this.h&32768))},function(a){V(this,a,!this.na()!=!(this.h&32768))},function(a){V(this,a,!!(this.l&65535)&&!this.na()==!(this.h&32768))},function(a){V(this,a,(this.l&65535?0:4)||!this.na()!=!(this.h&32768))},Ec,Ec,function(a){Rc[a>>6&3].call(this,a)},function(a){Sc[a>>6&3].call(this,a)},function(a){Tc[a>>6&3].call(this,a)},function(a){Uc[a>>
6&3].call(this,a)},Y,Y],Rc=[function(a){P(this,Yb(this,a,0));this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,ic);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,1,mc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,1,kc);this.a-=this.g?9:3+(7==this.c?2:0)}],Sc=[function(a){U(this,a,0,oc);this.a-=this.g?11:6},function(a){U(this,a,N(this)?1:0,Zb);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,N(this)?1:0,uc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){a=S(this,
a);P(this,a);this.a-=this.g?4:3+(7==this.c?2:0)}],Tc=[function(a){U(this,a,0,sc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,qc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,cc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,ac);this.a-=this.g?9:3+(7==this.c?2:0)}],Uc=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=this.vb(a|65536);this.f[7]=this.f[5]&65535;this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=Sb(this,a,0);Nb(this,a);O(this,a);this.a-=
11},function(a){var b=Pb(this),c=this.a;Tb(this,a,0,b);O(this,b);this.a=c-Gc[this.g]},function(a){O(this,Yb(this,a,this.na?65535:0));this.a-=this.g?9:3+(7==this.c?2:0)}],Qc=[function(a){Vc[a&15].call(this,a)},Y,Y,Y,Cc,Cc,Cc,Cc,function(a){if(a&8)F(this,8);else{var b=Pb(this);a&=7;this.f[7]=this.f[a]&65535;this.f[a]=b;this.a-=9}},function(a){a&8?(this.v&49152||(this.v=this.v&-2017|(a&7)<<5,this.j|=1),this.a-=5):F(this,8)},function(a){Wc[a&15].call(this,a)},function(a){Xc[a&15].call(this,a)},Kc,Kc,
Kc,Kc],Vc=[function(){this.v&49152?(this.F|=128,F(this,4)):L(this);this.a-=7},function(){this.j|=4;this.f[7]=this.f[7]+-2&65535;this.a-=3},function(){Ob(this);this.j|=this.v&16;this.a-=13},function(){F(this,12);this.a-=5},function(){F(this,16);this.a-=25},function(){this.v&49152||(Jb(this),this.o.reset());this.a-=667},function(){Ob(this);this.a-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],Wc=[Ic,function(){this.m=0;this.a-=5},function(){this.h=0;this.a-=5},W,function(){this.l=1;this.a-=5},W,W,W,function(){this.s=0;this.a-=
5},W,W,W,W,W,W,W],Xc=[Ic,function(){this.m=65536;this.a-=5},function(){this.h=32768;this.a-=5},X,function(){this.l=0;this.a-=5},X,X,X,function(){this.s=32768;this.a-=5},X,X,X,X,X,X,X],Oc=[Hc,Hc,Ac,Ac,yc,yc,zc,zc,Lc,Lc,Y,Y,Y,Y,Jc,Jc],Pc=[function(a){V(this,a,!this.na())},function(a){V(this,a,this.na())},function(a){V(this,a,!N(this)&&!!(this.l&65535))},function(a){V(this,a,N(this)||(this.l&65535?0:4))},function(a){V(this,a,!(this.h&32768))},function(a){V(this,a,this.h&32768?2:0)},function(a){V(this,
a,!N(this))},function(a){V(this,a,N(this))},function(){F(this,24);this.a-=25},function(){F(this,28);this.a-=5},function(a){Yc[a>>6&3].call(this,a)},function(a){Zc[a>>6&3].call(this,a)},function(a){$c[a>>6&3].call(this,a)},function(a){ad[a>>6&3].call(this,a)},Y,Y],Yc=[function(a){P(this,Xb(this,a,0));this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,0,jc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,1,nc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,1,lc);this.a-=this.g?
9:3+(7==this.c?2:0)}],Zc=[function(a){T(this,a,0,pc);this.a-=this.g?11:6},function(a){T(this,a,N(this)?1:0,$b);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,N(this)?1:0,vc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){a=Wb(this,a);P(this,a<<8);this.a-=this.g?4:3+(7==this.c?2:0)}],$c=[function(a){T(this,a,0,tc);this.a-=this.g?9+(this.Ua&1):3+(7==this.c?2:0)},function(a){T(this,a,0,rc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,0,dc);this.a-=this.g?9+(this.Ua&1):3+(7==this.c?
2:0)},function(a){T(this,a,0,bc);this.a-=this.g?9:3+(7==this.c?2:0)}],ad=[Y,function(a){a=Sb(this,a,65536);Nb(this,a);O(this,a);this.a-=11},function(a){var b=Pb(this),c=this.a;Tb(this,a,65536,b);O(this,b);this.a=c-Gc[this.g]},Y];
function bd(a){v.call(this,"ROM",a,bd);this.a=null;this.m=a.addr;this.c=a.size;this.s=a.writable;this.g=a.alias;this.h=a.file;this.u=ba(this.h);if(this.h){a=this.h;var b=ca(this.u);"json"!=b&&"hex"!=b&&(a=ea()+"/api/v1/dump?file="+this.h+"&format=bytes&decimal=true");var c=this;l(a,null,!0,function(a,b,f){cd(c,a,b,f)})}}x(bd);bd.prototype.oa=function(a,b,c,d){this.o=b;this.b=c;this.I=d;dd(this)};bd.prototype.ha=function(){this.l&&(this.I&&this.I.a(this.id,this.m,this.c,this.l),delete this.l);return!0};
bd.prototype.ga=function(){return!0};
function cd(a,b,c,d){if(d)a.K("Unable to load system ROM (error "+d+": "+b+")");else{Ga(a.Va,b,c);var e;if("["==c.charAt(0)||"{"==c.charAt(0))try{var f,k,m=eval("("+c+")");if(f=m.bytes)a.a=f;else if(f=m.words)for(a.a=Array(2*f.length),k=e=0;e<f.length;e++)a.a[k++]=f[e]&255,a.a[k++]=f[e]>>8&255;else if(f=m.data)for(a.a=Array(4*f.length),k=e=0;e<f.length;e++)a.a[k++]=f[e]&255,a.a[k++]=f[e]>>8&255,a.a[k++]=f[e]>>16&255,a.a[k++]=f[e]>>24&255;else a.a=m;a.l=m.symbols;if(!a.a.length){p("Empty ROM: "+b);
return}if(1==a.a.length){p(a.a[0]);return}}catch(n){a.K("ROM data error: "+n.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.a=Array(b.length),e=0;e<b.length;e++)a.a[e]=aa(b[e]);dd(a)}}
function dd(a){if(!Ia(a))if(!a.h)D(a);else if(a.a&&a.o){a.c||(a.c=a.a.length);if(a.a.length!=a.c){var b="ROM size ("+h(a.a.length,8,!0)+") does not match specified size ("+h(a.c,8,!0)+")";a.i.error=!0;a.K(b)}else{b=a.m;if(Sa(a.o,b,a.c,a.s?1:nb)){var c;for(c=0;c<a.a.length;c++){var d=a.o,e=b+c;d.a[(e&d.h)>>>d.c].Bb(e&d.o,a.a[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.g?b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){for(var f=a,d=b[c],e=f.o,k=f.c,m=[],n=f.m>>>e.c;0<k&&
n<e.a.length;)m.push(e.a[n++]),k-=e.g;e=f.o;f=f.c;k=0;for(d>>>=e.c;0<f&&d<e.a.length;){n=m[k++];if(!n)break;e.a[d++]=n;f-=e.g}}delete a.a}}D(a)}}u(function(){for(var a=C(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new bd(d);B(d,c)}});function ed(a){v.call(this,"RAM",a,ed);this.g=a.addr;this.c=a.size;this.a=!1}x(ed);g=ed.prototype;g.oa=function(a,b,c,d){this.o=b;this.b=c;this.I=d;D(this)};g.ha=function(a,b){b||this.reset();return!0};g.ga=function(a){return a?this.save():!0};
g.reset=function(){!this.a&&this.c&&Sa(this.o,this.g,this.c,1)&&(this.a=!0);this.a||p("No RAM allocated")};g.save=function(){return null};g.restore=function(){return!0};u(function(){for(var a=C(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new ed(d);B(d,c)}});function fd(a){v.call(this,"Keyboard",a,fd);D(this)}x(fd);fd.prototype.R=function(){return!1};fd.prototype.oa=function(a,b,c,d){this.A=a;this.b=c;this.I=d;this.sa=null};
u(function(){for(var a=C(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new fd(d);B(d,c)}});function Z(a){this.g=this.l=null;this.H=a.tabSize;this.B=a.charBOL;this.m=0;v.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.l="";else{var c;a=gd;b&&(void 0===c&&(c="Panel"),(c=z(c,this.id))&&(b=c.w[b])&&this.R(null,a,b))}this.s=this.u=null;this.exports={connect:this.ib,receiveData:this.ab}}x(Z);var gd="buffer";g=Z.prototype;
g.R=function(a,b,c){var d=this;switch(b){case gd:return this.w[b]=this.g=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.ab(b);return!0},c.onkeypress=function(a){a=a||window.event;d.ab(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
g.oa=function(a,b,c,d){this.A=a;this.o=b;this.b=c;this.I=d;var e=this;this.J=bb(this.b,function(){e.a&128||!e.h.length||(e.G=e.h.shift(),e.a|=128,e.a&64&&cb(e.b,40,4,48))});this.D=function(){e.c|=128;return!!(e.c&64)};$a(b,this,hd);D(this)};
g.ib=function(){if(!this.s){var a=yb(this.A,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ha(b[0]);if(c!=this.Fa)return;b=ha(b[1]);if(this.s=Ha(b)){var d=this.s.exports;if(d){var e=d.connect;e&&e.call(this.s);if(this.u=d.receiveData){this.status(this.Va+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};g.ha=function(a,b){if(!b)if(this.ib(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
g.ga=function(a){return a?this.save():!0};g.reset=function(){id(this)};g.save=function(){var a=new M(this);a.set(0,[]);return a.data()};g.restore=function(){return id(this)};function id(a){a.G=0;a.a=0;a.c=128;a.h=[];return!0}g.ab=function(a){if("number"==typeof a)this.h.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.h.push(a.charCodeAt(b));else this.h=this.h.concat(a);db(this.b,this.J,50);return!0};g.cc=function(){return this.a&65535};g.Hc=function(a){this.a=this.a&-112|a&111};
g.bc=function(){this.a&=-129;0<this.h.length&&db(this.b,this.J,50);return this.G};g.Gc=function(){};g.qc=function(){return this.c};g.Wc=function(a){128==(this.c&192)&&a&64&&cb(this.b,8,4,52,this.D);this.c=this.c&-70|a&69};g.pc=function(){return 0};
g.Vc=function(a){if(a&=255){this.u&&this.u.call(this.s,a);if(this.g)if(13==a)this.m=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.m&&this.m--;else{var b;b=(b=ia[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.H||8,c=a-this.m%a,this.H&&(b=" ".slice(0,c)));this.B&&!this.m&&c&&(b=String.fromCharCode(this.B)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.m+=c}else if(null!=this.l){if(10==a||1024<=this.l.length)this.M(this.l),
this.l="";10!=a&&(this.l+=String.fromCharCode(a))}this.c&=-129;cb(this.b,100,4,52,this.D)}};var jd={},hd=(jd[65392]=[null,null,Z.prototype.cc,Z.prototype.Hc,"RCSR"],jd[65394]=[null,null,Z.prototype.bc,Z.prototype.Gc,"RBUF"],jd[65396]=[null,null,Z.prototype.qc,Z.prototype.Wc,"XCSR"],jd[65398]=[null,null,Z.prototype.pc,Z.prototype.Vc,"XBUF"],jd);u(function(){for(var a=C(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Z(d);B(d,c)}});
function kd(a,b,c){v.call(this,"Computer",a,kd);this.i.L=!1;ld(this,b);this.B=yb(this,"autoPower",a);this.g=0;this.N=a.busWidth||a.buswidth;this.a=md;this.u=null;this.m=this.H=!1;this.O=yb(this,"url")||"";(Math.random()+.1).toString(36);this.c=nd(this);if(this.b=z("CPU",this.id)){this.I=z("Debugger",this.id);this.o=new Ma({id:this.Va+".bus",busWidth:this.N},this.b,this.I);var d,e=y(this.id);if((this.h=z("Panel",this.id))&&this.h.Ta)for(b=0;b<e.length;b++)d=e[b],d.K=this.h.K,d.M=this.h.M,d.Ta=this.h.Ta;
this.M("PDPjs v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.M("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.oa&&d.oa(this,this.o,this.b,this.I);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.a=parseInt(d,10));var f;if(a=yb(this,"state")||(f=!0,a.state))b=this.D=a,f||(this.m=!0,this.a=md),this.a&&(this.A=new M(this,
"1.30.1"),od(this.A)?b=null:delete this.A);!b&&this.a&&(b=pd(this))&&(this.m=!0);if(b){var k=this;l(b,null,!0,function(a,b,c){c?(k.s=null,k.m=!1,k.K("Unable to load machine state from server (error "+c+(b?": "+ha(b):"")+")")):(k.u=b,k.H=!0);D(k)})}else D(this);this.w.power||(this.B=!0);!c&&this.B&&qd(this,this.Da)}else p("Unable to find CPU component")}x(kd);var md=0;
function ld(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){p(d.message+" ("+c+")")}}a.J=b}function yb(a,b,c){var d=b.toLowerCase(),d=za[b]||za[d];void 0===d&&a.J&&(d=a.J[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function qd(a,b,c){for(var d=y(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ia(f)){Ia(f,function(){qd(a,b,c)});return}}b.call(a,c)}
function rd(a,b){var c=new M(a,"1.30.1","validate");if(od(c)&&sd(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.K("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}g=kd.prototype;
g.Da=function(a){void 0===a&&(a=this.a||(this.u?1:md));if(!this.g){this.g++;var b=!1,c=!1;this.G=!1;var d=this.A||new M(this,"1.30.1");if(-1==a)b=!0;else if(a>md){if(od(d,this.u)){this.l=new M(this,"1.30.1","failsafe");od(this.l)&&(td(this,d),a=2,ud(this.l));this.l.set("timestamp",ka());vd(this.l);var e=this.a&&!this.m;if(1==a||la("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=sd(d)){var f=d.get("code"),k=d.get("data");f&&("ok"==f?od(d,k):("error"==
f&&"no machine state"!=k?(this.K("Error: "+k),"unable to verify user"==k&&(pa("user",""),this.c=null)):this.M(f+": "+k),ud(d),od(d)?(c=sd(d),e=!0):c=!1))}e&&rd(this,c?d:null)}else 2==a&&d.clear()}else rd(this);delete this.u;delete this.A}e=y(this.id);for(f=0;f<e.length;f++)k=e[f],k!==this&&k!=this.b&&(c=wd(this,k,d,b,c));b=[d,a,c];-1!=a?qd(this,this.gb,b):this.gb(b)}};
function wd(a,b,c,d,e){if(!b.i.L){b.i.L=!0;if(b.ha){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ha(f,d)&&f&&(p("Unable to restore state for "+b.type),a.D&&!a.H?(c.clear(),a.a=md,window&&window.location.reload()):a.G=!0,b.ha(null),e=!1)}if(!d&&b.kb)for(a=b.kb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
g.gb=function(a){var b=a[0],c=0>a[1];a=a[2];this.S=!0;this.i.L=!0;var d=this.w.power;d&&(d.textContent="Shutdown");this.b&&(wd(this,this.b,b,c,a),this.b.Ca());this.G&&(td(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.g=0};
function td(a,b){if(la("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.c||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.1"};d.url=a.O;d.user=c;d.type="bug";d.data=b;l("http://www.pcjs.org/api/v1/report",d,!0)}}
function xd(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new M(a,"1.30.1"),k=new M(a,"1.30.1","validate"),m=ka();k.set("timestamp",m);f.set("timestamp",m);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.ga&&(c&&L(a.b),d=a.b.ga(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.i.L=!1,!1===d&&(e=null)));for(var m=y(a.id),n=0;n<m.length;n++){var q=m[n];q.i.L&&(q.ga&&(d=q.ga(b,c),"object"===typeof d&&f.set(q.id,
d)),c&&(q.i.L=!1,!1===d&&(e=null)))}e&&(c?(m=d=!1,b?(a.c&&yd(a,a.c,f.toString()),vd(k)&&vd(f)||(e=null,d=m=!0)):a.a&&(d=!0,m=3==a.a),d&&f.clear(m)):e=f.toString());c&&(a.i.L=!1,b=a.w.power)&&(b.textContent="Power");a.g=0;return e}g.reset=function(){this.o&&this.o.reset&&this.o.reset();for(var a=y(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.o&&c.reset&&c.reset()}};g.start=function(a,b){for(var c=y(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};
u(function(){for(var a=C(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=A(c);switch(d.name){case "default":d=new G(d),B(d,c)}}});var jb;if(Ja){var kb=new ArrayBuffer(2);(new DataView(kb)).setUint16(0,256,!0);jb=256===(new Uint16Array(kb))[0]}else jb=!1;var lb=jb;
function E(a,b,c,d,e,f){this.b=a;this.id=mb+=2;this.a=null;this.za=b;this.Pa=c;this.size=d||0;this.type=e||nb;this.h=e==ob;this.controller=null;Ra(this);this.ma=this.Ib=!1;if(d)if(f)this.controller=f,this.a=null,pb(this,f.Gb);else if(Ja)this.c=new ArrayBuffer(d),this.m=new DataView(this.c,0,d),this.g=new Uint8Array(this.c,0,d),this.o=new Uint16Array(this.c,0,d>>1),this.a=new Int32Array(this.c,0,d>>2),pb(this,lb?qb:rb);else{this.a=Array(d>>2);for(a=0;a<this.a.length;a++)this.a[a]=0;pb(this,sb)}else pb(this)}
var nb=0,ob=2,Va=4,Wa=["NONE","RAM","ROM","VID","H/W"],mb=0;
E.prototype={constructor:E,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ja)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.m.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Ja)for(b=0;b<a.length;b++)this.m.setInt32(b<<2,a[b],!0);else this.a=a;return this.ma=!0}return!1},s:function(){return 255},B:function(){},u:function(a,b){return this.Ya(a++,b++)|this.Ya(a,b)<<8},A:function(a,b,c){this.Qa(a++,
b&255,c++);this.Qa(a,b>>8,c)},N:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},aa:function(a){a&1&&F(this.b,4);var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},ea:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.ma=!0},ua:function(a,b){a&1&&F(this.b,4);var c=a>>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<<a)|b<<a:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|b>>8);this.ma=!0},G:function(a,b){return this.H(a,
b)},S:function(a,b){return this.Y(a,b)},ca:function(a,b,c){this.h||this.Ab(a,b,c)},ja:function(a,b,c){this.h||this.ka(a,b,c)},D:function(a){return this.g[a]},J:function(a){return this.g[a]},O:function(a){a&1&&F(this.b,4);return this.m.getUint16(a,!0)},$:function(a){a&1&&F(this.b,4);return this.o[a>>1]},ba:function(a,b){this.g[a]=b;this.ma=!0},da:function(a,b){this.g[a]=b;this.ma=!0},ia:function(a,b){a&1&&F(this.b,4);this.m.setUint16(a,b,!0);this.ma=!0},ta:function(a,b){a&1&&F(this.b,4);this.o[a>>
1]=b;this.ma=!0}};function Ra(a,b,c){a.I=b;a.w=a.l=0;c&&((a.w=c.w)&&tb(a,ub,!1),(a.l=c.l)&&vb(a,ub,!1))}function vb(a,b,c){c&&a.l||(a.Qa=!a.h&&b[1]||a.B,a.Sc=!a.h&&b[3]||a.A);if(c||void 0===c)a.Ab=b[1]||a.B,a.ka=b[3]||a.A}function tb(a,b,c){c&&a.w||(a.Ya=b[0]||a.s,a.oc=b[2]||a.u);if(c||void 0===c)a.H=b[0]||a.s,a.Y=b[2]||a.u}function pb(a,b){b||(b=wb);tb(a,b,void 0);vb(a,b,void 0)}
var wb=[],sb=[E.prototype.N,E.prototype.ea,E.prototype.aa,E.prototype.ua],ub=[E.prototype.G,E.prototype.ca,E.prototype.S,E.prototype.ja];if(Ja)var rb=[E.prototype.D,E.prototype.ba,E.prototype.O,E.prototype.ia],qb=[E.prototype.J,E.prototype.da,E.prototype.$,E.prototype.ta];
function xb(a,b){v.call(this,"CPU",a,xb);var c=a.multiplier||1;this.Ja=a.cycles||b;this.da=c;this.Va=Math.round(this.Ja/1E4)/100;this.ia=this.Va*this.da;this.i.V=!1;this.i.xb=!1;this.i.Aa=a.autoStart;this.i.cb=!1;this.i.La=!1;this.Ca=this.ja=0;this.Ia=a.csStart;this.ta=a.csInterval;this.ua=a.csStop;this.J=[];this.mb=this.sc.bind(this);D(this)}x(xb);var yb=["power","reset"];g=xb.prototype;
g.oa=function(a,b,c,d){this.B=a;this.m=b;this.I=d;for(b=0;b<yb.length;b++)(c=this.w[yb[b]])&&this.B.R(null,yb[b],c);a=zb(a,"autoStart");null!=a&&(this.i.Aa="true"==a?!0:"false"==a?!1:!!a);this.hb();D(this)};g.hb=function(){};g.reset=function(){};g.save=function(){return null};g.restore=function(){return!1};g.ha=function(a,b){if(!b){if(a&&this.restore){Ab(this);if(!this.restore(a))return!1;Bb(this)}else this.reset();this.M("No debugger detected")}Cb(this);return!0};
g.ga=function(a){return a?this.save():!0};g.Aa=function(){return this.i.Aa||void 0===this.w.run?(Db(this),!0):!1};g.fb=function(){return 0};function Bb(a){void 0===a.Ia&&(a.Ia=0);void 0===a.ta&&(a.ta=-1);void 0===a.ua&&(a.ua=-1);a.i.La=0<=a.Ia&&0<a.ta;a.i.La&&(a.Ca=0,a.ja=a.Ia-a.ea)}
function K(a,b,c,d){if(a.w[b]){void 0===c&&(a.i.error=!0,a.K("Value for "+b+" is invalid"),L(a));var e=a.I&&a.I.c||8;if(!a.i.V||a.i.cb)if(8==e){e="";d?11<d&&(d=11):d=c&-65536?11:6;if(null==c||isNaN(c))for(;0<d--;)e="?"+e;else for(;0<d--;)e=String.fromCharCode((c&7)+48)+e,c>>=3;d=""+e}else d=h(c,d);else d="--------".substr(0,d||4);a.w[b].textContent!=d&&(a.w[b].textContent=d)}}
g.R=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.w[b]=c;a=!0;break;case "run":this.w[b]=c;c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.i.L)a=!0;else{var b=null,c,m=y(a.id);for(c=0;c<m.length&&(b=m[c],b===a||b.i.ready);c++);if(c==m.length)for(c=0;c<m.length&&(b=m[c],b===a||b.i.L);c++);c==m.length&&(b=a);p("The "+b.type+" component ("+b.id+") is not "+(b.i.ready?"powered yet":"ready yet"+(b.Ma?" (waiting for notification)":""))+".");a=!1}a&&(d.i.V?L(d):Db(d))};a=!0;break;
case "speed":this.w[b]=c;a=!0;break;case "setSpeed":this.w[b]=c,c.onclick=function(){Eb(d,d.da<<1)},c.textContent=this.ia.toFixed(2)+"Mhz",a=!0}return a};function Fb(a,b,c){a.ea+=b;c&&(a.ca=a.a=0)}function Gb(a,b){var c=1;b&&1<a.da&&a.aa&&(c=a.aa/a.Va);a.kb=Math.round(1E3/30);a.Ka=Math.floor(a.Ja/30*c);b||(a.xa=a.Ka);a.Xa=0}function Hb(a){return a.ea+a.Y+a.ca-a.a}function Ab(a){a.aa=0;a.lb=0;a.ea=a.Y=a.ca=a.a=0;Bb(a);Eb(a,1)}
function Eb(a,b){if(void 0!==b&&(.8>a.aa/a.ia&&(b=1),a.da=b,b=a.Va*a.da,a.ia!=b)){a.ia=b;b=a.ia.toFixed(2)+"Mhz";var c=a.w.setSpeed;c&&(c.textContent=b);a.M("target speed: "+b)}Fb(a,a.Y);a.Y=0;a.S=ja();a.ba=0;Gb(a)}function cb(a,b){var c=a.J.length;a.J.push([-1,b]);return c}function eb(a,b,c){0<=b&&b<a.J.length&&0>a.J[b][0]&&(c*=a.Ja*a.da/1E3,a.J[b][0]=c)}
g.sc=function(){if(this.i.V){this.Xa>=this.Ja&&Gb(this,!0);this.ya=0;this.Ha=ja();if(this.ba){var a=this.Ha-this.ba;a>this.kb&&(this.S+=a,this.S>this.Ha&&(this.S=this.Ha))}try{do{for(var b,c=this.i.La?1:this.Ka,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.yb(b)}catch(q){if("number"!=typeof q)throw q;}for(var f=this.ca-this.a,a=f,k=this.J.length-1;0<=k;k--){var m=this.J[k];0>m[0]||(m[0]-=a,0>=m[0]&&(m[0]=-1,m[1]()))}this.ya+=f;this.Y+=f;Fb(this,0,!0);a=f;if(this.i.La){var n=
!1;this.Ca=this.Ca+this.fb()|0;this.ja-=a;0>=this.ja&&(this.ja+=this.ta,n=!0);0<=this.ua&&this.ua<=Hb(this)&&(this.ta=this.ua=-1,Bb(this),L(this),n=!0);n&&this.M(Hb(this)+" cycles: checksum="+h(this.Ca))}this.xa-=f;if(0>=this.xa){this.xa+=this.Ka;15<=++this.lb&&(this.B&&this.B.wa(),this.lb=0);break}}while(this.i.V)}catch(q){L(this);Cb(this);this.B&&this.B.stop(ja(),Hb(this));b=q.stack||q.message;this.i.error=!0;this.K(b);return}if(this.i.V){b=setTimeout;c=this.mb;this.ba=ja();d=this.kb;this.ya&&(d=
Math.round(d*this.ya/this.Ka));d-=this.ba-this.Ha;if(e=this.ba-this.S)this.aa=Math.round(this.Y/(10*e))/100,864E5<=e&&(this.ea=0,Eb(this));if(0>d||this.aa<this.ia)-1E3>d&&(this.S-=d),d=0;this.Xa+=this.ya;this.ba+=d;b(c,d)}}};function Db(a){var b;a.i.error?(a.M(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.i.V)a.M(a.toString()+" busy");else{Eb(a);a.i.V=!0;a.i.xb=!0;if(b=a.w.run)b.textContent="Halt";a.B&&a.B.start(a.S,Hb(a));Cb(a,!0);setTimeout(a.mb,0)}}g.yb=function(){return 0};
function L(a){if(a.i.V){a.ca-=a.a;a.a=0;Fb(a,a.Y);a.Y=0;a.i.V=!1;var b=a.w.run;b&&(b.textContent="Run");a.B&&a.B.stop(ja(),Hb(a));Cb(a)}a.i.complete=void 0}function Cb(a,b){a.B&&a.B.wa(b)}
function Ib(a){this.Mb=+a.model||1170;this.Ob=a.resetAddr||0;xb.call(this,a,6666667);this.gb=0;this.decode=Jb.bind(this);this.o=65536;this.h=32768;this.l=65535;this.s=32768;this.v=15;this.f=[0,0,0,0,0,0,0,this.Ob];this.va=[0,0,0,0,0,0];this.Z=[0,0,0,0];this.Fa=this.A=0;this.Lb=[4,2,0,1];this.C=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.P=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.tc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.wb=[0,0,0,0,0,0,0,0];this.g=this.c=this.Ta=this.G=this.H=this.j=this.vb=0;this.ka=-1;Kb(this);this.i.complete=this.i.Hb=!1}x(Ib,xb);g=Ib.prototype;g.hb=function(){fb(this)};g.reset=function(){this.i.V&&L(this);Kb(this);Ab(this);this.i.error=!1;this.parent.reset.call(this)};
function Kb(a){a.sa=255;a.F=0;a.ab=0;a.D=0;a.qa=0;a.$a=0;a.ra=0;a.Oa=0;a.Ea=0;a.Wa=262143;a.Ga=253952;a.u=[];a.j|=2;a.m&&fb(a)}function fb(a){a.Oa?(a.$=65536,a.N=a.Kb,a.O=a.ub,a.nb=a.Uc,Sa(a.m,a.ra&16?22:18)):(a.$=0,a.N=a.Jb,a.O=a.pc,a.nb=a.Tc,Sa(a.m,16))}g.fb=function(){return 0};g.save=function(){var a=new M(this);a.set(0,[]);a.set(1,[this.ea,this.da]);a.set(2,$a(this.m));return a.data()};
g.restore=function(a){var b=a[1];this.ea=b[1];Eb(this,b[3]);a:{b=this.m;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.A){for(var f=0,k=Array(b.A),m=0;m<e.length-1;)for(var n=e[m++],q=e[m++];n--;)k[f++]=q;e=k}f=b.a[d];if(!f||!f.restore(e)){p("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
g.R=function(a,b,c){switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":this.w[b]=c;this.gb++;a=!0;break;default:a=this.parent.R.call(this,a,b,c)}return a};
g.wa=function(a){if(this.gb&&(a||!this.i.V||this.i.cb)){for(a=0;a<this.f.length;a++)K(this,"R"+a,this.f[a]);a=hb(this);K(this,"PS",a);K(this,"NF",a&8?1:0,1);K(this,"ZF",a&4?1:0,1);K(this,"VF",a&2?1:0,1);K(this,"CF",a&1?1:0,1)}if(a=this.w.speed)a.textContent=this.i.V&&this.aa?this.aa.toFixed(2)+"Mhz":"Stopped"};function N(a){return a.o&65536?1:0}g.na=function(){return this.s&32768?8:0};function Lb(a){var b=a.O(a.f[7]);a.f[7]=a.f[7]+2&65535;return b}
function db(a,b,c,d,e){for(var f=a.u.length;0<f--;)if(a.u[f].zb===d){0<f&&(a.u[f-1].fa+=a.u[f].fa);a.u.splice(f,1);break}if(0<=b){for(f=a.u.length;0<f--;){if(a.u[f].fa>b){a.u[f].fa-=b;break}b-=a.u[f].fa}a.u.splice(f+1,0,{fa:b,ob:c<<5&224,zb:d,Ra:e})}a.j|=2}function hb(a){return a.v=a.v&63728|a.na()|(a.l&65535?0:4)|(a.h&32768?2:0)|N(a)}
function ib(a,b){a.s=b<<12;a.l=~b&4;a.h=b<<14;a.o=b<<16;if((b^a.v)&2048)for(var c=a.va.length;0<=--c;){var d=a.f[c];a.f[c]=a.va[c];a.va[c]=d}a.A=b>>14&3;c=a.v>>14&3;a.A!=c&&(a.Z[c]=a.f[6],a.f[6]=a.Z[a.A]);a.j|=2;a.v=b}function O(a,b){a.j&128||(a.s=a.l=b,a.h=0)}function P(a,b,c){a.j&128||(a.s=a.l=a.o=b,a.h=c||0)}function Mb(a,b,c,d){a.j&128||(a.s=a.l=a.o=b,a.h=(c^b)&(d^b))}function Q(a,b){a.j&128||(a.s=a.l=a.o=b,a.h=a.s^a.o>>1)}function Nb(a,b,c,d){a.j&128||(a.s=a.l=a.o=b,a.h=(c^d)&(d^b))}
function F(a,b){var c=!1;0>a.ka?a.ka=hb(a):a.A||(b=4,c=!0);a.D&57344||(a.qa=63222,a.$a=b);a.A=0;var d=a.O(b|a.$),e=a.O(b+2&65535|a.$);ib(a,e&-12289|a.ka>>2&12288);c&&(a.F|=4,a.f[6]=4);Ob(a,a.ka);Ob(a,a.f[7]);a.f[7]=d&65535;a.j&=-113;a.ka=-1;throw b;}function Pb(a){var b=Qb(a),c=Qb(a)&-1793;a.v&49152&&(c=c&-225|a.v&63712);a.f[7]=b&65535;ib(a,c);a.j&=-17}
function Rb(a,b,c){var d,e,f,k=0;d=b>>13;a.ra&a.Lb[a.A]||(d&=7);e=a.C[a.A][d];f=(a.P[a.A][d]<<6)+(b&8191)&a.Wa;if(f<a.Ga)f&1&&!(c&1)&&(a.F|=64,F(a,4));else if(a.ra&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var m=f>>13&31;31>m?a.ra&32&&(f=a.tc[m]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Ga&&4186112>f&&(a.F|=32,F(a,4))}switch(e&7){case 1:k=4096;case 2:e|=128;c&4&&(k=8192);break;case 4:k=4096;case 5:c&4&&(k=4096);case 6:e|=c&4?192:128;break;
default:k=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(k|=16384):(b&8128)>(e>>2&8128)&&(k|=16384));a.C[a.A][d]=e;if(4194170!==f||a.A)a.Ea=a.A,a.Fa=d;k&&(k&57344&&(0<=a.ka&&(k|=128),a.D&57344||(a.D=a.D|k|a.Ea<<5|a.Fa<<1),F(a,168)),a.D&61440||!(4191360>f||4194239<f)||(a.D|=4096,a.D&512&&(a.j|=32)));return f}function Qb(a){var b=a.O(a.f[6]|a.$);a.f[6]=a.f[6]+2&65535;return b}
function Ob(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.D&57344||(a.qa=a.qa<<8|246);!a.A&&c<=a.sa&&4<c&&(c<=a.sa-32?(a.F|=4,a.f[6]=4,F(a,4)):(a.F|=8,a.j|=4));a.nb(c,b)}
function Sb(a,b,c,d){var e,f,k=d&8?0:a.$;switch(b){case 0:return F(a,4),0;case 1:return 6===c&&!a.A&&d&4&&(a.f[6]<=a.sa||65534<=a.f[6])&&(a.f[6]<=a.sa-32||65534<=a.f[6]?(a.F|=4,a.f[6]=4,F(a,4)):(a.F|=8,a.j|=64)),a.a-=3,7===c?a.f[c]:a.f[c]|k;case 2:f=2;e=a.f[c];7!==c&&(e|=k,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.f[c];7!==c&&(e|=k);e=a.O(e);e|=k;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.f[c]+f&65535;7!==c&&(e|=k);a.a-=4;break;case 5:f=-2;e=a.f[c]-2&65535;7!==c&&(e|=k);e=a.O(e)|k;a.a-=8;break;
case 6:return e=Lb(a),e=e+a.f[c]&65535|k,a.a-=6,e;case 7:return e=Lb(a),e=e+a.f[c]&65535,e=a.O(e|a.$)|k,a.a-=10,e}a.f[c]=a.f[c]+f&65535;!k||a.D&57344||(a.qa=a.qa<<8|f<<3&248|c);6==c&&!a.A&&d&4&&0>=f&&(a.f[6]<=a.sa||65534<=a.f[6])&&(a.f[6]<=a.sa-32?(a.F|=4,a.f[6]=4,F(a,4)):(a.F|=8,a.j|=64));return e}g.Jb=function(a,b,c){return Sb(this,a,b,c)};g.Kb=function(a,b,c){return Rb(this,Sb(this,a,b,c),c)};g.pc=function(a){return Ya(this.m,a)};g.ub=function(a){return Ya(this.m,Rb(this,a,2))};
g.Tc=function(a,b){Za(this.m,a,b&65535)};g.Uc=function(a,b){Za(this.m,Rb(this,a,4),b)};function Tb(a,b,c){var d=a.c=b&7;(b=a.g=(b&56)>>3)?(d=Sb(a,b,d,2),c&65536||61440!==(a.v&61440)&&(d&=65535),a.A=a.v>>12&3,c=a.O(d|c&a.$),a.A=a.v>>14&3):c=6!=d||(a.v>>2&12288)===(a.v&12288)?a.f[d]:a.Z[a.v>>12&3];return c}
function Ub(a,b,c,d){a.D&57344||(a.qa=22);var e=a.c=b&7;(b=a.g=(b&56)>>3)?(e=Sb(a,b,e,4),c&65536||(e&=65535),a.A=a.v>>12&3,e=Rb(a,e|c&65536,4),a.A=a.v>>14&3,Za(a.m,e,d)):6!=e||(a.v>>2&12288)===(a.v&12288)?a.f[e]=d:a.Z[a.v>>12&3]=d}function Vb(a,b){b>>=6;var c=a.H=b&7;(b=a.G=(b&56)>>3)?(c=a.N(b,c,3),a=Xa(a.m,c)):a=a.f[c]&255;return a}function R(a,b){b>>=6;var c=a.H=b&7;return(b=a.G=(b&56)>>3)?Ya(a.m,a.N(b,c,2)):a.f[c]}function Wb(a,b){var c=a.c=b&7;b=a.g=(b&56)>>3;return Sb(a,b,c,8)}
function Xb(a,b){var c=a.c=b&7;(b=a.g=(b&56)>>3)?(c=a.N(b,c,3),a=Xa(a.m,c)):a=a.f[c]&255;return a}function S(a,b){var c=a.c=b&7;return(b=a.g=(b&56)>>3)?Ya(a.m,a.N(b,c,2)):a.f[c]}function T(a,b,c,d){var e=a.c=b&7;(b=a.g=(b&56)>>3)?(e=a.Ta=a.N(b,e,7),c=d.call(a,c,Xa(a.m,e)),e&1&&a.a--,a=a.m,a.a[(e&a.h)>>>a.c].Qa(e&a.m,c&255,e)):a.f[e]=a.f[e]&65280|d.call(a,c,a.f[e])}function U(a,b,c,d){var e=a.c=b&7;(b=a.g=(b&56)>>3)?(e=a.N(b,e,6),Za(a.m,e,d.call(a,c,Ya(a.m,e)))):a.f[e]=d.call(a,c,a.f[e])}
function Yb(a,b,c,d){var e=a.c=b&7;(b=a.g=(b&56)>>3)?(d=a.N(b,e,5),d&1&&a.a--,a=a.m,a.a[(d&a.h)>>>a.c].Qa(d&a.m,c&255,d)):a.f[e]=c?d&1?c<<24>>24&65535:a.f[e]&-256|c&255:a.f[e]&-256;return c}function Zb(a,b,c){var d=a.c=b&7;(b=a.g=(b&56)>>3)?Za(a.m,a.N(b,d,4),c):a.f[d]=c&65535;return c}function V(a,b,c){c&&(a.f[7]=a.f[7]+(b<<24>>23)&65535,a.a-=2);a.a-=3}
g.yb=function(a){this.i.complete=!0;this.i.Hb=!1;this.i.xb=!1;this.ca=this.a=a;do{if(this.j&&(this.j&112&&(this.j&32?F(this,168):this.j&64?F(this,4):this.j&16&&F(this,12),this.j&=-113),this.j&7))if(this.j&2){this.j&=-3;a=null;for(var b=this.ab&224,c=this.u.length;0<=--c;){if(0<this.u[c].fa){this.u[c].fa--;this.j|=2;break}if(this.u[c].Ra){if(!this.u[c].Ra()){this.u.splice(c,1);continue}this.u[c].Ra=null}this.u[c].ob>b&&(b=this.u[c].ob,a=this.u[c],this.u.splice(c,1))}b>(this.v&224)&&(this.j&4&&(this.f[7]=
this.f[7]+2&65535,this.j&=-5),a?F(this,a.zb):F(this,160))}else this.j&1&&this.j++;this.D&57344||(this.qa=0,this.$a=this.f[7]);this.j=this.j&7|this.v&16;this.decode(Lb(this))}while(0<this.a);return this.i.complete?this.ca-this.a:void 0===this.i.complete?0:-1};u(function(){for(var a=C(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Ib(d);B(d,c)}});function $b(a,b){var c=b+a;Mb(this,c,a,b);return c&65535}function ac(a,b){var c=b+a;Mb(this,c<<8,a<<8,b<<8);return c&255}
function bc(a,b){a=b<<1;Q(this,a);return a&65535}function cc(a,b){a=b<<1;Q(this,a<<8);return a&255}function dc(a,b){a=b&32768|b>>1|b<<16;Q(this,a);return a&65535}function ec(a,b){a=b&2048|b>>1|b<<8;Q(this,a<<8);return a&255}function fc(a,b){a=b&~a;O(this,a);return a}function gc(a,b){a=b&~a;O(this,a<<8);return a}function hc(a,b){a|=b;O(this,a);return a}function ic(a,b){a|=b;O(this,a<<8);return a}function jc(a,b){a=~b|65536;P(this,a);return a&65535}
function kc(a,b){a=~b|256;P(this,a<<8);return a&255}function lc(a,b){a=b-a;this.j&128||(this.s=this.l=a,this.h=b&(b^a));return a&65535}function mc(a,b){a=b-a;var c=a<<8;b<<=8;this.j&128||(this.s=this.l=c,this.h=b&(b^c));return a&255}function nc(a,b){a=b+a;this.j&128||(this.s=this.l=a,this.h=a&(b^a));return a&65535}function oc(a,b){a=b+a;var c=a<<8;this.j&128||(this.s=this.l=c,this.h=c&(b<<8^c));return a&255}function pc(a,b){a=-b;P(this,a,a&b&32768);return a&65535}
function qc(a,b){a=-b;P(this,a<<8,(a&b&128)<<8);return a&255}function rc(a,b){a=b<<1|this.o>>16&1;Q(this,a);return a&65535}function sc(a,b){a=b<<1|this.o>>16&1;Q(this,a<<8);return a&255}function tc(a,b){a=(this.o&65536|b)>>1|b<<16;Q(this,a);return a&65535}function uc(a,b){a=((this.o&65536)>>8|b)>>1|b<<8;Q(this,a<<8);return a&255}function vc(a,b){var c=b-a;Nb(this,c,a,b);return c&65535}function wc(a,b){var c=b-a;Nb(this,c<<8,a<<8,b<<8);return c&255}
function xc(a,b){this.j&128||(this.s=this.l=b&65280,this.h=this.o=0);return(b<<8|b>>8)&65535}function yc(a,b){a^=b;O(this,a);return a&65535}function zc(a){var b=S(this,a);a=a>>6&7;var c=this.f[a];c&32768&&(c|=4294901760);this.o=this.h=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.o=c<<17-b,c>>=b;else if(b)if(16<b)this.h=c,c=0;else{this.o=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.h=32768)}this.f[a]=c&65535;this.s=this.l=c;this.a-=(this.g?6:7)+b}
function Ac(a){var b=S(this,a);a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.o=this.h=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.o=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.o=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.h=32768)):d=c;this.f[a]=d>>16&65535;this.f[a|1]=d&65535;this.s=d>>16;this.l=d>>16|d;this.a-=(this.g?6:7)+b}function W(a){a&1&&(this.o=0);a&2&&(this.h=0);a&4&&(this.l=1);a&8&&(this.s=0);this.a-=5}
function Bc(a){var b=S(this,a);if(b){a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.o=this.h=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.f[a]=d&65535,this.f[a|1]=c-d*b&65535,this.l=d>>16|d,this.s=d>>16):(this.h=32768,this.l=d>>15|d,this.s=c>>16,-1===b&&65534===this.f[a]&&(this.f[a]=this.f[a|1]=1));this.a-=53}else this.l=this.s=0,this.h=32768,this.o=65536,this.a-=7}var Cc=[0,7,7,10,7,11,9,13];function Dc(a){var b=this.a;a=Wb(this,a);this.f[7]=a&65535;this.a=b-Cc[this.g]}
var Ec=[0,14,14,17,14,18,16,20];function Fc(a){var b=this.a,c=Wb(this,a);a=a>>6&7;Ob(this,this.f[a]);this.f[a]=this.f[7];this.f[7]=c&65535;this.a=b-Ec[this.g]}var Gc=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],Hc=[7,13,13,17,14,18,17,21];function Ic(a){var b=S(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.f[a];c&32768&&(c|=-65536);b=~~(b*c);this.f[a]=b>>16&65535;this.f[a|1]=b&65535;this.j&128||(this.s=b>>16,this.l=this.s|b,this.h=0,this.o=-32768>b||32767<b?65536:0);this.a-=23}
function Jc(){this.a-=5}function X(a){a&1&&(this.o=65536);a&2&&(this.h=32768);a&4&&(this.l=0);a&8&&(this.s=32768);this.a-=5}function Kc(a){var b=(a&448)>>6;if(this.f[b]=this.f[b]-1&65535)this.f[7]=this.f[7]-((a&63)<<1)&65535,this.a+=1;this.a-=6}function Lc(a){U(this,a,0,xc);this.a-=this.g?9:3+(7==this.c?2:0)}function Mc(a){U(this,a,R(this,a),yc);this.a-=this.g?9:3+(7==this.c?2:0)}function Y(){F(this,8)}function Jb(a){Nc[a>>12].call(this,a)}
var Nc=[function(a){Oc[a>>8&15].call(this,a)},function(a){var b=R(this,a),c=this.a;O(this,Zb(this,a,b));this.a=c-Gc[(this.G?8:0)+this.g]+(7!=this.c||this.g?0:2)},function(a){var b=R(this,a);a=S(this,a);Nb(this,b-a,a,b);this.a-=this.g?4+(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){O(this,R(this,a)&S(this,a));this.a-=this.g?4+(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){U(this,a,R(this,a),fc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?
2:0)},function(a){U(this,a,R(this,a),hc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){U(this,a,R(this,a),$b);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){Pc[a>>8&15].call(this,a)},function(a){Qc[a>>8&15].call(this,a)},function(a){var b=Vb(this,a);O(this,Yb(this,a,b,1)<<8);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){var b=Vb(this,a)<<8;a=Xb(this,a)<<8;Nb(this,b-a,a,b);this.a-=this.g?4+
(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){O(this,(Vb(this,a)&Xb(this,a))<<8);this.a-=this.g?4+(this.H&&6<=this.c?1:0):(this.G?4:3)+(7==this.c?2:0)},function(a){T(this,a,Vb(this,a),gc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){T(this,a,Vb(this,a),ic);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},function(a){U(this,a,R(this,a),vc);this.a-=this.g?9+(this.H&&6<=this.c?1:0):(this.G?5:3)+(7==this.c?2:0)},Y],Oc=[function(a){Rc[a>>
4&15].call(this,a)},function(a){V(this,a,!0)},function(a){V(this,a,!!(this.l&65535))},function(a){V(this,a,this.l&65535?0:4)},function(a){V(this,a,!this.na()==!(this.h&32768))},function(a){V(this,a,!this.na()!=!(this.h&32768))},function(a){V(this,a,!!(this.l&65535)&&!this.na()==!(this.h&32768))},function(a){V(this,a,(this.l&65535?0:4)||!this.na()!=!(this.h&32768))},Fc,Fc,function(a){Sc[a>>6&3].call(this,a)},function(a){Tc[a>>6&3].call(this,a)},function(a){Uc[a>>6&3].call(this,a)},function(a){Vc[a>>
6&3].call(this,a)},Y,Y],Sc=[function(a){P(this,Zb(this,a,0));this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,jc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,1,nc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,1,lc);this.a-=this.g?9:3+(7==this.c?2:0)}],Tc=[function(a){U(this,a,0,pc);this.a-=this.g?11:6},function(a){U(this,a,N(this)?1:0,$b);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,N(this)?1:0,vc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){a=S(this,
a);P(this,a);this.a-=this.g?4:3+(7==this.c?2:0)}],Uc=[function(a){U(this,a,0,tc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,rc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,dc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){U(this,a,0,bc);this.a-=this.g?9:3+(7==this.c?2:0)}],Vc=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=this.ub(a|65536);this.f[7]=this.f[5]&65535;this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=Tb(this,a,0);Ob(this,a);O(this,a);this.a-=
11},function(a){var b=Qb(this),c=this.a;Ub(this,a,0,b);O(this,b);this.a=c-Hc[this.g]},function(a){O(this,Zb(this,a,this.na?65535:0));this.a-=this.g?9:3+(7==this.c?2:0)}],Rc=[function(a){Wc[a&15].call(this,a)},Y,Y,Y,Dc,Dc,Dc,Dc,function(a){if(a&8)F(this,8);else{var b=Qb(this);a&=7;this.f[7]=this.f[a]&65535;this.f[a]=b;this.a-=9}},function(a){a&8?(this.v&49152||(this.v=this.v&-2017|(a&7)<<5,this.j|=1),this.a-=5):F(this,8)},function(a){Xc[a&15].call(this,a)},function(a){Yc[a&15].call(this,a)},Lc,Lc,
Lc,Lc],Wc=[function(){this.v&49152?(this.F|=128,F(this,4)):L(this);this.a-=7},function(){this.j|=4;this.f[7]=this.f[7]+-2&65535;this.a-=3},function(){Pb(this);this.j|=this.v&16;this.a-=13},function(){F(this,12);this.a-=5},function(){F(this,16);this.a-=25},function(){this.v&49152||(Kb(this),this.m.reset());this.a-=667},function(){Pb(this);this.a-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],Xc=[Jc,function(){this.o=0;this.a-=5},function(){this.h=0;this.a-=5},W,function(){this.l=1;this.a-=5},W,W,W,function(){this.s=0;this.a-=
5},W,W,W,W,W,W,W],Yc=[Jc,function(){this.o=65536;this.a-=5},function(){this.h=32768;this.a-=5},X,function(){this.l=0;this.a-=5},X,X,X,function(){this.s=32768;this.a-=5},X,X,X,X,X,X,X],Pc=[Ic,Ic,Bc,Bc,zc,zc,Ac,Ac,Mc,Mc,Y,Y,Y,Y,Kc,Kc],Qc=[function(a){V(this,a,!this.na())},function(a){V(this,a,this.na())},function(a){V(this,a,!N(this)&&!!(this.l&65535))},function(a){V(this,a,N(this)||(this.l&65535?0:4))},function(a){V(this,a,!(this.h&32768))},function(a){V(this,a,this.h&32768?2:0)},function(a){V(this,
a,!N(this))},function(a){V(this,a,N(this))},function(){F(this,24);this.a-=25},function(){F(this,28);this.a-=5},function(a){Zc[a>>6&3].call(this,a)},function(a){$c[a>>6&3].call(this,a)},function(a){ad[a>>6&3].call(this,a)},function(a){bd[a>>6&3].call(this,a)},Y,Y],Zc=[function(a){P(this,Yb(this,a,0));this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,0,kc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,1,oc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,1,mc);this.a-=this.g?
9:3+(7==this.c?2:0)}],$c=[function(a){T(this,a,0,qc);this.a-=this.g?11:6},function(a){T(this,a,N(this)?1:0,ac);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,N(this)?1:0,wc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){a=Xb(this,a);P(this,a<<8);this.a-=this.g?4:3+(7==this.c?2:0)}],ad=[function(a){T(this,a,0,uc);this.a-=this.g?9+(this.Ta&1):3+(7==this.c?2:0)},function(a){T(this,a,0,sc);this.a-=this.g?9:3+(7==this.c?2:0)},function(a){T(this,a,0,ec);this.a-=this.g?9+(this.Ta&1):3+(7==this.c?
2:0)},function(a){T(this,a,0,cc);this.a-=this.g?9:3+(7==this.c?2:0)}],bd=[Y,function(a){a=Tb(this,a,65536);Ob(this,a);O(this,a);this.a-=11},function(a){var b=Qb(this),c=this.a;Ub(this,a,65536,b);O(this,b);this.a=c-Hc[this.g]},Y];
function cd(a){v.call(this,"ROM",a,cd);this.a=null;this.o=a.addr;this.c=a.size;this.s=a.writable;this.g=a.alias;this.h=a.file;this.u=ba(this.h);if(this.h){a=this.h;var b=ca(this.u);"json"!=b&&"hex"!=b&&(a=ea()+"/api/v1/dump?file="+this.h+"&format=bytes&decimal=true");var c=this;l(a,null,!0,function(a,b,f){dd(c,a,b,f)})}}x(cd);cd.prototype.oa=function(a,b,c,d){this.m=b;this.b=c;this.I=d;ed(this)};cd.prototype.ha=function(){this.l&&(this.I&&this.I.a(this.id,this.o,this.c,this.l),delete this.l);return!0};
cd.prototype.ga=function(){return!0};
function dd(a,b,c,d){if(d)a.K("Unable to load system ROM (error "+d+": "+b+")");else{Ga(a.Ua,b,c);var e;if("["==c.charAt(0)||"{"==c.charAt(0))try{var f,k,m=eval("("+c+")");if(f=m.bytes)a.a=f;else if(f=m.words)for(a.a=Array(2*f.length),k=e=0;e<f.length;e++)a.a[k++]=f[e]&255,a.a[k++]=f[e]>>8&255;else if(f=m.data)for(a.a=Array(4*f.length),k=e=0;e<f.length;e++)a.a[k++]=f[e]&255,a.a[k++]=f[e]>>8&255,a.a[k++]=f[e]>>16&255,a.a[k++]=f[e]>>24&255;else a.a=m;a.l=m.symbols;if(!a.a.length){p("Empty ROM: "+b);
return}if(1==a.a.length){p(a.a[0]);return}}catch(n){a.K("ROM data error: "+n.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.a=Array(b.length),e=0;e<b.length;e++)a.a[e]=aa(b[e]);ed(a)}}
function ed(a){if(!Ia(a))if(!a.h)D(a);else if(a.a&&a.m){a.c||(a.c=a.a.length);if(a.a.length!=a.c){var b="ROM size ("+h(a.a.length,8,!0)+") does not match specified size ("+h(a.c,8,!0)+")";a.i.error=!0;a.K(b)}else{b=a.o;if(Ua(a.m,b,a.c,a.s?1:ob)){var c;for(c=0;c<a.a.length;c++){var d=a.m,e=b+c;d.a[(e&d.h)>>>d.c].Ab(e&d.m,a.a[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.g?b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){for(var f=a,d=b[c],e=f.m,k=f.c,m=[],n=f.o>>>e.c;0<k&&
n<e.a.length;)m.push(e.a[n++]),k-=e.g;e=f.m;f=f.c;k=0;for(d>>>=e.c;0<f&&d<e.a.length;){n=m[k++];if(!n)break;e.a[d++]=n;f-=e.g}}delete a.a}}D(a)}}u(function(){for(var a=C(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new cd(d);B(d,c)}});function fd(a){v.call(this,"RAM",a,fd);this.g=a.addr;this.c=a.size;this.a=!1}x(fd);g=fd.prototype;g.oa=function(a,b,c,d){this.m=b;this.b=c;this.I=d;D(this)};g.ha=function(a,b){b||this.reset();return!0};g.ga=function(a){return a?this.save():!0};
g.reset=function(){!this.a&&this.c&&Ua(this.m,this.g,this.c,1)&&(this.a=!0);this.a||p("No RAM allocated")};g.save=function(){return null};g.restore=function(){return!0};u(function(){for(var a=C(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new fd(d);B(d,c)}});function gd(a){v.call(this,"Keyboard",a,gd);D(this)}x(gd);gd.prototype.R=function(){return!1};gd.prototype.oa=function(a,b,c,d){this.B=a;this.b=c;this.I=d};
u(function(){for(var a=C(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new gd(d);B(d,c)}});function Z(a){this.g=this.l=null;this.H=a.tabSize;this.A=a.charBOL;this.o=0;v.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.l="";else{var c;a=hd;b&&(void 0===c&&(c="Panel"),(c=z(c,this.id))&&(b=c.w[b])&&this.R(null,a,b))}this.s=this.u=null;this.exports={connect:this.ib,receiveData:this.Za}}x(Z);var hd="buffer";g=Z.prototype;
g.R=function(a,b,c){var d=this;switch(b){case hd:return this.w[b]=this.g=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.Za(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Za(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
g.oa=function(a,b,c,d){this.B=a;this.m=b;this.b=c;this.I=d;var e=this;this.J=cb(this.b,function(){e.a&128||!e.h.length||(e.G=e.h.shift(),e.a|=128,e.a&64&&db(e.b,40,4,48))});this.D=function(){e.c|=128;return!!(e.c&64)};ab(b,this,id);D(this)};
g.ib=function(){if(!this.s){var a=zb(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ha(b[0]);if(c!=this.Da)return;b=ha(b[1]);if(this.s=Ha(b)){var d=this.s.exports;if(d){var e=d.connect;e&&e.call(this.s);if(this.u=d.receiveData){this.status(this.Ua+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};g.ha=function(a,b){if(!b)if(this.ib(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
g.ga=function(a){return a?this.save():!0};g.reset=function(){jd(this)};g.save=function(){var a=new M(this);a.set(0,[]);return a.data()};g.restore=function(){return jd(this)};function jd(a){a.G=0;a.a=0;a.c=128;a.h=[];return!0}g.Za=function(a){if("number"==typeof a)this.h.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.h.push(a.charCodeAt(b));else this.h=this.h.concat(a);eb(this.b,this.J,50);return!0};g.dc=function(){return this.a&65535};g.Hc=function(a){this.a=this.a&-112|a&111};
g.cc=function(){this.a&=-129;0<this.h.length&&eb(this.b,this.J,50);return this.G};g.Gc=function(){};g.rc=function(){return this.c};g.Wc=function(a){128==(this.c&192)&&a&64&&db(this.b,8,4,52,this.D);this.c=this.c&-70|a&69};g.qc=function(){return 0};
g.Vc=function(a){if(a&=255){this.u&&this.u.call(this.s,a);if(this.g)if(13==a)this.o=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.o&&this.o--;else{var b;b=(b=ia[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.H||8,c=a-this.o%a,this.H&&(b=" ".slice(0,c)));this.A&&!this.o&&c&&(b=String.fromCharCode(this.A)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.o+=c}else if(null!=this.l){if(10==a||1024<=this.l.length)this.M(this.l),
this.l="";10!=a&&(this.l+=String.fromCharCode(a))}this.c&=-129;db(this.b,100,4,52,this.D)}};var kd={},id=(kd[65392]=[null,null,Z.prototype.dc,Z.prototype.Hc,"RCSR"],kd[65394]=[null,null,Z.prototype.cc,Z.prototype.Gc,"RBUF"],kd[65396]=[null,null,Z.prototype.rc,Z.prototype.Wc,"XCSR"],kd[65398]=[null,null,Z.prototype.qc,Z.prototype.Vc,"XBUF"],kd);u(function(){for(var a=C(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Z(d);B(d,c)}});
function ld(a,b,c){v.call(this,"Computer",a,ld);this.i.L=!1;md(this,b);this.A=zb(this,"autoPower",a);this.g=0;this.N=a.busWidth||a.buswidth;this.a=nd;this.u=null;this.o=this.H=!1;this.O=zb(this,"url")||"";(Math.random()+.1).toString(36);this.c=od(this);if(this.b=z("CPU",this.id)){this.I=z("Debugger",this.id);this.m=new Ma({id:this.Ua+".bus",busWidth:this.N},this.b,this.I);var d,e=y(this.id);if((this.h=z("Panel",this.id))&&this.h.Sa)for(b=0;b<e.length;b++)d=e[b],d.K=this.h.K,d.M=this.h.M,d.Sa=this.h.Sa;
this.M("PDPjs v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.M("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.oa&&d.oa(this,this.m,this.b,this.I);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.a=parseInt(d,10));var f;if(a=zb(this,"state")||(f=!0,a.state))b=this.D=a,f||(this.o=!0,this.a=nd),this.a&&(this.B=new M(this,
"1.30.1"),pd(this.B)?b=null:delete this.B);!b&&this.a&&(b=qd(this))&&(this.o=!0);if(b){var k=this;l(b,null,!0,function(a,b,c){c?(k.s=null,k.o=!1,k.K("Unable to load machine state from server (error "+c+(b?": "+ha(b):"")+")")):(k.u=b,k.H=!0);D(k)})}else D(this);this.w.power||(this.A=!0);!c&&this.A&&rd(this,this.Ba)}else p("Unable to find CPU component")}x(ld);var nd=0;
function md(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){p(d.message+" ("+c+")")}}a.J=b}function zb(a,b,c){var d=b.toLowerCase(),d=za[b]||za[d];void 0===d&&a.J&&(d=a.J[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function rd(a,b,c){for(var d=y(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ia(f)){Ia(f,function(){rd(a,b,c)});return}}b.call(a,c)}
function sd(a,b){var c=new M(a,"1.30.1","validate");if(pd(c)&&td(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.K("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}g=ld.prototype;
g.Ba=function(a){void 0===a&&(a=this.a||(this.u?1:nd));if(!this.g){this.g++;var b=!1,c=!1;this.G=!1;var d=this.B||new M(this,"1.30.1");if(-1==a)b=!0;else if(a>nd){if(pd(d,this.u)){this.l=new M(this,"1.30.1","failsafe");pd(this.l)&&(ud(this,d),a=2,vd(this.l));this.l.set("timestamp",ka());wd(this.l);var e=this.a&&!this.o;if(1==a||la("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=td(d)){var f=d.get("code"),k=d.get("data");f&&("ok"==f?pd(d,k):("error"==
f&&"no machine state"!=k?(this.K("Error: "+k),"unable to verify user"==k&&(pa("user",""),this.c=null)):this.M(f+": "+k),vd(d),pd(d)?(c=td(d),e=!0):c=!1))}e&&sd(this,c?d:null)}else 2==a&&d.clear()}else sd(this);delete this.u;delete this.B}e=y(this.id);for(f=0;f<e.length;f++)k=e[f],k!==this&&k!=this.b&&(c=xd(this,k,d,b,c));b=[d,a,c];-1!=a?rd(this,this.eb,b):this.eb(b)}};
function xd(a,b,c,d,e){if(!b.i.L){b.i.L=!0;if(b.ha){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ha(f,d)&&f&&(p("Unable to restore state for "+b.type),a.D&&!a.H?(c.clear(),a.a=nd,window&&window.location.reload()):a.G=!0,b.ha(null),e=!1)}if(!d&&b.jb)for(a=b.jb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
g.eb=function(a){var b=a[0],c=0>a[1];a=a[2];this.S=!0;this.i.L=!0;var d=this.w.power;d&&(d.textContent="Shutdown");this.b&&(xd(this,this.b,b,c,a),this.b.Aa());this.G&&(ud(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.g=0};
function ud(a,b){if(la("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.c||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.1"};d.url=a.O;d.user=c;d.type="bug";d.data=b;l("http://www.pcjs.org/api/v1/report",d,!0)}}
function yd(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new M(a,"1.30.1"),k=new M(a,"1.30.1","validate"),m=ka();k.set("timestamp",m);f.set("timestamp",m);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.ga&&(c&&L(a.b),d=a.b.ga(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.i.L=!1,!1===d&&(e=null)));for(var m=y(a.id),n=0;n<m.length;n++){var q=m[n];q.i.L&&(q.ga&&(d=q.ga(b,c),"object"===typeof d&&f.set(q.id,
d)),c&&(q.i.L=!1,!1===d&&(e=null)))}e&&(c?(m=d=!1,b?(a.c&&zd(a,a.c,f.toString()),wd(k)&&wd(f)||(e=null,d=m=!0)):a.a&&(d=!0,m=3==a.a),d&&f.clear(m)):e=f.toString());c&&(a.i.L=!1,b=a.w.power)&&(b.textContent="Power");a.g=0;return e}g.reset=function(){this.m&&this.m.reset&&this.m.reset();for(var a=y(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.m&&c.reset&&c.reset()}};g.start=function(a,b){for(var c=y(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};
g.stop=function(a,b){for(var c=y(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
g.R=function(a,b,c){var d=this;switch(b){case "power":return this.w[b]=c,c.onclick=function(){d.g||(d.i.L?xd(d,!1,!0):qd(d,d.Da))},!0;case "reset":return this.w[b]=c,c.onclick=function(){if(d.i.L&&!d.g)if(d.a&&!d.s){var a=la("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");xd(d,a,!0);!a&&d.D?window&&window.location.reload():d.Da(md)}else d.reset(),d.b&&d.b.Ca()},!0;case "save":if(da())c.parentNode.removeChild(c);else return this.w[b]=
c,c.onclick=function(){var a=nd(d,!0);if(a){var b=!!(d.a&&!d.s||d.D),c=xd(d,b);b?yd(d,a,c):d.K("Resume disabled, machine state not saved")}},!0}return!1};
function nd(a,b){var c=a.c;c||((c=oa("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=zd(a,c))||a.K("The user ID is invalid.")):b&&a.K("Browser local storage is not available"));return c}
function zd(a,b){a.c=null;b=l(ea()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(pa("user",b.data),a.c=b.data)}catch(d){p(d.message+" ("+c+")")}return a.c}function pd(a){var b=null;a.c&&(b=ea()+"/api/v1/user?req=load&user="+a.c+"&state="+Ad(a,"1.30.1"));return b}
function yd(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Ad(a,"1.30.1");d.data=c;b=l(ea()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.K("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.K(c),pa("user",""),a.c=null)}}
g.wa=function(a){this.b&&this.b.wa(a);this.h&&this.h.wa(a)};u(function(){for(var a=C(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=C(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],k=A(f),k=new kd(k,d,!0);B(k,f);k.B&&qd(k,k.Da)}});r.show.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=z("Computer",c.id))&&c.S&&!c.i.L&&c.Da(-1)}});
r.exit.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=z("Computer",c.id))&&c.i.L&&xd(c,!(!c.a||c.s),!0)}});function M(a,b,c){this.id=a.id;this.key=Ad(a,b,c);this.I=a.I;ud(this,a.Nb)}function Ad(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
M.prototype={constructor:M,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){ud(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function ud(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function vd(a){var b=!0;if(na()){var c=JSON.stringify(a[a.id]);pa(a.key,c)||(p("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function sd(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){p(c.message||c),b=!1}return b}function od(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:na()&&(b=oa(a.key))?(a[a.id]=b,a.a=!0):!1}var Bd=0;
function Cd(a,b,c,d,e,f){e("Loading "+a+"...");l(a,null,!0,function(k,m,n){n?(m||(m="unable to load "+a+" ("+n+")"),f(m,null)):Dd(m,a,b,c,d,e,f)})}
function Dd(a,b,c,d,e,f,k){function m(a,f){if(f)k(f,null);else{c&&(Ga(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(t){f=null,a=t.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);k(a,f)}}a?e?Ed(a,f,m):m(a,null):k("no data"+(b?" for file: "+b:""),null)}
function Ed(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");l(e,null,!0,function(f,k,m){if(m||!k)c(a,"unable to resolve XML reference: "+d[0]+" ("+m+")");else{if(f=d[3])if(m=k.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var n=m[0],q,t=/( [a-z]+=)(['"])(.*?)\2/g;q=t.exec(f);)n=0>n.indexOf(q[1])?n.replace(">",q[0]+">"):n.replace(new RegExp(q[1]+"(['\"])(.*?)\\1"),q[0]);m[0]!=n&&(k=k.replace(m[0],n))}else{c(a,"missing <"+d[1]+"> in "+e);return}k=k.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],k);Ed(a,b,c)}})}else c(a,null)}
function Fd(a,b,c,d){function e(a){if(void 0===m){var b=k&&C(k,"machine-warning");m=b&&b[0]||k}m&&(m.innerHTML=ga(a))}function f(a){e("Error: "+a);n&&(--Bd||wa(!0));n=!1}var k,m,n=!0;Bd++;Fa[a]={};try{if(k=document.getElementById(a)){var q;if("object"==typeof resources&&(q=resources.css)){var t=document.head||document.getElementsByTagName("head")[0],J=document.createElement("style");J.type="text/css";J.styleSheet?J.styleSheet.cssText=q:J.appendChild(document.createTextNode(q));t.appendChild(J)}c||
(c="/versions/pdp11/1.30.1/components.xsl");q=function(d,m){m?Cd(c,null,null,!1,e,function(d,n){n?(Ga(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(n=m.transformNode(n))?(k.outerHTML=n,--Bd||wa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(n),(n=d.transformToFragment(m,document))?k.parentNode?(k.parentNode.replaceChild(n,k),--Bd||wa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Cd(b,a,d,!0,e,q):Dd(b,null,a,d,!1,e,q)}else f("missing machine element: "+a)}catch(Ba){f(Ba.message)}return n}window.embedPDP11=function(a,b,c,d){wa(!1);return Fd(a,b,c,d)};window.enableEvents=wa;window.sendEvent=xa;})();
g.R=function(a,b,c){var d=this;switch(b){case "power":return this.w[b]=c,c.onclick=function(){d.g||(d.i.L?yd(d,!1,!0):rd(d,d.Ba))},!0;case "reset":return this.w[b]=c,c.onclick=function(){if(d.i.L&&!d.g)if(d.a&&!d.s){var a=la("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");yd(d,a,!0);!a&&d.D?window&&window.location.reload():d.Ba(nd)}else d.reset(),d.b&&d.b.Aa()},!0;case "save":if(da())c.parentNode.removeChild(c);else return this.w[b]=
c,c.onclick=function(){var a=od(d,!0);if(a){var b=!!(d.a&&!d.s||d.D),c=yd(d,b);b?zd(d,a,c):d.K("Resume disabled, machine state not saved")}},!0}return!1};
function od(a,b){var c=a.c;c||((c=oa("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Ad(a,c))||a.K("The user ID is invalid.")):b&&a.K("Browser local storage is not available"));return c}
function Ad(a,b){a.c=null;b=l(ea()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(pa("user",b.data),a.c=b.data)}catch(d){p(d.message+" ("+c+")")}return a.c}function qd(a){var b=null;a.c&&(b=ea()+"/api/v1/user?req=load&user="+a.c+"&state="+Bd(a,"1.30.1"));return b}
function zd(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Bd(a,"1.30.1");d.data=c;b=l(ea()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.K("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.K(c),pa("user",""),a.c=null)}}
g.wa=function(a){this.b&&this.b.wa(a);this.h&&this.h.wa(a)};u(function(){for(var a=C(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=C(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],k=A(f),k=new ld(k,d,!0);B(k,f);k.A&&rd(k,k.Ba)}});r.show.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=z("Computer",c.id))&&c.S&&!c.i.L&&c.Ba(-1)}});
r.exit.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=z("Computer",c.id))&&c.i.L&&yd(c,!(!c.a||c.s),!0)}});function M(a,b,c){this.id=a.id;this.key=Bd(a,b,c);this.I=a.I;vd(this,a.Nb)}function Bd(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
M.prototype={constructor:M,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){vd(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 vd(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function wd(a){var b=!0;if(na()){var c=JSON.stringify(a[a.id]);pa(a.key,c)||(p("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function td(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){p(c.message||c),b=!1}return b}function pd(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:na()&&(b=oa(a.key))?(a[a.id]=b,a.a=!0):!1}var Cd=0;
function Dd(a,b,c,d,e,f){e("Loading "+a+"...");l(a,null,!0,function(k,m,n){n?(m||(m="unable to load "+a+" ("+n+")"),f(m,null)):Ed(m,a,b,c,d,e,f)})}
function Ed(a,b,c,d,e,f,k){function m(a,f){if(f)k(f,null);else{c&&(Ga(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(t){f=null,a=t.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);k(a,f)}}a?e?Fd(a,f,m):m(a,null):k("no data"+(b?" for file: "+b:""),null)}
function Fd(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");l(e,null,!0,function(f,k,m){if(m||!k)c(a,"unable to resolve XML reference: "+d[0]+" ("+m+")");else{if(f=d[3])if(m=k.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var n=m[0],q,t=/( [a-z]+=)(['"])(.*?)\2/g;q=t.exec(f);)n=0>n.indexOf(q[1])?n.replace(">",q[0]+">"):n.replace(new RegExp(q[1]+"(['\"])(.*?)\\1"),q[0]);m[0]!=n&&(k=k.replace(m[0],n))}else{c(a,"missing <"+d[1]+"> in "+e);return}k=k.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],k);Fd(a,b,c)}})}else c(a,null)}
function Gd(a,b,c,d){function e(a){if(void 0===m){var b=k&&C(k,"machine-warning");m=b&&b[0]||k}m&&(m.innerHTML=ga(a))}function f(a){e("Error: "+a);n&&(--Cd||wa(!0));n=!1}var k,m,n=!0;Cd++;Fa[a]={};try{if(k=document.getElementById(a)){var q;if("object"==typeof resources&&(q=resources.css)){var t=document.head||document.getElementsByTagName("head")[0],J=document.createElement("style");J.type="text/css";J.styleSheet?J.styleSheet.cssText=q:J.appendChild(document.createTextNode(q));t.appendChild(J)}c||
(c="/versions/pdp11/1.30.1/components.xsl");q=function(d,m){m?Dd(c,null,null,!1,e,function(d,n){n?(Ga(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(n=m.transformNode(n))?(k.outerHTML=n,--Cd||wa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(n),(n=d.transformToFragment(m,document))?k.parentNode?(k.parentNode.replaceChild(n,k),--Cd||wa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Dd(b,a,d,!0,e,q):Ed(b,null,a,d,!1,e,q)}else f("missing machine element: "+a)}catch(Ba){f(Ba.message)}return n}window.embedPDP11=function(a,b,c,d){wa(!1);return Gd(a,b,c,d)};window.enableEvents=wa;window.sendEvent=xa;})();