From 0e0dcb29ec6a00796ae1aec539589949ef54fc72 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 30 Sep 2016 15:27:53 -0700 Subject: [PATCH] Added some PDP-11 opcodes I missed (JMP and SWAB) --- modules/pdp11/lib/cpuops.js | 173 +++++++++++++-------- modules/pdp11/lib/cpustate.js | 34 +++-- versions/pdp11/1.30.0/pdp11.js | 264 +++++++++++++++++---------------- 3 files changed, 268 insertions(+), 203 deletions(-) diff --git a/modules/pdp11/lib/cpuops.js b/modules/pdp11/lib/cpuops.js index 73865f08a..369b5e84c 100644 --- a/modules/pdp11/lib/cpuops.js +++ b/modules/pdp11/lib/cpuops.js @@ -155,7 +155,7 @@ PDP11.fnASRB = function(src, dst) PDP11.fnBIC = function(src, dst) { var result = dst & ~src; - this.updateNZFlags(result); + this.updateNZVFlags(result); return result; }; @@ -170,7 +170,7 @@ PDP11.fnBIC = function(src, dst) PDP11.fnBICB = function(src, dst) { var result = dst & ~src; - this.updateNZFlags(result << 8); + this.updateNZVFlags(result << 8); return result; }; @@ -185,7 +185,7 @@ PDP11.fnBICB = function(src, dst) PDP11.fnBIS = function(src, dst) { var result = dst | src; - this.updateNZFlags(result); + this.updateNZVFlags(result); return result; }; @@ -200,7 +200,7 @@ PDP11.fnBIS = function(src, dst) PDP11.fnBISB = function(src, dst) { var result = dst | src; - this.updateNZFlags(result << 8); + this.updateNZVFlags(result << 8); return result; }; @@ -420,6 +420,24 @@ PDP11.fnSUBB = function(src, dst) return result & 0xff; }; +/** + * fnSWAB(src, dst) + * + * @this {CPUStatePDP11} + * @param {number} src (ignored) + * @param {number} dst + * @return {number} (dst with bytes swapped) + */ +PDP11.fnSWAB = function(src, dst) +{ + var result = (dst << 8) | (dst >> 8); + /* + * N and Z are based on the low byte of the result, which is the same as the high byte of dst. + */ + this.updateNZVCFlags(dst & 0xff00); + return result & 0xffff; +}; + /** * fnXOR(src, dst) * @@ -431,7 +449,7 @@ PDP11.fnSUBB = function(src, dst) PDP11.fnXOR = function(src, dst) { var result = dst ^ src; - this.updateNZFlags(result); + this.updateNZVFlags(result); return result & 0xffff; }; @@ -444,7 +462,7 @@ PDP11.fnXOR = function(src, dst) PDP11.opADC = function(opCode) { this.updateWordByMode(opCode, this.getCF()? 1 : 0, PDP11.fnADD); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -456,7 +474,7 @@ PDP11.opADC = function(opCode) PDP11.opADCB = function(opCode) { this.updateByteByMode(opCode, this.getCF()? 1 : 0, PDP11.fnADDB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -468,7 +486,7 @@ PDP11.opADCB = function(opCode) PDP11.opADD = function(opCode) { this.updateWordByMode(opCode, this.readWordByMode(opCode >> PDP11.SRCMODE.SHIFT), PDP11.fnADD); - this.nStepCycles -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1) + (this.dstReg == 7? 2 : 0))); + this.nStepCycles -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); }; /** @@ -557,7 +575,7 @@ PDP11.opASHC = function(opCode) PDP11.opASL = function(opCode) { this.updateWordByMode(opCode, 0, PDP11.fnASL); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -569,7 +587,7 @@ PDP11.opASL = function(opCode) PDP11.opASLB = function(opCode) { this.updateByteByMode(opCode, 0, PDP11.fnASLB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -629,7 +647,7 @@ PDP11.opBCS = function(opCode) PDP11.opBIC = function(opCode) { this.updateWordByMode(opCode, this.readWordByMode(opCode >> PDP11.SRCMODE.SHIFT), PDP11.fnBIC); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); }; /** @@ -641,7 +659,7 @@ PDP11.opBIC = function(opCode) PDP11.opBICB = function(opCode) { this.updateByteByMode(opCode, this.readByteByMode(opCode >> PDP11.SRCMODE.SHIFT), PDP11.fnBICB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); }; /** @@ -653,7 +671,7 @@ PDP11.opBICB = function(opCode) PDP11.opBIS = function(opCode) { this.updateWordByMode(opCode, this.readWordByMode(opCode >> PDP11.SRCMODE.SHIFT), PDP11.fnBIS); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); }; /** @@ -665,7 +683,7 @@ PDP11.opBIS = function(opCode) PDP11.opBISB = function(opCode) { this.updateByteByMode(opCode, this.readByteByMode(opCode >> PDP11.SRCMODE.SHIFT), PDP11.fnBISB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); }; /** @@ -676,8 +694,8 @@ PDP11.opBISB = function(opCode) */ PDP11.opBIT = function(opCode) { - this.updateNZFlags(this.readWordByMode(opCode >> PDP11.SRCMODE.SHIFT) & this.readWordByMode(opCode)); - this.nStepCycles -= 1; + this.updateNZVFlags(this.readWordByMode(opCode >> PDP11.SRCMODE.SHIFT) & this.readWordByMode(opCode)); + this.nStepCycles -= (this.dstMode? (3 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 1) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); }; /** @@ -688,8 +706,8 @@ PDP11.opBIT = function(opCode) */ PDP11.opBITB = function(opCode) { - this.updateNZFlags((this.readByteByMode(opCode >> PDP11.SRCMODE.SHIFT) & this.readByteByMode(opCode)) << 8); - this.nStepCycles -= 1; + this.updateNZVFlags((this.readByteByMode(opCode >> PDP11.SRCMODE.SHIFT) & this.readByteByMode(opCode)) << 8); + this.nStepCycles -= (this.dstMode? (3 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 1) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); }; /** @@ -869,7 +887,7 @@ PDP11.opBVS = function(opCode) PDP11.opCLR = function(opCode) { this.updateAllFlags(this.writeWordByMode(opCode, 0)); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -881,7 +899,7 @@ PDP11.opCLR = function(opCode) PDP11.opCLRB = function(opCode) { this.updateAllFlags(this.writeByteByMode(opCode, 0)); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -963,7 +981,7 @@ PDP11.opCMP = function(opCode) * we must reverse the order of the src and dst parameters. */ this.updateSubFlags(result, dst, src); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (3 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 1) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); }; /** @@ -982,7 +1000,7 @@ PDP11.opCMPB = function(opCode) * we must reverse the order of the src and dst parameters. */ this.updateSubFlags(result, dst, src); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (3 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 1) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); }; /** @@ -994,7 +1012,7 @@ PDP11.opCMPB = function(opCode) PDP11.opCOM = function(opCode) { this.updateWordByMode(opCode, 0, PDP11.fnCOM); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1006,7 +1024,7 @@ PDP11.opCOM = function(opCode) PDP11.opCOMB = function(opCode) { this.updateByteByMode(opCode, 0, PDP11.fnCOMB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1018,7 +1036,7 @@ PDP11.opCOMB = function(opCode) PDP11.opDEC = function(opCode) { this.updateWordByMode(opCode, 1, PDP11.fnDEC); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1030,7 +1048,7 @@ PDP11.opDEC = function(opCode) PDP11.opDECB = function(opCode) { this.updateByteByMode(opCode, 1, PDP11.fnDECB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1111,7 +1129,7 @@ PDP11.opHALT = function(opCode) PDP11.opINC = function(opCode) { this.updateWordByMode(opCode, 1, PDP11.fnINC); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1123,7 +1141,7 @@ PDP11.opINC = function(opCode) PDP11.opINCB = function(opCode) { this.updateByteByMode(opCode, 1, PDP11.fnINCB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1138,6 +1156,18 @@ PDP11.opIOT = function(opCode) this.nStepCycles -= 1; }; +/** + * opJMP(opCode) + * + * @this {CPUStatePDP11} + * @param {number} opCode + */ +PDP11.opJMP = function(opCode) +{ + this.setPC(this.getVirtualByMode(opCode, PDP11.ACCESS.VIRT)); + this.nStepCycles -= 1; +}; + /** * opJSR(opCode) * @@ -1149,8 +1179,8 @@ PDP11.opJSR = function(opCode) var addr = this.getVirtualByMode(opCode, PDP11.ACCESS.VIRT); var reg = (opCode >> PDP11.SRCMODE.SHIFT) & PDP11.OPREG.MASK; this.pushWord(this.regsGen[reg]); - this.regsGen[reg] = this.regsGen[PDP11.REG.PC]; - this.regsGen[PDP11.REG.PC] = addr; + this.regsGen[reg] = this.getPC(); + this.setPC(addr); this.nStepCycles -= 1; }; @@ -1162,7 +1192,7 @@ PDP11.opJSR = function(opCode) */ PDP11.opMARK = function(opCode) { - var addr = (this.regsGen[PDP11.REG.PC] + ((opCode & 0x3F) << 1)) & 0xffff; + var addr = (this.getPC() + ((opCode & 0x3F) << 1)) & 0xffff; var src = this.readWordFromVirtual(addr | 0x10000); this.setPC(this.regsGen[5]); this.setSP(addr + 2); @@ -1180,7 +1210,7 @@ PDP11.opMFPD = function(opCode) { var data = this.readWordFromPrevSpace(opCode, PDP11.ACCESS.DSPACE); this.pushWord(data); - this.updateNZFlags(data); + this.updateNZVFlags(data); this.nStepCycles -= 1; }; @@ -1194,10 +1224,15 @@ PDP11.opMFPI = function(opCode) { var data = this.readWordFromPrevSpace(opCode, PDP11.ACCESS.ISPACE); this.pushWord(data); - this.updateNZFlags(data); + this.updateNZVFlags(data); this.nStepCycles -= 1; }; +PDP11.MOV_CYCLES = [ + [2 + 1, 8 + 1, 8 + 1, 11 + 2, 9 + 1, 12 + 2, 10 + 2, 13 + 3, + 3 + 1, 8 + 1, 8 + 1, 11 + 2, 9 + 1, 12 + 2, 11 + 2, 14 + 3] +]; + /** * opMOV(opCode) * @@ -1206,8 +1241,8 @@ PDP11.opMFPI = function(opCode) */ PDP11.opMOV = function(opCode) { - this.updateNZFlags(this.writeWordByMode(opCode, this.readWordByMode(opCode >> PDP11.SRCMODE.SHIFT))); - this.nStepCycles -= 1; + this.updateNZVFlags(this.writeWordByMode(opCode, this.readWordByMode(opCode >> PDP11.SRCMODE.SHIFT))); + this.nStepCycles -= PDP11.MOV_CYCLES[(this.srcMode? 8 : 0) + this.dstMode] + (this.dstReg == 7 && !this.dstMode? 2 : 0); }; /** @@ -1219,8 +1254,8 @@ PDP11.opMOV = function(opCode) PDP11.opMOVB = function(opCode) { var data = this.readByteByMode(opCode >> PDP11.SRCMODE.SHIFT); - this.updateNZFlags(this.writeByteByMode(opCode, data, PDP11.WRITE.SIGNEXT) << 8); - this.nStepCycles -= 1; + this.updateNZVFlags(this.writeByteByMode(opCode, data, PDP11.WRITE.SIGNEXT) << 8); + this.nStepCycles -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1233,7 +1268,7 @@ PDP11.opMTPD = function(opCode) { var data = this.popWord(); this.writeWordToPrevSpace(opCode, PDP11.ACCESS.DSPACE, data); - this.updateNZFlags(data); + this.updateNZVFlags(data); this.nStepCycles -= 1; }; @@ -1247,7 +1282,7 @@ PDP11.opMTPI = function(opCode) { var data = this.popWord(); this.writeWordToPrevSpace(opCode, PDP11.ACCESS.ISPACE, data); - this.updateNZFlags(data); + this.updateNZVFlags(data); this.nStepCycles -= 1; }; @@ -1331,7 +1366,7 @@ PDP11.opRESET = function(opCode) PDP11.opROL = function(opCode) { this.updateWordByMode(opCode, 0, PDP11.fnROL); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1343,7 +1378,7 @@ PDP11.opROL = function(opCode) PDP11.opROLB = function(opCode) { this.updateByteByMode(opCode, 0, PDP11.fnROLB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1397,7 +1432,7 @@ PDP11.opRTS = function(opCode) this.assert(!(opCode & 0x08)); var src = this.popWord(); var reg = opCode & PDP11.OPREG.MASK; - this.regsGen[PDP11.REG.PC] = this.regsGen[reg]; + this.setPC(this.regsGen[reg]); this.regsGen[reg] = src; this.nStepCycles -= 1; }; @@ -1423,7 +1458,7 @@ PDP11.opRTT = function(opCode) PDP11.opSBC = function(opCode) { this.updateWordByMode(opCode, this.getCF()? 1 : 0, PDP11.fnSUB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1435,7 +1470,7 @@ PDP11.opSBC = function(opCode) PDP11.opSBCB = function(opCode) { this.updateByteByMode(opCode, this.getCF()? 1 : 0, PDP11.fnSUBB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1511,7 +1546,7 @@ PDP11.opSOB = function(opCode) { var reg = (opCode & PDP11.SRCMODE.REG) >> PDP11.SRCMODE.SHIFT; if ((this.regsGen[reg] = ((this.regsGen[reg] - 1) & 0xffff))) { - this.setPC(this.regsGen[PDP11.REG.PC] - ((opCode & 0x3F) << 1)); + this.setPC(this.getPC() - ((opCode & 0x3F) << 1)); } this.nStepCycles -= 1; }; @@ -1541,7 +1576,19 @@ PDP11.opSPL = function(opCode) PDP11.opSUB = function(opCode) { this.updateWordByMode(opCode, this.readWordByMode(opCode >> PDP11.SRCMODE.SHIFT), PDP11.fnSUB); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) + (this.srcReg && this.dstReg >= 6? 1 : 0) : (this.srcMode? (3 + 2) : (2 + 1)) + (this.dstReg == 7? 2 : 0)); +}; + +/** + * opSWAB(opCode) + * + * @this {CPUStatePDP11} + * @param {number} opCode + */ +PDP11.opSWAB = function(opCode) +{ + this.updateWordByMode(opCode, 0, PDP11.fnSWAB); + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1552,8 +1599,8 @@ PDP11.opSUB = function(opCode) */ PDP11.opSXT = function(opCode) { - this.updateNZFlags(this.writeWordByMode(opCode, this.getNF? 0xffff : 0)); - this.nStepCycles -= 1; + this.updateNZVFlags(this.writeWordByMode(opCode, this.getNF? 0xffff : 0)); + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1645,7 +1692,7 @@ PDP11.opWAIT = function(opCode) PDP11.opXOR = function(opCode) { this.updateWordByMode(opCode, this.readWordByMode((opCode & PDP11.SRCMODE.REG) >> PDP11.SRCMODE.SHIFT), PDP11.fnXOR); - this.nStepCycles -= 1; + this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0)); }; /** @@ -1913,22 +1960,22 @@ PDP11.aOps0DXn_1170 = [ ]; PDP11.aOps00Xn_1170 = [ - PDP11.op000X_1170, // 0x000n - PDP11.opUndefined, // 0x001n - PDP11.opUndefined, // 0x002n - PDP11.opUndefined, // 0x003n - PDP11.opUndefined, // 0x004n - PDP11.opUndefined, // 0x005n - PDP11.opUndefined, // 0x006n - PDP11.opUndefined, // 0x007n - PDP11.opRTS, // 0x008n 00020R (technically, bit 3 should also be CLR for the RTS opCode) - PDP11.opSPL, // 0x009n 00023N (technically, bit 3 should also be SET for the SPL opCode) + PDP11.op000X_1170, // 0x000n 000000-000017 + PDP11.opUndefined, // 0x001n 000020-000037 + PDP11.opUndefined, // 0x002n 000040-000057 + PDP11.opUndefined, // 0x003n 000060-000077 + PDP11.opJMP, // 0x004n 000100-000117 + PDP11.opJMP, // 0x005n 000120-000137 + PDP11.opJMP, // 0x006n 000140-000157 + PDP11.opJMP, // 0x007n 000160-000177 + PDP11.opRTS, // 0x008n 00020R (technically, bit 3 should also be CLR for the RTS opCode) + PDP11.opSPL, // 0x009n 00023N (technically, bit 3 should also be SET for the SPL opCode) PDP11.op00AX_1170, // 0x00An 000240-000257 PDP11.op00BX_1170, // 0x00Bn 000260-000277 - PDP11.opUndefined, // 0x00Cn - PDP11.opUndefined, // 0x00Dn - PDP11.opUndefined, // 0x00En - PDP11.opUndefined // 0x00Fn + PDP11.opSWAB, // 0x00Cn 000300-000317 + PDP11.opSWAB, // 0x00Dn 000320-000337 + PDP11.opSWAB, // 0x00En 000340-000357 + PDP11.opSWAB // 0x00Fn 000360-000377 ]; PDP11.aOps00AX_1170 = [ diff --git a/modules/pdp11/lib/cpustate.js b/modules/pdp11/lib/cpustate.js index fa5e35fd0..c14ccaa9d 100644 --- a/modules/pdp11/lib/cpustate.js +++ b/modules/pdp11/lib/cpustate.js @@ -511,7 +511,7 @@ CPUStatePDP11.prototype.setNF = function() */ CPUStatePDP11.prototype.getPC = function() { - return this.regsGen[7]; + return this.regsGen[PDP11.REG.PC]; }; /** @@ -522,7 +522,7 @@ CPUStatePDP11.prototype.getPC = function() */ CPUStatePDP11.prototype.getPCWord = function() { - var data = this.readWordFromVirtual(this.regsGen[7]); + var data = this.readWordFromVirtual(this.regsGen[PDP11.REG.PC]); this.advancePC(2); return data; }; @@ -535,7 +535,7 @@ CPUStatePDP11.prototype.getPCWord = function() */ CPUStatePDP11.prototype.advancePC = function(off) { - this.regsGen[7] = (this.regsGen[7] + off) & 0xffff; + this.regsGen[PDP11.REG.PC] = (this.regsGen[PDP11.REG.PC] + off) & 0xffff; }; /** @@ -546,7 +546,7 @@ CPUStatePDP11.prototype.advancePC = function(off) */ CPUStatePDP11.prototype.setPC = function(addr) { - this.regsGen[7] = addr & 0xffff; + this.regsGen[PDP11.REG.PC] = addr & 0xffff; }; /** @@ -557,7 +557,7 @@ CPUStatePDP11.prototype.setPC = function(addr) */ CPUStatePDP11.prototype.getSP = function() { - return this.regsGen[6]; + return this.regsGen[PDP11.REG.SP]; }; /** @@ -568,7 +568,7 @@ CPUStatePDP11.prototype.getSP = function() */ CPUStatePDP11.prototype.setSP = function(addr) { - this.regsGen[6] = addr & 0xffff; + this.regsGen[PDP11.REG.SP] = addr & 0xffff; }; /** @@ -746,14 +746,14 @@ CPUStatePDP11.prototype.setPSW = function(newPSW) }; /** - * updateNZFlags(result) + * updateNZVFlags(result) * - * NOTE: The V flag is simply zeroed, and the C flag is unchanged. + * NOTE: Only N and Z are updated based on the result; V is zeroed, C is unchanged. * * @this {CPUStatePDP11} * @param {number} result */ -CPUStatePDP11.prototype.updateNZFlags = function(result) +CPUStatePDP11.prototype.updateNZVFlags = function(result) { if (!(this.opFlags & PDP11.OPFLAG.NO_FLAGS)) { this.flagN = this.flagZ = result; @@ -761,6 +761,22 @@ CPUStatePDP11.prototype.updateNZFlags = function(result) } }; +/** + * updateNZVCFlags(result) + * + * NOTE: Only N and Z are updated based on the result; both V and C are simply zeroed. + * + * @this {CPUStatePDP11} + * @param {number} result + */ +CPUStatePDP11.prototype.updateNZVCFlags = function(result) +{ + if (!(this.opFlags & PDP11.OPFLAG.NO_FLAGS)) { + this.flagN = this.flagZ = result; + this.flagV = this.flagC = 0; + } +}; + /** * updateAllFlags(result, overflow) * diff --git a/versions/pdp11/1.30.0/pdp11.js b/versions/pdp11/1.30.0/pdp11.js index 5e5c6e359..9a2ebcdff 100644 --- a/versions/pdp11/1.30.0/pdp11.js +++ b/versions/pdp11/1.30.0/pdp11.js @@ -5,145 +5,147 @@ function ca(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf( function ja(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} function p(a,b,c,d){var 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 fa(){return"http://"+(window?window.location.host:"www.pcjs.org")} -function q(a){window&&window.alert(a)}function ka(a){var b=!1;window&&(b=window.confirm(a));return b}var la=null;function ma(){if(null==la){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}la=a}return la}function na(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} +function r(a){window&&window.alert(a)}function ka(a){var b=!1;window&&(b=window.confirm(a));return b}var la=null;function ma(){if(null==la){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}la=a}return la}function na(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} function oa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function pa(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var t={init:[],show:[],exit:[]},qa=!1,ra=!1,sa=!0;function ta(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function u(a){t.init.push(a)} -function ua(a){if(sa)try{for(var b=0;bb?this.wb=this.id:(this.Lb=this.id.substr(0,b),this.wb=this.id.substr(b+1));this[a]=c;this.h={ready:!1,Kc:!1,Lc:!1,N:!1,error:!1};this.lb=null;this.h.error=!1;this.u={};this.I=null;x.push(this)}var xa=void 0,ya={}; +function ua(a){if(sa)try{for(var b=0;bb?this.yb=this.id:(this.Pb=this.id.substr(0,b),this.yb=this.id.substr(b+1));this[a]=c;this.h={ready:!1,Kc:!1,Lc:!1,O:!1,error:!1};this.pb=null;this.h.error=!1;this.B={};this.K=null;x.push(this)}var xa=void 0,ya={}; if(window){xa||(xa=window.location.search.substr(1));for(var za,Aa=/\+/g,Ba=/([^&=]+)=?([^&]*)/g;za=Ba.exec(xa);)ya[decodeURIComponent(za[1].replace(Aa," "))]=decodeURIComponent(za[2].replace(Aa," "))}function Ca(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} -function y(a,b){b||(b=w);a.prototype=Ca(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Da=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else Da={},x=[];function Ea(a,b,c){Da[a]&&b&&(Da[a][b]=c)}function z(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.j=this.g-1;this.m=this.v/this.g|0;this.L=this.m-1;this.ma=[];this.C=null;this.$a=this.R;a=new G;Ka(a,this.I);this.b=Array(this.m);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.K("warning: unconverted read access to byte @"+ba(b));return c.$a(b,-1,1)} -function Ma(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.K("warning: unconverted write access to byte @"+ba(c));d.$a(c,b,1)} -function Na(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.K("warning: unconverted read access to word @"+ba(b));return c.$a(b,-1,0)}function Oa(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.K("warning: unconverted write access to word @"+ba(c));d.$a(c,b,0)}F.prototype.reset=function(){this.C&&this.C()};F.prototype.R=function(){return 0}; -F.prototype.va=function(a,b){b||this.reset();return!0};function Pa(a,b,c,d,f){for(var e=b,g=c,h=e>>>a.f;0g&&(r=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.Wa)return k.tb+=k.Wa-e,k.Wa=e,!0;if(e>=k.Wa+k.tb){r=k.size-(e-m);r>g&&(r=g);k.tb=e-k.Wa+r;e=m+a.g;g-=r;h++;continue}}return Ra(1,e,g)}e=new G(e,r,a.g,d,f);Ka(e,a.I,k);a.b[h++]=e;e=m+a.g;g-=r}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Sa[d]+" at "+n(b,8,!0)),!0):Ra(2,b,c)} -function Ta(a,b){return a.b[(b&a.l)>>>a.f].bb(b&a.j,b)}function Ua(a,b,c){var d=b&a.j,f=(b&a.l)>>>a.f;d!=a.j?a.b[f].Hc(d,c&65535,b):(a.b[f++].Va(d,c&255,b),a.b[f&a.L].Va(0,c>>8&255,b+1))}function Va(a){for(var b=0,c=[],d=0;d>1)+2;10>this.f&&(this.f=10);15>2;this.i=this.g-1;this.m=this.s/this.g|0;this.H=this.m-1;this.qa=[];this.v=null;this.$a=this.L;a=new G;Ka(a,this.K);this.b=Array(this.m);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.M("warning: unconverted read access to byte @"+ba(b));return c.$a(b,-1,1)} +function Ma(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.M("warning: unconverted write access to byte @"+ba(c));d.$a(c,b,1)} +function Na(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.M("warning: unconverted read access to word @"+ba(b));return c.$a(b,-1,0)}function Oa(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.M("warning: unconverted write access to word @"+ba(c));d.$a(c,b,0)}F.prototype.reset=function(){this.v&&this.v()};F.prototype.L=function(){return 0}; +F.prototype.za=function(a,b){b||this.reset();return!0};function Pa(a,b,c,d,f){for(var e=b,g=c,h=e>>>a.f;0g&&(q=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.Wa)return k.xb+=k.Wa-e,k.Wa=e,!0;if(e>=k.Wa+k.xb){q=k.size-(e-m);q>g&&(q=g);k.xb=e-k.Wa+q;e=m+a.g;g-=q;h++;continue}}return Ra(1,e,g)}e=new G(e,q,a.g,d,f);Ka(e,a.K,k);a.b[h++]=e;e=m+a.g;g-=q}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Sa[d]+" at "+n(b,8,!0)),!0):Ra(2,b,c)} +function Ta(a,b){return a.b[(b&a.l)>>>a.f].bb(b&a.i,b)}function Ua(a,b,c){var d=b&a.i,f=(b&a.l)>>>a.f;d!=a.i?a.b[f].Hc(d,c&65535,b):(a.b[f++].Va(d,c&255,b),a.b[f&a.H].Va(0,c>>8&255,b+1))}function Va(a){for(var b=0,c=[],d=0;d>5&3;c.Na=a>>1&15;c.mb=a&257?a&1?6:4:0;bb(c);a=c.C;a&1|256&&(b=this.a.Ja&16?1:2);this.g.Qa=this.g.Qa&-8|b};l.pc=function(){return this.b.U};l.Gc=function(a){this.b.U=this.b.U&128|a&-129};l.qc=function(){return this.b.W}; -l.Ic=function(a){if(128==(this.b.W&192)&&a&64){var b=this;I(this.a,8,4,52,function(){b.b.W|=128;return!!(b.b.W&64)})}this.b.W=this.b.W&128|a&-129};l.oc=function(){return cb(this.a)};l.Fc=function(a){db(this.a,a&-1809|cb(this.a)&1808);this.a.i|=128}; -function eb(a){var b=a.j,c,d,f,e=b.V>>13&7;"undefined"===typeof b.S[e]&&(b.S[e]={cache:[],postProcess:a.rc,drive:e,blocksize:256,mapped:0,maxblock:b.Ga[e]*b.F[e],url:"rk"+e+".dsk"});b.A&=-129;switch(b.A>>1&7){case 0:b.eb=2496;b.P=0;b.A=128;b.V=0;break;case 1:if((b.V>>4&511)>=b.Ga[e]){b.P|=32832;b.A|=49152;break}if((b.V&15)>=b.F[e]){b.P|=32800;b.A|=49152;break}c=(b.V>>4&511)*b.F[e]+(b.V&15);d=(b.A&48)<<12|b.cb;f=65536-b.fb&65535;fb(a,b.S[e],c,d,f);return;case 2:if((b.V>>4&511)>=b.Ga[e])b.P|=32832, -b.A|=49152;else if((b.V&15)>=b.F[e])b.P|=32800,b.A|=49152;else{c=(b.V>>4&511)*b.F[e]+(b.V&15);d=(b.A&48)<<12|b.cb;f=65536-b.fb&65535;a.ob(b.S[e],c,d,f);return}}b.eb=e<<13|b.eb&8176|b.V%9&15;I(a.a,20,5,144,function(){b.A=b.A&65534|128;return!!(b.A&64)})}l.rc=function(a,b,c,d,f){var e=this.j;e.cb=d&65535;e.A=e.A&-49|d>>12&48;e.fb=65536-f&65535;switch(a){case 1:e.P|=33024;e.A|=49152;break;case 2:e.P|=33792,e.A|=49152}I(this.a,20,5,144,function(){e.A=e.A&65534|128;return!!(e.A&64)})}; -function gb(a){var b=a.l,c,d,f,e=b.s>>8&3;b.s&=-2;"undefined"===typeof b.S[e]&&(b.S[e]={cache:[],postProcess:a.sc,drive:e,blocksize:128,mapped:1,maxblock:b.Ga[e]*b.F[e],url:"rl"+e+".dsk"});switch(b.s>>1&7){case 2:b.ta&8&&(b.s&=63);b.ta=b.bc[e]|b.za&64;break;case 3:1==(b.H&3)&&(b.za=b.H&4?b.za+(b.H&65408)&65408|b.H<<2&64:b.za-(b.H&65408)&65408|b.H<<2&64,b.H=b.za);break;case 4:b.ta=b.za;break;case 5:if(b.H>>6>=b.Ga[e]){b.s|=37888;break}if((b.H&63)>=b.F[e]){b.s|=37888;break}c=(b.H>>6)*b.F[e]+(b.H&63); -d=(b.na&63)<<16|b.Za;f=65536-b.ta&65535;fb(a,b.S[e],c,d,f);return;case 6:if(b.H>>6>=b.Ga[e])b.s|=37888;else if((b.H&63)>=b.F[e])b.s|=37888;else{c=(b.H>>6)*b.F[e]+(b.H&63);d=(b.na&63)<<16|b.Za;f=65536-b.ta&65535;a.ob(b.S[e],c,d,f);return}}I(a.a,20,5,112,function(){b.s|=129;return!!(b.s&64)})} -l.sc=function(a,b,c,d,f){var e=this.l;e.Za=d&65535;e.s=e.s&-49|d>>12&48;e.na=d>>16&63;e.H=~~(c/e.F[b.ga])<<6|c%e.F[b.ga];e.za=e.H;e.ta=65536-f&65535;switch(a){case 1:e.s|=33792;break;case 2:e.s|=40960}I(this.a,20,5,112,function(){e.s|=129;return!!(e.s&64)})};function hb(a){a=a.m;a.D=2176;a.ba=0;a.T=[4544,4544,4544,4544,4544,4544,4544,4544];a.Sa=[0,0,0,0,0,0,0,0];a.La=a.Ta=a.Ra=a.ya=a.Eb=0} -function ib(a,b){var c=a.m,d,f,e;c.D&=-16513;c.ba&=-2049;c.T[b]&=-1153;I(a.a,-1,0,172);"undefined"===typeof c.S[b]&&(c.S[b]={cache:[],postProcess:a.tc,drive:b,blocksize:256,mapped:0,maxblock:c.ub[0]*c.Fa[0]*c.F[0],url:"rp"+b+".dsk"});switch(c.D&63){case 5:c.sb[b]=c.ha[b];c.D|=32896;c.T[b]|=32896;c.La|=1<=c.ub[0]||c.ca[b]>>8>=c.Fa[0]||(c.ca[b]&255)>=c.F[0]){c.Sa[b]|=1024;c.D|=49152;break}d=(c.ha[b]*c.Fa[0]+(c.ca[b]>>8))*c.F[0]+ -(c.ca[b]&255);f=(c.ya&63)<<16|c.Ra;e=65536-c.Ta&65535;fb(a,c.S[b],d,f,e);return;case 57:if(c.ha[b]>=c.ub[0]||c.ca[b]>>8>=c.Fa[0]||(c.ca[b]&255)>=c.F[0])c.Sa[b]|=1024,c.D|=49152;else{d=(c.ha[b]*c.Fa[0]+(c.ca[b]>>8))*c.F[0]+(c.ca[b]&255);f=(c.ya&63)<<16|c.Ra;e=65536-c.Ta&65535;a.ob(c.S[b],d,f,e);return}}I(a.a,3,5,172,function(){c.D=c.D&65534|128;c.T[b]|=128;return!!(c.D&64)})} -l.tc=function(a,b,c,d,f){var e=this.m;e.Ta=65536-f&65535;e.Ra=d&65535;e.D=e.D&-769|d>>8&768;e.ya=d>>16&63;f=~~(c/e.F[0]);d=~~(f/e.Fa[0]);e.ca[b.ga]=f%e.Fa[0]<<8|c%e.F[0];e.sb[b.ga]=e.ha[b.ga]=d;e.La|=1<=b.kc-1&&(e.T[b.ga]|=1024);switch(a){case 1:e.ba|=512;e.D|=49152;break;case 2:e.ba|=2048,e.D|=49152}I(this.a,20,5,172,function(){e.T[b.ga]|=128;e.D=e.D&65534|128;return!!(e.D&64)})}; -function jb(a,b,c,d,f,e){var g=~~((e+c.oa-1)/c.oa),h=new XMLHttpRequest;2048>g&&d+2048g){b.Bb(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.Bb(0,b,c,d,f)}l.reset=function(){this.g.Qa=this.g.Qa&-120|20;this.b.U=0;this.b.W=128;this.f.sa=0;this.j.A=128;this.l.s=128;hb(this)}; -l.ac=function(a,b,c){var d,f,e=this.a;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=e.xa&65280:(a&1&&(b<<=8),e.xa=b|255,d=0);break;case 4194298:if(0>b)d=e.Db;else{a&1&&(b<<=8);if(d=b&65024){f=d>>9;do d+=34;while(f>>=1)}e.Db=d;e.i|=2}break;case 4194294:if(70!==e.Ha)return K(e,4);0>b?d=e.o:d=e.o=0;break;case 4194292:if(70!==e.Ha)return K(e,4);d=1;break;case 4194290:if(70!==e.Ha)return K(e,4);d=0;break;case 4194288:if(70!==e.Ha)return K(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.Ha)return K(e,4);f=a-4194272>>1;0>b?d=e.Ab[f]:(d=J(this,e.Ab[f],a,b,c),0<=d&&(e.Ab[f]=d));break;case 4194254:return a&1?e.w>>14&1?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.fa[3]=b),d=e.fa[3]):e.w>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.fa[1]=b),d=e.fa[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.w&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.w>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.fa[0]=b),d=e.fa[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.w&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.o|=16,K(e,4)}break;case 4194176:f=a>>1&31;d=J(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.b;switch(a&-2){case 4194174:d=J(this,e.rb,a,b,c);0<=d&&(e.rb=d);break;case 4194172:d=e.wa;d&65280&&(d=(d<<8|d>>8)&65535);break; -case 4194168:0>b?d=this.g.Bc&65535:(d=J(this,this.g.data,a,b,c),0<=d&&(this.g.data=d));break;case 4194166:0<=b&&(b&127&&(g.dc=0),g.W&=-129,I(e,100,4,52,function(){g.W|=128;return!!(g.W&64)}));d=0;break;case 4194162:d=0;0>b&&(g.U&=-129,0b?d=g.U:(d=J(this,g.U,a,b,c),0<=d&&(g.U=g.U&128|d&-129));break;default:return e.o|=16,K(e,4)}break;case 4194048:f=this.j;switch(a&-2){case 4194048:d= -J(this,f.eb,a,b,c);0<=d&&(f.eb=d);break;case 4194050:d=J(this,f.P,a,b,c);0<=d&&(f.P=d);break;case 4194052:d=J(this,f.A,a,b,c);0<=b&&0<=d&&(f.A=d&-36993|f.A&36992,f.A&1&&eb(this));break;case 4194054:d=J(this,f.fb,a,b,c);0<=d&&(f.fb=d);break;case 4194056:d=J(this,f.cb,a,b,c);0<=d&&(f.cb=d);break;case 4194058:d=J(this,f.V,a,b,c);0<=d&&(f.V=d);break;case 4194060:break;case 4194062:d=J(this,f.Ub,a,b,c);0<=d&&(f.Ub=d);break;default:return e.o|=16,K(e,4)}break;case 4193728:var h=this.m;f=h.ba&7;switch(a& --2){case 4193728:d=J(this,h.D,a,b,c);0<=b&&0<=d&&(h.ya=h.ya&60|d>>8&3,h.D=d&17279|h.D&34944|2048,d&1&&h.D&128?ib(this,f):192==(d&192)&&I(e,0,5,172));break;case 4193730:d=J(this,h.Ta,a,b,c);0<=d&&(h.Ta=d);break;case 4193732:d=J(this,h.Ra,a,b,c);0<=d&&(h.Ra=d&65534);break;case 4193734:d=J(this,h.ca[f],a,b,c);0<=d&&(h.ca[f]=d&7967);break;case 4193736:d=J(this,h.ba,a,b,c);0<=d&&(h.ba=d&63|h.ba&65472,d&128&&hb(this));break;case 4193738:d=h.T[f];break;case 4193740:d=h.Sa[f];break;case 4193742:d=J(this, -h.La,a,b,c);0<=d&&(h.La=d&255);break;case 4193744:d=h.yc[f];break;case 4193746:d=J(this,h.Vb,a,b,c);0<=d&&(h.Vb=d);break;case 4193748:d=J(this,h.Wb[f],a,b,c);0<=d&&(h.Wb[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=h.zc[f];break;case 4193754:d=J(this,h.Xb[f],a,b,c);0<=d&&(h.Xb[f]=d);break;case 4193756:d=J(this,h.ha[f],a,b,c);0<=d&&(h.ha[f]=d&511);break;case 4193758:h.sb[f]=h.ha[f];d=h.sb[f];break;case 4193760:d=h.wc[f];break;case 4193762:d=h.xc[f];break;case 4193764:d=h.uc[f];break;case 4193766:d= -h.vc[f];break;case 4193768:d=J(this,h.ya,a,b,c);0<=d&&(h.ya=d&63,h.D=h.D&-769|(d&3)<<8);break;case 4193770:d=J(this,h.Eb,a,b,c);0<=d&&(h.Eb=d);break;default:return e.o|=16,K(e,4)}break;case 4192512:f=this.l;switch(a&-2){case 4192512:d=J(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||gb(this));break;case 4192514:d=J(this,f.Za,a,b,c);0<=d&&(f.Za=d&65534);break;case 4192516:d=J(this,f.H,a,b,c);0<=d&&(f.H=d);break;case 4192518:d=J(this,f.ta,a,b,c);0<=d&&(f.ta=d);break; -case 4192520:d=J(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.o|=16,K(e,4)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.Ja:(d=J(this,e.Ja,a,b,c),0<=d&&(70!==e.Ha&&(d&=-49),e.Ja=d,e.nb[0]=d&4?15:7,e.nb[1]=d&2?15:7,e.nb[3]=d&1?15:7,e.mb&&(f=2,e.Ja&16&&(f=1),this.g.Qa=this.g.Qa&-8|f)));break;default:return e.o|=16,K(e,4)}break;case 4191424:f=a>>1&31;d=J(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=J(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.Ha)return K(e,4);f=a>>2&31;d=e.gb[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=J(this,d,a,b,c),0<=d&&(e.gb[f]=a&2?d<<16|e.gb[f]&65535:e.gb[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=Za[a>>1&255];else return e.o|=16,K(e,4);break;default:return e.o|=16,K(e,4)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)"); +0,3024,3103,65514,34562,0,264,8197,33779,5003,2574,32337,260,0,258,5579,12,6080,448,6081,450,6084,452,116,2,6084,65400,17860,65024,21956,62976,38848,65401,3200,161,76,0,16944,10797];l=H.prototype;l.Ma=function(a,b,c,d){this.C=b;this.a=c;this.K=d;var f=this;this.f.Ib=$a(this.a,function(){f.f.wa|=128;f.f.wa&64&&(I(f.a,0,6,64),ab(f.a,f.f.Ib))});Wa(b,this);Ya(b,this.reset.bind(this),this.ac.bind(this));E(this)};l.mc=function(){var a=this.f.wa;this.f.wa&=-129;return a}; +l.Dc=function(a){this.f.wa=a;a&64&&ab(this.a,this.f.Ib);this.f.wa=a&-129};l.nc=function(){var a=this.a;return a.G&62337|a.hb<<5|a.ib<<1};l.Ec=function(a){var b=4,c=this.a;c.G=a&=62337;c.hb=a>>5&3;c.ib=a>>1&15;c.qb=a&257?a&1?6:4:0;bb(c);a=c.G;a&1|256&&(b=this.a.Na&16?1:2);this.g.Qa=this.g.Qa&-8|b};l.pc=function(){return this.b.W};l.Gc=function(a){this.b.W=this.b.W&128|a&-129};l.qc=function(){return this.b.Y}; +l.Ic=function(a){if(128==(this.b.Y&192)&&a&64){var b=this;I(this.a,8,4,52,function(){b.b.Y|=128;return!!(b.b.Y&64)})}this.b.Y=this.b.Y&128|a&-129};l.oc=function(){return cb(this.a)};l.Fc=function(a){db(this.a,a&-1809|cb(this.a)&1808);this.a.j|=128}; +function eb(a){var b=a.i,c,d,f,e=b.X>>13&7;"undefined"===typeof b.U[e]&&(b.U[e]={cache:[],postProcess:a.rc,drive:e,blocksize:256,mapped:0,maxblock:b.Ka[e]*b.I[e],url:"rk"+e+".dsk"});b.A&=-129;switch(b.A>>1&7){case 0:b.eb=2496;b.R=0;b.A=128;b.X=0;break;case 1:if((b.X>>4&511)>=b.Ka[e]){b.R|=32832;b.A|=49152;break}if((b.X&15)>=b.I[e]){b.R|=32800;b.A|=49152;break}c=(b.X>>4&511)*b.I[e]+(b.X&15);d=(b.A&48)<<12|b.cb;f=65536-b.fb&65535;fb(a,b.U[e],c,d,f);return;case 2:if((b.X>>4&511)>=b.Ka[e])b.R|=32832, +b.A|=49152;else if((b.X&15)>=b.I[e])b.R|=32800,b.A|=49152;else{c=(b.X>>4&511)*b.I[e]+(b.X&15);d=(b.A&48)<<12|b.cb;f=65536-b.fb&65535;a.sb(b.U[e],c,d,f);return}}b.eb=e<<13|b.eb&8176|b.X%9&15;I(a.a,20,5,144,function(){b.A=b.A&65534|128;return!!(b.A&64)})}l.rc=function(a,b,c,d,f){var e=this.i;e.cb=d&65535;e.A=e.A&-49|d>>12&48;e.fb=65536-f&65535;switch(a){case 1:e.R|=33024;e.A|=49152;break;case 2:e.R|=33792,e.A|=49152}I(this.a,20,5,144,function(){e.A=e.A&65534|128;return!!(e.A&64)})}; +function gb(a){var b=a.l,c,d,f,e=b.u>>8&3;b.u&=-2;"undefined"===typeof b.U[e]&&(b.U[e]={cache:[],postProcess:a.sc,drive:e,blocksize:128,mapped:1,maxblock:b.Ka[e]*b.I[e],url:"rl"+e+".dsk"});switch(b.u>>1&7){case 2:b.xa&8&&(b.u&=63);b.xa=b.bc[e]|b.Da&64;break;case 3:1==(b.J&3)&&(b.Da=b.J&4?b.Da+(b.J&65408)&65408|b.J<<2&64:b.Da-(b.J&65408)&65408|b.J<<2&64,b.J=b.Da);break;case 4:b.xa=b.Da;break;case 5:if(b.J>>6>=b.Ka[e]){b.u|=37888;break}if((b.J&63)>=b.I[e]){b.u|=37888;break}c=(b.J>>6)*b.I[e]+(b.J&63); +d=(b.ra&63)<<16|b.Za;f=65536-b.xa&65535;fb(a,b.U[e],c,d,f);return;case 6:if(b.J>>6>=b.Ka[e])b.u|=37888;else if((b.J&63)>=b.I[e])b.u|=37888;else{c=(b.J>>6)*b.I[e]+(b.J&63);d=(b.ra&63)<<16|b.Za;f=65536-b.xa&65535;a.sb(b.U[e],c,d,f);return}}I(a.a,20,5,112,function(){b.u|=129;return!!(b.u&64)})} +l.sc=function(a,b,c,d,f){var e=this.l;e.Za=d&65535;e.u=e.u&-49|d>>12&48;e.ra=d>>16&63;e.J=~~(c/e.I[b.ka])<<6|c%e.I[b.ka];e.Da=e.J;e.xa=65536-f&65535;switch(a){case 1:e.u|=33792;break;case 2:e.u|=40960}I(this.a,20,5,112,function(){e.u|=129;return!!(e.u&64)})};function hb(a){a=a.m;a.D=2176;a.ba=0;a.V=[4544,4544,4544,4544,4544,4544,4544,4544];a.Sa=[0,0,0,0,0,0,0,0];a.Pa=a.Ta=a.Ra=a.Ca=a.Hb=0} +function ib(a,b){var c=a.m,d,f,e;c.D&=-16513;c.ba&=-2049;c.V[b]&=-1153;I(a.a,-1,0,172);"undefined"===typeof c.U[b]&&(c.U[b]={cache:[],postProcess:a.tc,drive:b,blocksize:256,mapped:0,maxblock:c.zb[0]*c.Ja[0]*c.I[0],url:"rp"+b+".dsk"});switch(c.D&63){case 5:c.wb[b]=c.la[b];c.D|=32896;c.V[b]|=32896;c.Pa|=1<=c.zb[0]||c.ca[b]>>8>=c.Ja[0]||(c.ca[b]&255)>=c.I[0]){c.Sa[b]|=1024;c.D|=49152;break}d=(c.la[b]*c.Ja[0]+(c.ca[b]>>8))*c.I[0]+ +(c.ca[b]&255);f=(c.Ca&63)<<16|c.Ra;e=65536-c.Ta&65535;fb(a,c.U[b],d,f,e);return;case 57:if(c.la[b]>=c.zb[0]||c.ca[b]>>8>=c.Ja[0]||(c.ca[b]&255)>=c.I[0])c.Sa[b]|=1024,c.D|=49152;else{d=(c.la[b]*c.Ja[0]+(c.ca[b]>>8))*c.I[0]+(c.ca[b]&255);f=(c.Ca&63)<<16|c.Ra;e=65536-c.Ta&65535;a.sb(c.U[b],d,f,e);return}}I(a.a,3,5,172,function(){c.D=c.D&65534|128;c.V[b]|=128;return!!(c.D&64)})} +l.tc=function(a,b,c,d,f){var e=this.m;e.Ta=65536-f&65535;e.Ra=d&65535;e.D=e.D&-769|d>>8&768;e.Ca=d>>16&63;f=~~(c/e.I[0]);d=~~(f/e.Ja[0]);e.ca[b.ka]=f%e.Ja[0]<<8|c%e.I[0];e.wb[b.ka]=e.la[b.ka]=d;e.Pa|=1<=b.kc-1&&(e.V[b.ka]|=1024);switch(a){case 1:e.ba|=512;e.D|=49152;break;case 2:e.ba|=2048,e.D|=49152}I(this.a,20,5,172,function(){e.V[b.ka]|=128;e.D=e.D&65534|128;return!!(e.D&64)})}; +function jb(a,b,c,d,f,e){var g=~~((e+c.sa-1)/c.sa),h=new XMLHttpRequest;2048>g&&d+2048g){b.Eb(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.Eb(0,b,c,d,f)}l.reset=function(){this.g.Qa=this.g.Qa&-120|20;this.b.W=0;this.b.Y=128;this.f.wa=0;this.i.A=128;this.l.u=128;hb(this)}; +l.ac=function(a,b,c){var d,f,e=this.a;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=e.Ba&65280:(a&1&&(b<<=8),e.Ba=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.j|=2}break;case 4194294:if(70!==e.La)return K(e,4);0>b?d=e.o:d=e.o=0;break;case 4194292:if(70!==e.La)return K(e,4);d=1;break;case 4194290:if(70!==e.La)return K(e,4);d=0;break;case 4194288:if(70!==e.La)return K(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.La)return K(e,4);f=a-4194272>>1;0>b?d=e.Db[f]:(d=J(this,e.Db[f],a,b,c),0<=d&&(e.Db[f]=d));break;case 4194254:return a&1?e.w>>14&1?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.fa[3]=b),d=e.fa[3]):e.w>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.fa[1]=b),d=e.fa[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.w&2048?(0<=b&&(e.c[f]=b),d=e.c[f]):(0<=b&&(e.Oa[f]=b),d=e.Oa[f]),d;case 4194246:return a& +1?(0<=b&&(e.c[7]=b),d=e.c[7]):e.w>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.fa[0]=b),d=e.fa[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.w&2048?(0<=b&&(e.Oa[f]=b),d=e.Oa[f]):(0<=b&&(e.c[f]=b),d=e.c[f]),d;default:return e.o|=16,K(e,4)}break;case 4194176:f=a>>1&31;d=J(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.b;switch(a&-2){case 4194174:d=J(this,e.vb,a,b,c);0<=d&&(e.vb=d);break;case 4194172:d=e.Aa;d&65280&&(d=(d<<8|d>>8)&65535);break; +case 4194168:0>b?d=this.g.Bc&65535:(d=J(this,this.g.data,a,b,c),0<=d&&(this.g.data=d));break;case 4194166:0<=b&&(b&127&&(g.dc=0),g.Y&=-129,I(e,100,4,52,function(){g.Y|=128;return!!(g.Y&64)}));d=0;break;case 4194162:d=0;0>b&&(g.W&=-129,0b?d=g.W:(d=J(this,g.W,a,b,c),0<=d&&(g.W=g.W&128|d&-129));break;default:return e.o|=16,K(e,4)}break;case 4194048:f=this.i;switch(a&-2){case 4194048:d= +J(this,f.eb,a,b,c);0<=d&&(f.eb=d);break;case 4194050:d=J(this,f.R,a,b,c);0<=d&&(f.R=d);break;case 4194052:d=J(this,f.A,a,b,c);0<=b&&0<=d&&(f.A=d&-36993|f.A&36992,f.A&1&&eb(this));break;case 4194054:d=J(this,f.fb,a,b,c);0<=d&&(f.fb=d);break;case 4194056:d=J(this,f.cb,a,b,c);0<=d&&(f.cb=d);break;case 4194058:d=J(this,f.X,a,b,c);0<=d&&(f.X=d);break;case 4194060:break;case 4194062:d=J(this,f.Ub,a,b,c);0<=d&&(f.Ub=d);break;default:return e.o|=16,K(e,4)}break;case 4193728:var h=this.m;f=h.ba&7;switch(a& +-2){case 4193728:d=J(this,h.D,a,b,c);0<=b&&0<=d&&(h.Ca=h.Ca&60|d>>8&3,h.D=d&17279|h.D&34944|2048,d&1&&h.D&128?ib(this,f):192==(d&192)&&I(e,0,5,172));break;case 4193730:d=J(this,h.Ta,a,b,c);0<=d&&(h.Ta=d);break;case 4193732:d=J(this,h.Ra,a,b,c);0<=d&&(h.Ra=d&65534);break;case 4193734:d=J(this,h.ca[f],a,b,c);0<=d&&(h.ca[f]=d&7967);break;case 4193736:d=J(this,h.ba,a,b,c);0<=d&&(h.ba=d&63|h.ba&65472,d&128&&hb(this));break;case 4193738:d=h.V[f];break;case 4193740:d=h.Sa[f];break;case 4193742:d=J(this, +h.Pa,a,b,c);0<=d&&(h.Pa=d&255);break;case 4193744:d=h.yc[f];break;case 4193746:d=J(this,h.Vb,a,b,c);0<=d&&(h.Vb=d);break;case 4193748:d=J(this,h.Wb[f],a,b,c);0<=d&&(h.Wb[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=h.zc[f];break;case 4193754:d=J(this,h.Xb[f],a,b,c);0<=d&&(h.Xb[f]=d);break;case 4193756:d=J(this,h.la[f],a,b,c);0<=d&&(h.la[f]=d&511);break;case 4193758:h.wb[f]=h.la[f];d=h.wb[f];break;case 4193760:d=h.wc[f];break;case 4193762:d=h.xc[f];break;case 4193764:d=h.uc[f];break;case 4193766:d= +h.vc[f];break;case 4193768:d=J(this,h.Ca,a,b,c);0<=d&&(h.Ca=d&63,h.D=h.D&-769|(d&3)<<8);break;case 4193770:d=J(this,h.Hb,a,b,c);0<=d&&(h.Hb=d);break;default:return e.o|=16,K(e,4)}break;case 4192512:f=this.l;switch(a&-2){case 4192512:d=J(this,f.u,a,b,c);0<=b&&0<=d&&(f.ra=f.ra&60|d>>4&3,f.u=f.u&-1023|d&1022,f.u&128||gb(this));break;case 4192514:d=J(this,f.Za,a,b,c);0<=d&&(f.Za=d&65534);break;case 4192516:d=J(this,f.J,a,b,c);0<=d&&(f.J=d);break;case 4192518:d=J(this,f.xa,a,b,c);0<=d&&(f.xa=d);break; +case 4192520:d=J(this,f.ra,a,b,c);0<=d&&(f.ra=d&63,f.u=f.u&-49|(f.ra&3)<<4);break;default:return e.o|=16,K(e,4)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.Na:(d=J(this,e.Na,a,b,c),0<=d&&(70!==e.La&&(d&=-49),e.Na=d,e.rb[0]=d&4?15:7,e.rb[1]=d&2?15:7,e.rb[3]=d&1?15:7,e.qb&&(f=2,e.Na&16&&(f=1),this.g.Qa=this.g.Qa&-8|f)));break;default:return e.o|=16,K(e,4)}break;case 4191424:f=a>>1&31;d=J(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=J(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.La)return K(e,4);f=a>>2&31;d=e.gb[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=J(this,d,a,b,c),0<=d&&(e.gb[f]=a&2?d<<16|e.gb[f]&65535:e.gb[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=Za[a>>1&255];else return e.o|=16,K(e,4);break;default:return e.o|=16,K(e,4)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)"); return d};var L={},Xa=(L[65382]=[null,null,H.prototype.mc,H.prototype.Dc,"LKS"],L[65392]=[null,null,H.prototype.pc,H.prototype.Gc,"RCSR"],L[65396]=[null,null,H.prototype.qc,H.prototype.Ic,"XCSR"],L[65402]=[null,null,H.prototype.nc,H.prototype.Ec,"MMR0"],L[65534]=[null,null,H.prototype.oc,H.prototype.Fc,"PSW"],L);u(function(){for(var a=C(document,"pdp11","device"),b=0;b>1),this.a=new Int32Array(this.f,0,c>>2),rb(this,nb?sb:tb);else{this.a=Array(c>>2);for(a=0;a>1),this.a=new Int32Array(this.f,0,c>>2),rb(this,nb?sb:tb);else{this.a=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},$:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},la: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},Da: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},R:function(a,b){return this.X(a,b)},ia:function(a,b){return this.ja(a, -b)},Ba:function(a,b,c){this.g||this.$b(a,b,c)},Ma:function(a,b,c){this.g||this.Na(a,b,c)},L:function(a){return this.b[a]},Y:function(a){return this.b[a]},aa:function(a){return this.u.getUint16(a,!0)},ka:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.m[a>>1]},Aa:function(a,b){this.b[a]=b;this.qa=!0},Ca:function(a,b){this.b[a]=b;this.qa=!0},Ea:function(a,b){this.u.setUint16(a,b,!0);this.qa=!0},Oa:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.m[a>>1]=b;this.qa=!0}}; -function Ka(a,b,c){a.I=b;a.j=a.l=0;c&&((a.j=c.j)&&vb(a,wb,!1),(a.l=c.l)&&xb(a,wb,!1))}function xb(a,b,c){c&&a.l||(a.Va=!a.g&&b[1]||a.G,a.Hc=!a.g&&b[3]||a.J);if(c||void 0===c)a.$b=b[1]||a.G,a.Na=b[3]||a.J}function vb(a,b,c){c&&a.j||(a.bb=b[0]||a.v,a.pb=b[2]||a.C);if(c||void 0===c)a.X=b[0]||a.v,a.ja=b[2]||a.C}function rb(a,b){b||(b=yb);vb(a,b,void 0);xb(a,b,void 0)}var yb=[],ub=[G.prototype.$,G.prototype.Da,G.prototype.la,G.prototype.Pa],wb=[G.prototype.R,G.prototype.Ba,G.prototype.ia,G.prototype.Ma]; -if(Ha)var tb=[G.prototype.L,G.prototype.Aa,G.prototype.aa,G.prototype.Ea],sb=[G.prototype.Y,G.prototype.Ca,G.prototype.ka,G.prototype.Oa];function zb(a,b){w.call(this,"CPU",a,zb);var c=a.multiplier||1;this.ib=a.cycles||b;this.$=c;this.xb=Math.round(this.ib/1E4)/100;this.ja=this.xb*this.$;this.h.Z=!1;this.h.Yb=!1;this.h.Ya=a.autoStart;this.h.Mb=!1;this.h.kb=!1;this.Pa=this.ka=0;this.hb=a.csStart;this.Ba=a.csInterval;this.Ca=a.csStop;this.G=[];this.Qb=this.Ac.bind(this);E(this)}y(zb); -var Ab=["power","reset"];l=zb.prototype;l.Ia=function(a,b,c,d){this.v=a;this.B=b;this.I=d;for(b=0;ba.X/a.ja&&(b=1),a.$=b,b=a.xb*a.$,a.ja!=b)){a.ja=b;b=a.ja.toFixed(2)+"Mhz";var c=a.u.setSpeed;c&&(c.textContent=b);a.K("target speed: "+b)}Ib(a,a.R);a.R=0;a.L=ia();a.Y=0;Jb(a)}function $a(a,b){var c=a.G.length;a.G.push([-1,b]);return c}function ab(a,b){var c;0<=b&&ba.G[b][0]&&(c=a.ib*a.$/1E3*(1E3/60),a.G[b][0]=c)} -l.Ac=function(){if(this.h.Z){this.yb>=this.ib&&Jb(this,!0);this.Ea=0;this.Oa=ia();if(this.Y){var a=this.Oa-this.Y;a>this.Ob&&(this.L+=a,this.L>this.Oa&&(this.L=this.Oa))}try{do{for(var b,c=this.h.kb?1:this.jb,d=this.G.length-1;0<=d;d--){var f=this.G[d];0>f[0]||c>f[0]&&(c=f[0])}b=c;try{this.Zb(b)}catch(m){if("number"!=typeof m)throw m;}for(var e=this.J-this.a,a=e,g=this.G.length-1;0<=g;g--){var h=this.G[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.Ea+=e;this.R+=e;Ib(this,0,!0);a=e;if(this.h.kb){var k= -!1;this.Pa=this.Pa+this.Rb()|0;this.ka-=a;0>=this.ka&&(this.ka+=this.Ba,k=!0);0<=this.Ca&&this.Ca<=Kb(this)&&(this.Ba=this.Ca=-1,Db(this),Gb(this),k=!0);k&&this.K(Kb(this)+" cycles: checksum="+n(this.Pa))}this.Da-=e;if(0>=this.Da){this.Da+=this.jb;15<=++this.Pb&&(this.v&&this.v.Ua(),this.Pb=0);break}}while(this.h.Z)}catch(m){Gb(this);Eb(this);this.v&&this.v.stop(ia(),Kb(this));b=m.stack||m.message;this.h.error=!0;this.M(b);return}if(this.h.Z){b=setTimeout;c=this.Qb;this.Y=ia();d=this.Ob;this.Ea&& -(d=Math.round(d*this.Ea/this.jb));d-=this.Y-this.Oa;if(f=this.Y-this.L)this.X=Math.round(this.R/(10*f))/100,864E5<=f&&(this.aa=0,Hb(this));if(0>d||this.Xd&&(this.L-=d),d=0;this.yb+=this.Ea;this.Y+=d;b(c,d)}}};function Fb(a){var b;a.h.error?(a.K(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.h.Z)a.K(a.toString()+" busy");else{Hb(a);a.h.Z=!0;a.h.Yb=!0;a.Aa&&a.Aa.start();if(b=a.u.run)b.textContent="Halt";a.v&&a.v.start(a.L,Kb(a));Eb(a,!0);setTimeout(a.Qb,0)}}l.Zb=function(){return 0}; -function Gb(a){if(a.h.Z){a.J-=a.a;a.a=0;Ib(a,a.R);a.R=0;a.h.Z=!1;a.Aa&&a.Aa.stop();var b=a.u.run;b&&(b.textContent="Run");a.v&&a.v.stop(ia(),Kb(a));Eb(a)}a.h.complete=void 0}function Eb(a,b){a.v&&a.v.Ua(b)} -function Lb(a){this.ic=a.resetAddr||0;zb.call(this,a,6666667);this.Hb=0;this.decode=Mb.bind(this);this.g=65536;this.b=32768;this.f=65535;this.j=32768;this.w=15;this.c=[0,0,0,0,0,0,0,this.ic];this.Ka=[0,0,0,0,0,0];this.fa=[0,0,0,0];this.Na=this.m=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.gb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.Ab=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.Tb=this.vb=this.Sb=this.Jb=this.i=0;this.Ha=70;this.la=-1;Nb(this);this.h.complete=this.h.cc=!1}y(Lb,zb);l=Lb.prototype;l.reset=function(){this.h.Z&&Gb(this);Nb(this);Cb(this);this.h.error=!1;this.parent.reset.call(this)}; -function Nb(a){a.xa=255;a.o=0;a.Db=0;a.C=0;a.wa=0;a.rb=0;a.Ja=0;a.mb=0;a.Ma=0;a.nb=[7,7,7,7];a.l=[];a.i|=2;bb(a)}function bb(a){a.mb?(a.Gb=65536,a.ia=a.gc,a.pb=a.ea):(a.Gb=0,a.ia=a.fc,a.pb=a.qb)}l.Rb=function(){return 0};l.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.aa,this.$]);a.set(2,Va(this.B));return a.data()}; -l.restore=function(a){var b=a[1];this.aa=b[1];Hb(this,b[3]);a:{b=this.B;a=a[2];var c;for(c=0;cb){a.l[e].pa-=b;break}b-=a.l[e].pa}a.l.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.i|=2}function cb(a){return a.w=a.w&63728|a.ra()|(a.f&65535?0:4)|(a.b&32768?2:0)|O(a)} -function db(a,b){a.j=b<<12;a.f=~b&4;a.b=b<<14;a.g=b<<16;if((b^a.w)&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.m=b>>14&3;c=a.w>>14&3;a.m!=c&&(a.fa[c]=a.c[6],a.c[6]=a.fa[a.m]);a.i|=2;a.w=b}function P(a,b){a.i&128||(a.j=a.f=b,a.b=0)}function Q(a,b,c){a.i&128||(a.j=a.f=a.g=b,a.b=c||0)}function Pb(a,b,c,d){a.i&128||(a.j=a.f=a.g=b,a.b=(c^b)&(d^b))}function R(a,b){a.i&128||(a.j=a.f=a.g=b,a.b=a.j^a.g>>1)}function Qb(a,b,c,d){a.i&128||(a.j=a.f=a.g=b,a.b=(c^d)&(d^b))} -function K(a,b){var c=!1;0>a.la?a.la=cb(a):a.m||(b=4,c=!0);a.C&57344||(a.wa=63222,a.rb=b);a.m=0;var d=a.ea(b|65536),f=a.ea(b+2&65535|65536);db(a,f&-12289|a.la>>2&12288);c&&(a.o|=4,a.c[6]=4);Rb(a,a.la);Rb(a,a.c[7]);a.c[7]=d&65535;a.i&=-113;a.la=-1;throw b;}function Sb(a){var b=Tb(a),c=Tb(a)&-1793;a.w&49152&&(c=c&-225|a.w&63712);a.c[7]=b&65535;db(a,c);a.i&=-17} -function kb(a,b){var c=b>>13&31;31>c?a.Ja&32&&(b=a.gb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b} -function Ub(a,b,c){var d,f,e,g=0;if(c&a.mb){d=b>>13&a.nb[a.m];f=a.O[a.m][d];e=(a.O[a.m][d+16]<<6)+(b&8191)&4194303;a.Ja&16?3932160<=e&&4186112>e&&(e=kb(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.o|=32,K(a,4)),e&1&&!(c&1)&&(a.o|=64,K(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.m][d]=f;if(4194170!==e||a.m)a.Ma=a.m,a.Na=d;g&&(g&57344&&(0<=a.la&&(g|=128),a.C&57344||(a.C=a.C|g|a.Ma<<5|a.Na<<1),K(a,168)),a.C&61440||!(4191360>e||4194239>>b.f;a=c!=b.j?b.b[d].pb(c,a):b.b[d++].bb(c,a)|b.b[d&b.L].bb(0,a+1)<<8}return a};l.ea=function(a){return this.qb(Ub(this,a,2))}; -function Tb(a){var b=a.ea(a.c[6]|65536);a.c[6]=a.c[6]+2&65535;return b}function Rb(a,b){var c=a.c[6]-2&65535;a.c[6]=c;a.C&57344||(a.wa=a.wa<<8|246);!a.m&&c<=a.xa&&4>3&7;c&4?(a.Jb=b,a.vb=g):(a.Sb=b,a.Tb=g);switch(b){case 0:return K(a,4),0;case 1:return 6===g&&!a.m&&c&4&&(a.c[6]<=a.xa||65534<=a.c[6])&&(a.c[6]<=a.xa-32||65534<=a.c[6]?(a.o|=4,a.c[6]=4,K(a,4)):(a.o|=8,a.i|=64)),a.a-=3,7===g?a.c[g]:a.c[g]|e;case 2:f=2;d=a.c[g];7!==g&&(d|=e,6>g&&c&1&&(f=1));a.a-=3;break;case 3:f=2;d=a.c[g];7!==g&&(d|=e);d=a.ea(d);d|=e;a.a-=7;break;case 4:f=-2;6>g&&c&1&&(f=-1);d=a.c[g]+f&65535;7!==g&&(d|=e);a.a-=4;break;case 5:f=-2; -d=a.c[g]-2&65535;7!==g&&(d|=e);d=a.ea(d)|e;a.a-=8;break;case 6:return d=Ob(a),d=d+a.c[g]&65535|e,a.a-=6,d;case 7:return d=Ob(a),d=d+a.c[g]&65535,d=a.ea(d|65536)|e,a.a-=10,d}a.c[g]=a.c[g]+f&65535;!e||a.C&57344||(a.wa=a.wa<<8|f<<3&248|g);6==g&&!a.m&&c&4&&0>=f&&(a.c[6]<=a.xa||65534<=a.c[6])&&(a.c[6]<=a.xa-32?(a.o|=4,a.c[6]=4,K(a,4)):(a.o|=8,a.i|=64));return d}l.fc=function(a,b){return Vb(this,a,b)};l.gc=function(a,b){return Ub(this,Vb(this,a,b),b)}; -function Wb(a,b,c){b&56?(b=Vb(a,b,2),c&65536||61440!==(a.w&61440)&&(b&=65535),a.m=a.w>>12&3,c=a.ea(b|c&65536),a.m=a.w>>14&3):(c=b&7,c=6!=c||(a.w>>2&12288)===(a.w&12288)?a.c[c]:a.fa[a.w>>12&3]);return c}function Xb(a,b,c,d){a.C&57344||(a.wa=22);b&56?(b=Vb(a,b,4),c&65536||(b&=65535),a.m=a.w>>12&3,b=Ub(a,b|c&65536,4),a.m=a.w>>14&3,Ua(a.B,b,d&65535)):(c=b&7,6!=c||(a.w>>2&12288)===(a.w&12288)?a.c[c]=d:a.fa[a.w>>12&3]=d)}function S(a,b){return b&56?a.pb(Vb(a,b,2)):a.c[b&7]} -function T(a,b){b&56?(b=a.ia(b,3),a=Ta(a.B,b)):a=a.c[b&7]&255;return a}function U(a,b,c,d){b&56?(b=a.ia(b,6),c=d.call(a,c,a.qb(b)),Ua(a.B,b,c&65535)):(b&=7,a.c[b]=d.call(a,c,a.c[b]))}function V(a,b,c,d){b&56?(b=a.ia(b,7),c=d.call(a,c,Ta(a.B,b)),b&1&&a.a--,a=a.B,a.b[(b&a.l)>>>a.f].Va(b&a.j,c&255,b)):(b&=7,a.c[b]=a.c[b]&65280|d.call(a,c,a.c[b]))}function Yb(a,b,c){b&56?(b=a.ia(b,4),Ua(a.B,b,c&65535)):a.c[b&7]=c&65535;return c} -function Zb(a,b,c,d){b&56?(d=a.ia(b,5),d&1&&a.a--,a=a.B,a.b[(d&a.l)>>>a.f].Va(d&a.j,c&255,d)):(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 W(a,b){a.c[7]=a.c[7]+(b<<24>>23)&65535} -l.Zb=function(a){this.h.complete=!0;this.h.cc=!1;this.h.Yb=!1;this.J=this.a=a;do{if(this.i&&(this.i&112&&(this.i&32?K(this,168):this.i&64?K(this,4):this.i&16&&K(this,12),this.i&=-113),this.i&7))if(this.i&2){this.i&=-3;a=null;for(var b=this.Db&224,c=this.l.length;0<=--c;){if(0b&&(b=this.l[c].lc,a=this.l[c],this.l.splice(c,1))}b>(this.w&224)&&(this.i&4&&(this.c[7]= -this.c[7]+2&65535,this.i&=-5),a?K(this,a.Cc):K(this,160))}else this.i&1&&this.i++;this.C&57344||(this.wa=0,this.rb=this.c[7]);this.i=this.i&7|this.w&16;this.decode(Ob(this))}while(0>1|b<<16;R(this,a);return a&65535}function ec(a,b){a=b&2048|b>>1|b<<8;R(this,a<<8);return a&255}function fc(a,b){a=b&~a;P(this,a);return a}function gc(a,b){a=b&~a;P(this,a<<8);return a}function hc(a,b){a|=b;P(this,a);return a}function ic(a,b){a|=b;P(this,a<<8);return a}function jc(a,b){a=~b|65536;Q(this,a);return a&65535} -function kc(a,b){a=~b|256;Q(this,a<<8);return a&255}function lc(a,b){a=b-a;this.i&128||(this.j=this.f=a,this.b=b&(b^a));return a&65535}function mc(a,b){a=b-a;var c=a<<8;b<<=8;this.i&128||(this.j=this.f=c,this.b=b&(b^c));return a&255}function nc(a,b){a=b+a;this.i&128||(this.j=this.f=a,this.b=a&(b^a));return a&65535}function oc(a,b){a=b+a;var c=a<<8;this.i&128||(this.j=this.f=c,this.b=c&(b<<8^c));return a&255}function pc(a,b){a=-b;Q(this,a,a&b&32768);return a&65535} -function qc(a,b){a=-b;Q(this,a<<8,(a&b&128)<<8);return a&255}function rc(a,b){a=b<<1|this.g>>16&1;R(this,a);return a&65535}function sc(a,b){a=b<<1|this.g>>16&1;R(this,a<<8);return a&255}function tc(a,b){a=(this.g&65536|b)>>1|b<<16;R(this,a);return a&65535}function uc(a,b){a=((this.g&65536)>>8|b)>>1|b<<8;R(this,a<<8);return a&255}function vc(a,b){var c=b-a;Qb(this,c,a,b);return c&65535}function wc(a,b){var c=b-a;Qb(this,c<<8,a<<8,b<<8);return c&255}function xc(a,b){a^=b;P(this,a);return a&65535} -function yc(a){var b=S(this,a);a=a>>6&7;var c=this.c[a];c&32768&&(c|=4294901760);this.g=this.b=0;b&=63;b&32?(b=64-b,16>=b):b&&(16>15&65535)&&65535!==b&&(this.b=32768)));this.c[a]=c&65535;this.j=this.f=c;--this.a} -function zc(a){var b=S(this,a);a=a>>6&7;var c=this.c[a]<<16|this.c[a|1];this.g=this.b=0;b&=63;if(b&32){b=64-b;32>b-1;this.g=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<>15,d<<=1,32>=32-b)&&4294967295!==(c|4294967295<>16&65535;this.c[a|1]=d&65535;this.j=d>>16;this.f=d>>16|d;--this.a}function X(a){a&1&&(this.g=0);a&2&&(this.b=0);a&4&&(this.f=1);a&8&&(this.j=0);--this.a} -function Ac(a){var b=S(this,a);if(b){a=a>>6&7;var c=this.c[a]<<16|this.c[a|1];this.g=this.b=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.c[a]=d&65535,this.c[a|1]=c-d*b&65535,this.f=d>>16|d,this.j=d>>16):(this.b=32768,this.f=d>>15|d,this.j=c>>16,-1===b&&65534===this.c[a]&&(this.c[a]=this.c[a|1]=1))}else this.f=this.j=0,this.b=32768,this.g=65536;--this.a}function Bc(a){var b=Vb(this,a,8);a=a>>6&7;Rb(this,this.c[a]);this.c[a]=this.c[7];this.c[7]=b;--this.a} -function Cc(a){var b=S(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.c[a];c&32768&&(c|=-65536);b=~~(b*c);this.c[a]=b>>16&65535;this.c[a|1]=b&65535;this.i&128||(this.j=b>>16,this.f=this.j|b,this.b=0,this.g=-32768>b||32767>6;if(this.c[b]=this.c[b]-1&65535)this.c[7]=this.c[7]-((a&63)<<1)&65535;--this.a} -function Fc(a){U(this,a,S(this,(a&448)>>6),xc);--this.a}function Z(){K(this,8)}function Mb(a){Gc[a>>12].call(this,a)} -var Gc=[function(a){Hc[a>>8&15].call(this,a)},function(a){P(this,Yb(this,a,S(this,a>>6)));--this.a},function(a){var b=S(this,a>>6);a=S(this,a);Qb(this,b-a,a,b);--this.a},function(a){P(this,S(this,a>>6)&S(this,a));--this.a},function(a){U(this,a,S(this,a>>6),fc);--this.a},function(a){U(this,a,S(this,a>>6),hc);--this.a},function(a){U(this,a,S(this,a>>6),$b);this.a-=this.Jb?9+(this.Tb&&6<=this.vb?1:0):this.Sb?5:3+(7==this.vb?2:0)},function(a){Ic[a>>8&15].call(this,a)},function(a){Jc[a>>8&15].call(this, -a)},function(a){var b=T(this,a>>6);P(this,Zb(this,a,b,1)<<8);--this.a},function(a){var b=T(this,a>>6)<<8;a=T(this,a)<<8;Qb(this,b-a,a,b);--this.a},function(a){P(this,(T(this,a>>6)&T(this,a))<<8);--this.a},function(a){V(this,a,T(this,a>>6),gc);--this.a},function(a){V(this,a,T(this,a>>6),ic);--this.a},function(a){U(this,a,S(this,a>>6),vc);--this.a},Z],Hc=[function(a){Kc[a>>4&15].call(this,a)},function(a){W(this,a);--this.a},function(a){this.f&65535&&W(this,a);--this.a},function(a){this.f&65535||W(this, -a);--this.a},function(a){!this.ra()==!(this.b&32768)&&W(this,a);--this.a},function(a){!this.ra()!=!(this.b&32768)&&W(this,a);--this.a},function(a){this.f&65535&&!this.ra()==!(this.b&32768)&&W(this,a);--this.a},function(a){this.f&65535&&!this.ra()==!(this.b&32768)||W(this,a);--this.a},Bc,Bc,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)},function(a){Oc[a>>6&3].call(this,a)},Z,Z],Lc=[function(a){Q(this,Yb(this,a,0));--this.a},function(a){U(this, -a,0,jc);--this.a},function(a){U(this,a,1,nc);--this.a},function(a){U(this,a,1,lc);--this.a}],Mc=[function(a){U(this,a,0,pc);--this.a},function(a){U(this,a,O(this)?1:0,$b);--this.a},function(a){U(this,a,O(this)?1:0,vc);--this.a},function(a){a=S(this,a);Q(this,a);--this.a}],Nc=[function(a){U(this,a,0,tc);--this.a},function(a){U(this,a,0,rc);--this.a},function(a){U(this,a,0,dc);--this.a},function(a){U(this,a,0,bc);--this.a}],Oc=[function(a){a=this.c[7]+((a&63)<<1)&65535;var b=this.ea(a|65536);this.c[7]= -this.c[5]&65535;this.c[6]=a+2&65535;this.c[5]=b;--this.a},function(a){a=Wb(this,a,0);Rb(this,a);P(this,a);--this.a},function(a){var b=Tb(this);Xb(this,a,0,b);P(this,b);--this.a},function(a){P(this,Yb(this,a,this.ra?65535:0));--this.a}],Kc=[function(a){Pc[a&15].call(this,a)},Z,Z,Z,Z,Z,Z,Z,function(a){var b=Tb(this);a&=7;this.c[7]=this.c[a];this.c[a]=b;--this.a},function(a){this.w&49152||(this.w=this.w&-2017|(a&7)<<5,this.i|=1);--this.a},function(a){Qc[a&15].call(this,a)},function(a){Rc[a&15].call(this, -a)},Z,Z,Z,Z],Qc=[Dc,function(){this.g=0;--this.a},function(){this.b=0;--this.a},X,function(){this.f=1;--this.a},X,X,X,function(){this.j=0;--this.a},X,X,X,X,X,X,X],Rc=[Dc,function(){this.g=65536;--this.a},function(){this.b=32768;--this.a},Y,function(){this.f=0;--this.a},Y,Y,Y,function(){this.j=32768;--this.a},Y,Y,Y,Y,Y,Y,Y],Pc=[function(){this.w&49152?(this.o|=128,K(this,4)):(this.J-=this.a,this.a=0);--this.a},function(){this.i|=4;this.c[7]=this.c[7]+-2&65535;--this.a},function(){Sb(this);this.i|= -this.w&16;--this.a},function(){K(this,12);--this.a},function(){K(this,16);--this.a},function(){this.w&49152||(Nb(this),this.B.reset());--this.a},function(){Sb(this);--this.a},Z,Z,Z,Z,Z,Z,Z,Z,Z],Ic=[Cc,Cc,Ac,Ac,yc,yc,zc,zc,Fc,Fc,Z,Z,Z,Z,Ec,Ec],Jc=[function(a){this.ra()||W(this,a);--this.a},function(a){this.ra()&&W(this,a);--this.a},function(a){!O(this)&&this.f&65535&&W(this,a);--this.a},function(a){!O(this)&&this.f&65535||W(this,a);--this.a},function(a){this.b&32768||W(this,a);--this.a},function(a){this.b& -32768&&W(this,a);--this.a},function(a){O(this)||W(this,a);--this.a},function(a){O(this)&&W(this,a);--this.a},function(){K(this,24);--this.a},function(){K(this,28);--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)},function(a){Vc[a>>6&3].call(this,a)},Z,Z],Sc=[function(a){Q(this,Zb(this,a,0));--this.a},function(a){V(this,a,0,kc);--this.a},function(a){V(this,a,1,oc);--this.a},function(a){V(this,a,1,mc);--this.a}],Tc=[function(a){V(this, -a,0,qc);--this.a},function(a){V(this,a,O(this)?1:0,ac);--this.a},function(a){V(this,a,O(this)?1:0,wc);--this.a},function(a){a=T(this,a);Q(this,a<<8);--this.a}],Uc=[function(a){V(this,a,0,uc);--this.a},function(a){V(this,a,0,sc);--this.a},function(a){V(this,a,0,ec);--this.a},function(a){V(this,a,0,cc);--this.a}],Vc=[Z,function(a){a=Wb(this,a,65536);Rb(this,a);P(this,a);--this.a},function(a){var b=Tb(this);Xb(this,a,65536,b);P(this,b);--this.a},Z]; -function Wc(a){w.call(this,"ROM",a,Wc);this.b=null;this.m=a.addr;this.f=a.size;this.v=a.writable;this.g=a.alias;this.j=a.file;this.C=ca(this.j);if(this.j){a=this.j;var b=da(this.C);"json"!=b&&"hex"!=b&&(a=fa()+"/api/v1/dump?file="+this.j+"&format=bytes&decimal=true");var c=this;p(a,null,!0,function(a,b,e){Xc(c,a,b,e)})}}y(Wc);Wc.prototype.Ia=function(a,b,c,d){this.B=b;this.a=c;this.I=d;Yc(this)};Wc.prototype.va=function(){this.l&&(this.I&&this.I.a(this.id,this.m,this.f,this.l),delete this.l);return!0}; -Wc.prototype.ua=function(){return!0}; -function Xc(a,b,c,d){if(d)a.M("Unable to load system ROM (error "+d+": "+b+")");else{Ea(a.Lb,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.l=h.symbols;if(!a.b.length){q("Empty ROM: "+b); -return}if(1==a.b.length){q(a.b[0]);return}}catch(k){a.M("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].$b(f&d.j,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.g?b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(c=0;c>>f.f;0>>=f.f;0\nLicense: GPL version 3 or later ");this.K("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bcd){if(ed(d,this.C)){this.l=new N(this,"1.30.0","failsafe");ed(this.l)&&(jd(this,d),a=2,kd(this.l));this.l.set("timestamp",ja());ld(this.l);var f=this.b&&!this.m;if(1==a||ka("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=id(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?ed(d,g):("error"== -e&&"no machine state"!=g?(this.M("Error: "+g),"unable to verify user"==g&&(oa("user",""),this.f=null)):this.K(e+": "+g),kd(d),ed(d)?(c=id(d),f=!0):c=!1))}f&&hd(this,c?d:null)}else 2==a&&d.clear()}else hd(this);delete this.C;delete this.G}f=z(this.id);for(e=0;ea[1];a=a[2];this.aa=!0;this.h.N=!0;var d=this.u.power;d&&(d.textContent="Shutdown");this.a&&(md(this,this.a,b,c,a),this.a.Ya());this.R&&(jd(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.g=0}; -function jd(a,b){if(ka("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;p("http://www.pcjs.org/api/v1/report",d,!0)}} -function nd(a,b,c){var d,f="none";if(a.g)return null;a.g--;var e=new N(a,"1.30.0"),g=new N(a,"1.30.0","validate"),h=ja();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.ua&&(c&&Gb(a.a),d=a.a.ua(b,c),"object"===typeof d&&e.set(a.a.id,d),c&&(a.a.h.N=!1,!1===d&&(f=null)));for(var h=z(a.id),k=0;k>2),b=0;b>8,c)},Z:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ja: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},pa: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.ua=!0},L:function(a,b){return this.S(a,b)},ga:function(a,b){return this.ha(a, +b)},na:function(a,b,c){this.i||this.$b(a,b,c)},Fa:function(a,b,c){this.i||this.Ga(a,b,c)},H:function(a){return this.b[a]},T:function(a){return this.b[a]},$:function(a){return this.g.getUint16(a,!0)},ia:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.m[a>>1]},ma:function(a,b){this.b[a]=b;this.ua=!0},oa:function(a,b){this.b[a]=b;this.ua=!0},Ea:function(a,b){this.g.setUint16(a,b,!0);this.ua=!0},Ha:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.m[a>>1]=b;this.ua=!0}}; +function Ka(a,b,c){a.K=b;a.B=a.l=0;c&&((a.B=c.B)&&vb(a,wb,!1),(a.l=c.l)&&xb(a,wb,!1))}function xb(a,b,c){c&&a.l||(a.Va=!a.i&&b[1]||a.F,a.Hc=!a.i&&b[3]||a.G);if(c||void 0===c)a.$b=b[1]||a.F,a.Ga=b[3]||a.G}function vb(a,b,c){c&&a.B||(a.bb=b[0]||a.s,a.tb=b[2]||a.v);if(c||void 0===c)a.S=b[0]||a.s,a.ha=b[2]||a.v}function rb(a,b){b||(b=yb);vb(a,b,void 0);xb(a,b,void 0)}var yb=[],ub=[G.prototype.Z,G.prototype.pa,G.prototype.ja,G.prototype.Ia],wb=[G.prototype.L,G.prototype.na,G.prototype.ga,G.prototype.Fa]; +if(Ha)var tb=[G.prototype.H,G.prototype.ma,G.prototype.$,G.prototype.Ea],sb=[G.prototype.T,G.prototype.oa,G.prototype.ia,G.prototype.Ha];function zb(a,b){v.call(this,"CPU",a,zb);var c=a.multiplier||1;this.mb=a.cycles||b;this.ia=c;this.Ab=Math.round(this.mb/1E4)/100;this.na=this.Ab*this.ia;this.h.aa=!1;this.h.Yb=!1;this.h.Ya=a.autoStart;this.h.Mb=!1;this.h.ob=!1;this.kb=this.oa=0;this.lb=a.csStart;this.Fa=a.csInterval;this.Ga=a.csStop;this.S=[];this.Tb=this.Ac.bind(this);E(this)}y(zb); +var Ab=["power","reset"];l=zb.prototype;l.Ma=function(a,b,c,d){this.F=a;this.C=b;this.K=d;for(b=0;ba.ga/a.na&&(b=1),a.ia=b,b=a.Ab*a.ia,a.na!=b)){a.na=b;b=a.na.toFixed(2)+"Mhz";var c=a.B.setSpeed;c&&(c.textContent=b);a.M("target speed: "+b)}Jb(a,a.$);a.$=0;a.Z=ia();a.ha=0;Kb(a)}function $a(a,b){var c=a.S.length;a.S.push([-1,b]);return c}function ab(a,b){var c;0<=b&&ba.S[b][0]&&(c=a.mb*a.ia/1E3*(1E3/60),a.S[b][0]=c)} +l.Ac=function(){if(this.h.aa){this.Bb>=this.mb&&Kb(this,!0);this.Ia=0;this.jb=ia();if(this.ha){var a=this.jb-this.ha;a>this.Qb&&(this.Z+=a,this.Z>this.jb&&(this.Z=this.jb))}try{do{for(var b,c=this.h.ob?1:this.nb,d=this.S.length-1;0<=d;d--){var f=this.S[d];0>f[0]||c>f[0]&&(c=f[0])}b=c;try{this.Zb(b)}catch(m){if("number"!=typeof m)throw m;}for(var e=this.T-this.a,a=e,g=this.S.length-1;0<=g;g--){var h=this.S[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.Ia+=e;this.$+=e;Jb(this,0,!0);a=e;if(this.h.ob){var k= +!1;this.kb=this.kb+this.Rb()|0;this.oa-=a;0>=this.oa&&(this.oa+=this.Fa,k=!0);0<=this.Ga&&this.Ga<=Lb(this)&&(this.Fa=this.Ga=-1,Db(this),Hb(this),k=!0);k&&this.M(Lb(this)+" cycles: checksum="+n(this.kb))}this.Ha-=e;if(0>=this.Ha){this.Ha+=this.nb;15<=++this.Sb&&(this.F&&this.F.Ua(),this.Sb=0);break}}while(this.h.aa)}catch(m){Hb(this);Eb(this);this.F&&this.F.stop(ia(),Lb(this));b=m.stack||m.message;this.h.error=!0;this.N(b);return}if(this.h.aa){b=setTimeout;c=this.Tb;this.ha=ia();d=this.Qb;this.Ia&& +(d=Math.round(d*this.Ia/this.nb));d-=this.ha-this.jb;if(f=this.ha-this.Z)this.ga=Math.round(this.$/(10*f))/100,864E5<=f&&(this.ja=0,Ib(this));if(0>d||this.gad&&(this.Z-=d),d=0;this.Bb+=this.Ia;this.ha+=d;b(c,d)}}};function Fb(a){var b;a.h.error?(a.M(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.h.aa)a.M(a.toString()+" busy");else{Ib(a);a.h.aa=!0;a.h.Yb=!0;a.Ea&&a.Ea.start();if(b=a.B.run)b.textContent="Halt";a.F&&a.F.start(a.Z,Lb(a));Eb(a,!0);setTimeout(a.Tb,0)}}l.Zb=function(){return 0}; +function Hb(a){if(a.h.aa){a.T-=a.a;a.a=0;Jb(a,a.$);a.$=0;a.h.aa=!1;a.Ea&&a.Ea.stop();var b=a.B.run;b&&(b.textContent="Run");a.F&&a.F.stop(ia(),Lb(a));Eb(a)}a.h.complete=void 0}function Eb(a,b){a.F&&a.F.Ua(b)} +function Mb(a){this.ic=a.resetAddr||0;zb.call(this,a,6666667);this.Lb=0;this.decode=Nb.bind(this);this.l=65536;this.g=32768;this.i=65535;this.m=32768;this.w=15;this.c=[0,0,0,0,0,0,0,this.ic];this.Oa=[0,0,0,0,0,0];this.fa=[0,0,0,0];this.ib=this.v=0;this.P=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[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.gb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.L=this.b=this.H=this.f=this.j=0;this.La=70;this.pa=-1;Ob(this);this.h.complete=this.h.cc=!1}y(Mb,zb);l=Mb.prototype;l.reset=function(){this.h.aa&&Hb(this);Ob(this);Cb(this);this.h.error=!1;this.parent.reset.call(this)}; +function Ob(a){a.Ba=255;a.o=0;a.Gb=0;a.G=0;a.Aa=0;a.vb=0;a.Na=0;a.qb=0;a.hb=0;a.rb=[7,7,7,7];a.s=[];a.j|=2;bb(a)}function bb(a){a.qb?(a.Jb=65536,a.ma=a.gc,a.tb=a.ea):(a.Jb=0,a.ma=a.fc,a.tb=a.ub)}l.Rb=function(){return 0};l.save=function(){var a=new M(this);a.set(0,[]);a.set(1,[this.ja,this.ia]);a.set(2,Va(this.C));return a.data()}; +l.restore=function(a){var b=a[1];this.ja=b[1];Ib(this,b[3]);a:{b=this.C;a=a[2];var c;for(c=0;cb){a.s[e].ta-=b;break}b-=a.s[e].ta}a.s.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.j|=2}function cb(a){return a.w=a.w&63728|a.va()|(a.i&65535?0:4)|(a.g&32768?2:0)|N(a)} +function db(a,b){a.m=b<<12;a.i=~b&4;a.g=b<<14;a.l=b<<16;if((b^a.w)&2048)for(var c=a.Oa.length;0<=--c;){var d=a.c[c];a.c[c]=a.Oa[c];a.Oa[c]=d}a.v=b>>14&3;c=a.w>>14&3;a.v!=c&&(a.fa[c]=a.c[6],a.c[6]=a.fa[a.v]);a.j|=2;a.w=b}function O(a,b){a.j&128||(a.m=a.i=b,a.g=0)}function P(a,b,c){a.j&128||(a.m=a.i=a.l=b,a.g=c||0)}function Qb(a,b,c,d){a.j&128||(a.m=a.i=a.l=b,a.g=(c^b)&(d^b))}function Q(a,b){a.j&128||(a.m=a.i=a.l=b,a.g=a.m^a.l>>1)}function Rb(a,b,c,d){a.j&128||(a.m=a.i=a.l=b,a.g=(c^d)&(d^b))} +function K(a,b){var c=!1;0>a.pa?a.pa=cb(a):a.v||(b=4,c=!0);a.G&57344||(a.Aa=63222,a.vb=b);a.v=0;var d=a.ea(b|65536),f=a.ea(b+2&65535|65536);db(a,f&-12289|a.pa>>2&12288);c&&(a.o|=4,a.c[6]=4);Sb(a,a.pa);Sb(a,a.c[7]);a.c[7]=d&65535;a.j&=-113;a.pa=-1;throw b;}function Tb(a){var b=Ub(a),c=Ub(a)&-1793;a.w&49152&&(c=c&-225|a.w&63712);a.c[7]=b&65535;db(a,c);a.j&=-17} +function kb(a,b){var c=b>>13&31;31>c?a.Na&32&&(b=a.gb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b} +function Vb(a,b,c){var d,f,e,g=0;if(c&a.qb){d=b>>13&a.rb[a.v];f=a.P[a.v][d];e=(a.P[a.v][d+16]<<6)+(b&8191)&4194303;a.Na&16?3932160<=e&&4186112>e&&(e=kb(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.o|=32,K(a,4)),e&1&&!(c&1)&&(a.o|=64,K(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.P[a.v][d]=f;if(4194170!==e||a.v)a.hb=a.v,a.ib=d;g&&(g&57344&&(0<=a.pa&&(g|=128),a.G&57344||(a.G=a.G|g|a.hb<<5|a.ib<<1),K(a,168)),a.G&61440||!(4191360>e||4194239>>b.f;a=c!=b.i?b.b[d].tb(c,a):b.b[d++].bb(c,a)|b.b[d&b.H].bb(0,a+1)<<8}return a};l.ea=function(a){return this.ub(Vb(this,a,2))}; +function Ub(a){var b=a.ea(a.c[6]|65536);a.c[6]=a.c[6]+2&65535;return b}function Sb(a,b){var c=a.c[6]-2&65535;a.c[6]=c;a.G&57344||(a.Aa=a.Aa<<8|246);!a.v&&c<=a.Ba&&4>3&7;c&4?(a.f=b,a.b=g):(a.H=b,a.L=g);switch(b){case 0:return K(a,4),0;case 1:return 6===g&&!a.v&&c&4&&(a.c[6]<=a.Ba||65534<=a.c[6])&&(a.c[6]<=a.Ba-32||65534<=a.c[6]?(a.o|=4,a.c[6]=4,K(a,4)):(a.o|=8,a.j|=64)),a.a-=3,7===g?a.c[g]:a.c[g]|e;case 2:f=2;d=a.c[g];7!==g&&(d|=e,6>g&&c&1&&(f=1));a.a-=3;break;case 3:f=2;d=a.c[g];7!==g&&(d|=e);d=a.ea(d);d|=e;a.a-=7;break;case 4:f=-2;6>g&&c&1&&(f=-1);d=a.c[g]+f&65535;7!==g&&(d|=e);a.a-=4;break;case 5:f=-2;d=a.c[g]- +2&65535;7!==g&&(d|=e);d=a.ea(d)|e;a.a-=8;break;case 6:return d=Pb(a),d=d+a.c[g]&65535|e,a.a-=6,d;case 7:return d=Pb(a),d=d+a.c[g]&65535,d=a.ea(d|65536)|e,a.a-=10,d}a.c[g]=a.c[g]+f&65535;!e||a.G&57344||(a.Aa=a.Aa<<8|f<<3&248|g);6==g&&!a.v&&c&4&&0>=f&&(a.c[6]<=a.Ba||65534<=a.c[6])&&(a.c[6]<=a.Ba-32?(a.o|=4,a.c[6]=4,K(a,4)):(a.o|=8,a.j|=64));return d}l.fc=function(a,b){return R(this,a,b)};l.gc=function(a,b){return Vb(this,R(this,a,b),b)}; +function Wb(a,b,c){b&56?(b=R(a,b,2),c&65536||61440!==(a.w&61440)&&(b&=65535),a.v=a.w>>12&3,c=a.ea(b|c&65536),a.v=a.w>>14&3):(c=b&7,c=6!=c||(a.w>>2&12288)===(a.w&12288)?a.c[c]:a.fa[a.w>>12&3]);return c}function Xb(a,b,c,d){a.G&57344||(a.Aa=22);b&56?(b=R(a,b,4),c&65536||(b&=65535),a.v=a.w>>12&3,b=Vb(a,b|c&65536,4),a.v=a.w>>14&3,Ua(a.C,b,d&65535)):(c=b&7,6!=c||(a.w>>2&12288)===(a.w&12288)?a.c[c]=d:a.fa[a.w>>12&3]=d)}function S(a,b){return b&56?a.tb(R(a,b,2)):a.c[b&7]} +function T(a,b){b&56?(b=a.ma(b,3),a=Ta(a.C,b)):a=a.c[b&7]&255;return a}function U(a,b,c,d){b&56?(b=a.ma(b,6),c=d.call(a,c,a.ub(b)),Ua(a.C,b,c&65535)):(b&=7,a.c[b]=d.call(a,c,a.c[b]))}function V(a,b,c,d){b&56?(b=a.ma(b,7),c=d.call(a,c,Ta(a.C,b)),b&1&&a.a--,a=a.C,a.b[(b&a.l)>>>a.f].Va(b&a.i,c&255,b)):(b&=7,a.c[b]=a.c[b]&65280|d.call(a,c,a.c[b]))}function Yb(a,b,c){b&56?(b=a.ma(b,4),Ua(a.C,b,c&65535)):a.c[b&7]=c&65535;return c} +function Zb(a,b,c,d){b&56?(d=a.ma(b,5),d&1&&a.a--,a=a.C,a.b[(d&a.l)>>>a.f].Va(d&a.i,c&255,d)):(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 W(a,b){a.c[7]=a.c[7]+(b<<24>>23)&65535} +l.Zb=function(a){this.h.complete=!0;this.h.cc=!1;this.h.Yb=!1;this.T=this.a=a;do{if(this.j&&(this.j&112&&(this.j&32?K(this,168):this.j&64?K(this,4):this.j&16&&K(this,12),this.j&=-113),this.j&7))if(this.j&2){this.j&=-3;a=null;for(var b=this.Gb&224,c=this.s.length;0<=--c;){if(0b&&(b=this.s[c].lc,a=this.s[c],this.s.splice(c,1))}b>(this.w&224)&&(this.j&4&&(this.c[7]= +this.c[7]+2&65535,this.j&=-5),a?K(this,a.Cc):K(this,160))}else this.j&1&&this.j++;this.G&57344||(this.Aa=0,this.vb=this.c[7]);this.j=this.j&7|this.w&16;this.decode(Pb(this))}while(0>1|b<<16;Q(this,a);return a&65535}function ec(a,b){a=b&2048|b>>1|b<<8;Q(this,a<<8);return a&255}function fc(a,b){a=b&~a;O(this,a);return a}function gc(a,b){a=b&~a;O(this,a<<8);return a}function hc(a,b){a|=b;O(this,a);return a}function ic(a,b){a|=b;O(this,a<<8);return a}function jc(a,b){a=~b|65536;P(this,a);return a&65535} +function kc(a,b){a=~b|256;P(this,a<<8);return a&255}function lc(a,b){a=b-a;this.j&128||(this.m=this.i=a,this.g=b&(b^a));return a&65535}function mc(a,b){a=b-a;var c=a<<8;b<<=8;this.j&128||(this.m=this.i=c,this.g=b&(b^c));return a&255}function nc(a,b){a=b+a;this.j&128||(this.m=this.i=a,this.g=a&(b^a));return a&65535}function oc(a,b){a=b+a;var c=a<<8;this.j&128||(this.m=this.i=c,this.g=c&(b<<8^c));return a&255}function pc(a,b){a=-b;P(this,a,a&b&32768);return a&65535} +function qc(a,b){a=-b;P(this,a<<8,(a&b&128)<<8);return a&255}function rc(a,b){a=b<<1|this.l>>16&1;Q(this,a);return a&65535}function sc(a,b){a=b<<1|this.l>>16&1;Q(this,a<<8);return a&255}function tc(a,b){a=(this.l&65536|b)>>1|b<<16;Q(this,a);return a&65535}function uc(a,b){a=((this.l&65536)>>8|b)>>1|b<<8;Q(this,a<<8);return a&255}function vc(a,b){var c=b-a;Rb(this,c,a,b);return c&65535}function wc(a,b){var c=b-a;Rb(this,c<<8,a<<8,b<<8);return c&255} +function xc(a,b){this.j&128||(this.m=this.i=b&65280,this.g=this.l=0);return(b<<8|b>>8)&65535}function yc(a,b){a^=b;O(this,a);return a&65535}function zc(a){var b=S(this,a);a=a>>6&7;var c=this.c[a];c&32768&&(c|=4294901760);this.l=this.g=0;b&=63;b&32?(b=64-b,16>=b):b&&(16>15&65535)&&65535!==b&&(this.g=32768)));this.c[a]=c&65535;this.m=this.i=c;--this.a} +function Ac(a){var b=S(this,a);a=a>>6&7;var c=this.c[a]<<16|this.c[a|1];this.l=this.g=0;b&=63;if(b&32){b=64-b;32>b-1;this.l=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<>15,d<<=1,32>=32-b)&&4294967295!==(c|4294967295<>16&65535;this.c[a|1]=d&65535;this.m=d>>16;this.i=d>>16|d;--this.a}function X(a){a&1&&(this.l=0);a&2&&(this.g=0);a&4&&(this.i=1);a&8&&(this.m=0);--this.a} +function Bc(a){var b=S(this,a);if(b){a=a>>6&7;var c=this.c[a]<<16|this.c[a|1];this.l=this.g=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.c[a]=d&65535,this.c[a|1]=c-d*b&65535,this.i=d>>16|d,this.m=d>>16):(this.g=32768,this.i=d>>15|d,this.m=c>>16,-1===b&&65534===this.c[a]&&(this.c[a]=this.c[a|1]=1))}else this.i=this.m=0,this.g=32768,this.l=65536;--this.a}function Cc(a){a=R(this,a,8);this.c[7]=a&65535;--this.a} +function Dc(a){var b=R(this,a,8);a=a>>6&7;Sb(this,this.c[a]);this.c[a]=this.c[7];this.c[7]=b&65535;--this.a}var Ec=[[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17]];function Fc(a){var b=S(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.c[a];c&32768&&(c|=-65536);b=~~(b*c);this.c[a]=b>>16&65535;this.c[a|1]=b&65535;this.j&128||(this.m=b>>16,this.i=this.m|b,this.g=0,this.l=-32768>b||32767>6;if(this.c[b]=this.c[b]-1&65535)this.c[7]=this.c[7]-((a&63)<<1)&65535;--this.a}function Ic(a){U(this,a,0,xc);this.a-=this.f?9:3+(7==this.b?2:0)}function Jc(a){U(this,a,S(this,(a&448)>>6),yc);this.a-=this.f?9:3+(7==this.b?2:0)}function Z(){K(this,8)}function Nb(a){Kc[a>>12].call(this,a)} +var Kc=[function(a){Lc[a>>8&15].call(this,a)},function(a){O(this,Yb(this,a,S(this,a>>6)));this.a-=Ec[(this.H?8:0)+this.f]+(7!=this.b||this.f?0:2)},function(a){var b=S(this,a>>6);a=S(this,a);Rb(this,b-a,a,b);this.a-=this.f?4+(this.L&&6<=this.b?1:0):(this.H?4:3)+(7==this.b?2:0)},function(a){O(this,S(this,a>>6)&S(this,a));this.a-=this.f?4+(this.L&&6<=this.b?1:0):(this.H?4:3)+(7==this.b?2:0)},function(a){U(this,a,S(this,a>>6),fc);this.a-=this.f?9+(this.L&&6<=this.b?1:0):(this.H?5:3)+(7==this.b?2:0)}, +function(a){U(this,a,S(this,a>>6),hc);this.a-=this.f?9+(this.L&&6<=this.b?1:0):(this.H?5:3)+(7==this.b?2:0)},function(a){U(this,a,S(this,a>>6),$b);this.a-=this.f?9+(this.L&&6<=this.b?1:0):(this.H?5:3)+(7==this.b?2:0)},function(a){Mc[a>>8&15].call(this,a)},function(a){Nc[a>>8&15].call(this,a)},function(a){var b=T(this,a>>6);O(this,Zb(this,a,b,1)<<8);this.a-=this.f?9+(this.L&&6<=this.b?1:0):(this.H?5:3)+(7==this.b?2:0)},function(a){var b=T(this,a>>6)<<8;a=T(this,a)<<8;Rb(this,b-a,a,b);this.a-=this.f? +4+(this.L&&6<=this.b?1:0):(this.H?4:3)+(7==this.b?2:0)},function(a){O(this,(T(this,a>>6)&T(this,a))<<8);this.a-=this.f?4+(this.L&&6<=this.b?1:0):(this.H?4:3)+(7==this.b?2:0)},function(a){V(this,a,T(this,a>>6),gc);this.a-=this.f?9+(this.L&&6<=this.b?1:0):(this.H?5:3)+(7==this.b?2:0)},function(a){V(this,a,T(this,a>>6),ic);this.a-=this.f?9+(this.L&&6<=this.b?1:0):(this.H?5:3)+(7==this.b?2:0)},function(a){U(this,a,S(this,a>>6),vc);this.a-=this.f?9+(this.L&&6<=this.b?1:0):(this.H?5:3)+(7==this.b?2:0)}, +Z],Lc=[function(a){Oc[a>>4&15].call(this,a)},function(a){W(this,a);--this.a},function(a){this.i&65535&&W(this,a);--this.a},function(a){this.i&65535||W(this,a);--this.a},function(a){!this.va()==!(this.g&32768)&&W(this,a);--this.a},function(a){!this.va()!=!(this.g&32768)&&W(this,a);--this.a},function(a){this.i&65535&&!this.va()==!(this.g&32768)&&W(this,a);--this.a},function(a){this.i&65535&&!this.va()==!(this.g&32768)||W(this,a);--this.a},Dc,Dc,function(a){Pc[a>>6&3].call(this,a)},function(a){Qc[a>> +6&3].call(this,a)},function(a){Rc[a>>6&3].call(this,a)},function(a){Sc[a>>6&3].call(this,a)},Z,Z],Pc=[function(a){P(this,Yb(this,a,0));this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,0,jc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,1,nc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,1,lc);this.a-=this.f?9:3+(7==this.b?2:0)}],Qc=[function(a){U(this,a,0,pc);--this.a},function(a){U(this,a,N(this)?1:0,$b);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,N(this)? +1:0,vc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){a=S(this,a);P(this,a);--this.a}],Rc=[function(a){U(this,a,0,tc);--this.a},function(a){U(this,a,0,rc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){U(this,a,0,dc);--this.a},function(a){U(this,a,0,bc);this.a-=this.f?9:3+(7==this.b?2:0)}],Sc=[function(a){a=this.c[7]+((a&63)<<1)&65535;var b=this.ea(a|65536);this.c[7]=this.c[5]&65535;this.c[6]=a+2&65535;this.c[5]=b;--this.a},function(a){a=Wb(this,a,0);Sb(this,a);O(this,a);--this.a},function(a){var b= +Ub(this);Xb(this,a,0,b);O(this,b);--this.a},function(a){O(this,Yb(this,a,this.va?65535:0));this.a-=this.f?9:3+(7==this.b?2:0)}],Oc=[function(a){Tc[a&15].call(this,a)},Z,Z,Z,Cc,Cc,Cc,Cc,function(a){var b=Ub(this);a&=7;this.c[7]=this.c[a]&65535;this.c[a]=b;--this.a},function(a){this.w&49152||(this.w=this.w&-2017|(a&7)<<5,this.j|=1);--this.a},function(a){Uc[a&15].call(this,a)},function(a){Vc[a&15].call(this,a)},Ic,Ic,Ic,Ic],Uc=[Gc,function(){this.l=0;--this.a},function(){this.g=0;--this.a},X,function(){this.i= +1;--this.a},X,X,X,function(){this.m=0;--this.a},X,X,X,X,X,X,X],Vc=[Gc,function(){this.l=65536;--this.a},function(){this.g=32768;--this.a},Y,function(){this.i=0;--this.a},Y,Y,Y,function(){this.m=32768;--this.a},Y,Y,Y,Y,Y,Y,Y],Tc=[function(){this.w&49152?(this.o|=128,K(this,4)):(this.T-=this.a,this.a=0);--this.a},function(){this.j|=4;this.c[7]=this.c[7]+-2&65535;--this.a},function(){Tb(this);this.j|=this.w&16;--this.a},function(){K(this,12);--this.a},function(){K(this,16);--this.a},function(){this.w& +49152||(Ob(this),this.C.reset());--this.a},function(){Tb(this);--this.a},Z,Z,Z,Z,Z,Z,Z,Z,Z],Mc=[Fc,Fc,Bc,Bc,zc,zc,Ac,Ac,Jc,Jc,Z,Z,Z,Z,Hc,Hc],Nc=[function(a){this.va()||W(this,a);--this.a},function(a){this.va()&&W(this,a);--this.a},function(a){!N(this)&&this.i&65535&&W(this,a);--this.a},function(a){!N(this)&&this.i&65535||W(this,a);--this.a},function(a){this.g&32768||W(this,a);--this.a},function(a){this.g&32768&&W(this,a);--this.a},function(a){N(this)||W(this,a);--this.a},function(a){N(this)&&W(this, +a);--this.a},function(){K(this,24);--this.a},function(){K(this,28);--this.a},function(a){Wc[a>>6&3].call(this,a)},function(a){Xc[a>>6&3].call(this,a)},function(a){Yc[a>>6&3].call(this,a)},function(a){Zc[a>>6&3].call(this,a)},Z,Z],Wc=[function(a){P(this,Zb(this,a,0));this.a-=this.f?9:3+(7==this.b?2:0)},function(a){V(this,a,0,kc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){V(this,a,1,oc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){V(this,a,1,mc);this.a-=this.f?9:3+(7==this.b?2:0)}],Xc=[function(a){V(this, +a,0,qc);--this.a},function(a){V(this,a,N(this)?1:0,ac);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){V(this,a,N(this)?1:0,wc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){a=T(this,a);P(this,a<<8);--this.a}],Yc=[function(a){V(this,a,0,uc);--this.a},function(a){V(this,a,0,sc);this.a-=this.f?9:3+(7==this.b?2:0)},function(a){V(this,a,0,ec);--this.a},function(a){V(this,a,0,cc);this.a-=this.f?9:3+(7==this.b?2:0)}],Zc=[Z,function(a){a=Wb(this,a,65536);Sb(this,a);O(this,a);--this.a},function(a){var b= +Ub(this);Xb(this,a,65536,b);O(this,b);--this.a},Z];function $c(a){v.call(this,"ROM",a,$c);this.b=null;this.m=a.addr;this.f=a.size;this.s=a.writable;this.g=a.alias;this.i=a.file;this.v=ca(this.i);if(this.i){a=this.i;var b=da(this.v);"json"!=b&&"hex"!=b&&(a=fa()+"/api/v1/dump?file="+this.i+"&format=bytes&decimal=true");var c=this;p(a,null,!0,function(a,b,e){ad(c,a,b,e)})}}y($c);$c.prototype.Ma=function(a,b,c,d){this.C=b;this.a=c;this.K=d;bd(this)}; +$c.prototype.za=function(){this.l&&(this.K&&this.K.a(this.id,this.m,this.f,this.l),delete this.l);return!0};$c.prototype.ya=function(){return!0}; +function ad(a,b,c,d){if(d)a.N("Unable to load system ROM (error "+d+": "+b+")");else{Ea(a.Pb,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.l=h.symbols;if(!a.b.length){r("Empty ROM: "+b); +return}if(1==a.b.length){r(a.b[0]);return}}catch(k){a.N("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].$b(f&d.i,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.g?b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(c=0;c>>f.f;0>>=f.f;0\nLicense: GPL version 3 or later ");this.M("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bgd){if(id(d,this.v)){this.l=new M(this,"1.30.0","failsafe");id(this.l)&&(nd(this,d),a=2,od(this.l));this.l.set("timestamp",ja());pd(this.l);var f=this.b&&!this.m;if(1==a||ka("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=md(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?id(d,g):("error"== +e&&"no machine state"!=g?(this.N("Error: "+g),"unable to verify user"==g&&(oa("user",""),this.f=null)):this.M(e+": "+g),od(d),id(d)?(c=md(d),f=!0):c=!1))}f&&ld(this,c?d:null)}else 2==a&&d.clear()}else ld(this);delete this.v;delete this.F}f=z(this.id);for(e=0;ea[1];a=a[2];this.$=!0;this.h.O=!0;var d=this.B.power;d&&(d.textContent="Shutdown");this.a&&(qd(this,this.a,b,c,a),this.a.Ya());this.L&&(nd(this,b),b.clear());!c&&this.l&&(this.l.clear(),delete this.l);this.g=0}; +function nd(a,b){if(ka("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;p("http://www.pcjs.org/api/v1/report",d,!0)}} +function rd(a,b,c){var d,f="none";if(a.g)return null;a.g--;var e=new M(a,"1.30.0"),g=new M(a,"1.30.0","validate"),h=ja();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.ya&&(c&&Hb(a.a),d=a.a.ya(b,c),"object"===typeof d&&e.set(a.a.id,d),c&&(a.a.h.O=!1,!1===d&&(f=null)));for(var h=z(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(r){e=null,a=r.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");p(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,r=/( [a-z]+=)(['"])(.*?)\2/g;m=r.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);ud(a,b,c)}})}else c(a,null)} -function vd(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=ha(a))}function e(a){f("Error: "+a);k&&(--rd||va(!0));k=!1}var g,h,k=!0;rd++;Da[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var r=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=m:v.appendChild(document.createTextNode(m));r.appendChild(v)}c|| -(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?sd(c,null,null,!1,f,function(d,k){k?(Ea(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--rd||va(!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),--rd||va(!0)):e("invalid machine element: "+ -a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(d)}):e(d)};"<"!=b.charAt(0)?sd(b,a,d,!0,f,m):td(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(D){e(D.message)}return k}window.embedPDP11=function(a,b,c,d){va(!1);return vd(a,b,c,d)};window.enableEvents=va;window.sendEvent=wa;})(); +l.da=function(a,b,c){var d=this;switch(b){case "power":return this.B[b]=c,c.onclick=function(){d.g||(d.h.O?rd(d,!1,!0):kd(d,d.ab))},!0;case "reset":return this.B[b]=c,c.onclick=function(){if(d.h.O&&!d.g)if(d.b&&!d.s){var a=ka("Click OK to save changes to this PDP11js machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");rd(d,a,!0);!a&&d.H?window&&window.location.reload():d.ab(gd)}else d.reset(),d.a&&d.a.Ya()},!0;case "save":if(ea())c.parentNode.removeChild(c);else return this.B[b]= +c,c.onclick=function(){var a=hd(d,!0);if(a){var b=!!(d.b&&!d.s||d.H),c=rd(d,b);b?sd(d,a,c):d.N("Resume disabled, machine state not saved")}},!0}return!1}; +function hd(a,b){var c=a.f;c||((c=na("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=td(a,c))||a.N("The user ID is invalid.")):b&&a.N("Browser local storage is not available"));return c} +function td(a,b){a.f=null;b=p(fa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(oa("user",b.data),a.f=b.data)}catch(d){r(d.message+" ("+c+")")}return a.f}function jd(a){var b=null;a.f&&(b=fa()+"/api/v1/user?req=load&user="+a.f+"&state="+ud(a,"1.30.0"));return b} +function sd(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=ud(a,"1.30.0");d.data=c;b=p(fa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var f=d.indexOf("\n");0e.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(q){e=null,a=q.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");p(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,q=/( [a-z]+=)(['"])(.*?)\2/g;m=q.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);yd(a,b,c)}})}else c(a,null)} +function zd(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=ha(a))}function e(a){f("Error: "+a);k&&(--vd||va(!0));k=!1}var g,h,k=!0;vd++;Da[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],w=document.createElement("style");w.type="text/css";w.styleSheet?w.styleSheet.cssText=m:w.appendChild(document.createTextNode(m));q.appendChild(w)}c|| +(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?wd(c,null,null,!1,f,function(d,k){k?(Ea(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--vd||va(!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),--vd||va(!0)):e("invalid machine element: "+ +a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(d)}):e(d)};"<"!=b.charAt(0)?wd(b,a,d,!0,f,m):xd(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(D){e(D.message)}return k}window.embedPDP11=function(a,b,c,d){va(!1);return zd(a,b,c,d)};window.enableEvents=va;window.sendEvent=wa;})();