From 34974661139e08c65a5bffd348d65d8361203328 Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 26 Sep 2016 16:53:37 -0700 Subject: [PATCH] Cleaned up interrupt handling, register initialization, MMU initialization, etc --- modules/pdp11/lib/cpu.js | 6 +- modules/pdp11/lib/cpustate.js | 2479 ++++++++++++++-------------- modules/pdp11/lib/debugger.js | 10 +- modules/pdp11/lib/defines.js | 8 - modules/pdp11/lib/device.js | 140 +- modules/shared/lib/debugger.js | 14 +- versions/pdp11/1.30.0/pdp11-dbg.js | 392 ++--- versions/pdp11/1.30.0/pdp11.js | 209 ++- 8 files changed, 1640 insertions(+), 1618 deletions(-) diff --git a/modules/pdp11/lib/cpu.js b/modules/pdp11/lib/cpu.js index 50b2c2de4..100a4a91c 100644 --- a/modules/pdp11/lib/cpu.js +++ b/modules/pdp11/lib/cpu.js @@ -1087,8 +1087,12 @@ CPUPDP11.prototype.runCPU = function(fUpdateFocus) this.stepCPU(nCyclesPerBurst); } catch(exception) { + /* + * We assume that any numeric exception was explicitly thrown by the CPU to interrupt the + * current instruction (and by extension, the current burst, but not the current run). All + * other exceptions are re-thrown to the catch below, which will attempt a stack dump. + */ if (typeof exception != "number") throw exception; - if (DEBUG) this.println("CPU exception: " + str.toHexWord(exception)); } /* diff --git a/modules/pdp11/lib/cpustate.js b/modules/pdp11/lib/cpustate.js index 82b619d98..a194c852e 100644 --- a/modules/pdp11/lib/cpustate.js +++ b/modules/pdp11/lib/cpustate.js @@ -89,6 +89,16 @@ function CPUStatePDP11(parmsCPU) Component.subclass(CPUStatePDP11, CPUPDP11); +/** + * @typedef {{ + * delay: number, + * priority: number, + * vector: number, + * callback: (function()|null|undefined) + * }} InterruptEvent + */ +var InterruptEvent; + /** * initProcessor() * @@ -139,21 +149,9 @@ CPUStatePDP11.prototype.initRegs = function() this.regsAltStack = [ // Alternate R6 stack pointers (kernel, super, illegal, user) 0, 0, 0, 0 ]; - this.regSL = 0xff; // 177774 - this.regPIR = 0; // 177772 - this.regCPUErr = 0; // 177766 - this.MMR0 = 0; // 177572 - this.MMR1 = 0; // 177574 - this.MMR2 = 0; // 177576 - this.MMR3 = 0; // 172516 this.mmuMode = 0; // current memory management mode (see PDP11.MODE.KERNEL | SUPER | UNUSED | USER) - this.mmuEnable = 0; // MMU enabled for PDP11.ACCESS.READ or PDP11.ACCESS.WRITE - this.mmuLastMode = 0; this.mmuLastPage = 0; this.mmuLastVirtual = 0; - this.mmuMask = [ // mask to control I&D access for each mode - 0x7, 0x7, 0x7, 0x7 - ]; this.mmuMap = [ // memory management register by mode - 16 PDR (8 I then 8 D descriptors) followed by 16 PAR (I/D addresses) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // kernel [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // super @@ -167,18 +165,13 @@ CPUStatePDP11.prototype.initRegs = function() this.controlReg = [ // various control registers we don't really care about 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; - this.regOp = -1; // current opcode this.opFlags = 0; - this.cpuType = 70; this.trapPSW = -1; - this.interruptQueue = []; // List of interrupts pending this.runState = 0; // 0=run, 1=step, 2=wait, 3=run this.loopRate = 9999; // instructions we can execute in 12ms - this.priorityReview = 2; // flag to mark if we need to check priority change - - this.initMemoryAccess(); + this.resetRegs(); }; /** @@ -188,32 +181,31 @@ CPUStatePDP11.prototype.initRegs = function() */ CPUStatePDP11.prototype.resetRegs = function() { - this.regSL = 0xff; - this.regCPUErr = 0; - this.interruptQueue = []; - this.regPIR = 0; - this.MMR0 = this.MMR1 = this.MMR2 = this.MMR3 = this.mmuFrozen = this.mmuEnable = 0; - this.mmuMask[0] = this.mmuMask[1] = this.mmuMask[3] = 0x7; + this.regSL = 0xff; // 177774 + this.regErr = 0; // 177766 + this.regPIR = 0; // 177772 + this.MMR0 = 0; // 177572 + this.MMR1 = 0; // 177574 + this.MMR2 = 0; // 177576 + this.MMR3 = 0; // 172516 + this.mmuEnable = 0; // MMU enabled for PDP11.ACCESS.READ or PDP11.ACCESS.WRITE this.mmuLastMode = 0; - + this.mmuMask = [ // mask to control I&D access for each mode + 0x7, 0x7, 0x7, 0x7 + ]; + /** + * @type {Array.} + */ + this.interruptQueue = []; // List of interrupts pending + this.priorityReview = 2; // flag to mark if we need to check priority change this.initMemoryAccess(); }; /** * initMemoryAccess() * - * Define getAddr(), readWord(), etc, handlers appropriate for the current MMU mode. - * - * The initial goal is to eliminate unnecessary calls to mapVirtualToPhysical(); for example, - * readWordFromVirtual() always does this: - * - * return this.readWordFromPhysical(this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.READ)); - * - * and getAddrVirtual() -- formerly getAddrByMode() -- always does this: - * - * return this.mapVirtualToPhysical(this.getVirtualByMode(addressMode, accessFlags), accessFlags); - * - * So now we define readWord() and getAddr() functions that are more appropriate for the current MMU mode. + * Define getAddr(), readWord(), etc, handlers appropriate for the current MMU mode, in order to + * eliminate unnecessary calls to mapVirtualToPhysical(). * * @this {CPUStatePDP11} */ @@ -230,6 +222,42 @@ CPUStatePDP11.prototype.initMemoryAccess = function() } }; +/** + * getMMR0() + * + * @this {CPUStatePDP11} + * @return {number} + */ +CPUStatePDP11.prototype.getMMR0 = function() +{ + return (this.MMR0 & 0xf381) | (this.mmuLastMode << 5) | (this.mmuLastPage << 1); +}; + +/** + * setMMR0() + * + * @this {CPUStatePDP11} + * @param {number} newMMR0 + * @return {number} + */ +CPUStatePDP11.prototype.setMMR0 = function(newMMR0) +{ + this.MMR0 = 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; + } + } else { + this.mmuEnable = 0; + } + this.initMemoryAccess(); + return this.MMR0; +}; + /** * getChecksum() * @@ -253,7 +281,7 @@ CPUStatePDP11.prototype.save = function() { var state = new State(this); state.set(0, []); - state.set(1, [this.intFlags, this.nTotalCycles, this.getSpeed()]); + state.set(1, [this.nTotalCycles, this.getSpeed()]); state.set(2, this.bus.saveMemory()); return state.data(); }; @@ -270,7 +298,6 @@ CPUStatePDP11.prototype.save = function() CPUStatePDP11.prototype.restore = function(data) { var a = data[1]; - this.intFlags = a[0]; this.nTotalCycles = a[1]; this.setSpeed(a[3]); return this.bus.restoreMemory(data[2]); @@ -499,45 +526,6 @@ CPUStatePDP11.prototype.getSP = function() return this.regsGen[6]; }; -/** - * checkINTR() - * - * @this {CPUStatePDP11} - * @return {boolean} true if execution may proceed, false if not - */ -CPUStatePDP11.prototype.checkINTR = function() -{ - if (this.intFlags & PDP11.INTFLAG.HALT) { - /* - * As discussed in opHLT(), the CPU is never REALLY halted by a HLT instruction; instead, opHLT() - * calls requestHALT(), which sets INTFLAG.HALT and signals to stepCPU() that it's free to end the - * current burst AND that it should not execute any more instructions until checkINTR() indicates - * that a hardware interrupt has been requested. - */ - this.endBurst(); - return false; - } - return true; -}; - -/** - * clearINTR(nLevel) - * - * Clear the corresponding interrupt level. - * - * nLevel can either be a valid interrupt level (0-7), or -1 to clear all pending interrupts - * (eg, in the event of a system-wide reset). - * - * @this {CPUStatePDP11} - * @param {number} nLevel (0-7, or -1 for all) - */ -CPUStatePDP11.prototype.clearINTR = function(nLevel) -{ - var bitsClear = nLevel < 0? 0xff : (1 << nLevel); - this.intFlags &= ~bitsClear; -}; - - /** * requestHALT() * @@ -545,7 +533,7 @@ CPUStatePDP11.prototype.clearINTR = function(nLevel) */ CPUStatePDP11.prototype.requestHALT = function() { - this.intFlags |= PDP11.INTFLAG.HALT; + // TODO: There will be more work to do than this.... this.endBurst(); }; @@ -602,6 +590,50 @@ CPUStatePDP11.prototype.interrupt = function(delay, priority, vector, callback) this.priorityReview = 2; }; +/** + * checkInterruptQueue() + * + * @this {CPUStatePDP11} + */ +CPUStatePDP11.prototype.checkInterruptQueue = function() +{ + if (this.priorityReview == 1) { + this.priorityReview = 2; // SPL delay + } else { + this.priorityReview = 0; + var interruptEvent = null; + var savePSW = this.regPIR & 0xe0; + for (var i = this.interruptQueue.length; --i >= 0;) { + if (this.interruptQueue[i].delay > 0) { + this.interruptQueue[i].delay--; + this.priorityReview = 2; + break; // Decrement only one delay 'difference' per cycle + } + //if (typeof this.interruptQueue[i].callback !== "undefined") { + if (this.interruptQueue[i].callback) { + if (!this.interruptQueue[i].callback()) { + this.interruptQueue.splice(i, 1); + continue; + } + //delete + this.interruptQueue[i].callback = null; + } + if (this.interruptQueue[i].priority > savePSW) { + savePSW = this.interruptQueue[i].priority; + interruptEvent = this.interruptQueue[i]; + this.interruptQueue.splice(i, 1); + } + } + if (savePSW > (this.PSW & 0xe0)) { + if (!interruptEvent) { + this.trap(PDP11.TRAP.PIRQ, 42); + } else { + this.trap(interruptEvent.vector, 44); + } + } + } +}; + /** * getPSW() * @@ -752,7 +784,7 @@ CPUStatePDP11.prototype.panic = function(reason) * * @this {CPUStatePDP11} * @param {number} vector - * @param {number} reason + * @param {number} [reason] */ CPUStatePDP11.prototype.trap = function(vector, reason) { @@ -783,7 +815,7 @@ CPUStatePDP11.prototype.trap = function(vector, reason) this.setPSW((newPSW & 0xcfff) | ((this.trapPSW >> 2) & 0x3000)); if (doubleTrap) { - this.regCPUErr |= PDP11.CPUERR.RED; + this.regErr |= PDP11.CPUERR.RED; this.regsGen[6] = 4; } @@ -793,7 +825,10 @@ CPUStatePDP11.prototype.trap = function(vector, reason) this.opFlags &= ~PDP11.OPFLAG.TRAP_MASK; // lose interest in traps after an abort this.trapPSW = -1; // reset flag that we have a trap within a trap - throw vector | (reason << 8); + + if (DEBUG) this.println("trap to vector " + str.toOct(vector, 3) + (reason? " (reason " + reason + ")" : "")); + + throw vector; }; /** @@ -878,7 +913,7 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFl physicalAddress |= BusPDP11.IOPAGE_22BIT; } else { // no max_memory check in 16 bit mode if ((physicalAddress & 1) && !(accessFlags & PDP11.ACCESS.BYTE)) { - this.regCPUErr |= PDP11.CPUERR.ODDADDR; + this.regErr |= PDP11.CPUERR.ODDADDR; this.trap(PDP11.TRAP.BUS_ERROR, 22); } } @@ -897,11 +932,11 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFl } if (physicalAddress < BusPDP11.IOPAGE_UNIBUS) { if (physicalAddress >= BusPDP11.MAX_MEMORY) { - this.regCPUErr |= PDP11.CPUERR.NOMEMORY; + this.regErr |= PDP11.CPUERR.NOMEMORY; this.trap(PDP11.TRAP.BUS_ERROR, 24); // KB11-EM does this after ABORT handling - KB11-CM before } if ((physicalAddress & 1) && !(accessFlags & PDP11.ACCESS.BYTE)) { - this.regCPUErr |= PDP11.CPUERR.ODDADDR; + this.regErr |= PDP11.CPUERR.ODDADDR; this.trap(PDP11.TRAP.BUS_ERROR, 26); } } @@ -1115,11 +1150,11 @@ CPUStatePDP11.prototype.pushWord = function(data) if ((!this.mmuMode) && virtualAddress <= this.regSL && virtualAddress > 4) { if (virtualAddress <= this.regSL - 32) { - this.regCPUErr |= PDP11.CPUERR.RED; + this.regErr |= PDP11.CPUERR.RED; this.regsGen[6] = 4; this.trap(PDP11.TRAP.BUS_ERROR, 32); } else { - this.regCPUErr |= PDP11.CPUERR.YELLOW; + this.regErr |= PDP11.CPUERR.YELLOW; this.opFlags |= 4; } } @@ -1179,11 +1214,11 @@ CPUStatePDP11.prototype.getVirtualByMode = function(addressMode, accessFlags) if (reg === 6 && (!this.mmuMode) && (accessFlags & PDP11.ACCESS.WRITE) && (this.regsGen[6] <= this.regSL || this.regsGen[6] >= 0xfffe)) { if (this.regsGen[6] <= this.regSL - 32 || this.regsGen[6] >= 0xfffe) { - this.regCPUErr |= PDP11.CPUERR.RED; + this.regErr |= PDP11.CPUERR.RED; this.regsGen[6] = 4; this.trap(PDP11.TRAP.BUS_ERROR, 36); } else { - this.regCPUErr |= PDP11.CPUERR.YELLOW; + this.regErr |= PDP11.CPUERR.YELLOW; this.opFlags |= PDP11.OPFLAG.TRAP_SP; } } @@ -1284,11 +1319,11 @@ CPUStatePDP11.prototype.getVirtualByMode = function(addressMode, accessFlags) if (reg === 6 && (!this.mmuMode) && (accessFlags & PDP11.ACCESS.WRITE) && stepSize <= 0 && (this.regsGen[6] <= this.regSL || this.regsGen[6] >= 0xfffe)) { if (this.regsGen[6] <= this.regSL - 32) { - this.regCPUErr |= PDP11.CPUERR.RED; + this.regErr |= PDP11.CPUERR.RED; this.regsGen[6] = 4; this.trap(PDP11.TRAP.BUS_ERROR, 38); } else { - this.regCPUErr |= PDP11.CPUERR.YELLOW; + this.regErr |= PDP11.CPUERR.YELLOW; this.opFlags |= PDP11.OPFLAG.TRAP_SP; } } @@ -1532,1170 +1567,1128 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles) */ this.nBurstCycles = this.nStepCycles = nMinCycles; - /* - * NOTE: If checkINTR() returns false, INTFLAG.HALT must be set, so no instructions should be executed. - */ - if (this.checkINTR()) { - do { - if (DEBUGGER && fDebugCheck) { - if (this.dbg.checkInstruction(this.getPC(), nDebugState)) { - this.stopCPU(); - break; - } - nDebugState = 1; + do { + if (DEBUGGER && fDebugCheck) { + if (this.dbg.checkInstruction(this.getPC(), nDebugState)) { + this.stopCPU(); + break; } + nDebugState = 1; + } - var opCode, - src, - dst, - dstAddr, - result, - virtualAddress, savePSW, reg, i, j; - - /* - * Check for any pending traps. - * - * I've moved this TRAP_MASK check BEFORE we decode the next instruction instead - * of immediately AFTER, because the last instruction may have thrown an exception, - * kicking us out before we reach the bottom of this loop. - */ - if (this.opFlags & PDP11.OPFLAG.TRAP_MASK) { - if (this.opFlags & PDP11.OPFLAG.TRAP_MMU) { - this.trap(PDP11.TRAP.MMU_FAULT, 52); // MMU trap has priority + /* + * Check for any pending traps. + * + * I've moved this TRAP_MASK check BEFORE we decode the next instruction instead + * of immediately AFTER, because the last instruction may have thrown an exception, + * kicking us out before we reach the bottom of this loop. + */ + if (this.opFlags & PDP11.OPFLAG.TRAP_MASK) { + if (this.opFlags & PDP11.OPFLAG.TRAP_MMU) { + this.trap(PDP11.TRAP.MMU_FAULT, 52); // MMU trap has priority + } else { + if (this.opFlags & PDP11.OPFLAG.TRAP_SP) { + this.trap(PDP11.TRAP.BUS_ERROR, 54); // then SP trap } else { - if (this.opFlags & PDP11.OPFLAG.TRAP_SP) { - this.trap(PDP11.TRAP.BUS_ERROR, 54); // then SP trap - } else { - if (this.opFlags & PDP11.OPFLAG.TRAP_TF) { - this.trap(PDP11.TRAP.BREAKPOINT, 56); // and finally a TF trap - } - } - } - this.opFlags &= ~PDP11.OPFLAG.TRAP_MASK; - } - - if (this.priorityReview) { // if nothing has changed don't check priority - if (this.priorityReview === 1) { - this.priorityReview = 2; // SPL delay - } else { - this.priorityReview = 0; - j = -1; - savePSW = this.regPIR & 0xe0; - if ((i = this.interruptQueue.length) > 0) { - while (i-- > 0) { - if (this.interruptQueue[i].delay > 0) { - this.interruptQueue[i].delay--; - this.priorityReview = 2; - break; // Decrement only one delay 'difference' per cycle - } - //if (typeof this.interruptQueue[i].callback !== "undefined") { - if (this.interruptQueue[i].callback) { - if (!this.interruptQueue[i].callback()) { - this.interruptQueue.splice(i, 1); - j--; - continue; - } - //delete - this.interruptQueue[i].callback = null; - } - if (this.interruptQueue[i].priority > savePSW) { - savePSW = this.interruptQueue[i].priority; - j = i; - } - } - } - if (savePSW > (this.PSW & 0xe0)) { - if (j < 0) { - this.trap(PDP11.TRAP.PIRQ, 42); - } else { - this.trap(this.interruptQueue[j].vector, 44); - this.interruptQueue.splice(j, 1); - } + if (this.opFlags & PDP11.OPFLAG.TRAP_TF) { + this.trap(PDP11.TRAP.BREAKPOINT, 56); // and finally a TF trap } } } + this.opFlags &= ~PDP11.OPFLAG.TRAP_MASK; + } - if (!(this.MMR0 & 0xe000)) { - this.MMR1 = 0; - this.MMR2 = this.regsGen[7]; - } + if (this.priorityReview) { + this.checkInterruptQueue(); + } - /* - * Snapshot the TF bit in opFlags, while simultaneously clearing all other opFlags; - * we'll check the TRAP_TF bit in opFlags when we come back around for another opcode. - */ - this.opFlags = this.PSW & PDP11.PSW.TF; + if (!(this.MMR0 & 0xe000)) { + this.MMR1 = 0; + this.MMR2 = this.regsGen[7]; + } - /* - * TODO: Determine (later) if this.regOp is a useful (internal) register to maintain; - * perhaps it would alleviate lots of opCode parameter-passing. In the meantime, we use - * it to detect if our new decode() function has processed (ie, "consumed") the opcode, - * by setting it to -1. If it has, then we can skip the older opcode decode logic below. - */ - this.regOp = opCode = this.readWordFromVirtual(this.regsGen[7]); - if (opCode >= 0) this.regsGen[7] = (this.regsGen[7] + 2) & 0xffff; + /* + * Snapshot the TF bit in opFlags, while simultaneously clearing all other opFlags; + * we'll check the TRAP_TF bit in opFlags when we come back around for another opcode. + */ + this.opFlags = this.PSW & PDP11.PSW.TF; - this.decode(opCode); + /* + * TODO: Determine (later) if this.regOp is a useful (internal) register to maintain; + * perhaps it would alleviate lots of opCode parameter-passing. In the meantime, we use + * it to detect if our new decode() function has processed (ie, "consumed") the opcode, + * by setting it to -1. If it has, then we can skip the older opcode decode logic below. + */ + var opCode = this.regOp = this.readWordFromVirtual(this.regsGen[7]); + if (opCode >= 0) this.regsGen[7] = (this.regsGen[7] + 2) & 0xffff; - if (this.regOp < 0) { - this.regsGen[7] = (this.regsGen[7] - 2) & 0xffff; - this.println("unimplemented"); - break; - } + this.decode(opCode); - switch (opCode & 0xF000) /*0170000*/ { // Double operand instructions xxSSDD - case 0x1000: /*0010000*/ // MOV 01SSDD - //LOG_INSTRUCTION(opCode, 2, "MOV"); - // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { - // if (!(opCode & 0x38)) { - // this.regsGen[opCode & 7] = src; - // this.flagN = this.flagZ = src; - // this.flagV = 0; - // } else { - // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE)) >= 0) { - // if (this.writeWordToPhysical(dstAddr, src) >= 0) { - // this.flagN = this.flagZ = src; - // this.flagV = 0; - // } - // } - // } - // } - break; - case 0x2000: /*0020000*/ // CMP 02SSDD - //LOG_INSTRUCTION(opCode, 2, "CMP"); - // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { - // if ((dst = this.readWordByMode(opCode)) >= 0) { - // result = src - dst; - // this.flagN = this.flagZ = this.flagC = result; - // this.flagV = (src ^ dst) & (src ^ result); - // } - // } - break; - case 0x3000: /*0030000*/ // BIT 03SSDD - //LOG_INSTRUCTION(opCode, 2, "BIT"); - // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { - // if ((dst = this.readWordByMode(opCode)) >= 0) { - // this.flagN = this.flagZ = src & dst; - // this.flagV = 0; - // } - // } - break; - case 0x4000: /*0040000*/ // BIC 04SSDD - //LOG_INSTRUCTION(opCode, 2, "BIC"); - // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { - // if (!(opCode & 0x38)) { - // result = this.regsGen[opCode & 7] &= ~src; - // this.flagN = this.flagZ = result; - // this.flagV = 0; - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= 0) { - // result = dst & ~src; - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = result; - // this.flagV = 0; - // } - // } - // } - // } - break; - case 0x5000: /*0050000*/ // BIS 05SSDD - //LOG_INSTRUCTION(opCode, 2, "BIS"); - // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { - // if (!(opCode & 0x38)) { - // result = this.regsGen[opCode & 7] |= src; - // this.flagN = this.flagZ = result; - // this.flagV = 0; - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= 0) { - // result = dst | src; - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = result; - // this.flagV = 0; - // } - // } - // } - // } - break; - case 0x6000: /*0060000*/ // ADD 06SSDD - //LOG_INSTRUCTION(opCode, 2, "ADD"); - // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // dst = this.regsGen[reg]; - // this.regsGen[reg] = (result = src + dst) & 0xffff; - // this.flagN = this.flagZ = this.flagC = result; - // this.flagV = (src ^ result) & (dst ^ result); - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= 0) { - // result = src + dst; - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = this.flagC = result; - // this.flagV = (src ^ result) & (dst ^ result); - // } - // } - // } - // } - break; - case 0x9000: /*0110000*/ // MOVB 11SSDD - //LOG_INSTRUCTION(opCode, 2, "MOVB"); - // if ((src = this.readByteByMode(opCode >> 6)) >= 0) { - // if (!(opCode & 0x38)) { - // if (src & 0x80) /*0200*/ src |= 0xff00; // movb sign extends register to word size - // this.regsGen[opCode & 7] = src; - // this.flagN = this.flagZ = src; - // this.flagV = 0; - // } else { - // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE_BYTE)) >= 0) { // write byte - // if (this.writeByteToPhysical(dstAddr, src) >= 0) { - // this.flagN = this.flagZ = src << 8; - // this.flagV = 0; - // } - // } - // } - // } - break; - case 0xA000: /*0120000*/ // CMPB 12SSDD - //LOG_INSTRUCTION(opCode, 2, "CMPB"); - // if ((src = this.readByteByMode(opCode >> 6)) >= 0) { - // if ((dst = this.readByteByMode(opCode)) >= 0) { - // result = src - dst; - // this.flagN = this.flagZ = this.flagC = result << 8; - // this.flagV = ((src ^ dst) & (src ^ result)) << 8; - // } - // } - break; - case 0xB000: /*0130000*/ // BITB 13SSDD - //LOG_INSTRUCTION(opCode, 2, "BITB"); - // if ((src = this.readByteByMode(opCode >> 6)) >= 0) { - // if ((dst = this.readByteByMode(opCode)) >= 0) { - // this.flagN = this.flagZ = (src & dst) << 8; - // this.flagV = 0; - // } - // } - break; - case 0xC000: /*0140000*/ // BICB 14SSDD - //LOG_INSTRUCTION(opCode, 2, "BICB"); - // if ((src = this.readByteByMode(opCode >> 6)) >= 0) { - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= 0) { - // result = dst & ~src; - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = result << 8; - // this.flagV = 0; - // } - // } - // } - break; - case 0xD000: /*0150000*/ // BISB 15SSDD - //LOG_INSTRUCTION(opCode, 2, "BISB"); - // if ((src = this.readByteByMode(opCode >> 6)) >= 0) { - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= 0) { - // result = dst | src; - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = result << 8; - // this.flagV = 0; - // } - // } - // } - break; - case 0xE000: /*0160000*/ // SUB 16SSDD - //LOG_INSTRUCTION(opCode, 2, "SUB"); - // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // dst = this.regsGen[reg]; - // this.regsGen[reg] = (result = dst - src) & 0xffff; - // this.flagN = this.flagZ = this.flagC = result; - // this.flagV = (src ^ dst) & (dst ^ result); - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= 0) { - // result = dst - src; - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = this.flagC = result; - // this.flagV = (src ^ dst) & (dst ^ result); - // } - // } - // } - // } - break; - default: - // switch (opCode & 0xFE00) /*0177000*/ { // Misc instructions xxRDD - // case 0x800: /*04000*/ // JSR 004RDD - // //LOG_INSTRUCTION(opCode, 3, "JSR"); - // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - // reg = (opCode >> 6) & 7; - // if (this.pushWord(this.regsGen[reg]) >= 0) { - // this.regsGen[reg] = this.regsGen[7]; - // this.regsGen[7] = virtualAddress & 0xffff; - // } - // } - // break; - // case 0x7000: /*0070000*/ // MUL 070RSS - // //LOG_INSTRUCTION(opCode, 3, "MUL"); - // if ((src = this.readWordByMode(opCode)) >= 0) { - // reg = (opCode >> 6) & 7; - // if (src & 0x8000) src |= ~0xffff; - // dst = this.regsGen[reg]; - // if (dst & 0x8000) dst |= ~0xffff; - // result = ~~(src * dst); - // this.regsGen[reg] = (result >> 16) & 0xffff; - // this.regsGen[reg | 1] = result & 0xffff; - // this.flagN = result >> 16; - // this.flagZ = this.flagN | result; - // this.flagC = this.flagV = 0; - // if (result < -32768 || result > 32767) this.flagC = 0x10000; - // } - // break; - // case 0x7200: /*0071000*/ // DIV 071RSS - // //LOG_INSTRUCTION(opCode, 3, "DIV"); - // if ((src = this.readWordByMode(opCode)) >= 0) { - // if (!src) { - // this.flagN = 0; // NZVC - // this.flagZ = 0; - // this.flagV = 0x8000; - // this.flagC = 0x10000; // divide by zero - // } else { - // reg = (opCode >> 6) & 7; - // dst = (this.regsGen[reg] << 16) | this.regsGen[reg | 1]; - // this.flagC = this.flagV = 0; - // if (src & 0x8000) src |= ~0xffff; - // result = ~~(dst / src); - // if (result >= -32768 && result <= 32767) { - // this.regsGen[reg] = result & 0xffff; - // this.regsGen[reg | 1] = (dst - (result * src)) & 0xffff; - // this.flagZ = (result >> 16) | result; - // this.flagN = result >> 16; - // } else { - // this.flagV = 0x8000; // overflow - following are indeterminate - // this.flagZ = (result >> 15) | result; // dodgy - // this.flagN = dst >> 16; // just as dodgy - // if (src === -1 && this.regsGen[reg] === - // 0xfffe) this.regsGen[reg] = this.regsGen[reg | 1] = 1; // etc - // } - // } - // } - // break; - // case 0x7400: /*072000*/ // ASH 072RSS - // //LOG_INSTRUCTION(opCode, 3, "ASH"); - // if ((src = this.readWordByMode(opCode)) >= 0) { - // reg = (opCode >> 6) & 7; - // result = this.regsGen[reg]; - // if (result & 0x8000) result |= 0xffff0000; - // this.flagC = this.flagV = 0; - // src &= 0x3F; /*077*/ - // if (src & 0x20) /*040*/ { // shift right - // src = 64 - src; - // if (src > 16) src = 16; - // this.flagC = result << (17 - src); - // result = result >> src; - // } else { - // if (src) { - // if (src > 16) { - // this.flagV = result; - // result = 0; - // } else { - // result = result << src; - // this.flagC = result; - // dst = (result >> 15) & 0xffff; // check successive sign bits - // if (dst && dst !== 0xffff) this.flagV = 0x8000; - // } - // } - // } - // this.regsGen[reg] = result & 0xffff; - // this.flagN = this.flagZ = result; - // } - // break; - // case 0x7600: /*073000*/ // ASHC 073RSS - // //LOG_INSTRUCTION(opCode, 3, "ASHC"); - // if ((src = this.readWordByMode(opCode)) >= 0) { - // reg = (opCode >> 6) & 7; - // dst = (this.regsGen[reg] << 16) | this.regsGen[reg | 1]; - // this.flagC = this.flagV = 0; - // src &= 0x3F; /*077*/ - // if (src & 0x20) /*040*/ { - // src = 64 - src; - // if (src > 32) src = 32; - // result = dst >> (src - 1); - // this.flagC = result << 16; - // result >>= 1; - // if (dst & 0x80000000) result |= 0xffffffff << (32 - src); - // } else { - // if (src) { // shift left - // result = dst << (src - 1); - // this.flagC = result >> 15; - // result <<= 1; - // if (src > 32) src = 32; - // dst = dst >> (32 - src); - // if (dst) { - // dst |= (0xffffffff << src) & 0xffffffff; - // if (dst !== 0xffffffff) this.flagV = 0x8000; - // } - // } else { - // result = dst; - // } - // } - // this.regsGen[reg] = (result >> 16) & 0xffff; - // this.regsGen[reg | 1] = result & 0xffff; - // this.flagN = result >> 16; - // this.flagZ = result >> 16 | result; - // } - // break; - // case 0x7800: /*0074000*/ // XOR 074RSS - // //LOG_INSTRUCTION(opCode, 3, "XOR"); - // if (!(opCode & 0x38)) { - // dst = this.regsGen[opCode & 7] ^= this.regsGen[(opCode >> 6) & 7]; - // this.flagN = this.flagZ = dst; - // this.flagV = 0; - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= 0) { - // dst ^= this.regsGen[(opCode >> 6) & 7]; - // if (this.writeWordToPhysical(dstAddr, dst) >= 0) { - // this.flagN = this.flagZ = dst; - // this.flagV = 0; - // } - // } - // } - // break; - // case 0x7E00: /*0077000*/ // SOB 077Rnn - // //LOG_INSTRUCTION(opCode, 5, "SOB"); - // reg = (opCode >> 6) & 7; - // if ((this.regsGen[reg] = ((this.regsGen[reg] - 1) & 0xffff))) { - // this.regsGen[7] = (this.regsGen[7] - ((opCode & 0x3F) /*077*/ << 1)) & 0xffff; - // } - // break; - // default: - // switch (opCode & 0xFF00) /*0177400*/ { // Program control instructions & traps - // case 0x100: /*0000400*/ // BR - // //LOG_INSTRUCTION(opCode, 4, "BR"); - // this.regsGen[7] = this.branch(opCode); - // break; - // case 0x200: /*0001000*/ // BNE - // //LOG_INSTRUCTION(opCode, 4, "BNE"); - // if (this.flagZ & 0xffff) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x300: /*0001400*/ // BEQ - // //LOG_INSTRUCTION(opCode, 4, "BEQ"); - // if (!(this.flagZ & 0xffff)) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x400: /*0002000*/ // BGE - // //LOG_INSTRUCTION(opCode, 4, "BGE"); - // if ((this.flagN & 0x8000) === - // (this.flagV & 0x8000)) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x500: /*0002400*/ // BLT - // //LOG_INSTRUCTION(opCode, 4, "BLT"); - // if ((this.flagN & 0x8000) !== - // (this.flagV & 0x8000)) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x600: /*0003000*/ // BGT - // //LOG_INSTRUCTION(opCode, 4, "BGT"); - // if ((this.flagZ & 0xffff) && ((this.flagN & 0x8000) === - // (this.flagV & 0x8000))) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x700: /*0003400*/ // BLE - // //LOG_INSTRUCTION(opCode, 4, "BLE"); - // if (!(this.flagZ & 0xffff) || ((this.flagN & 0x8000) !== - // (this.flagV & 0x8000))) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x8000: /*0100000*/ // BPL - // //LOG_INSTRUCTION(opCode, 4, "BPL"); - // if (!(this.flagN & 0x8000)) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x8200: /*0101000*/ // BHI - // //LOG_INSTRUCTION(opCode, 4, "BHI"); - // if (!(this.flagC & 0x10000) && - // (this.flagZ & 0xffff)) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x8100: /*0100400*/ // BMI - // //LOG_INSTRUCTION(opCode, 4, "BMI"); - // if ((this.flagN & 0x8000)) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x8300: /*0101400*/ // BLOS - // //LOG_INSTRUCTION(opCode, 4, "BLOS"); - // if ((this.flagC & 0x10000) || - // !(this.flagZ & 0xffff)) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x8400: /*0102000*/ // BVC - // //LOG_INSTRUCTION(opCode, 4, "BVC"); - // if (!(this.flagV & 0x8000)) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x8500: /*0102400*/ // BVS - // //LOG_INSTRUCTION(opCode, 4, "BVS"); - // if ((this.flagV & 0x8000)) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x8600: /*0103000*/ // BCC - // //LOG_INSTRUCTION(opCode, 4, "BCC"); - // if (!(this.flagC & - // 0x10000)) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x8700: /*0103400*/ // BCS - // //LOG_INSTRUCTION(opCode, 4, "BCS"); - // if (this.flagC & 0x10000) this.regsGen[7] = this.branch(opCode); - // break; - // case 0x8800: /*0104000*/ // EMT 104000 -> 104377 - // //LOG_INSTRUCTION(opCode, 7, "EMT"); - // this.trap(PDP11.TRAP.EMULATOR, /*030*/ 2); - // break; - // case 0x8900: /*0104400*/ // TRAP 104400 -> 104777 - // //LOG_INSTRUCTION(opCode, 7, "TRAP"); - // this.trap(PDP11.TRAP.TRAP, /*034*/ 4); - // break; - // default: - // switch (opCode & 0xFFC0) /*0177700*/ { // Single operand instructions xxxxDD - // case 0x40: /*0000100*/ // JMP 0001DD - // //LOG_INSTRUCTION(opCode, 1, "JMP"); - // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - // this.regsGen[7] = virtualAddress & 0xffff; - // } - // break; - // case 0xC0: /*0000300*/ // SWAB 0003DD - // //LOG_INSTRUCTION(opCode, 1, "SWAB"); - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // dst = this.regsGen[reg]; - // this.regsGen[reg] = ((dst << 8) | (dst >> 8)) & 0xffff; - // this.flagN = this.flagZ = dst & 0xff00; - // this.flagV = this.flagC = 0; - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= - // 0) { - // result = (dst << 8) | (dst >> 8); - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = dst & 0xff00; - // this.flagV = this.flagC = 0; - // } - // } - // } - // break; - // case 0xA00: /*0005000*/ // CLR 0050DD - // //LOG_INSTRUCTION(opCode, 1, "CLR"); - // // if (!(opCode & 0x38)) { - // // this.regsGen[opCode & 7] = 0; - // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; - // // } else { - // // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE)) >= 0) { // write word - // // if (this.writeWordToPhysical(dstAddr, 0) >= 0) { - // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; - // // } - // // } - // // } - // break; - // case 0xA40: /*0005100*/ // COM 0051DD - // //LOG_INSTRUCTION(opCode, 1, "COM"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - // 0) { - // result = ~dst; - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = result; - // this.flagC = 0x10000; - // this.flagV = 0; - // } - // } - // break; - // case 0xA80: /*0005200*/ // INC 0052DD - // //LOG_INSTRUCTION(opCode, 1, "INC"); - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // dst = this.regsGen[reg]; - // result = dst + 1; - // this.regsGen[reg] = result & 0xffff; - // this.flagN = this.flagZ = result; - // this.flagV = result & (result ^ dst); - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - // 0) { - // result = dst + 1; - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = result; - // this.flagV = result & (result ^ dst); - // } - // } - // } - // break; - // case 0xAC0: /*0005300*/ // DEC 0053DD - // //LOG_INSTRUCTION(opCode, 1, "DEC"); - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // dst = this.regsGen[reg]; - // result = dst - 1; - // this.regsGen[reg] = result & 0xffff; - // this.flagN = this.flagZ = result; - // this.flagV = (result ^ dst) & dst; - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - // 0) { - // result = dst - 1; - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = result; - // this.flagV = (result ^ dst) & dst; - // } - // } - // } - // break; - // case 0xB00: /*0005400*/ // NEG 0054DD - // //LOG_INSTRUCTION(opCode, 1, "NEG"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - // 0) { - // result = -dst; - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagC = this.flagN = this.flagZ = result; - // this.flagV = result & dst; - // } - // } - // break; - // case 0xB40: /*0005500*/ // ADC 0055DD - // //LOG_INSTRUCTION(opCode, 1, "ADC"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - // 0) { - // result = dst + ((this.flagC >> 16) & 1); - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagC = this.flagN = this.flagZ = result; - // this.flagV = result & (result ^ dst); - // } - // } - // break; - // case 0xB80: /*0005600*/ // SBC 0056DD - // //LOG_INSTRUCTION(opCode, 1, "SBC"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - // 0) { - // result = dst - ((this.flagC >> 16) & 1); - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagC = this.flagN = this.flagZ = result; - // this.flagV = (result ^ dst) & dst; - // } - // } - // break; - // case 0xBC0: /*0005700*/ // TST 0057DD - // //LOG_INSTRUCTION(opCode, 1, "TST"); - // if ((dst = this.readWordByMode(opCode)) >= 0) { - // this.flagN = this.flagZ = dst; - // this.flagC = this.flagV = 0; - // } - // break; - // case 0xC00: /*0006000*/ // ROR 0060DD - // //LOG_INSTRUCTION(opCode, 1, "ROR"); - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // dst = this.regsGen[reg]; - // result = ((this.flagC & 0x10000) | dst) >> 1; - // this.regsGen[reg] = result & 0xffff; - // this.flagC = (dst << 16); - // this.flagN = this.flagZ = result; - // this.flagV = result ^ (this.flagC >> 1); - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - // 0) { - // result = ((this.flagC & 0x10000) | dst) >> 1; - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagC = (dst << 16); - // this.flagN = this.flagZ = result; - // this.flagV = result ^ (this.flagC >> 1); - // } - // } - // } - // break; - // case 0xC40: /*0006100*/ // ROL 0061DD - // //LOG_INSTRUCTION(opCode, 1, "ROL"); - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // dst = this.regsGen[reg]; - // result = (dst << 1) | ((this.flagC >> 16) & 1); - // this.regsGen[reg] = result & 0xffff; - // this.flagC = this.flagN = this.flagZ = result; - // this.flagV = result ^ dst; - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - // 0) { - // result = (dst << 1) | ((this.flagC >> 16) & 1); - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagC = this.flagN = this.flagZ = result; - // this.flagV = result ^ dst; - // } - // } - // } - // break; - // case 0xC80: /*0006200*/ // ASR 0062DD - // //LOG_INSTRUCTION(opCode, 1, "ASR"); - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // dst = this.regsGen[reg]; - // result = (dst & 0x8000) | (dst >> 1); - // this.regsGen[reg] = result & 0xffff; - // this.flagC = dst << 16; - // this.flagN = this.flagZ = result; - // this.flagV = this.flagN ^ (this.flagC >> 1); - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - // 0) { - // result = (dst & 0x8000) | (dst >> 1); - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagC = dst << 16; - // this.flagN = this.flagZ = result; - // this.flagV = this.flagN ^ (this.flagC >> 1); - // } - // } - // } - // break; - // case 0xCC0: /*0006300*/ // ASL 0063DD - // //LOG_INSTRUCTION(opCode, 1, "ASL"); - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // dst = this.regsGen[reg]; - // result = dst << 1; - // this.regsGen[reg] = result & 0xffff; - // this.flagC = this.flagN = this.flagZ = result; - // this.flagV = result ^ dst; - // } else { - // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - // 0) { - // result = dst << 1; - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagC = this.flagN = this.flagZ = result; - // this.flagV = result ^ dst; - // } - // } - // } - // break; - // case 0xD00: /*0006400*/ // MARK 0064nn - // //LOG_INSTRUCTION(opCode, 8, "MARK"); - // virtualAddress = (this.regsGen[7] + ((opCode & 0x3F) /*077*/ << 1)) & 0xffff; - // if ((src = this.readWordFromVirtual(virtualAddress | PDP11.ACCESS.DSPACE)) >= 0) { - // this.regsGen[7] = this.regsGen[5]; - // this.regsGen[5] = src; - // this.regsGen[6] = (virtualAddress + 2) & 0xffff; - // } - // break; - // case 0xD40: /*0006500*/ // MFPI 0065SS - // //LOG_INSTRUCTION(opCode, 1, "MFPI"); - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { - // src = this.regsGen[reg]; - // } else { - // src = this.regsAltStack[(this.PSW >> 12) & 3]; - // } - // if (this.pushWord(src) >= 0) { - // this.flagN = this.flagZ = src; - // this.flagV = 0; - // } - // } else { - // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - // if ((this.PSW & 0xf000) !== 0xf000) virtualAddress &= 0xffff; - // this.mmuMode = (this.PSW >> 12) & 3; - // if ((src = this.readWordFromVirtual(virtualAddress)) >= 0) { - // this.mmuMode = (this.PSW >> 14) & 3; - // if (this.pushWord(src) >= 0) { - // this.flagN = this.flagZ = src; - // this.flagV = 0; - // } - // } - // } - // } - // break; - // case 0xD80: /*0006600*/ // MTPI 0066DD - // //LOG_INSTRUCTION(opCode, 1, "MTPI"); - // if ((dst = this.popWord()) >= 0) { - // if (!(this.MMR0 & 0xe000)) this.MMR1 = 0x16; /*026*/ - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { - // this.regsGen[reg] = dst; - // } else { - // this.regsAltStack[(this.PSW >> 12) & 3] = dst; - // } - // this.flagN = this.flagZ = dst; - // this.flagV = 0; - // } else { - // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - // virtualAddress &= 0xffff; - // this.mmuMode = (this.PSW >> 12) & 3; - // if ((dstAddr = this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.WRITE)) >= 0) { - // this.mmuMode = (this.PSW >> 14) & 3; - // if (this.writeWordToPhysical(dstAddr, dst) >= 0) { - // this.flagN = this.flagZ = dst; - // this.flagV = 0; - // } - // } - // } - // } - // } - // break; - // case 0xDC0: /*0006700*/ // SXT 0067DD - // //LOG_INSTRUCTION(opCode, 1, "SXT"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE)) >= 0) { // write word - // result = -((this.flagN >> 15) & 1); - // if (this.writeWordToPhysical(dstAddr, result) >= 0) { - // this.flagZ = result; - // this.flagV = 0; - // } - // } - // break; - // case 0x8A00: /*0105000*/ // CLRB 1050DD - // //LOG_INSTRUCTION(opCode, 1, "CLRB"); - // // if (!(opCode & 0x38)) { - // // this.regsGen[opCode & 7] &= 0xff00; - // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; - // // } else { - // // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE_BYTE)) >= 0) { // write byte - // // if (this.writeByteToPhysical(dstAddr, 0) >= 0) { - // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; - // // } - // // } - // // } - // break; - // case 0x8A40: /*0105100*/ // COMB 1051DD - // //LOG_INSTRUCTION(opCode, 1, "COMB"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - // 0) { - // result = ~dst; - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = result << 8; - // this.flagC = 0x10000; - // this.flagV = 0; - // } - // } - // break; - // case 0x8A80: /*0105200*/ // INCB 1052DD - // //LOG_INSTRUCTION(opCode, 1, "INCB"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - // 0) { - // result = dst + 1; - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = result << 8; - // this.flagV = (result & (result ^ dst)) << 8; - // } - // } - // break; - // case 0x8AC0: /*0105300*/ // DECB 1053DD - // //LOG_INSTRUCTION(opCode, 1, "DECB"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - // 0) { - // result = dst - 1; - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = result << 8; - // this.flagV = ((result ^ dst) & dst) << 8; - // } - // } - // break; - // case 0x8B00: /*0105400*/ // NEGB 1054DD - // //LOG_INSTRUCTION(opCode, 1, "NEGB"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - // 0) { - // result = -dst; - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagC = this.flagN = this.flagZ = result << 8; - // this.flagV = (result & dst) << 8; - // } - // } - // break; - // case 0x8B40: /*0105500*/ // ADCB 01055DD - // //LOG_INSTRUCTION(opCode, 1, "ADCB"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - // 0) { - // result = dst + ((this.flagC >> 16) & 1); - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = this.flagC = result << 8; - // this.flagV = (result & (result ^ dst)) << 8; - // } - // } - // break; - // case 0x8B80: /*0105600*/ // SBCB 01056DD - // //LOG_INSTRUCTION(opCode, 1, "SBCB"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - // 0) { - // result = dst - ((this.flagC >> 16) & 1); - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagN = this.flagZ = this.flagC = result << 8; - // this.flagV = ((result ^ dst) & dst) << 8; - // } - // } - // break; - // case 0x8BC0: /*0105700*/ // TSTB 1057DD - // //LOG_INSTRUCTION(opCode, 1, "TSTB"); - // if ((dst = this.readByteByMode(opCode)) >= 0) { - // this.flagN = this.flagZ = dst << 8; - // this.flagC = this.flagV = 0; - // } - // break; - // case 0x8C00: /*0106000*/ // RORB 1060DD - // //LOG_INSTRUCTION(opCode, 1, "RORB"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - // 0) { - // result = (((this.flagC & 0x10000) >> 8) | dst) >> 1; - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagC = (dst << 16); - // this.flagN = this.flagZ = (result << 8); - // this.flagV = this.flagN ^ (this.flagC >> 1); - // } - // } - // break; - // case 0x8C40: /*0106100*/ // ROLB 1061DD - // //LOG_INSTRUCTION(opCode, 1, "ROLB"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - // 0) { - // result = (dst << 1) | ((this.flagC >> 16) & 1); - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagC = this.flagN = this.flagZ = result << 8; - // this.flagV = (result ^ dst) << 8; - // } - // } - // break; - // case 0x8C80: /*0106200*/ // ASRB 1062DD - // //LOG_INSTRUCTION(opCode, 1, "ASRB"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - // 0) { - // result = (dst & 0x80) | (dst >> 1); - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagC = dst << 16; - // this.flagN = this.flagZ = result << 8; - // this.flagV = this.flagN ^ (this.flagC >> 1); - // } - // } - // break; - // case 0x8CC0: /*0106300*/ // ASLB 1063DD - // //LOG_INSTRUCTION(opCode, 1, "ASLB"); - // /* - // * TODO: Here's an example where getAddr() could be called in the register-only case. - // */ - // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - // 0) { - // result = dst << 1; - // if (this.writeByteToPhysical(dstAddr, result) >= 0) { - // this.flagC = this.flagN = this.flagZ = result << 8; - // this.flagV = (result ^ dst) << 8; - // } - // } - // break; - // //case 0106400: // MTPS 1064SS - // // //LOG_INSTRUCTION(opCode, 1, "MTPS"); - // // if ((src = this.readByteByMode(instruction)) >= 0) { - // // this.setPSW((this.PSW & 0xff00) | (src & 0xef)); - // // } // Temporary PDP 11/34A - // // break; - // case 0x8D40: /*0106500*/ // MFPD 1065DD - // //LOG_INSTRUCTION(opCode, 1, "MFPD"); - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { - // src = this.regsGen[reg]; - // } else { - // src = this.regsAltStack[(this.PSW >> 12) & 3]; - // } - // if (this.pushWord(src) >= 0) { - // this.flagN = this.flagZ = src; - // this.flagV = 0; - // } - // } else { - // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - // this.mmuMode = (this.PSW >> 12) & 3; - // if ((src = this.readWordFromVirtual(virtualAddress | PDP11.ACCESS.DSPACE)) >= 0) { - // this.mmuMode = (this.PSW >> 14) & 3; - // if (this.pushWord(src) >= 0) { - // this.flagN = this.flagZ = src; - // this.flagV = 0; - // } - // } - // } - // } - // break; - // case 0x8D80: /*0106600*/ // MTPD 1066DD - // //LOG_INSTRUCTION(opCode, 1, "MTPD"); - // if ((dst = this.popWord()) >= 0) { - // if (!(this.MMR0 & 0xe000)) this.MMR1 = 0x16; /*026*/ - // if (!(opCode & 0x38)) { - // reg = opCode & 7; - // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { - // this.regsGen[reg] = dst; - // } else { - // this.regsAltStack[(this.PSW >> 12) & 3] = dst; - // } - // this.flagN = this.flagZ = dst; - // this.flagV = 0; - // } else { - // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - // this.mmuMode = (this.PSW >> 12) & 3; - // if ((dstAddr = this.mapVirtualToPhysical(virtualAddress | PDP11.ACCESS.DSPACE, PDP11.ACCESS.WRITE)) >= 0) { - // this.mmuMode = (this.PSW >> 14) & 3; - // if (this.writeWordToPhysical(dstAddr, dst) >= 0) { - // this.flagN = this.flagZ = dst; - // this.flagV = 0; - // } - // } - // } - // } - // } - // break; - // //case 0106700: // MTFS 1064SS - // // //LOG_INSTRUCTION(opCode, 1, "MFPS"); - // // src = this.getPSW() & 0xff; - // // if (instruction & 0x38) { - // // if ((dstAddr = this.getAddr(instruction, PDP11.ACCESS.WRITE_BYTE)) >= 0) { // write byte - // // if (this.writeByteToPhysical(dstAddr, src) >= 0) { - // // this.flagN = this.flagZ = src << 8; - // // this.flagV = 0; - // // } - // // } - // // } else { - // // if (src & 0200) src |= 0xff00; - // // this.regsGen[instruction & 7] = src; - // // this.flagN = this.flagZ = src << 8; - // // this.flagV = 0; - // // } // Temporary PDP 11/34A - // // break; - // default: - // switch (opCode & 0xFFF8) /*0177770*/ { // Single register instructions xxxxxR (and CC) - // case 0x80: /*0000200*/ // RTS 00020R - // //LOG_INSTRUCTION(opCode, 6, "RTS"); - // if ((src = this.popWord()) >= 0) { - // reg = opCode & 7; - // this.regsGen[7] = this.regsGen[reg]; - // this.regsGen[reg] = src; - // } - // break; - // case 0x98: /*0000230*/ // SPL 00023N - // //LOG_INSTRUCTION(opCode, 9, "SPL"); - // if (!(this.PSW & 0xc000)) { - // this.PSW = (this.PSW & 0xf81f) | ((opCode & 7) << 5); - // this.priorityReview = 1; - // } - // break; - // case 0xA0: /*0000240*/ // CLR CC 00024M Part 1 without N - // case 0xA8: /*0000250*/ // CLR CC 00025M Part 2 with N - // // if (opCode & 1) this.clearCF(); // CLC - // // if (opCode & 2) this.clearVF(); // CLV - // // if (opCode & 4) this.clearZF(); // CLZ - // // if (opCode & 8) this.clearNF(); // CLN - // break; - // case 0xB0: /*0000260*/ // SET CC 00026M Part 1 without N - // case 0xB8: /*0000270*/ // SET CC 00026M Part 2 with N - // // if (opCode & 1) this.setCF(); // SEC - // // if (opCode & 2) this.setVF(); // SEV - // // if (opCode & 4) this.setZF(); // SEZ - // // if (opCode & 8) this.setNF(); // SEN - // break; - // default: // Misc instructions (decode ALL remaining bits) xxxxxx - // switch (opCode) { - // case 0x0: /*0000000*/ // HALT 000000 - // //LOG_INSTRUCTION(opCode, 0, "HALT"); - // if (0xc000 & this.PSW) { - // this.regCPUErr |= PDP11.CPUERR.BADHALT; - // this.trap(PDP11.TRAP.BUS_ERROR, 46); - // } else { - // this.runState = 3; // halt - // this.endBurst(); - // //LOG_PRINT(); - // console.log("HALT at " + this.regsGen[7].toString(8)); - // } - // break; - // case 0x1: /*0000001*/ // WAIT 000001 - // //LOG_INSTRUCTION(opCode, 0, "WAIT"); - // j = 0; - // if ((i = this.interruptQueue.length) > 0) { - // while (i-- > 0) { - // j += this.interruptQueue[i].delay; - // this.interruptQueue[i].delay = 0; - // } - // } - // if (j === 0 && this.runState === 0) { - // this.runState = 2; // wait - // this.endBurst(); - // } - // break; - // case 0x3: /*0000003*/ // BPT 000003 - // //LOG_INSTRUCTION(opCode, 0, "BPT"); - // this.trap(PDP11.TRAP.BREAKPOINT, /*014*/ 6); - // break; - // case 0x4: /*0000004*/ // IOT 000004 - // //LOG_INSTRUCTION(opCode, 0, "IOT"); - // this.trap(PDP11.TRAP.IOT, /*020*/ 8); - // break; - // case 0x5: /*0000005*/ // RESET 000005 - // //LOG_INSTRUCTION(opCode, 0, "RESET"); - // // if (!(this.PSW & 0xc000)) { - // // this.resetRegs(); - // // this.bus.reset(); - // // // display.data = this.regsGen[0]; // TODO: Review - // // } - // break; - // case 0x2: /*0000002*/ // RTI 000002 - // case 0x6: /*0000006*/ // RTT 000006 - // //LOG_INSTRUCTION(opCode, 0, "RTT"); - // dstAddr = this.regsGen[6]; - // if ((virtualAddress = this.readWordFromVirtual(dstAddr | PDP11.ACCESS.DSPACE)) >= 0) { - // dstAddr = (dstAddr + 2) & 0xffff; - // if ((savePSW = this.readWordFromVirtual(dstAddr | PDP11.ACCESS.DSPACE)) >= 0) { - // this.regsGen[6] = (dstAddr + 2) & 0xffff; - // savePSW &= 0xf8ff; - // if (this.PSW & 0xc000) { // user / super restrictions - // // keep SPL and allow lower only for modes and register set - // savePSW = (savePSW & 0xf81f) | (this.PSW & 0xf8e0); - // } - // this.regsGen[7] = virtualAddress; - // this.setPSW(savePSW); - // this.opFlags &= ~PDP11.OPFLAG.TRAP_TF; - // if (opCode === 2) { // RTI enables immediate trace - // this.opFlags |= (this.PSW & PDP11.PSW.TF); - // } - // } - // } - // break; - // //case 0000007: // MFPT 000007 - // // //LOG_INSTRUCTION(opCode, 0, "MFPT"); - // // this.regsGen[0] = 1; - // // break; // Exists on pdp 11/44 & KB11-EM - // default: // We don't know this instruction - // //LOG_INSTRUCTION(opCode, 11, "-unknown-"); - // this.trap(PDP11.TRAP.RESERVED, /*010*/ 48); // reserved instruction - // break; - // } - // } - // } - // } - // } - } - } while (this.nStepCycles > 0); - } + if (this.regOp < 0) { + this.regsGen[7] = (this.regsGen[7] - 2) & 0xffff; + this.println("unimplemented"); + break; + } + + // var opCode, + // src, + // dst, + // dstAddr, + // result, + // virtualAddress, savePSW, reg, i, j; + + switch (opCode & 0xF000) /*0170000*/ { // Double operand instructions xxSSDD + case 0x1000: /*0010000*/ // MOV 01SSDD + //LOG_INSTRUCTION(opCode, 2, "MOV"); + // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { + // if (!(opCode & 0x38)) { + // this.regsGen[opCode & 7] = src; + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } else { + // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE)) >= 0) { + // if (this.writeWordToPhysical(dstAddr, src) >= 0) { + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } + // } + // } + // } + break; + case 0x2000: /*0020000*/ // CMP 02SSDD + //LOG_INSTRUCTION(opCode, 2, "CMP"); + // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { + // if ((dst = this.readWordByMode(opCode)) >= 0) { + // result = src - dst; + // this.flagN = this.flagZ = this.flagC = result; + // this.flagV = (src ^ dst) & (src ^ result); + // } + // } + break; + case 0x3000: /*0030000*/ // BIT 03SSDD + //LOG_INSTRUCTION(opCode, 2, "BIT"); + // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { + // if ((dst = this.readWordByMode(opCode)) >= 0) { + // this.flagN = this.flagZ = src & dst; + // this.flagV = 0; + // } + // } + break; + case 0x4000: /*0040000*/ // BIC 04SSDD + //LOG_INSTRUCTION(opCode, 2, "BIC"); + // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { + // if (!(opCode & 0x38)) { + // result = this.regsGen[opCode & 7] &= ~src; + // this.flagN = this.flagZ = result; + // this.flagV = 0; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= 0) { + // result = dst & ~src; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result; + // this.flagV = 0; + // } + // } + // } + // } + break; + case 0x5000: /*0050000*/ // BIS 05SSDD + //LOG_INSTRUCTION(opCode, 2, "BIS"); + // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { + // if (!(opCode & 0x38)) { + // result = this.regsGen[opCode & 7] |= src; + // this.flagN = this.flagZ = result; + // this.flagV = 0; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= 0) { + // result = dst | src; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result; + // this.flagV = 0; + // } + // } + // } + // } + break; + case 0x6000: /*0060000*/ // ADD 06SSDD + //LOG_INSTRUCTION(opCode, 2, "ADD"); + // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // this.regsGen[reg] = (result = src + dst) & 0xffff; + // this.flagN = this.flagZ = this.flagC = result; + // this.flagV = (src ^ result) & (dst ^ result); + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= 0) { + // result = src + dst; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = this.flagC = result; + // this.flagV = (src ^ result) & (dst ^ result); + // } + // } + // } + // } + break; + case 0x9000: /*0110000*/ // MOVB 11SSDD + //LOG_INSTRUCTION(opCode, 2, "MOVB"); + // if ((src = this.readByteByMode(opCode >> 6)) >= 0) { + // if (!(opCode & 0x38)) { + // if (src & 0x80) /*0200*/ src |= 0xff00; // movb sign extends register to word size + // this.regsGen[opCode & 7] = src; + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } else { + // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE_BYTE)) >= 0) { // write byte + // if (this.writeByteToPhysical(dstAddr, src) >= 0) { + // this.flagN = this.flagZ = src << 8; + // this.flagV = 0; + // } + // } + // } + // } + break; + case 0xA000: /*0120000*/ // CMPB 12SSDD + //LOG_INSTRUCTION(opCode, 2, "CMPB"); + // if ((src = this.readByteByMode(opCode >> 6)) >= 0) { + // if ((dst = this.readByteByMode(opCode)) >= 0) { + // result = src - dst; + // this.flagN = this.flagZ = this.flagC = result << 8; + // this.flagV = ((src ^ dst) & (src ^ result)) << 8; + // } + // } + break; + case 0xB000: /*0130000*/ // BITB 13SSDD + //LOG_INSTRUCTION(opCode, 2, "BITB"); + // if ((src = this.readByteByMode(opCode >> 6)) >= 0) { + // if ((dst = this.readByteByMode(opCode)) >= 0) { + // this.flagN = this.flagZ = (src & dst) << 8; + // this.flagV = 0; + // } + // } + break; + case 0xC000: /*0140000*/ // BICB 14SSDD + //LOG_INSTRUCTION(opCode, 2, "BICB"); + // if ((src = this.readByteByMode(opCode >> 6)) >= 0) { + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= 0) { + // result = dst & ~src; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result << 8; + // this.flagV = 0; + // } + // } + // } + break; + case 0xD000: /*0150000*/ // BISB 15SSDD + //LOG_INSTRUCTION(opCode, 2, "BISB"); + // if ((src = this.readByteByMode(opCode >> 6)) >= 0) { + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= 0) { + // result = dst | src; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result << 8; + // this.flagV = 0; + // } + // } + // } + break; + case 0xE000: /*0160000*/ // SUB 16SSDD + //LOG_INSTRUCTION(opCode, 2, "SUB"); + // if ((src = this.readWordByMode(opCode >> 6)) >= 0) { + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // this.regsGen[reg] = (result = dst - src) & 0xffff; + // this.flagN = this.flagZ = this.flagC = result; + // this.flagV = (src ^ dst) & (dst ^ result); + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= 0) { + // result = dst - src; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = this.flagC = result; + // this.flagV = (src ^ dst) & (dst ^ result); + // } + // } + // } + // } + break; + default: + // switch (opCode & 0xFE00) /*0177000*/ { // Misc instructions xxRDD + // case 0x800: /*04000*/ // JSR 004RDD + // //LOG_INSTRUCTION(opCode, 3, "JSR"); + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // reg = (opCode >> 6) & 7; + // if (this.pushWord(this.regsGen[reg]) >= 0) { + // this.regsGen[reg] = this.regsGen[7]; + // this.regsGen[7] = virtualAddress & 0xffff; + // } + // } + // break; + // case 0x7000: /*0070000*/ // MUL 070RSS + // //LOG_INSTRUCTION(opCode, 3, "MUL"); + // if ((src = this.readWordByMode(opCode)) >= 0) { + // reg = (opCode >> 6) & 7; + // if (src & 0x8000) src |= ~0xffff; + // dst = this.regsGen[reg]; + // if (dst & 0x8000) dst |= ~0xffff; + // result = ~~(src * dst); + // this.regsGen[reg] = (result >> 16) & 0xffff; + // this.regsGen[reg | 1] = result & 0xffff; + // this.flagN = result >> 16; + // this.flagZ = this.flagN | result; + // this.flagC = this.flagV = 0; + // if (result < -32768 || result > 32767) this.flagC = 0x10000; + // } + // break; + // case 0x7200: /*0071000*/ // DIV 071RSS + // //LOG_INSTRUCTION(opCode, 3, "DIV"); + // if ((src = this.readWordByMode(opCode)) >= 0) { + // if (!src) { + // this.flagN = 0; // NZVC + // this.flagZ = 0; + // this.flagV = 0x8000; + // this.flagC = 0x10000; // divide by zero + // } else { + // reg = (opCode >> 6) & 7; + // dst = (this.regsGen[reg] << 16) | this.regsGen[reg | 1]; + // this.flagC = this.flagV = 0; + // if (src & 0x8000) src |= ~0xffff; + // result = ~~(dst / src); + // if (result >= -32768 && result <= 32767) { + // this.regsGen[reg] = result & 0xffff; + // this.regsGen[reg | 1] = (dst - (result * src)) & 0xffff; + // this.flagZ = (result >> 16) | result; + // this.flagN = result >> 16; + // } else { + // this.flagV = 0x8000; // overflow - following are indeterminate + // this.flagZ = (result >> 15) | result; // dodgy + // this.flagN = dst >> 16; // just as dodgy + // if (src === -1 && this.regsGen[reg] === + // 0xfffe) this.regsGen[reg] = this.regsGen[reg | 1] = 1; // etc + // } + // } + // } + // break; + // case 0x7400: /*072000*/ // ASH 072RSS + // //LOG_INSTRUCTION(opCode, 3, "ASH"); + // if ((src = this.readWordByMode(opCode)) >= 0) { + // reg = (opCode >> 6) & 7; + // result = this.regsGen[reg]; + // if (result & 0x8000) result |= 0xffff0000; + // this.flagC = this.flagV = 0; + // src &= 0x3F; /*077*/ + // if (src & 0x20) /*040*/ { // shift right + // src = 64 - src; + // if (src > 16) src = 16; + // this.flagC = result << (17 - src); + // result = result >> src; + // } else { + // if (src) { + // if (src > 16) { + // this.flagV = result; + // result = 0; + // } else { + // result = result << src; + // this.flagC = result; + // dst = (result >> 15) & 0xffff; // check successive sign bits + // if (dst && dst !== 0xffff) this.flagV = 0x8000; + // } + // } + // } + // this.regsGen[reg] = result & 0xffff; + // this.flagN = this.flagZ = result; + // } + // break; + // case 0x7600: /*073000*/ // ASHC 073RSS + // //LOG_INSTRUCTION(opCode, 3, "ASHC"); + // if ((src = this.readWordByMode(opCode)) >= 0) { + // reg = (opCode >> 6) & 7; + // dst = (this.regsGen[reg] << 16) | this.regsGen[reg | 1]; + // this.flagC = this.flagV = 0; + // src &= 0x3F; /*077*/ + // if (src & 0x20) /*040*/ { + // src = 64 - src; + // if (src > 32) src = 32; + // result = dst >> (src - 1); + // this.flagC = result << 16; + // result >>= 1; + // if (dst & 0x80000000) result |= 0xffffffff << (32 - src); + // } else { + // if (src) { // shift left + // result = dst << (src - 1); + // this.flagC = result >> 15; + // result <<= 1; + // if (src > 32) src = 32; + // dst = dst >> (32 - src); + // if (dst) { + // dst |= (0xffffffff << src) & 0xffffffff; + // if (dst !== 0xffffffff) this.flagV = 0x8000; + // } + // } else { + // result = dst; + // } + // } + // this.regsGen[reg] = (result >> 16) & 0xffff; + // this.regsGen[reg | 1] = result & 0xffff; + // this.flagN = result >> 16; + // this.flagZ = result >> 16 | result; + // } + // break; + // case 0x7800: /*0074000*/ // XOR 074RSS + // //LOG_INSTRUCTION(opCode, 3, "XOR"); + // if (!(opCode & 0x38)) { + // dst = this.regsGen[opCode & 7] ^= this.regsGen[(opCode >> 6) & 7]; + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= 0) { + // dst ^= this.regsGen[(opCode >> 6) & 7]; + // if (this.writeWordToPhysical(dstAddr, dst) >= 0) { + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } + // } + // } + // break; + // case 0x7E00: /*0077000*/ // SOB 077Rnn + // //LOG_INSTRUCTION(opCode, 5, "SOB"); + // reg = (opCode >> 6) & 7; + // if ((this.regsGen[reg] = ((this.regsGen[reg] - 1) & 0xffff))) { + // this.regsGen[7] = (this.regsGen[7] - ((opCode & 0x3F) /*077*/ << 1)) & 0xffff; + // } + // break; + // default: + // switch (opCode & 0xFF00) /*0177400*/ { // Program control instructions & traps + // case 0x100: /*0000400*/ // BR + // //LOG_INSTRUCTION(opCode, 4, "BR"); + // this.regsGen[7] = this.branch(opCode); + // break; + // case 0x200: /*0001000*/ // BNE + // //LOG_INSTRUCTION(opCode, 4, "BNE"); + // if (this.flagZ & 0xffff) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x300: /*0001400*/ // BEQ + // //LOG_INSTRUCTION(opCode, 4, "BEQ"); + // if (!(this.flagZ & 0xffff)) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x400: /*0002000*/ // BGE + // //LOG_INSTRUCTION(opCode, 4, "BGE"); + // if ((this.flagN & 0x8000) === + // (this.flagV & 0x8000)) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x500: /*0002400*/ // BLT + // //LOG_INSTRUCTION(opCode, 4, "BLT"); + // if ((this.flagN & 0x8000) !== + // (this.flagV & 0x8000)) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x600: /*0003000*/ // BGT + // //LOG_INSTRUCTION(opCode, 4, "BGT"); + // if ((this.flagZ & 0xffff) && ((this.flagN & 0x8000) === + // (this.flagV & 0x8000))) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x700: /*0003400*/ // BLE + // //LOG_INSTRUCTION(opCode, 4, "BLE"); + // if (!(this.flagZ & 0xffff) || ((this.flagN & 0x8000) !== + // (this.flagV & 0x8000))) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x8000: /*0100000*/ // BPL + // //LOG_INSTRUCTION(opCode, 4, "BPL"); + // if (!(this.flagN & 0x8000)) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x8200: /*0101000*/ // BHI + // //LOG_INSTRUCTION(opCode, 4, "BHI"); + // if (!(this.flagC & 0x10000) && + // (this.flagZ & 0xffff)) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x8100: /*0100400*/ // BMI + // //LOG_INSTRUCTION(opCode, 4, "BMI"); + // if ((this.flagN & 0x8000)) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x8300: /*0101400*/ // BLOS + // //LOG_INSTRUCTION(opCode, 4, "BLOS"); + // if ((this.flagC & 0x10000) || + // !(this.flagZ & 0xffff)) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x8400: /*0102000*/ // BVC + // //LOG_INSTRUCTION(opCode, 4, "BVC"); + // if (!(this.flagV & 0x8000)) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x8500: /*0102400*/ // BVS + // //LOG_INSTRUCTION(opCode, 4, "BVS"); + // if ((this.flagV & 0x8000)) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x8600: /*0103000*/ // BCC + // //LOG_INSTRUCTION(opCode, 4, "BCC"); + // if (!(this.flagC & + // 0x10000)) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x8700: /*0103400*/ // BCS + // //LOG_INSTRUCTION(opCode, 4, "BCS"); + // if (this.flagC & 0x10000) this.regsGen[7] = this.branch(opCode); + // break; + // case 0x8800: /*0104000*/ // EMT 104000 -> 104377 + // //LOG_INSTRUCTION(opCode, 7, "EMT"); + // this.trap(PDP11.TRAP.EMULATOR, /*030*/ 2); + // break; + // case 0x8900: /*0104400*/ // TRAP 104400 -> 104777 + // //LOG_INSTRUCTION(opCode, 7, "TRAP"); + // this.trap(PDP11.TRAP.TRAP, /*034*/ 4); + // break; + // default: + // switch (opCode & 0xFFC0) /*0177700*/ { // Single operand instructions xxxxDD + // case 0x40: /*0000100*/ // JMP 0001DD + // //LOG_INSTRUCTION(opCode, 1, "JMP"); + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // this.regsGen[7] = virtualAddress & 0xffff; + // } + // break; + // case 0xC0: /*0000300*/ // SWAB 0003DD + // //LOG_INSTRUCTION(opCode, 1, "SWAB"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // this.regsGen[reg] = ((dst << 8) | (dst >> 8)) & 0xffff; + // this.flagN = this.flagZ = dst & 0xff00; + // this.flagV = this.flagC = 0; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_WORD))) >= + // 0) { + // result = (dst << 8) | (dst >> 8); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = dst & 0xff00; + // this.flagV = this.flagC = 0; + // } + // } + // } + // break; + // case 0xA00: /*0005000*/ // CLR 0050DD + // //LOG_INSTRUCTION(opCode, 1, "CLR"); + // // if (!(opCode & 0x38)) { + // // this.regsGen[opCode & 7] = 0; + // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; + // // } else { + // // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE)) >= 0) { // write word + // // if (this.writeWordToPhysical(dstAddr, 0) >= 0) { + // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; + // // } + // // } + // // } + // break; + // case 0xA40: /*0005100*/ // COM 0051DD + // //LOG_INSTRUCTION(opCode, 1, "COM"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = ~dst; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result; + // this.flagC = 0x10000; + // this.flagV = 0; + // } + // } + // break; + // case 0xA80: /*0005200*/ // INC 0052DD + // //LOG_INSTRUCTION(opCode, 1, "INC"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = dst + 1; + // this.regsGen[reg] = result & 0xffff; + // this.flagN = this.flagZ = result; + // this.flagV = result & (result ^ dst); + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = dst + 1; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result; + // this.flagV = result & (result ^ dst); + // } + // } + // } + // break; + // case 0xAC0: /*0005300*/ // DEC 0053DD + // //LOG_INSTRUCTION(opCode, 1, "DEC"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = dst - 1; + // this.regsGen[reg] = result & 0xffff; + // this.flagN = this.flagZ = result; + // this.flagV = (result ^ dst) & dst; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = dst - 1; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result; + // this.flagV = (result ^ dst) & dst; + // } + // } + // } + // break; + // case 0xB00: /*0005400*/ // NEG 0054DD + // //LOG_INSTRUCTION(opCode, 1, "NEG"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = -dst; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result & dst; + // } + // } + // break; + // case 0xB40: /*0005500*/ // ADC 0055DD + // //LOG_INSTRUCTION(opCode, 1, "ADC"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = dst + ((this.flagC >> 16) & 1); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result & (result ^ dst); + // } + // } + // break; + // case 0xB80: /*0005600*/ // SBC 0056DD + // //LOG_INSTRUCTION(opCode, 1, "SBC"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = dst - ((this.flagC >> 16) & 1); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = (result ^ dst) & dst; + // } + // } + // break; + // case 0xBC0: /*0005700*/ // TST 0057DD + // //LOG_INSTRUCTION(opCode, 1, "TST"); + // if ((dst = this.readWordByMode(opCode)) >= 0) { + // this.flagN = this.flagZ = dst; + // this.flagC = this.flagV = 0; + // } + // break; + // case 0xC00: /*0006000*/ // ROR 0060DD + // //LOG_INSTRUCTION(opCode, 1, "ROR"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = ((this.flagC & 0x10000) | dst) >> 1; + // this.regsGen[reg] = result & 0xffff; + // this.flagC = (dst << 16); + // this.flagN = this.flagZ = result; + // this.flagV = result ^ (this.flagC >> 1); + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = ((this.flagC & 0x10000) | dst) >> 1; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = (dst << 16); + // this.flagN = this.flagZ = result; + // this.flagV = result ^ (this.flagC >> 1); + // } + // } + // } + // break; + // case 0xC40: /*0006100*/ // ROL 0061DD + // //LOG_INSTRUCTION(opCode, 1, "ROL"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = (dst << 1) | ((this.flagC >> 16) & 1); + // this.regsGen[reg] = result & 0xffff; + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result ^ dst; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = (dst << 1) | ((this.flagC >> 16) & 1); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result ^ dst; + // } + // } + // } + // break; + // case 0xC80: /*0006200*/ // ASR 0062DD + // //LOG_INSTRUCTION(opCode, 1, "ASR"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = (dst & 0x8000) | (dst >> 1); + // this.regsGen[reg] = result & 0xffff; + // this.flagC = dst << 16; + // this.flagN = this.flagZ = result; + // this.flagV = this.flagN ^ (this.flagC >> 1); + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = (dst & 0x8000) | (dst >> 1); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = dst << 16; + // this.flagN = this.flagZ = result; + // this.flagV = this.flagN ^ (this.flagC >> 1); + // } + // } + // } + // break; + // case 0xCC0: /*0006300*/ // ASL 0063DD + // //LOG_INSTRUCTION(opCode, 1, "ASL"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = dst << 1; + // this.regsGen[reg] = result & 0xffff; + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result ^ dst; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = dst << 1; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result ^ dst; + // } + // } + // } + // break; + // case 0xD00: /*0006400*/ // MARK 0064nn + // //LOG_INSTRUCTION(opCode, 8, "MARK"); + // virtualAddress = (this.regsGen[7] + ((opCode & 0x3F) /*077*/ << 1)) & 0xffff; + // if ((src = this.readWordFromVirtual(virtualAddress | PDP11.ACCESS.DSPACE)) >= 0) { + // this.regsGen[7] = this.regsGen[5]; + // this.regsGen[5] = src; + // this.regsGen[6] = (virtualAddress + 2) & 0xffff; + // } + // break; + // case 0xD40: /*0006500*/ // MFPI 0065SS + // //LOG_INSTRUCTION(opCode, 1, "MFPI"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + // src = this.regsGen[reg]; + // } else { + // src = this.regsAltStack[(this.PSW >> 12) & 3]; + // } + // if (this.pushWord(src) >= 0) { + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } + // } else { + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // if ((this.PSW & 0xf000) !== 0xf000) virtualAddress &= 0xffff; + // this.mmuMode = (this.PSW >> 12) & 3; + // if ((src = this.readWordFromVirtual(virtualAddress)) >= 0) { + // this.mmuMode = (this.PSW >> 14) & 3; + // if (this.pushWord(src) >= 0) { + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } + // } + // } + // } + // break; + // case 0xD80: /*0006600*/ // MTPI 0066DD + // //LOG_INSTRUCTION(opCode, 1, "MTPI"); + // if ((dst = this.popWord()) >= 0) { + // if (!(this.MMR0 & 0xe000)) this.MMR1 = 0x16; /*026*/ + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + // this.regsGen[reg] = dst; + // } else { + // this.regsAltStack[(this.PSW >> 12) & 3] = dst; + // } + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } else { + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // virtualAddress &= 0xffff; + // this.mmuMode = (this.PSW >> 12) & 3; + // if ((dstAddr = this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.WRITE)) >= 0) { + // this.mmuMode = (this.PSW >> 14) & 3; + // if (this.writeWordToPhysical(dstAddr, dst) >= 0) { + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } + // } + // } + // } + // } + // break; + // case 0xDC0: /*0006700*/ // SXT 0067DD + // //LOG_INSTRUCTION(opCode, 1, "SXT"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE)) >= 0) { // write word + // result = -((this.flagN >> 15) & 1); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagZ = result; + // this.flagV = 0; + // } + // } + // break; + // case 0x8A00: /*0105000*/ // CLRB 1050DD + // //LOG_INSTRUCTION(opCode, 1, "CLRB"); + // // if (!(opCode & 0x38)) { + // // this.regsGen[opCode & 7] &= 0xff00; + // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; + // // } else { + // // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE_BYTE)) >= 0) { // write byte + // // if (this.writeByteToPhysical(dstAddr, 0) >= 0) { + // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; + // // } + // // } + // // } + // break; + // case 0x8A40: /*0105100*/ // COMB 1051DD + // //LOG_INSTRUCTION(opCode, 1, "COMB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = ~dst; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result << 8; + // this.flagC = 0x10000; + // this.flagV = 0; + // } + // } + // break; + // case 0x8A80: /*0105200*/ // INCB 1052DD + // //LOG_INSTRUCTION(opCode, 1, "INCB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = dst + 1; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result << 8; + // this.flagV = (result & (result ^ dst)) << 8; + // } + // } + // break; + // case 0x8AC0: /*0105300*/ // DECB 1053DD + // //LOG_INSTRUCTION(opCode, 1, "DECB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = dst - 1; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result << 8; + // this.flagV = ((result ^ dst) & dst) << 8; + // } + // } + // break; + // case 0x8B00: /*0105400*/ // NEGB 1054DD + // //LOG_INSTRUCTION(opCode, 1, "NEGB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = -dst; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result << 8; + // this.flagV = (result & dst) << 8; + // } + // } + // break; + // case 0x8B40: /*0105500*/ // ADCB 01055DD + // //LOG_INSTRUCTION(opCode, 1, "ADCB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = dst + ((this.flagC >> 16) & 1); + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = this.flagC = result << 8; + // this.flagV = (result & (result ^ dst)) << 8; + // } + // } + // break; + // case 0x8B80: /*0105600*/ // SBCB 01056DD + // //LOG_INSTRUCTION(opCode, 1, "SBCB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = dst - ((this.flagC >> 16) & 1); + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = this.flagC = result << 8; + // this.flagV = ((result ^ dst) & dst) << 8; + // } + // } + // break; + // case 0x8BC0: /*0105700*/ // TSTB 1057DD + // //LOG_INSTRUCTION(opCode, 1, "TSTB"); + // if ((dst = this.readByteByMode(opCode)) >= 0) { + // this.flagN = this.flagZ = dst << 8; + // this.flagC = this.flagV = 0; + // } + // break; + // case 0x8C00: /*0106000*/ // RORB 1060DD + // //LOG_INSTRUCTION(opCode, 1, "RORB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = (((this.flagC & 0x10000) >> 8) | dst) >> 1; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagC = (dst << 16); + // this.flagN = this.flagZ = (result << 8); + // this.flagV = this.flagN ^ (this.flagC >> 1); + // } + // } + // break; + // case 0x8C40: /*0106100*/ // ROLB 1061DD + // //LOG_INSTRUCTION(opCode, 1, "ROLB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = (dst << 1) | ((this.flagC >> 16) & 1); + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result << 8; + // this.flagV = (result ^ dst) << 8; + // } + // } + // break; + // case 0x8C80: /*0106200*/ // ASRB 1062DD + // //LOG_INSTRUCTION(opCode, 1, "ASRB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = (dst & 0x80) | (dst >> 1); + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagC = dst << 16; + // this.flagN = this.flagZ = result << 8; + // this.flagV = this.flagN ^ (this.flagC >> 1); + // } + // } + // break; + // case 0x8CC0: /*0106300*/ // ASLB 1063DD + // //LOG_INSTRUCTION(opCode, 1, "ASLB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = dst << 1; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result << 8; + // this.flagV = (result ^ dst) << 8; + // } + // } + // break; + // //case 0106400: // MTPS 1064SS + // // //LOG_INSTRUCTION(opCode, 1, "MTPS"); + // // if ((src = this.readByteByMode(instruction)) >= 0) { + // // this.setPSW((this.PSW & 0xff00) | (src & 0xef)); + // // } // Temporary PDP 11/34A + // // break; + // case 0x8D40: /*0106500*/ // MFPD 1065DD + // //LOG_INSTRUCTION(opCode, 1, "MFPD"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + // src = this.regsGen[reg]; + // } else { + // src = this.regsAltStack[(this.PSW >> 12) & 3]; + // } + // if (this.pushWord(src) >= 0) { + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } + // } else { + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // this.mmuMode = (this.PSW >> 12) & 3; + // if ((src = this.readWordFromVirtual(virtualAddress | PDP11.ACCESS.DSPACE)) >= 0) { + // this.mmuMode = (this.PSW >> 14) & 3; + // if (this.pushWord(src) >= 0) { + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } + // } + // } + // } + // break; + // case 0x8D80: /*0106600*/ // MTPD 1066DD + // //LOG_INSTRUCTION(opCode, 1, "MTPD"); + // if ((dst = this.popWord()) >= 0) { + // if (!(this.MMR0 & 0xe000)) this.MMR1 = 0x16; /*026*/ + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + // this.regsGen[reg] = dst; + // } else { + // this.regsAltStack[(this.PSW >> 12) & 3] = dst; + // } + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } else { + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // this.mmuMode = (this.PSW >> 12) & 3; + // if ((dstAddr = this.mapVirtualToPhysical(virtualAddress | PDP11.ACCESS.DSPACE, PDP11.ACCESS.WRITE)) >= 0) { + // this.mmuMode = (this.PSW >> 14) & 3; + // if (this.writeWordToPhysical(dstAddr, dst) >= 0) { + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } + // } + // } + // } + // } + // break; + // //case 0106700: // MTFS 1064SS + // // //LOG_INSTRUCTION(opCode, 1, "MFPS"); + // // src = this.getPSW() & 0xff; + // // if (instruction & 0x38) { + // // if ((dstAddr = this.getAddr(instruction, PDP11.ACCESS.WRITE_BYTE)) >= 0) { // write byte + // // if (this.writeByteToPhysical(dstAddr, src) >= 0) { + // // this.flagN = this.flagZ = src << 8; + // // this.flagV = 0; + // // } + // // } + // // } else { + // // if (src & 0200) src |= 0xff00; + // // this.regsGen[instruction & 7] = src; + // // this.flagN = this.flagZ = src << 8; + // // this.flagV = 0; + // // } // Temporary PDP 11/34A + // // break; + // default: + // switch (opCode & 0xFFF8) /*0177770*/ { // Single register instructions xxxxxR (and CC) + // case 0x80: /*0000200*/ // RTS 00020R + // //LOG_INSTRUCTION(opCode, 6, "RTS"); + // if ((src = this.popWord()) >= 0) { + // reg = opCode & 7; + // this.regsGen[7] = this.regsGen[reg]; + // this.regsGen[reg] = src; + // } + // break; + // case 0x98: /*0000230*/ // SPL 00023N + // //LOG_INSTRUCTION(opCode, 9, "SPL"); + // if (!(this.PSW & 0xc000)) { + // this.PSW = (this.PSW & 0xf81f) | ((opCode & 7) << 5); + // this.priorityReview = 1; + // } + // break; + // case 0xA0: /*0000240*/ // CLR CC 00024M Part 1 without N + // case 0xA8: /*0000250*/ // CLR CC 00025M Part 2 with N + // // if (opCode & 1) this.clearCF(); // CLC + // // if (opCode & 2) this.clearVF(); // CLV + // // if (opCode & 4) this.clearZF(); // CLZ + // // if (opCode & 8) this.clearNF(); // CLN + // break; + // case 0xB0: /*0000260*/ // SET CC 00026M Part 1 without N + // case 0xB8: /*0000270*/ // SET CC 00026M Part 2 with N + // // if (opCode & 1) this.setCF(); // SEC + // // if (opCode & 2) this.setVF(); // SEV + // // if (opCode & 4) this.setZF(); // SEZ + // // if (opCode & 8) this.setNF(); // SEN + // break; + // default: // Misc instructions (decode ALL remaining bits) xxxxxx + // switch (opCode) { + // case 0x0: /*0000000*/ // HALT 000000 + // //LOG_INSTRUCTION(opCode, 0, "HALT"); + // if (0xc000 & this.PSW) { + // this.regErr |= PDP11.CPUERR.BADHALT; + // this.trap(PDP11.TRAP.BUS_ERROR, 46); + // } else { + // this.runState = 3; // halt + // this.endBurst(); + // //LOG_PRINT(); + // console.log("HALT at " + this.regsGen[7].toString(8)); + // } + // break; + // case 0x1: /*0000001*/ // WAIT 000001 + // //LOG_INSTRUCTION(opCode, 0, "WAIT"); + // j = 0; + // if ((i = this.interruptQueue.length) > 0) { + // while (i-- > 0) { + // j += this.interruptQueue[i].delay; + // this.interruptQueue[i].delay = 0; + // } + // } + // if (j === 0 && this.runState === 0) { + // this.runState = 2; // wait + // this.endBurst(); + // } + // break; + // case 0x3: /*0000003*/ // BPT 000003 + // //LOG_INSTRUCTION(opCode, 0, "BPT"); + // this.trap(PDP11.TRAP.BREAKPOINT, /*014*/ 6); + // break; + // case 0x4: /*0000004*/ // IOT 000004 + // //LOG_INSTRUCTION(opCode, 0, "IOT"); + // this.trap(PDP11.TRAP.IOT, /*020*/ 8); + // break; + // case 0x5: /*0000005*/ // RESET 000005 + // //LOG_INSTRUCTION(opCode, 0, "RESET"); + // // if (!(this.PSW & 0xc000)) { + // // this.resetRegs(); + // // this.bus.reset(); + // // // display.data = this.regsGen[0]; // TODO: Review + // // } + // break; + // case 0x2: /*0000002*/ // RTI 000002 + // case 0x6: /*0000006*/ // RTT 000006 + // //LOG_INSTRUCTION(opCode, 0, "RTT"); + // dstAddr = this.regsGen[6]; + // if ((virtualAddress = this.readWordFromVirtual(dstAddr | PDP11.ACCESS.DSPACE)) >= 0) { + // dstAddr = (dstAddr + 2) & 0xffff; + // if ((savePSW = this.readWordFromVirtual(dstAddr | PDP11.ACCESS.DSPACE)) >= 0) { + // this.regsGen[6] = (dstAddr + 2) & 0xffff; + // savePSW &= 0xf8ff; + // if (this.PSW & 0xc000) { // user / super restrictions + // // keep SPL and allow lower only for modes and register set + // savePSW = (savePSW & 0xf81f) | (this.PSW & 0xf8e0); + // } + // this.regsGen[7] = virtualAddress; + // this.setPSW(savePSW); + // this.opFlags &= ~PDP11.OPFLAG.TRAP_TF; + // if (opCode === 2) { // RTI enables immediate trace + // this.opFlags |= (this.PSW & PDP11.PSW.TF); + // } + // } + // } + // break; + // //case 0000007: // MFPT 000007 + // // //LOG_INSTRUCTION(opCode, 0, "MFPT"); + // // this.regsGen[0] = 1; + // // break; // Exists on pdp 11/44 & KB11-EM + // default: // We don't know this instruction + // //LOG_INSTRUCTION(opCode, 11, "-unknown-"); + // this.trap(PDP11.TRAP.RESERVED, /*010*/ 48); // reserved instruction + // break; + // } + // } + // } + // } + // } + } + } while (this.nStepCycles > 0); return (this.flags.complete? this.nBurstCycles - this.nStepCycles : (this.flags.complete === undefined? 0 : -1)); }; diff --git a/modules/pdp11/lib/debugger.js b/modules/pdp11/lib/debugger.js index 9396a70f9..550829a18 100644 --- a/modules/pdp11/lib/debugger.js +++ b/modules/pdp11/lib/debugger.js @@ -1200,12 +1200,14 @@ if (DEBUGGER) { } } catch(exception) { + /* + * We assume that any numeric exception was explicitly thrown by the CPU to interrupt the + * current instruction. For all other exceptions, we attempt a stack dump. + */ if (typeof exception != "number") { var e = exception; this.nCycles = 0; this.cpu.setError(e.stack || e.message); - } else { - if (DEBUG) this.println("CPU exception: " + str.toHexWord(exception)); } } @@ -1980,11 +1982,11 @@ if (DEBUGGER) { } else if (opTypeOther == DebuggerPDP11.OP_DSTNUM3) { disp = (opCode & 0x7); - sOperand = this.toStrBase(disp, 2); + sOperand = this.toStrBase(disp, 1); } else if (opTypeOther == DebuggerPDP11.OP_DSTNUM6) { disp = (opCode & 0x3f); - sOperand = this.toStrBase(disp); + sOperand = this.toStrBase(disp, 1); } else { /* diff --git a/modules/pdp11/lib/defines.js b/modules/pdp11/lib/defines.js index 6755dc0ed..16256c883 100644 --- a/modules/pdp11/lib/defines.js +++ b/modules/pdp11/lib/defines.js @@ -157,14 +157,6 @@ var PDP11 = { CMODE: 14 } }, - /* - * Interrupt-related flags (stored in intFlags) - */ - INTFLAG: { - NONE: 0x0000, - INTR: 0x00ff, // mask for 8 bits, representing interrupt levels 0-7 - HALT: 0x0100 // halt requested; see opHLT() - }, /* * Internal operation state flags */ diff --git a/modules/pdp11/lib/device.js b/modules/pdp11/lib/device.js index 544235665..bf784788d 100644 --- a/modules/pdp11/lib/device.js +++ b/modules/pdp11/lib/device.js @@ -233,6 +233,38 @@ DevicePDP11.prototype.writeLKS = function(data, addr) this.kw11.lks = data & ~PDP11.KW11.LKS.MONITOR; }; +/** + * readMMR0(addr) + * + * @this {DevicePDP11} + * @param {number} addr (eg, PDP11.UNIBUS.MMR0 or 177572) + * @return {number} + */ +DevicePDP11.prototype.readMMR0 = function(addr) +{ + return this.cpu.getMMR0(); +}; + +/** + * writeMMR0(data, addr) + * + * @this {DevicePDP11} + * @param {number} data + * @param {number} addr (eg, PDP11.UNIBUS.MMR0 or 177572) + */ +DevicePDP11.prototype.writeMMR0 = function(data, addr) +{ + /* + * Set idx to 1 (22-bit), 2 (18-bit), or 4 (16-bit) + */ + var idx = 4; + data = this.cpu.setMMR0(data); + if (data & PDP11.MMR0.ENABLED | PDP11.MMR0.DSTMODE) { + idx = (this.cpu.MMR3 & PDP11.MMR3.MMU_22BIT)? 1 : 2; + } + this.display.misc = (this.display.misc & ~7) | idx; +}; + /** * readXCSR(addr) * @@ -890,24 +922,23 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) switch (physicalAddress & ~0x3F) /*077*/ { case 0x3FFFC0: /*017777700*/ // 017777700 - 017777777 switch (physicalAddress & ~1) { - /* - * Superseded by UNIBUS_TABLE (more of this code will be commented out - * as it is replaced by read/write handlers in the UNIBUS_TABLE; stay tuned). - * - case 0x3FFFFE: // 017777776 // PSW - result = cpu.getPSW(); - if (data >= 0) { - if (physicalAddress & 1) { - data = (data << 8) | (result & 0xff); - } else { - if (byteFlag) data = (result & 0xff00) | (data & 0xff); - } - data = (data & 0xf8ef) | (result & 0x0710); - cpu.setPSW(data); - return -1; // KLUDGE - no trap but abort any CC updates - } - break; - */ + // + // Superseded by UNIBUS_TABLE (more of this code will be commented out + // as it is replaced by read/write handlers in UNIBUS_TABLE; stay tuned). + // + // case 0x3FFFFE: // 017777776 // PSW + // result = cpu.getPSW(); + // if (data >= 0) { + // if (physicalAddress & 1) { + // data = (data << 8) | (result & 0xff); + // } else { + // if (byteFlag) data = (result & 0xff00) | (data & 0xff); + // } + // data = (data & 0xf8ef) | (result & 0x0710); + // cpu.setPSW(data); + // return -1; // KLUDGE - no trap but abort any CC updates + // } + // break; case 0x3FFFFC: /*017777774*/ // stack limit if (data < 0) { result = cpu.regSL & 0xff00; @@ -941,9 +972,9 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) case 0x3FFFF6: /*017777766*/ // CPU error if (cpu.cpuType !== 70) return cpu.trap(PDP11.TRAP.BUS_ERROR, 222); if (data < 0) { - result = cpu.regCPUErr; + result = cpu.regErr; } else { - result = cpu.regCPUErr = 0; // TODO: Always writes as zero? + result = cpu.regErr = 0; // TODO: Always writes as zero? } break; case 0x3FFFF4: /*017777764*/ // System I/D @@ -1038,7 +1069,7 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) } return result; default: - cpu.regCPUErr |= PDP11.CPUERR.TIMEOUT; + cpu.regErr |= PDP11.CPUERR.TIMEOUT; return cpu.trap(PDP11.TRAP.BUS_ERROR, 124); } break; @@ -1062,32 +1093,32 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) result = cpu.MMR1; if (result & 0xff00) result = ((result << 8) | (result >> 8)) & 0xffff; break; - case 0x3FFF7A: /*017777572*/ // MMR0 - cpu.MMR0 = (cpu.MMR0 & 0xf381) | (cpu.mmuLastMode << 5) | (cpu.mmuLastPage << 1); - if (data < 0) { - result = cpu.MMR0; - } else { - result = this.insertData(cpu.MMR0, physicalAddress, data, byteFlag); - if (result >= 0) { - cpu.MMR0 = result &= 0xf381; - cpu.mmuLastMode = (result >> 5) & 3; - cpu.mmuLastPage = (result >> 1) & 0xf; - if (result & 0x101) { - idx = 2; // 18 bit - if (cpu.MMR3 & 0x10) idx = 1; // 22 bit - if (result & 0x1) { - cpu.mmuEnable = PDP11.ACCESS.READ | PDP11.ACCESS.WRITE; - } else { - cpu.mmuEnable = PDP11.ACCESS.WRITE; - } - } else { - cpu.mmuEnable = 0; - idx = 4; // 16 bit - } - this.display.misc = (this.display.misc & ~7) | idx; - } - } - break; + // case 0x3FFF7A: /*017777572*/ // MMR0 + // cpu.MMR0 = (cpu.MMR0 & 0xf381) | (cpu.mmuLastMode << 5) | (cpu.mmuLastPage << 1); + // if (data < 0) { + // result = cpu.MMR0; + // } else { + // result = this.insertData(cpu.MMR0, physicalAddress, data, byteFlag); + // if (result >= 0) { + // cpu.MMR0 = result &= 0xf381; + // cpu.mmuLastMode = (result >> 5) & 3; + // cpu.mmuLastPage = (result >> 1) & 0xf; + // if (result & 0x101) { + // idx = 2; // 18 bit + // if (cpu.MMR3 & 0x10) idx = 1; // 22 bit + // if (result & 0x1) { + // cpu.mmuEnable = PDP11.ACCESS.READ | PDP11.ACCESS.WRITE; + // } else { + // cpu.mmuEnable = PDP11.ACCESS.WRITE; + // } + // } else { + // cpu.mmuEnable = 0; + // idx = 4; // 16 bit + // } + // this.display.misc = (this.display.misc & ~7) | idx; + // } + // } + // break; case 0x3FFF78: /*017777570*/ // console display/switch; if (data < 0) { result = this.display.switches & 0xffff; @@ -1191,7 +1222,7 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) // } // break; default: - cpu.regCPUErr |= PDP11.CPUERR.TIMEOUT; + cpu.regErr |= PDP11.CPUERR.TIMEOUT; return cpu.trap(PDP11.TRAP.BUS_ERROR, 126); } break; @@ -1234,7 +1265,7 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) if (result >= 0) rk11.rkdb = result; break; default: - cpu.regCPUErr |= PDP11.CPUERR.TIMEOUT; + cpu.regErr |= PDP11.CPUERR.TIMEOUT; return cpu.trap(PDP11.TRAP.BUS_ERROR, 128); } break; @@ -1339,7 +1370,7 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) if (result >= 0) rp11.rpcs3 = result; break; default: - cpu.regCPUErr |= PDP11.CPUERR.TIMEOUT; + cpu.regErr |= PDP11.CPUERR.TIMEOUT; return cpu.trap(PDP11.TRAP.BUS_ERROR, 132); } break; @@ -1378,7 +1409,7 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) } break; default: - cpu.regCPUErr |= PDP11.CPUERR.TIMEOUT; + cpu.regErr |= PDP11.CPUERR.TIMEOUT; return cpu.trap(PDP11.TRAP.BUS_ERROR, 134); } break; @@ -1404,7 +1435,7 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) } break; default: - cpu.regCPUErr |= PDP11.CPUERR.TIMEOUT; + cpu.regErr |= PDP11.CPUERR.TIMEOUT; return cpu.trap(PDP11.TRAP.BUS_ERROR, 136); } break; @@ -1454,12 +1485,12 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) idx = (physicalAddress >> 1) & 0xff; result = DevicePDP11.M9312[idx]; } else { - cpu.regCPUErr |= PDP11.CPUERR.TIMEOUT; + cpu.regErr |= PDP11.CPUERR.TIMEOUT; return cpu.trap(PDP11.TRAP.BUS_ERROR, 138); } break; default: - cpu.regCPUErr |= PDP11.CPUERR.TIMEOUT; + cpu.regErr |= PDP11.CPUERR.TIMEOUT; return cpu.trap(PDP11.TRAP.BUS_ERROR, 142); } if (byteFlag && result >= 0) { // make any required byte adjustment @@ -1480,6 +1511,7 @@ DevicePDP11.prototype.access = function(physicalAddress, data, byteFlag) */ DevicePDP11.UNIBUS_TABLE = { [PDP11.UNIBUS.LKS]: [null, null, DevicePDP11.prototype.readLKS, DevicePDP11.prototype.writeLKS], + [PDP11.UNIBUS.MMR0]: [null, null, DevicePDP11.prototype.readMMR0, DevicePDP11.prototype.writeMMR0], [PDP11.UNIBUS.XCSR]: [null, null, DevicePDP11.prototype.readXCSR, DevicePDP11.prototype.writeXCSR], [PDP11.UNIBUS.PSW]: [null, null, DevicePDP11.prototype.readPSW, DevicePDP11.prototype.writePSW] }; diff --git a/modules/shared/lib/debugger.js b/modules/shared/lib/debugger.js index d1ac13440..19b1d60ed 100644 --- a/modules/shared/lib/debugger.js +++ b/modules/shared/lib/debugger.js @@ -659,25 +659,25 @@ if (DEBUGGER) { }; /** - * toStrBase(n, cch) + * toStrBase(n, nBytes) * - * Use this instead of str.toHex() or str.toOct() to convert words to the default base. + * Use this instead of str.toHex() or str.toOct() to convert bytes/words to the Debugger's default base. * * @this {Debugger} * @param {number|null|undefined} n - * @param {number} [cch] is the desired number of hex digits (0 or undefined for default) + * @param {number} [nBytes] is the number of bytes to display, which we translate into a number of characters * @return {string} */ - Debugger.prototype.toStrBase = function(n, cch) + Debugger.prototype.toStrBase = function(n, nBytes) { switch(this.nBase) { case 8: - return str.toOct(n, cch); + return str.toOct(n, nBytes * 3); case 10: - return n.toString(); // TODO: Do we want to support any formatting based on cch? + return n.toString(); case 16: default: - return str.toHex(n, cch); + return str.toHex(n, nBytes * 2); } }; diff --git a/versions/pdp11/1.30.0/pdp11-dbg.js b/versions/pdp11/1.30.0/pdp11-dbg.js index 4be14f490..2a0adef61 100644 --- a/versions/pdp11/1.30.0/pdp11-dbg.js +++ b/versions/pdp11/1.30.0/pdp11-dbg.js @@ -1,201 +1,201 @@ (function(){var l; -function ca(a,b){var d;if(a){b||(b=10);var c=a.charAt(0),f=0>=3;return(d?"0o":"")+c}function r(a,b,d){var c="";b?8=f?48:55),c=String.fromCharCode(f)+c;a>>=4}return(d?"0x":"")+c} -function ea(a){var b=a,d=a.lastIndexOf("/");0<=d&&(b=a.substr(d+1));d=b.indexOf("&");0":">",'"':""","'":"'"};function ja(a){return a.replace(/[&<>"']/g,function(a){return ia[a]})}function ka(a,b){return(a+" ").slice(0,b)} -function ma(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function na(a,b,d){var c=0,f=a.length,e=0;for(d||(d=function(a,b){return a>b?1:a>1,h;h=d(b,a[g]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} -function ta(a,b,d,c){var f=0,e=null,g=null;if("object"==typeof resources&&(e=resources[a]))return c&&c(a,e,f),[e,f];if(d&&"function"==typeof resources)return resources(a,function(b,d){c&&c(a,b,d)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");d&&(h.onreadystatechange=function(){4===h.readyState&&(e=h.responseText,200==h.status||!h.status&&e.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),c&&c(a,e,f))});if(b&&"object"== -typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encodeURIComponent(b[m]));k=k.replace(/%20/g,"+");h.open("POST",a,!!d);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k)}else h.open("GET",a,!!d),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();d||(e=h.responseText,200!=h.status&&(f=h.status||-1),c&&c(a,e,f),g=[e,f]);return g}function ha(){return"http://"+(window?window.location.host:"www.pcjs.org")} -function t(a){window&&window.alert(a)}function ua(a){var b=!1;window&&(b=window.confirm(a));return b}var va=null;function wa(){if(null==va){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}va=a}return va}function xa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(d){}return b} -function ya(a,b){try{return window.localStorage.setItem(a,b),!0}catch(d){}return!1}function za(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Fa(a,b,d){function c(){--a;0<=a&&(b()||(a=0));0b?this.Fb=this.id:(this.uc=this.id.substr(0,b),this.Fb=this.id.substr(b+1));this[a]=d;this.j={ready:!1,qb:!1,jc:!1,ca:!1,error:!1};this.ac=null;this.j.error=!1;this.I={};this.D=null;this.da=c||0;v.push(this)}var Qa=void 0,Ra={}; -if(window){Qa||(Qa=window.location.search.substr(1));for(var Sa,Ta=/\+/g,Ua=/([^&=]+)=?([^&]*)/g;Sa=Ua.exec(Qa);)Ra[decodeURIComponent(Sa[1].replace(Ta," "))]=decodeURIComponent(Sa[2].replace(Ta," "))}function Va(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var d=typeof a;if("object"!==d&&"function"!==d)throw new TypeError;}b.prototype=a;return new b} -function w(a,b){b||(b=u);a.prototype=Va(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Wa=window.PCjs.Machines||(window.PCjs.Machines={}),v=window.PCjs.Components||(window.PCjs.Components=[])}else Wa={},v=[];function Xa(a,b,d){Wa[a]&&b&&(Wa[a][b]=d)}function Ya(a){var b,d=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1)+2;10>this.S&&(this.S=10);15>2;this.f=this.Aa-1;this.u=this.B/this.Aa|0;this.w=this.u-1;this.Ua=[];this.F=null;this.Lb=this.Gc;a=new F;vb(a,this.D);this.L=Array(this.u);for(b=0;b>8:c[2](b)&255}else if(b&1&&(c=d.Ua[a&-2],c[2]))return c[2](b&-2)>>8;d.g("warning: unconverted read access to byte @"+da(b));return d.Lb(b,-1,1)} -function xb(a,b,d){var c=this.controller,f=c.Ua[a];if(f){if(f[1]){f[1](b,d);return}if(f[3]){a=f[2]?f[2](d):0;if(d&1)f[3](a&255|b<<8,d&-2);else f[3](a&-256|b,d);return}}else if(d&1&&(f=c.Ua[a&-2],f[3])){d&=-2;a=f[2]?f[2](d):0;f[3](a&255|b<<8,d);return}c.g("warning: unconverted write access to byte @"+da(d));c.Lb(d,b,1)} -function yb(a,b){var d=this.controller;if(a=d.Ua[a]){if(a[2])return a[2](b);if(a[0])return a[0](b)|a[0](b+1)<<8}d.g("warning: unconverted read access to word @"+da(b));return d.Lb(b,-1,0)}function zb(a,b,d){var c=this.controller;if(a=c.Ua[a]){if(a[3]){a[3](b,d);return}if(a[1]){a[1](b&255,d);a[1](b>>8,d+1);return}}c.g("warning: unconverted write access to word @"+da(d));c.Lb(d,b,0)}l=ub.prototype;l.reset=function(){this.F&&this.F()};l.Gc=function(){return 0};l.Ma=function(a,b){b||this.reset();return!0}; -function Ab(a,b,d,c,f){for(var e=b,g=d,h=e>>>a.S;0g&&(n=g);if(k&&k.size){if(k.type==c&&k.controller==f){if(e+g<=k.A)return k.Zb+=k.A-e,k.A=e,!0;if(e>=k.A+k.Zb){n=k.size-(e-m);n>g&&(n=g);k.Zb=e-k.A+n;e=m+a.Aa;g-=n;h++;continue}}return Cb(1,e,g)}e=new F(e,n,a.Aa,c,f);vb(e,a.D,k);a.L[h++]=e;e=m+a.Aa;g-=n}return 0>=g?(a.status(Math.floor(d/1024)+"Kb "+Db[c]+" at "+r(b,8,!0)),!0):Cb(2,b,d)} -l.Mb=function(a){return this.L[(a&this.C)>>>this.S].wb(a&this.f,a)};l.Ea=function(a){var b=a&this.f,d=(a&this.C)>>>this.S;return b!=this.f?this.L[d].Tb(b,a):this.L[d++].wb(b,a)|this.L[d&this.w].wb(0,a+1)<<8};function Eb(a,b){var d=b&a.f,c=(b&a.C)>>>a.S;return d!=a.f?a.L[c].nc(d,b):a.L[c++].Sb(d,b)|a.L[c&a.w].Sb(0,b+1)<<8}l.hc=function(a,b){this.L[(a&this.C)>>>this.S].Bb(a&this.f,b&255,a)}; -l.pc=function(a,b){var d=a&this.f,c=(a&this.C)>>>this.S;d!=this.f?this.L[c].Fc(d,b&65535,a):(this.L[c++].Bb(d,b&255,a),this.L[c&this.w].Bb(0,b>>8&255,a+1))};function Fb(a){for(var b=0,d=[],c=0;c>=3;return(c?"0o":"")+d}function r(a,b,c){var d="";b?8=f?48:55),d=String.fromCharCode(f)+d;a>>=4}return(c?"0x":"")+d} +function ea(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0":">",'"':""","'":"'"};function ja(a){return a.replace(/[&<>"']/g,function(a){return ia[a]})}function ka(a,b){return(a+" ").slice(0,b)} +function ma(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function na(a,b,c){var d=0,f=a.length,e=0;for(c||(c=function(a,b){return a>b?1:a>1,h;h=c(b,a[g]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} +function ta(a,b,c,d){var f=0,e=null,g=null;if("object"==typeof resources&&(e=resources[a]))return d&&d(a,e,f),[e,f];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(e=h.responseText,200==h.status||!h.status&&e.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),d&&d(a,e,f))});if(b&&"object"== +typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encodeURIComponent(b[m]));k=k.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(e=h.responseText,200!=h.status&&(f=h.status||-1),d&&d(a,e,f),g=[e,f]);return g}function ha(){return"http://"+(window?window.location.host:"www.pcjs.org")} +function t(a){window&&window.alert(a)}function ua(a){var b=!1;window&&(b=window.confirm(a));return b}var va=null;function wa(){if(null==va){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}va=a}return va}function xa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} +function ya(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function za(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Fa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0b?this.Ab=this.id:(this.tc=this.id.substr(0,b),this.Ab=this.id.substr(b+1));this[a]=c;this.j={ready:!1,ob:!1,gc:!1,ba:!1,error:!1};this.Yb=null;this.j.error=!1;this.I={};this.F=null;this.da=d||0;v.push(this)}var Qa=void 0,Ra={}; +if(window){Qa||(Qa=window.location.search.substr(1));for(var Sa,Ta=/\+/g,Ua=/([^&=]+)=?([^&]*)/g;Sa=Ua.exec(Qa);)Ra[decodeURIComponent(Sa[1].replace(Ta," "))]=decodeURIComponent(Sa[2].replace(Ta," "))}function Va(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} +function w(a,b){b||(b=u);a.prototype=Va(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Wa=window.PCjs.Machines||(window.PCjs.Machines={}),v=window.PCjs.Components||(window.PCjs.Components=[])}else Wa={},v=[];function Xa(a,b,c){Wa[a]&&b&&(Wa[a][b]=c)}function Ya(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1)+2;10>this.S&&(this.S=10);15>2;this.f=this.za-1;this.w=this.B/this.za|0;this.u=this.w-1;this.Qa=[];this.D=null;this.Ib=this.Fc;a=new F;vb(a,this.F);this.L=Array(this.w);for(b=0;b>8:d[2](b)&255}else if(b&1&&(d=c.Qa[a&-2],d[2]))return d[2](b&-2)>>8;c.g("warning: unconverted read access to byte @"+da(b));return c.Ib(b,-1,1)} +function xb(a,b,c){var d=this.controller,f=d.Qa[a];if(f){if(f[1]){f[1](b,c);return}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);return}}else if(c&1&&(f=d.Qa[a&-2],f[3])){c&=-2;a=f[2]?f[2](c):0;f[3](a&255|b<<8,c);return}d.g("warning: unconverted write access to byte @"+da(c));d.Ib(c,b,1)} +function yb(a,b){var c=this.controller;if(a=c.Qa[a]){if(a[2])return a[2](b);if(a[0])return a[0](b)|a[0](b+1)<<8}c.g("warning: unconverted read access to word @"+da(b));return c.Ib(b,-1,0)}function zb(a,b,c){var d=this.controller;if(a=d.Qa[a]){if(a[3]){a[3](b,c);return}if(a[1]){a[1](b&255,c);a[1](b>>8,c+1);return}}d.g("warning: unconverted write access to word @"+da(c));d.Ib(c,b,0)}l=ub.prototype;l.reset=function(){this.D&&this.D()};l.Fc=function(){return 0};l.Ma=function(a,b){b||this.reset();return!0}; +function Ab(a,b,c,d,f){for(var e=b,g=c,h=e>>>a.S;0g&&(n=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.A)return k.Vb+=k.A-e,k.A=e,!0;if(e>=k.A+k.Vb){n=k.size-(e-m);n>g&&(n=g);k.Vb=e-k.A+n;e=m+a.za;g-=n;h++;continue}}return Cb(1,e,g)}e=new F(e,n,a.za,d,f);vb(e,a.F,k);a.L[h++]=e;e=m+a.za;g-=n}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Db[d]+" at "+r(b,8,!0)),!0):Cb(2,b,c)} +l.Jb=function(a){return this.L[(a&this.C)>>>this.S].tb(a&this.f,a)};l.Fa=function(a){var b=a&this.f,c=(a&this.C)>>>this.S;return b!=this.f?this.L[c].Pb(b,a):this.L[c++].tb(b,a)|this.L[c&this.u].tb(0,a+1)<<8};function Eb(a,b){var c=b&a.f,d=(b&a.C)>>>a.S;return c!=a.f?a.L[d].lc(c,b):a.L[d++].Ob(c,b)|a.L[d&a.u].Ob(0,b+1)<<8}l.ec=function(a,b){this.L[(a&this.C)>>>this.S].yb(a&this.f,b&255,a)}; +l.oc=function(a,b){var c=a&this.f,d=(a&this.C)>>>this.S;c!=this.f?this.L[d].Ec(c,b&65535,a):(this.L[d++].yb(c,b&255,a),this.L[d&this.u].yb(0,b>>8&255,a+1))};function Fb(a){for(var b=0,c=[],d=0;d>13&7;"undefined"===typeof b.la[e]&&(b.la[e]={cache:[],postProcess:a.cd,drive:e,blocksize:256,mapped:0,maxblock:b.gb[e]*b.U[e],url:"rk"+e+".dsk"});b.M&=-129;switch(b.M>>1&7){case 0:b.Vb=2496;b.ja=0;b.M=128;b.qa=0;break;case 1:if((b.qa>>4&511)>=b.gb[e]){b.ja|=32832;b.M|=49152;break}if((b.qa&15)>=b.U[e]){b.ja|=32800;b.M|=49152;break}d=(b.qa>>4&511)*b.U[e]+(b.qa&15);c=(b.M&48)<<12|b.Ub;f=65536-b.Wb&65535;Ub(a,b.la[e],d,c,f);return;case 2:if((b.qa>>4&511)>=b.gb[e])b.ja|= -32832,b.M|=49152;else if((b.qa&15)>=b.U[e])b.ja|=32800,b.M|=49152;else{d=(b.qa>>4&511)*b.U[e]+(b.qa&15);c=(b.M&48)<<12|b.Ub;f=65536-b.Wb&65535;a.dc(b.la[e],d,c,f);return}}b.Vb=e<<13|b.Vb&8176|b.qa%9&15;H(a.b,20,5,144,function(){b.M=b.M&65534|128;return!!(b.M&64)})}l.cd=function(a,b,d,c,f){var e=this.B;e.Ub=c&65535;e.M=e.M&-49|c>>12&48;e.Wb=65536-f&65535;switch(a){case 1:e.ja|=33024;e.M|=49152;break;case 2:e.ja|=33792,e.M|=49152}H(this.b,20,5,144,function(){e.M=e.M&65534|128;return!!(e.M&64)})}; -function Vb(a){var b=a.F,d,c,f,e=b.J>>8&3;b.J&=-2;"undefined"===typeof b.la[e]&&(b.la[e]={cache:[],postProcess:a.dd,drive:e,blocksize:128,mapped:1,maxblock:b.gb[e]*b.U[e],url:"rl"+e+".dsk"});switch(b.J>>1&7){case 2:b.ab&8&&(b.J&=63);b.ab=b.Ic[e]|b.eb&64;break;case 3:1==(b.Z&3)&&(b.eb=b.Z&4?b.eb+(b.Z&65408)&65408|b.Z<<2&64:b.eb-(b.Z&65408)&65408|b.Z<<2&64,b.Z=b.eb);break;case 4:b.ab=b.eb;break;case 5:if(b.Z>>6>=b.gb[e]){b.J|=37888;break}if((b.Z&63)>=b.U[e]){b.J|=37888;break}d=(b.Z>>6)*b.U[e]+(b.Z& -63);c=(b.Va&63)<<16|b.Jb;f=65536-b.ab&65535;Ub(a,b.la[e],d,c,f);return;case 6:if(b.Z>>6>=b.gb[e])b.J|=37888;else if((b.Z&63)>=b.U[e])b.J|=37888;else{d=(b.Z>>6)*b.U[e]+(b.Z&63);c=(b.Va&63)<<16|b.Jb;f=65536-b.ab&65535;a.dc(b.la[e],d,c,f);return}}H(a.b,20,5,112,function(){b.J|=129;return!!(b.J&64)})} -l.dd=function(a,b,d,c,f){var e=this.F;e.Jb=c&65535;e.J=e.J&-49|c>>12&48;e.Va=c>>16&63;e.Z=~~(d/e.U[b.Ka])<<6|d%e.U[b.Ka];e.eb=e.Z;e.ab=65536-f&65535;switch(a){case 1:e.J|=33792;break;case 2:e.J|=40960}H(this.b,20,5,112,function(){e.J|=129;return!!(e.J&64)})};function Wb(a){a=a.G;a.N=2176;a.Ba=0;a.na=[4544,4544,4544,4544,4544,4544,4544,4544];a.yb=[0,0,0,0,0,0,0,0];a.nb=a.zb=a.xb=a.cb=a.oc=0} -function Xb(a,b){var d=a.G,c,f,e;d.N&=-16513;d.Ba&=-2049;d.na[b]&=-1153;H(a.b,-1,0,172);"undefined"===typeof d.la[b]&&(d.la[b]={cache:[],postProcess:a.ed,drive:b,blocksize:256,mapped:0,maxblock:d.ic[0]*d.fb[0]*d.U[0],url:"rp"+b+".dsk"});switch(d.N&63){case 5:d.gc[b]=d.Qa[b];d.N|=32896;d.na[b]|=32896;d.nb|=1<=d.ic[0]||d.Ca[b]>>8>=d.fb[0]||(d.Ca[b]&255)>=d.U[0]){d.yb[b]|=1024;d.N|=49152;break}c=(d.Qa[b]*d.fb[0]+(d.Ca[b]>>8))*d.U[0]+ -(d.Ca[b]&255);f=(d.cb&63)<<16|d.xb;e=65536-d.zb&65535;Ub(a,d.la[b],c,f,e);return;case 57:if(d.Qa[b]>=d.ic[0]||d.Ca[b]>>8>=d.fb[0]||(d.Ca[b]&255)>=d.U[0])d.yb[b]|=1024,d.N|=49152;else{c=(d.Qa[b]*d.fb[0]+(d.Ca[b]>>8))*d.U[0]+(d.Ca[b]&255);f=(d.cb&63)<<16|d.xb;e=65536-d.zb&65535;a.dc(d.la[b],c,f,e);return}}H(a.b,3,5,172,function(){d.N=d.N&65534|128;d.na[b]|=128;return!!(d.N&64)})} -l.ed=function(a,b,d,c,f){var e=this.G;e.zb=65536-f&65535;e.xb=c&65535;e.N=e.N&-769|c>>8&768;e.cb=c>>16&63;f=~~(d/e.U[0]);c=~~(f/e.fb[0]);e.Ca[b.Ka]=f%e.fb[0]<<8|d%e.U[0];e.gc[b.Ka]=e.Qa[b.Ka]=c;e.nb|=1<=b.Xc-1&&(e.na[b.Ka]|=1024);switch(a){case 1:e.Ba|=512;e.N|=49152;break;case 2:e.Ba|=2048,e.N|=49152}H(this.b,20,5,172,function(){e.na[b.Ka]|=128;e.N=e.N&65534|128;return!!(e.N&64)})};l.Uc=function(){this.f.$a|=128;this.f.$a&64&&H(this.b,0,6,64)}; -function Yb(a,b,d,c,f,e){var g=~~((e+d.Wa-1)/d.Wa),h=new XMLHttpRequest;2048>g&&c+2048Zb(this.b,a.Wc?$b(this.b,d):d,a.cache[b][f])){a.cc(2,a,b,d,c);return}d+=2;--c}b++}a.cc(0,a,b,d,c)}; -function Ub(a,b,d,c,f){for(var e,g;0g){b.cc(2,b,d,c,f);return}b.cache[d][e]=g;c+=2;--f}d++}b.cc(0,b,d,c,f)}l.reset=function(){this.u.sb=this.u.sb&-120|20;this.w.Fa=0;this.w.sa=128;this.f.$a=0;this.B.M=128;this.F.J=128;Wb(this)}; -l.Hc=function(a,b,d){var c,f,e=this.b;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?c=e.Oa&65280:(a&1&&(b<<=8),e.Oa=b|255,c=0);break;case 4194298:if(0>b)c=e.fc;else{a&1&&(b<<=8);if(c=b&65024){f=c>>9;do c+=34;while(f>>=1)}e.fc=c;e.Na=2}break;case 4194294:if(70!==e.jb)return J(e,4,222);0>b?c=e.H:c=e.H=0;break;case 4194292:if(70!==e.jb)return J(e,4,224);c=1;break;case 4194290:if(70!==e.jb)return J(e,4,226);c=0;break;case 4194288:if(70!==e.jb)return J(e,4,228);c=61183;break;case 4194296:0<= -b&&!(a&1)&&(b&=255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.jb)return J(e,4,232);f=a-4194272>>1;0>b?c=e.lc[f]:(c=I(this,e.lc[f],a,b,d),0<=c&&(e.lc[f]=c));break;case 4194254:return a&1?e.ga>>14&1?(0<=b&&(e.i[6]=b),c=e.i[6]):(0<=b&&(e.Pa[3]=b),c=e.Pa[3]):e.ga>>14&0?(0<=b&&(e.i[6]=b),c=e.i[6]):(0<=b&&(e.Pa[1]=b),c=e.Pa[1]),c;case 4194252:case 4194250:case 4194248:return f=a&7,e.ga&2048?(0<=b&&(e.i[f]=b),c=e.i[f]):(0<=b&&(e.bb[f]= -b),c=e.bb[f]),c;case 4194246:return a&1?(0<=b&&(e.i[7]=b),c=e.i[7]):e.ga>>14&0?(0<=b&&(e.i[6]=b),c=e.i[6]):(0<=b&&(e.Pa[0]=b),c=e.Pa[0]),c;case 4194244:case 4194242:case 4194240:return f=a&7,e.ga&2048?(0<=b&&(e.bb[f]=b),c=e.bb[f]):(0<=b&&(e.i[f]=b),c=e.i[f]),c;default:return e.H|=16,J(e,4,124)}break;case 4194176:f=a>>1&31;c=I(this,e.ia[3][f],a,b,d);0<=c&&(e.ia[3][f]=c,e.ia[3][f&15]&=65295);break;case 4194112:var g=this.w;switch(a&-2){case 4194174:c=I(this,e.Eb,a,b,d);0<=c&&(e.Eb=c);break;case 4194172:c= -e.Ra;c&65280&&(c=(c<<8|c>>8)&65535);break;case 4194170:e.ba=e.ba&62337|e.Ob<<5|e.bc<<1;0>b?c=e.ba:(c=I(this,e.ba,a,b,d),0<=c&&(e.ba=c&=62337,e.Ob=c>>5&3,e.bc=c>>1&15,c&257?(f=2,e.Sa&16&&(f=1),e.tb=c&1?6:4):(e.tb=0,f=4),this.u.sb=this.u.sb&-8|f));break;case 4194168:0>b?c=this.u.md&65535:(c=I(this,this.u.data,a,b,d),0<=c&&(this.u.data=c));break;case 4194166:0<=b&&(b&127&&(g.Mc=0),g.sa&=-129,H(e,100,4,52,function(){g.sa|=128;return!!(g.sa&64)}));c=0;break;case 4194162:c=0;0>b&&(g.Fa&=-129,0b?c=g.Fa:(c=I(this,g.Fa,a,b,d),0<=c&&(g.Fa=g.Fa&128|c&-129));break;default:return e.H|=16,J(e,4,126)}break;case 4194048:f=this.B;switch(a&-2){case 4194048:c=I(this,f.Vb,a,b,d);0<=c&&(f.Vb=c);break;case 4194050:c=I(this,f.ja,a,b,d);0<=c&&(f.ja=c);break;case 4194052:c=I(this,f.M,a,b,d);0<=b&&0<=c&&(f.M=c&-36993|f.M&36992,f.M&1&&Tb(this));break;case 4194054:c=I(this,f.Wb,a,b,d);0<=c&&(f.Wb= -c);break;case 4194056:c=I(this,f.Ub,a,b,d);0<=c&&(f.Ub=c);break;case 4194058:c=I(this,f.qa,a,b,d);0<=c&&(f.qa=c);break;case 4194060:break;case 4194062:c=I(this,f.Ac,a,b,d);0<=c&&(f.Ac=c);break;default:return e.H|=16,J(e,4,128)}break;case 4193728:var h=this.G;f=h.Ba&7;switch(a&-2){case 4193728:c=I(this,h.N,a,b,d);0<=b&&0<=c&&(h.cb=h.cb&60|c>>8&3,h.N=c&17279|h.N&34944|2048,c&1&&h.N&128?Xb(this,f):192==(c&192)&&H(e,0,5,172));break;case 4193730:c=I(this,h.zb,a,b,d);0<=c&&(h.zb=c);break;case 4193732:c= -I(this,h.xb,a,b,d);0<=c&&(h.xb=c&65534);break;case 4193734:c=I(this,h.Ca[f],a,b,d);0<=c&&(h.Ca[f]=c&7967);break;case 4193736:c=I(this,h.Ba,a,b,d);0<=c&&(h.Ba=c&63|h.Ba&65472,c&128&&Wb(this));break;case 4193738:c=h.na[f];break;case 4193740:c=h.yb[f];break;case 4193742:c=I(this,h.nb,a,b,d);0<=c&&(h.nb=c&255);break;case 4193744:c=h.kd[f];break;case 4193746:c=I(this,h.Bc,a,b,d);0<=c&&(h.Bc=c);break;case 4193748:c=I(this,h.Cc[f],a,b,d);0<=c&&(h.Cc[f]=c&1023);break;case 4193750:c=8210;break;case 4193752:c= -h.ld[f];break;case 4193754:c=I(this,h.Dc[f],a,b,d);0<=c&&(h.Dc[f]=c);break;case 4193756:c=I(this,h.Qa[f],a,b,d);0<=c&&(h.Qa[f]=c&511);break;case 4193758:h.gc[f]=h.Qa[f];c=h.gc[f];break;case 4193760:c=h.hd[f];break;case 4193762:c=h.jd[f];break;case 4193764:c=h.fd[f];break;case 4193766:c=h.gd[f];break;case 4193768:c=I(this,h.cb,a,b,d);0<=c&&(h.cb=c&63,h.N=h.N&-769|(c&3)<<8);break;case 4193770:c=I(this,h.oc,a,b,d);0<=c&&(h.oc=c);break;default:return e.H|=16,J(e,4,132)}break;case 4192512:f=this.F;switch(a& --2){case 4192512:c=I(this,f.J,a,b,d);0<=b&&0<=c&&(f.Va=f.Va&60|c>>4&3,f.J=f.J&-1023|c&1022,f.J&128||Vb(this));break;case 4192514:c=I(this,f.Jb,a,b,d);0<=c&&(f.Jb=c&65534);break;case 4192516:c=I(this,f.Z,a,b,d);0<=c&&(f.Z=c);break;case 4192518:c=I(this,f.ab,a,b,d);0<=c&&(f.ab=c);break;case 4192520:c=I(this,f.Va,a,b,d);0<=c&&(f.Va=c&63,f.J=f.J&-49|(f.Va&3)<<4);break;default:return e.H|=16,J(e,4,134)}break;case 4191552:switch(a&-2){case 4191566:0>b?c=e.Sa:(c=I(this,e.Sa,a,b,d),0<=c&&(70!==e.jb&&(c&= --49),e.Sa=c,e.lb[0]=c&4?15:7,e.lb[1]=c&2?15:7,e.lb[3]=c&1?15:7,e.tb&&(f=2,e.Sa&16&&(f=1),this.u.sb=this.u.sb&-8|f)));break;default:return e.H|=16,J(e,4,136)}break;case 4191424:f=a>>1&31;c=I(this,e.ia[0][f],a,b,d);0<=c&&(e.ia[0][f]=c,e.ia[0][f&15]&=65295);break;case 4191360:f=a>>1&31;c=I(this,e.ia[1][f],a,b,d);0<=c&&(e.ia[1][f]=c,e.ia[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!==e.jb)return J(e,4,234);f=a>>2&31;c=e.Xb[f];a&2&&(c>>=16);c&=65535;0<=b&&(c=I(this,c,a,b,d),0<=c&&(e.Xb[f]=a& -2?c<<16|e.Xb[f]&65535:e.Xb[f]&4294901760|c&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)c=Gb[a>>1&255];else return e.H|=16,J(e,4,138);break;default:return e.H|=16,J(e,4,142)}d&&0<=c&&(a&1?c>>=8:c&=255);"undefined"===typeof c&&console.log("panic(76)");return c}; -var ac={},Hb=(ac[65382]=[null,null,G.prototype.$c,G.prototype.od],ac[65396]=[null,null,G.prototype.bd,G.prototype.qd],ac[65534]=[null,null,G.prototype.ad,G.prototype.pd],ac);Ma(function(){for(var a=C(document,"pdp11","device"),b=0;b>1),this.b=new Int32Array(this.B,0,d>>2),hc(this,dc?ic:jc);else{this.b=Array(d>>2);for(a=0;a>2),b=0;b>8,d)},Y:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},oa:function(a){var b=a>>2;a=(a&3)<<3;var d=this.b[b]>>a;return 24>a?d&65535:d&255|(this.b[b+1]&255)<<8},wa:function(a,b){var d=a>> -2;a=(a&3)<<3;this.b[d]=this.b[d]&~(255<>2;a=(a&3)<<3;24>a?this.b[d]=this.b[d]&~(65535<>8);this.Ya=!0},V:function(a,b){if(this.D&&null!=this.A){var d=this.D;oc(d,this.A+a,1,d.R)&&d.ka(!0)}return this.Sb(a,b)},aa:function(a,b){if(this.D&&null!=this.A){var d=this.D;oc(d,this.A+a,2,d.R)&&d.ka(!0)}return this.nc(a,b)},ua:function(a,b,d){if(this.D&&null!=this.A){var c=this.D;oc(c,this.A+ -a,1,c.F)&&c.ka(!0)}this.C?this.u(a,b,d):this.Cb(a,b,d)},Ia:function(a,b,d){if(this.D&&null!=this.A){var c=this.D;oc(c,this.A+a,2,c.F)&&c.ka(!0)}this.C?this.u(a,b,d):this.rc(a,b,d)},R:function(a){return this.f[a]},X:function(a){return this.f[a]},$:function(a){return this.F.getUint16(a,!0)},fa:function(a){return a&1?this.f[a]|this.f[a+1]<<8:this.K[a>>1]},pa:function(a,b){this.f[a]=b;this.Ya=!0},va:function(a,b){this.f[a]=b;this.Ya=!0},Ha:function(a,b){this.F.setUint16(a,b,!0);this.Ya=!0},Ta:function(a, -b){a&1?(this.f[a]=b,this.f[a+1]=b>>8):this.K[a>>1]=b;this.Ya=!0}};function vb(a,b,d){a.D=b;a.I=a.w=0;d&&((a.I=d.I)&&nc(a,mc,!1),(a.w=d.w)&&lc(a,mc,!1))}function pc(a,b){b?--a.w||(a.Bb=a.C?a.u:a.Cb,a.Fc=a.C?a.G:a.rc):--a.I||(a.wb=a.Sb,a.Tb=a.nc)}function lc(a,b,d){d&&a.w||(a.Bb=!a.C&&b[1]||a.u,a.Fc=!a.C&&b[3]||a.G);if(d||void 0===d)a.Cb=b[1]||a.u,a.rc=b[3]||a.G}function nc(a,b,d){d&&a.I||(a.wb=b[0]||a.O,a.Tb=b[2]||a.P);if(d||void 0===d)a.Sb=b[0]||a.O,a.nc=b[2]||a.P} -function hc(a,b){b||(b=qc);nc(a,b,void 0);lc(a,b,void 0)}var qc=[],kc=[F.prototype.Y,F.prototype.wa,F.prototype.oa,F.prototype.Fb],mc=[F.prototype.V,F.prototype.ua,F.prototype.aa,F.prototype.Ia];if(rb)var jc=[F.prototype.R,F.prototype.pa,F.prototype.$,F.prototype.Ha],ic=[F.prototype.X,F.prototype.va,F.prototype.fa,F.prototype.Ta]; -function rc(a,b){u.call(this,"CPU",a,rc,1);var d=a.multiplier||1;this.va=a.cycles||b;this.mb=d;this.ua=Math.round(this.va/1E4)/100;this.kb=this.ua*this.mb;this.j.ea=!1;this.j.qc=!1;this.j.Hb=a.autoStart;this.j.xc=!1;this.j.rb=!1;this.Pb=this.V=0;this.Qb=a.csStart;this.ub=a.csInterval;this.vb=a.csStop;this.fa=[];this.Ib=this.ob.bind(this);D(this)}w(rc);var sc=["power","reset"];l=rc.prototype; -l.Za=function(a,b,d,c){this.w=a;this.C=b;this.D=c;for(b=0;b=a.V&&(a.V+=a.ub,d=!0);0<=a.vb&&a.vb<=Lc(a)&&(a.ub=a.vb=-1,Jc(a),a.ka(),d=!0);d&&a.g(Lc(a)+" cycles: checksum="+r(a.Pb))}} -function Mc(a,b,d,c){if(a.I[b]){void 0===d&&(qb(a,"Value for "+b+" is invalid"),a.ka());var f=a.D&&a.D.$||8;d=!a.j.ea||a.j.xc?8==f?da(d,c):r(d,c):"--------".substr(0,c||4);a.I[b].textContent!=d&&(a.I[b].textContent=d)}} -l.ra=function(a,b,d){var c=this;a=!1;switch(b){case "power":case "reset":this.I[b]=d;a=!0;break;case "run":this.I[b]=d;d.onclick=function(){var a;if(a=c.w)if(a=c.w,a.j.ca)a=!0;else{var b=null,d,h=Ya(a.id);for(d=0;da.K/a.kb?b=1:c=!0;a.mb=b;b=a.ua*a.mb;if(a.kb!=b){a.kb=b;b=a.kb.toFixed(2)+"Mhz";var f=a.I.setSpeed;f&&(f.textContent=b);a.g("target speed: "+b)}d&&a.w&&a.w.Yb()}Oc(a,a.G);a.G=0;a.F=oa();a.O=0;Pc(a);return c}function Qc(a){a.P-=a.b;a.b=0} -l.ob=function(a){if(nb(this,!0)){if(!this.j.ea){Nc(this);this.w&&this.w.start(this.F,Lc(this));this.j.ea=!0;this.j.qc=!0;this.$&&this.$.start();var b=this.I.run;b&&(b.textContent="Halt");this.w&&(this.w.ta(!0),a&&this.w.Yb(!0))}this.wa>=this.va&&Pc(this,!0);this.aa=0;this.oa=oa();this.O&&(a=this.oa-this.O,a>this.pb&&(this.F+=a,this.F>this.oa&&(this.F=this.oa)));try{do{for(var d,c=this.j.rb?1:this.pa,f=this.fa.length-1;0<=f;f--){var e=this.fa[f];0>e[0]||c>e[0]&&(c=e[0])}d=c;try{this.Ab(d)}catch(m){if("number"!= -typeof m)throw m;}var g=this.P-this.b;a=g;for(var h=this.fa.length-1;0<=h;h--){var k=this.fa[h];0>k[0]||(k[0]-=a,0>=k[0]&&(k[0]=-1,k[1]()))}this.aa+=g;this.G+=g;Oc(this,0,!0);Kc(this,g);this.X-=g;if(0>=this.X){this.X+=this.pa;15<=++this.Db&&(this.w&&this.w.ta(),this.Db=0);break}}while(this.j.ea)}catch(m){this.ka();K(this);this.w&&this.w.stop(oa(),Lc(this));nb(this,!1);qb(this,m.stack||m.message);return}d=setTimeout;c=this.Ib;this.O=oa();f=this.pb;this.aa&&(f=Math.round(f*this.aa/this.pa));f-=this.O- -this.oa;if(e=this.O-this.F)this.K=Math.round(this.G/(10*e))/100,864E5<=e&&(this.R=0,Nc(this));if(0>f||this.Kf&&(this.F-=f),f=0;this.wa+=this.aa;this.O+=f;d(c,f)}else K(this),this.w&&this.w.stop(oa(),Lc(this))};l.Ab=function(){return 0};l.ka=function(a){ob(this,!0);Qc(this);Oc(this,this.G);this.G=0;if(this.j.ea){this.j.ea=!1;this.$&&this.$.stop();var b=this.I.run;b&&(b.textContent="Run")}this.j.complete=a};function K(a,b){a.w&&a.w.ta(b)} -function Rc(a){this.Yc=+a.model||1170;this.$b=a.resetAddr||0;rc.call(this,a,1E6);this.Ia=0;this.decode=Sc.bind(this);this.ha=65536;this.ya=32768;this.za=65535;this.xa=32768;this.i=[0,0,0,0,0,0,0,this.$b];this.bb=[0,0,0,0,0,0];this.Pa=[0,0,0,0];this.Oa=255;this.bc=this.Ob=this.tb=this.B=this.Sa=this.Eb=this.Ra=this.ba=this.H=this.fc=0;this.lb=[7,7,7,7];this.ia=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535, -65535,65535,65535,65535,65535,65535,65535,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Xb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.lc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.f=-1;this.T=0;this.jb=70;this.Y=-1;this.u=[];this.Kb=0;this.Na=2;Tc(this);this.j.complete=this.j.Lc=!1}w(Rc,rc);l=Rc.prototype; -l.reset=function(){this.j.ea&&this.ka();Uc(this);uc(this);this.j.error=!1;this.parent.reset.call(this)};function Uc(a){a.Oa=255;a.H=0;a.u=[];a.fc=0;a.ba=a.Ra=a.Eb=a.Sa=a.tb=0;a.lb[0]=a.lb[1]=a.lb[3]=7;a.Ob=0;Tc(a)}function Tc(a){a.tb?(a.Ha=65536,a.W=a.Sc,a.Tb=a.Ga):(a.Ha=0,a.W=a.Rc,a.Tb=a.ec)}l.zc=function(){return 0};l.save=function(){var a=new M(this);a.set(0,[]);a.set(1,[this.Ta,this.R,this.mb]);a.set(2,Fb(this.C));return a.data()}; -l.restore=function(a){var b=a[1];this.Ta=b[0];this.R=b[1];Nc(this,b[3]);a:{b=this.C;a=a[2];var d;for(d=0;db){a.u[e].Xa-=b;break}b-=a.u[e].Xa}a.u.splice(e+1,0,{delay:b,priority:d<<5&224,vector:c,callback:f})}a.Na=2}function Rb(a){return a.ga=a.ga&63728|Xc(a)|Wc(a)|Vc(a)|(a.ha&65536?1:0)} -function Sb(a,b){a.xa=b<<12;a.za=~b&4;a.ya=b<<14;a.ha=b<<16;if((b^a.ga)&2048)for(var d=a.bb.length;0<=--d;){var c=a.i[d];a.i[d]=a.bb[d];a.bb[d]=c}a.B=b>>14&3;d=a.ga>>14&3;a.B!=d&&(a.Pa[d]=a.i[6],a.i[6]=a.Pa[a.B]);a.Na=2;a.ga=b}function Yc(a,b){a.T&128||(a.xa=a.za=a.ha=b,a.ya=0)}function Zc(a,b){a.T&128||(a.xa=a.za=b,a.ya=0)}function $c(a,b,d,c){a.T&128||(a.xa=a.za=a.ha=b,a.ya=(d^c)&(c^b))} -function J(a,b,d){var c=!1;0>a.Y?a.Y=Rb(a):a.B||(b=4,c=!0);a.ba&57344||(a.Ra=63222,a.Eb=b);a.B=0;var f=a.Ga(b|65536),e=a.Ga(b+2&65535|65536);Sb(a,e&53247|a.Y>>2&12288);c&&(a.H|=4,a.i[6]=4);ad(a,a.Y);ad(a,a.i[7]);a.i[7]=f;a.T&=-113;a.Y=-1;throw b|d<<8;}function $b(a,b){var d=b>>13&31;31>d?a.Sa&32&&(b=a.Xb[d]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b} -function bd(a,b,d){var c,f,e,g=0;if(d&a.tb){c=b>>13&a.lb[a.B];f=a.ia[a.B][c];e=(a.ia[a.B][c+16]<<6)+(b&8191)&4194303;a.Sa&16?3932160<=e&&4186112>e&&(e=$b(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.H|=32,J(a,4,24)),e&1&&!(d&1)&&(a.H|=64,J(a,4,26)));switch(f&7){case 1:g=4096;case 2:f|=128;d&4&&(g=8192);break;case 4:g=4096;case 5:d&4&&(g=4096);case 6:f|=d&4?192:128;break;default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2& -8128)&&(g|=16384));a.ia[a.B][c]=f;if(4194170!==e||a.B)a.Ob=a.B,a.bc=c;g&&(g&57344&&(0<=a.Y&&(g|=128),a.ba&57344||(a.ba=a.ba|g|a.Ob<<5|a.bc<<1),J(a,168,28)),a.ba&61440||!(4191360>e||4194239>3&7){case 0:J(a,4,34);break;case 1:return 6===e&&!a.B&&d&4&&(a.i[6]<=a.Oa||65534<=a.i[6])&&(a.i[6]<=a.Oa-32||65534<=a.i[6]?(a.H|=4,a.i[6]=4,J(a,4,36)):(a.H|=8,a.T|=64)),7===e?a.i[e]:a.i[e]|g;case 2:f=2;c=a.i[e];7!==e&&(c|=g,6>e&&d&1&&(f=1));break;case 3:f=2;c=a.i[e];7!==e&&(c|=g);if(0>(c=a.Ga(c)))return c;c|=g;break;case 4:f=-2;6>e&&d&1&&(f=-1);c=a.i[e]+f&65535;7!==e&&(c|=g);break;case 5:f=-2;c=a.i[e]-2&65535;7!==e&&(c|=g);if(0>(c=a.Ga(c)))return c; -c|=g;break;case 6:if(0>(c=a.Ga(a.i[7])))return c;a.i[7]=a.i[7]+2&65535;c=c+a.i[e]&65535;return c|g;case 7:if(0>(c=a.Ga(a.i[7])))return c;a.i[7]=a.i[7]+2&65535;c=c+a.i[e]&65535;return 0>(c=a.Ga(c|65536))?c:c|g}a.i[e]=a.i[e]+f&65535;!g||a.ba&57344||(a.Ra=a.Ra<<8|f<<3&248|e);6===e&&!a.B&&d&4&&0>=f&&(a.i[6]<=a.Oa||65534<=a.i[6])&&(a.i[6]<=a.Oa-32?(a.H|=4,a.i[6]=4,J(a,4,38)):(a.H|=8,a.T|=64));return c}l.Rc=function(a,b){return ed(this,a,b)};l.Sc=function(a,b){return bd(this,ed(this,a,b),b)}; -function N(a,b){return b&56?a.Tb(ed(a,b,2)):a.i[b&7]}function fd(a,b){return b&56?cd(a,a.W(b,3)):a.i[b&7]&255}function gd(a,b,d,c){b&56?(b=a.W(b,6),Zb(a,b,c.call(a,d,a.ec(b)))):(b&=7,a.i[b]=c.call(a,d,a.i[b])&65535)}function hd(a,b,d,c){b&56?(b=a.W(b,7),dd(a,b,c.call(a,d,cd(a,b)))):(b&=7,a.i[b]=a.i[b]&65280|c.call(a,d,a.i[b])&255)}function id(a,b,d){b&56?Zb(a,a.W(b,4),d):a.i[b&7]=d&65535;return d} -function jd(a,b,d,c){b&56?dd(a,a.W(b,5),d):(b&=7,a.i[b]=d?c&1?d<<24>>24&65535:a.i[b]&-256|d&255:a.i[b]&-256);return d}function O(a,b){return a.i[7]+(b<<24>>23)&65535} -l.Ab=function(a){this.j.complete=!0;var b=this.j.Lc=this.D&&kd(this.D),d=a?this.j.qc?0:1:-1;this.j.qc=!1;this.P=this.b=a;this.Ta&256?(Qc(this),a=!1):a=!0;if(a){do{if(b){if(ld(this.D,this.i[7],d)){this.ka();break}d=1}var c,f;this.T&112&&(this.T&32?J(this,168,52):this.T&64?J(this,4,54):this.T&16&&J(this,12,56),this.T&=-113);if(this.Na)if(1===this.Na)this.Na=2;else{this.Na=0;f=-1;a=this.fc&224;if(0<(c=this.u.length))for(;0a&&(a=this.u[c].Zc,f=c)}a>(this.ga&224)&&(0>f?J(this,160,42):(J(this,this.u[f].nd,44),this.u.splice(f,1)))}this.ba&57344||(this.Ra=0,this.Eb=this.i[7]);this.T=this.ga&16;this.f=a=this.Ga(this.i[7]);0<=a&&(this.i[7]=this.i[7]+2&65535);this.decode(a);if(0>this.f){this.i[7]=this.i[7]-2&65535;this.g("unimplemented");break}}while(0>6&7;ad(this,this.i[a]);this.i[a]=this.i[7];this.i[7]=b;--this.b}function wd(){this.f=-1;--this.b}function xd(){--this.b}function R(a){a&1&&(this.ha=65536);a&2&&(this.ya=32768);a&4&&(this.za=0);a&8&&(this.xa=32768);--this.b}function yd(){this.f=-1;--this.b}function zd(){this.f=-1;--this.b} -function S(){J(this,8,48)}function Sc(a){Ad[a>>12].call(this,a)} -var Ad=[function(a){Bd[a>>8&15].call(this,a)},function(a){Zc(this,id(this,a,N(this,a>>6)));--this.b},function(a){var b=N(this,a>>6);a=N(this,a);$c(this,b-a,a,b);--this.b},function(a){Zc(this,N(this,a>>6)&N(this,a));--this.b},function(a){gd(this,a,N(this,a>>6),nd);--this.b},function(a){gd(this,a,N(this,a>>6),pd);--this.b},function(a){gd(this,a,N(this,a>>6),md);--this.b},function(a){Cd[a>>8&15].call(this,a)},function(a){Dd[a>>8&15].call(this,a)},function(a){var b=fd(this,a>>6);Zc(this,jd(this,a,b,1)<< -8);--this.b},function(a){var b=fd(this,a>>6)<<8;a=fd(this,a)<<8;$c(this,b-a,a,b);--this.b},function(a){Zc(this,(fd(this,a>>6)&fd(this,a))<<8);--this.b},function(a){hd(this,a,fd(this,a>>6),od);--this.b},function(a){hd(this,a,fd(this,a>>6),qd);--this.b},function(a){gd(this,a,N(this,a>>6),rd);--this.b},S],Bd=[function(a){Ed[a>>4&15].call(this,a)},function(a){this.i[7]=O(this,a);--this.b},function(a){Wc(this)||(this.i[7]=O(this,a));--this.b},function(a){Wc(this)&&(this.i[7]=O(this,a));--this.b},function(a){!Xc(this)== -!Vc(this)&&(this.i[7]=O(this,a));--this.b},function(a){!Xc(this)!=!Vc(this)&&(this.i[7]=O(this,a));--this.b},function(a){Wc(this)||!Xc(this)!=!Vc(this)||(this.i[7]=O(this,a));--this.b},function(a){if(Wc(this)||!Xc(this)!=!Vc(this))this.i[7]=O(this,a);--this.b},vd,vd,function(a){Fd[a>>6&3].call(this,a)},function(a){Gd[a>>6&3].call(this,a)},function(a){Hd[a>>6&3].call(this,a)},function(a){Id[a>>6&3].call(this,a)},S,S],Ed=[function(a){Jd[a&15].call(this,a)},S,S,S,S,S,S,S,function(a){var b=this.Ga(this.i[6]| -65536);0<=b&&(this.i[6]=this.i[6]+2&65535);a&=7;this.i[7]=this.i[a];this.i[a]=b;--this.b},function(a){this.ga&49152||(this.ga=this.ga&-2017|(a&7)<<5,this.Na=1);--this.b},function(a){Kd[a&15].call(this,a)},function(a){Ld[a&15].call(this,a)},S,S,S,S],Kd=[xd,function(){this.ha=0;--this.b},function(){this.ya=0;--this.b},Q,function(){this.za=1;--this.b},Q,Q,Q,function(){this.xa=0;--this.b},Q,Q,Q,Q,Q,Q,Q],Ld=[xd,function(){this.ha=65536;--this.b},function(){this.ya=32768;--this.b},R,function(){this.za= -0;--this.b},R,R,R,function(){this.xa=32768;--this.b},R,R,R,R,R,R,R],Jd=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.ga&49152||(Uc(this),this.C.reset());--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},S,S,S,S,S,S,S,S],Cd=[wd,wd,ud,ud,sd,sd,td,td,zd,zd,S,S,S,S,yd,yd],Dd=[function(a){Xc(this)||(this.i[7]=O(this,a));--this.b},function(a){Xc(this)&&(this.i[7]= -O(this,a));--this.b},function(a){this.ha&65536||Wc(this)||(this.i[7]=O(this,a));--this.b},function(a){if(this.ha&65536||Wc(this))this.i[7]=O(this,a);--this.b},function(a){Vc(this)||(this.i[7]=O(this,a));--this.b},function(a){Vc(this)&&(this.i[7]=O(this,a));--this.b},function(a){this.ha&65536||(this.i[7]=O(this,a));--this.b},function(a){this.ha&65536&&(this.i[7]=O(this,a));--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(a){Md[a>>6&3].call(this,a)},function(a){Nd[a>> -6&3].call(this,a)},function(a){Od[a>>6&3].call(this,a)},function(a){Pd[a>>6&3].call(this,a)},S,S],Fd=[function(a){Yc(this,id(this,a,0));--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Gd=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Hd=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Id= -[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Md=[function(a){Yc(this,jd(this,a,0));--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Nd=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Od=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f= --1;--this.b}],Pd=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}];function Qd(a){u.call(this,"ROM",a,Qd);this.f=null;this.F=a.addr;this.w=a.size;this.G=a.writable;this.u=a.alias;this.B=a.file;this.K=ea(this.B);if(this.B){a=this.B;var b=fa(this.K);"json"!=b&&"hex"!=b&&(a=ha()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var d=this;ta(a,null,!0,function(a,b,e){pe(d,a,b,e)})}}w(Qd); -Qd.prototype.Za=function(a,b,d,c){this.C=b;this.b=d;this.D=c;qe(this)};Qd.prototype.Ma=function(){if(this.Ja){if(this.D){var a=this.D,b=this.id,d=this.F,c=this.w,f=this.Ja,e=[],g;for(g in f){var h=f[g];"number"==typeof h&&(f[g]=h={o:h});var k=h.o,m=h.a;if(void 0!==k){var n=e,k=[k>>>0,g],q=na(n,k,a.wc);0>q&&n.splice(-(q+1),0,k)}m&&(h.a=m.replace(/''/g,'"'))}a.G.push({sd:b,A:d,Vc:c,Ja:f,tc:e})}delete this.Ja}return!0};Qd.prototype.La=function(){return!0}; -function pe(a,b,d,c){if(c)a.ma("Unable to load system ROM (error "+c+": "+b+")");else{Xa(a.uc,b,d);var f;if("["==d.charAt(0)||"{"==d.charAt(0))try{var e,g,h=eval("("+d+")");if(e=h.bytes)a.f=e;else if(e=h.words)for(a.f=Array(2*e.length),g=f=0;f>8&255;else if(e=h.data)for(a.f=Array(4*e.length),g=f=0;f>8&255,a.f[g++]=e[f]>>16&255,a.f[g++]=e[f]>>24&255;else a.f=h;a.Ja=h.symbols;if(!a.f.length){t("Empty ROM: "+ -b);return}if(1==a.f.length){t(a.f[0]);return}}catch(k){a.ma("ROM data error: "+k.message);return}else for(b=d.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.f=Array(b.length),f=0;f>>c.S].Cb(f&c.f,a.f[d]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.u?b.push(a.u):null!=a.u&&a.u.length&&(b=a.u);for(d=0;d>>f.S;0>>=f.S;0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; -function ve(a,b,d,c){if(d)if(b){0>a.B&&a.u.length&&(a.B=0);if(0>a.B||b!=a.u[a.B])a.u.splice(0,0,b),a.B=0;a.B--}else a.Y?b="end":b=a.u[a.B+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");d=0;var f=null;c=c||";";for(var e=0;e<=b.length;e++){var g=b.charAt(e);if('"'==g||"'"==g)f?g==f&&(f=null):f=g;else if(g==c&&!f||!g)a.push(ma(b.substring(d,e))),d=e+1}}return a} -function we(a,b,d){for(d=d||-1;d--&&b.length;){var c=b.pop();if(2>a.length)return!1;var f=a.pop(),e=a.pop();switch(c){case "*":c=e*f;break;case "/":if(!f)return!1;c=e/f;break;case "%":if(!f)return!1;c=e%f;break;case "+":c=e+f;break;case "-":c=e-f;break;case "<<":c=e<>":c=e>>f;break;case ">>>":c=e>>>f;break;case "<":c=e":c=e>f?1:0;break;case ">=":c=e>=f?1:0;break;case "==":c=e==f?1:0;break;case "!=":c=e!=f?1:0;break;case "&":c=e&f;break; -case "^":c=e^f;break;case "|":c=e|f;break;case "&&":c=e&&f?1:0;break;case "||":c=e||f?1:0;break;default:return!1}a.push(c|0)}return!0} -function xe(a,b,d){var c;if(b){b=ye(a,b);for(var f=0,e=!1,g=b,h=[],k=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);f>=1;g=n+g;c>>=8}c=r(d,0,!0)+" "+d+". "+da(d,0,!0)+" "+("0b"+g)}a.g((null!=b?b+": ":"")+c);return f} -function Be(a,b){if(b)return Ae(a,b,a.fa[b]);var d=0;for(b in a.fa)Ae(a,b,a.fa[b]),d++;return 0>5&3;c.sa=a>>1&15;c.Zb=a&257?a&1?6:4:0;Rb(c);a=c.B;a&1|256&&(b=this.b.cb&16?1:2);this.w.qb=this.w.qb&-8|b};l.$c=function(){return this.u.ra}; +l.pd=function(a){if(128==(this.u.ra&192)&&a&64){var b=this;H(this.b,8,4,52,function(){b.u.ra|=128;return!!(b.u.ra&64)})}this.u.ra=this.u.ra&128|a&-129};l.Zc=function(){return Sb(this.b)};l.od=function(a){Tb(this.b,a&-1809|Sb(this.b)&1808);this.b.T|=128}; +function Ub(a){var b=a.B,c,d,f,e=b.pa>>13&7;"undefined"===typeof b.ka[e]&&(b.ka[e]={cache:[],postProcess:a.ad,drive:e,blocksize:256,mapped:0,maxblock:b.fb[e]*b.V[e],url:"rk"+e+".dsk"});b.M&=-129;switch(b.M>>1&7){case 0:b.Rb=2496;b.ia=0;b.M=128;b.pa=0;break;case 1:if((b.pa>>4&511)>=b.fb[e]){b.ia|=32832;b.M|=49152;break}if((b.pa&15)>=b.V[e]){b.ia|=32800;b.M|=49152;break}c=(b.pa>>4&511)*b.V[e]+(b.pa&15);d=(b.M&48)<<12|b.Qb;f=65536-b.Sb&65535;Vb(a,b.ka[e],c,d,f);return;case 2:if((b.pa>>4&511)>=b.fb[e])b.ia|= +32832,b.M|=49152;else if((b.pa&15)>=b.V[e])b.ia|=32800,b.M|=49152;else{c=(b.pa>>4&511)*b.V[e]+(b.pa&15);d=(b.M&48)<<12|b.Qb;f=65536-b.Sb&65535;a.bc(b.ka[e],c,d,f);return}}b.Rb=e<<13|b.Rb&8176|b.pa%9&15;H(a.b,20,5,144,function(){b.M=b.M&65534|128;return!!(b.M&64)})}l.ad=function(a,b,c,d,f){var e=this.B;e.Qb=d&65535;e.M=e.M&-49|d>>12&48;e.Sb=65536-f&65535;switch(a){case 1:e.ia|=33024;e.M|=49152;break;case 2:e.ia|=33792,e.M|=49152}H(this.b,20,5,144,function(){e.M=e.M&65534|128;return!!(e.M&64)})}; +function Wb(a){var b=a.D,c,d,f,e=b.J>>8&3;b.J&=-2;"undefined"===typeof b.ka[e]&&(b.ka[e]={cache:[],postProcess:a.bd,drive:e,blocksize:128,mapped:1,maxblock:b.fb[e]*b.V[e],url:"rl"+e+".dsk"});switch(b.J>>1&7){case 2:b.Xa&8&&(b.J&=63);b.Xa=b.Hc[e]|b.ab&64;break;case 3:1==(b.$&3)&&(b.ab=b.$&4?b.ab+(b.$&65408)&65408|b.$<<2&64:b.ab-(b.$&65408)&65408|b.$<<2&64,b.$=b.ab);break;case 4:b.Xa=b.ab;break;case 5:if(b.$>>6>=b.fb[e]){b.J|=37888;break}if((b.$&63)>=b.V[e]){b.J|=37888;break}c=(b.$>>6)*b.V[e]+(b.$& +63);d=(b.Ra&63)<<16|b.Fb;f=65536-b.Xa&65535;Vb(a,b.ka[e],c,d,f);return;case 6:if(b.$>>6>=b.fb[e])b.J|=37888;else if((b.$&63)>=b.V[e])b.J|=37888;else{c=(b.$>>6)*b.V[e]+(b.$&63);d=(b.Ra&63)<<16|b.Fb;f=65536-b.Xa&65535;a.bc(b.ka[e],c,d,f);return}}H(a.b,20,5,112,function(){b.J|=129;return!!(b.J&64)})} +l.bd=function(a,b,c,d,f){var e=this.D;e.Fb=d&65535;e.J=e.J&-49|d>>12&48;e.Ra=d>>16&63;e.$=~~(c/e.V[b.Ka])<<6|c%e.V[b.Ka];e.ab=e.$;e.Xa=65536-f&65535;switch(a){case 1:e.J|=33792;break;case 2:e.J|=40960}H(this.b,20,5,112,function(){e.J|=129;return!!(e.J&64)})};function Xb(a){a=a.G;a.N=2176;a.Aa=0;a.ma=[4544,4544,4544,4544,4544,4544,4544,4544];a.vb=[0,0,0,0,0,0,0,0];a.lb=a.wb=a.ub=a.$a=a.nc=0} +function Yb(a,b){var c=a.G,d,f,e;c.N&=-16513;c.Aa&=-2049;c.ma[b]&=-1153;H(a.b,-1,0,172);"undefined"===typeof c.ka[b]&&(c.ka[b]={cache:[],postProcess:a.cd,drive:b,blocksize:256,mapped:0,maxblock:c.fc[0]*c.eb[0]*c.V[0],url:"rp"+b+".dsk"});switch(c.N&63){case 5:c.dc[b]=c.Pa[b];c.N|=32896;c.ma[b]|=32896;c.lb|=1<=c.fc[0]||c.Ba[b]>>8>=c.eb[0]||(c.Ba[b]&255)>=c.V[0]){c.vb[b]|=1024;c.N|=49152;break}d=(c.Pa[b]*c.eb[0]+(c.Ba[b]>>8))*c.V[0]+ +(c.Ba[b]&255);f=(c.$a&63)<<16|c.ub;e=65536-c.wb&65535;Vb(a,c.ka[b],d,f,e);return;case 57:if(c.Pa[b]>=c.fc[0]||c.Ba[b]>>8>=c.eb[0]||(c.Ba[b]&255)>=c.V[0])c.vb[b]|=1024,c.N|=49152;else{d=(c.Pa[b]*c.eb[0]+(c.Ba[b]>>8))*c.V[0]+(c.Ba[b]&255);f=(c.$a&63)<<16|c.ub;e=65536-c.wb&65535;a.bc(c.ka[b],d,f,e);return}}H(a.b,3,5,172,function(){c.N=c.N&65534|128;c.ma[b]|=128;return!!(c.N&64)})} +l.cd=function(a,b,c,d,f){var e=this.G;e.wb=65536-f&65535;e.ub=d&65535;e.N=e.N&-769|d>>8&768;e.$a=d>>16&63;f=~~(c/e.V[0]);d=~~(f/e.eb[0]);e.Ba[b.Ka]=f%e.eb[0]<<8|c%e.V[0];e.dc[b.Ka]=e.Pa[b.Ka]=d;e.lb|=1<=b.Uc-1&&(e.ma[b.Ka]|=1024);switch(a){case 1:e.Aa|=512;e.N|=49152;break;case 2:e.Aa|=2048,e.N|=49152}H(this.b,20,5,172,function(){e.ma[b.Ka]|=128;e.N=e.N&65534|128;return!!(e.N&64)})};l.Rc=function(){this.f.Wa|=128;this.f.Wa&64&&H(this.b,0,6,64)}; +function Zb(a,b,c,d,f,e){var g=~~((e+c.Sa-1)/c.Sa),h=new XMLHttpRequest;2048>g&&d+2048$b(this.b,a.Tc?ac(this.b,c):c,a.cache[b][f])){a.ac(2,a,b,c,d);return}c+=2;--d}b++}a.ac(0,a,b,c,d)}; +function Vb(a,b,c,d,f){for(var e,g;0g){b.ac(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.ac(0,b,c,d,f)}l.reset=function(){this.w.qb=this.w.qb&-120|20;this.u.Ga=0;this.u.ra=128;this.f.Wa=0;this.B.M=128;this.D.J=128;Xb(this)}; +l.Gc=function(a,b,c){var d,f,e=this.b;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=e.Ya&65280:(a&1&&(b<<=8),e.Ya=b|255,d=0);break;case 4194298:if(0>b)d=e.mc;else{a&1&&(b<<=8);if(d=b&65024){f=d>>9;do d+=34;while(f>>=1)}e.mc=d;e.Na=2}break;case 4194294:if(70!==e.ib)return J(e,4);0>b?d=e.H:d=e.H=0;break;case 4194292:if(70!==e.ib)return J(e,4);d=1;break;case 4194290:if(70!==e.ib)return J(e,4);d=0;break;case 4194288:if(70!==e.ib)return J(e,4);d=61183;break;case 4194296:0<=b&&!(a&1)&&(b&= +255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.ib)return J(e,4);f=a-4194272>>1;0>b?d=e.ic[f]:(d=I(this,e.ic[f],a,b,c),0<=d&&(e.ic[f]=d));break;case 4194254:return a&1?e.fa>>14&1?(0<=b&&(e.i[6]=b),d=e.i[6]):(0<=b&&(e.Oa[3]=b),d=e.Oa[3]):e.fa>>14&0?(0<=b&&(e.i[6]=b),d=e.i[6]):(0<=b&&(e.Oa[1]=b),d=e.Oa[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.fa&2048?(0<=b&&(e.i[f]=b),d=e.i[f]):(0<=b&&(e.Za[f]=b),d=e.Za[f]),d; +case 4194246:return a&1?(0<=b&&(e.i[7]=b),d=e.i[7]):e.fa>>14&0?(0<=b&&(e.i[6]=b),d=e.i[6]):(0<=b&&(e.Oa[0]=b),d=e.Oa[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.fa&2048?(0<=b&&(e.Za[f]=b),d=e.Za[f]):(0<=b&&(e.i[f]=b),d=e.i[f]),d;default:return e.H|=16,J(e,4)}break;case 4194176:f=a>>1&31;d=I(this,e.ha[3][f],a,b,c);0<=d&&(e.ha[3][f]=d,e.ha[3][f&15]&=65295);break;case 4194112:var g=this.u;switch(a&-2){case 4194174:d=I(this,e.Wb,a,b,c);0<=d&&(e.Wb=d);break;case 4194172:d=e.bb;d&65280&& +(d=(d<<8|d>>8)&65535);break;case 4194168:0>b?d=this.w.kd&65535:(d=I(this,this.w.data,a,b,c),0<=d&&(this.w.data=d));break;case 4194166:0<=b&&(b&127&&(g.Lc=0),g.ra&=-129,H(e,100,4,52,function(){g.ra|=128;return!!(g.ra&64)}));d=0;break;case 4194162:d=0;0>b&&(g.Ga&=-129,0b?d=g.Ga:(d=I(this,g.Ga,a,b,c),0<=d&&(g.Ga=g.Ga&128|d&-129));break;default:return e.H|=16,J(e,4)}break;case 4194048:f= +this.B;switch(a&-2){case 4194048:d=I(this,f.Rb,a,b,c);0<=d&&(f.Rb=d);break;case 4194050:d=I(this,f.ia,a,b,c);0<=d&&(f.ia=d);break;case 4194052:d=I(this,f.M,a,b,c);0<=b&&0<=d&&(f.M=d&-36993|f.M&36992,f.M&1&&Ub(this));break;case 4194054:d=I(this,f.Sb,a,b,c);0<=d&&(f.Sb=d);break;case 4194056:d=I(this,f.Qb,a,b,c);0<=d&&(f.Qb=d);break;case 4194058:d=I(this,f.pa,a,b,c);0<=d&&(f.pa=d);break;case 4194060:break;case 4194062:d=I(this,f.zc,a,b,c);0<=d&&(f.zc=d);break;default:return e.H|=16,J(e,4)}break;case 4193728:var h= +this.G;f=h.Aa&7;switch(a&-2){case 4193728:d=I(this,h.N,a,b,c);0<=b&&0<=d&&(h.$a=h.$a&60|d>>8&3,h.N=d&17279|h.N&34944|2048,d&1&&h.N&128?Yb(this,f):192==(d&192)&&H(e,0,5,172));break;case 4193730:d=I(this,h.wb,a,b,c);0<=d&&(h.wb=d);break;case 4193732:d=I(this,h.ub,a,b,c);0<=d&&(h.ub=d&65534);break;case 4193734:d=I(this,h.Ba[f],a,b,c);0<=d&&(h.Ba[f]=d&7967);break;case 4193736:d=I(this,h.Aa,a,b,c);0<=d&&(h.Aa=d&63|h.Aa&65472,d&128&&Xb(this));break;case 4193738:d=h.ma[f];break;case 4193740:d=h.vb[f];break; +case 4193742:d=I(this,h.lb,a,b,c);0<=d&&(h.lb=d&255);break;case 4193744:d=h.hd[f];break;case 4193746:d=I(this,h.Ac,a,b,c);0<=d&&(h.Ac=d);break;case 4193748:d=I(this,h.Bc[f],a,b,c);0<=d&&(h.Bc[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=h.jd[f];break;case 4193754:d=I(this,h.Cc[f],a,b,c);0<=d&&(h.Cc[f]=d);break;case 4193756:d=I(this,h.Pa[f],a,b,c);0<=d&&(h.Pa[f]=d&511);break;case 4193758:h.dc[f]=h.Pa[f];d=h.dc[f];break;case 4193760:d=h.fd[f];break;case 4193762:d=h.gd[f];break;case 4193764:d= +h.dd[f];break;case 4193766:d=h.ed[f];break;case 4193768:d=I(this,h.$a,a,b,c);0<=d&&(h.$a=d&63,h.N=h.N&-769|(d&3)<<8);break;case 4193770:d=I(this,h.nc,a,b,c);0<=d&&(h.nc=d);break;default:return e.H|=16,J(e,4)}break;case 4192512:f=this.D;switch(a&-2){case 4192512:d=I(this,f.J,a,b,c);0<=b&&0<=d&&(f.Ra=f.Ra&60|d>>4&3,f.J=f.J&-1023|d&1022,f.J&128||Wb(this));break;case 4192514:d=I(this,f.Fb,a,b,c);0<=d&&(f.Fb=d&65534);break;case 4192516:d=I(this,f.$,a,b,c);0<=d&&(f.$=d);break;case 4192518:d=I(this,f.Xa, +a,b,c);0<=d&&(f.Xa=d);break;case 4192520:d=I(this,f.Ra,a,b,c);0<=d&&(f.Ra=d&63,f.J=f.J&-49|(f.Ra&3)<<4);break;default:return e.H|=16,J(e,4)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.cb:(d=I(this,e.cb,a,b,c),0<=d&&(70!==e.ib&&(d&=-49),e.cb=d,e.$b[0]=d&4?15:7,e.$b[1]=d&2?15:7,e.$b[3]=d&1?15:7,e.Zb&&(f=2,e.cb&16&&(f=1),this.w.qb=this.w.qb&-8|f)));break;default:return e.H|=16,J(e,4)}break;case 4191424:f=a>>1&31;d=I(this,e.ha[0][f],a,b,c);0<=d&&(e.ha[0][f]=d,e.ha[0][f&15]&=65295);break;case 4191360:f= +a>>1&31;d=I(this,e.ha[1][f],a,b,c);0<=d&&(e.ha[1][f]=d,e.ha[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!==e.ib)return J(e,4);f=a>>2&31;d=e.Tb[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=I(this,d,a,b,c),0<=d&&(e.Tb[f]=a&2?d<<16|e.Tb[f]&65535:e.Tb[f]&4294901760|d&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)d=Gb[a>>1&255];else return e.H|=16,J(e,4);break;default:return e.H|=16,J(e,4)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"=== +typeof d&&console.log("panic(76)");return d};var bc={},Hb=(bc[65382]=[null,null,G.prototype.Xc,G.prototype.md],bc[65402]=[null,null,G.prototype.Yc,G.prototype.nd],bc[65396]=[null,null,G.prototype.$c,G.prototype.pd],bc[65534]=[null,null,G.prototype.Zc,G.prototype.od],bc);Ma(function(){for(var a=C(document,"pdp11","device"),b=0;b>1),this.b=new Int32Array(this.B,0,c>>2),ic(this,ec?jc:kc);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},Y:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},na:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},ua:function(a,b){var c=a>> +2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<>8);this.Ua=!0},U:function(a,b){if(this.F&&null!=this.A){var c=this.F;pc(c,this.A+a,1,c.R)&&c.ja(!0)}return this.Ob(a,b)},aa:function(a,b){if(this.F&&null!=this.A){var c=this.F;pc(c,this.A+a,2,c.R)&&c.ja(!0)}return this.lc(a,b)},sa:function(a,b,c){if(this.F&&null!=this.A){var d=this.F;pc(d,this.A+ +a,1,d.D)&&d.ja(!0)}this.C?this.w(a,b,c):this.zb(a,b,c)},Da:function(a,b,c){if(this.F&&null!=this.A){var d=this.F;pc(d,this.A+a,2,d.D)&&d.ja(!0)}this.C?this.w(a,b,c):this.qc(a,b,c)},R:function(a){return this.f[a]},X:function(a){return this.f[a]},Z:function(a){return this.D.getUint16(a,!0)},ca:function(a){return a&1?this.f[a]|this.f[a+1]<<8:this.K[a>>1]},oa:function(a,b){this.f[a]=b;this.Ua=!0},ta:function(a,b){this.f[a]=b;this.Ua=!0},Ca:function(a,b){this.D.setUint16(a,b,!0);this.Ua=!0},Ia:function(a, +b){a&1?(this.f[a]=b,this.f[a+1]=b>>8):this.K[a>>1]=b;this.Ua=!0}};function vb(a,b,c){a.F=b;a.I=a.u=0;c&&((a.I=c.I)&&oc(a,nc,!1),(a.u=c.u)&&mc(a,nc,!1))}function qc(a,b){b?--a.u||(a.yb=a.C?a.w:a.zb,a.Ec=a.C?a.G:a.qc):--a.I||(a.tb=a.Ob,a.Pb=a.lc)}function mc(a,b,c){c&&a.u||(a.yb=!a.C&&b[1]||a.w,a.Ec=!a.C&&b[3]||a.G);if(c||void 0===c)a.zb=b[1]||a.w,a.qc=b[3]||a.G}function oc(a,b,c){c&&a.I||(a.tb=b[0]||a.O,a.Pb=b[2]||a.P);if(c||void 0===c)a.Ob=b[0]||a.O,a.lc=b[2]||a.P} +function ic(a,b){b||(b=rc);oc(a,b,void 0);mc(a,b,void 0)}var rc=[],lc=[F.prototype.Y,F.prototype.ua,F.prototype.na,F.prototype.Ab],nc=[F.prototype.U,F.prototype.sa,F.prototype.aa,F.prototype.Da];if(rb)var kc=[F.prototype.R,F.prototype.oa,F.prototype.Z,F.prototype.Ca],jc=[F.prototype.X,F.prototype.ta,F.prototype.ca,F.prototype.Ia]; +function sc(a,b){u.call(this,"CPU",a,sc,1);var c=a.multiplier||1;this.Da=a.cycles||b;this.kb=c;this.Ca=Math.round(this.Da/1E4)/100;this.jb=this.Ca*this.kb;this.j.ea=!1;this.j.pc=!1;this.j.Db=a.autoStart;this.j.wc=!1;this.j.pb=!1;this.Lb=this.X=0;this.Mb=a.csStart;this.rb=a.csInterval;this.sb=a.csStop;this.na=[];this.Hb=this.mb.bind(this);D(this)}w(sc);var tc=["power","reset"];l=sc.prototype; +l.Va=function(a,b,c,d){this.u=a;this.C=b;this.F=d;for(b=0;b=a.X&&(a.X+=a.rb,c=!0);0<=a.sb&&a.sb<=Mc(a)&&(a.rb=a.sb=-1,Kc(a),a.ja(),c=!0);c&&a.g(Mc(a)+" cycles: checksum="+r(a.Lb))}} +function Nc(a,b,c,d){if(a.I[b]){void 0===c&&(qb(a,"Value for "+b+" is invalid"),a.ja());var f=a.F&&a.F.Z||8;c=!a.j.ea||a.j.wc?8==f?da(c,d):r(c,d):"--------".substr(0,d||4);a.I[b].textContent!=c&&(a.I[b].textContent=c)}} +l.qa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.I[b]=c;a=!0;break;case "run":this.I[b]=c;c.onclick=function(){var a;if(a=d.u)if(a=d.u,a.j.ba)a=!0;else{var b=null,c,h=Ya(a.id);for(c=0;ca.P/a.jb?b=1:d=!0;a.kb=b;b=a.Ca*a.kb;if(a.jb!=b){a.jb=b;b=a.jb.toFixed(2)+"Mhz";var f=a.I.setSpeed;f&&(f.textContent=b);a.g("target speed: "+b)}c&&a.u&&a.u.Ub()}Pc(a,a.O);a.O=0;a.K=oa();a.R=0;Qc(a);return d} +l.mb=function(a){if(nb(this,!0)){if(!this.j.ea){Oc(this);this.u&&this.u.start(this.K,Mc(this));this.j.ea=!0;this.j.pc=!0;this.aa&&this.aa.start();var b=this.I.run;b&&(b.textContent="Halt");this.u&&(this.u.va(!0),a&&this.u.Ub(!0))}this.Ia>=this.Da&&Qc(this,!0);this.ca=0;this.ta=oa();this.R&&(a=this.ta-this.R,a>this.Eb&&(this.K+=a,this.K>this.ta&&(this.K=this.ta)));try{do{for(var c,d=this.j.pb?1:this.ua,f=this.na.length-1;0<=f;f--){var e=this.na[f];0>e[0]||d>e[0]&&(d=e[0])}c=d;try{this.xb(c)}catch(m){if("number"!= +typeof m)throw m;}var g=this.G-this.b;a=g;for(var h=this.na.length-1;0<=h;h--){var k=this.na[h];0>k[0]||(k[0]-=a,0>=k[0]&&(k[0]=-1,k[1]()))}this.ca+=g;this.O+=g;Pc(this,0,!0);Lc(this,g);this.Y-=g;if(0>=this.Y){this.Y+=this.ua;15<=++this.Gb&&(this.u&&this.u.va(),this.Gb=0);break}}while(this.j.ea)}catch(m){this.ja();K(this);this.u&&this.u.stop(oa(),Mc(this));nb(this,!1);qb(this,m.stack||m.message);return}c=setTimeout;d=this.Hb;this.R=oa();f=this.Eb;this.ca&&(f=Math.round(f*this.ca/this.ua));f-=this.R- +this.ta;if(e=this.R-this.K)this.P=Math.round(this.O/(10*e))/100,864E5<=e&&(this.U=0,Oc(this));if(0>f||this.Pf&&(this.K-=f),f=0;this.Ia+=this.ca;this.R+=f;c(d,f)}else K(this),this.u&&this.u.stop(oa(),Mc(this))};l.xb=function(){return 0};l.ja=function(a){ob(this,!0);this.G-=this.b;this.b=0;Pc(this,this.O);this.O=0;if(this.j.ea){this.j.ea=!1;this.aa&&this.aa.stop();var b=this.I.run;b&&(b.textContent="Run")}this.j.complete=a};function K(a,b){a.u&&a.u.va(b)} +function Rc(a){this.Vc=+a.model||1170;this.jc=a.resetAddr||0;sc.call(this,a,1E6);this.Bb=0;this.decode=Sc.bind(this);this.ga=65536;this.xa=32768;this.ya=65535;this.wa=32768;this.i=[0,0,0,0,0,0,0,this.jc];this.Za=[0,0,0,0,0,0];this.Oa=[0,0,0,0];this.sa=this.D=0;this.ha=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Tb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.ic=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.f=-1;this.T=0;this.ib=70;this.Z=-1;this.Xb=0;Tc(this);this.j.complete=this.j.Kc=!1}w(Rc,sc);l=Rc.prototype;l.reset=function(){this.j.ea&&this.ja();Tc(this);Jc(this);this.j.error=!1;this.parent.reset.call(this)}; +function Tc(a){a.Ya=255;a.H=0;a.mc=0;a.B=0;a.bb=0;a.Wb=0;a.cb=0;a.Zb=0;a.oa=0;a.$b=[7,7,7,7];a.w=[];a.Na=2;Rb(a)}function Rb(a){a.Zb?(a.nb=65536,a.W=a.Pc,a.Pb=a.Ha):(a.nb=0,a.W=a.Oc,a.Pb=a.cc)}l.yc=function(){return 0};l.save=function(){var a=new L(this);a.set(0,[]);a.set(1,[this.U,this.kb]);a.set(2,Fb(this.C));return a.data()}; +l.restore=function(a){var b=a[1];this.U=b[1];Oc(this,b[3]);a:{b=this.C;a=a[2];var c;for(c=0;cb){a.w[e].Ta-=b;break}b-=a.w[e].Ta}a.w.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.Na=2}function Sb(a){return a.fa=a.fa&63728|Wc(a)|Vc(a)|Uc(a)|(a.ga&65536?1:0)} +function Tb(a,b){a.wa=b<<12;a.ya=~b&4;a.xa=b<<14;a.ga=b<<16;if((b^a.fa)&2048)for(var c=a.Za.length;0<=--c;){var d=a.i[c];a.i[c]=a.Za[c];a.Za[c]=d}a.D=b>>14&3;c=a.fa>>14&3;a.D!=c&&(a.Oa[c]=a.i[6],a.i[6]=a.Oa[a.D]);a.Na=2;a.fa=b}function Xc(a,b){a.T&128||(a.wa=a.ya=a.ga=b,a.xa=0)}function Yc(a,b){a.T&128||(a.wa=a.ya=b,a.xa=0)}function Zc(a,b,c,d){a.T&128||(a.wa=a.ya=a.ga=b,a.xa=(c^d)&(d^b))} +function J(a,b){var c=!1;0>a.Z?a.Z=Sb(a):a.D||(b=4,c=!0);a.B&57344||(a.bb=63222,a.Wb=b);a.D=0;var d=a.Ha(b|65536),f=a.Ha(b+2&65535|65536);Tb(a,f&53247|a.Z>>2&12288);c&&(a.H|=4,a.i[6]=4);$c(a,a.Z);$c(a,a.i[7]);a.i[7]=d;a.T&=-113;a.Z=-1;throw b;}function ac(a,b){var c=b>>13&31;31>c?a.cb&32&&(b=a.Tb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b} +function ad(a,b,c){var d,f,e,g=0;if(c&a.Zb){d=b>>13&a.$b[a.D];f=a.ha[a.D][d];e=(a.ha[a.D][d+16]<<6)+(b&8191)&4194303;a.cb&16?3932160<=e&&4186112>e&&(e=ac(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.H|=32,J(a,4)),e&1&&!(c&1)&&(a.H|=64,J(a,4)));switch(f&7){case 1:g=4096;case 2:f|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:f|=c&4?192:128;break;default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2&8128)&& +(g|=16384));a.ha[a.D][d]=f;if(4194170!==e||a.D)a.oa=a.D,a.sa=d;g&&(g&57344&&(0<=a.Z&&(g|=128),a.B&57344||(a.B=a.B|g|a.oa<<5|a.sa<<1),J(a,168)),a.B&61440||!(4191360>e||4194239>3&7){case 0:J(a,4);break;case 1:return 6===e&&!a.D&&c&4&&(a.i[6]<=a.Ya||65534<=a.i[6])&&(a.i[6]<=a.Ya-32||65534<=a.i[6]?(a.H|=4,a.i[6]=4,J(a,4)):(a.H|=8,a.T|=64)),7===e?a.i[e]:a.i[e]|g;case 2:f=2;d=a.i[e];7!==e&&(d|=g,6>e&&c&1&&(f=1));break;case 3:f=2;d=a.i[e];7!==e&&(d|=g);if(0>(d=a.Ha(d)))return d;d|=g;break;case 4:f=-2;6>e&&c&1&&(f=-1);d=a.i[e]+f&65535;7!==e&&(d|=g);break;case 5:f=-2;d=a.i[e]-2&65535;7!==e&&(d|=g);if(0>(d=a.Ha(d)))return d; +d|=g;break;case 6:if(0>(d=a.Ha(a.i[7])))return d;a.i[7]=a.i[7]+2&65535;d=d+a.i[e]&65535;return d|g;case 7:if(0>(d=a.Ha(a.i[7])))return d;a.i[7]=a.i[7]+2&65535;d=d+a.i[e]&65535;return 0>(d=a.Ha(d|65536))?d:d|g}a.i[e]=a.i[e]+f&65535;!g||a.B&57344||(a.bb=a.bb<<8|f<<3&248|e);6===e&&!a.D&&c&4&&0>=f&&(a.i[6]<=a.Ya||65534<=a.i[6])&&(a.i[6]<=a.Ya-32?(a.H|=4,a.i[6]=4,J(a,4)):(a.H|=8,a.T|=64));return d}l.Oc=function(a,b){return dd(this,a,b)};l.Pc=function(a,b){return ad(this,dd(this,a,b),b)}; +function N(a,b){return b&56?a.Pb(dd(a,b,2)):a.i[b&7]}function ed(a,b){return b&56?bd(a,a.W(b,3)):a.i[b&7]&255}function fd(a,b,c,d){b&56?(b=a.W(b,6),$b(a,b,d.call(a,c,a.cc(b)))):(b&=7,a.i[b]=d.call(a,c,a.i[b])&65535)}function gd(a,b,c,d){b&56?(b=a.W(b,7),cd(a,b,d.call(a,c,bd(a,b)))):(b&=7,a.i[b]=a.i[b]&65280|d.call(a,c,a.i[b])&255)}function hd(a,b,c){b&56?$b(a,a.W(b,4),c):a.i[b&7]=c&65535;return c} +function id(a,b,c,d){b&56?cd(a,a.W(b,5),c):(b&=7,a.i[b]=c?d&1?c<<24>>24&65535:a.i[b]&-256|c&255:a.i[b]&-256);return c}function O(a,b){return a.i[7]+(b<<24>>23)&65535} +l.xb=function(a){this.j.complete=!0;var b=this.j.Kc=this.F&&jd(this.F),c=a?this.j.pc?0:1:-1;this.j.pc=!1;this.G=this.b=a;do{if(b){if(kd(this.F,this.i[7],c)){this.ja();break}c=1}this.T&112&&(this.T&32?J(this,168):this.T&64?J(this,4):this.T&16&&J(this,12),this.T&=-113);if(this.Na)if(1==this.Na)this.Na=2;else{this.Na=0;a=null;for(var d=this.mc&224,f=this.w.length;0<=--f;){if(0 +d&&(d=this.w[f].Wc,a=this.w[f],this.w.splice(f,1))}d>(this.fa&224)&&(a?J(this,a.ld):J(this,160))}this.B&57344||(this.bb=0,this.Wb=this.i[7]);this.T=this.fa&16;a=this.f=this.Ha(this.i[7]);0<=a&&(this.i[7]=this.i[7]+2&65535);this.decode(a);if(0>this.f){this.i[7]=this.i[7]-2&65535;this.g("unimplemented");break}}while(0>6&7;$c(this,this.i[a]);this.i[a]=this.i[7];this.i[7]=b;--this.b}function vd(){this.f=-1;--this.b}function wd(){--this.b}function R(a){a&1&&(this.ga=65536);a&2&&(this.xa=32768);a&4&&(this.ya=0);a&8&&(this.wa=32768);--this.b}function xd(){this.f=-1;--this.b}function yd(){this.f=-1;--this.b}function S(){J(this,8)}function Sc(a){zd[a>>12].call(this,a)} +var zd=[function(a){Ad[a>>8&15].call(this,a)},function(a){Yc(this,hd(this,a,N(this,a>>6)));--this.b},function(a){var b=N(this,a>>6);a=N(this,a);Zc(this,b-a,a,b);--this.b},function(a){Yc(this,N(this,a>>6)&N(this,a));--this.b},function(a){fd(this,a,N(this,a>>6),md);--this.b},function(a){fd(this,a,N(this,a>>6),od);--this.b},function(a){fd(this,a,N(this,a>>6),ld);--this.b},function(a){Bd[a>>8&15].call(this,a)},function(a){Cd[a>>8&15].call(this,a)},function(a){var b=ed(this,a>>6);Yc(this,id(this,a,b,1)<< +8);--this.b},function(a){var b=ed(this,a>>6)<<8;a=ed(this,a)<<8;Zc(this,b-a,a,b);--this.b},function(a){Yc(this,(ed(this,a>>6)&ed(this,a))<<8);--this.b},function(a){gd(this,a,ed(this,a>>6),nd);--this.b},function(a){gd(this,a,ed(this,a>>6),pd);--this.b},function(a){fd(this,a,N(this,a>>6),qd);--this.b},S],Ad=[function(a){Dd[a>>4&15].call(this,a)},function(a){this.i[7]=O(this,a);--this.b},function(a){Vc(this)||(this.i[7]=O(this,a));--this.b},function(a){Vc(this)&&(this.i[7]=O(this,a));--this.b},function(a){!Wc(this)== +!Uc(this)&&(this.i[7]=O(this,a));--this.b},function(a){!Wc(this)!=!Uc(this)&&(this.i[7]=O(this,a));--this.b},function(a){Vc(this)||!Wc(this)!=!Uc(this)||(this.i[7]=O(this,a));--this.b},function(a){if(Vc(this)||!Wc(this)!=!Uc(this))this.i[7]=O(this,a);--this.b},ud,ud,function(a){Ed[a>>6&3].call(this,a)},function(a){Fd[a>>6&3].call(this,a)},function(a){Gd[a>>6&3].call(this,a)},function(a){Hd[a>>6&3].call(this,a)},S,S],Dd=[function(a){Id[a&15].call(this,a)},S,S,S,S,S,S,S,function(a){var b=this.Ha(this.i[6]| +65536);0<=b&&(this.i[6]=this.i[6]+2&65535);a&=7;this.i[7]=this.i[a];this.i[a]=b;--this.b},function(a){this.fa&49152||(this.fa=this.fa&-2017|(a&7)<<5,this.Na=1);--this.b},function(a){Jd[a&15].call(this,a)},function(a){Kd[a&15].call(this,a)},S,S,S,S],Jd=[wd,function(){this.ga=0;--this.b},function(){this.xa=0;--this.b},P,function(){this.ya=1;--this.b},P,P,P,function(){this.wa=0;--this.b},P,P,P,P,P,P,P],Kd=[wd,function(){this.ga=65536;--this.b},function(){this.xa=32768;--this.b},R,function(){this.ya= +0;--this.b},R,R,R,function(){this.wa=32768;--this.b},R,R,R,R,R,R,R],Id=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.fa&49152||(Tc(this),this.C.reset());--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},S,S,S,S,S,S,S,S],Bd=[vd,vd,td,td,rd,rd,sd,sd,yd,yd,S,S,S,S,xd,xd],Cd=[function(a){Wc(this)||(this.i[7]=O(this,a));--this.b},function(a){Wc(this)&&(this.i[7]= +O(this,a));--this.b},function(a){this.ga&65536||Vc(this)||(this.i[7]=O(this,a));--this.b},function(a){if(this.ga&65536||Vc(this))this.i[7]=O(this,a);--this.b},function(a){Uc(this)||(this.i[7]=O(this,a));--this.b},function(a){Uc(this)&&(this.i[7]=O(this,a));--this.b},function(a){this.ga&65536||(this.i[7]=O(this,a));--this.b},function(a){this.ga&65536&&(this.i[7]=O(this,a));--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(a){Ld[a>>6&3].call(this,a)},function(a){Md[a>> +6&3].call(this,a)},function(a){Nd[a>>6&3].call(this,a)},function(a){Od[a>>6&3].call(this,a)},S,S],Ed=[function(a){Xc(this,hd(this,a,0));--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Fd=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Gd=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Hd= +[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Ld=[function(a){Xc(this,id(this,a,0));--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Md=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}],Nd=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f= +-1;--this.b}],Od=[function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b},function(){this.f=-1;--this.b}];function Pd(a){u.call(this,"ROM",a,Pd);this.f=null;this.D=a.addr;this.u=a.size;this.G=a.writable;this.w=a.alias;this.B=a.file;this.K=ea(this.B);if(this.B){a=this.B;var b=fa(this.K);"json"!=b&&"hex"!=b&&(a=ha()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var c=this;ta(a,null,!0,function(a,b,e){oe(c,a,b,e)})}}w(Pd); +Pd.prototype.Va=function(a,b,c,d){this.C=b;this.b=c;this.F=d;pe(this)};Pd.prototype.Ma=function(){if(this.Ja){if(this.F){var a=this.F,b=this.id,c=this.D,d=this.u,f=this.Ja,e=[],g;for(g in f){var h=f[g];"number"==typeof h&&(f[g]=h={o:h});var k=h.o,m=h.a;if(void 0!==k){var n=e,k=[k>>>0,g],q=na(n,k,a.vc);0>q&&n.splice(-(q+1),0,k)}m&&(h.a=m.replace(/''/g,'"'))}a.G.push({rd:b,A:c,Sc:d,Ja:f,sc:e})}delete this.Ja}return!0};Pd.prototype.La=function(){return!0}; +function oe(a,b,c,d){if(d)a.la("Unable to load system ROM (error "+d+": "+b+")");else{Xa(a.tc,b,c);var f;if("["==c.charAt(0)||"{"==c.charAt(0))try{var e,g,h=eval("("+c+")");if(e=h.bytes)a.f=e;else if(e=h.words)for(a.f=Array(2*e.length),g=f=0;f>8&255;else if(e=h.data)for(a.f=Array(4*e.length),g=f=0;f>8&255,a.f[g++]=e[f]>>16&255,a.f[g++]=e[f]>>24&255;else a.f=h;a.Ja=h.symbols;if(!a.f.length){t("Empty ROM: "+ +b);return}if(1==a.f.length){t(a.f[0]);return}}catch(k){a.la("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.f=Array(b.length),f=0;f>>d.S].zb(f&d.f,a.f[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.w?b.push(a.w):null!=a.w&&a.w.length&&(b=a.w);for(c=0;c>>f.S;0>>=f.S;0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; +function ue(a,b,c,d){if(c)if(b){0>a.B&&a.w.length&&(a.B=0);if(0>a.B||b!=a.w[a.B])a.w.splice(0,0,b),a.B=0;a.B--}else a.Y?b="end":b=a.w[a.B+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var f=null;d=d||";";for(var e=0;e<=b.length;e++){var g=b.charAt(e);if('"'==g||"'"==g)f?g==f&&(f=null):f=g;else if(g==d&&!f||!g)a.push(ma(b.substring(c,e))),c=e+1}}return a} +function ve(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var f=a.pop(),e=a.pop();switch(d){case "*":d=e*f;break;case "/":if(!f)return!1;d=e/f;break;case "%":if(!f)return!1;d=e%f;break;case "+":d=e+f;break;case "-":d=e-f;break;case "<<":d=e<>":d=e>>f;break;case ">>>":d=e>>>f;break;case "<":d=e":d=e>f?1:0;break;case ">=":d=e>=f?1:0;break;case "==":d=e==f?1:0;break;case "!=":d=e!=f?1:0;break;case "&":d=e&f;break; +case "^":d=e^f;break;case "|":d=e|f;break;case "&&":d=e&&f?1:0;break;case "||":d=e||f?1:0;break;default:return!1}a.push(d|0)}return!0} +function we(a,b,c){var d;if(b){b=xe(a,b);for(var f=0,e=!1,g=b,h=[],k=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);f>=1;g=n+g;d>>=8}d=r(c,0,!0)+" "+c+". "+da(c,0,!0)+" "+("0b"+g)}a.g((null!=b?b+": ":"")+d);return f} +function Ae(a,b){if(b)return ze(a,b,a.ca[b]);var c=0;for(b in a.ca)ze(a,b,a.ca[b]),c++;return 0>>c.C.S;k=1}c.g("blockid physical blockaddr used size type");c.g("-------- --------- ---------- ------ ------ ----");for(var d=-1,m=0;k--;){var n=b[f];n.type==d?m++||c.g("..."):(d=n.type,m=Db[d],n&&c.g(r(n.id,8)+" %"+r(f<>>d.S].Sb(c&d.f,c),b&&Le(a,b));return d};l.Ea=function(a,b){var d=65535,c=this.W(a,!1,2);-1!==c&&(d=Eb(this.C,c),b&&Le(a,b));return d}; -l.hc=function(a,b,d){var c=this.W(a,!0,1);if(-1!==c){var f=this.C;f.L[(c&f.C)>>>f.S].Cb(c&f.f,b&255,c);d&&Le(a,d);K(this.b,!0)}};l.pc=function(a,b,d){var c=this.W(a,!0,2);if(-1!==c){var f=this.C,e=c&f.f,g=(c&f.C)>>>f.S;e!=f.f?f.L[g].rc(e,b&65535,c):(f.L[g++].Cb(e,b&255,c),f.L[g&f.w].Cb(0,b>>8&255,c+1));d&&Le(a,d);K(this.b,!0)}};function V(a){return{A:a,Da:!1}}function Me(a){return[a.A,a.Da]}function Ne(a){return{A:a[0],Da:a[1]}} -function W(a,b,d){var c;d=(d?a.P:a.Db).A;if(void 0!==b){c=b=ye(a,b);var f;if(c.match(/^[a-z_][a-z0-9_]*$/i))for(c=c.toUpperCase(),d=0;dc&&(c+=b.length);0>c&&(c=0);for(var f=b.length;c>>c.S],!1)}a.R=["br"];if(a.F)for(b=1;b>>c.S],!0);a.F=["bw"];a.Ib=0} -l.hb=function(a,b,d){var c=!0;d||Te(this,a,b,!1,!0);if(a!=this.f){var f=this.W(b);if(-1===f)this.g("invalid address: "+T(this,b.A)),c=!1;else{var e=this.C;e.L[f>>>e.S].hb(f&e.f,a==this.F)}}c&&(a.push(b),d?b.Da=!0:(Ue(this,a,a.length-1,"set"),Ee(this)));return c};function Te(a,b,d,c,f){var e=!1;d=a.W(d);for(var g=1;g>>c.S],b==a.F));h.Da||Ee(a);break}}return e} -function Ve(a,b){for(var d=1;d>23)&65535,x=T(p,q);else if(8192==A)q=q.A-((e&63)<<1)&65535,x=T(p,q);else if(12288==A)x=T(p,e&7,2);else if(24576==A)x=T(p,e&63);else if(A=e&z,z&4032&&(A>>=6,z>>=6),z&63)switch(z=A&7,A&56){case 0:x=X(z);break;case 8:x="@"+X(z);break;case 16:7>z?x="("+X(z)+")+": -(A=p.Ea(q,2),x="#"+T(p,A));break;case 24:7>z?x="@("+X(z)+")+":(A=p.Ea(q,2),x="@#"+T(p,A));break;case 32:x="-("+X(z)+")";break;case 40:x="@-("+X(z)+")";break;case 48:A=p.Ea(q,2);x=T(p,A)+"("+X(z)+")";7==z&&(x=[x,T(p,A+q.A&65535)]);break;case 56:A=p.Ea(q,2),x="@"+T(p,A)+"("+X(z)+")",7==z&&(x=[x,T(p,A+q.A&65535)])}p=x;if(!p||!p.length){h="INVALID";break}"string"!=typeof p&&(d=p[1],c=null,p=p[0]);0a?"R"+a:6==a?"SP":"PC"} -function Ze(a,b){var d="",c=a.b;8>b?(d=X(b),d+="="+T(a,c.i[b])):13>b?d="A"+(b-8)+"="+T(a,c.bb[b-8]):16<=b&&20>b?d="S"+(b-16)+"="+T(a,c.Pa[b-16]):20==b&&(d="PS="+T(a,Rb(c)));d&&(d+=" ");return d}function $e(a){var b,d="";for(b=0;6>b;b++)d+=Ze(a,b);d=d+"\n"+(Ze(a,6)+Ze(a,7)+Ze(a,20));return d+=Ye(a,"T")+Ye(a,"N")+Ye(a,"Z")+Ye(a,"V")+Ye(a,"C")}l.wc=function(a,b){return a[0]>b[0]?1:a[0]>>0;for(b=0;b>>0,h=e.Vc;if(f>=g&&fh[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.g(m)}h[3]&&(g=h[3],e=null);e=Xe(a,b,g,e);a.g(e);a.P=b;f-=b.A-k;d++}}} -function We(a,b,d){var c=!0;try{b.length&&"end"!=b?d||a.g(">> "+b):(a.Y&&(a.g("ended assemble at "+T(a,a.X.A)),a.P=a.X,a.Y=!1),b="");var f=b.charAt(0);if('"'==f||"'"==f)return!0;a.wa=null;if(pb(a)&&0m||"z"Z.length&&(a.g("note: only "+Z.length+" available"),P=Z.length);U-=P;0>U&&(null==Z[Z.length-1].A?(P=U+P,U=0):U+=Z.length);var yc=[];"call"==Wd&&(Za=1E5,yc=["CALL"]);for(void 0!==Vd&&a.g(P+" instructions earlier:");0=Z.length&&(U=0);a.Kb=P;Yd++; -Za--}}Yd||(a.g("no "+Xd+"history available"),a.Kb=void 0)}else{var Ib=W(a,Y);if(Ib){var Jb=0;qa&&("l"==qa.charAt(0)&&(qa=qa.substr(1)||zf),Jb=ze(a,qa)>>>0,65536>4||1;Bf--&&0Lb?String.fromCharCode(Lb):"."; -Kb--}ab&&(ab+="\n");ab+=Y+" "+Ac+(0==cb?" "+ae:"")}ab&&a.g(ab);a.Db=Ib}}}}break;case "e":if("else"==e[0])break;var Mb=1,be=255,ce=a.Mb,de=a.hc;"ew"==e[0]&&(Mb=2,be=65535,ce=a.Ea,de=a.pc);var ee=Mb<<1,fe=e[1];if(null==fe)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var Nb=W(a,fe);if(Nb)for(var Ob=2;ObEc;){for(var ra=null,Ff=256;65536>fb.A>>>0;){he.A=a.Ea(fb,2);if(null==fb.A||!Ff--)break;for(var Gf=a,Pb=he,ie=null,gb=Pb.A,je=gb,Fc=1;6>=Fc&&gb;Fc++){if(2\nLicense: GPL version 3 or later ");this.g("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bkf){if(mf(c,this.O)){this.F=new M(this,"1.30.0","failsafe");mf(this.F)&&(rf(this,c),a=2,sf(this.F));this.F.set("timestamp",sa());tf(this.F);var f=this.f&&!this.G;if(1==a||ua("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(d=qf(c)){var e=c.get("code"),g=c.get("data");e&&("ok"==e?mf(c,g):("error"== -e&&"no machine state"!=g?(this.ma("Error: "+g),"unable to verify user"==g&&(ya("user",""),this.w=null)):this.g(e+": "+g),sf(c),mf(c)?(d=qf(c),f=!0):d=!1))}f&&pf(this,d?c:null)}else 2==a&&c.clear()}else pf(this);delete this.O;delete this.P}f=Ya(this.id);for(e=0;ea[1];a=a[2];this.fa=!0;this.j.ca=!0;var c=this.I.power;c&&(c.textContent="Shutdown");this.b&&(uf(this,this.b,b,d,a),this.b.Hb());this.X&&(rf(this,b),b.clear());!d&&this.F&&(this.F.clear(),delete this.F);this.u=0}; -function rf(a,b){if(ua("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var d=a.w||"";b=b.toString();var c={app:"PDP11js",ver:"1.30.0"};c.url=a.url;c.user=d;c.type="bug";c.data=b;ta("http://www.pcjs.org/api/v1/report",c,!0)}} -function gf(a,b,d){var c,f="none";if(a.u)return null;a.u--;var e=new M(a,"1.30.0"),g=new M(a,"1.30.0","validate"),h=sa();g.set("timestamp",h);e.set("timestamp",h);e.set("version","1.30.0");e.set("url",window?window.location.href:null);e.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.La&&(d&&a.b.ka(),c=a.b.La(b,d),"object"===typeof c&&e.set(a.b.id,c),d&&(a.b.j.ca=!1,!1===c&&(f=null)));for(var h=Ya(a.id),k=0;ke.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(e=window.location.pathname+e),c?"}"==c.slice(-1)?(c=c.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+d+"$2"+(c?" parms='"+c+"'":"")+(e?' url="'+e+'"':"")));f||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDP11js$2"), -a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));e=null;if("<"==a.charAt(0))try{f||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.loadXML(a)):e=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){e=null,a=n.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=c[2];b("Loading "+f+"...");ta(f,null,!0,function(e,g,h){if(h||!g)d(a,"unable to resolve XML reference: "+c[0]+" ("+h+")");else{if(e=c[3])if(h=g.match(new RegExp("<"+c[1]+"[^>]*>"))){for(var k=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(e);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{d(a,"missing <"+c[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(c[0],g);Mf(a,b,d)}})}else d(a,null)} -function Nf(a,b,d,c){function f(a){if(void 0===h){var b=g&&C(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ja(a))}function e(a){f("Error: "+a);k&&(--yf||Oa(!0));k=!1}var g,h,k=!0;yf++;Wa[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=m:q.appendChild(document.createTextNode(m));n.appendChild(q)}d|| -(d="/versions/pdp11/1.30.0/components.xsl");m=function(c,h){h?Kf(d,null,null,!1,f,function(c,k){k?(Xa(a,d,c),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--yf||Oa(!0)):e("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(c=new XSLTProcessor,c.importStylesheet(k),(k=c.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--yf||Oa(!0)):e("invalid machine element: "+ -a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(c)}):e(c)};"<"!=b.charAt(0)?Kf(b,a,c,!0,f,m):Lf(b,null,a,c,!1,f,m)}else e("missing machine element: "+a)}catch(p){e(p.message)}return k}window.embedPDP11=function(a,b,d,c){Oa(!1);return Nf(a,b,d,c)};window.enableEvents=Oa;window.sendEvent=Pa;})(); +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]}};l=Be.prototype; +l.Va=function(a,b,c,d){this.C=b;this.b=c;this.u=a;(a=uc(a,"messages"))&&Ee(this,a);this.Hb=Ie;Je(this,function(a){a:{var b=d.C.L,c=a[0],f=a=0,k=b.length;if(c){a=d.W(W(d,c));if(-1===a){d.g("invalid address: "+c);break a}f=a>>>d.C.S;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;k--;){var n=b[f];n.type==c?m++||d.g("..."):(c=n.type,m=Db[c],n&&d.g(r(n.id,8)+" %"+r(f<>>c.S].Ob(d&c.f,d),b&&Ke(a,b));return c};l.Fa=function(a,b){var c=65535,d=this.W(a,!1,2);-1!==d&&(c=Eb(this.C,d),b&&Ke(a,b));return c}; +l.ec=function(a,b,c){var d=this.W(a,!0,1);if(-1!==d){var f=this.C;f.L[(d&f.C)>>>f.S].zb(d&f.f,b&255,d);c&&Ke(a,c);K(this.b,!0)}};l.oc=function(a,b,c){var d=this.W(a,!0,2);if(-1!==d){var f=this.C,e=d&f.f,g=(d&f.C)>>>f.S;e!=f.f?f.L[g].qc(e,b&65535,d):(f.L[g++].zb(e,b&255,d),f.L[g&f.u].zb(0,b>>8&255,d+1));c&&Ke(a,c);K(this.b,!0)}};function V(a){return{A:a,Ea:!1}}function Le(a){return[a.A,a.Ea]}function Me(a){return{A:a[0],Ea:a[1]}} +function W(a,b,c){var d;c=(c?a.P:a.Bb).A;if(void 0!==b){d=b=xe(a,b);var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cd&&(d+=b.length);0>d&&(d=0);for(var f=b.length;d>>d.S],!1)}a.R=["br"];if(a.D)for(b=1;b>>d.S],!0);a.D=["bw"];a.Eb=0} +l.gb=function(a,b,c){var d=!0;c||Se(this,a,b,!1,!0);if(a!=this.f){var f=this.W(b);if(-1===f)this.g("invalid address: "+T(this,b.A)),d=!1;else{var e=this.C;e.L[f>>>e.S].gb(f&e.f,a==this.D)}}d&&(a.push(b),c?b.Ea=!0:(Te(this,a,a.length-1,"set"),De(this)));return d};function Se(a,b,c,d,f){var e=!1;c=a.W(c);for(var g=1;g>>d.S],b==a.D));h.Ea||De(a);break}}return e} +function Ue(a,b){for(var c=1;c>23)&65535,x=T(p,q);else if(8192==A)q=q.A-((e&63)<<1)&65535,x=T(p,q);else if(12288==A)x=T(p,e&7,1);else if(24576==A)x=T(p,e&63,1);else if(A=e&z,z&4032&&(A>>=6,z>>=6),z&63)switch(z=A&7,A&56){case 0:x=X(z);break;case 8:x="@"+X(z);break;case 16:7>z?x="("+X(z)+")+": +(A=p.Fa(q,2),x="#"+T(p,A));break;case 24:7>z?x="@("+X(z)+")+":(A=p.Fa(q,2),x="@#"+T(p,A));break;case 32:x="-("+X(z)+")";break;case 40:x="@-("+X(z)+")";break;case 48:A=p.Fa(q,2);x=T(p,A)+"("+X(z)+")";7==z&&(x=[x,T(p,A+q.A&65535)]);break;case 56:A=p.Fa(q,2),x="@"+T(p,A)+"("+X(z)+")",7==z&&(x=[x,T(p,A+q.A&65535)])}p=x;if(!p||!p.length){h="INVALID";break}"string"!=typeof p&&(c=p[1],d=null,p=p[0]);0a?"R"+a:6==a?"SP":"PC"} +function Ye(a,b){var c="",d=a.b;8>b?(c=X(b),c+="="+T(a,d.i[b])):13>b?c="A"+(b-8)+"="+T(a,d.Za[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+T(a,d.Oa[b-16]):20==b&&(c="PS="+T(a,Sb(d)));c&&(c+=" ");return c}function Ze(a){var b,c="";for(b=0;6>b;b++)c+=Ye(a,b);c=c+"\n"+(Ye(a,6)+Ye(a,7)+Ye(a,20));return c+=Xe(a,"T")+Xe(a,"N")+Xe(a,"Z")+Xe(a,"V")+Xe(a,"C")}l.vc=function(a,b){return a[0]>b[0]?1:a[0]>>0;for(b=0;b>>0,h=e.Sc;if(f>=g&&fh[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.g(m)}h[3]&&(g=h[3],e=null);e=We(a,b,g,e);a.g(e);a.P=b;f-=b.A-k;c++}}} +function Ve(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.Y&&(a.g("ended assemble at "+T(a,a.X.A)),a.P=a.X,a.Y=!1),b="");var f=b.charAt(0);if('"'==f||"'"==f)return!0;a.ua=null;if(pb(a)&&0m||"z"Z.length&&(a.g("note: only "+Z.length+" available"),Q=Z.length);U-=Q;0>U&&(null==Z[Z.length-1].A?(Q=U+Q,U=0):U+=Z.length);var yc=[];"call"==Vd&&($a=1E5,yc=["CALL"]);for(void 0!==Ud&&a.g(Q+" instructions earlier:");0<$a&&U!=a.oa;){var Yd=Z[U++];if(null==Yd.A)break;var ab=V(Yd.A),zf=Q--,Zd=We(a,ab,"history",zf);(!yc.length||0<=Zd.indexOf(yc[0]))&&a.g(Zd);ab.hc&&(U+=ab.hc,$a-=ab.hc,Q-=ab.hc);U>=Z.length&&(U=0);a.Gb=Q;Xd++; +$a--}}Xd||(a.g("no "+Wd+"history available"),a.Gb=void 0)}else{var Ib=W(a,Y);if(Ib){var Jb=0;qa&&("l"==qa.charAt(0)&&(qa=qa.substr(1)||yf),Jb=ye(a,qa)>>>0,65536>4||1;Af--&&0Lb?String.fromCharCode(Lb):"."; +Kb--}bb&&(bb+="\n");bb+=Y+" "+Ac+(0==db?" "+$d:"")}bb&&a.g(bb);a.Bb=Ib}}}}break;case "e":if("else"==e[0])break;var Mb=1,ae=255,be=a.Jb,ce=a.ec;"ew"==e[0]&&(Mb=2,ae=65535,be=a.Fa,ce=a.oc);var de=Mb<<1,ee=e[1];if(null==ee)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var Nb=W(a,ee);if(Nb)for(var Ob=2;ObEc;){for(var ra=null,Ef=256;65536>gb.A>>>0;){ge.A=a.Fa(gb,2);if(null==gb.A||!Ef--)break;for(var Ff=a,Pb=ge,he=null,hb=Pb.A,ie=hb,Fc=1;6>=Fc&&hb;Fc++){if(2\nLicense: GPL version 3 or later ");this.g("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bjf){if(lf(d,this.O)){this.D=new L(this,"1.30.0","failsafe");lf(this.D)&&(qf(this,d),a=2,rf(this.D));this.D.set("timestamp",sa());sf(this.D);var f=this.f&&!this.G;if(1==a||ua("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=pf(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?lf(d,g):("error"== +e&&"no machine state"!=g?(this.la("Error: "+g),"unable to verify user"==g&&(ya("user",""),this.u=null)):this.g(e+": "+g),rf(d),lf(d)?(c=pf(d),f=!0):c=!1))}f&&of(this,c?d:null)}else 2==a&&d.clear()}else of(this);delete this.O;delete this.P}f=Ya(this.id);for(e=0;ea[1];a=a[2];this.ca=!0;this.j.ba=!0;var d=this.I.power;d&&(d.textContent="Shutdown");this.b&&(tf(this,this.b,b,c,a),this.b.Db());this.X&&(qf(this,b),b.clear());!c&&this.D&&(this.D.clear(),delete this.D);this.w=0}; +function qf(a,b){if(ua("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var c=a.u||"";b=b.toString();var d={app:"PDP11js",ver:"1.30.0"};d.url=a.url;d.user=c;d.type="bug";d.data=b;ta("http://www.pcjs.org/api/v1/report",d,!0)}} +function ff(a,b,c){var d,f="none";if(a.w)return null;a.w--;var e=new L(a,"1.30.0"),g=new L(a,"1.30.0","validate"),h=sa();g.set("timestamp",h);e.set("timestamp",h);e.set("version","1.30.0");e.set("url",window?window.location.href:null);e.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.La&&(c&&a.b.ja(),d=a.b.La(b,c),"object"===typeof d&&e.set(a.b.id,d),c&&(a.b.j.ba=!1,!1===d&&(f=null)));for(var h=Ya(a.id),k=0;ke.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(e=window.location.pathname+e),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(e?' url="'+e+'"':"")));f||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDP11js$2"), +a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));e=null;if("<"==a.charAt(0))try{f||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.loadXML(a)):e=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){e=null,a=n.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");ta(f,null,!0,function(e,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(e=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(e);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],g);Lf(a,b,c)}})}else c(a,null)} +function Mf(a,b,c,d){function f(a){if(void 0===h){var b=g&&C(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ja(a))}function e(a){f("Error: "+a);k&&(--xf||Oa(!0));k=!1}var g,h,k=!0;xf++;Wa[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=m:q.appendChild(document.createTextNode(m));n.appendChild(q)}c|| +(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?Jf(c,null,null,!1,f,function(d,k){k?(Xa(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--xf||Oa(!0)):e("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(k),(k=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--xf||Oa(!0)):e("invalid machine element: "+ +a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(d)}):e(d)};"<"!=b.charAt(0)?Jf(b,a,d,!0,f,m):Kf(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(p){e(p.message)}return k}window.embedPDP11=function(a,b,c,d){Oa(!1);return Mf(a,b,c,d)};window.enableEvents=Oa;window.sendEvent=Pa;})(); diff --git a/versions/pdp11/1.30.0/pdp11.js b/versions/pdp11/1.30.0/pdp11.js index 20dfdfc17..c51b45c08 100644 --- a/versions/pdp11/1.30.0/pdp11.js +++ b/versions/pdp11/1.30.0/pdp11.js @@ -8,128 +8,127 @@ typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encod function u(a){window&&window.alert(a)}function ia(a){var b=!1;window&&(b=window.confirm(a));return b}var ja=null;function ka(){if(null==ja){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}ja=a}return ja}function la(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} function ma(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function na(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var v={init:[],show:[],exit:[]},oa=!1,pa=!1,qa=!0;function ra(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function w(a){v.init.push(a)} function sa(a){if(qa)try{for(var b=0;bb?this.yb=this.id:(this.Mb=this.id.substr(0,b),this.yb=this.id.substr(b+1));this[a]=c;this.g={ready:!1,bb:!1,Cb:!1,M:!1,error:!1};this.ob=null;this.g.error=!1;this.u={};this.H=null;y.push(this)}var va=void 0,wa={}; +function x(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Lb=b.comment;this.ic=b;b=this.id.indexOf(".");0>b?this.yb=this.id:(this.Nb=this.id.substr(0,b),this.yb=this.id.substr(b+1));this[a]=c;this.g={ready:!1,Ya:!1,Bb:!1,L:!1,error:!1};this.nb=null;this.g.error=!1;this.u={};this.H=null;y.push(this)}var va=void 0,wa={}; if(window){va||(va=window.location.search.substr(1));for(var xa,ya=/\+/g,za=/([^&=]+)=?([^&]*)/g;xa=za.exec(va);)wa[decodeURIComponent(xa[1].replace(ya," "))]=decodeURIComponent(xa[2].replace(ya," "))}function Aa(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} function z(a,b){b||(b=x);a.prototype=Aa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ba=window.PCjs.Machines||(window.PCjs.Machines={}),y=window.PCjs.Components||(window.PCjs.Components=[])}else Ba={},y=[];function Ca(a,b,c){Ba[a]&&b&&(Ba[a][b]=c)}function A(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1)+2;10>this.f&&(this.f=10);15>2;this.h=this.l-1;this.j=this.o/this.l|0;this.K=this.j-1;this.pa=[];this.w=null;this.cb=this.N;a=new I;Ja(a,this.H);this.b=Array(this.j);for(b=0;b>8:d[2](b)&255}else if(b&1&&(d=c.pa[a&-2],d[2]))return d[2](b&-2)>>8;c.J("warning: unconverted read access to byte @"+n(b));return c.cb(b,-1,1)} -function La(a,b,c){var d=this.controller,f=d.pa[a];if(f){if(f[1]){f[1](b,c);return}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);return}}else if(c&1&&(f=d.pa[a&-2],f[3])){c&=-2;a=f[2]?f[2](c):0;f[3](a&255|b<<8,c);return}d.J("warning: unconverted write access to byte @"+n(c));d.cb(c,b,1)} -function Ma(a,b){var c=this.controller;if(a=c.pa[a]){if(a[2])return a[2](b);if(a[0])return a[0](b)|a[0](b+1)<<8}c.J("warning: unconverted read access to word @"+n(b));return c.cb(b,-1,0)}function Na(a,b,c){var d=this.controller;if(a=d.pa[a]){if(a[3]){a[3](b,c);return}if(a[1]){a[1](b&255,c);a[1](b>>8,c+1);return}}d.J("warning: unconverted write access to word @"+n(c));d.cb(c,b,0)}G.prototype.reset=function(){this.w&&this.w()};G.prototype.N=function(){return 0}; -G.prototype.xa=function(a,b){b||this.reset();return!0};function Oa(a,b,c,d,f){for(var e=b,g=c,h=e>>>a.f;0g&&(p=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.Sa)return k.wb+=k.Sa-e,k.Sa=e,!0;if(e>=k.Sa+k.wb){p=k.size-(e-m);p>g&&(p=g);k.wb=e-k.Sa+p;e=m+a.l;g-=p;h++;continue}}return Qa(1,e,g)}e=new I(e,p,a.l,d,f);Ja(e,a.H,k);a.b[h++]=e;e=m+a.l;g-=p}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Ra[d]+" at "+q(b,8,!0)),!0):Qa(2,b,c)} -function Sa(a){for(var b=0,c=[],d=0;d>1)+2;10>this.j&&(this.j=10);15>2;this.h=this.f-1;this.l=this.o/this.f|0;this.J=this.l-1;this.ma=[];this.w=null;this.Za=this.M;a=new I;Ja(a,this.H);this.b=Array(this.l);for(b=0;b>8:d[2](b)&255}else if(b&1&&(d=c.ma[a&-2],d[2]))return d[2](b&-2)>>8;c.I("warning: unconverted read access to byte @"+n(b));return c.Za(b,-1,1)} +function La(a,b,c){var d=this.controller,f=d.ma[a];if(f){if(f[1]){f[1](b,c);return}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);return}}else if(c&1&&(f=d.ma[a&-2],f[3])){c&=-2;a=f[2]?f[2](c):0;f[3](a&255|b<<8,c);return}d.I("warning: unconverted write access to byte @"+n(c));d.Za(c,b,1)} +function Ma(a,b){var c=this.controller;if(a=c.ma[a]){if(a[2])return a[2](b);if(a[0])return a[0](b)|a[0](b+1)<<8}c.I("warning: unconverted read access to word @"+n(b));return c.Za(b,-1,0)}function Na(a,b,c){var d=this.controller;if(a=d.ma[a]){if(a[3]){a[3](b,c);return}if(a[1]){a[1](b&255,c);a[1](b>>8,c+1);return}}d.I("warning: unconverted write access to word @"+n(c));d.Za(c,b,0)}G.prototype.reset=function(){this.w&&this.w()};G.prototype.M=function(){return 0}; +G.prototype.ua=function(a,b){b||this.reset();return!0};function Oa(a,b,c,d,f){for(var e=b,g=c,h=e>>>a.j;0g&&(p=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.Qa)return k.vb+=k.Qa-e,k.Qa=e,!0;if(e>=k.Qa+k.vb){p=k.size-(e-m);p>g&&(p=g);k.vb=e-k.Qa+p;e=m+a.f;g-=p;h++;continue}}return Qa(1,e,g)}e=new I(e,p,a.f,d,f);Ja(e,a.H,k);a.b[h++]=e;e=m+a.f;g-=p}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Ra[d]+" at "+q(b,8,!0)),!0):Qa(2,b,c)} +function Sa(a){for(var b=0,c=[],d=0;d>13&7;"undefined"===typeof b.S[e]&&(b.S[e]={cache:[],postProcess:a.sc,drive:e,blocksize:256,mapped:0,maxblock:b.Ha[e]*b.D[e],url:"rk"+e+".dsk"});b.v&=-129;switch(b.v>>1&7){case 0:b.ib=2496;b.R=0;b.v=128;b.U=0;break;case 1:if((b.U>>4&511)>=b.Ha[e]){b.R|=32832;b.v|=49152;break}if((b.U&15)>=b.D[e]){b.R|=32800;b.v|=49152;break}c=(b.U>>4&511)*b.D[e]+(b.U&15);d=(b.v&48)<<12|b.hb;f=65536-b.jb&65535;Ya(a,b.S[e],c,d,f);return;case 2:if((b.U>>4&511)>=b.Ha[e])b.R|=32832, -b.v|=49152;else if((b.U&15)>=b.D[e])b.R|=32800,b.v|=49152;else{c=(b.U>>4&511)*b.D[e]+(b.U&15);d=(b.v&48)<<12|b.hb;f=65536-b.jb&65535;a.rb(b.S[e],c,d,f);return}}b.ib=e<<13|b.ib&8176|b.U%9&15;K(a.a,20,5,144,function(){b.v=b.v&65534|128;return!!(b.v&64)})}l.sc=function(a,b,c,d,f){var e=this.i;e.hb=d&65535;e.v=e.v&-49|d>>12&48;e.jb=65536-f&65535;switch(a){case 1:e.R|=33024;e.v|=49152;break;case 2:e.R|=33792,e.v|=49152}K(this.a,20,5,144,function(){e.v=e.v&65534|128;return!!(e.v&64)})}; -function Za(a){var b=a.j,c,d,f,e=b.s>>8&3;b.s&=-2;"undefined"===typeof b.S[e]&&(b.S[e]={cache:[],postProcess:a.tc,drive:e,blocksize:128,mapped:1,maxblock:b.Ha[e]*b.D[e],url:"rl"+e+".dsk"});switch(b.s>>1&7){case 2:b.va&8&&(b.s&=63);b.va=b.dc[e]|b.Aa&64;break;case 3:1==(b.G&3)&&(b.Aa=b.G&4?b.Aa+(b.G&65408)&65408|b.G<<2&64:b.Aa-(b.G&65408)&65408|b.G<<2&64,b.G=b.Aa);break;case 4:b.va=b.Aa;break;case 5:if(b.G>>6>=b.Ha[e]){b.s|=37888;break}if((b.G&63)>=b.D[e]){b.s|=37888;break}c=(b.G>>6)*b.D[e]+(b.G&63); -d=(b.qa&63)<<16|b.ab;f=65536-b.va&65535;Ya(a,b.S[e],c,d,f);return;case 6:if(b.G>>6>=b.Ha[e])b.s|=37888;else if((b.G&63)>=b.D[e])b.s|=37888;else{c=(b.G>>6)*b.D[e]+(b.G&63);d=(b.qa&63)<<16|b.ab;f=65536-b.va&65535;a.rb(b.S[e],c,d,f);return}}K(a.a,20,5,112,function(){b.s|=129;return!!(b.s&64)})} -l.tc=function(a,b,c,d,f){var e=this.j;e.ab=d&65535;e.s=e.s&-49|d>>12&48;e.qa=d>>16&63;e.G=~~(c/e.D[b.ga])<<6|c%e.D[b.ga];e.Aa=e.G;e.va=65536-f&65535;switch(a){case 1:e.s|=33792;break;case 2:e.s|=40960}K(this.a,20,5,112,function(){e.s|=129;return!!(e.s&64)})};function $a(a){a=a.o;a.A=2176;a.Z=0;a.T=[4544,4544,4544,4544,4544,4544,4544,4544];a.Wa=[0,0,0,0,0,0,0,0];a.Ma=a.Xa=a.Va=a.za=a.Hb=0} -function ab(a,b){var c=a.o,d,f,e;c.A&=-16513;c.Z&=-2049;c.T[b]&=-1153;K(a.a,-1,0,172);"undefined"===typeof c.S[b]&&(c.S[b]={cache:[],postProcess:a.uc,drive:b,blocksize:256,mapped:0,maxblock:c.xb[0]*c.Ga[0]*c.D[0],url:"rp"+b+".dsk"});switch(c.A&63){case 5:c.vb[b]=c.ja[b];c.A|=32896;c.T[b]|=32896;c.Ma|=1<=c.xb[0]||c.$[b]>>8>=c.Ga[0]||(c.$[b]&255)>=c.D[0]){c.Wa[b]|=1024;c.A|=49152;break}d=(c.ja[b]*c.Ga[0]+(c.$[b]>>8))*c.D[0]+(c.$[b]& -255);f=(c.za&63)<<16|c.Va;e=65536-c.Xa&65535;Ya(a,c.S[b],d,f,e);return;case 57:if(c.ja[b]>=c.xb[0]||c.$[b]>>8>=c.Ga[0]||(c.$[b]&255)>=c.D[0])c.Wa[b]|=1024,c.A|=49152;else{d=(c.ja[b]*c.Ga[0]+(c.$[b]>>8))*c.D[0]+(c.$[b]&255);f=(c.za&63)<<16|c.Va;e=65536-c.Xa&65535;a.rb(c.S[b],d,f,e);return}}K(a.a,3,5,172,function(){c.A=c.A&65534|128;c.T[b]|=128;return!!(c.A&64)})} -l.uc=function(a,b,c,d,f){var e=this.o;e.Xa=65536-f&65535;e.Va=d&65535;e.A=e.A&-769|d>>8&768;e.za=d>>16&63;f=~~(c/e.D[0]);d=~~(f/e.Ga[0]);e.$[b.ga]=f%e.Ga[0]<<8|c%e.D[0];e.vb[b.ga]=e.ja[b.ga]=d;e.Ma|=1<=b.nc-1&&(e.T[b.ga]|=1024);switch(a){case 1:e.Z|=512;e.A|=49152;break;case 2:e.Z|=2048,e.A|=49152}K(this.a,20,5,172,function(){e.T[b.ga]|=128;e.A=e.A&65534|128;return!!(e.A&64)})};l.lc=function(){this.b.ua|=128;this.b.ua&64&&K(this.a,0,6,64)}; -function bb(a,b,c,d,f,e){var g=~~((e+c.ra-1)/c.ra),h=new XMLHttpRequest;2048>g&&d+2048cb(this.a,a.mc?db(this.a,c):c,a.cache[b][f])){a.qb(2,a,b,c,d);return}c+=2;--d}b++}a.qb(0,a,b,c,d)}; -function Ya(a,b,c,d,f){for(var e,g;0g){b.qb(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.qb(0,b,c,d,f)}l.reset=function(){this.h.Ta=this.h.Ta&-120|20;this.f.da=0;this.f.V=128;this.b.ua=0;this.i.v=128;this.j.s=128;$a(this)}; -l.cc=function(a,b,c){var d,f,e=this.a;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=e.ia&65280:(a&1&&(b<<=8),e.ia=b|255,d=0);break;case 4194298:if(0>b)d=e.ub;else{a&1&&(b<<=8);if(d=b&65024){f=d>>9;do d+=34;while(f>>=1)}e.ub=d;e.ha=2}break;case 4194294:if(70!==e.Ia)return M(e,4,222);0>b?d=e.m:d=e.m=0;break;case 4194292:if(70!==e.Ia)return M(e,4,224);d=1;break;case 4194290:if(70!==e.Ia)return M(e,4,226);d=0;break;case 4194288:if(70!==e.Ia)return M(e,4,228);d=61183;break;case 4194296:0<= -b&&!(a&1)&&(b&=255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.Ia)return M(e,4,232);f=a-4194272>>1;0>b?d=e.Eb[f]:(d=L(this,e.Eb[f],a,b,c),0<=d&&(e.Eb[f]=d));break;case 4194254:return a&1?e.O>>14&1?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.ya[3]=b),d=e.ya[3]):e.O>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.ya[1]=b),d=e.ya[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.O&2048?(0<=b&&(e.c[f]=b),d=e.c[f]):(0<=b&&(e.La[f]= -b),d=e.La[f]),d;case 4194246:return a&1?(0<=b&&(e.c[7]=b),d=e.c[7]):e.O>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.ya[0]=b),d=e.ya[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.O&2048?(0<=b&&(e.La[f]=b),d=e.La[f]):(0<=b&&(e.c[f]=b),d=e.c[f]),d;default:return e.m|=16,M(e,4,124)}break;case 4194176:f=a>>1&31;d=L(this,e.P[3][f],a,b,c);0<=d&&(e.P[3][f]=d,e.P[3][f&15]&=65295);break;case 4194112:var g=this.f;switch(a&-2){case 4194174:d=L(this,e.Ya,a,b,c);0<=d&&(e.Ya=d);break;case 4194172:d= -e.na;d&65280&&(d=(d<<8|d>>8)&65535);break;case 4194170:e.I=e.I&62337|e.eb<<5|e.pb<<1;0>b?d=e.I:(d=L(this,e.I,a,b,c),0<=d&&(e.I=d&=62337,e.eb=d>>5&3,e.pb=d>>1&15,d&257?(f=2,e.oa&16&&(f=1),e.Ua=d&1?6:4):(e.Ua=0,f=4),this.h.Ta=this.h.Ta&-8|f));break;case 4194168:0>b?d=this.h.Bc&65535:(d=L(this,this.h.data,a,b,c),0<=d&&(this.h.data=d));break;case 4194166:0<=b&&(b&127&&(g.fc=0),g.V&=-129,K(e,100,4,52,function(){g.V|=128;return!!(g.V&64)}));d=0;break;case 4194162:d=0;0>b&&(g.da&=-129,0b?d=g.da:(d=L(this,g.da,a,b,c),0<=d&&(g.da=g.da&128|d&-129));break;default:return e.m|=16,M(e,4,126)}break;case 4194048:f=this.i;switch(a&-2){case 4194048:d=L(this,f.ib,a,b,c);0<=d&&(f.ib=d);break;case 4194050:d=L(this,f.R,a,b,c);0<=d&&(f.R=d);break;case 4194052:d=L(this,f.v,a,b,c);0<=b&&0<=d&&(f.v=d&-36993|f.v&36992,f.v&1&&Xa(this));break;case 4194054:d=L(this,f.jb,a,b,c);0<=d&&(f.jb=d); -break;case 4194056:d=L(this,f.hb,a,b,c);0<=d&&(f.hb=d);break;case 4194058:d=L(this,f.U,a,b,c);0<=d&&(f.U=d);break;case 4194060:break;case 4194062:d=L(this,f.Wb,a,b,c);0<=d&&(f.Wb=d);break;default:return e.m|=16,M(e,4,128)}break;case 4193728:var h=this.o;f=h.Z&7;switch(a&-2){case 4193728:d=L(this,h.A,a,b,c);0<=b&&0<=d&&(h.za=h.za&60|d>>8&3,h.A=d&17279|h.A&34944|2048,d&1&&h.A&128?ab(this,f):192==(d&192)&&K(e,0,5,172));break;case 4193730:d=L(this,h.Xa,a,b,c);0<=d&&(h.Xa=d);break;case 4193732:d=L(this, -h.Va,a,b,c);0<=d&&(h.Va=d&65534);break;case 4193734:d=L(this,h.$[f],a,b,c);0<=d&&(h.$[f]=d&7967);break;case 4193736:d=L(this,h.Z,a,b,c);0<=d&&(h.Z=d&63|h.Z&65472,d&128&&$a(this));break;case 4193738:d=h.T[f];break;case 4193740:d=h.Wa[f];break;case 4193742:d=L(this,h.Ma,a,b,c);0<=d&&(h.Ma=d&255);break;case 4193744:d=h.zc[f];break;case 4193746:d=L(this,h.Xb,a,b,c);0<=d&&(h.Xb=d);break;case 4193748:d=L(this,h.Yb[f],a,b,c);0<=d&&(h.Yb[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=h.Ac[f];break; -case 4193754:d=L(this,h.Zb[f],a,b,c);0<=d&&(h.Zb[f]=d);break;case 4193756:d=L(this,h.ja[f],a,b,c);0<=d&&(h.ja[f]=d&511);break;case 4193758:h.vb[f]=h.ja[f];d=h.vb[f];break;case 4193760:d=h.xc[f];break;case 4193762:d=h.yc[f];break;case 4193764:d=h.vc[f];break;case 4193766:d=h.wc[f];break;case 4193768:d=L(this,h.za,a,b,c);0<=d&&(h.za=d&63,h.A=h.A&-769|(d&3)<<8);break;case 4193770:d=L(this,h.Hb,a,b,c);0<=d&&(h.Hb=d);break;default:return e.m|=16,M(e,4,132)}break;case 4192512:f=this.j;switch(a&-2){case 4192512:d= -L(this,f.s,a,b,c);0<=b&&0<=d&&(f.qa=f.qa&60|d>>4&3,f.s=f.s&-1023|d&1022,f.s&128||Za(this));break;case 4192514:d=L(this,f.ab,a,b,c);0<=d&&(f.ab=d&65534);break;case 4192516:d=L(this,f.G,a,b,c);0<=d&&(f.G=d);break;case 4192518:d=L(this,f.va,a,b,c);0<=d&&(f.va=d);break;case 4192520:d=L(this,f.qa,a,b,c);0<=d&&(f.qa=d&63,f.s=f.s&-49|(f.qa&3)<<4);break;default:return e.m|=16,M(e,4,134)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.oa:(d=L(this,e.oa,a,b,c),0<=d&&(70!==e.Ia&&(d&=-49),e.oa=d,e.Ka[0]= -d&4?15:7,e.Ka[1]=d&2?15:7,e.Ka[3]=d&1?15:7,e.Ua&&(f=2,e.oa&16&&(f=1),this.h.Ta=this.h.Ta&-8|f)));break;default:return e.m|=16,M(e,4,136)}break;case 4191424:f=a>>1&31;d=L(this,e.P[0][f],a,b,c);0<=d&&(e.P[0][f]=d,e.P[0][f&15]&=65295);break;case 4191360:f=a>>1&31;d=L(this,e.P[1][f],a,b,c);0<=d&&(e.P[1][f]=d,e.P[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!==e.Ia)return M(e,4,234);f=a>>2&31;d=e.kb[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=L(this,d,a,b,c),0<=d&&(e.kb[f]=a&2?d<<16|e.kb[f]&65535:e.kb[f]& -4294901760|d&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)d=Ta[a>>1&255];else return e.m|=16,M(e,4,138);break;default:return e.m|=16,M(e,4,142)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)");return d};var eb={},Ua=(eb[65382]=[null,null,J.prototype.pc,J.prototype.Dc],eb[65396]=[null,null,J.prototype.rc,J.prototype.Gc],eb[65534]=[null,null,J.prototype.qc,J.prototype.Ec],eb); -w(function(){for(var a=D(document,"pdp11","device"),b=0;b>1),this.a=new Int32Array(this.u,0,c>>2),lb(this,hb?mb:nb);else{this.a=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},Y:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ma:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},Ea:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<>8);this.ta=!0},N:function(a,b){return this.W(a, -b)},ca:function(a,b){return this.ka(a,b)},Ca:function(a,b,c){this.l||this.bc(a,b,c)},Oa:function(a,b,c){this.l||this.Pa(a,b,c)},K:function(a){return this.b[a]},X:function(a){return this.b[a]},ba:function(a){return this.f.getUint16(a,!0)},la:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.j[a>>1]},Ba:function(a,b){this.b[a]=b;this.ta=!0},Da:function(a,b){this.b[a]=b;this.ta=!0},Fa:function(a,b){this.f.setUint16(a,b,!0);this.ta=!0},Qa:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.j[a>> -1]=b;this.ta=!0}};function Ja(a,b,c){a.H=b;a.h=a.i=0;c&&((a.h=c.h)&&pb(a,qb,!1),(a.i=c.i)&&rb(a,qb,!1))}function rb(a,b,c){c&&a.i||(a.lb=!a.l&&b[1]||a.B,a.Fc=!a.l&&b[3]||a.F);if(c||void 0===c)a.bc=b[1]||a.B,a.Pa=b[3]||a.F}function pb(a,b,c){c&&a.h||(a.gb=b[0]||a.o,a.sb=b[2]||a.w);if(c||void 0===c)a.W=b[0]||a.o,a.ka=b[2]||a.w}function lb(a,b){b||(b=sb);pb(a,b,void 0);rb(a,b,void 0)} -var sb=[],ob=[I.prototype.Y,I.prototype.Ea,I.prototype.ma,I.prototype.Ra],qb=[I.prototype.N,I.prototype.Ca,I.prototype.ca,I.prototype.Oa];if(Ga)var nb=[I.prototype.K,I.prototype.Ba,I.prototype.ba,I.prototype.Fa],mb=[I.prototype.X,I.prototype.Da,I.prototype.la,I.prototype.Qa]; -function tb(a,b){x.call(this,"CPU",a,tb);var c=a.multiplier||1;this.Ab=a.cycles||b;this.la=c;this.zb=Math.round(this.Ab/1E4)/100;this.ca=this.zb*this.la;this.g.fa=!1;this.g.$b=!1;this.g.$a=a.autoStart;this.g.Rb=!1;this.g.nb=!1;this.Qa=this.ka=0;this.Ra=a.csStart;this.Ca=a.csInterval;this.Da=a.csStop;this.Oa=[];this.Tb=this.Ib.bind(this);F(this)}z(tb);var ub=["power","reset"];l=tb.prototype; -l.Ja=function(a,b,c,d){this.h=a;this.l=b;this.H=d;for(b=0;ba.W/a.ca&&(b=1),a.la=b,b=a.zb*a.la,a.ca!=b)){a.ca=b;b=a.ca.toFixed(2)+"Mhz";var c=a.u.setSpeed;c&&(c.textContent=b);a.J("target speed: "+b)}Ab(a,a.N);a.N=0;a.K=ga();a.X=0;Bb(a)} -l.Ib=function(){if(Ea(this,!0)){if(!this.g.fa){zb(this);this.h&&this.h.start(this.K,Cb(this));this.g.fa=!0;this.g.$b=!0;this.Ba&&this.Ba.start();var a=this.u.run;a&&(a.textContent="Halt");this.h&&this.h.Na(!0)}this.Bb>=this.Ab&&Bb(this,!0);this.Fa=0;this.Pa=ga();this.X&&(a=this.Pa-this.X,a>this.Ob&&(this.K+=a,this.K>this.Pa&&(this.K=this.Pa)));try{do{for(var b,c=this.g.nb?1:this.mb,d=this.Oa.length-1;0<=d;d--){var f=this.Oa[d];0>f[0]||c>f[0]&&(c=f[0])}b=c;try{this.ac(b)}catch(m){if("number"!=typeof m)throw m; -}for(var e=this.F-this.a,a=e,g=this.Oa.length-1;0<=g;g--){var h=this.Oa[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.Fa+=e;this.N+=e;Ab(this,0,!0);a=e;if(this.g.nb){var k=!1;this.Qa=this.Qa+this.Vb()|0;this.ka-=a;0>=this.ka&&(this.ka+=this.Ca,k=!0);0<=this.Da&&this.Da<=Cb(this)&&(this.Ca=this.Da=-1,xb(this),O(this),k=!0);k&&this.J(Cb(this)+" cycles: checksum="+q(this.Qa))}this.Ea-=e;if(0>=this.Ea){this.Ea+=this.mb;15<=++this.Qb&&(this.h&&this.h.Na(),this.Qb=0);break}}while(this.g.fa)}catch(m){O(this); -yb(this);this.h&&this.h.stop(ga(),Cb(this));Ea(this,!1);b=m.stack||m.message;this.g.error=!0;this.L(b);return}b=setTimeout;c=this.Tb;this.X=ga();d=this.Ob;this.Fa&&(d=Math.round(d*this.Fa/this.mb));d-=this.X-this.Pa;if(f=this.X-this.K)this.W=Math.round(this.N/(10*f))/100,864E5<=f&&(this.Y=0,zb(this));if(0>d||this.Wd&&(this.K-=d),d=0;this.Bb+=this.Fa;this.X+=d;b(c,d)}else yb(this),this.h&&this.h.stop(ga(),Cb(this))};l.ac=function(){return 0}; -function O(a){a.g.bb&&(a.g.Cb=!0);a.F-=a.a;a.a=0;Ab(a,a.N);a.N=0;if(a.g.fa){a.g.fa=!1;a.Ba&&a.Ba.stop();var b=a.u.run;b&&(b.textContent="Run")}a.g.complete=void 0}function yb(a){a.h&&a.h.Na(void 0)} -function Db(a){this.kc=a.resetAddr||0;tb.call(this,a,1E6);this.Lb=0;this.decode=Eb.bind(this);this.B=65536;this.j=32768;this.o=65535;this.i=32768;this.c=[0,0,0,0,0,0,0,this.kc];this.La=[0,0,0,0,0,0];this.ya=[0,0,0,0];this.ia=255;this.pb=this.eb=this.Ua=this.w=this.oa=this.Ya=this.na=this.I=this.m=this.ub=0;this.Ka=[7,7,7,7];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],[65535,65535,65535,65535,65535,65535, -65535,65535,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.kb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.Eb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.b=-1;this.C=0;this.Ia=70;this.ma=-1;this.f=[];this.Ub=0;this.ha=2;Fb(this);this.g.complete=this.g.ec=!1}z(Db,tb);l=Db.prototype; -l.reset=function(){this.g.fa&&O(this);Gb(this);wb(this);this.g.error=!1;this.parent.reset.call(this)};function Gb(a){a.ia=255;a.m=0;a.f=[];a.ub=0;a.I=a.na=a.Ya=a.oa=a.Ua=0;a.Ka[0]=a.Ka[1]=a.Ka[3]=7;a.eb=0;Fb(a)}function Fb(a){a.Ua?(a.Kb=65536,a.ba=a.jc,a.sb=a.ea):(a.Kb=0,a.ba=a.ic,a.sb=a.tb)}l.Vb=function(){return 0};l.save=function(){var a=new P(this);a.set(0,[]);a.set(1,[this.Nb,this.Y,this.la]);a.set(2,Sa(this.l));return a.data()}; -l.restore=function(a){var b=a[1];this.Nb=b[0];this.Y=b[1];zb(this,b[3]);a:{b=this.l;a=a[2];var c;for(c=0;cb){a.f[e].sa-=b;break}b-=a.f[e].sa}a.f.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.ha=2}function Va(a){return a.O=a.O&63728|(a.i&32768?8:0)|(a.o&65535?0:4)|(a.j&32768?2:0)|(a.B&65536?1:0)} -function Wa(a,b){a.i=b<<12;a.o=~b&4;a.j=b<<14;a.B=b<<16;if((b^a.O)&2048)for(var c=a.La.length;0<=--c;){var d=a.c[c];a.c[c]=a.La[c];a.La[c]=d}a.w=b>>14&3;c=a.O>>14&3;a.w!=c&&(a.ya[c]=a.c[6],a.c[6]=a.ya[a.w]);a.ha=2;a.O=b}function Hb(a,b){a.C&128||(a.i=a.o=a.B=b,a.j=0)}function Q(a,b){a.C&128||(a.i=a.o=b,a.j=0)}function Ib(a,b,c,d){a.C&128||(a.i=a.o=a.B=b,a.j=(c^d)&(d^b))} -function M(a,b,c){var d=!1;0>a.ma?a.ma=Va(a):a.w||(b=4,d=!0);a.I&57344||(a.na=63222,a.Ya=b);a.w=0;var f=a.ea(b|65536),e=a.ea(b+2&65535|65536);Wa(a,e&53247|a.ma>>2&12288);d&&(a.m|=4,a.c[6]=4);Jb(a,a.ma);Jb(a,a.c[7]);a.c[7]=f;a.C&=-113;a.ma=-1;throw b|c<<8;}function db(a,b){var c=b>>13&31;31>c?a.oa&32&&(b=a.kb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b} -function Kb(a,b,c){var d,f,e,g=0;if(c&a.Ua){d=b>>13&a.Ka[a.w];f=a.P[a.w][d];e=(a.P[a.w][d+16]<<6)+(b&8191)&4194303;a.oa&16?3932160<=e&&4186112>e&&(e=db(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.m|=32,M(a,4,24)),e&1&&!(c&1)&&(a.m|=64,M(a,4,26)));switch(f&7){case 1:g=4096;case 2:f|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:f|=c&4?192:128;break;default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2&8128)&& -(g|=16384));a.P[a.w][d]=f;if(4194170!==e||a.w)a.eb=a.w,a.pb=d;g&&(g&57344&&(0<=a.ma&&(g|=128),a.I&57344||(a.I=a.I|g|a.eb<<5|a.pb<<1),M(a,168,28)),a.I&61440||!(4191360>e||4194239>>b.f;a=c!=b.h?b.b[d].sb(c,a):b.b[d++].gb(c,a)|b.b[d&b.K].gb(0,a+1)<<8}return a}; -l.ea=function(a){return this.tb(Kb(this,a,2))};function cb(a,b,c){c&=65535;if(4194304<=b)return a.c[b-4194304]=c;if(0<=b){a=a.l;var d=c,f=b&a.h,e=(b&a.i)>>>a.f;f!=a.h?a.b[e].Fc(f,d&65535,b):(a.b[e++].lb(f,d&255,b),a.b[e&a.K].lb(0,d>>8&255,b+1));return c}return b}function Lb(a,b){4194304<=b?b=a.c[b-4194304]&255:0<=b&&(a=a.l,b=a.b[(b&a.i)>>>a.f].gb(b&a.h,b));return b}function Mb(a,b,c){c&=255;4194304<=b?a.c[b-4194304]=a.c[b-4194304]&65280|c:0<=b&&(a=a.l,a.b[(b&a.i)>>>a.f].lb(b&a.h,c&255,b))} -function Jb(a,b){var c=a.c[6]-2&65535;a.c[6]=c;a.I&57344||(a.na=a.na<<8|246);!a.w&&c<=a.ia&&4>3&7){case 0:M(a,4,34);break;case 1:return 6===e&&!a.w&&c&4&&(a.c[6]<=a.ia||65534<=a.c[6])&&(a.c[6]<=a.ia-32||65534<=a.c[6]?(a.m|=4,a.c[6]=4,M(a,4,36)):(a.m|=8,a.C|=64)),7===e?a.c[e]:a.c[e]|g;case 2:f=2;d=a.c[e];7!==e&&(d|=g,6>e&&c&1&&(f=1));break;case 3:f=2;d=a.c[e];7!==e&&(d|=g);if(0>(d=a.ea(d)))return d;d|=g;break;case 4:f=-2;6>e&&c&1&&(f=-1);d=a.c[e]+f&65535;7!==e&&(d|=g);break;case 5:f=-2;d=a.c[e]-2&65535;7!==e&&(d|=g);if(0>(d=a.ea(d)))return d; -d|=g;break;case 6:if(0>(d=a.ea(a.c[7])))return d;a.c[7]=a.c[7]+2&65535;d=d+a.c[e]&65535;return d|g;case 7:if(0>(d=a.ea(a.c[7])))return d;a.c[7]=a.c[7]+2&65535;d=d+a.c[e]&65535;return 0>(d=a.ea(d|65536))?d:d|g}a.c[e]=a.c[e]+f&65535;!g||a.I&57344||(a.na=a.na<<8|f<<3&248|e);6===e&&!a.w&&c&4&&0>=f&&(a.c[6]<=a.ia||65534<=a.c[6])&&(a.c[6]<=a.ia-32?(a.m|=4,a.c[6]=4,M(a,4,38)):(a.m|=8,a.C|=64));return d}l.ic=function(a,b){return Nb(this,a,b)};l.jc=function(a,b){return Kb(this,Nb(this,a,b),b)}; -function R(a,b){return b&56?a.sb(Nb(a,b,2)):a.c[b&7]}function S(a,b){return b&56?Lb(a,a.ba(b,3)):a.c[b&7]&255}function Ob(a,b,c,d){b&56?(b=a.ba(b,6),cb(a,b,d.call(a,c,a.tb(b)))):(b&=7,a.c[b]=d.call(a,c,a.c[b])&65535)}function Pb(a,b,c,d){b&56?(b=a.ba(b,7),Mb(a,b,d.call(a,c,Lb(a,b)))):(b&=7,a.c[b]=a.c[b]&65280|d.call(a,c,a.c[b])&255)}function Qb(a,b,c){b&56?cb(a,a.ba(b,4),c):a.c[b&7]=c&65535;return c} +l.Ja=function(a,b,c,d){this.j=b;this.a=c;this.H=d;a=Ua;for(var f in a){var e=a[f];c=b;d=+f;for(var g=e[0]?e[0].bind(this):null,h=e[1]?e[1].bind(this):null,k=e[2]?e[2].bind(this):null,e=e[3]?e[3].bind(this):null,m=+f;m<=d;m+=2){var p=m&8191;void 0!==c.ma[p]?u("I/O address already registered: "+q(m,8,!0)):c.ma[p]=[g,h,k,e,!1]}}f=this.bc.bind(this);b.w=this.reset.bind(this);b.Za=f;E(this)};l.oc=function(){var a=this.b.ra;this.b.ra&=-129;return a}; +l.Dc=function(a){this.b.ra=a;a&64&&!this.b.Eb&&(setInterval(this.kc.bind(this),25),this.b.Eb=1);this.b.ra=a&-129};l.pc=function(){var a=this.a;return a.w&62337|a.Oa<<5|a.Pa<<1};l.Ec=function(a){var b=4,c=this.a;c.w=a&=62337;c.Oa=a>>5&3;c.Pa=a>>1&15;c.ob=a&257?a&1?6:4:0;Va(c);a=c.w;a&1|256&&(b=this.a.Da&16?1:2);this.h.Ra=this.h.Ra&-8|b};l.rc=function(){return this.f.U}; +l.Hc=function(a){if(128==(this.f.U&192)&&a&64){var b=this;K(this.a,8,4,52,function(){b.f.U|=128;return!!(b.f.U&64)})}this.f.U=this.f.U&128|a&-129};l.qc=function(){return Wa(this.a)};l.Fc=function(a){Xa(this.a,a&-1809|Wa(this.a)&1808);this.a.D|=128}; +function Ya(a){var b=a.i,c,d,f,e=b.T>>13&7;"undefined"===typeof b.R[e]&&(b.R[e]={cache:[],postProcess:a.sc,drive:e,blocksize:256,mapped:0,maxblock:b.Ha[e]*b.F[e],url:"rk"+e+".dsk"});b.v&=-129;switch(b.v>>1&7){case 0:b.cb=2496;b.P=0;b.v=128;b.T=0;break;case 1:if((b.T>>4&511)>=b.Ha[e]){b.P|=32832;b.v|=49152;break}if((b.T&15)>=b.F[e]){b.P|=32800;b.v|=49152;break}c=(b.T>>4&511)*b.F[e]+(b.T&15);d=(b.v&48)<<12|b.bb;f=65536-b.eb&65535;Za(a,b.R[e],c,d,f);return;case 2:if((b.T>>4&511)>=b.Ha[e])b.P|=32832, +b.v|=49152;else if((b.T&15)>=b.F[e])b.P|=32800,b.v|=49152;else{c=(b.T>>4&511)*b.F[e]+(b.T&15);d=(b.v&48)<<12|b.bb;f=65536-b.eb&65535;a.rb(b.R[e],c,d,f);return}}b.cb=e<<13|b.cb&8176|b.T%9&15;K(a.a,20,5,144,function(){b.v=b.v&65534|128;return!!(b.v&64)})}l.sc=function(a,b,c,d,f){var e=this.i;e.bb=d&65535;e.v=e.v&-49|d>>12&48;e.eb=65536-f&65535;switch(a){case 1:e.P|=33024;e.v|=49152;break;case 2:e.P|=33792,e.v|=49152}K(this.a,20,5,144,function(){e.v=e.v&65534|128;return!!(e.v&64)})}; +function $a(a){var b=a.l,c,d,f,e=b.s>>8&3;b.s&=-2;"undefined"===typeof b.R[e]&&(b.R[e]={cache:[],postProcess:a.tc,drive:e,blocksize:128,mapped:1,maxblock:b.Ha[e]*b.F[e],url:"rl"+e+".dsk"});switch(b.s>>1&7){case 2:b.sa&8&&(b.s&=63);b.sa=b.cc[e]|b.ya&64;break;case 3:1==(b.G&3)&&(b.ya=b.G&4?b.ya+(b.G&65408)&65408|b.G<<2&64:b.ya-(b.G&65408)&65408|b.G<<2&64,b.G=b.ya);break;case 4:b.sa=b.ya;break;case 5:if(b.G>>6>=b.Ha[e]){b.s|=37888;break}if((b.G&63)>=b.F[e]){b.s|=37888;break}c=(b.G>>6)*b.F[e]+(b.G&63); +d=(b.na&63)<<16|b.Xa;f=65536-b.sa&65535;Za(a,b.R[e],c,d,f);return;case 6:if(b.G>>6>=b.Ha[e])b.s|=37888;else if((b.G&63)>=b.F[e])b.s|=37888;else{c=(b.G>>6)*b.F[e]+(b.G&63);d=(b.na&63)<<16|b.Xa;f=65536-b.sa&65535;a.rb(b.R[e],c,d,f);return}}K(a.a,20,5,112,function(){b.s|=129;return!!(b.s&64)})} +l.tc=function(a,b,c,d,f){var e=this.l;e.Xa=d&65535;e.s=e.s&-49|d>>12&48;e.na=d>>16&63;e.G=~~(c/e.F[b.fa])<<6|c%e.F[b.fa];e.ya=e.G;e.sa=65536-f&65535;switch(a){case 1:e.s|=33792;break;case 2:e.s|=40960}K(this.a,20,5,112,function(){e.s|=129;return!!(e.s&64)})};function ab(a){a=a.o;a.A=2176;a.Z=0;a.S=[4544,4544,4544,4544,4544,4544,4544,4544];a.Ta=[0,0,0,0,0,0,0,0];a.La=a.Ua=a.Sa=a.xa=a.Hb=0} +function bb(a,b){var c=a.o,d,f,e;c.A&=-16513;c.Z&=-2049;c.S[b]&=-1153;K(a.a,-1,0,172);"undefined"===typeof c.R[b]&&(c.R[b]={cache:[],postProcess:a.uc,drive:b,blocksize:256,mapped:0,maxblock:c.xb[0]*c.Ga[0]*c.F[0],url:"rp"+b+".dsk"});switch(c.A&63){case 5:c.ub[b]=c.ha[b];c.A|=32896;c.S[b]|=32896;c.La|=1<=c.xb[0]||c.$[b]>>8>=c.Ga[0]||(c.$[b]&255)>=c.F[0]){c.Ta[b]|=1024;c.A|=49152;break}d=(c.ha[b]*c.Ga[0]+(c.$[b]>>8))*c.F[0]+(c.$[b]& +255);f=(c.xa&63)<<16|c.Sa;e=65536-c.Ua&65535;Za(a,c.R[b],d,f,e);return;case 57:if(c.ha[b]>=c.xb[0]||c.$[b]>>8>=c.Ga[0]||(c.$[b]&255)>=c.F[0])c.Ta[b]|=1024,c.A|=49152;else{d=(c.ha[b]*c.Ga[0]+(c.$[b]>>8))*c.F[0]+(c.$[b]&255);f=(c.xa&63)<<16|c.Sa;e=65536-c.Ua&65535;a.rb(c.R[b],d,f,e);return}}K(a.a,3,5,172,function(){c.A=c.A&65534|128;c.S[b]|=128;return!!(c.A&64)})} +l.uc=function(a,b,c,d,f){var e=this.o;e.Ua=65536-f&65535;e.Sa=d&65535;e.A=e.A&-769|d>>8&768;e.xa=d>>16&63;f=~~(c/e.F[0]);d=~~(f/e.Ga[0]);e.$[b.fa]=f%e.Ga[0]<<8|c%e.F[0];e.ub[b.fa]=e.ha[b.fa]=d;e.La|=1<=b.mc-1&&(e.S[b.fa]|=1024);switch(a){case 1:e.Z|=512;e.A|=49152;break;case 2:e.Z|=2048,e.A|=49152}K(this.a,20,5,172,function(){e.S[b.fa]|=128;e.A=e.A&65534|128;return!!(e.A&64)})};l.kc=function(){this.b.ra|=128;this.b.ra&64&&K(this.a,0,6,64)}; +function cb(a,b,c,d,f,e){var g=~~((e+c.oa-1)/c.oa),h=new XMLHttpRequest;2048>g&&d+2048db(this.a,a.lc?eb(this.a,c):c,a.cache[b][f])){a.qb(2,a,b,c,d);return}c+=2;--d}b++}a.qb(0,a,b,c,d)}; +function Za(a,b,c,d,f){for(var e,g;0g){b.qb(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.qb(0,b,c,d,f)}l.reset=function(){this.h.Ra=this.h.Ra&-120|20;this.f.ca=0;this.f.U=128;this.b.ra=0;this.i.v=128;this.l.s=128;ab(this)}; +l.bc=function(a,b,c){var d,f,e=this.a;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=e.va&65280:(a&1&&(b<<=8),e.va=b|255,d=0);break;case 4194298:if(0>b)d=e.Gb;else{a&1&&(b<<=8);if(d=b&65024){f=d>>9;do d+=34;while(f>>=1)}e.Gb=d;e.ga=2}break;case 4194294:if(70!==e.Ia)return M(e,4);0>b?d=e.m:d=e.m=0;break;case 4194292:if(70!==e.Ia)return M(e,4);d=1;break;case 4194290:if(70!==e.Ia)return M(e,4);d=0;break;case 4194288:if(70!==e.Ia)return M(e,4);d=61183;break;case 4194296:0<=b&&!(a&1)&&(b&= +255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.Ia)return M(e,4);f=a-4194272>>1;0>b?d=e.Db[f]:(d=L(this,e.Db[f],a,b,c),0<=d&&(e.Db[f]=d));break;case 4194254:return a&1?e.N>>14&1?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.wa[3]=b),d=e.wa[3]):e.N>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.wa[1]=b),d=e.wa[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.N&2048?(0<=b&&(e.c[f]=b),d=e.c[f]):(0<=b&&(e.Ka[f]=b),d=e.Ka[f]),d;case 4194246:return a& +1?(0<=b&&(e.c[7]=b),d=e.c[7]):e.N>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.wa[0]=b),d=e.wa[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.N&2048?(0<=b&&(e.Ka[f]=b),d=e.Ka[f]):(0<=b&&(e.c[f]=b),d=e.c[f]),d;default:return e.m|=16,M(e,4)}break;case 4194176:f=a>>1&31;d=L(this,e.O[3][f],a,b,c);0<=d&&(e.O[3][f]=d,e.O[3][f&15]&=65295);break;case 4194112:var g=this.f;switch(a&-2){case 4194174:d=L(this,e.hb,a,b,c);0<=d&&(e.hb=d);break;case 4194172:d=e.Ca;d&65280&&(d=(d<<8|d>>8)&65535);break; +case 4194168:0>b?d=this.h.Bc&65535:(d=L(this,this.h.data,a,b,c),0<=d&&(this.h.data=d));break;case 4194166:0<=b&&(b&127&&(g.ec=0),g.U&=-129,K(e,100,4,52,function(){g.U|=128;return!!(g.U&64)}));d=0;break;case 4194162:d=0;0>b&&(g.ca&=-129,0b?d=g.ca:(d=L(this,g.ca,a,b,c),0<=d&&(g.ca=g.ca&128|d&-129));break;default:return e.m|=16,M(e,4)}break;case 4194048:f=this.i;switch(a&-2){case 4194048:d= +L(this,f.cb,a,b,c);0<=d&&(f.cb=d);break;case 4194050:d=L(this,f.P,a,b,c);0<=d&&(f.P=d);break;case 4194052:d=L(this,f.v,a,b,c);0<=b&&0<=d&&(f.v=d&-36993|f.v&36992,f.v&1&&Ya(this));break;case 4194054:d=L(this,f.eb,a,b,c);0<=d&&(f.eb=d);break;case 4194056:d=L(this,f.bb,a,b,c);0<=d&&(f.bb=d);break;case 4194058:d=L(this,f.T,a,b,c);0<=d&&(f.T=d);break;case 4194060:break;case 4194062:d=L(this,f.Vb,a,b,c);0<=d&&(f.Vb=d);break;default:return e.m|=16,M(e,4)}break;case 4193728:var h=this.o;f=h.Z&7;switch(a& +-2){case 4193728:d=L(this,h.A,a,b,c);0<=b&&0<=d&&(h.xa=h.xa&60|d>>8&3,h.A=d&17279|h.A&34944|2048,d&1&&h.A&128?bb(this,f):192==(d&192)&&K(e,0,5,172));break;case 4193730:d=L(this,h.Ua,a,b,c);0<=d&&(h.Ua=d);break;case 4193732:d=L(this,h.Sa,a,b,c);0<=d&&(h.Sa=d&65534);break;case 4193734:d=L(this,h.$[f],a,b,c);0<=d&&(h.$[f]=d&7967);break;case 4193736:d=L(this,h.Z,a,b,c);0<=d&&(h.Z=d&63|h.Z&65472,d&128&&ab(this));break;case 4193738:d=h.S[f];break;case 4193740:d=h.Ta[f];break;case 4193742:d=L(this,h.La, +a,b,c);0<=d&&(h.La=d&255);break;case 4193744:d=h.zc[f];break;case 4193746:d=L(this,h.Wb,a,b,c);0<=d&&(h.Wb=d);break;case 4193748:d=L(this,h.Xb[f],a,b,c);0<=d&&(h.Xb[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=h.Ac[f];break;case 4193754:d=L(this,h.Yb[f],a,b,c);0<=d&&(h.Yb[f]=d);break;case 4193756:d=L(this,h.ha[f],a,b,c);0<=d&&(h.ha[f]=d&511);break;case 4193758:h.ub[f]=h.ha[f];d=h.ub[f];break;case 4193760:d=h.xc[f];break;case 4193762:d=h.yc[f];break;case 4193764:d=h.vc[f];break;case 4193766:d= +h.wc[f];break;case 4193768:d=L(this,h.xa,a,b,c);0<=d&&(h.xa=d&63,h.A=h.A&-769|(d&3)<<8);break;case 4193770:d=L(this,h.Hb,a,b,c);0<=d&&(h.Hb=d);break;default:return e.m|=16,M(e,4)}break;case 4192512:f=this.l;switch(a&-2){case 4192512:d=L(this,f.s,a,b,c);0<=b&&0<=d&&(f.na=f.na&60|d>>4&3,f.s=f.s&-1023|d&1022,f.s&128||$a(this));break;case 4192514:d=L(this,f.Xa,a,b,c);0<=d&&(f.Xa=d&65534);break;case 4192516:d=L(this,f.G,a,b,c);0<=d&&(f.G=d);break;case 4192518:d=L(this,f.sa,a,b,c);0<=d&&(f.sa=d);break; +case 4192520:d=L(this,f.na,a,b,c);0<=d&&(f.na=d&63,f.s=f.s&-49|(f.na&3)<<4);break;default:return e.m|=16,M(e,4)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.Da:(d=L(this,e.Da,a,b,c),0<=d&&(70!==e.Ia&&(d&=-49),e.Da=d,e.pb[0]=d&4?15:7,e.pb[1]=d&2?15:7,e.pb[3]=d&1?15:7,e.ob&&(f=2,e.Da&16&&(f=1),this.h.Ra=this.h.Ra&-8|f)));break;default:return e.m|=16,M(e,4)}break;case 4191424:f=a>>1&31;d=L(this,e.O[0][f],a,b,c);0<=d&&(e.O[0][f]=d,e.O[0][f&15]&=65295);break;case 4191360:f=a>>1&31;d=L(this,e.O[1][f], +a,b,c);0<=d&&(e.O[1][f]=d,e.O[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!==e.Ia)return M(e,4);f=a>>2&31;d=e.fb[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=L(this,d,a,b,c),0<=d&&(e.fb[f]=a&2?d<<16|e.fb[f]&65535:e.fb[f]&4294901760|d&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)d=Ta[a>>1&255];else return e.m|=16,M(e,4);break;default:return e.m|=16,M(e,4)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)"); +return d};var fb={},Ua=(fb[65382]=[null,null,J.prototype.oc,J.prototype.Dc],fb[65402]=[null,null,J.prototype.pc,J.prototype.Ec],fb[65396]=[null,null,J.prototype.rc,J.prototype.Hc],fb[65534]=[null,null,J.prototype.qc,J.prototype.Fc],fb);w(function(){for(var a=D(document,"pdp11","device"),b=0;b>1),this.a=new Int32Array(this.u,0,c>>2),mb(this,ib?nb:ob);else{this.a=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},X:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ka:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},Ba:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<>8);this.qa=!0},M:function(a,b){return this.V(a, +b)},ba:function(a,b){return this.ia(a,b)},za:function(a,b,c){this.f||this.ac(a,b,c)},Fa:function(a,b,c){this.f||this.Na(a,b,c)},J:function(a){return this.b[a]},W:function(a){return this.b[a]},Y:function(a){return this.j.getUint16(a,!0)},ja:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.l[a>>1]},la:function(a,b){this.b[a]=b;this.qa=!0},Aa:function(a,b){this.b[a]=b;this.qa=!0},Ea:function(a,b){this.j.setUint16(a,b,!0);this.qa=!0},Oa:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.l[a>>1]= +b;this.qa=!0}};function Ja(a,b,c){a.H=b;a.h=a.i=0;c&&((a.h=c.h)&&qb(a,rb,!1),(a.i=c.i)&&sb(a,rb,!1))}function sb(a,b,c){c&&a.i||(a.gb=!a.f&&b[1]||a.B,a.Gc=!a.f&&b[3]||a.C);if(c||void 0===c)a.ac=b[1]||a.B,a.Na=b[3]||a.C}function qb(a,b,c){c&&a.h||(a.ab=b[0]||a.o,a.sb=b[2]||a.w);if(c||void 0===c)a.V=b[0]||a.o,a.ia=b[2]||a.w}function mb(a,b){b||(b=tb);qb(a,b,void 0);sb(a,b,void 0)} +var tb=[],pb=[I.prototype.X,I.prototype.Ba,I.prototype.ka,I.prototype.Pa],rb=[I.prototype.M,I.prototype.za,I.prototype.ba,I.prototype.Fa];if(Ga)var ob=[I.prototype.J,I.prototype.la,I.prototype.Y,I.prototype.Ea],nb=[I.prototype.W,I.prototype.Aa,I.prototype.ja,I.prototype.Oa]; +function ub(a,b){x.call(this,"CPU",a,ub);var c=a.multiplier||1;this.Ab=a.cycles||b;this.ka=c;this.zb=Math.round(this.Ab/1E4)/100;this.ia=this.zb*this.ka;this.g.ea=!1;this.g.Zb=!1;this.g.Wa=a.autoStart;this.g.Ob=!1;this.g.mb=!1;this.jb=this.ja=0;this.kb=a.csStart;this.Aa=a.csInterval;this.Ba=a.csStop;this.Na=[];this.Sb=this.Ib.bind(this);E(this)}z(ub);var vb=["power","reset"];l=ub.prototype; +l.Ja=function(a,b,c,d){this.h=a;this.j=b;this.H=d;for(b=0;ba.V/a.ia&&(b=1),a.ka=b,b=a.zb*a.ka,a.ia!=b)){a.ia=b;b=a.ia.toFixed(2)+"Mhz";var c=a.u.setSpeed;c&&(c.textContent=b);a.I("target speed: "+b)}Bb(a,a.M);a.M=0;a.J=ga();a.W=0;Cb(a)} +l.Ib=function(){if(Ea(this,!0)){if(!this.g.ea){Ab(this);this.h&&this.h.start(this.J,Db(this));this.g.ea=!0;this.g.Zb=!0;this.za&&this.za.start();var a=this.u.run;a&&(a.textContent="Halt");this.h&&this.h.Ma(!0)}this.wb>=this.Ab&&Cb(this,!0);this.Fa=0;this.ib=ga();this.W&&(a=this.ib-this.W,a>this.Qb&&(this.J+=a,this.J>this.ib&&(this.J=this.ib)));try{do{for(var b,c=this.g.mb?1:this.lb,d=this.Na.length-1;0<=d;d--){var f=this.Na[d];0>f[0]||c>f[0]&&(c=f[0])}b=c;try{this.$b(b)}catch(m){if("number"!=typeof m)throw m; +}for(var e=this.X-this.a,a=e,g=this.Na.length-1;0<=g;g--){var h=this.Na[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.Fa+=e;this.M+=e;Bb(this,0,!0);a=e;if(this.g.mb){var k=!1;this.jb=this.jb+this.Tb()|0;this.ja-=a;0>=this.ja&&(this.ja+=this.Aa,k=!0);0<=this.Ba&&this.Ba<=Db(this)&&(this.Aa=this.Ba=-1,yb(this),O(this),k=!0);k&&this.I(Db(this)+" cycles: checksum="+q(this.jb))}this.Ea-=e;if(0>=this.Ea){this.Ea+=this.lb;15<=++this.Rb&&(this.h&&this.h.Ma(),this.Rb=0);break}}while(this.g.ea)}catch(m){O(this); +zb(this);this.h&&this.h.stop(ga(),Db(this));Ea(this,!1);b=m.stack||m.message;this.g.error=!0;this.K(b);return}b=setTimeout;c=this.Sb;this.W=ga();d=this.Qb;this.Fa&&(d=Math.round(d*this.Fa/this.lb));d-=this.W-this.ib;if(f=this.W-this.J)this.V=Math.round(this.M/(10*f))/100,864E5<=f&&(this.Y=0,Ab(this));if(0>d||this.Vd&&(this.J-=d),d=0;this.wb+=this.Fa;this.W+=d;b(c,d)}else zb(this),this.h&&this.h.stop(ga(),Db(this))};l.$b=function(){return 0}; +function O(a){a.g.Ya&&(a.g.Bb=!0);a.X-=a.a;a.a=0;Bb(a,a.M);a.M=0;if(a.g.ea){a.g.ea=!1;a.za&&a.za.stop();var b=a.u.run;b&&(b.textContent="Run")}a.g.complete=void 0}function zb(a){a.h&&a.h.Ma(void 0)} +function Eb(a){this.jc=a.resetAddr||0;ub.call(this,a,1E6);this.Kb=0;this.decode=Fb.bind(this);this.C=65536;this.l=32768;this.o=65535;this.i=32768;this.c=[0,0,0,0,0,0,0,this.jc];this.Ka=[0,0,0,0,0,0];this.wa=[0,0,0,0];this.Pa=this.B=0;this.O=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.fb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.Db=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.b=-1;this.D=0;this.Ia=70;this.la=-1;this.Ub=0;Gb(this);this.g.complete=this.g.dc=!1}z(Eb,ub);l=Eb.prototype;l.reset=function(){this.g.ea&&O(this);Gb(this);xb(this);this.g.error=!1;this.parent.reset.call(this)}; +function Gb(a){a.va=255;a.m=0;a.Gb=0;a.w=0;a.Ca=0;a.hb=0;a.Da=0;a.ob=0;a.Oa=0;a.pb=[7,7,7,7];a.f=[];a.ga=2;Va(a)}function Va(a){a.ob?(a.Jb=65536,a.ba=a.hc,a.sb=a.da):(a.Jb=0,a.ba=a.gc,a.sb=a.tb)}l.Tb=function(){return 0};l.save=function(){var a=new P(this);a.set(0,[]);a.set(1,[this.Y,this.ka]);a.set(2,Sa(this.j));return a.data()}; +l.restore=function(a){var b=a[1];this.Y=b[1];Ab(this,b[3]);a:{b=this.j;a=a[2];var c;for(c=0;cb){a.f[e].pa-=b;break}b-=a.f[e].pa}a.f.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.ga=2}function Wa(a){return a.N=a.N&63728|(a.i&32768?8:0)|(a.o&65535?0:4)|(a.l&32768?2:0)|(a.C&65536?1:0)} +function Xa(a,b){a.i=b<<12;a.o=~b&4;a.l=b<<14;a.C=b<<16;if((b^a.N)&2048)for(var c=a.Ka.length;0<=--c;){var d=a.c[c];a.c[c]=a.Ka[c];a.Ka[c]=d}a.B=b>>14&3;c=a.N>>14&3;a.B!=c&&(a.wa[c]=a.c[6],a.c[6]=a.wa[a.B]);a.ga=2;a.N=b}function Hb(a,b){a.D&128||(a.i=a.o=a.C=b,a.l=0)}function Q(a,b){a.D&128||(a.i=a.o=b,a.l=0)}function Ib(a,b,c,d){a.D&128||(a.i=a.o=a.C=b,a.l=(c^d)&(d^b))} +function M(a,b){var c=!1;0>a.la?a.la=Wa(a):a.B||(b=4,c=!0);a.w&57344||(a.Ca=63222,a.hb=b);a.B=0;var d=a.da(b|65536),f=a.da(b+2&65535|65536);Xa(a,f&53247|a.la>>2&12288);c&&(a.m|=4,a.c[6]=4);Jb(a,a.la);Jb(a,a.c[7]);a.c[7]=d;a.D&=-113;a.la=-1;throw b;}function eb(a,b){var c=b>>13&31;31>c?a.Da&32&&(b=a.fb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b} +function Kb(a,b,c){var d,f,e,g=0;if(c&a.ob){d=b>>13&a.pb[a.B];f=a.O[a.B][d];e=(a.O[a.B][d+16]<<6)+(b&8191)&4194303;a.Da&16?3932160<=e&&4186112>e&&(e=eb(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.m|=32,M(a,4)),e&1&&!(c&1)&&(a.m|=64,M(a,4)));switch(f&7){case 1:g=4096;case 2:f|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:f|=c&4?192:128;break;default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2&8128)&&(g|= +16384));a.O[a.B][d]=f;if(4194170!==e||a.B)a.Oa=a.B,a.Pa=d;g&&(g&57344&&(0<=a.la&&(g|=128),a.w&57344||(a.w=a.w|g|a.Oa<<5|a.Pa<<1),M(a,168)),a.w&61440||!(4191360>e||4194239>>b.j;a=c!=b.h?b.b[d].sb(c,a):b.b[d++].ab(c,a)|b.b[d&b.J].ab(0,a+1)<<8}return a};l.da=function(a){return this.tb(Kb(this,a,2))}; +function db(a,b,c){c&=65535;if(4194304<=b)return a.c[b-4194304]=c;if(0<=b){a=a.j;var d=c,f=b&a.h,e=(b&a.i)>>>a.j;f!=a.h?a.b[e].Gc(f,d&65535,b):(a.b[e++].gb(f,d&255,b),a.b[e&a.J].gb(0,d>>8&255,b+1));return c}return b}function Lb(a,b){4194304<=b?b=a.c[b-4194304]&255:0<=b&&(a=a.j,b=a.b[(b&a.i)>>>a.j].ab(b&a.h,b));return b}function Mb(a,b,c){c&=255;4194304<=b?a.c[b-4194304]=a.c[b-4194304]&65280|c:0<=b&&(a=a.j,a.b[(b&a.i)>>>a.j].gb(b&a.h,c&255,b))} +function Jb(a,b){var c=a.c[6]-2&65535;a.c[6]=c;a.w&57344||(a.Ca=a.Ca<<8|246);!a.B&&c<=a.va&&4>3&7){case 0:M(a,4);break;case 1:return 6===e&&!a.B&&c&4&&(a.c[6]<=a.va||65534<=a.c[6])&&(a.c[6]<=a.va-32||65534<=a.c[6]?(a.m|=4,a.c[6]=4,M(a,4)):(a.m|=8,a.D|=64)),7===e?a.c[e]:a.c[e]|g;case 2:f=2;d=a.c[e];7!==e&&(d|=g,6>e&&c&1&&(f=1));break;case 3:f=2;d=a.c[e];7!==e&&(d|=g);if(0>(d=a.da(d)))return d;d|=g;break;case 4:f=-2;6>e&&c&1&&(f=-1);d=a.c[e]+f&65535;7!==e&&(d|=g);break;case 5:f=-2;d=a.c[e]-2&65535;7!==e&&(d|=g);if(0>(d=a.da(d)))return d; +d|=g;break;case 6:if(0>(d=a.da(a.c[7])))return d;a.c[7]=a.c[7]+2&65535;d=d+a.c[e]&65535;return d|g;case 7:if(0>(d=a.da(a.c[7])))return d;a.c[7]=a.c[7]+2&65535;d=d+a.c[e]&65535;return 0>(d=a.da(d|65536))?d:d|g}a.c[e]=a.c[e]+f&65535;!g||a.w&57344||(a.Ca=a.Ca<<8|f<<3&248|e);6===e&&!a.B&&c&4&&0>=f&&(a.c[6]<=a.va||65534<=a.c[6])&&(a.c[6]<=a.va-32?(a.m|=4,a.c[6]=4,M(a,4)):(a.m|=8,a.D|=64));return d}l.gc=function(a,b){return Nb(this,a,b)};l.hc=function(a,b){return Kb(this,Nb(this,a,b),b)}; +function R(a,b){return b&56?a.sb(Nb(a,b,2)):a.c[b&7]}function S(a,b){return b&56?Lb(a,a.ba(b,3)):a.c[b&7]&255}function Ob(a,b,c,d){b&56?(b=a.ba(b,6),db(a,b,d.call(a,c,a.tb(b)))):(b&=7,a.c[b]=d.call(a,c,a.c[b])&65535)}function Pb(a,b,c,d){b&56?(b=a.ba(b,7),Mb(a,b,d.call(a,c,Lb(a,b)))):(b&=7,a.c[b]=a.c[b]&65280|d.call(a,c,a.c[b])&255)}function Qb(a,b,c){b&56?db(a,a.ba(b,4),c):a.c[b&7]=c&65535;return c} function Rb(a,b,c,d){b&56?Mb(a,a.ba(b,5),c):(b&=7,a.c[b]=c?d&1?c<<24>>24&65535:a.c[b]&-256|c&255:a.c[b]&-256);return c}function T(a,b){return a.c[7]+(b<<24>>23)&65535} -l.ac=function(a){this.g.complete=!0;this.g.ec=!1;this.g.$b=!1;this.F=this.a=a;this.Nb&256?(this.F-=this.a,this.a=0,a=!1):a=!0;if(a){do{var b,c;this.C&112&&(this.C&32?M(this,168,52):this.C&64?M(this,4,54):this.C&16&&M(this,12,56),this.C&=-113);if(this.ha)if(1===this.ha)this.ha=2;else{this.ha=0;c=-1;a=this.ub&224;if(0<(b=this.f.length))for(;0a&& -(a=this.f[b].oc,c=b)}a>(this.O&224)&&(0>c?M(this,160,42):(M(this,this.f[c].Cc,44),this.f.splice(c,1)))}this.I&57344||(this.na=0,this.Ya=this.c[7]);this.C=this.O&16;this.b=a=this.ea(this.c[7]);0<=a&&(this.c[7]=this.c[7]+2&65535);this.decode(a);if(0>this.b){this.c[7]=this.c[7]-2&65535;this.J("unimplemented");break}}while(0>6&7;Jb(this,this.c[a]);this.c[a]=this.c[7];this.c[7]=b;--this.a}function bc(){this.b=-1;--this.a}function cc(){--this.a}function V(a){a&1&&(this.B=65536);a&2&&(this.j=32768);a&4&&(this.o=0);a&8&&(this.i=32768);--this.a}function dc(){this.b=-1;--this.a}function ec(){this.b=-1;--this.a} -function W(){M(this,8,48)}function Eb(a){fc[a>>12].call(this,a)} +l.$b=function(a){this.g.complete=!0;this.g.dc=!1;this.g.Zb=!1;this.X=this.a=a;do{this.D&112&&(this.D&32?M(this,168):this.D&64?M(this,4):this.D&16&&M(this,12),this.D&=-113);if(this.ga)if(1==this.ga)this.ga=2;else{this.ga=0;a=null;for(var b=this.Gb&224,c=this.f.length;0<=--c;){if(0b&&(b=this.f[c].nc,a=this.f[c],this.f.splice(c,1))}b>(this.N&224)&&(a?M(this,a.Cc): +M(this,160))}this.w&57344||(this.Ca=0,this.hb=this.c[7]);this.D=this.N&16;a=this.b=this.da(this.c[7]);0<=a&&(this.c[7]=this.c[7]+2&65535);this.decode(a);if(0>this.b){this.c[7]=this.c[7]-2&65535;this.I("unimplemented");break}}while(0>6&7;Jb(this,this.c[a]);this.c[a]=this.c[7];this.c[7]=b;--this.a}function bc(){this.b=-1;--this.a}function cc(){--this.a}function V(a){a&1&&(this.C=65536);a&2&&(this.l=32768);a&4&&(this.o=0);a&8&&(this.i=32768);--this.a}function dc(){this.b=-1;--this.a}function ec(){this.b=-1;--this.a}function W(){M(this,8)}function Fb(a){fc[a>>12].call(this,a)} var fc=[function(a){gc[a>>8&15].call(this,a)},function(a){Q(this,Qb(this,a,R(this,a>>6)));--this.a},function(a){var b=R(this,a>>6);a=R(this,a);Ib(this,b-a,a,b);--this.a},function(a){Q(this,R(this,a>>6)&R(this,a));--this.a},function(a){Ob(this,a,R(this,a>>6),Tb);--this.a},function(a){Ob(this,a,R(this,a>>6),Vb);--this.a},function(a){Ob(this,a,R(this,a>>6),Sb);--this.a},function(a){hc[a>>8&15].call(this,a)},function(a){ic[a>>8&15].call(this,a)},function(a){var b=S(this,a>>6);Q(this,Rb(this,a,b,1)<<8); --this.a},function(a){var b=S(this,a>>6)<<8;a=S(this,a)<<8;Ib(this,b-a,a,b);--this.a},function(a){Q(this,(S(this,a>>6)&S(this,a))<<8);--this.a},function(a){Pb(this,a,S(this,a>>6),Ub);--this.a},function(a){Pb(this,a,S(this,a>>6),Wb);--this.a},function(a){Ob(this,a,R(this,a>>6),Xb);--this.a},W],gc=[function(a){jc[a>>4&15].call(this,a)},function(a){this.c[7]=T(this,a);--this.a},function(a){this.o&65535&&(this.c[7]=T(this,a));--this.a},function(a){this.o&65535||(this.c[7]=T(this,a));--this.a},function(a){!(this.i& -32768)==!(this.j&32768)&&(this.c[7]=T(this,a));--this.a},function(a){!(this.i&32768)!=!(this.j&32768)&&(this.c[7]=T(this,a));--this.a},function(a){this.o&65535&&!(this.i&32768)==!(this.j&32768)&&(this.c[7]=T(this,a));--this.a},function(a){this.o&65535&&!(this.i&32768)==!(this.j&32768)||(this.c[7]=T(this,a));--this.a},ac,ac,function(a){kc[a>>6&3].call(this,a)},function(a){lc[a>>6&3].call(this,a)},function(a){mc[a>>6&3].call(this,a)},function(a){nc[a>>6&3].call(this,a)},W,W],jc=[function(a){oc[a&15].call(this, -a)},W,W,W,W,W,W,W,function(a){var b=this.ea(this.c[6]|65536);0<=b&&(this.c[6]=this.c[6]+2&65535);a&=7;this.c[7]=this.c[a];this.c[a]=b;--this.a},function(a){this.O&49152||(this.O=this.O&-2017|(a&7)<<5,this.ha=1);--this.a},function(a){pc[a&15].call(this,a)},function(a){qc[a&15].call(this,a)},W,W,W,W],pc=[cc,function(){this.B=0;--this.a},function(){this.j=0;--this.a},U,function(){this.o=1;--this.a},U,U,U,function(){this.i=0;--this.a},U,U,U,U,U,U,U],qc=[cc,function(){this.B=65536;--this.a},function(){this.j= -32768;--this.a},V,function(){this.o=0;--this.a},V,V,V,function(){this.i=32768;--this.a},V,V,V,V,V,V,V],oc=[function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.O&49152||(Gb(this),this.l.reset());--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},W,W,W,W,W,W,W,W],hc=[bc,bc,$b,$b,Yb,Yb,Zb,Zb,ec,ec,W,W,W,W,dc,dc],ic=[function(a){this.i&32768||(this.c[7]=T(this,a)); ---this.a},function(a){this.i&32768&&(this.c[7]=T(this,a));--this.a},function(a){this.B&65536||!(this.o&65535)||(this.c[7]=T(this,a));--this.a},function(a){if(this.B&65536||!(this.o&65535))this.c[7]=T(this,a);--this.a},function(a){this.j&32768||(this.c[7]=T(this,a));--this.a},function(a){this.j&32768&&(this.c[7]=T(this,a));--this.a},function(a){this.B&65536||(this.c[7]=T(this,a));--this.a},function(a){this.B&65536&&(this.c[7]=T(this,a));--this.a},function(){this.b=-1;--this.a},function(){this.b=-1; +32768)==!(this.l&32768)&&(this.c[7]=T(this,a));--this.a},function(a){!(this.i&32768)!=!(this.l&32768)&&(this.c[7]=T(this,a));--this.a},function(a){this.o&65535&&!(this.i&32768)==!(this.l&32768)&&(this.c[7]=T(this,a));--this.a},function(a){this.o&65535&&!(this.i&32768)==!(this.l&32768)||(this.c[7]=T(this,a));--this.a},ac,ac,function(a){kc[a>>6&3].call(this,a)},function(a){lc[a>>6&3].call(this,a)},function(a){mc[a>>6&3].call(this,a)},function(a){nc[a>>6&3].call(this,a)},W,W],jc=[function(a){oc[a&15].call(this, +a)},W,W,W,W,W,W,W,function(a){var b=this.da(this.c[6]|65536);0<=b&&(this.c[6]=this.c[6]+2&65535);a&=7;this.c[7]=this.c[a];this.c[a]=b;--this.a},function(a){this.N&49152||(this.N=this.N&-2017|(a&7)<<5,this.ga=1);--this.a},function(a){pc[a&15].call(this,a)},function(a){qc[a&15].call(this,a)},W,W,W,W],pc=[cc,function(){this.C=0;--this.a},function(){this.l=0;--this.a},U,function(){this.o=1;--this.a},U,U,U,function(){this.i=0;--this.a},U,U,U,U,U,U,U],qc=[cc,function(){this.C=65536;--this.a},function(){this.l= +32768;--this.a},V,function(){this.o=0;--this.a},V,V,V,function(){this.i=32768;--this.a},V,V,V,V,V,V,V],oc=[function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.N&49152||(Gb(this),this.j.reset());--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},W,W,W,W,W,W,W,W],hc=[bc,bc,$b,$b,Yb,Yb,Zb,Zb,ec,ec,W,W,W,W,dc,dc],ic=[function(a){this.i&32768||(this.c[7]=T(this,a)); +--this.a},function(a){this.i&32768&&(this.c[7]=T(this,a));--this.a},function(a){this.C&65536||!(this.o&65535)||(this.c[7]=T(this,a));--this.a},function(a){if(this.C&65536||!(this.o&65535))this.c[7]=T(this,a);--this.a},function(a){this.l&32768||(this.c[7]=T(this,a));--this.a},function(a){this.l&32768&&(this.c[7]=T(this,a));--this.a},function(a){this.C&65536||(this.c[7]=T(this,a));--this.a},function(a){this.C&65536&&(this.c[7]=T(this,a));--this.a},function(){this.b=-1;--this.a},function(){this.b=-1; --this.a},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)},W,W],kc=[function(a){Hb(this,Qb(this,a,0));--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a}],lc=[function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a}],mc=[function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b= -1;--this.a},function(){this.b=-1;--this.a}],nc=[function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a}],rc=[function(a){Hb(this,Rb(this,a,0));--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a}],sc=[function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a}],tc=[function(){this.b=-1;--this.a},function(){this.b=-1; --this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a}],uc=[function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a},function(){this.b=-1;--this.a}]; -function X(a){x.call(this,"ROM",a,X);this.b=null;this.o=a.addr;this.f=a.size;this.w=a.writable;this.h=a.alias;this.i=a.file;this.B=ba(this.i);if(this.i){a=this.i;var b=ca(this.B);"json"!=b&&"hex"!=b&&(a=r()+"/api/v1/dump?file="+this.i+"&format=bytes&decimal=true");var c=this;t(a,null,!0,function(a,b,e){vc(c,a,b,e)})}}z(X);X.prototype.Ja=function(a,b,c,d){this.l=b;this.a=c;this.H=d;wc(this)};X.prototype.xa=function(){this.j&&(this.H&&this.H.a(this.id,this.o,this.f,this.j),delete this.j);return!0}; -X.prototype.wa=function(){return!0}; -function vc(a,b,c,d){if(d)a.L("Unable to load system ROM (error "+d+": "+b+")");else{Ca(a.Mb,b,c);var f;if("["==c.charAt(0)||"{"==c.charAt(0))try{var e,g,h=eval("("+c+")");if(e=h.bytes)a.b=e;else if(e=h.words)for(a.b=Array(2*e.length),g=f=0;f>8&255;else if(e=h.data)for(a.b=Array(4*e.length),g=f=0;f>8&255,a.b[g++]=e[f]>>16&255,a.b[g++]=e[f]>>24&255;else a.b=h;a.j=h.symbols;if(!a.b.length){u("Empty ROM: "+b); -return}if(1==a.b.length){u(a.b[0]);return}}catch(k){a.L("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f>>d.f].bc(f&d.h,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.h?b.push(a.h):null!=a.h&&a.h.length&&(b=a.h);for(c=0;c>>f.f;0>>=f.f;0>8&255;else if(e=h.data)for(a.b=Array(4*e.length),g=f=0;f>8&255,a.b[g++]=e[f]>>16&255,a.b[g++]=e[f]>>24&255;else a.b=h;a.l=h.symbols;if(!a.b.length){u("Empty ROM: "+b); +return}if(1==a.b.length){u(a.b[0]);return}}catch(k){a.K("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f>>d.j].ac(f&d.h,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.h?b.push(a.h):null!=a.h&&a.h.length&&(b=a.h);for(c=0;c>>f.j;0>>=f.j;0\nLicense: GPL version 3 or later ");this.J("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bY){if(Z(d,this.B)){this.j=new P(this,"1.30.0","failsafe");Z(this.j)&&(Gc(this,d),a=2,Hc(this.j));this.j.set("timestamp",ha());Ic(this.j);var f=this.b&&!this.o;if(1==a||ia("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=Fc(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?Z(d,g):("error"==e&& -"no machine state"!=g?(this.L("Error: "+g),"unable to verify user"==g&&(ma("user",""),this.f=null)):this.J(e+": "+g),Hc(d),Z(d)?(c=Fc(d),f=!0):c=!1))}f&&Ec(this,c?d:null)}else 2==a&&d.clear()}else Ec(this);delete this.B;delete this.F}f=A(this.id);for(e=0;ea[1];a=a[2];this.ca=!0;this.g.M=!0;var d=this.u.power;d&&(d.textContent="Shutdown");this.a&&(Jc(this,this.a,b,c,a),this.a.$a());this.W&&(Gc(this,b),b.clear());!c&&this.j&&(this.j.clear(),delete this.j);this.h=0}; +function zc(a,b,c){x.call(this,"Computer",a,zc);this.g.L=!1;Ac(this,b);this.J=wb(this,"autoPower",a);this.h=0;this.Y=a.busWidth||a.buswidth;this.b=Y;this.B=null;this.o=this.W=!1;this.url=wb(this,"url")||"";(Math.random()+.1).toString(36);this.f=Bc(this);if(this.a=Da("CPU",this.id)){this.H=Da("Debugger",this.id);this.j=new G({id:this.Nb+".bus",busWidth:this.Y},this.a,this.H);var d,f=A(this.id);if((this.i=Da("Panel",this.id))&&this.i.Cb)for(b=0;b\nLicense: GPL version 3 or later ");this.I("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bY){if(Z(d,this.B)){this.l=new P(this,"1.30.0","failsafe");Z(this.l)&&(Gc(this,d),a=2,Hc(this.l));this.l.set("timestamp",ha());Ic(this.l);var f=this.b&&!this.o;if(1==a||ia("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=Fc(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?Z(d,g):("error"==e&& +"no machine state"!=g?(this.K("Error: "+g),"unable to verify user"==g&&(ma("user",""),this.f=null)):this.I(e+": "+g),Hc(d),Z(d)?(c=Fc(d),f=!0):c=!1))}f&&Ec(this,c?d:null)}else 2==a&&d.clear()}else Ec(this);delete this.B;delete this.C}f=A(this.id);for(e=0;ea[1];a=a[2];this.ba=!0;this.g.L=!0;var d=this.u.power;d&&(d.textContent="Shutdown");this.a&&(Jc(this,this.a,b,c,a),this.a.Wa());this.V&&(Gc(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.h=0}; function Gc(a,b){if(ia("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var c=a.f||"";b=b.toString();var d={app:"PDP11js",ver:"1.30.0"};d.url=a.url;d.user=c;d.type="bug";d.data=b;t("http://www.pcjs.org/api/v1/report",d,!0)}} -function Kc(a,b,c){var d,f="none";if(a.h)return null;a.h--;var e=new P(a,"1.30.0"),g=new P(a,"1.30.0","validate"),h=ha();g.set("timestamp",h);e.set("timestamp",h);e.set("version","1.30.0");e.set("url",window?window.location.href:null);e.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.wa&&(c&&O(a.a),d=a.a.wa(b,c),"object"===typeof d&&e.set(a.a.id,d),c&&(a.a.g.M=!1,!1===d&&(f=null)));for(var h=A(a.id),k=0;k).*?(<\/xsl:variable>)/,"$1pdp11$2"));e=null;if("<"==a.charAt(0))try{f||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.loadXML(a)):e=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){e=null,a=p.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");t(f,null,!0,function(e,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(e=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=h[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(e);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, "");a=a.replace(d[0],g);Rc(a,b,c)}})}else c(a,null)} -function Sc(a,b,c,d){function f(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=fa(a))}function e(a){f("Error: "+a);k&&(--Oc||ta(!0));k=!1}var g,h,k=!0;Oc++;Ba[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],E=document.createElement("style");E.type="text/css";E.styleSheet?E.styleSheet.cssText=m:E.appendChild(document.createTextNode(m));p.appendChild(E)}c|| +function Sc(a,b,c,d){function f(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=fa(a))}function e(a){f("Error: "+a);k&&(--Oc||ta(!0));k=!1}var g,h,k=!0;Oc++;Ba[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],F=document.createElement("style");F.type="text/css";F.styleSheet?F.styleSheet.cssText=m:F.appendChild(document.createTextNode(m));p.appendChild(F)}c|| (c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?Pc(c,null,null,!1,f,function(d,k){k?(Ca(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--Oc||ta(!0)):e("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(k),(k=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--Oc||ta(!0)):e("invalid machine element: "+ a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(d)}):e(d)};"<"!=b.charAt(0)?Pc(b,a,d,!0,f,m):Qc(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(H){e(H.message)}return k}window.embedPDP11=function(a,b,c,d){ta(!1);return Sc(a,b,c,d)};window.enableEvents=ta;window.sendEvent=ua;})();