From 1ec60573d51214f6d8df29a2f22300d9ffb9d1bb Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 26 Sep 2016 09:43:05 -0700 Subject: [PATCH] Implemented opJSR, removed more "negative address" tests (eg, in pushWord); bad addresses should result in special exceptions, not negative return values --- modules/pdp11/lib/cpuops.js | 9 +- modules/pdp11/lib/cpustate.js | 1895 ++++++++++++++-------------- modules/pdp11/lib/defines.js | 17 +- modules/pdp11/lib/device.js | 12 +- versions/pdp11/1.30.0/pdp11-dbg.js | 402 +++--- versions/pdp11/1.30.0/pdp11.js | 288 ++--- 6 files changed, 1315 insertions(+), 1308 deletions(-) diff --git a/modules/pdp11/lib/cpuops.js b/modules/pdp11/lib/cpuops.js index d4252d90b..dcfb3ff1c 100644 --- a/modules/pdp11/lib/cpuops.js +++ b/modules/pdp11/lib/cpuops.js @@ -854,10 +854,11 @@ PDP11.opIOT = function(opCode) */ PDP11.opJSR = function(opCode) { - /* - * TODO: Implement - */ - this.regOp = -1; + 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.nStepCycles -= 1; }; diff --git a/modules/pdp11/lib/cpustate.js b/modules/pdp11/lib/cpustate.js index b2e389a5f..618c3d5e4 100644 --- a/modules/pdp11/lib/cpustate.js +++ b/modules/pdp11/lib/cpustate.js @@ -756,33 +756,41 @@ CPUStatePDP11.prototype.panic = function(reason) */ CPUStatePDP11.prototype.trap = function(vector, reason) { - var newPC, newPSW, doubleTrap = 0; + var doubleTrap = false; + if (this.trapPSW < 0) { this.trapPSW = this.getPSW(); - } else { - if (!this.mmuMode) { - vector = 4; - doubleTrap = 1; - } + } else if (!this.mmuMode) { + vector = 4; + doubleTrap = true; } - //LOG_INSTRUCTION(vector, 11, "-trap-"); + if (!(this.MMR0 & 0xe000)) { this.MMR1 = 0xf6f6; this.MMR2 = vector; } - this.mmuMode = 0; // read from kernel D space - if ((newPC = this.readWordFromVirtual(vector | PDP11.ACCESS.DSPACE)) >= 0) { - if ((newPSW = this.readWordFromVirtual(((vector + 2) & 0xffff) | PDP11.ACCESS.DSPACE)) >= 0) { - this.setPSW((newPSW & 0xcfff) | ((this.trapPSW >> 2) & 0x3000)); // set new this.PSW with previous mode - if (doubleTrap) { - this.regCPUErr |= PDP11.CPUERR.RED; - this.regsGen[6] = 4; - } - if (this.pushWord(this.trapPSW) >= 0 && this.pushWord(this.regsGen[7]) >= 0) { - this.regsGen[7] = newPC; - } - } + + /* + * Read from kernel D space + */ + this.mmuMode = 0; + var newPC = this.readWordFromVirtual(vector | PDP11.ACCESS.DSPACE); + var newPSW = this.readWordFromVirtual(((vector + 2) & 0xffff) | PDP11.ACCESS.DSPACE); + + /* + * Set new PSW with previous mode + */ + this.setPSW((newPSW & 0xcfff) | ((this.trapPSW >> 2) & 0x3000)); + + if (doubleTrap) { + this.regCPUErr |= PDP11.CPUERR.RED; + this.regsGen[6] = 4; } + + this.pushWord(this.trapPSW); + this.pushWord(this.regsGen[7]); + this.regsGen[7] = newPC; + this.opFlags &= ~PDP11.OPFLAG.TRAP_MASK; // lose interest in traps after an abort this.trapPSW = -1; // reset flag that we have a trap within a trap throw vector | (reason << 8); @@ -859,8 +867,10 @@ CPUStatePDP11.prototype.mapUnibus = function(unibusAddress) CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFlags) { var page, pdr, physicalAddress, errorMask = 0; + //if (virtualAddress & ~0x1ffff) this.panic(89); // check VA range //if (!accessFlags) this.panic(93); // must have PDP11.ACCESS.READ or PDP11.ACCESS.WRITE + if (!(accessFlags & this.mmuEnable)) { physicalAddress = virtualAddress & 0xffff; // virtual address without MMU is 16 bit (no I&D) this.mmuLastVirtual = physicalAddress; @@ -872,7 +882,6 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFl this.trap(PDP11.TRAP.BUS_ERROR, 22); } } - return physicalAddress; } else { this.mmuLastVirtual = virtualAddress; page = (virtualAddress >> 13) & this.mmuMask[this.mmuMode]; @@ -959,8 +968,8 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFl } } } - return physicalAddress; } + return physicalAddress; }; /** @@ -1093,15 +1102,17 @@ CPUStatePDP11.prototype.popWord = function() * * @this {CPUStatePDP11} * @param {number} data - * @return {number} */ CPUStatePDP11.prototype.pushWord = function(data) { - var physicalAddress, virtualAddress; - this.regsGen[6] = virtualAddress = (this.regsGen[6] - 2) & 0xffff; // BSD needs SP updated before any fault :-( + var virtualAddress = (this.regsGen[6] - 2) & 0xffff; + + this.regsGen[6] = virtualAddress; // BSD needs SP updated before any fault :-( + if (!(this.MMR0 & 0xe000)) { this.MMR1 = (this.MMR1 << 8) | 0xf6; } + if ((!this.mmuMode) && virtualAddress <= this.regSL && virtualAddress > 4) { if (virtualAddress <= this.regSL - 32) { this.regCPUErr |= PDP11.CPUERR.RED; @@ -1112,10 +1123,9 @@ CPUStatePDP11.prototype.pushWord = function(data) this.opFlags |= 4; } } - if ((physicalAddress = this.mapVirtualToPhysical(virtualAddress | PDP11.ACCESS.DSPACE, PDP11.ACCESS.WRITE)) >= 0) { - return this.writeWordToPhysical(physicalAddress, data); - } - return physicalAddress; + + var physicalAddress = this.mapVirtualToPhysical(virtualAddress | PDP11.ACCESS.DSPACE, PDP11.ACCESS.WRITE); + this.writeWordToPhysical(physicalAddress, data); }; @@ -1151,13 +1161,21 @@ CPUStatePDP11.prototype.pushWord = function(data) CPUStatePDP11.prototype.getVirtualByMode = function(addressMode, accessFlags) { var virtualAddress, stepSize, reg = addressMode & 7; + var addrDSpace = (accessFlags & PDP11.ACCESS.VIRT)? 0 : this.addrDSpace; switch ((addressMode >> 3) & 7) { - case 0: // Mode 0: Registers don't have a virtual address so trap! - this.trap(PDP11.TRAP.BUS_ERROR, 34); // trap for invalid virtual address + + /* + * Mode 0: Registers don't have a virtual address so trap + */ + case 0: + this.trap(PDP11.TRAP.BUS_ERROR, 34); break; - case 1: // Mode 1: (R) + /* + * Mode 1: (R) + */ + case 1: if (reg === 6 && (!this.mmuMode) && (accessFlags & PDP11.ACCESS.WRITE) && (this.regsGen[6] <= this.regSL || this.regsGen[6] >= 0xfffe)) { if (this.regsGen[6] <= this.regSL - 32 || this.regsGen[6] >= 0xfffe) { @@ -1169,81 +1187,102 @@ CPUStatePDP11.prototype.getVirtualByMode = function(addressMode, accessFlags) this.opFlags |= PDP11.OPFLAG.TRAP_SP; } } - return (reg === 7 ? this.regsGen[reg] : (this.regsGen[reg] | this.addrDSpace)); + return (reg === 7 ? this.regsGen[reg] : (this.regsGen[reg] | addrDSpace)); - case 2: // Mode 2: (R)+ + /* + * Mode 2: (R)+ + */ + case 2: stepSize = 2; virtualAddress = this.regsGen[reg]; if (reg !== 7) { - virtualAddress |= this.addrDSpace; + virtualAddress |= addrDSpace; if (reg < 6 && (accessFlags & PDP11.ACCESS.BYTE)) { stepSize = 1; } } break; - case 3: // Mode 3: @(R)+ + + /* + * Mode 3: @(R)+ + */ + case 3: stepSize = 2; virtualAddress = this.regsGen[reg]; - if (reg !== 7) virtualAddress |= this.addrDSpace; + if (reg !== 7) virtualAddress |= addrDSpace; if ((virtualAddress = this.readWordFromVirtual(virtualAddress)) < 0) { return virtualAddress; } // if (reg === 7) LOG_ADDRESS(virtualAddress); // @#n not operational - virtualAddress |= this.addrDSpace; + virtualAddress |= addrDSpace; break; - case 4: // Mode 4: -(R) + + /* + * Mode 4: -(R) + */ + case 4: stepSize = -2; if (reg < 6 && (accessFlags & PDP11.ACCESS.BYTE)) stepSize = -1; virtualAddress = (this.regsGen[reg] + stepSize) & 0xffff; if (reg !== 7) { - virtualAddress |= this.addrDSpace; + virtualAddress |= addrDSpace; } break; - case 5: // Mode 5: @-(R) + + /* + * Mode 5: @-(R) + */ + case 5: stepSize = -2; virtualAddress = (this.regsGen[reg] - 2) & 0xffff; - if (reg !== 7) virtualAddress |= this.addrDSpace; + if (reg !== 7) virtualAddress |= addrDSpace; if ((virtualAddress = this.readWordFromVirtual(virtualAddress)) < 0) { return virtualAddress; } - virtualAddress |= this.addrDSpace; + virtualAddress |= addrDSpace; break; - case 6: // Mode 6: d(R) + + /* + * Mode 6: d(R) + */ + case 6: if ((virtualAddress = this.readWordFromVirtual(this.regsGen[7])) < 0) { return virtualAddress; } this.regsGen[7] = (this.regsGen[7] + 2) & 0xffff; if (reg < 7) { - //LOG_ADDRESS(virtualAddress); virtualAddress = (virtualAddress + this.regsGen[reg]) & 0xffff; } else { virtualAddress = (virtualAddress + this.regsGen[reg]) & 0xffff; - //LOG_ADDRESS(virtualAddress); } - return virtualAddress | this.addrDSpace; - case 7: // Mode 7: @d(R) + return virtualAddress | addrDSpace; + + /* + * Mode 7: @d(R) + */ + case 7: if ((virtualAddress = this.readWordFromVirtual(this.regsGen[7])) < 0) { return virtualAddress; } this.regsGen[7] = (this.regsGen[7] + 2) & 0xffff; if (reg < 7) { - //LOG_ADDRESS(virtualAddress); virtualAddress = (virtualAddress + this.regsGen[reg]) & 0xffff; } else { virtualAddress = (virtualAddress + this.regsGen[reg]) & 0xffff; - //LOG_ADDRESS(virtualAddress); } if ((virtualAddress = this.readWordFromVirtual(virtualAddress | PDP11.ACCESS.DSPACE)) < 0) { return virtualAddress; } - return virtualAddress | this.addrDSpace; + return virtualAddress | addrDSpace; } + this.regsGen[reg] = (this.regsGen[reg] + stepSize) & 0xffff; - if (this.addrDSpace && !(this.MMR0 & 0xe000)) { + + if (addrDSpace && !(this.MMR0 & 0xe000)) { this.MMR1 = (this.MMR1 << 8) | ((stepSize << 3) & 0xf8) | reg; } - if (reg === 6 && (!this.mmuMode) && (accessFlags & PDP11.ACCESS.WRITE) && stepSize <= 0 && - (this.regsGen[6] <= this.regSL || this.regsGen[6] >= 0xfffe)) { + + if (reg === 6 && (!this.mmuMode) && (accessFlags & PDP11.ACCESS.WRITE) && stepSize <= 0 && (this.regsGen[6] <= this.regSL || this.regsGen[6] >= 0xfffe)) { if (this.regsGen[6] <= this.regSL - 32) { this.regCPUErr |= PDP11.CPUERR.RED; this.regsGen[6] = 4; @@ -1780,881 +1819,881 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles) // } break; default: - switch (opCode & 0xFE00) /*0177000*/ { // Misc instructions xxRDD - case 0x800: /*04000*/ // JSR 004RDD - //LOG_INSTRUCTION(opCode, 3, "JSR"); - if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - reg = (opCode >> 6) & 7; - if (this.pushWord(this.regsGen[reg]) >= 0) { - this.regsGen[reg] = this.regsGen[7]; - this.regsGen[7] = virtualAddress & 0xffff; - } - } - break; - case 0x7000: /*0070000*/ // MUL 070RSS - //LOG_INSTRUCTION(opCode, 3, "MUL"); - if ((src = this.readWordByMode(opCode)) >= 0) { - reg = (opCode >> 6) & 7; - if (src & 0x8000) src |= ~0xffff; - dst = this.regsGen[reg]; - if (dst & 0x8000) dst |= ~0xffff; - result = ~~(src * dst); - this.regsGen[reg] = (result >> 16) & 0xffff; - this.regsGen[reg | 1] = result & 0xffff; - this.flagN = result >> 16; - this.flagZ = this.flagN | result; - this.flagC = this.flagV = 0; - if (result < -32768 || result > 32767) this.flagC = 0x10000; - } - break; - case 0x7200: /*0071000*/ // DIV 071RSS - //LOG_INSTRUCTION(opCode, 3, "DIV"); - if ((src = this.readWordByMode(opCode)) >= 0) { - if (!src) { - this.flagN = 0; // NZVC - this.flagZ = 0; - this.flagV = 0x8000; - this.flagC = 0x10000; // divide by zero - } else { - reg = (opCode >> 6) & 7; - dst = (this.regsGen[reg] << 16) | this.regsGen[reg | 1]; - this.flagC = this.flagV = 0; - if (src & 0x8000) src |= ~0xffff; - result = ~~(dst / src); - if (result >= -32768 && result <= 32767) { - this.regsGen[reg] = result & 0xffff; - this.regsGen[reg | 1] = (dst - (result * src)) & 0xffff; - this.flagZ = (result >> 16) | result; - this.flagN = result >> 16; - } else { - this.flagV = 0x8000; // overflow - following are indeterminate - this.flagZ = (result >> 15) | result; // dodgy - this.flagN = dst >> 16; // just as dodgy - if (src === -1 && this.regsGen[reg] === - 0xfffe) this.regsGen[reg] = this.regsGen[reg | 1] = 1; // etc - } - } - } - break; - case 0x7400: /*072000*/ // ASH 072RSS - //LOG_INSTRUCTION(opCode, 3, "ASH"); - if ((src = this.readWordByMode(opCode)) >= 0) { - reg = (opCode >> 6) & 7; - result = this.regsGen[reg]; - if (result & 0x8000) result |= 0xffff0000; - this.flagC = this.flagV = 0; - src &= 0x3F; /*077*/ - if (src & 0x20) /*040*/ { // shift right - src = 64 - src; - if (src > 16) src = 16; - this.flagC = result << (17 - src); - result = result >> src; - } else { - if (src) { - if (src > 16) { - this.flagV = result; - result = 0; - } else { - result = result << src; - this.flagC = result; - dst = (result >> 15) & 0xffff; // check successive sign bits - if (dst && dst !== 0xffff) this.flagV = 0x8000; - } - } - } - this.regsGen[reg] = result & 0xffff; - this.flagN = this.flagZ = result; - } - break; - case 0x7600: /*073000*/ // ASHC 073RSS - //LOG_INSTRUCTION(opCode, 3, "ASHC"); - if ((src = this.readWordByMode(opCode)) >= 0) { - reg = (opCode >> 6) & 7; - dst = (this.regsGen[reg] << 16) | this.regsGen[reg | 1]; - this.flagC = this.flagV = 0; - src &= 0x3F; /*077*/ - if (src & 0x20) /*040*/ { - src = 64 - src; - if (src > 32) src = 32; - result = dst >> (src - 1); - this.flagC = result << 16; - result >>= 1; - if (dst & 0x80000000) result |= 0xffffffff << (32 - src); - } else { - if (src) { // shift left - result = dst << (src - 1); - this.flagC = result >> 15; - result <<= 1; - if (src > 32) src = 32; - dst = dst >> (32 - src); - if (dst) { - dst |= (0xffffffff << src) & 0xffffffff; - if (dst !== 0xffffffff) this.flagV = 0x8000; - } - } else { - result = dst; - } - } - this.regsGen[reg] = (result >> 16) & 0xffff; - this.regsGen[reg | 1] = result & 0xffff; - this.flagN = result >> 16; - this.flagZ = result >> 16 | result; - } - break; - case 0x7800: /*0074000*/ // XOR 074RSS - //LOG_INSTRUCTION(opCode, 3, "XOR"); - if (!(opCode & 0x38)) { - dst = this.regsGen[opCode & 7] ^= this.regsGen[(opCode >> 6) & 7]; - this.flagN = this.flagZ = dst; - this.flagV = 0; - } else { - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= 0) { - dst ^= this.regsGen[(opCode >> 6) & 7]; - if (this.writeWordToPhysical(dstAddr, dst) >= 0) { - this.flagN = this.flagZ = dst; - this.flagV = 0; - } - } - } - break; - case 0x7E00: /*0077000*/ // SOB 077Rnn - //LOG_INSTRUCTION(opCode, 5, "SOB"); - reg = (opCode >> 6) & 7; - if ((this.regsGen[reg] = ((this.regsGen[reg] - 1) & 0xffff))) { - this.regsGen[7] = (this.regsGen[7] - ((opCode & 0x3F) /*077*/ << 1)) & 0xffff; - } - break; - default: - switch (opCode & 0xFF00) /*0177400*/ { // Program control instructions & traps - case 0x100: /*0000400*/ // BR - //LOG_INSTRUCTION(opCode, 4, "BR"); - this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x200: /*0001000*/ // BNE - //LOG_INSTRUCTION(opCode, 4, "BNE"); - if (this.flagZ & 0xffff) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x300: /*0001400*/ // BEQ - //LOG_INSTRUCTION(opCode, 4, "BEQ"); - if (!(this.flagZ & 0xffff)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x400: /*0002000*/ // BGE - //LOG_INSTRUCTION(opCode, 4, "BGE"); - if ((this.flagN & 0x8000) === - (this.flagV & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x500: /*0002400*/ // BLT - //LOG_INSTRUCTION(opCode, 4, "BLT"); - if ((this.flagN & 0x8000) !== - (this.flagV & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x600: /*0003000*/ // BGT - //LOG_INSTRUCTION(opCode, 4, "BGT"); - if ((this.flagZ & 0xffff) && ((this.flagN & 0x8000) === - (this.flagV & 0x8000))) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x700: /*0003400*/ // BLE - //LOG_INSTRUCTION(opCode, 4, "BLE"); - if (!(this.flagZ & 0xffff) || ((this.flagN & 0x8000) !== - (this.flagV & 0x8000))) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x8000: /*0100000*/ // BPL - //LOG_INSTRUCTION(opCode, 4, "BPL"); - if (!(this.flagN & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x8200: /*0101000*/ // BHI - //LOG_INSTRUCTION(opCode, 4, "BHI"); - if (!(this.flagC & 0x10000) && - (this.flagZ & 0xffff)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x8100: /*0100400*/ // BMI - //LOG_INSTRUCTION(opCode, 4, "BMI"); - if ((this.flagN & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x8300: /*0101400*/ // BLOS - //LOG_INSTRUCTION(opCode, 4, "BLOS"); - if ((this.flagC & 0x10000) || - !(this.flagZ & 0xffff)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x8400: /*0102000*/ // BVC - //LOG_INSTRUCTION(opCode, 4, "BVC"); - if (!(this.flagV & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x8500: /*0102400*/ // BVS - //LOG_INSTRUCTION(opCode, 4, "BVS"); - if ((this.flagV & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x8600: /*0103000*/ // BCC - //LOG_INSTRUCTION(opCode, 4, "BCC"); - if (!(this.flagC & - 0x10000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x8700: /*0103400*/ // BCS - //LOG_INSTRUCTION(opCode, 4, "BCS"); - if (this.flagC & 0x10000) this.regsGen[7] = this.branch(this.regsGen[7], opCode); - break; - case 0x8800: /*0104000*/ // EMT 104000 -> 104377 - //LOG_INSTRUCTION(opCode, 7, "EMT"); - this.trap(PDP11.TRAP.EMULATOR, /*030*/ 2); - break; - case 0x8900: /*0104400*/ // TRAP 104400 -> 104777 - //LOG_INSTRUCTION(opCode, 7, "TRAP"); - this.trap(PDP11.TRAP.TRAP, /*034*/ 4); - break; - default: - switch (opCode & 0xFFC0) /*0177700*/ { // Single operand instructions xxxxDD - case 0x40: /*0000100*/ // JMP 0001DD - //LOG_INSTRUCTION(opCode, 1, "JMP"); - if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - this.regsGen[7] = virtualAddress & 0xffff; - } - break; - case 0xC0: /*0000300*/ // SWAB 0003DD - //LOG_INSTRUCTION(opCode, 1, "SWAB"); - if (!(opCode & 0x38)) { - reg = opCode & 7; - dst = this.regsGen[reg]; - this.regsGen[reg] = ((dst << 8) | (dst >> 8)) & 0xffff; - this.flagN = this.flagZ = dst & 0xff00; - this.flagV = this.flagC = 0; - } else { - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = (dst << 8) | (dst >> 8); - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagN = this.flagZ = dst & 0xff00; - this.flagV = this.flagC = 0; - } - } - } - break; - case 0xA00: /*0005000*/ // CLR 0050DD - //LOG_INSTRUCTION(opCode, 1, "CLR"); - // if (!(opCode & 0x38)) { - // this.regsGen[opCode & 7] = 0; - // this.flagN = this.flagC = this.flagV = this.flagZ = 0; - // } else { - // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE)) >= 0) { // write word - // if (this.writeWordToPhysical(dstAddr, 0) >= 0) { - // this.flagN = this.flagC = this.flagV = this.flagZ = 0; - // } - // } - // } - break; - case 0xA40: /*0005100*/ // COM 0051DD - //LOG_INSTRUCTION(opCode, 1, "COM"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = ~dst; - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagN = this.flagZ = result; - this.flagC = 0x10000; - this.flagV = 0; - } - } - break; - case 0xA80: /*0005200*/ // INC 0052DD - //LOG_INSTRUCTION(opCode, 1, "INC"); - if (!(opCode & 0x38)) { - reg = opCode & 7; - dst = this.regsGen[reg]; - result = dst + 1; - this.regsGen[reg] = result & 0xffff; - this.flagN = this.flagZ = result; - this.flagV = result & (result ^ dst); - } else { - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = dst + 1; - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagN = this.flagZ = result; - this.flagV = result & (result ^ dst); - } - } - } - break; - case 0xAC0: /*0005300*/ // DEC 0053DD - //LOG_INSTRUCTION(opCode, 1, "DEC"); - if (!(opCode & 0x38)) { - reg = opCode & 7; - dst = this.regsGen[reg]; - result = dst - 1; - this.regsGen[reg] = result & 0xffff; - this.flagN = this.flagZ = result; - this.flagV = (result ^ dst) & dst; - } else { - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = dst - 1; - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagN = this.flagZ = result; - this.flagV = (result ^ dst) & dst; - } - } - } - break; - case 0xB00: /*0005400*/ // NEG 0054DD - //LOG_INSTRUCTION(opCode, 1, "NEG"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = -dst; - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagC = this.flagN = this.flagZ = result; - this.flagV = result & dst; - } - } - break; - case 0xB40: /*0005500*/ // ADC 0055DD - //LOG_INSTRUCTION(opCode, 1, "ADC"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = dst + ((this.flagC >> 16) & 1); - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagC = this.flagN = this.flagZ = result; - this.flagV = result & (result ^ dst); - } - } - break; - case 0xB80: /*0005600*/ // SBC 0056DD - //LOG_INSTRUCTION(opCode, 1, "SBC"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = dst - ((this.flagC >> 16) & 1); - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagC = this.flagN = this.flagZ = result; - this.flagV = (result ^ dst) & dst; - } - } - break; - case 0xBC0: /*0005700*/ // TST 0057DD - //LOG_INSTRUCTION(opCode, 1, "TST"); - if ((dst = this.readWordByMode(opCode)) >= 0) { - this.flagN = this.flagZ = dst; - this.flagC = this.flagV = 0; - } - break; - case 0xC00: /*0006000*/ // ROR 0060DD - //LOG_INSTRUCTION(opCode, 1, "ROR"); - if (!(opCode & 0x38)) { - reg = opCode & 7; - dst = this.regsGen[reg]; - result = ((this.flagC & 0x10000) | dst) >> 1; - this.regsGen[reg] = result & 0xffff; - this.flagC = (dst << 16); - this.flagN = this.flagZ = result; - this.flagV = result ^ (this.flagC >> 1); - } else { - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = ((this.flagC & 0x10000) | dst) >> 1; - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagC = (dst << 16); - this.flagN = this.flagZ = result; - this.flagV = result ^ (this.flagC >> 1); - } - } - } - break; - case 0xC40: /*0006100*/ // ROL 0061DD - //LOG_INSTRUCTION(opCode, 1, "ROL"); - if (!(opCode & 0x38)) { - reg = opCode & 7; - dst = this.regsGen[reg]; - result = (dst << 1) | ((this.flagC >> 16) & 1); - this.regsGen[reg] = result & 0xffff; - this.flagC = this.flagN = this.flagZ = result; - this.flagV = result ^ dst; - } else { - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = (dst << 1) | ((this.flagC >> 16) & 1); - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagC = this.flagN = this.flagZ = result; - this.flagV = result ^ dst; - } - } - } - break; - case 0xC80: /*0006200*/ // ASR 0062DD - //LOG_INSTRUCTION(opCode, 1, "ASR"); - if (!(opCode & 0x38)) { - reg = opCode & 7; - dst = this.regsGen[reg]; - result = (dst & 0x8000) | (dst >> 1); - this.regsGen[reg] = result & 0xffff; - this.flagC = dst << 16; - this.flagN = this.flagZ = result; - this.flagV = this.flagN ^ (this.flagC >> 1); - } else { - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = (dst & 0x8000) | (dst >> 1); - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagC = dst << 16; - this.flagN = this.flagZ = result; - this.flagV = this.flagN ^ (this.flagC >> 1); - } - } - } - break; - case 0xCC0: /*0006300*/ // ASL 0063DD - //LOG_INSTRUCTION(opCode, 1, "ASL"); - if (!(opCode & 0x38)) { - reg = opCode & 7; - dst = this.regsGen[reg]; - result = dst << 1; - this.regsGen[reg] = result & 0xffff; - this.flagC = this.flagN = this.flagZ = result; - this.flagV = result ^ dst; - } else { - if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= - 0) { - result = dst << 1; - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagC = this.flagN = this.flagZ = result; - this.flagV = result ^ dst; - } - } - } - break; - case 0xD00: /*0006400*/ // MARK 0064nn - //LOG_INSTRUCTION(opCode, 8, "MARK"); - virtualAddress = (this.regsGen[7] + ((opCode & 0x3F) /*077*/ << 1)) & 0xffff; - if ((src = this.readWordFromVirtual(virtualAddress | PDP11.ACCESS.DSPACE)) >= 0) { - this.regsGen[7] = this.regsGen[5]; - this.regsGen[5] = src; - this.regsGen[6] = (virtualAddress + 2) & 0xffff; - } - break; - case 0xD40: /*0006500*/ // MFPI 0065SS - //LOG_INSTRUCTION(opCode, 1, "MFPI"); - if (!(opCode & 0x38)) { - reg = opCode & 7; - if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { - src = this.regsGen[reg]; - } else { - src = this.regsAltStack[(this.PSW >> 12) & 3]; - } - if (this.pushWord(src) >= 0) { - this.flagN = this.flagZ = src; - this.flagV = 0; - } - } else { - if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - if ((this.PSW & 0xf000) !== 0xf000) virtualAddress &= 0xffff; - this.mmuMode = (this.PSW >> 12) & 3; - if ((src = this.readWordFromVirtual(virtualAddress)) >= 0) { - this.mmuMode = (this.PSW >> 14) & 3; - if (this.pushWord(src) >= 0) { - this.flagN = this.flagZ = src; - this.flagV = 0; - } - } - } - } - break; - case 0xD80: /*0006600*/ // MTPI 0066DD - //LOG_INSTRUCTION(opCode, 1, "MTPI"); - if ((dst = this.popWord()) >= 0) { - if (!(this.MMR0 & 0xe000)) this.MMR1 = 0x16; /*026*/ - if (!(opCode & 0x38)) { - reg = opCode & 7; - if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { - this.regsGen[reg] = dst; - } else { - this.regsAltStack[(this.PSW >> 12) & 3] = dst; - } - this.flagN = this.flagZ = dst; - this.flagV = 0; - } else { - if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - virtualAddress &= 0xffff; - this.mmuMode = (this.PSW >> 12) & 3; - if ((dstAddr = this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.WRITE)) >= 0) { - this.mmuMode = (this.PSW >> 14) & 3; - if (this.writeWordToPhysical(dstAddr, dst) >= 0) { - this.flagN = this.flagZ = dst; - this.flagV = 0; - } - } - } - } - } - break; - case 0xDC0: /*0006700*/ // SXT 0067DD - //LOG_INSTRUCTION(opCode, 1, "SXT"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE)) >= 0) { // write word - result = -((this.flagN >> 15) & 1); - if (this.writeWordToPhysical(dstAddr, result) >= 0) { - this.flagZ = result; - this.flagV = 0; - } - } - break; - case 0x8A00: /*0105000*/ // CLRB 1050DD - //LOG_INSTRUCTION(opCode, 1, "CLRB"); - // if (!(opCode & 0x38)) { - // this.regsGen[opCode & 7] &= 0xff00; - // this.flagN = this.flagC = this.flagV = this.flagZ = 0; - // } else { - // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE_BYTE)) >= 0) { // write byte - // if (this.writeByteToPhysical(dstAddr, 0) >= 0) { - // this.flagN = this.flagC = this.flagV = this.flagZ = 0; - // } - // } - // } - break; - case 0x8A40: /*0105100*/ // COMB 1051DD - //LOG_INSTRUCTION(opCode, 1, "COMB"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - 0) { - result = ~dst; - if (this.writeByteToPhysical(dstAddr, result) >= 0) { - this.flagN = this.flagZ = result << 8; - this.flagC = 0x10000; - this.flagV = 0; - } - } - break; - case 0x8A80: /*0105200*/ // INCB 1052DD - //LOG_INSTRUCTION(opCode, 1, "INCB"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - 0) { - result = dst + 1; - if (this.writeByteToPhysical(dstAddr, result) >= 0) { - this.flagN = this.flagZ = result << 8; - this.flagV = (result & (result ^ dst)) << 8; - } - } - break; - case 0x8AC0: /*0105300*/ // DECB 1053DD - //LOG_INSTRUCTION(opCode, 1, "DECB"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - 0) { - result = dst - 1; - if (this.writeByteToPhysical(dstAddr, result) >= 0) { - this.flagN = this.flagZ = result << 8; - this.flagV = ((result ^ dst) & dst) << 8; - } - } - break; - case 0x8B00: /*0105400*/ // NEGB 1054DD - //LOG_INSTRUCTION(opCode, 1, "NEGB"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - 0) { - result = -dst; - if (this.writeByteToPhysical(dstAddr, result) >= 0) { - this.flagC = this.flagN = this.flagZ = result << 8; - this.flagV = (result & dst) << 8; - } - } - break; - case 0x8B40: /*0105500*/ // ADCB 01055DD - //LOG_INSTRUCTION(opCode, 1, "ADCB"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - 0) { - result = dst + ((this.flagC >> 16) & 1); - if (this.writeByteToPhysical(dstAddr, result) >= 0) { - this.flagN = this.flagZ = this.flagC = result << 8; - this.flagV = (result & (result ^ dst)) << 8; - } - } - break; - case 0x8B80: /*0105600*/ // SBCB 01056DD - //LOG_INSTRUCTION(opCode, 1, "SBCB"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - 0) { - result = dst - ((this.flagC >> 16) & 1); - if (this.writeByteToPhysical(dstAddr, result) >= 0) { - this.flagN = this.flagZ = this.flagC = result << 8; - this.flagV = ((result ^ dst) & dst) << 8; - } - } - break; - case 0x8BC0: /*0105700*/ // TSTB 1057DD - //LOG_INSTRUCTION(opCode, 1, "TSTB"); - if ((dst = this.readByteByMode(opCode)) >= 0) { - this.flagN = this.flagZ = dst << 8; - this.flagC = this.flagV = 0; - } - break; - case 0x8C00: /*0106000*/ // RORB 1060DD - //LOG_INSTRUCTION(opCode, 1, "RORB"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - 0) { - result = (((this.flagC & 0x10000) >> 8) | dst) >> 1; - if (this.writeByteToPhysical(dstAddr, result) >= 0) { - this.flagC = (dst << 16); - this.flagN = this.flagZ = (result << 8); - this.flagV = this.flagN ^ (this.flagC >> 1); - } - } - break; - case 0x8C40: /*0106100*/ // ROLB 1061DD - //LOG_INSTRUCTION(opCode, 1, "ROLB"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - 0) { - result = (dst << 1) | ((this.flagC >> 16) & 1); - if (this.writeByteToPhysical(dstAddr, result) >= 0) { - this.flagC = this.flagN = this.flagZ = result << 8; - this.flagV = (result ^ dst) << 8; - } - } - break; - case 0x8C80: /*0106200*/ // ASRB 1062DD - //LOG_INSTRUCTION(opCode, 1, "ASRB"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - 0) { - result = (dst & 0x80) | (dst >> 1); - if (this.writeByteToPhysical(dstAddr, result) >= 0) { - this.flagC = dst << 16; - this.flagN = this.flagZ = result << 8; - this.flagV = this.flagN ^ (this.flagC >> 1); - } - } - break; - case 0x8CC0: /*0106300*/ // ASLB 1063DD - //LOG_INSTRUCTION(opCode, 1, "ASLB"); - /* - * TODO: Here's an example where getAddr() could be called in the register-only case. - */ - if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= - 0) { - result = dst << 1; - if (this.writeByteToPhysical(dstAddr, result) >= 0) { - this.flagC = this.flagN = this.flagZ = result << 8; - this.flagV = (result ^ dst) << 8; - } - } - break; - //case 0106400: // MTPS 1064SS - // //LOG_INSTRUCTION(opCode, 1, "MTPS"); - // if ((src = this.readByteByMode(instruction)) >= 0) { - // this.setPSW((this.PSW & 0xff00) | (src & 0xef)); - // } // Temporary PDP 11/34A - // break; - case 0x8D40: /*0106500*/ // MFPD 1065DD - //LOG_INSTRUCTION(opCode, 1, "MFPD"); - if (!(opCode & 0x38)) { - reg = opCode & 7; - if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { - src = this.regsGen[reg]; - } else { - src = this.regsAltStack[(this.PSW >> 12) & 3]; - } - if (this.pushWord(src) >= 0) { - this.flagN = this.flagZ = src; - this.flagV = 0; - } - } else { - if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - this.mmuMode = (this.PSW >> 12) & 3; - if ((src = this.readWordFromVirtual(virtualAddress | PDP11.ACCESS.DSPACE)) >= 0) { - this.mmuMode = (this.PSW >> 14) & 3; - if (this.pushWord(src) >= 0) { - this.flagN = this.flagZ = src; - this.flagV = 0; - } - } - } - } - break; - case 0x8D80: /*0106600*/ // MTPD 1066DD - //LOG_INSTRUCTION(opCode, 1, "MTPD"); - if ((dst = this.popWord()) >= 0) { - if (!(this.MMR0 & 0xe000)) this.MMR1 = 0x16; /*026*/ - if (!(opCode & 0x38)) { - reg = opCode & 7; - if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { - this.regsGen[reg] = dst; - } else { - this.regsAltStack[(this.PSW >> 12) & 3] = dst; - } - this.flagN = this.flagZ = dst; - this.flagV = 0; - } else { - if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { - this.mmuMode = (this.PSW >> 12) & 3; - if ((dstAddr = this.mapVirtualToPhysical(virtualAddress | PDP11.ACCESS.DSPACE, PDP11.ACCESS.WRITE)) >= 0) { - this.mmuMode = (this.PSW >> 14) & 3; - if (this.writeWordToPhysical(dstAddr, dst) >= 0) { - this.flagN = this.flagZ = dst; - this.flagV = 0; - } - } - } - } - } - break; - //case 0106700: // MTFS 1064SS - // //LOG_INSTRUCTION(opCode, 1, "MFPS"); - // src = this.getPSW() & 0xff; - // if (instruction & 0x38) { - // if ((dstAddr = this.getAddr(instruction, PDP11.ACCESS.WRITE_BYTE)) >= 0) { // write byte - // if (this.writeByteToPhysical(dstAddr, src) >= 0) { - // this.flagN = this.flagZ = src << 8; - // this.flagV = 0; - // } - // } - // } else { - // if (src & 0200) src |= 0xff00; - // this.regsGen[instruction & 7] = src; - // this.flagN = this.flagZ = src << 8; - // this.flagV = 0; - // } // Temporary PDP 11/34A - // break; - default: - switch (opCode & 0xFFF8) /*0177770*/ { // Single register instructions xxxxxR (and CC) - case 0x80: /*0000200*/ // RTS 00020R - //LOG_INSTRUCTION(opCode, 6, "RTS"); - if ((src = this.popWord()) >= 0) { - reg = opCode & 7; - this.regsGen[7] = this.regsGen[reg]; - this.regsGen[reg] = src; - } - break; - case 0x98: /*0000230*/ // SPL 00023N - //LOG_INSTRUCTION(opCode, 9, "SPL"); - if (!(this.PSW & 0xc000)) { - this.PSW = (this.PSW & 0xf81f) | ((opCode & 7) << 5); - this.priorityReview = 1; - } - break; - case 0xA0: /*0000240*/ // CLR CC 00024M Part 1 without N - case 0xA8: /*0000250*/ // CLR CC 00025M Part 2 with N - // if (opCode & 1) this.clearCF(); // CLC - // if (opCode & 2) this.clearVF(); // CLV - // if (opCode & 4) this.clearZF(); // CLZ - // if (opCode & 8) this.clearNF(); // CLN - break; - case 0xB0: /*0000260*/ // SET CC 00026M Part 1 without N - case 0xB8: /*0000270*/ // SET CC 00026M Part 2 with N - // if (opCode & 1) this.setCF(); // SEC - // if (opCode & 2) this.setVF(); // SEV - // if (opCode & 4) this.setZF(); // SEZ - // if (opCode & 8) this.setNF(); // SEN - break; - default: // Misc instructions (decode ALL remaining bits) xxxxxx - switch (opCode) { - case 0x0: /*0000000*/ // HALT 000000 - //LOG_INSTRUCTION(opCode, 0, "HALT"); - if (0xc000 & this.PSW) { - this.regCPUErr |= PDP11.CPUERR.BADHALT; - this.trap(PDP11.TRAP.BUS_ERROR, 46); - } else { - this.runState = 3; // halt - this.endBurst(); - //LOG_PRINT(); - console.log("HALT at " + this.regsGen[7].toString(8)); - } - break; - case 0x1: /*0000001*/ // WAIT 000001 - //LOG_INSTRUCTION(opCode, 0, "WAIT"); - j = 0; - if ((i = this.interruptQueue.length) > 0) { - while (i-- > 0) { - j += this.interruptQueue[i].delay; - this.interruptQueue[i].delay = 0; - } - } - if (j === 0 && this.runState === 0) { - this.runState = 2; // wait - this.endBurst(); - } - break; - case 0x3: /*0000003*/ // BPT 000003 - //LOG_INSTRUCTION(opCode, 0, "BPT"); - this.trap(PDP11.TRAP.BREAKPOINT, /*014*/ 6); - break; - case 0x4: /*0000004*/ // IOT 000004 - //LOG_INSTRUCTION(opCode, 0, "IOT"); - this.trap(PDP11.TRAP.IOT, /*020*/ 8); - break; - case 0x5: /*0000005*/ // RESET 000005 - //LOG_INSTRUCTION(opCode, 0, "RESET"); - // if (!(this.PSW & 0xc000)) { - // this.resetRegs(); - // this.bus.reset(); - // // display.data = this.regsGen[0]; // TODO: Review - // } - break; - case 0x2: /*0000002*/ // RTI 000002 - case 0x6: /*0000006*/ // RTT 000006 - //LOG_INSTRUCTION(opCode, 0, "RTT"); - dstAddr = this.regsGen[6]; - if ((virtualAddress = this.readWordFromVirtual(dstAddr | PDP11.ACCESS.DSPACE)) >= 0) { - dstAddr = (dstAddr + 2) & 0xffff; - if ((savePSW = this.readWordFromVirtual(dstAddr | PDP11.ACCESS.DSPACE)) >= 0) { - this.regsGen[6] = (dstAddr + 2) & 0xffff; - savePSW &= 0xf8ff; - if (this.PSW & 0xc000) { // user / super restrictions - // keep SPL and allow lower only for modes and register set - savePSW = (savePSW & 0xf81f) | (this.PSW & 0xf8e0); - } - this.regsGen[7] = virtualAddress; - this.setPSW(savePSW); - this.opFlags &= ~PDP11.OPFLAG.TRAP_TF; - if (opCode === 2) { // RTI enables immediate trace - this.opFlags |= (this.PSW & PDP11.PSW.TF); - } - } - } - break; - //case 0000007: // MFPT 000007 - // //LOG_INSTRUCTION(opCode, 0, "MFPT"); - // this.regsGen[0] = 1; - // break; // Exists on pdp 11/44 & KB11-EM - default: // We don't know this instruction - //LOG_INSTRUCTION(opCode, 11, "-unknown-"); - this.trap(PDP11.TRAP.RESERVED, /*010*/ 48); // reserved instruction - break; - } - } - } - } - } + // switch (opCode & 0xFE00) /*0177000*/ { // Misc instructions xxRDD + // case 0x800: /*04000*/ // JSR 004RDD + // //LOG_INSTRUCTION(opCode, 3, "JSR"); + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // reg = (opCode >> 6) & 7; + // if (this.pushWord(this.regsGen[reg]) >= 0) { + // this.regsGen[reg] = this.regsGen[7]; + // this.regsGen[7] = virtualAddress & 0xffff; + // } + // } + // break; + // case 0x7000: /*0070000*/ // MUL 070RSS + // //LOG_INSTRUCTION(opCode, 3, "MUL"); + // if ((src = this.readWordByMode(opCode)) >= 0) { + // reg = (opCode >> 6) & 7; + // if (src & 0x8000) src |= ~0xffff; + // dst = this.regsGen[reg]; + // if (dst & 0x8000) dst |= ~0xffff; + // result = ~~(src * dst); + // this.regsGen[reg] = (result >> 16) & 0xffff; + // this.regsGen[reg | 1] = result & 0xffff; + // this.flagN = result >> 16; + // this.flagZ = this.flagN | result; + // this.flagC = this.flagV = 0; + // if (result < -32768 || result > 32767) this.flagC = 0x10000; + // } + // break; + // case 0x7200: /*0071000*/ // DIV 071RSS + // //LOG_INSTRUCTION(opCode, 3, "DIV"); + // if ((src = this.readWordByMode(opCode)) >= 0) { + // if (!src) { + // this.flagN = 0; // NZVC + // this.flagZ = 0; + // this.flagV = 0x8000; + // this.flagC = 0x10000; // divide by zero + // } else { + // reg = (opCode >> 6) & 7; + // dst = (this.regsGen[reg] << 16) | this.regsGen[reg | 1]; + // this.flagC = this.flagV = 0; + // if (src & 0x8000) src |= ~0xffff; + // result = ~~(dst / src); + // if (result >= -32768 && result <= 32767) { + // this.regsGen[reg] = result & 0xffff; + // this.regsGen[reg | 1] = (dst - (result * src)) & 0xffff; + // this.flagZ = (result >> 16) | result; + // this.flagN = result >> 16; + // } else { + // this.flagV = 0x8000; // overflow - following are indeterminate + // this.flagZ = (result >> 15) | result; // dodgy + // this.flagN = dst >> 16; // just as dodgy + // if (src === -1 && this.regsGen[reg] === + // 0xfffe) this.regsGen[reg] = this.regsGen[reg | 1] = 1; // etc + // } + // } + // } + // break; + // case 0x7400: /*072000*/ // ASH 072RSS + // //LOG_INSTRUCTION(opCode, 3, "ASH"); + // if ((src = this.readWordByMode(opCode)) >= 0) { + // reg = (opCode >> 6) & 7; + // result = this.regsGen[reg]; + // if (result & 0x8000) result |= 0xffff0000; + // this.flagC = this.flagV = 0; + // src &= 0x3F; /*077*/ + // if (src & 0x20) /*040*/ { // shift right + // src = 64 - src; + // if (src > 16) src = 16; + // this.flagC = result << (17 - src); + // result = result >> src; + // } else { + // if (src) { + // if (src > 16) { + // this.flagV = result; + // result = 0; + // } else { + // result = result << src; + // this.flagC = result; + // dst = (result >> 15) & 0xffff; // check successive sign bits + // if (dst && dst !== 0xffff) this.flagV = 0x8000; + // } + // } + // } + // this.regsGen[reg] = result & 0xffff; + // this.flagN = this.flagZ = result; + // } + // break; + // case 0x7600: /*073000*/ // ASHC 073RSS + // //LOG_INSTRUCTION(opCode, 3, "ASHC"); + // if ((src = this.readWordByMode(opCode)) >= 0) { + // reg = (opCode >> 6) & 7; + // dst = (this.regsGen[reg] << 16) | this.regsGen[reg | 1]; + // this.flagC = this.flagV = 0; + // src &= 0x3F; /*077*/ + // if (src & 0x20) /*040*/ { + // src = 64 - src; + // if (src > 32) src = 32; + // result = dst >> (src - 1); + // this.flagC = result << 16; + // result >>= 1; + // if (dst & 0x80000000) result |= 0xffffffff << (32 - src); + // } else { + // if (src) { // shift left + // result = dst << (src - 1); + // this.flagC = result >> 15; + // result <<= 1; + // if (src > 32) src = 32; + // dst = dst >> (32 - src); + // if (dst) { + // dst |= (0xffffffff << src) & 0xffffffff; + // if (dst !== 0xffffffff) this.flagV = 0x8000; + // } + // } else { + // result = dst; + // } + // } + // this.regsGen[reg] = (result >> 16) & 0xffff; + // this.regsGen[reg | 1] = result & 0xffff; + // this.flagN = result >> 16; + // this.flagZ = result >> 16 | result; + // } + // break; + // case 0x7800: /*0074000*/ // XOR 074RSS + // //LOG_INSTRUCTION(opCode, 3, "XOR"); + // if (!(opCode & 0x38)) { + // dst = this.regsGen[opCode & 7] ^= this.regsGen[(opCode >> 6) & 7]; + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= 0) { + // dst ^= this.regsGen[(opCode >> 6) & 7]; + // if (this.writeWordToPhysical(dstAddr, dst) >= 0) { + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } + // } + // } + // break; + // case 0x7E00: /*0077000*/ // SOB 077Rnn + // //LOG_INSTRUCTION(opCode, 5, "SOB"); + // reg = (opCode >> 6) & 7; + // if ((this.regsGen[reg] = ((this.regsGen[reg] - 1) & 0xffff))) { + // this.regsGen[7] = (this.regsGen[7] - ((opCode & 0x3F) /*077*/ << 1)) & 0xffff; + // } + // break; + // default: + // switch (opCode & 0xFF00) /*0177400*/ { // Program control instructions & traps + // case 0x100: /*0000400*/ // BR + // //LOG_INSTRUCTION(opCode, 4, "BR"); + // this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x200: /*0001000*/ // BNE + // //LOG_INSTRUCTION(opCode, 4, "BNE"); + // if (this.flagZ & 0xffff) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x300: /*0001400*/ // BEQ + // //LOG_INSTRUCTION(opCode, 4, "BEQ"); + // if (!(this.flagZ & 0xffff)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x400: /*0002000*/ // BGE + // //LOG_INSTRUCTION(opCode, 4, "BGE"); + // if ((this.flagN & 0x8000) === + // (this.flagV & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x500: /*0002400*/ // BLT + // //LOG_INSTRUCTION(opCode, 4, "BLT"); + // if ((this.flagN & 0x8000) !== + // (this.flagV & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x600: /*0003000*/ // BGT + // //LOG_INSTRUCTION(opCode, 4, "BGT"); + // if ((this.flagZ & 0xffff) && ((this.flagN & 0x8000) === + // (this.flagV & 0x8000))) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x700: /*0003400*/ // BLE + // //LOG_INSTRUCTION(opCode, 4, "BLE"); + // if (!(this.flagZ & 0xffff) || ((this.flagN & 0x8000) !== + // (this.flagV & 0x8000))) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x8000: /*0100000*/ // BPL + // //LOG_INSTRUCTION(opCode, 4, "BPL"); + // if (!(this.flagN & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x8200: /*0101000*/ // BHI + // //LOG_INSTRUCTION(opCode, 4, "BHI"); + // if (!(this.flagC & 0x10000) && + // (this.flagZ & 0xffff)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x8100: /*0100400*/ // BMI + // //LOG_INSTRUCTION(opCode, 4, "BMI"); + // if ((this.flagN & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x8300: /*0101400*/ // BLOS + // //LOG_INSTRUCTION(opCode, 4, "BLOS"); + // if ((this.flagC & 0x10000) || + // !(this.flagZ & 0xffff)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x8400: /*0102000*/ // BVC + // //LOG_INSTRUCTION(opCode, 4, "BVC"); + // if (!(this.flagV & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x8500: /*0102400*/ // BVS + // //LOG_INSTRUCTION(opCode, 4, "BVS"); + // if ((this.flagV & 0x8000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x8600: /*0103000*/ // BCC + // //LOG_INSTRUCTION(opCode, 4, "BCC"); + // if (!(this.flagC & + // 0x10000)) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x8700: /*0103400*/ // BCS + // //LOG_INSTRUCTION(opCode, 4, "BCS"); + // if (this.flagC & 0x10000) this.regsGen[7] = this.branch(this.regsGen[7], opCode); + // break; + // case 0x8800: /*0104000*/ // EMT 104000 -> 104377 + // //LOG_INSTRUCTION(opCode, 7, "EMT"); + // this.trap(PDP11.TRAP.EMULATOR, /*030*/ 2); + // break; + // case 0x8900: /*0104400*/ // TRAP 104400 -> 104777 + // //LOG_INSTRUCTION(opCode, 7, "TRAP"); + // this.trap(PDP11.TRAP.TRAP, /*034*/ 4); + // break; + // default: + // switch (opCode & 0xFFC0) /*0177700*/ { // Single operand instructions xxxxDD + // case 0x40: /*0000100*/ // JMP 0001DD + // //LOG_INSTRUCTION(opCode, 1, "JMP"); + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // this.regsGen[7] = virtualAddress & 0xffff; + // } + // break; + // case 0xC0: /*0000300*/ // SWAB 0003DD + // //LOG_INSTRUCTION(opCode, 1, "SWAB"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // this.regsGen[reg] = ((dst << 8) | (dst >> 8)) & 0xffff; + // this.flagN = this.flagZ = dst & 0xff00; + // this.flagV = this.flagC = 0; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = (dst << 8) | (dst >> 8); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = dst & 0xff00; + // this.flagV = this.flagC = 0; + // } + // } + // } + // break; + // case 0xA00: /*0005000*/ // CLR 0050DD + // //LOG_INSTRUCTION(opCode, 1, "CLR"); + // // if (!(opCode & 0x38)) { + // // this.regsGen[opCode & 7] = 0; + // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; + // // } else { + // // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE)) >= 0) { // write word + // // if (this.writeWordToPhysical(dstAddr, 0) >= 0) { + // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; + // // } + // // } + // // } + // break; + // case 0xA40: /*0005100*/ // COM 0051DD + // //LOG_INSTRUCTION(opCode, 1, "COM"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = ~dst; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result; + // this.flagC = 0x10000; + // this.flagV = 0; + // } + // } + // break; + // case 0xA80: /*0005200*/ // INC 0052DD + // //LOG_INSTRUCTION(opCode, 1, "INC"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = dst + 1; + // this.regsGen[reg] = result & 0xffff; + // this.flagN = this.flagZ = result; + // this.flagV = result & (result ^ dst); + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = dst + 1; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result; + // this.flagV = result & (result ^ dst); + // } + // } + // } + // break; + // case 0xAC0: /*0005300*/ // DEC 0053DD + // //LOG_INSTRUCTION(opCode, 1, "DEC"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = dst - 1; + // this.regsGen[reg] = result & 0xffff; + // this.flagN = this.flagZ = result; + // this.flagV = (result ^ dst) & dst; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = dst - 1; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result; + // this.flagV = (result ^ dst) & dst; + // } + // } + // } + // break; + // case 0xB00: /*0005400*/ // NEG 0054DD + // //LOG_INSTRUCTION(opCode, 1, "NEG"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = -dst; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result & dst; + // } + // } + // break; + // case 0xB40: /*0005500*/ // ADC 0055DD + // //LOG_INSTRUCTION(opCode, 1, "ADC"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = dst + ((this.flagC >> 16) & 1); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result & (result ^ dst); + // } + // } + // break; + // case 0xB80: /*0005600*/ // SBC 0056DD + // //LOG_INSTRUCTION(opCode, 1, "SBC"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = dst - ((this.flagC >> 16) & 1); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = (result ^ dst) & dst; + // } + // } + // break; + // case 0xBC0: /*0005700*/ // TST 0057DD + // //LOG_INSTRUCTION(opCode, 1, "TST"); + // if ((dst = this.readWordByMode(opCode)) >= 0) { + // this.flagN = this.flagZ = dst; + // this.flagC = this.flagV = 0; + // } + // break; + // case 0xC00: /*0006000*/ // ROR 0060DD + // //LOG_INSTRUCTION(opCode, 1, "ROR"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = ((this.flagC & 0x10000) | dst) >> 1; + // this.regsGen[reg] = result & 0xffff; + // this.flagC = (dst << 16); + // this.flagN = this.flagZ = result; + // this.flagV = result ^ (this.flagC >> 1); + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = ((this.flagC & 0x10000) | dst) >> 1; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = (dst << 16); + // this.flagN = this.flagZ = result; + // this.flagV = result ^ (this.flagC >> 1); + // } + // } + // } + // break; + // case 0xC40: /*0006100*/ // ROL 0061DD + // //LOG_INSTRUCTION(opCode, 1, "ROL"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = (dst << 1) | ((this.flagC >> 16) & 1); + // this.regsGen[reg] = result & 0xffff; + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result ^ dst; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = (dst << 1) | ((this.flagC >> 16) & 1); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result ^ dst; + // } + // } + // } + // break; + // case 0xC80: /*0006200*/ // ASR 0062DD + // //LOG_INSTRUCTION(opCode, 1, "ASR"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = (dst & 0x8000) | (dst >> 1); + // this.regsGen[reg] = result & 0xffff; + // this.flagC = dst << 16; + // this.flagN = this.flagZ = result; + // this.flagV = this.flagN ^ (this.flagC >> 1); + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = (dst & 0x8000) | (dst >> 1); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = dst << 16; + // this.flagN = this.flagZ = result; + // this.flagV = this.flagN ^ (this.flagC >> 1); + // } + // } + // } + // break; + // case 0xCC0: /*0006300*/ // ASL 0063DD + // //LOG_INSTRUCTION(opCode, 1, "ASL"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // dst = this.regsGen[reg]; + // result = dst << 1; + // this.regsGen[reg] = result & 0xffff; + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result ^ dst; + // } else { + // if ((dst = this.readWordFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE))) >= + // 0) { + // result = dst << 1; + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result; + // this.flagV = result ^ dst; + // } + // } + // } + // break; + // case 0xD00: /*0006400*/ // MARK 0064nn + // //LOG_INSTRUCTION(opCode, 8, "MARK"); + // virtualAddress = (this.regsGen[7] + ((opCode & 0x3F) /*077*/ << 1)) & 0xffff; + // if ((src = this.readWordFromVirtual(virtualAddress | PDP11.ACCESS.DSPACE)) >= 0) { + // this.regsGen[7] = this.regsGen[5]; + // this.regsGen[5] = src; + // this.regsGen[6] = (virtualAddress + 2) & 0xffff; + // } + // break; + // case 0xD40: /*0006500*/ // MFPI 0065SS + // //LOG_INSTRUCTION(opCode, 1, "MFPI"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + // src = this.regsGen[reg]; + // } else { + // src = this.regsAltStack[(this.PSW >> 12) & 3]; + // } + // if (this.pushWord(src) >= 0) { + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } + // } else { + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // if ((this.PSW & 0xf000) !== 0xf000) virtualAddress &= 0xffff; + // this.mmuMode = (this.PSW >> 12) & 3; + // if ((src = this.readWordFromVirtual(virtualAddress)) >= 0) { + // this.mmuMode = (this.PSW >> 14) & 3; + // if (this.pushWord(src) >= 0) { + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } + // } + // } + // } + // break; + // case 0xD80: /*0006600*/ // MTPI 0066DD + // //LOG_INSTRUCTION(opCode, 1, "MTPI"); + // if ((dst = this.popWord()) >= 0) { + // if (!(this.MMR0 & 0xe000)) this.MMR1 = 0x16; /*026*/ + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + // this.regsGen[reg] = dst; + // } else { + // this.regsAltStack[(this.PSW >> 12) & 3] = dst; + // } + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } else { + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // virtualAddress &= 0xffff; + // this.mmuMode = (this.PSW >> 12) & 3; + // if ((dstAddr = this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.WRITE)) >= 0) { + // this.mmuMode = (this.PSW >> 14) & 3; + // if (this.writeWordToPhysical(dstAddr, dst) >= 0) { + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } + // } + // } + // } + // } + // break; + // case 0xDC0: /*0006700*/ // SXT 0067DD + // //LOG_INSTRUCTION(opCode, 1, "SXT"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE)) >= 0) { // write word + // result = -((this.flagN >> 15) & 1); + // if (this.writeWordToPhysical(dstAddr, result) >= 0) { + // this.flagZ = result; + // this.flagV = 0; + // } + // } + // break; + // case 0x8A00: /*0105000*/ // CLRB 1050DD + // //LOG_INSTRUCTION(opCode, 1, "CLRB"); + // // if (!(opCode & 0x38)) { + // // this.regsGen[opCode & 7] &= 0xff00; + // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; + // // } else { + // // if ((dstAddr = this.getAddr(opCode, PDP11.ACCESS.WRITE_BYTE)) >= 0) { // write byte + // // if (this.writeByteToPhysical(dstAddr, 0) >= 0) { + // // this.flagN = this.flagC = this.flagV = this.flagZ = 0; + // // } + // // } + // // } + // break; + // case 0x8A40: /*0105100*/ // COMB 1051DD + // //LOG_INSTRUCTION(opCode, 1, "COMB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = ~dst; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result << 8; + // this.flagC = 0x10000; + // this.flagV = 0; + // } + // } + // break; + // case 0x8A80: /*0105200*/ // INCB 1052DD + // //LOG_INSTRUCTION(opCode, 1, "INCB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = dst + 1; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result << 8; + // this.flagV = (result & (result ^ dst)) << 8; + // } + // } + // break; + // case 0x8AC0: /*0105300*/ // DECB 1053DD + // //LOG_INSTRUCTION(opCode, 1, "DECB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = dst - 1; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = result << 8; + // this.flagV = ((result ^ dst) & dst) << 8; + // } + // } + // break; + // case 0x8B00: /*0105400*/ // NEGB 1054DD + // //LOG_INSTRUCTION(opCode, 1, "NEGB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = -dst; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result << 8; + // this.flagV = (result & dst) << 8; + // } + // } + // break; + // case 0x8B40: /*0105500*/ // ADCB 01055DD + // //LOG_INSTRUCTION(opCode, 1, "ADCB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = dst + ((this.flagC >> 16) & 1); + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = this.flagC = result << 8; + // this.flagV = (result & (result ^ dst)) << 8; + // } + // } + // break; + // case 0x8B80: /*0105600*/ // SBCB 01056DD + // //LOG_INSTRUCTION(opCode, 1, "SBCB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = dst - ((this.flagC >> 16) & 1); + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagN = this.flagZ = this.flagC = result << 8; + // this.flagV = ((result ^ dst) & dst) << 8; + // } + // } + // break; + // case 0x8BC0: /*0105700*/ // TSTB 1057DD + // //LOG_INSTRUCTION(opCode, 1, "TSTB"); + // if ((dst = this.readByteByMode(opCode)) >= 0) { + // this.flagN = this.flagZ = dst << 8; + // this.flagC = this.flagV = 0; + // } + // break; + // case 0x8C00: /*0106000*/ // RORB 1060DD + // //LOG_INSTRUCTION(opCode, 1, "RORB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = (((this.flagC & 0x10000) >> 8) | dst) >> 1; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagC = (dst << 16); + // this.flagN = this.flagZ = (result << 8); + // this.flagV = this.flagN ^ (this.flagC >> 1); + // } + // } + // break; + // case 0x8C40: /*0106100*/ // ROLB 1061DD + // //LOG_INSTRUCTION(opCode, 1, "ROLB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = (dst << 1) | ((this.flagC >> 16) & 1); + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result << 8; + // this.flagV = (result ^ dst) << 8; + // } + // } + // break; + // case 0x8C80: /*0106200*/ // ASRB 1062DD + // //LOG_INSTRUCTION(opCode, 1, "ASRB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = (dst & 0x80) | (dst >> 1); + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagC = dst << 16; + // this.flagN = this.flagZ = result << 8; + // this.flagV = this.flagN ^ (this.flagC >> 1); + // } + // } + // break; + // case 0x8CC0: /*0106300*/ // ASLB 1063DD + // //LOG_INSTRUCTION(opCode, 1, "ASLB"); + // /* + // * TODO: Here's an example where getAddr() could be called in the register-only case. + // */ + // if ((dst = this.readByteFromPhysical(dstAddr = this.getAddr(opCode, PDP11.ACCESS.UPDATE_BYTE))) >= + // 0) { + // result = dst << 1; + // if (this.writeByteToPhysical(dstAddr, result) >= 0) { + // this.flagC = this.flagN = this.flagZ = result << 8; + // this.flagV = (result ^ dst) << 8; + // } + // } + // break; + // //case 0106400: // MTPS 1064SS + // // //LOG_INSTRUCTION(opCode, 1, "MTPS"); + // // if ((src = this.readByteByMode(instruction)) >= 0) { + // // this.setPSW((this.PSW & 0xff00) | (src & 0xef)); + // // } // Temporary PDP 11/34A + // // break; + // case 0x8D40: /*0106500*/ // MFPD 1065DD + // //LOG_INSTRUCTION(opCode, 1, "MFPD"); + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + // src = this.regsGen[reg]; + // } else { + // src = this.regsAltStack[(this.PSW >> 12) & 3]; + // } + // if (this.pushWord(src) >= 0) { + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } + // } else { + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // this.mmuMode = (this.PSW >> 12) & 3; + // if ((src = this.readWordFromVirtual(virtualAddress | PDP11.ACCESS.DSPACE)) >= 0) { + // this.mmuMode = (this.PSW >> 14) & 3; + // if (this.pushWord(src) >= 0) { + // this.flagN = this.flagZ = src; + // this.flagV = 0; + // } + // } + // } + // } + // break; + // case 0x8D80: /*0106600*/ // MTPD 1066DD + // //LOG_INSTRUCTION(opCode, 1, "MTPD"); + // if ((dst = this.popWord()) >= 0) { + // if (!(this.MMR0 & 0xe000)) this.MMR1 = 0x16; /*026*/ + // if (!(opCode & 0x38)) { + // reg = opCode & 7; + // if (6 !== reg || ((this.PSW >> 2) & 0x3000) === (this.PSW & 0x3000)) { + // this.regsGen[reg] = dst; + // } else { + // this.regsAltStack[(this.PSW >> 12) & 3] = dst; + // } + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } else { + // if ((virtualAddress = this.getVirtualByMode(opCode, 0)) >= 0) { + // this.mmuMode = (this.PSW >> 12) & 3; + // if ((dstAddr = this.mapVirtualToPhysical(virtualAddress | PDP11.ACCESS.DSPACE, PDP11.ACCESS.WRITE)) >= 0) { + // this.mmuMode = (this.PSW >> 14) & 3; + // if (this.writeWordToPhysical(dstAddr, dst) >= 0) { + // this.flagN = this.flagZ = dst; + // this.flagV = 0; + // } + // } + // } + // } + // } + // break; + // //case 0106700: // MTFS 1064SS + // // //LOG_INSTRUCTION(opCode, 1, "MFPS"); + // // src = this.getPSW() & 0xff; + // // if (instruction & 0x38) { + // // if ((dstAddr = this.getAddr(instruction, PDP11.ACCESS.WRITE_BYTE)) >= 0) { // write byte + // // if (this.writeByteToPhysical(dstAddr, src) >= 0) { + // // this.flagN = this.flagZ = src << 8; + // // this.flagV = 0; + // // } + // // } + // // } else { + // // if (src & 0200) src |= 0xff00; + // // this.regsGen[instruction & 7] = src; + // // this.flagN = this.flagZ = src << 8; + // // this.flagV = 0; + // // } // Temporary PDP 11/34A + // // break; + // default: + // switch (opCode & 0xFFF8) /*0177770*/ { // Single register instructions xxxxxR (and CC) + // case 0x80: /*0000200*/ // RTS 00020R + // //LOG_INSTRUCTION(opCode, 6, "RTS"); + // if ((src = this.popWord()) >= 0) { + // reg = opCode & 7; + // this.regsGen[7] = this.regsGen[reg]; + // this.regsGen[reg] = src; + // } + // break; + // case 0x98: /*0000230*/ // SPL 00023N + // //LOG_INSTRUCTION(opCode, 9, "SPL"); + // if (!(this.PSW & 0xc000)) { + // this.PSW = (this.PSW & 0xf81f) | ((opCode & 7) << 5); + // this.priorityReview = 1; + // } + // break; + // case 0xA0: /*0000240*/ // CLR CC 00024M Part 1 without N + // case 0xA8: /*0000250*/ // CLR CC 00025M Part 2 with N + // // if (opCode & 1) this.clearCF(); // CLC + // // if (opCode & 2) this.clearVF(); // CLV + // // if (opCode & 4) this.clearZF(); // CLZ + // // if (opCode & 8) this.clearNF(); // CLN + // break; + // case 0xB0: /*0000260*/ // SET CC 00026M Part 1 without N + // case 0xB8: /*0000270*/ // SET CC 00026M Part 2 with N + // // if (opCode & 1) this.setCF(); // SEC + // // if (opCode & 2) this.setVF(); // SEV + // // if (opCode & 4) this.setZF(); // SEZ + // // if (opCode & 8) this.setNF(); // SEN + // break; + // default: // Misc instructions (decode ALL remaining bits) xxxxxx + // switch (opCode) { + // case 0x0: /*0000000*/ // HALT 000000 + // //LOG_INSTRUCTION(opCode, 0, "HALT"); + // if (0xc000 & this.PSW) { + // this.regCPUErr |= PDP11.CPUERR.BADHALT; + // this.trap(PDP11.TRAP.BUS_ERROR, 46); + // } else { + // this.runState = 3; // halt + // this.endBurst(); + // //LOG_PRINT(); + // console.log("HALT at " + this.regsGen[7].toString(8)); + // } + // break; + // case 0x1: /*0000001*/ // WAIT 000001 + // //LOG_INSTRUCTION(opCode, 0, "WAIT"); + // j = 0; + // if ((i = this.interruptQueue.length) > 0) { + // while (i-- > 0) { + // j += this.interruptQueue[i].delay; + // this.interruptQueue[i].delay = 0; + // } + // } + // if (j === 0 && this.runState === 0) { + // this.runState = 2; // wait + // this.endBurst(); + // } + // break; + // case 0x3: /*0000003*/ // BPT 000003 + // //LOG_INSTRUCTION(opCode, 0, "BPT"); + // this.trap(PDP11.TRAP.BREAKPOINT, /*014*/ 6); + // break; + // case 0x4: /*0000004*/ // IOT 000004 + // //LOG_INSTRUCTION(opCode, 0, "IOT"); + // this.trap(PDP11.TRAP.IOT, /*020*/ 8); + // break; + // case 0x5: /*0000005*/ // RESET 000005 + // //LOG_INSTRUCTION(opCode, 0, "RESET"); + // // if (!(this.PSW & 0xc000)) { + // // this.resetRegs(); + // // this.bus.reset(); + // // // display.data = this.regsGen[0]; // TODO: Review + // // } + // break; + // case 0x2: /*0000002*/ // RTI 000002 + // case 0x6: /*0000006*/ // RTT 000006 + // //LOG_INSTRUCTION(opCode, 0, "RTT"); + // dstAddr = this.regsGen[6]; + // if ((virtualAddress = this.readWordFromVirtual(dstAddr | PDP11.ACCESS.DSPACE)) >= 0) { + // dstAddr = (dstAddr + 2) & 0xffff; + // if ((savePSW = this.readWordFromVirtual(dstAddr | PDP11.ACCESS.DSPACE)) >= 0) { + // this.regsGen[6] = (dstAddr + 2) & 0xffff; + // savePSW &= 0xf8ff; + // if (this.PSW & 0xc000) { // user / super restrictions + // // keep SPL and allow lower only for modes and register set + // savePSW = (savePSW & 0xf81f) | (this.PSW & 0xf8e0); + // } + // this.regsGen[7] = virtualAddress; + // this.setPSW(savePSW); + // this.opFlags &= ~PDP11.OPFLAG.TRAP_TF; + // if (opCode === 2) { // RTI enables immediate trace + // this.opFlags |= (this.PSW & PDP11.PSW.TF); + // } + // } + // } + // break; + // //case 0000007: // MFPT 000007 + // // //LOG_INSTRUCTION(opCode, 0, "MFPT"); + // // this.regsGen[0] = 1; + // // break; // Exists on pdp 11/44 & KB11-EM + // default: // We don't know this instruction + // //LOG_INSTRUCTION(opCode, 11, "-unknown-"); + // this.trap(PDP11.TRAP.RESERVED, /*010*/ 48); // reserved instruction + // break; + // } + // } + // } + // } + // } } } } while (this.nStepCycles > 0); diff --git a/modules/pdp11/lib/defines.js b/modules/pdp11/lib/defines.js index bee0a0997..22004fd54 100644 --- a/modules/pdp11/lib/defines.js +++ b/modules/pdp11/lib/defines.js @@ -203,6 +203,10 @@ var PDP11 = { MASK: 0x0FC0, SHIFT: 6 }, + REG: { + SP: 6, + PC: 7, + }, /* * PDP-11 trap vectors */ @@ -222,12 +226,13 @@ var PDP11 = { * Internal memory access flags */ ACCESS: { - WORD: 0x0, - BYTE: 0x1, - READ: 0x2, - WRITE: 0x4, - UPDATE: 0x6, - DSPACE: 0x10000 // set bit 17 in any 16-bit virtual address that refers to D space (as opposed to I space) + WORD: 0x00, + BYTE: 0x01, + READ: 0x02, + WRITE: 0x04, + UPDATE: 0x06, + VIRT: 0x08, // getVirtualByMode() leaves bit 17 clear if this is set (otherwise the caller would have to clear it again) + DSPACE: 0x10000, // getVirtualByMode() sets bit 17 in any 16-bit virtual address that refers to D space (as opposed to I space) }, /* * Internal flags passed to writeByteByMode(), etc. diff --git a/modules/pdp11/lib/device.js b/modules/pdp11/lib/device.js index 4b7848123..a65d86690 100644 --- a/modules/pdp11/lib/device.js +++ b/modules/pdp11/lib/device.js @@ -48,8 +48,8 @@ if (NODE) { * name: the name of the device to be supported (eg, "unibus" for generic UNIBUS support) * * TODO: This is currently a "catch-all" device; ideally, each of the assorted devices emulated here - * (eg, KW11, RK11, RL11, etc) would be a separate component. But because we're in the middle of porting - * all this code from a common module (iopage.js), that's the way it is. + * (eg, DL11, KW11, RK11, RL11, etc) would be a separate component. But because we're in the middle of + * porting all this code from a common module (iopage.js), that's the way it is. * * @constructor * @extends Component @@ -63,7 +63,7 @@ function DevicePDP11(parmsDevice) this.tty = { rbuf: [], rcsr: 0, - xcsr: 0x80, /*0200*/ + xcsr: PDP11.DL11.XCSR.READY, delCode: 127, del: 0 }; @@ -248,17 +248,17 @@ DevicePDP11.prototype.readXCSR = function(addr) DevicePDP11.prototype.writeXCSR = function(data, addr) { /* - * If the device is READY and INT_ENABLE is transitioning to *set*, generate an interrupt. + * If the device is READY, and INT_ENABLE is transitioning to *set*, then generate an interrupt. */ - var device = this; if ((this.tty.xcsr & (PDP11.DL11.XCSR.READY | PDP11.DL11.XCSR.INT_ENABLE)) == PDP11.DL11.XCSR.READY && (data & PDP11.DL11.XCSR.INT_ENABLE)) { + var device = this; this.cpu.interrupt(PDP11.DL11.DELAY, PDP11.DL11.PRI, PDP11.DL11.VEC, function() { device.tty.xcsr |= PDP11.DL11.XCSR.READY; return !!(device.tty.xcsr & PDP11.DL11.XCSR.INT_ENABLE); }); } /* - * In any event, update all bits from data *except* for READY. + * In any event, propagate all bits from data *except* for READY. */ this.tty.xcsr = (this.tty.xcsr & PDP11.DL11.XCSR.READY) | (data & ~PDP11.DL11.XCSR.READY); }; diff --git a/versions/pdp11/1.30.0/pdp11-dbg.js b/versions/pdp11/1.30.0/pdp11-dbg.js index a23d29470..cb9efeddc 100644 --- a/versions/pdp11/1.30.0/pdp11-dbg.js +++ b/versions/pdp11/1.30.0/pdp11-dbg.js @@ -1,217 +1,197 @@ (function(){var l; -function ba(a,b){var d;if(a){b||(b=10);var c=a.charAt(0),e=0>=3;return(d?"0o":"")+c}function r(a,b,d){var c="";b?8=e?48:55),c=String.fromCharCode(e)+c;a>>=4}return(d?"0x":"")+c} -function da(a){var b=a,d=a.lastIndexOf("/");0<=d&&(b=a.substr(d+1));d=b.indexOf("&");0":">",'"':""","'":"'"};function ma(a){return a.replace(/[&<>"']/g,function(a){return la[a]})}function na(a,b){return(a+" ").slice(0,b)} -function oa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function qa(a,b,d){var c=0,e=a.length,f=0;for(d||(d=function(a,b){return a>b?1:a>1,h;h=d(b,a[g]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} -function ta(a,b,d,c){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return c&&c(a,f,e),[f,e];if(d&&"function"==typeof resources)return resources(a,function(b,d){c&&c(a,b,d)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");d&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),c&&c(a,f,e))});if(b&&"object"== -typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encodeURIComponent(b[m]));k=k.replace(/%20/g,"+");h.open("POST",a,!!d);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k)}else h.open("GET",a,!!d),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();d||(f=h.responseText,200!=h.status&&(e=h.status||-1),c&&c(a,f,e),g=[f,e]);return g}function ka(){return"http://"+(window?window.location.host:"www.pcjs.org")} -function t(a){window&&window.alert(a)}function xa(a){var b=!1;window&&(b=window.confirm(a));return b}var ya=null;function za(){if(null==ya){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}ya=a}return ya}function Aa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(d){}return b} -function Ba(a,b){try{return window.localStorage.setItem(a,b),!0}catch(d){}return!1}function Ca(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Da(a,b,d){function c(){--a;0<=a&&(b()||(a=0));0b?this.Fb=this.id:(this.tc=this.id.substr(0,b),this.Fb=this.id.substr(b+1));this[a]=d;this.j={ready:!1,qb:!1,ic:!1,ga:!1,error:!1};this.ac=null;this.j.error=!1;this.P={};this.I=null;this.ja=c||0;v.push(this)}var Sa=void 0,Ta={}; -if(window){Sa||(Sa=window.location.search.substr(1));for(var Ua,Va=/\+/g,Wa=/([^&=]+)=?([^&]*)/g;Ua=Wa.exec(Sa);)Ta[decodeURIComponent(Ua[1].replace(Va," "))]=decodeURIComponent(Ua[2].replace(Va," "))}function Xa(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var d=typeof a;if("object"!==d&&"function"!==d)throw new TypeError;}b.prototype=a;return new b} -function w(a,b){b||(b=u);a.prototype=Xa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ya=window.PCjs.Machines||(window.PCjs.Machines={}),v=window.PCjs.Components||(window.PCjs.Components=[])}else Ya={},v=[];function Za(a,b,d){Ya[a]&&b&&(Ya[a][b]=d)}function $a(a){var b,d=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1)+2;10>this.Z&&(this.Z=10);15>2;this.g=this.Da-1;this.u=this.G/this.Da|0;this.w=this.u-1;this.Wa=[];this.J=null;this.Lb=this.Fc;a=new I;zb(a,this.I);this.S=Array(this.u);for(b=0;b>8:c[2](b)&255}else if(b&1&&(c=d.Wa[a&-2],c[2]))return c[2](b&-2)>>8;d.i("warning: unconverted read access to byte @"+ca(b));return d.Lb(b,-1,1)} -function Bb(a,b,d){var c=this.controller,e=c.Wa[a];if(e){if(e[1]){e[1](b,d);return}if(e[3]){a=e[2]?e[2](d):0;if(d&1)e[3](a&255|b<<8,d&-2);else e[3](a&-256|b,d);return}}else if(d&1&&(e=c.Wa[a&-2],e[3])){d&=-2;a=e[2]?e[2](d):0;e[3](a&255|b<<8,d);return}c.i("warning: unconverted write access to byte @"+ca(d));c.Lb(d,b,1)} -function Cb(a,b){var d=this.controller;if(a=d.Wa[a]){if(a[2])return a[2](b);if(a[0])return a[0](b)|a[0](b+1)<<8}d.i("warning: unconverted read access to word @"+ca(b));return d.Lb(b,-1,0)}function Db(a,b,d){var c=this.controller;if(a=c.Wa[a]){if(a[3]){a[3](b,d);return}if(a[1]){a[1](b&255,d);a[1](b>>8,d+1);return}}c.i("warning: unconverted write access to word @"+ca(d));c.Lb(d,b,0)}l=yb.prototype;l.reset=function(){this.J&&this.J()};l.Fc=function(){return 0};l.Qa=function(a,b){b||this.reset();return!0}; -function Eb(a,b,d,c,e){for(var f=b,g=d,h=f>>>a.Z;0g&&(n=g);if(k&&k.size){if(k.type==c&&k.controller==e){if(f+g<=k.A)return k.Zb+=k.A-f,k.A=f,!0;if(f>=k.A+k.Zb){n=k.size-(f-m);n>g&&(n=g);k.Zb=f-k.A+n;f=m+a.Da;g-=n;h++;continue}}return Gb(1,f,g)}f=new I(f,n,a.Da,c,e);zb(f,a.I,k);a.S[h++]=f;f=m+a.Da;g-=n}return 0>=g?(a.status(Math.floor(d/1024)+"Kb "+Hb[c]+" at "+r(b,8,!0)),!0):Gb(2,b,d)} -l.Mb=function(a){return this.S[(a&this.H)>>>this.Z].wb(a&this.g,a)};l.La=function(a){var b=a&this.g,d=(a&this.H)>>>this.Z;return b!=this.g?this.S[d].Tb(b,a):this.S[d++].wb(b,a)|this.S[d&this.w].wb(0,a+1)<<8};function Ib(a,b){var d=b&a.g,c=(b&a.H)>>>a.Z;return d!=a.g?a.S[c].mc(d,b):a.S[c++].Sb(d,b)|a.S[c&a.w].Sb(0,b+1)<<8}l.gc=function(a,b){this.S[(a&this.H)>>>this.Z].Bb(a&this.g,b&255,a)}; -l.oc=function(a,b){var d=a&this.g,c=(a&this.H)>>>this.Z;d!=this.g?this.S[c].Ec(d,b&65535,a):(this.S[c++].Bb(d,b&255,a),this.S[c&this.w].Bb(0,b>>8&255,a+1))};function Jb(a){for(var b=0,d=[],c=0;c>=3;return(d?"0o":"")+c}function r(a,b,d){var c="";b?8=f?48:55),c=String.fromCharCode(f)+c;a>>=4}return(d?"0x":"")+c} +function da(a){var b=a,d=a.lastIndexOf("/");0<=d&&(b=a.substr(d+1));d=b.indexOf("&");0":">",'"':""","'":"'"};function ja(a){return a.replace(/[&<>"']/g,function(a){return ia[a]})}function ka(a,b){return(a+" ").slice(0,b)} +function la(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function pa(a,b,d){var c=0,f=a.length,e=0;for(d||(d=function(a,b){return a>b?1:a>1,h;h=d(b,a[g]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} +function sa(a,b,d,c){var f=0,e=null,g=null;if("object"==typeof resources&&(e=resources[a]))return c&&c(a,e,f),[e,f];if(d&&"function"==typeof resources)return resources(a,function(b,d){c&&c(a,b,d)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");d&&(h.onreadystatechange=function(){4===h.readyState&&(e=h.responseText,200==h.status||!h.status&&e.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),c&&c(a,e,f))});if(b&&"object"== +typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encodeURIComponent(b[m]));k=k.replace(/%20/g,"+");h.open("POST",a,!!d);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k)}else h.open("GET",a,!!d),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();d||(e=h.responseText,200!=h.status&&(f=h.status||-1),c&&c(a,e,f),g=[e,f]);return g}function ga(){return"http://"+(window?window.location.host:"www.pcjs.org")} +function t(a){window&&window.alert(a)}function ta(a){var b=!1;window&&(b=window.confirm(a));return b}var ua=null;function va(){if(null==ua){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}ua=a}return ua}function wa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(d){}return b} +function xa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(d){}return!1}function Ca(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Da(a,b,d){function c(){--a;0<=a&&(b()||(a=0));0b?this.Eb=this.id:(this.sc=this.id.substr(0,b),this.Eb=this.id.substr(b+1));this[a]=d;this.u={ready:!1,pb:!1,hc:!1,ba:!1,error:!1};this.Zb=null;this.u.error=!1;this.J={};this.C=null;this.ca=c||0;v.push(this)}var Oa=void 0,Pa={}; +if(window){Oa||(Oa=window.location.search.substr(1));for(var Qa,Ra=/\+/g,Sa=/([^&=]+)=?([^&]*)/g;Qa=Sa.exec(Oa);)Pa[decodeURIComponent(Qa[1].replace(Ra," "))]=decodeURIComponent(Qa[2].replace(Ra," "))}function Ta(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var d=typeof a;if("object"!==d&&"function"!==d)throw new TypeError;}b.prototype=a;return new b} +function w(a,b){b||(b=u);a.prototype=Ta(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ua=window.PCjs.Machines||(window.PCjs.Machines={}),v=window.PCjs.Components||(window.PCjs.Components=[])}else Ua={},v=[];function Va(a,b,d){Ua[a]&&b&&(Ua[a][b]=d)}function gb(a){var b,d=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1)+2;10>this.R&&(this.R=10);15>2;this.A=this.za-1;this.B=this.D/this.za|0;this.j=this.B-1;this.Ta=[];this.F=null;this.Jb=this.Fc;a=new G;xb(a,this.C);this.L=Array(this.B);for(b=0;b>8:c[2](b)&255}else if(b&1&&(c=d.Ta[a&-2],c[2]))return c[2](b&-2)>>8;d.f("warning: unconverted read access to byte @"+ca(b));return d.Jb(b,-1,1)} +function zb(a,b,d){var c=this.controller,f=c.Ta[a];if(f){if(f[1]){f[1](b,d);return}if(f[3]){a=f[2]?f[2](d):0;if(d&1)f[3](a&255|b<<8,d&-2);else f[3](a&-256|b,d);return}}else if(d&1&&(f=c.Ta[a&-2],f[3])){d&=-2;a=f[2]?f[2](d):0;f[3](a&255|b<<8,d);return}c.f("warning: unconverted write access to byte @"+ca(d));c.Jb(d,b,1)} +function Ab(a,b){var d=this.controller;if(a=d.Ta[a]){if(a[2])return a[2](b);if(a[0])return a[0](b)|a[0](b+1)<<8}d.f("warning: unconverted read access to word @"+ca(b));return d.Jb(b,-1,0)}function Bb(a,b,d){var c=this.controller;if(a=c.Ta[a]){if(a[3]){a[3](b,d);return}if(a[1]){a[1](b&255,d);a[1](b>>8,d+1);return}}c.f("warning: unconverted write access to word @"+ca(d));c.Jb(d,b,0)}l=wb.prototype;l.reset=function(){this.F&&this.F()};l.Fc=function(){return 0};l.La=function(a,b){b||this.reset();return!0}; +function Cb(a,b,d,c,f){for(var e=b,g=d,h=e>>>a.R;0g&&(n=g);if(k&&k.size){if(k.type==c&&k.controller==f){if(e+g<=k.w)return k.Xb+=k.w-e,k.w=e,!0;if(e>=k.w+k.Xb){n=k.size-(e-m);n>g&&(n=g);k.Xb=e-k.w+n;e=m+a.za;g-=n;h++;continue}}return Pb(1,e,g)}e=new G(e,n,a.za,c,f);xb(e,a.C,k);a.L[h++]=e;e=m+a.za;g-=n}return 0>=g?(a.status(Math.floor(d/1024)+"Kb "+Qb[c]+" at "+r(b,8,!0)),!0):Pb(2,b,d)} +l.Kb=function(a){return this.L[(a&this.g)>>>this.R].vb(a&this.A,a)};l.Ea=function(a){var b=a&this.A,d=(a&this.g)>>>this.R;return b!=this.A?this.L[d].Rb(b,a):this.L[d++].vb(b,a)|this.L[d&this.j].vb(0,a+1)<<8};function Rb(a,b){var d=b&a.A,c=(b&a.g)>>>a.R;return d!=a.A?a.L[c].lc(d,b):a.L[c++].Qb(d,b)|a.L[c&a.j].Qb(0,b+1)<<8}l.fc=function(a,b){this.L[(a&this.g)>>>this.R].Ab(a&this.A,b&255,a)}; +l.nc=function(a,b){var d=a&this.A,c=(a&this.g)>>>this.R;d!=this.A?this.L[c].Ec(d,b&65535,a):(this.L[c++].Ab(d,b&255,a),this.L[c&this.j].Ab(0,b>>8&255,a+1))};function Sb(a){for(var b=0,d=[],c=0;c>13&7;"undefined"===typeof b.ra[f]&&(b.ra[f]={cache:[],postProcess:a.ad,drive:f,blocksize:256,mapped:0,maxblock:b.gb[f]*b.aa[f],url:"rk"+f+".dsk"});b.T&=-129;switch(b.T>>1&7){case 0:b.Vb=2496;b.oa=0;b.T=128;b.va=0;break;case 1:if((b.va>>4&511)>=b.gb[f]){b.oa|=32832;b.T|=49152;break}if((b.va&15)>=b.aa[f]){b.oa|=32800;b.T|=49152;break}d=(b.va>>4&511)*b.aa[f]+(b.va&15);c=(b.T&48)<<12|b.Ub;e=65536-b.Wb&65535;ac(a,b.ra[f],d,c,e);return;case 2:if((b.va>>4&511)>=b.gb[f])b.oa|= -32832,b.T|=49152;else if((b.va&15)>=b.aa[f])b.oa|=32800,b.T|=49152;else{d=(b.va>>4&511)*b.aa[f]+(b.va&15);c=(b.T&48)<<12|b.Ub;e=65536-b.Wb&65535;a.dc(b.ra[f],d,c,e);return}}b.Vb=f<<13|b.Vb&8176|b.va%9&15;J(a.b,20,5,144,function(){b.T=b.T&65534|128;return!!(b.T&64)})}l.ad=function(a,b,d,c,e){var f=this.G;f.Ub=c&65535;f.T=f.T&-49|c>>12&48;f.Wb=65536-e&65535;switch(a){case 1:f.oa|=33024;f.T|=49152;break;case 2:f.oa|=33792,f.T|=49152}J(this.b,20,5,144,function(){f.T=f.T&65534|128;return!!(f.T&64)})}; -function bc(a){var b=a.J,d,c,e,f=b.K>>8&3;b.K&=-2;"undefined"===typeof b.ra[f]&&(b.ra[f]={cache:[],postProcess:a.bd,drive:f,blocksize:128,mapped:1,maxblock:b.gb[f]*b.aa[f],url:"rl"+f+".dsk"});switch(b.K>>1&7){case 2:b.ab&8&&(b.K&=63);b.ab=b.Hc[f]|b.eb&64;break;case 3:1==(b.fa&3)&&(b.eb=b.fa&4?b.eb+(b.fa&65408)&65408|b.fa<<2&64:b.eb-(b.fa&65408)&65408|b.fa<<2&64,b.fa=b.eb);break;case 4:b.ab=b.eb;break;case 5:if(b.fa>>6>=b.gb[f]){b.K|=37888;break}if((b.fa&63)>=b.aa[f]){b.K|=37888;break}d=(b.fa>>6)* -b.aa[f]+(b.fa&63);c=(b.Xa&63)<<16|b.Jb;e=65536-b.ab&65535;ac(a,b.ra[f],d,c,e);return;case 6:if(b.fa>>6>=b.gb[f])b.K|=37888;else if((b.fa&63)>=b.aa[f])b.K|=37888;else{d=(b.fa>>6)*b.aa[f]+(b.fa&63);c=(b.Xa&63)<<16|b.Jb;e=65536-b.ab&65535;a.dc(b.ra[f],d,c,e);return}}J(a.b,20,5,112,function(){b.K|=129;return!!(b.K&64)})} -l.bd=function(a,b,d,c,e){var f=this.J;f.Jb=c&65535;f.K=f.K&-49|c>>12&48;f.Xa=c>>16&63;f.fa=~~(d/f.aa[b.Oa])<<6|d%f.aa[b.Oa];f.eb=f.fa;f.ab=65536-e&65535;switch(a){case 1:f.K|=33792;break;case 2:f.K|=40960}J(this.b,20,5,112,function(){f.K|=129;return!!(f.K&64)})};function cc(a){a=a.O;a.U=2176;a.Ea=0;a.ta=[4544,4544,4544,4544,4544,4544,4544,4544];a.yb=[0,0,0,0,0,0,0,0];a.nb=a.zb=a.xb=a.cb=a.nc=0} -function dc(a,b){var d=a.O,c,e,f;d.U&=-16513;d.Ea&=-2049;d.ta[b]&=-1153;J(a.b,-1,0,172);"undefined"===typeof d.ra[b]&&(d.ra[b]={cache:[],postProcess:a.cd,drive:b,blocksize:256,mapped:0,maxblock:d.hc[0]*d.fb[0]*d.aa[0],url:"rp"+b+".dsk"});switch(d.U&63){case 5:d.fc[b]=d.Ta[b];d.U|=32896;d.ta[b]|=32896;d.nb|=1<=d.hc[0]||d.Fa[b]>>8>=d.fb[0]||(d.Fa[b]&255)>=d.aa[0]){d.yb[b]|=1024;d.U|=49152;break}c=(d.Ta[b]*d.fb[0]+(d.Fa[b]>>8))* -d.aa[0]+(d.Fa[b]&255);e=(d.cb&63)<<16|d.xb;f=65536-d.zb&65535;ac(a,d.ra[b],c,e,f);return;case 57:if(d.Ta[b]>=d.hc[0]||d.Fa[b]>>8>=d.fb[0]||(d.Fa[b]&255)>=d.aa[0])d.yb[b]|=1024,d.U|=49152;else{c=(d.Ta[b]*d.fb[0]+(d.Fa[b]>>8))*d.aa[0]+(d.Fa[b]&255);e=(d.cb&63)<<16|d.xb;f=65536-d.zb&65535;a.dc(d.ra[b],c,e,f);return}}J(a.b,3,5,172,function(){d.U=d.U&65534|128;d.ta[b]|=128;return!!(d.U&64)})} -l.cd=function(a,b,d,c,e){var f=this.O;f.zb=65536-e&65535;f.xb=c&65535;f.U=f.U&-769|c>>8&768;f.cb=c>>16&63;e=~~(d/f.aa[0]);c=~~(e/f.fb[0]);f.Fa[b.Oa]=e%f.fb[0]<<8|d%f.aa[0];f.fc[b.Oa]=f.Ta[b.Oa]=c;f.nb|=1<=b.Wc-1&&(f.ta[b.Oa]|=1024);switch(a){case 1:f.Ea|=512;f.U|=49152;break;case 2:f.Ea|=2048,f.U|=49152}J(this.b,20,5,172,function(){f.ta[b.Oa]|=128;f.U=f.U&65534|128;return!!(f.U&64)})};l.Tc=function(){this.u.K|=128;this.u.K&64&&J(this.b,0,6,64)}; -function ec(a,b,d,c,e,f){var g=~~((f+d.Ya-1)/d.Ya),h=new XMLHttpRequest;2048>g&&c+2048M(this.b,a.Vc?fc(this.b,d):d,a.cache[b][e])){a.cc(2,a,b,d,c);return}d+=2;--c}b++}a.cc(0,a,b,d,c)}; -function ac(a,b,d,c,e){for(var f,g;0g){b.cc(2,b,d,c,e);return}b.cache[d][f]=g;c+=2;--e}d++}b.cc(0,b,d,c,e)}l.reset=function(){this.w.sb=this.w.sb&-120|20;this.g.Ma=0;this.g.xa=128;this.u.K=0;this.G.T=128;this.J.K=128;cc(this)}; -l.Gc=function(a,b,d){var c,e,f=this.b;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?c=f.Sa&65280:(a&1&&(b<<=8),f.Sa=b|255,c=0);break;case 4194298:if(0>b)c=f.ec;else{a&1&&(b<<=8);if(c=b&65024){e=c>>9;do c+=34;while(e>>=1)}f.ec=c;f.Ra=2}break;case 4194294:if(70!==f.jb)return L(f,4,222);0>b?c=f.M:c=f.M=0;break;case 4194292:if(70!==f.jb)return L(f,4,224);c=1;break;case 4194290:if(70!==f.jb)return L(f,4,226);c=0;break;case 4194288:if(70!==f.jb)return L(f,4,228);c=61183;break;case 4194296:0<= -b&&!(a&1)&&(b&=255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==f.jb)return L(f,4,232);e=a-4194272>>1;0>b?c=f.kc[e]:(c=K(this,f.kc[e],a,b,d),0<=c&&(f.kc[e]=c));break;case 4194254:return a&1?f.N>>14&1?(0<=b&&(f.f[6]=b),c=f.f[6]):(0<=b&&(f.ua[3]=b),c=f.ua[3]):f.N>>14&0?(0<=b&&(f.f[6]=b),c=f.f[6]):(0<=b&&(f.ua[1]=b),c=f.ua[1]),c;case 4194252:case 4194250:case 4194248:return e=a&7,f.N&2048?(0<=b&&(f.f[e]=b),c=f.f[e]):(0<=b&&(f.bb[e]= -b),c=f.bb[e]),c;case 4194246:return a&1?(0<=b&&(f.f[7]=b),c=f.f[7]):f.N>>14&0?(0<=b&&(f.f[6]=b),c=f.f[6]):(0<=b&&(f.ua[0]=b),c=f.ua[0]),c;case 4194244:case 4194242:case 4194240:return e=a&7,f.N&2048?(0<=b&&(f.bb[e]=b),c=f.bb[e]):(0<=b&&(f.f[e]=b),c=f.f[e]),c;default:return f.M|=16,L(f,4,124)}break;case 4194176:e=a>>1&31;c=K(this,f.ma[3][e],a,b,d);0<=c&&(f.ma[3][e]=c,f.ma[3][e&15]&=65295);break;case 4194112:var g=this.g;e=this.u;switch(a&-2){case 4194174:c=K(this,f.Eb,a,b,d);0<=c&&(f.Eb=c);break;case 4194172:c= -f.Ga;c&65280&&(c=(c<<8|c>>8)&65535);break;case 4194170:f.ea=f.ea&62337|f.Ob<<5|f.bc<<1;0>b?c=f.ea:(c=K(this,f.ea,a,b,d),0<=c&&(f.ea=c&=62337,f.Ob=c>>5&3,f.bc=c>>1&15,c&257?(e=2,f.Ua&16&&(e=1),f.tb=c&1?tb|E:E):(f.tb=0,e=4),this.w.sb=this.w.sb&-8|e));break;case 4194168:0>b?c=this.w.kd&65535:(c=K(this,this.w.data,a,b,d),0<=c&&(this.w.data=c));break;case 4194166:0<=b&&(b&127&&(g.Lc=0),g.xa&=-129,J(f,100,4,52,function(){g.xa|=128;return!!(g.xa&64)}));c=0;break;case 4194164:break;case 4194162:c=0;0>b&& -(g.Ma&=-129,0b?c=g.Ma:(c=K(this,g.Ma,a,b,d),0<=c&&(g.Ma=g.Ma&128|c&-129));break;case 4194150:0>b?(c=e.K,e.K&=-129):(c=K(this,e.K,a,b,d),0<=c&&(c&64&&!e.Nb&&(setInterval(this.Tc.bind(this),25),e.Nb=1),e.K=c&-129));break;default:return f.M|=16,L(f,4,126)}break;case 4194048:e=this.G;switch(a&-2){case 4194048:c=K(this,e.Vb,a,b,d);0<=c&&(e.Vb=c);break;case 4194050:c=K(this,e.oa, -a,b,d);0<=c&&(e.oa=c);break;case 4194052:c=K(this,e.T,a,b,d);0<=b&&0<=c&&(e.T=c&-36993|e.T&36992,e.T&1&&$b(this));break;case 4194054:c=K(this,e.Wb,a,b,d);0<=c&&(e.Wb=c);break;case 4194056:c=K(this,e.Ub,a,b,d);0<=c&&(e.Ub=c);break;case 4194058:c=K(this,e.va,a,b,d);0<=c&&(e.va=c);break;case 4194060:break;case 4194062:c=K(this,e.zc,a,b,d);0<=c&&(e.zc=c);break;default:return f.M|=16,L(f,4,128)}break;case 4193728:var h=this.O;e=h.Ea&7;switch(a&-2){case 4193728:c=K(this,h.U,a,b,d);0<=b&&0<=c&&(h.cb=h.cb& -60|c>>8&3,h.U=c&17279|h.U&34944|2048,c&1&&h.U&128?dc(this,e):192==(c&192)&&J(f,0,5,172));break;case 4193730:c=K(this,h.zb,a,b,d);0<=c&&(h.zb=c);break;case 4193732:c=K(this,h.xb,a,b,d);0<=c&&(h.xb=c&65534);break;case 4193734:c=K(this,h.Fa[e],a,b,d);0<=c&&(h.Fa[e]=c&7967);break;case 4193736:c=K(this,h.Ea,a,b,d);0<=c&&(h.Ea=c&63|h.Ea&65472,c&128&&cc(this));break;case 4193738:c=h.ta[e];break;case 4193740:c=h.yb[e];break;case 4193742:c=K(this,h.nb,a,b,d);0<=c&&(h.nb=c&255);break;case 4193744:c=h.hd[e]; -break;case 4193746:c=K(this,h.Ac,a,b,d);0<=c&&(h.Ac=c);break;case 4193748:c=K(this,h.Bc[e],a,b,d);0<=c&&(h.Bc[e]=c&1023);break;case 4193750:c=8210;break;case 4193752:c=h.jd[e];break;case 4193754:c=K(this,h.Cc[e],a,b,d);0<=c&&(h.Cc[e]=c);break;case 4193756:c=K(this,h.Ta[e],a,b,d);0<=c&&(h.Ta[e]=c&511);break;case 4193758:h.fc[e]=h.Ta[e];c=h.fc[e];break;case 4193760:c=h.fd[e];break;case 4193762:c=h.gd[e];break;case 4193764:c=h.dd[e];break;case 4193766:c=h.ed[e];break;case 4193768:c=K(this,h.cb,a,b,d); -0<=c&&(h.cb=c&63,h.U=h.U&-769|(c&3)<<8);break;case 4193770:c=K(this,h.nc,a,b,d);0<=c&&(h.nc=c);break;default:return f.M|=16,L(f,4,132)}break;case 4192512:e=this.J;switch(a&-2){case 4192512:c=K(this,e.K,a,b,d);0<=b&&0<=c&&(e.Xa=e.Xa&60|c>>4&3,e.K=e.K&-1023|c&1022,e.K&128||bc(this));break;case 4192514:c=K(this,e.Jb,a,b,d);0<=c&&(e.Jb=c&65534);break;case 4192516:c=K(this,e.fa,a,b,d);0<=c&&(e.fa=c);break;case 4192518:c=K(this,e.ab,a,b,d);0<=c&&(e.ab=c);break;case 4192520:c=K(this,e.Xa,a,b,d);0<=c&&(e.Xa= -c&63,e.K=e.K&-49|(e.Xa&3)<<4);break;default:return f.M|=16,L(f,4,134)}break;case 4191552:switch(a&-2){case 4191566:0>b?c=f.Ua:(c=K(this,f.Ua,a,b,d),0<=c&&(70!==f.jb&&(c&=-49),f.Ua=c,f.lb[0]=c&4?15:7,f.lb[1]=c&2?15:7,f.lb[3]=c&1?15:7,f.tb&&(e=2,f.Ua&16&&(e=1),this.w.sb=this.w.sb&-8|e)));break;default:return f.M|=16,L(f,4,136)}break;case 4191424:e=a>>1&31;c=K(this,f.ma[0][e],a,b,d);0<=c&&(f.ma[0][e]=c,f.ma[0][e&15]&=65295);break;case 4191360:e=a>>1&31;c=K(this,f.ma[1][e],a,b,d);0<=c&&(f.ma[1][e]=c, -f.ma[1][e&15]&=65295);break;case 4190400:case 4190336:if(70!==f.jb)return L(f,4,234);e=a>>2&31;c=f.Xb[e];a&2&&(c>>=16);c&=65535;0<=b&&(c=K(this,c,a,b,d),0<=c&&(f.Xb[e]=a&2?c<<16|f.Xb[e]&65535:f.Xb[e]&4294901760|c&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)c=Wb[a>>1&255];else return f.M|=16,L(f,4,138);break;default:return f.M|=16,L(f,4,142)}d&&0<=c&&(a&1?c>>=8:c&=255);"undefined"===typeof c&&console.log("panic(76)"); -return c};var gc={},Xb=(gc[65534]=[null,null,Kb.prototype.Zc,Kb.prototype.md],gc[65396]=[null,null,Kb.prototype.$c,Kb.prototype.nd],gc);Oa(function(){for(var a=B(document,"pdp11","device"),b=0;b>1),this.b=new Int32Array(this.G,0,d>>2),nc(this,jc?oc:pc);else{this.b=Array(d>>2);for(a=0;a>2),b=0;b>8,d)},ca:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},qa:function(a){var b=a>>2;a=(a&3)<<3;var d=this.b[b]>>a;return 24>a?d&65535:d&255|(this.b[b+1]&255)<<8},Ca:function(a,b){var d=a>> -2;a=(a&3)<<3;this.b[d]=this.b[d]&~(255<>2;a=(a&3)<<3;24>a?this.b[d]=this.b[d]&~(65535<>8);this.Za=!0},$:function(a,b){if(this.I&&null!=this.A){var d=this.I;uc(d,this.A+a,1,d.Y)&&d.pa(!0)}return this.Sb(a,b)},ha:function(a,b){if(this.I&&null!=this.A){var d=this.I;uc(d,this.A+a,2,d.Y)&&d.pa(!0)}return this.mc(a,b)},za:function(a,b,d){if(this.I&&null!=this.A){var c=this.I;uc(c,this.A+ -a,1,c.J)&&c.pa(!0)}this.H?this.u(a,b,d):this.Cb(a,b,d)},Ia:function(a,b,d){if(this.I&&null!=this.A){var c=this.I;uc(c,this.A+a,2,c.J)&&c.pa(!0)}this.H?this.u(a,b,d):this.qc(a,b,d)},Y:function(a){return this.g[a]},ba:function(a){return this.g[a]},da:function(a){return this.J.getUint16(a,!0)},ia:function(a){return a&1?this.g[a]|this.g[a+1]<<8:this.R[a>>1]},ya:function(a,b){this.g[a]=b;this.Za=!0},Aa:function(a,b){this.g[a]=b;this.Za=!0},Ha:function(a,b){this.J.setUint16(a,b,!0);this.Za=!0},Va:function(a, -b){a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.R[a>>1]=b;this.Za=!0}};function zb(a,b,d){a.I=b;a.P=a.w=0;d&&((a.P=d.P)&&tc(a,sc,!1),(a.w=d.w)&&rc(a,sc,!1))}function vc(a,b){b?--a.w||(a.Bb=a.H?a.u:a.Cb,a.Ec=a.H?a.O:a.qc):--a.P||(a.wb=a.Sb,a.Tb=a.mc)}function rc(a,b,d){d&&a.w||(a.Bb=!a.H&&b[1]||a.u,a.Ec=!a.H&&b[3]||a.O);if(d||void 0===d)a.Cb=b[1]||a.u,a.qc=b[3]||a.O}function tc(a,b,d){d&&a.P||(a.wb=b[0]||a.W,a.Tb=b[2]||a.X);if(d||void 0===d)a.Sb=b[0]||a.W,a.mc=b[2]||a.X} -function nc(a,b){b||(b=wc);tc(a,b,void 0);rc(a,b,void 0)}var wc=[],qc=[I.prototype.ca,I.prototype.Ca,I.prototype.qa,I.prototype.Fb],sc=[I.prototype.$,I.prototype.za,I.prototype.ha,I.prototype.Ia];if(sb)var pc=[I.prototype.Y,I.prototype.ya,I.prototype.da,I.prototype.Ha],oc=[I.prototype.ba,I.prototype.Aa,I.prototype.ia,I.prototype.Va]; -function xc(a,b){u.call(this,"CPU",a,xc,1);var d=a.multiplier||1;this.Ha=a.cycles||b;this.mb=d;this.Ca=Math.round(this.Ha/1E4)/100;this.kb=this.Ca*this.mb;this.j.la=!1;this.j.pc=!1;this.j.Hb=a.autoStart;this.j.wc=!1;this.j.rb=!1;this.Pb=this.ba=0;this.Qb=a.csStart;this.ub=a.csInterval;this.vb=a.csStop;this.ya=[];this.Kb=this.ob.bind(this);D(this)}w(xc);var yc=["power","reset"];l=xc.prototype; -l.$a=function(a,b,d,c){this.w=a;this.H=b;this.I=c;for(b=0;b=a.ba&&(a.ba+=a.ub,d=!0);0<=a.vb&&a.vb<=Rc(a)&&(a.ub=a.vb=-1,Pc(a),a.pa(),d=!0);d&&a.i(Rc(a)+" cycles: checksum="+r(a.Pb))}} -function Sc(a,b,d,c){if(a.P[b]){void 0===d&&(rb(a,"Value for "+b+" is invalid"),a.pa());var e=a.I&&a.I.za||8;d=!a.j.la||a.j.wc?8==e?ca(d,c):r(d,c):"--------".substr(0,c||4);a.P[b].textContent!=d&&(a.P[b].textContent=d)}} -l.wa=function(a,b,d){var c=this;a=!1;switch(b){case "power":case "reset":this.P[b]=d;a=!0;break;case "run":this.P[b]=d;d.onclick=function(){var a;if(a=c.w)if(a=c.w,a.j.ga)a=!0;else{var b=null,d,h=$a(a.id);for(d=0;da.W/a.kb?b=1:c=!0;a.mb=b;b=a.Ca*a.mb;if(a.kb!=b){a.kb=b;b=a.kb.toFixed(2)+"Mhz";var e=a.P.setSpeed;e&&(e.textContent=b);a.i("target speed: "+b)}d&&a.w&&a.w.Yb()}Uc(a,a.R);a.R=0;a.O=ra();a.X=0;Vc(a);return c}function Wc(a){a.Y-=a.b;a.b=0} -l.ob=function(a){if(db(this,!0)){if(!this.j.la){Tc(this);this.w&&this.w.start(this.O,Rc(this));this.j.la=!0;this.j.pc=!0;this.ha&&this.ha.start();var b=this.P.run;b&&(b.textContent="Halt");this.w&&(this.w.Ba(!0),a&&this.w.Yb(!0))}this.Ia>=this.Ha&&Vc(this,!0);this.ia=0;this.za=ra();this.X&&(a=this.za-this.X,a>this.Db&&(this.O+=a,this.O>this.za&&(this.O=this.za)));try{do{for(var d,c=this.j.rb?1:this.Aa,e=this.ya.length-1;0<=e;e--){var f=this.ya[e];0>f[0]||c>f[0]&&(c=f[0])}d=c;try{this.Ab(d)}catch(m){if("number"!= -typeof m)throw m;}var g=this.Y-this.b;a=g;for(var h=this.ya.length-1;0<=h;h--){var k=this.ya[h];0>k[0]||(k[0]-=a,0>=k[0]&&(k[0]=-1,k[1]()))}this.ia+=g;this.R+=g;Uc(this,0,!0);Qc(this,g);this.ca-=g;if(0>=this.ca){this.ca+=this.Aa;15<=++this.Ib&&(this.w&&this.w.Ba(),this.Ib=0);break}}while(this.j.la)}catch(m){this.pa();N(this);this.w&&this.w.stop(ra(),Rc(this));db(this,!1);rb(this,m.stack||m.message);return}d=setTimeout;c=this.Kb;this.X=ra();e=this.Db;this.ia&&(e=Math.round(e*this.ia/this.Aa));e-=this.X- -this.za;if(f=this.X-this.O)this.W=Math.round(this.R/(10*f))/100,864E5<=f&&(this.$=0,Tc(this));if(0>e||this.We&&(this.O-=e),e=0;this.Ia+=this.ia;this.X+=e;d(c,e)}else N(this),this.w&&this.w.stop(ra(),Rc(this))};l.Ab=function(){return 0};l.pa=function(a){eb(this,!0);Wc(this);Uc(this,this.R);this.R=0;if(this.j.la){this.j.la=!1;this.ha&&this.ha.stop();var b=this.P.run;b&&(b.textContent="Run")}this.j.complete=a};function N(a,b){a.w&&a.w.Ba(b)} -function Xc(a){this.Xc=+a.model||1170;this.$b=a.resetAddr||0;xc.call(this,a,1E6);this.Va=0;this.decode=Yc.bind(this);this.D=65536;this.C=32768;this.F=65535;this.B=32768;this.f=[0,0,0,0,0,0,0,this.$b];this.bb=[0,0,0,0,0,0];this.ua=[0,0,0,0];this.Sa=255;this.bc=this.Ob=this.tb=this.G=this.Ua=this.Eb=this.Ga=this.ea=this.M=this.ec=0;this.lb=[7,7,7,7];this.ma=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535, -65535,65535,65535,65535,65535,65535,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Xb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.kc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.g=-1;this.V=0;this.jb=70;this.da=-1;this.u=[];this.qa=0;this.Ra=2;Zc(this);this.j.complete=this.j.Kc=!1}w(Xc,xc);l=Xc.prototype; -l.reset=function(){this.j.la&&this.pa();$c(this);Oc(this);this.j.error=!1;this.parent.reset.call(this)};function $c(a){a.Sa=255;a.M=0;a.u=[];a.ec=0;a.ea=a.Ga=a.Eb=a.Ua=a.tb=0;a.lb[0]=a.lb[1]=a.lb[3]=7;a.Ob=0;Zc(a)}function Zc(a){a.tb?(a.J=65536,a.L=a.Rc,a.Tb=a.na):(a.J=0,a.L=a.Qc,a.Tb=a.ka)}l.yc=function(){return 0};l.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.pb,this.$,this.mb]);a.set(2,Jb(this.H));return a.data()}; -l.restore=function(a){var b=a[1];this.pb=b[0];this.$=b[1];Tc(this,b[3]);a:{b=this.H;a=a[2];var d;for(d=0;db){a.u[f].Ja-=b;break}b-=a.u[f].Ja}a.u.splice(f+1,0,{delay:b,priority:d<<5&224,vector:c,callback:e})}a.Ra=2}function Yb(a){return a.N=a.N&63728|(a.B&32768?8:0)|(a.F&65535?0:4)|(a.C&32768?2:0)|(a.D&65536?1:0)} -function Zb(a,b){a.B=b<<12;a.F=~b&4;a.C=b<<14;a.D=b<<16;if((b^a.N)&2048)for(var d=a.bb.length;0<=--d;){var c=a.f[d];a.f[d]=a.bb[d];a.bb[d]=c}a.G=b>>14&3;d=a.N>>14&3;a.G!=d&&(a.ua[d]=a.f[6],a.f[6]=a.ua[a.G]);a.Ra=2;a.N=b}function ad(a,b){a.V&128||(a.B=a.F=a.D=b,a.C=0)}function bd(a,b){a.V&128||(a.B=a.F=b,a.C=0)}function cd(a,b,d,c){a.V&128||(a.B=a.F=a.D=b,a.C=(d^c)&(c^b))} -function L(a,b,d){var c,e,f=0;0>a.da?a.da=Yb(a):a.G||(b=4,f=1);a.ea&57344||(a.Ga=63222,a.Eb=b);a.G=0;0<=(c=a.na(b|65536))&&0<=(e=a.na(b+2&65535|65536))&&(Zb(a,e&53247|a.da>>2&12288),f&&(a.M|=4,a.f[6]=4),0<=dd(a,a.da)&&0<=dd(a,a.f[7])&&(a.f[7]=c));a.V&=-113;a.da=-1;throw b|d<<8;}function fc(a,b){var d=b>>13&31;31>d?a.Ua&32&&(b=a.Xb[d]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b} -function ed(a,b,d){var c,e,f,g=0;if(d&a.tb){c=b>>13&a.lb[a.G];e=a.ma[a.G][c];f=(a.ma[a.G][c+16]<<6)+(b&8191)&4194303;a.Ua&16?3932160<=f&&4186112>f&&(f=fc(a,f&262143)):(f&=262143,253952<=f&&(f|=4186112));3932160>f&&(3915776<=f&&(a.M|=32,L(a,4,24)),f&1&&!(d&1)&&(a.M|=64,L(a,4,26)));switch(e&7){case 1:g=4096;case 2:e|=128;d&E&&(g=8192);break;case 4:g=4096;case 5:d&E&&(g=4096);case 6:e|=d&E?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2& -8128)&&(g|=16384));a.ma[a.G][c]=e;if(4194170!==f||a.G)a.Ob=a.G,a.bc=c;g&&(g&57344&&(0<=a.da&&(g|=128),a.ea&57344||(a.ea=a.ea|g|a.Ob<<5|a.bc<<1),L(a,168,28)),a.ea&61440||!(4191360>f||4194239>3&7){case 0:L(a,4,34);break;case 1:return 6===f&&!a.G&&d&E&&(a.f[6]<=a.Sa||65534<=a.f[6])&&(a.f[6]<=a.Sa-32||65534<=a.f[6]?(a.M|=4,a.f[6]=4,L(a,4,36)):(a.M|=8,a.V|=64)),7===f?a.f[f]:a.f[f]|a.J;case 2:e=2;c=a.f[f];7!==f&&(c|=a.J,6>f&&d&1&&(e=1));break;case 3:e=2;c=a.f[f];7!==f&&(c|=a.J);if(0>(c=a.na(c)))return c;c|=a.J;break;case 4:e=-2;6>f&&d&1&&(e=-1);c=a.f[f]+e&65535;7!==f&&(c|=a.J);break;case 5:e=-2;c=a.f[f]-2&65535;7!==f&&(c|=a.J);if(0>(c=a.na(c)))return c; -c|=a.J;break;case 6:if(0>(c=a.na(a.f[7])))return c;a.f[7]=a.f[7]+2&65535;c=c+a.f[f]&65535;return c|a.J;case 7:if(0>(c=a.na(a.f[7])))return c;a.f[7]=a.f[7]+2&65535;c=c+a.f[f]&65535;return 0>(c=a.na(c|65536))?c:c|a.J}a.f[f]=a.f[f]+e&65535;!a.J||a.ea&57344||(a.Ga=a.Ga<<8|e<<3&248|f);6===f&&!a.G&&d&E&&0>=e&&(a.f[6]<=a.Sa||65534<=a.f[6])&&(a.f[6]<=a.Sa-32?(a.M|=4,a.f[6]=4,L(a,4,38)):(a.M|=8,a.V|=64));return c}l.Qc=function(a,b){return gd(this,a,b)};l.Rc=function(a,b){return ed(this,gd(this,a,b),b)}; -function S(a,b){return b&56?a.Tb(gd(a,b,tb)):a.f[b&7]}function hd(a,b){return b&56?P(a,a.L(b,ub)):a.f[b&7]&255}function id(a,b,d,c){b&56?(b=a.L(b,F),M(a,b,c.call(a,d,a.ka(b)))):(b&=7,a.f[b]=c.call(a,d,a.f[b])&65535)}function jd(a,b,d,c){b&56?(b=a.L(b,G),Q(a,b,c.call(a,d,P(a,b)))):(b&=7,a.f[b]=a.f[b]&65280|c.call(a,d,a.f[b])&255)}function kd(a,b,d){b&56?M(a,a.L(b,E),d):a.f[b&7]=d&65535;return d} -function ld(a,b,d,c){b&56?Q(a,a.L(b,vb),d):(b&=7,a.f[b]=d?c&1?d<<24>>24&65535:a.f[b]&-256|d&255:a.f[b]&-256);return d}function T(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} -l.Ab=function(a){this.j.complete=!0;var b=this.j.Kc=this.I&&md(this.I),d=a?this.j.pc?0:1:-1;this.j.pc=!1;this.Y=this.b=a;this.pb&256?(Wc(this),a=!1):a=!0;if(a){do{if(b){if(nd(this.I,this.f[7],d)){this.pa();break}d=1}var c,e,f,g;this.V&112&&(this.V&32?L(this,168,52):this.V&64?L(this,4,54):this.V&16&&L(this,12,56),this.V&=-113);if(this.Ra)if(1===this.Ra)this.Ra=2;else{this.Ra=0;c=-1;e=this.ec&224;if(0<(a=this.u.length))for(;0e&&(e=this.u[a].Yc,c=a)}e>(this.N&224)&&(0>c?L(this,160,42):(L(this,this.u[c].ld,44),this.u.splice(c,1)))}this.ea&57344||(this.Ga=0,this.Eb=this.f[7]);this.V=this.N&16;this.g=a=this.na(this.f[7]);0<=a&&(this.f[7]=this.f[7]+2&65535);this.decode(a);if(0>this.g)switch(a&61440){case 4096:break;case 8192:break;case 12288:break;case 16384:break;case 20480:break;case 24576:break;case 36864:break;case 40960:break;case 45056:break;case 49152:break;case 53248:break; -case 57344:break;default:switch(a&65024){case 2048:0<=(f=gd(this,a,0))&&(g=a>>6&7,0<=dd(this,this.f[g])&&(this.f[g]=this.f[7],this.f[7]=f&65535));break;case 28672:0<=(c=S(this,a))&&(g=a>>6&7,c&32768&&(c|=-65536),e=this.f[g],e&32768&&(e|=-65536),a=~~(c*e),this.f[g]=a>>16&65535,this.f[g|1]=a&65535,this.B=a>>16,this.F=this.B|a,this.D=this.C=0,-32768>a||32767>6&7,e=this.f[g]<<16|this.f[g|1],this.D=this.C=0,c&32768&&(c|=-65536),a=~~(e/c),-32768<= -a&&32767>=a?(this.f[g]=a&65535,this.f[g|1]=e-a*c&65535,this.F=a>>16|a,this.B=a>>16):(this.C=32768,this.F=a>>15|a,this.B=e>>16,-1===c&&65534===this.f[g]&&(this.f[g]=this.f[g|1]=1))):(this.F=this.B=0,this.C=32768,this.D=65536));break;case 29696:0<=(c=S(this,a))&&(g=a>>6&7,a=this.f[g],a&32768&&(a|=4294901760),this.D=this.C=0,c&=63,c&32?(c=64-c,16>=c):c&&(16>15&65535)&&65535!==e&&(this.C=32768))),this.f[g]=a&65535,this.B=this.F=a);break; -case 30208:if(0<=(c=S(this,a))){g=a>>6&7;e=this.f[g]<<16|this.f[g|1];this.D=this.C=0;c&=63;if(c&32)c=64-c,32>c-1,this.D=a<<16,a>>=1,e&2147483648&&(a|=4294967295<<32-c);else if(c){if(a=e<>15,a<<=1,32>=32-c)e|=4294967295<>16&65535;this.f[g|1]=a&65535;this.B=a>>16;this.F=a>>16|a}break;case 30720:a&56?0<=(e=this.ka(c=this.L(a,F)))&&(e^=this.f[a>>6&7],0<=M(this,c,e)&&(this.B=this.F=e,this.C=0)): -(this.B=this.F=e=this.f[a&7]^=this.f[a>>6&7],this.C=0);break;case 32256:g=a>>6&7;if(this.f[g]=this.f[g]-1&65535)this.f[7]=this.f[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.f[7]=T(this.f[7],a);break;case 512:this.F&65535&&(this.f[7]=T(this.f[7],a));break;case 768:this.F&65535||(this.f[7]=T(this.f[7],a));break;case 1024:(this.B&32768)===(this.C&32768)&&(this.f[7]=T(this.f[7],a));break;case 1280:(this.B&32768)!==(this.C&32768)&&(this.f[7]=T(this.f[7],a));break;case 1536:this.F& -65535&&(this.B&32768)===(this.C&32768)&&(this.f[7]=T(this.f[7],a));break;case 1792:this.F&65535&&(this.B&32768)===(this.C&32768)||(this.f[7]=T(this.f[7],a));break;case 32768:this.B&32768||(this.f[7]=T(this.f[7],a));break;case 33280:!(this.D&65536)&&this.F&65535&&(this.f[7]=T(this.f[7],a));break;case 33024:this.B&32768&&(this.f[7]=T(this.f[7],a));break;case 33536:if(this.D&65536||!(this.F&65535))this.f[7]=T(this.f[7],a);break;case 33792:this.C&32768||(this.f[7]=T(this.f[7],a));break;case 34048:this.C& -32768&&(this.f[7]=T(this.f[7],a));break;case 34304:this.D&65536||(this.f[7]=T(this.f[7],a));break;case 34560:this.D&65536&&(this.f[7]=T(this.f[7],a));break;case 34816:L(this,24,2);break;case 35072:L(this,28,4);break;default:switch(a&65472){case 64:0<=(f=gd(this,a,0))&&(this.f[7]=f&65535);break;case 192:a&56?0<=(e=this.ka(c=this.L(a,F)))&&(a=e<<8|e>>8,0<=M(this,c,a)&&(this.B=this.F=e&65280,this.C=this.D=0)):(g=a&7,e=this.f[g],this.f[g]=(e<<8|e>>8)&65535,this.B=this.F=e&65280,this.C=this.D=0);break; -case 2560:break;case 2624:0<=(e=this.ka(c=this.L(a,F)))&&(a=~e,0<=M(this,c,a)&&(this.B=this.F=a,this.D=65536,this.C=0));break;case 2688:a&56?0<=(e=this.ka(c=this.L(a,F)))&&(a=e+1,0<=M(this,c,a)&&(this.B=this.F=a,this.C=a&(a^e))):(g=a&7,e=this.f[g],a=e+1,this.f[g]=a&65535,this.B=this.F=a,this.C=a&(a^e));break;case 2752:a&56?0<=(e=this.ka(c=this.L(a,F)))&&(a=e-1,0<=M(this,c,a)&&(this.B=this.F=a,this.C=(a^e)&e)):(g=a&7,e=this.f[g],a=e-1,this.f[g]=a&65535,this.B=this.F=a,this.C=(a^e)&e);break;case 2816:0<= -(e=this.ka(c=this.L(a,F)))&&(a=-e,0<=M(this,c,a)&&(this.D=this.B=this.F=a,this.C=a&e));break;case 2880:0<=(e=this.ka(c=this.L(a,F)))&&(a=e+(this.D>>16&1),0<=M(this,c,a)&&(this.D=this.B=this.F=a,this.C=a&(a^e)));break;case 2944:0<=(e=this.ka(c=this.L(a,F)))&&(a=e-(this.D>>16&1),0<=M(this,c,a)&&(this.D=this.B=this.F=a,this.C=(a^e)&e));break;case 3008:0<=(e=S(this,a))&&(this.B=this.F=e,this.D=this.C=0);break;case 3072:a&56?0<=(e=this.ka(c=this.L(a,F)))&&(a=(this.D&65536|e)>>1,0<=M(this,c,a)&&(this.D= -e<<16,this.B=this.F=a,this.C=a^this.D>>1)):(g=a&7,e=this.f[g],a=(this.D&65536|e)>>1,this.f[g]=a&65535,this.D=e<<16,this.B=this.F=a,this.C=a^this.D>>1);break;case 3136:a&56?0<=(e=this.ka(c=this.L(a,F)))&&(a=e<<1|this.D>>16&1,0<=M(this,c,a)&&(this.D=this.B=this.F=a,this.C=a^e)):(g=a&7,e=this.f[g],a=e<<1|this.D>>16&1,this.f[g]=a&65535,this.D=this.B=this.F=a,this.C=a^e);break;case 3200:a&56?0<=(e=this.ka(c=this.L(a,F)))&&(a=e&32768|e>>1,0<=M(this,c,a)&&(this.D=e<<16,this.B=this.F=a,this.C=this.B^this.D>> -1)):(g=a&7,e=this.f[g],a=e&32768|e>>1,this.f[g]=a&65535,this.D=e<<16,this.B=this.F=a,this.C=this.B^this.D>>1);break;case 3264:a&56?0<=(e=this.ka(c=this.L(a,F)))&&(a=e<<1,0<=M(this,c,a)&&(this.D=this.B=this.F=a,this.C=a^e)):(g=a&7,e=this.f[g],a=e<<1,this.f[g]=a&65535,this.D=this.B=this.F=a,this.C=a^e);break;case 3328:f=this.f[7]+((a&63)<<1)&65535;0<=(c=this.na(f|65536))&&(this.f[7]=this.f[5],this.f[5]=c,this.f[6]=f+2&65535);break;case 3392:a&56?0<=(f=gd(this,a,0))&&(61440!==(this.N&61440)&&(f&=65535), -this.G=this.N>>12&3,0<=(c=this.na(f))&&(this.G=this.N>>14&3,0<=dd(this,c)&&(this.B=this.F=c,this.C=0))):(g=a&7,c=6!==g||(this.N>>2&12288)===(this.N&12288)?this.f[g]:this.ua[this.N>>12&3],0<=dd(this,c)&&(this.B=this.F=c,this.C=0));break;case 3456:0<=(e=fd(this))&&((this.ea&57344||(this.Ga=22),a&56)?0<=(f=gd(this,a,0))&&(f&=65535,this.G=this.N>>12&3,0<=(c=ed(this,f,E))&&(this.G=this.N>>14&3,0<=M(this,c,e)&&(this.B=this.F=e,this.C=0))):(g=a&7,6!==g||(this.N>>2&12288)===(this.N&12288)?this.f[g]=e:this.ua[this.N>> -12&3]=e,this.B=this.F=e,this.C=0));break;case 3520:0<=(c=this.L(a,E))&&(a=-(this.B>>15&1),0<=M(this,c,a)&&(this.F=a,this.C=0));break;case 35328:break;case 35392:0<=(e=P(this,c=this.L(a,G)))&&(a=~e,0<=Q(this,c,a)&&(this.B=this.F=a<<8,this.D=65536,this.C=0));break;case 35456:0<=(e=P(this,c=this.L(a,G)))&&(a=e+1,0<=Q(this,c,a)&&(this.B=this.F=a<<8,this.C=(a&(a^e))<<8));break;case 35520:0<=(e=P(this,c=this.L(a,G)))&&(a=e-1,0<=Q(this,c,a)&&(this.B=this.F=a<<8,this.C=((a^e)&e)<<8));break;case 35584:0<= -(e=P(this,c=this.L(a,G)))&&(a=-e,0<=Q(this,c,a)&&(this.D=this.B=this.F=a<<8,this.C=(a&e)<<8));break;case 35648:0<=(e=P(this,c=this.L(a,G)))&&(a=e+(this.D>>16&1),0<=Q(this,c,a)&&(this.B=this.F=this.D=a<<8,this.C=(a&(a^e))<<8));break;case 35712:0<=(e=P(this,c=this.L(a,G)))&&(a=e-(this.D>>16&1),0<=Q(this,c,a)&&(this.B=this.F=this.D=a<<8,this.C=((a^e)&e)<<8));break;case 35776:0<=(e=hd(this,a))&&(this.B=this.F=e<<8,this.D=this.C=0);break;case 35840:0<=(e=P(this,c=this.L(a,G)))&&(a=((this.D&65536)>>8|e)>> -1,0<=Q(this,c,a)&&(this.D=e<<16,this.B=this.F=a<<8,this.C=this.B^this.D>>1));break;case 35904:0<=(e=P(this,c=this.L(a,G)))&&(a=e<<1|this.D>>16&1,0<=Q(this,c,a)&&(this.D=this.B=this.F=a<<8,this.C=(a^e)<<8));break;case 35968:0<=(e=P(this,c=this.L(a,G)))&&(a=e&128|e>>1,0<=Q(this,c,a)&&(this.D=e<<16,this.B=this.F=a<<8,this.C=this.B^this.D>>1));break;case 36032:0<=(e=P(this,c=this.L(a,G)))&&(a=e<<1,0<=Q(this,c,a)&&(this.D=this.B=this.F=a<<8,this.C=(a^e)<<8));break;case 36160:a&56?0<=(f=gd(this,a,0))&& -(this.G=this.N>>12&3,0<=(c=this.na(f|65536))&&(this.G=this.N>>14&3,0<=dd(this,c)&&(this.B=this.F=c,this.C=0))):(g=a&7,c=6!==g||(this.N>>2&12288)===(this.N&12288)?this.f[g]:this.ua[this.N>>12&3],0<=dd(this,c)&&(this.B=this.F=c,this.C=0));break;case 36224:0<=(e=fd(this))&&((this.ea&57344||(this.Ga=22),a&56)?0<=(f=gd(this,a,0))&&(this.G=this.N>>12&3,0<=(c=ed(this,f|65536,E))&&(this.G=this.N>>14&3,0<=M(this,c,e)&&(this.B=this.F=e,this.C=0))):(g=a&7,6!==g||(this.N>>2&12288)===(this.N&12288)?this.f[g]= -e:this.ua[this.N>>12&3]=e,this.B=this.F=e,this.C=0));break;default:switch(a&65528){case 128:0<=(c=fd(this))&&(g=a&7,this.f[7]=this.f[g],this.f[g]=c);break;case 152:this.N&49152||(this.N=this.N&63519|(a&7)<<5,this.Ra=1);break;case 160:case 168:break;case 176:case 184:break;default:switch(a){case 0:49152&this.N?(this.M|=128,L(this,4,46)):(this.qa=3,Wc(this),console.log("HALT at "+this.f[7].toString(8)));break;case 1:c=0;if(0<(a=this.u.length))for(;0>12].call(this,a)} -var Cd=[function(a){Dd[a>>8&15].call(this,a)},function(a){bd(this,kd(this,a,S(this,a>>6)));--this.b},function(a){var b=S(this,a>>6);a=S(this,a);cd(this,b-a,a,b);--this.b},function(a){bd(this,S(this,a>>6)&S(this,a));--this.b},function(a){id(this,a,S(this,a>>6),pd);--this.b},function(a){id(this,a,S(this,a>>6),rd);--this.b},function(a){id(this,a,S(this,a>>6),od);--this.b},function(a){Ed[a>>8&15].call(this,a)},function(a){Fd[a>>8&15].call(this,a)},function(a){var b=hd(this,a>>6);bd(this,ld(this,a,b,1)<< -8);--this.b},function(a){var b=hd(this,a>>6)<<8;a=hd(this,a)<<8;cd(this,b-a,a,b);--this.b},function(a){bd(this,(hd(this,a>>6)&hd(this,a))<<8);--this.b},function(a){jd(this,a,hd(this,a>>6),qd);--this.b},function(a){jd(this,a,hd(this,a>>6),sd);--this.b},function(a){id(this,a,S(this,a>>6),td);--this.b},X],Dd=[function(a){Gd[a>>4&15].call(this,a)},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b}, -function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},xd,xd,function(a){Hd[a>>6&3].call(this,a)},function(a){Id[a>>6&3].call(this,a)},function(a){Jd[a>>6&3].call(this,a)},function(a){Kd[a>>6&3].call(this,a)},X,X],Gd=[function(a){Ld[a&15].call(this,a)},X,X,X,X,X,X,X,X,X,function(a){Md[a&15].call(this,a)},function(a){Nd[a&15].call(this,a)},X,X,X,X],Md=[zd,function(){this.D=0;--this.b},function(){this.C=0;--this.b},U,function(){this.F=1;--this.b},U,U,U,function(){this.B=0;--this.b},U,U,U,U,U, -U,U],Nd=[zd,function(){this.D=65536;--this.b},function(){this.C=32768;--this.b},V,function(){this.F=0;--this.b},V,V,V,function(){this.B=32768;--this.b},V,V,V,V,V,V,V],Ld=[function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.N&49152||($c(this),this.H.reset());--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},X,X,X,X,X,X,X,X],Ed=[yd,yd,wd,wd,ud,ud,vd,vd,Bd,Bd,X, -X,X,X,Ad,Ad],Fd=[function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(a){Od[a>>6&3].call(this,a)},function(a){Pd[a>>6&3].call(this,a)},function(a){Qd[a>>6&3].call(this,a)},function(a){Rd[a>>6&3].call(this,a)},X,X],Hd=[function(a){ad(this, -kd(this,a,0));--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b}],Id=[function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b}],Jd=[function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b}],Kd=[function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b}], -Od=[function(a){ad(this,ld(this,a,0));--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b}],Pd=[function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b}],Qd=[function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b}],Rd=[function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g=-1;--this.b},function(){this.g= --1;--this.b}];function Sd(a){u.call(this,"ROM",a,Sd);this.g=null;this.J=a.addr;this.w=a.size;this.O=a.writable;this.u=a.alias;this.G=a.file;this.R=da(this.G);if(this.G){a=this.G;var b=ia(this.R);"json"!=b&&"hex"!=b&&(a=ka()+"/api/v1/dump?file="+this.G+"&format=bytes&decimal=true");var d=this;ta(a,null,!0,function(a,b,f){re(d,a,b,f)})}}w(Sd);Sd.prototype.$a=function(a,b,d,c){this.H=b;this.b=d;this.I=c;se(this)}; -Sd.prototype.Qa=function(){if(this.Na){if(this.I){var a=this.I,b=this.id,d=this.J,c=this.w,e=this.Na,f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var k=h.o,m=h.a;if(void 0!==k){var n=f,k=[k>>>0,g],q=qa(n,k,a.vc);0>q&&n.splice(-(q+1),0,k)}m&&(h.a=m.replace(/''/g,'"'))}a.O.push({pd:b,A:d,Uc:c,Na:e,sc:f})}delete this.Na}return!0};Sd.prototype.Pa=function(){return!0}; -function re(a,b,d,c){if(c)a.sa("Unable to load system ROM (error "+c+": "+b+")");else{Za(a.tc,b,d);var e;if("["==d.charAt(0)||"{"==d.charAt(0))try{var f,g,h=eval("("+d+")");if(f=h.bytes)a.g=f;else if(f=h.words)for(a.g=Array(2*f.length),g=e=0;e>8&255;else if(f=h.data)for(a.g=Array(4*f.length),g=e=0;e>8&255,a.g[g++]=f[e]>>16&255,a.g[g++]=f[e]>>24&255;else a.g=h;a.Na=h.symbols;if(!a.g.length){t("Empty ROM: "+ -b);return}if(1==a.g.length){t(a.g[0]);return}}catch(k){a.sa("ROM data error: "+k.message);return}else for(b=d.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.g=Array(b.length),e=0;e>>c.Z].Cb(e&c.g,a.g[d]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.u?b.push(a.u):null!=a.u&&a.u.length&&(b=a.u);for(d=0;d>>e.Z;0>>=e.Z;0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; -function xe(a,b,d,c){if(d)if(b){0>a.G&&a.u.length&&(a.G=0);if(0>a.G||b!=a.u[a.G])a.u.splice(0,0,b),a.G=0;a.G--}else a.ca?b="end":b=a.u[a.G+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");d=0;var e=null;c=c||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)a.push(oa(b.substring(d,f))),d=f+1}}return a} -function ye(a,b,d){for(d=d||-1;d--&&b.length;){var c=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(c){case "*":c=f*e;break;case "/":if(!e)return!1;c=f/e;break;case "%":if(!e)return!1;c=f%e;break;case "+":c=f+e;break;case "-":c=f-e;break;case "<<":c=f<>":c=f>>e;break;case ">>>":c=f>>>e;break;case "<":c=f":c=f>e?1:0;break;case ">=":c=f>=e?1:0;break;case "==":c=f==e?1:0;break;case "!=":c=f!=e?1:0;break;case "&":c=f&e;break; -case "^":c=f^e;break;case "|":c=f|e;break;case "&&":c=f&&e?1:0;break;case "||":c=f||e?1:0;break;default:return!1}a.push(c|0)}return!0} -function ze(a,b,d){var c;if(b){b=Ae(a,b);for(var e=0,f=!1,g=b,h=[],k=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;g=n+g;c>>=8}c=r(d,0,!0)+" "+d+". "+ca(d,0,!0)+" "+("0b"+g)}a.i((null!=b?b+": ":"")+c);return e} -function De(a,b){if(b)return Ce(a,b,a.ha[b]);var d=0;for(b in a.ha)Ce(a,b,a.ha[b]),d++;return 0>13&7;"undefined"===typeof b.ja[e]&&(b.ja[e]={cache:[],postProcess:a.ad,drive:e,blocksize:256,mapped:0,maxblock:b.fb[e]*b.U[e],url:"rk"+e+".dsk"});b.M&=-129;switch(b.M>>1&7){case 0:b.Tb=2496;b.ha=0;b.M=128;b.na=0;break;case 1:if((b.na>>4&511)>=b.fb[e]){b.ha|=32832;b.M|=49152;break}if((b.na&15)>=b.U[e]){b.ha|=32800;b.M|=49152;break}d=(b.na>>4&511)*b.U[e]+(b.na&15);c=(b.M&48)<<12|b.Sb;f=65536-b.Ub&65535;Zb(a,b.ja[e],d,c,f);return;case 2:if((b.na>>4&511)>=b.fb[e])b.ha|= +32832,b.M|=49152;else if((b.na&15)>=b.U[e])b.ha|=32800,b.M|=49152;else{d=(b.na>>4&511)*b.U[e]+(b.na&15);c=(b.M&48)<<12|b.Sb;f=65536-b.Ub&65535;a.bc(b.ja[e],d,c,f);return}}b.Tb=e<<13|b.Tb&8176|b.na%9&15;H(a.b,20,5,144,function(){b.M=b.M&65534|128;return!!(b.M&64)})}l.ad=function(a,b,d,c,f){var e=this.D;e.Sb=c&65535;e.M=e.M&-49|c>>12&48;e.Ub=65536-f&65535;switch(a){case 1:e.ha|=33024;e.M|=49152;break;case 2:e.ha|=33792,e.M|=49152}H(this.b,20,5,144,function(){e.M=e.M&65534|128;return!!(e.M&64)})}; +function $b(a){var b=a.F,d,c,f,e=b.G>>8&3;b.G&=-2;"undefined"===typeof b.ja[e]&&(b.ja[e]={cache:[],postProcess:a.bd,drive:e,blocksize:128,mapped:1,maxblock:b.fb[e]*b.U[e],url:"rl"+e+".dsk"});switch(b.G>>1&7){case 2:b.Za&8&&(b.G&=63);b.Za=b.Hc[e]|b.cb&64;break;case 3:1==(b.Y&3)&&(b.cb=b.Y&4?b.cb+(b.Y&65408)&65408|b.Y<<2&64:b.cb-(b.Y&65408)&65408|b.Y<<2&64,b.Y=b.cb);break;case 4:b.Za=b.cb;break;case 5:if(b.Y>>6>=b.fb[e]){b.G|=37888;break}if((b.Y&63)>=b.U[e]){b.G|=37888;break}d=(b.Y>>6)*b.U[e]+(b.Y& +63);c=(b.Ua&63)<<16|b.Ib;f=65536-b.Za&65535;Zb(a,b.ja[e],d,c,f);return;case 6:if(b.Y>>6>=b.fb[e])b.G|=37888;else if((b.Y&63)>=b.U[e])b.G|=37888;else{d=(b.Y>>6)*b.U[e]+(b.Y&63);c=(b.Ua&63)<<16|b.Ib;f=65536-b.Za&65535;a.bc(b.ja[e],d,c,f);return}}H(a.b,20,5,112,function(){b.G|=129;return!!(b.G&64)})} +l.bd=function(a,b,d,c,f){var e=this.F;e.Ib=c&65535;e.G=e.G&-49|c>>12&48;e.Ua=c>>16&63;e.Y=~~(d/e.U[b.Ja])<<6|d%e.U[b.Ja];e.cb=e.Y;e.Za=65536-f&65535;switch(a){case 1:e.G|=33792;break;case 2:e.G|=40960}H(this.b,20,5,112,function(){e.G|=129;return!!(e.G&64)})};function ac(a){a=a.I;a.N=2176;a.Aa=0;a.la=[4544,4544,4544,4544,4544,4544,4544,4544];a.xb=[0,0,0,0,0,0,0,0];a.mb=a.yb=a.wb=a.bb=a.mc=0} +function bc(a,b){var d=a.I,c,f,e;d.N&=-16513;d.Aa&=-2049;d.la[b]&=-1153;H(a.b,-1,0,172);"undefined"===typeof d.ja[b]&&(d.ja[b]={cache:[],postProcess:a.cd,drive:b,blocksize:256,mapped:0,maxblock:d.gc[0]*d.eb[0]*d.U[0],url:"rp"+b+".dsk"});switch(d.N&63){case 5:d.ec[b]=d.Pa[b];d.N|=32896;d.la[b]|=32896;d.mb|=1<=d.gc[0]||d.Ba[b]>>8>=d.eb[0]||(d.Ba[b]&255)>=d.U[0]){d.xb[b]|=1024;d.N|=49152;break}c=(d.Pa[b]*d.eb[0]+(d.Ba[b]>>8))*d.U[0]+ +(d.Ba[b]&255);f=(d.bb&63)<<16|d.wb;e=65536-d.yb&65535;Zb(a,d.ja[b],c,f,e);return;case 57:if(d.Pa[b]>=d.gc[0]||d.Ba[b]>>8>=d.eb[0]||(d.Ba[b]&255)>=d.U[0])d.xb[b]|=1024,d.N|=49152;else{c=(d.Pa[b]*d.eb[0]+(d.Ba[b]>>8))*d.U[0]+(d.Ba[b]&255);f=(d.bb&63)<<16|d.wb;e=65536-d.yb&65535;a.bc(d.ja[b],c,f,e);return}}H(a.b,3,5,172,function(){d.N=d.N&65534|128;d.la[b]|=128;return!!(d.N&64)})} +l.cd=function(a,b,d,c,f){var e=this.I;e.yb=65536-f&65535;e.wb=c&65535;e.N=e.N&-769|c>>8&768;e.bb=c>>16&63;f=~~(d/e.U[0]);c=~~(f/e.eb[0]);e.Ba[b.Ja]=f%e.eb[0]<<8|d%e.U[0];e.ec[b.Ja]=e.Pa[b.Ja]=c;e.mb|=1<=b.Wc-1&&(e.la[b.Ja]|=1024);switch(a){case 1:e.Aa|=512;e.N|=49152;break;case 2:e.Aa|=2048,e.N|=49152}H(this.b,20,5,172,function(){e.la[b.Ja]|=128;e.N=e.N&65534|128;return!!(e.N&64)})};l.Tc=function(){this.B.G|=128;this.B.G&64&&H(this.b,0,6,64)}; +function cc(a,b,d,c,f,e){var g=~~((e+d.Va-1)/d.Va),h=new XMLHttpRequest;2048>g&&c+2048dc(this.b,a.Vc?ec(this.b,d):d,a.cache[b][f])){a.ac(2,a,b,d,c);return}d+=2;--c}b++}a.ac(0,a,b,d,c)}; +function Zb(a,b,d,c,f){for(var e,g;0g){b.ac(2,b,d,c,f);return}b.cache[d][e]=g;c+=2;--f}d++}b.ac(0,b,d,c,f)}l.reset=function(){this.j.rb=this.j.rb&-120|20;this.g.Fa=0;this.g.pa=128;this.B.G=0;this.D.M=128;this.F.G=128;ac(this)}; +l.Gc=function(a,b,d){var c,f,e=this.b;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?c=e.Na&65280:(a&1&&(b<<=8),e.Na=b|255,c=0);break;case 4194298:if(0>b)c=e.dc;else{a&1&&(b<<=8);if(c=b&65024){f=c>>9;do c+=34;while(f>>=1)}e.dc=c;e.$a=2}break;case 4194294:if(70!==e.ib)return J(e,4,222);0>b?c=e.H:c=e.H=0;break;case 4194292:if(70!==e.ib)return J(e,4,224);c=1;break;case 4194290:if(70!==e.ib)return J(e,4,226);c=0;break;case 4194288:if(70!==e.ib)return J(e,4,228);c=61183;break;case 4194296:0<= +b&&!(a&1)&&(b&=255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.ib)return J(e,4,232);f=a-4194272>>1;0>b?c=e.jc[f]:(c=I(this,e.jc[f],a,b,d),0<=c&&(e.jc[f]=c));break;case 4194254:return a&1?e.qa>>14&1?(0<=b&&(e.i[6]=b),c=e.i[6]):(0<=b&&(e.Oa[3]=b),c=e.Oa[3]):e.qa>>14&0?(0<=b&&(e.i[6]=b),c=e.i[6]):(0<=b&&(e.Oa[1]=b),c=e.Oa[1]),c;case 4194252:case 4194250:case 4194248:return f=a&7,e.qa&2048?(0<=b&&(e.i[f]=b),c=e.i[f]):(0<=b&&(e.ab[f]= +b),c=e.ab[f]),c;case 4194246:return a&1?(0<=b&&(e.i[7]=b),c=e.i[7]):e.qa>>14&0?(0<=b&&(e.i[6]=b),c=e.i[6]):(0<=b&&(e.Oa[0]=b),c=e.Oa[0]),c;case 4194244:case 4194242:case 4194240:return f=a&7,e.qa&2048?(0<=b&&(e.ab[f]=b),c=e.ab[f]):(0<=b&&(e.i[f]=b),c=e.i[f]),c;default:return e.H|=16,J(e,4,124)}break;case 4194176:f=a>>1&31;c=I(this,e.ga[3][f],a,b,d);0<=c&&(e.ga[3][f]=c,e.ga[3][f&15]&=65295);break;case 4194112:var g=this.g;f=this.B;switch(a&-2){case 4194174:c=I(this,e.Db,a,b,d);0<=c&&(e.Db=c);break; +case 4194172:c=e.Qa;c&65280&&(c=(c<<8|c>>8)&65535);break;case 4194170:e.aa=e.aa&62337|e.Mb<<5|e.$b<<1;0>b?c=e.aa:(c=I(this,e.aa,a,b,d),0<=c&&(e.aa=c&=62337,e.Mb=c>>5&3,e.$b=c>>1&15,c&257?(f=2,e.Ra&16&&(f=1),e.sb=c&1?pb|E:E):(e.sb=0,f=4),this.j.rb=this.j.rb&-8|f));break;case 4194168:0>b?c=this.j.kd&65535:(c=I(this,this.j.data,a,b,d),0<=c&&(this.j.data=c));break;case 4194166:0<=b&&(b&127&&(g.Lc=0),g.pa&=-129,H(e,100,4,52,function(){g.pa|=128;return!!(g.pa&64)}));c=0;break;case 4194164:break;case 4194162:c= +0;0>b&&(g.Fa&=-129,0b?c=g.Fa:(c=I(this,g.Fa,a,b,d),0<=c&&(g.Fa=g.Fa&128|c&-129));break;case 4194150:0>b?(c=f.G,f.G&=-129):(c=I(this,f.G,a,b,d),0<=c&&(c&64&&!f.Lb&&(setInterval(this.Tc.bind(this),25),f.Lb=1),f.G=c&-129));break;default:return e.H|=16,J(e,4,126)}break;case 4194048:f=this.D;switch(a&-2){case 4194048:c=I(this,f.Tb,a,b,d);0<=c&&(f.Tb=c);break;case 4194050:c=I(this, +f.ha,a,b,d);0<=c&&(f.ha=c);break;case 4194052:c=I(this,f.M,a,b,d);0<=b&&0<=c&&(f.M=c&-36993|f.M&36992,f.M&1&&Yb(this));break;case 4194054:c=I(this,f.Ub,a,b,d);0<=c&&(f.Ub=c);break;case 4194056:c=I(this,f.Sb,a,b,d);0<=c&&(f.Sb=c);break;case 4194058:c=I(this,f.na,a,b,d);0<=c&&(f.na=c);break;case 4194060:break;case 4194062:c=I(this,f.zc,a,b,d);0<=c&&(f.zc=c);break;default:return e.H|=16,J(e,4,128)}break;case 4193728:var h=this.I;f=h.Aa&7;switch(a&-2){case 4193728:c=I(this,h.N,a,b,d);0<=b&&0<=c&&(h.bb= +h.bb&60|c>>8&3,h.N=c&17279|h.N&34944|2048,c&1&&h.N&128?bc(this,f):192==(c&192)&&H(e,0,5,172));break;case 4193730:c=I(this,h.yb,a,b,d);0<=c&&(h.yb=c);break;case 4193732:c=I(this,h.wb,a,b,d);0<=c&&(h.wb=c&65534);break;case 4193734:c=I(this,h.Ba[f],a,b,d);0<=c&&(h.Ba[f]=c&7967);break;case 4193736:c=I(this,h.Aa,a,b,d);0<=c&&(h.Aa=c&63|h.Aa&65472,c&128&&ac(this));break;case 4193738:c=h.la[f];break;case 4193740:c=h.xb[f];break;case 4193742:c=I(this,h.mb,a,b,d);0<=c&&(h.mb=c&255);break;case 4193744:c=h.hd[f]; +break;case 4193746:c=I(this,h.Ac,a,b,d);0<=c&&(h.Ac=c);break;case 4193748:c=I(this,h.Bc[f],a,b,d);0<=c&&(h.Bc[f]=c&1023);break;case 4193750:c=8210;break;case 4193752:c=h.jd[f];break;case 4193754:c=I(this,h.Cc[f],a,b,d);0<=c&&(h.Cc[f]=c);break;case 4193756:c=I(this,h.Pa[f],a,b,d);0<=c&&(h.Pa[f]=c&511);break;case 4193758:h.ec[f]=h.Pa[f];c=h.ec[f];break;case 4193760:c=h.fd[f];break;case 4193762:c=h.gd[f];break;case 4193764:c=h.dd[f];break;case 4193766:c=h.ed[f];break;case 4193768:c=I(this,h.bb,a,b,d); +0<=c&&(h.bb=c&63,h.N=h.N&-769|(c&3)<<8);break;case 4193770:c=I(this,h.mc,a,b,d);0<=c&&(h.mc=c);break;default:return e.H|=16,J(e,4,132)}break;case 4192512:f=this.F;switch(a&-2){case 4192512:c=I(this,f.G,a,b,d);0<=b&&0<=c&&(f.Ua=f.Ua&60|c>>4&3,f.G=f.G&-1023|c&1022,f.G&128||$b(this));break;case 4192514:c=I(this,f.Ib,a,b,d);0<=c&&(f.Ib=c&65534);break;case 4192516:c=I(this,f.Y,a,b,d);0<=c&&(f.Y=c);break;case 4192518:c=I(this,f.Za,a,b,d);0<=c&&(f.Za=c);break;case 4192520:c=I(this,f.Ua,a,b,d);0<=c&&(f.Ua= +c&63,f.G=f.G&-49|(f.Ua&3)<<4);break;default:return e.H|=16,J(e,4,134)}break;case 4191552:switch(a&-2){case 4191566:0>b?c=e.Ra:(c=I(this,e.Ra,a,b,d),0<=c&&(70!==e.ib&&(c&=-49),e.Ra=c,e.kb[0]=c&4?15:7,e.kb[1]=c&2?15:7,e.kb[3]=c&1?15:7,e.sb&&(f=2,e.Ra&16&&(f=1),this.j.rb=this.j.rb&-8|f)));break;default:return e.H|=16,J(e,4,136)}break;case 4191424:f=a>>1&31;c=I(this,e.ga[0][f],a,b,d);0<=c&&(e.ga[0][f]=c,e.ga[0][f&15]&=65295);break;case 4191360:f=a>>1&31;c=I(this,e.ga[1][f],a,b,d);0<=c&&(e.ga[1][f]=c, +e.ga[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!==e.ib)return J(e,4,234);f=a>>2&31;c=e.Vb[f];a&2&&(c>>=16);c&=65535;0<=b&&(c=I(this,c,a,b,d),0<=c&&(e.Vb[f]=a&2?c<<16|e.Vb[f]&65535:e.Vb[f]&4294901760|c&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)c=Ub[a>>1&255];else return e.H|=16,J(e,4,138);break;default:return e.H|=16,J(e,4,142)}d&&0<=c&&(a&1?c>>=8:c&=255);"undefined"===typeof c&&console.log("panic(76)"); +return c};var fc={},Vb=(fc[65534]=[null,null,Tb.prototype.Zc,Tb.prototype.md],fc[65396]=[null,null,Tb.prototype.$c,Tb.prototype.nd],fc);Ka(function(){for(var a=C(document,"pdp11","device"),b=0;b>1),this.b=new Int32Array(this.D,0,d>>2),mc(this,ic?nc:oc);else{this.b=Array(d>>2);for(a=0;a>2),b=0;b>8,d)},Z:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ma:function(a){var b=a>>2;a=(a&3)<<3;var d=this.b[b]>>a;return 24>a?d&65535:d&255|(this.b[b+1]&255)<<8},Ca:function(a,b){var d=a>> +2;a=(a&3)<<3;this.b[d]=this.b[d]&~(255<>2;a=(a&3)<<3;24>a?this.b[d]=this.b[d]&~(65535<>8);this.Xa=!0},V:function(a,b){if(this.C&&null!=this.w){var d=this.C;tc(d,this.w+a,1,d.T)&&d.ia(!0)}return this.Qb(a,b)},ea:function(a,b){if(this.C&&null!=this.w){var d=this.C;tc(d,this.w+a,2,d.T)&&d.ia(!0)}return this.lc(a,b)},wa:function(a,b,d){if(this.C&&null!=this.w){var c=this.C;tc(c,this.w+ +a,1,c.F)&&c.ia(!0)}this.J?this.B(a,b,d):this.Bb(a,b,d)},Ha:function(a,b,d){if(this.C&&null!=this.w){var c=this.C;tc(c,this.w+a,2,c.F)&&c.ia(!0)}this.J?this.B(a,b,d):this.pc(a,b,d)},T:function(a){return this.A[a]},X:function(a){return this.A[a]},$:function(a){return this.F.getUint16(a,!0)},fa:function(a){return a&1?this.A[a]|this.A[a+1]<<8:this.K[a>>1]},va:function(a,b){this.A[a]=b;this.Xa=!0},xa:function(a,b){this.A[a]=b;this.Xa=!0},Ga:function(a,b){this.F.setUint16(a,b,!0);this.Xa=!0},Sa:function(a, +b){a&1?(this.A[a]=b,this.A[a+1]=b>>8):this.K[a>>1]=b;this.Xa=!0}};function xb(a,b,d){a.C=b;a.g=a.j=0;d&&((a.g=d.g)&&sc(a,rc,!1),(a.j=d.j)&&qc(a,rc,!1))}function Ic(a,b){b?--a.j||(a.Ab=a.J?a.B:a.Bb,a.Ec=a.J?a.I:a.pc):--a.g||(a.vb=a.Qb,a.Rb=a.lc)}function qc(a,b,d){d&&a.j||(a.Ab=!a.J&&b[1]||a.B,a.Ec=!a.J&&b[3]||a.I);if(d||void 0===d)a.Bb=b[1]||a.B,a.pc=b[3]||a.I}function sc(a,b,d){d&&a.g||(a.vb=b[0]||a.O,a.Rb=b[2]||a.P);if(d||void 0===d)a.Qb=b[0]||a.O,a.lc=b[2]||a.P} +function mc(a,b){b||(b=Jc);sc(a,b,void 0);qc(a,b,void 0)}var Jc=[],pc=[G.prototype.Z,G.prototype.Ca,G.prototype.ma,G.prototype.Eb],rc=[G.prototype.V,G.prototype.wa,G.prototype.ea,G.prototype.Ha];if(ob)var oc=[G.prototype.T,G.prototype.va,G.prototype.$,G.prototype.Ga],nc=[G.prototype.X,G.prototype.xa,G.prototype.fa,G.prototype.Sa]; +function Kc(a,b){u.call(this,"CPU",a,Kc,1);var d=a.multiplier||1;this.wa=a.cycles||b;this.lb=d;this.va=Math.round(this.wa/1E4)/100;this.jb=this.va*this.lb;this.u.da=!1;this.u.oc=!1;this.u.Gb=a.autoStart;this.u.wc=!1;this.u.qb=!1;this.Nb=this.T=0;this.Ob=a.csStart;this.tb=a.csInterval;this.ub=a.csStop;this.ea=[];this.Cb=this.nb.bind(this);D(this)}w(Kc);var Lc=["power","reset"];l=Kc.prototype; +l.Ya=function(a,b,d,c){this.g=a;this.A=b;this.C=c;for(b=0;b=a.T&&(a.T+=a.tb,d=!0);0<=a.ub&&a.ub<=Qc(a)&&(a.tb=a.ub=-1,Oc(a),a.ia(),d=!0);d&&a.f(Qc(a)+" cycles: checksum="+r(a.Nb))}} +function Rc(a,b,d,c){if(a.J[b]){void 0===d&&(nb(a,"Value for "+b+" is invalid"),a.ia());var f=a.C&&a.C.wa||8;d=!a.u.da||a.u.wc?8==f?ca(d,c):r(d,c):"--------".substr(0,c||4);a.J[b].textContent!=d&&(a.J[b].textContent=d)}} +l.oa=function(a,b,d){var c=this;a=!1;switch(b){case "power":case "reset":this.J[b]=d;a=!0;break;case "run":this.J[b]=d;d.onclick=function(){var a;if(a=c.g)if(a=c.g,a.u.ba)a=!0;else{var b=null,d,h=gb(a.id);for(d=0;da.I/a.jb?b=1:c=!0;a.lb=b;b=a.va*a.lb;if(a.jb!=b){a.jb=b;b=a.jb.toFixed(2)+"Mhz";var f=a.J.setSpeed;f&&(f.textContent=b);a.f("target speed: "+b)}d&&a.g&&a.g.Wb()}Tc(a,a.F);a.F=0;a.D=qa();a.K=0;Uc(a);return c}function Vc(a){a.O-=a.b;a.b=0} +l.nb=function(a){if(kb(this,!0)){if(!this.u.da){Sc(this);this.g&&this.g.start(this.D,Qc(this));this.u.da=!0;this.u.oc=!0;this.Z&&this.Z.start();var b=this.J.run;b&&(b.textContent="Halt");this.g&&(this.g.ua(!0),a&&this.g.Wb(!0))}this.xa>=this.wa&&Uc(this,!0);this.$=0;this.fa=qa();this.K&&(a=this.fa-this.K,a>this.Sa&&(this.D+=a,this.D>this.fa&&(this.D=this.fa)));try{do{for(var d,c=this.u.qb?1:this.ma,f=this.ea.length-1;0<=f;f--){var e=this.ea[f];0>e[0]||c>e[0]&&(c=e[0])}d=c;try{this.zb(d)}catch(m){if("number"!= +typeof m)throw m;}var g=this.O-this.b;a=g;for(var h=this.ea.length-1;0<=h;h--){var k=this.ea[h];0>k[0]||(k[0]-=a,0>=k[0]&&(k[0]=-1,k[1]()))}this.$+=g;this.F+=g;Tc(this,0,!0);Pc(this,g);this.V-=g;if(0>=this.V){this.V+=this.ma;15<=++this.ob&&(this.g&&this.g.ua(),this.ob=0);break}}while(this.u.da)}catch(m){this.ia();K(this);this.g&&this.g.stop(qa(),Qc(this));kb(this,!1);nb(this,m.stack||m.message);return}d=setTimeout;c=this.Cb;this.K=qa();f=this.Sa;this.$&&(f=Math.round(f*this.$/this.ma));f-=this.K- +this.fa;if(e=this.K-this.D)this.I=Math.round(this.F/(10*e))/100,864E5<=e&&(this.P=0,Sc(this));if(0>f||this.If&&(this.D-=f),f=0;this.xa+=this.$;this.K+=f;d(c,f)}else K(this),this.g&&this.g.stop(qa(),Qc(this))};l.zb=function(){return 0};l.ia=function(a){lb(this,!0);Vc(this);Tc(this,this.F);this.F=0;if(this.u.da){this.u.da=!1;this.Z&&this.Z.stop();var b=this.J.run;b&&(b.textContent="Run")}this.u.complete=a};function K(a,b){a.g&&a.g.ua(b)} +function Wc(a){this.Xc=+a.model||1170;this.Yb=a.resetAddr||0;Kc.call(this,a,1E6);this.Ga=0;this.decode=Xc.bind(this);this.ya=65536;this.sa=32768;this.ta=65535;this.ra=32768;this.i=[0,0,0,0,0,0,0,this.Yb];this.ab=[0,0,0,0,0,0];this.Oa=[0,0,0,0];this.Na=255;this.$b=this.Mb=this.sb=this.B=this.Ra=this.Db=this.Qa=this.aa=this.H=this.dc=0;this.kb=[7,7,7,7];this.ga=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.Vb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.jc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.S=0;this.ib=70;this.X=-1;this.j=[];this.Hb=0;this.$a=2;Yc(this);this.u.complete=this.u.Kc=!1}w(Wc,Kc);l=Wc.prototype; +l.reset=function(){this.u.da&&this.ia();Zc(this);Nc(this);this.u.error=!1;this.parent.reset.call(this)};function Zc(a){a.Na=255;a.H=0;a.j=[];a.dc=0;a.aa=a.Qa=a.Db=a.Ra=a.sb=0;a.kb[0]=a.kb[1]=a.kb[3]=7;a.Mb=0;Yc(a)}function Yc(a){a.sb?(a.Ca=65536,a.W=a.Rc,a.Rb=a.Ma):(a.Ca=0,a.W=a.Qc,a.Rb=a.cc)}l.yc=function(){return 0};l.save=function(){var a=new M(this);a.set(0,[]);a.set(1,[this.Ha,this.P,this.lb]);a.set(2,Sb(this.A));return a.data()}; +l.restore=function(a){var b=a[1];this.Ha=b[0];this.P=b[1];Sc(this,b[3]);a:{b=this.A;a=a[2];var d;for(d=0;db){a.j[e].Wa-=b;break}b-=a.j[e].Wa}a.j.splice(e+1,0,{delay:b,priority:d<<5&224,vector:c,callback:f})}a.$a=2}function Wb(a){return a.qa=a.qa&63728|(a.ra&32768?8:0)|(a.ta&65535?0:4)|(a.sa&32768?2:0)|(a.ya&65536?1:0)} +function Xb(a,b){a.ra=b<<12;a.ta=~b&4;a.sa=b<<14;a.ya=b<<16;if((b^a.qa)&2048)for(var d=a.ab.length;0<=--d;){var c=a.i[d];a.i[d]=a.ab[d];a.ab[d]=c}a.B=b>>14&3;d=a.qa>>14&3;a.B!=d&&(a.Oa[d]=a.i[6],a.i[6]=a.Oa[a.B]);a.$a=2;a.qa=b}function $c(a,b){a.S&128||(a.ra=a.ta=a.ya=b,a.sa=0)}function ad(a,b){a.S&128||(a.ra=a.ta=b,a.sa=0)}function bd(a,b,d,c){a.S&128||(a.ra=a.ta=a.ya=b,a.sa=(d^c)&(c^b))} +function J(a,b,d){var c=!1;0>a.X?a.X=Wb(a):a.B||(b=4,c=!0);a.aa&57344||(a.Qa=63222,a.Db=b);a.B=0;var f=a.Ma(b|65536),e=a.Ma(b+2&65535|65536);Xb(a,e&53247|a.X>>2&12288);c&&(a.H|=4,a.i[6]=4);cd(a,a.X);cd(a,a.i[7]);a.i[7]=f;a.S&=-113;a.X=-1;throw b|d<<8;}function ec(a,b){var d=b>>13&31;31>d?a.Ra&32&&(b=a.Vb[d]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b} +function dd(a,b,d){var c,f,e,g=0;if(d&a.sb){c=b>>13&a.kb[a.B];f=a.ga[a.B][c];e=(a.ga[a.B][c+16]<<6)+(b&8191)&4194303;a.Ra&16?3932160<=e&&4186112>e&&(e=ec(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.H|=32,J(a,4,24)),e&1&&!(d&1)&&(a.H|=64,J(a,4,26)));switch(f&7){case 1:g=4096;case 2:f|=128;d&E&&(g=8192);break;case 4:g=4096;case 5:d&E&&(g=4096);case 6:f|=d&E?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.ga[a.B][c]=f;if(4194170!==e||a.B)a.Mb=a.B,a.$b=c;g&&(g&57344&&(0<=a.X&&(g|=128),a.aa&57344||(a.aa=a.aa|g|a.Mb<<5|a.$b<<1),J(a,168,28)),a.aa&61440||!(4191360>e||4194239>3&7){case 0:J(a,4,34);break;case 1:return 6===e&&!a.B&&d&E&&(a.i[6]<=a.Na||65534<=a.i[6])&&(a.i[6]<=a.Na-32||65534<=a.i[6]?(a.H|=4,a.i[6]=4,J(a,4,36)):(a.H|=8,a.S|=64)),7===e?a.i[e]:a.i[e]|g;case 2:f=2;c=a.i[e];7!==e&&(c|=g,6>e&&d&1&&(f=1));break;case 3:f=2;c=a.i[e];7!==e&&(c|=g);if(0>(c=a.Ma(c)))return c;c|=g;break;case 4:f=-2;6>e&&d&1&&(f=-1);c=a.i[e]+f&65535;7!==e&&(c|=g);break;case 5:f=-2;c=a.i[e]-2&65535;7!==e&&(c|=g);if(0>(c=a.Ma(c)))return c; +c|=g;break;case 6:if(0>(c=a.Ma(a.i[7])))return c;a.i[7]=a.i[7]+2&65535;c=c+a.i[e]&65535;return c|g;case 7:if(0>(c=a.Ma(a.i[7])))return c;a.i[7]=a.i[7]+2&65535;c=c+a.i[e]&65535;return 0>(c=a.Ma(c|65536))?c:c|g}a.i[e]=a.i[e]+f&65535;!g||a.aa&57344||(a.Qa=a.Qa<<8|f<<3&248|e);6===e&&!a.B&&d&E&&0>=f&&(a.i[6]<=a.Na||65534<=a.i[6])&&(a.i[6]<=a.Na-32?(a.H|=4,a.i[6]=4,J(a,4,38)):(a.H|=8,a.S|=64));return c}l.Qc=function(a,b){return gd(this,a,b)};l.Rc=function(a,b){return dd(this,gd(this,a,b),b)}; +function N(a,b){return b&56?a.Rb(gd(a,b,pb)):a.i[b&7]}function hd(a,b){return b&56?ed(a,a.W(b,rb)):a.i[b&7]&255}function id(a,b,d,c){b&56?(b=a.W(b,qb),dc(a,b,c.call(a,d,a.cc(b)))):(b&=7,a.i[b]=c.call(a,d,a.i[b])&65535)}function jd(a,b,d,c){b&56?(b=a.W(b,tb),fd(a,b,c.call(a,d,ed(a,b)))):(b&=7,a.i[b]=a.i[b]&65280|c.call(a,d,a.i[b])&255)}function kd(a,b,d){b&56?dc(a,a.W(b,E),d):a.i[b&7]=d&65535;return d} +function ld(a,b,d,c){b&56?fd(a,a.W(b,sb),d):(b&=7,a.i[b]=d?c&1?d<<24>>24&65535:a.i[b]&-256|d&255:a.i[b]&-256);return d} +l.zb=function(a){this.u.complete=!0;var b=this.u.Kc=this.C&&md(this.C),d=a?this.u.oc?0:1:-1;this.u.oc=!1;this.O=this.b=a;this.Ha&256?(Vc(this),a=!1):a=!0;if(a){do{if(b){if(nd(this.C,this.i[7],d)){this.ia();break}d=1}var c,f;this.S&112&&(this.S&32?J(this,168,52):this.S&64?J(this,4,54):this.S&16&&J(this,12,56),this.S&=-113);if(this.$a)if(1===this.$a)this.$a=2;else{this.$a=0;f=-1;a=this.dc&224;if(0<(c=this.j.length))for(;0a&&(a=this.j[c].Yc,f=c)}a>(this.qa&224)&&(0>f?J(this,160,42):(J(this,this.j[f].ld,44),this.j.splice(f,1)))}this.aa&57344||(this.Qa=0,this.Db=this.i[7]);this.S=this.qa&16;a=this.Ma(this.i[7]);0<=a&&(this.i[7]=this.i[7]+2&65535);this.decode(a)}while(0>6&7;cd(this,this.i[a]);this.i[a]=this.i[7];this.i[7]=b;--this.b}function yd(){--this.b}function zd(){--this.b}function Q(a){a&1&&(this.ya=65536);a&2&&(this.sa=32768);a&4&&(this.ta=0);a&8&&(this.ra=32768);--this.b}function Ad(){--this.b}function Bd(){--this.b}function R(){J(this,8,48)}function Xc(a){Cd[a>>12].call(this,a)} +var Cd=[function(a){Dd[a>>8&15].call(this,a)},function(a){ad(this,kd(this,a,N(this,a>>6)));--this.b},function(a){var b=N(this,a>>6);a=N(this,a);bd(this,b-a,a,b);--this.b},function(a){ad(this,N(this,a>>6)&N(this,a));--this.b},function(a){id(this,a,N(this,a>>6),pd);--this.b},function(a){id(this,a,N(this,a>>6),rd);--this.b},function(a){id(this,a,N(this,a>>6),od);--this.b},function(a){Ed[a>>8&15].call(this,a)},function(a){Fd[a>>8&15].call(this,a)},function(a){var b=hd(this,a>>6);ad(this,ld(this,a,b,1)<< +8);--this.b},function(a){var b=hd(this,a>>6)<<8;a=hd(this,a)<<8;bd(this,b-a,a,b);--this.b},function(a){ad(this,(hd(this,a>>6)&hd(this,a))<<8);--this.b},function(a){jd(this,a,hd(this,a>>6),qd);--this.b},function(a){jd(this,a,hd(this,a>>6),sd);--this.b},function(a){id(this,a,N(this,a>>6),td);--this.b},R],Dd=[function(a){Gd[a>>4&15].call(this,a)},function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b},xd,xd,function(a){Hd[a>> +6&3].call(this,a)},function(a){Id[a>>6&3].call(this,a)},function(a){Jd[a>>6&3].call(this,a)},function(a){Kd[a>>6&3].call(this,a)},R,R],Gd=[function(a){Ld[a&15].call(this,a)},R,R,R,R,R,R,R,R,R,function(a){Md[a&15].call(this,a)},function(a){Nd[a&15].call(this,a)},R,R,R,R],Md=[zd,function(){this.ya=0;--this.b},function(){this.sa=0;--this.b},O,function(){this.ta=1;--this.b},O,O,O,function(){this.ra=0;--this.b},O,O,O,O,O,O,O],Nd=[zd,function(){this.ya=65536;--this.b},function(){this.sa=32768;--this.b}, +Q,function(){this.ta=0;--this.b},Q,Q,Q,function(){this.ra=32768;--this.b},Q,Q,Q,Q,Q,Q,Q],Ld=[function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b},function(){this.qa&49152||(Zc(this),this.A.reset());--this.b},function(){--this.b},function(){--this.b},R,R,R,R,R,R,R,R],Ed=[yd,yd,wd,wd,ud,ud,vd,vd,Bd,Bd,R,R,R,R,Ad,Ad],Fd=[function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b}, +function(){--this.b},function(){--this.b},function(){--this.b},function(a){Od[a>>6&3].call(this,a)},function(a){Pd[a>>6&3].call(this,a)},function(a){oe[a>>6&3].call(this,a)},function(a){pe[a>>6&3].call(this,a)},R,R],Hd=[function(a){$c(this,kd(this,a,0));--this.b},function(){--this.b},function(){--this.b},function(){--this.b}],Id=[function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b}],Jd=[function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b}], +Kd=[function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b}],Od=[function(a){$c(this,ld(this,a,0));--this.b},function(){--this.b},function(){--this.b},function(){--this.b}],Pd=[function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b}],oe=[function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b}],pe=[function(){--this.b},function(){--this.b},function(){--this.b},function(){--this.b}]; +function qe(a){u.call(this,"ROM",a,qe);this.g=null;this.F=a.addr;this.j=a.size;this.I=a.writable;this.B=a.alias;this.D=a.file;this.K=da(this.D);if(this.D){a=this.D;var b=ea(this.K);"json"!=b&&"hex"!=b&&(a=ga()+"/api/v1/dump?file="+this.D+"&format=bytes&decimal=true");var d=this;sa(a,null,!0,function(a,b,e){re(d,a,b,e)})}}w(qe);qe.prototype.Ya=function(a,b,d,c){this.A=b;this.b=d;this.C=c;se(this)}; +qe.prototype.La=function(){if(this.Ia){if(this.C){var a=this.C,b=this.id,d=this.F,c=this.j,f=this.Ia,e=[],g;for(g in f){var h=f[g];"number"==typeof h&&(f[g]=h={o:h});var k=h.o,m=h.a;if(void 0!==k){var n=e,k=[k>>>0,g],q=pa(n,k,a.uc);0>q&&n.splice(-(q+1),0,k)}m&&(h.a=m.replace(/''/g,'"'))}a.I.push({pd:b,w:d,Uc:c,Ia:f,rc:e})}delete this.Ia}return!0};qe.prototype.Ka=function(){return!0}; +function re(a,b,d,c){if(c)a.ka("Unable to load system ROM (error "+c+": "+b+")");else{Va(a.sc,b,d);var f;if("["==d.charAt(0)||"{"==d.charAt(0))try{var e,g,h=eval("("+d+")");if(e=h.bytes)a.g=e;else if(e=h.words)for(a.g=Array(2*e.length),g=f=0;f>8&255;else if(e=h.data)for(a.g=Array(4*e.length),g=f=0;f>8&255,a.g[g++]=e[f]>>16&255,a.g[g++]=e[f]>>24&255;else a.g=h;a.Ia=h.symbols;if(!a.g.length){t("Empty ROM: "+ +b);return}if(1==a.g.length){t(a.g[0]);return}}catch(k){a.ka("ROM data error: "+k.message);return}else for(b=d.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.g=Array(b.length),f=0;f>>c.R].Bb(f&c.A,a.g[d]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.B?b.push(a.B):null!=a.B&&a.B.length&&(b=a.B);for(d=0;d>>f.R;0>>=f.R;0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; +function xe(a,b,d,c){if(d)if(b){0>a.D&&a.B.length&&(a.D=0);if(0>a.D||b!=a.B[a.D])a.B.splice(0,0,b),a.D=0;a.D--}else a.Z?b="end":b=a.B[a.D+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");d=0;var f=null;c=c||";";for(var e=0;e<=b.length;e++){var g=b.charAt(e);if('"'==g||"'"==g)f?g==f&&(f=null):f=g;else if(g==c&&!f||!g)a.push(la(b.substring(d,e))),d=e+1}}return a} +function ye(a,b,d){for(d=d||-1;d--&&b.length;){var c=b.pop();if(2>a.length)return!1;var f=a.pop(),e=a.pop();switch(c){case "*":c=e*f;break;case "/":if(!f)return!1;c=e/f;break;case "%":if(!f)return!1;c=e%f;break;case "+":c=e+f;break;case "-":c=e-f;break;case "<<":c=e<>":c=e>>f;break;case ">>>":c=e>>>f;break;case "<":c=e":c=e>f?1:0;break;case ">=":c=e>=f?1:0;break;case "==":c=e==f?1:0;break;case "!=":c=e!=f?1:0;break;case "&":c=e&f;break; +case "^":c=e^f;break;case "|":c=e|f;break;case "&&":c=e&&f?1:0;break;case "||":c=e||f?1:0;break;default:return!1}a.push(c|0)}return!0} +function ze(a,b,d){var c;if(b){b=Ae(a,b);for(var f=0,e=!1,g=b,h=[],k=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);f>=1;g=n+g;c>>=8}c=r(d,0,!0)+" "+d+". "+ca(d,0,!0)+" "+("0b"+g)}a.f((null!=b?b+": ":"")+c);return f} +function De(a,b){if(b)return Ce(a,b,a.ea[b]);var d=0;for(b in a.ea)Ce(a,b,a.ea[b]),d++;return 0>>c.H.Z;k=1}c.i("blockid physical blockaddr used size type");c.i("-------- --------- ---------- ------ ------ ----");for(var d=-1,m=0;k--;){var n=b[e];n.type==d?m++||c.i("..."):(d=n.type,m=Hb[d],n&&c.i(r(n.id,8)+" %"+r(e<>>d.Z].Sb(c&d.g,c),b&&Oe(a,b));return d};l.La=function(a,b){var d=65535,c=this.L(a,!1,2);-1!==c&&(d=Ib(this.H,c),b&&Oe(a,b));return d}; -l.gc=function(a,b,d){var c=this.L(a,!0,1);if(-1!==c){var e=this.H;e.S[(c&e.H)>>>e.Z].Cb(c&e.g,b&255,c);d&&Oe(a,d);N(this.b,!0)}};l.oc=function(a,b,d){var c=this.L(a,!0,2);if(-1!==c){var e=this.H,f=c&e.g,g=(c&e.H)>>>e.Z;f!=e.g?e.S[g].qc(f,b&65535,c):(e.S[g++].Cb(f,b&255,c),e.S[g&e.w].Cb(0,b>>8&255,c+1));d&&Oe(a,d);N(this.b,!0)}};function Z(a){return{A:a,Ka:!1}}function Pe(a){return[a.A,a.Ka]}function Qe(a){return{A:a[0],Ka:a[1]}} -function Ne(a,b,d){var c;d=(d?a.X:a.Db).A;if(void 0!==b){c=b=Ae(a,b);var e;if(c.match(/^[a-z_][a-z0-9_]*$/i))for(c=c.toUpperCase(),d=0;dc&&(c+=b.length);0>c&&(c=0);for(var e=b.length;c>>c.Z],!1)}a.Y=["br"];if(a.J)for(b=1;b>>c.Z],!0);a.J=["bw"];a.Ib=0} -l.hb=function(a,b,d){var c=!0;d||We(this,a,b,!1,!0);if(a!=this.g){var e=this.L(b);if(-1===e)this.i("invalid address: "+Y(this,b.A)),c=!1;else{var f=this.H;f.S[e>>>f.Z].hb(e&f.g,a==this.J)}}c&&(a.push(b),d?b.Ka=!0:(Xe(this,a,a.length-1,"set"),Ge(this)));return c};function We(a,b,d,c,e){var f=!1;d=a.L(d);for(var g=1;g>>c.Z],b==a.J));h.Ka||Ge(a);break}}return f} -function Ye(a,b){for(var d=1;d>23)&65535,x=Y(p,q);else if(8192==A)q=q.A-((f&63)<<1)&65535,x=Y(p,q);else if(12288==A)x=Y(p,f&7,2);else if(24576==A)x=Y(p,f&63);else if(A=f&z,z&4032&&(A>>=6,z>>=6),z&63)switch(z=A&7,A&56){case 0:x=af(z);break;case 8:x="@"+af(z);break;case 16:7>z?x="("+af(z)+ -")+":(A=p.La(q,2),x="#"+Y(p,A));break;case 24:7>z?x="@("+af(z)+")+":(A=p.La(q,2),x="@#"+Y(p,A));break;case 32:x="-("+af(z)+")";break;case 40:x="@-("+af(z)+")";break;case 48:A=p.La(q,2);x=Y(p,A)+"("+af(z)+")";7==z&&(x=[x,Y(p,A+q.A&65535)]);break;case 56:A=p.La(q,2),x="@"+Y(p,A)+"("+af(z)+")",7==z&&(x=[x,Y(p,A+q.A&65535)])}p=x;if(!p||!p.length){h="INVALID";break}"string"!=typeof p&&(d||(d=p[1]),p=p[0]);0a?"R"+a:6==a?"SP":"PC"} -function cf(a,b){var d="",c=a.b;8>b?(d=af(b),d+="="+Y(a,c.f[b])):13>b?d="A"+(b-8)+"="+Y(a,c.bb[b-8]):16<=b&&20>b?d="S"+(b-16)+"="+Y(a,c.ua[b-16]):20==b&&(d="PS="+Y(a,Yb(c)));d&&(d+=" ");return d}function df(a){var b,d="";for(b=0;6>b;b++)d+=cf(a,b);d=d+"\n"+(cf(a,6)+cf(a,7)+cf(a,20));return d+=bf(a,"T")+bf(a,"N")+bf(a,"Z")+bf(a,"V")+bf(a,"C")}l.vc=function(a,b){return a[0]>b[0]?1:a[0]>>0;for(b=0;b>>0,h=f.Uc;if(e>=g&&eh[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.i(m)}h[3]&&(g=h[3],f=null);f=$e(a,b,g,f);a.i(f);a.X=b;e-=b.A-k;d++}}} -function Ze(a,b,d){var c=!0;try{b.length&&"end"!=b?d||a.i(">> "+b):(a.ca&&(a.i("ended assemble at "+Y(a,a.ba.A)),a.X=a.ba,a.ca=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.Ca=null;if(qb(a)&&0m||"z"fa.length&&(a.i("note: only "+fa.length+" available"),W=fa.length);aa-=W;0>aa&&(null==fa[fa.length-1].A?(W=aa+W,aa=0):aa+=fa.length);var Dc=[];"call"==Yd&&(fb=1E5,Dc=["CALL"]);for(void 0!==Xd&&a.i(W+" instructions earlier:");0=fa.length&& -(aa=0);a.Kb=W;$d++;fb--}}$d||(a.i("no "+Zd+"history available"),a.Kb=void 0)}else{var Lb=Ne(a,ea);if(Lb){var Mb=0;va&&("l"==va.charAt(0)&&(va=va.substr(1)||Df),Mb=Be(a,va)>>>0,65536>4||1;Ff--&&0Qb?String.fromCharCode(Qb):".";Ob--}hb&& -(hb+="\n");hb+=ea+" "+Fc+(ib?"":" "+ce)}hb&&a.i(hb);a.Db=Lb}}}}break;case "e":if("else"==f[0])break;var Rb=1,de=255,ee=a.Mb,fe=a.gc;"ew"==f[0]&&(Rb=2,de=65535,ee=a.La,fe=a.oc);var ge=Rb<<1,he=f[1];if(null==he)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a");else{var Sb=Ne(a,he);if(Sb)for(var Tb=2;TbJc;){for(var wa=null,Jf=256;65536>lb.A>>>0;){je.A=a.La(lb,2);if(null==lb.A||!Jf--)break;for(var Kf=a,Ub=je,ke=null,mb=Ub.A,le=mb,Kc=1;6>=Kc&&mb;Kc++){if(2\nLicense: GPL version 3 or later ");this.i("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bof){if(qf(c,this.W)){this.J=new O(this,"1.30.0","failsafe");qf(this.J)&&(vf(this,c),a=2,wf(this.J));this.J.set("timestamp",sa());xf(this.J);var e=this.g&&!this.O;if(1==a||xa("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(d=uf(c)){var f=c.get("code"),g=c.get("data");f&&("ok"==f?qf(c,g):("error"== -f&&"no machine state"!=g?(this.sa("Error: "+g),"unable to verify user"==g&&(Ba("user",""),this.w=null)):this.i(f+": "+g),wf(c),qf(c)?(d=uf(c),e=!0):d=!1))}e&&tf(this,d?c:null)}else 2==a&&c.clear()}else tf(this);delete this.W;delete this.X}e=$a(this.id);for(f=0;fa[1];a=a[2];this.ia=!0;this.j.ga=!0;var c=this.P.power;c&&(c.textContent="Shutdown");this.b&&(yf(this,this.b,b,d,a),this.b.Hb());this.ba&&(vf(this,b),b.clear());!d&&this.J&&(this.J.clear(),delete this.J);this.u=0}; -function vf(a,b){if(xa("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var d=a.w||"";b=b.toString();var c={app:"PDP11js",ver:"1.30.0"};c.url=a.url;c.user=d;c.type="bug";c.data=b;ta("http://www.pcjs.org/api/v1/report",c,!0)}} -function lf(a,b,d){var c,e="none";if(a.u)return null;a.u--;var f=new O(a,"1.30.0"),g=new O(a,"1.30.0","validate"),h=sa();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.0");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Pa&&(d&&a.b.pa(),c=a.b.Pa(b,d),"object"===typeof c&&f.set(a.b.id,c),d&&(a.b.j.ga=!1,!1===c&&(e=null)));for(var h=$a(a.id),k=0;kf.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),c?"}"==c.slice(-1)?(c=c.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+d+"$2"+(c?" parms='"+c+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDP11js$2"), -a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){f=null,a=n.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=c[2];b("Loading "+e+"...");ta(e,null,!0,function(f,g,h){if(h||!g)d(a,"unable to resolve XML reference: "+c[0]+" ("+h+")");else{if(f=c[3])if(h=g.match(new RegExp("<"+c[1]+"[^>]*>"))){for(var k=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{d(a,"missing <"+c[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(c[0],g);Qf(a,b,d)}})}else d(a,null)} -function Rf(a,b,d,c){function e(a){if(void 0===h){var b=g&&B(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ma(a))}function f(a){e("Error: "+a);k&&(--Cf||Qa(!0));k=!1}var g,h,k=!0;Cf++;Ya[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=m:q.appendChild(document.createTextNode(m));n.appendChild(q)}d|| -(d="/versions/pdp11/1.30.0/components.xsl");m=function(c,h){h?Of(d,null,null,!1,e,function(c,k){k?(Za(a,d,c),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--Cf||Qa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(c=new XSLTProcessor,c.importStylesheet(k),(k=c.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--Cf||Qa(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(c)}):f(c)};"<"!=b.charAt(0)?Of(b,a,c,!0,e,m):Pf(b,null,a,c,!1,e,m)}else f("missing machine element: "+a)}catch(p){f(p.message)}return k}window.embedPDP11=function(a,b,d,c){Qa(!1);return Rf(a,b,d,c)};window.enableEvents=Qa;window.sendEvent=Ra;})(); +l.Ya=function(a,b,d,c){this.A=b;this.b=d;this.g=a;(a=Mc(a,"messages"))&&He(this,a);this.vc=Le;Me(this,function(a){a:{var b=c.A.L,d=a[0],f=a=0,k=b.length;if(d){a=c.W(V(c,d));if(-1===a){c.f("invalid address: "+d);break a}f=a>>>c.A.R;k=1}c.f("blockid physical blockaddr used size type");c.f("-------- --------- ---------- ------ ------ ----");for(var d=-1,m=0;k--;){var n=b[f];n.type==d?m++||c.f("..."):(d=n.type,m=Qb[d],n&&c.f(r(n.id,8)+" %"+r(f<>>d.R].Qb(c&d.A,c),b&&Ne(a,b));return d};l.Ea=function(a,b){var d=65535,c=this.W(a,!1,2);-1!==c&&(d=Rb(this.A,c),b&&Ne(a,b));return d}; +l.fc=function(a,b,d){var c=this.W(a,!0,1);if(-1!==c){var f=this.A;f.L[(c&f.g)>>>f.R].Bb(c&f.A,b&255,c);d&&Ne(a,d);K(this.b,!0)}};l.nc=function(a,b,d){var c=this.W(a,!0,2);if(-1!==c){var f=this.A,e=c&f.A,g=(c&f.g)>>>f.R;e!=f.A?f.L[g].pc(e,b&65535,c):(f.L[g++].Bb(e,b&255,c),f.L[g&f.j].Bb(0,b>>8&255,c+1));d&&Ne(a,d);K(this.b,!0)}};function U(a){return{w:a,Da:!1}}function Oe(a){return[a.w,a.Da]}function Pe(a){return{w:a[0],Da:a[1]}} +function V(a,b,d){var c;d=(d?a.P:a.Cb).w;if(void 0!==b){c=b=Ae(a,b);var f;if(c.match(/^[a-z_][a-z0-9_]*$/i))for(c=c.toUpperCase(),d=0;dc&&(c+=b.length);0>c&&(c=0);for(var f=b.length;c>>c.R],!1)}a.T=["br"];if(a.F)for(b=1;b>>c.R],!0);a.F=["bw"];a.Hb=0} +l.gb=function(a,b,d){var c=!0;d||Ve(this,a,b,!1,!0);if(a!=this.j){var f=this.W(b);if(-1===f)this.f("invalid address: "+S(this,b.w)),c=!1;else{var e=this.A;e.L[f>>>e.R].gb(f&e.A,a==this.F)}}c&&(a.push(b),d?b.Da=!0:(We(this,a,a.length-1,"set"),Ge(this)));return c};function Ve(a,b,d,c,f){var e=!1;d=a.W(d);for(var g=1;g>>c.R],b==a.F));h.Da||Ge(a);break}}return e} +function Xe(a,b){for(var d=1;d>23)&65535,x=S(p,q);else if(8192==A)q=q.w-((e&63)<<1)&65535,x=S(p,q);else if(12288==A)x=S(p,e&7,2);else if(24576==A)x=S(p,e&63);else if(A=e&z,z&4032&&(A>>=6,z>>=6),z&63)switch(z=A&7,A&56){case 0:x=W(z);break;case 8:x="@"+W(z);break;case 16:7>z?x="("+W(z)+")+": +(A=p.Ea(q,2),x="#"+S(p,A));break;case 24:7>z?x="@("+W(z)+")+":(A=p.Ea(q,2),x="@#"+S(p,A));break;case 32:x="-("+W(z)+")";break;case 40:x="@-("+W(z)+")";break;case 48:A=p.Ea(q,2);x=S(p,A)+"("+W(z)+")";7==z&&(x=[x,S(p,A+q.w&65535)]);break;case 56:A=p.Ea(q,2),x="@"+S(p,A)+"("+W(z)+")",7==z&&(x=[x,S(p,A+q.w&65535)])}p=x;if(!p||!p.length){h="INVALID";break}"string"!=typeof p&&(d||(d=p[1]),p=p[0]);0a?"R"+a:6==a?"SP":"PC"} +function af(a,b){var d="",c=a.b;8>b?(d=W(b),d+="="+S(a,c.i[b])):13>b?d="A"+(b-8)+"="+S(a,c.ab[b-8]):16<=b&&20>b?d="S"+(b-16)+"="+S(a,c.Oa[b-16]):20==b&&(d="PS="+S(a,Wb(c)));d&&(d+=" ");return d}function bf(a){var b,d="";for(b=0;6>b;b++)d+=af(a,b);d=d+"\n"+(af(a,6)+af(a,7)+af(a,20));return d+=$e(a,"T")+$e(a,"N")+$e(a,"Z")+$e(a,"V")+$e(a,"C")}l.uc=function(a,b){return a[0]>b[0]?1:a[0]>>0;for(b=0;b>>0,h=e.Uc;if(f>=g&&fh[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.f(m)}h[3]&&(g=h[3],e=null);e=Ze(a,b,g,e);a.f(e);a.P=b;f-=b.w-k;d++}}} +function Ye(a,b,d){var c=!0;try{b.length&&"end"!=b?d||a.f(">> "+b):(a.Z&&(a.f("ended assemble at "+S(a,a.X.w)),a.P=a.X,a.Z=!1),b="");var f=b.charAt(0);if('"'==f||"'"==f)return!0;a.Ca=null;if(mb(a)&&0m||"z"Y.length&&(a.f("note: only "+Y.length+" available"),P=Y.length);T-=P;0>T&&(null==Y[Y.length-1].w?(P=T+P,T=0):T+=Y.length);var xc=[];"call"==Vd&&(Wa=1E5,xc=["CALL"]);for(void 0!==Ud&&a.f(P+" instructions earlier:");0=Y.length&&(T=0);a.Yb=P;Xd++; +Wa--}}Xd||(a.f("no "+Wd+"history available"),a.Yb=void 0)}else{var Eb=V(a,X);if(Eb){var Fb=0;na&&("l"==na.charAt(0)&&(na=na.substr(1)||Bf),Fb=Be(a,na)>>>0,65536>4||1;Df--&&0Jb?String.fromCharCode(Jb):".";Hb--}Ya&&(Ya+="\n");Ya+=X+ +" "+zc+(Za?"":" "+$d)}Ya&&a.f(Ya);a.Cb=Eb}}}}break;case "e":if("else"==e[0])break;var Kb=1,ae=255,be=a.Kb,ce=a.fc;"ew"==e[0]&&(Kb=2,ae=65535,be=a.Ea,ce=a.nc);var de=Kb<<1,ee=e[1];if(null==ee)a.f("edit memory commands:"),a.f("\teb [a] [...] edit bytes at address a"),a.f("\tew [a] [...] edit words at address a");else{var Lb=V(a,ee);if(Lb)for(var Mb=2;MbDc;){for(var oa=null,Hf=256;65536>bb.w>>>0;){ge.w=a.Ea(bb,2);if(null==bb.w||!Hf--)break;for(var If=a,Nb=ge,he=null,cb=Nb.w,ie=cb,Ec=1;6>=Ec&&cb;Ec++){if(2\nLicense: GPL version 3 or later ");this.f("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bmf){if(of(c,this.O)){this.F=new M(this,"1.30.0","failsafe");of(this.F)&&(tf(this,c),a=2,uf(this.F));this.F.set("timestamp",ra());vf(this.F);var f=this.g&&!this.I;if(1==a||ta("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(d=sf(c)){var e=c.get("code"),g=c.get("data");e&&("ok"==e?of(c,g):("error"== +e&&"no machine state"!=g?(this.ka("Error: "+g),"unable to verify user"==g&&(xa("user",""),this.j=null)):this.f(e+": "+g),uf(c),of(c)?(d=sf(c),f=!0):d=!1))}f&&rf(this,d?c:null)}else 2==a&&c.clear()}else rf(this);delete this.O;delete this.P}f=gb(this.id);for(e=0;ea[1];a=a[2];this.fa=!0;this.u.ba=!0;var c=this.J.power;c&&(c.textContent="Shutdown");this.b&&(wf(this,this.b,b,d,a),this.b.Gb());this.X&&(tf(this,b),b.clear());!d&&this.F&&(this.F.clear(),delete this.F);this.B=0}; +function tf(a,b){if(ta("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var d=a.j||"";b=b.toString();var c={app:"PDP11js",ver:"1.30.0"};c.url=a.url;c.user=d;c.type="bug";c.data=b;sa("http://www.pcjs.org/api/v1/report",c,!0)}} +function jf(a,b,d){var c,f="none";if(a.B)return null;a.B--;var e=new M(a,"1.30.0"),g=new M(a,"1.30.0","validate"),h=ra();g.set("timestamp",h);e.set("timestamp",h);e.set("version","1.30.0");e.set("url",window?window.location.href:null);e.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Ka&&(d&&a.b.ia(),c=a.b.Ka(b,d),"object"===typeof c&&e.set(a.b.id,c),d&&(a.b.u.ba=!1,!1===c&&(f=null)));for(var h=gb(a.id),k=0;ke.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(e=window.location.pathname+e),c?"}"==c.slice(-1)?(c=c.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+d+"$2"+(c?" parms='"+c+"'":"")+(e?' url="'+e+'"':"")));f||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDP11js$2"), +a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));e=null;if("<"==a.charAt(0))try{f||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(e=new window.ActiveXObject("Microsoft.XMLDOM"),e.async=!1,e.loadXML(a)):e=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){e=null,a=n.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=c[2];b("Loading "+f+"...");sa(f,null,!0,function(e,g,h){if(h||!g)d(a,"unable to resolve XML reference: "+c[0]+" ("+h+")");else{if(e=c[3])if(h=g.match(new RegExp("<"+c[1]+"[^>]*>"))){for(var k=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(e);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{d(a,"missing <"+c[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(c[0],g);Of(a,b,d)}})}else d(a,null)} +function Pf(a,b,d,c){function f(a){if(void 0===h){var b=g&&C(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ja(a))}function e(a){f("Error: "+a);k&&(--Af||Ma(!0));k=!1}var g,h,k=!0;Af++;Ua[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=m:q.appendChild(document.createTextNode(m));n.appendChild(q)}d|| +(d="/versions/pdp11/1.30.0/components.xsl");m=function(c,h){h?Mf(d,null,null,!1,f,function(c,k){k?(Va(a,d,c),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--Af||Ma(!0)):e("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(c=new XSLTProcessor,c.importStylesheet(k),(k=c.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--Af||Ma(!0)):e("invalid machine element: "+ +a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(c)}):e(c)};"<"!=b.charAt(0)?Mf(b,a,c,!0,f,m):Nf(b,null,a,c,!1,f,m)}else e("missing machine element: "+a)}catch(p){e(p.message)}return k}window.embedPDP11=function(a,b,d,c){Ma(!1);return Pf(a,b,d,c)};window.enableEvents=Ma;window.sendEvent=Na;})(); diff --git a/versions/pdp11/1.30.0/pdp11.js b/versions/pdp11/1.30.0/pdp11.js index f705545ae..47150a1cb 100644 --- a/versions/pdp11/1.30.0/pdp11.js +++ b/versions/pdp11/1.30.0/pdp11.js @@ -1,156 +1,138 @@ (function(){var l; function aa(a){var b=16,c;if(a){b||(b=10);var d=a.charAt(0),f=0>=3;return""+c}function n(a,b,c){var d="";b?8=f?48:55),d=String.fromCharCode(f)+d;a>>=4}return(c?"0x":"")+d} -function ca(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0":">",'"':""","'":"'"};function ha(a){return a.replace(/[&<>"']/g,function(a){return ga[a]})}var ia=Date.now||function(){return+new Date}; -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 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.zb=this.id:(this.Mb=this.id.substr(0,b),this.zb=this.id.substr(b+1));this[a]=c;this.j={ready:!1,bb:!1,Db:!1,M:!1,error:!1};this.qb=null;this.j.error=!1;this.C={};this.K=null;w.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 x(a,b){b||(b=v);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={}),w=window.PCjs.Components||(window.PCjs.Components=[])}else Da={},w=[];function Ea(a,b,c){Da[a]&&b&&(Da[a][b]=c)}function y(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1)+2;10>this.f&&(this.f=10);15>2;this.h=this.g-1;this.l=this.o/this.g|0;this.H=this.l-1;this.ta=[];this.A=null;this.cb=this.P;a=new G;Pa(a,this.K);this.c=Array(this.l);for(b=0;b>8:d[2](b)&255}else if(b&1&&(d=c.ta[a&-2],d[2]))return d[2](b&-2)>>8;c.N("warning: unconverted read access to byte @"+ba(b));return c.cb(b,-1,1)} -function Ra(a,b,c){var d=this.controller,f=d.ta[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.ta[a&-2],f[3])){c&=-2;a=f[2]?f[2](c):0;f[3](a&255|b<<8,c);return}d.N("warning: unconverted write access to byte @"+ba(c));d.cb(c,b,1)} -function Sa(a,b){var c=this.controller;if(a=c.ta[a]){if(a[2])return a[2](b);if(a[0])return a[0](b)|a[0](b+1)<<8}c.N("warning: unconverted read access to word @"+ba(b));return c.cb(b,-1,0)}function Ta(a,b,c){var d=this.controller;if(a=d.ta[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.N("warning: unconverted write access to word @"+ba(c));d.cb(c,b,0)}Oa.prototype.reset=function(){this.A&&this.A()};Oa.prototype.P=function(){return 0}; -Oa.prototype.za=function(a,b){b||this.reset();return!0};function Ua(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.Sa)return k.xb+=k.Sa-e,k.Sa=e,!0;if(e>=k.Sa+k.xb){q=k.size-(e-m);q>g&&(q=g);k.xb=e-k.Sa+q;e=m+a.g;g-=q;h++;continue}}return Wa(1,e,g)}e=new G(e,q,a.g,d,f);Pa(e,a.K,k);a.c[h++]=e;e=m+a.g;g-=q}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Xa[d]+" at "+n(b,8,!0)),!0):Wa(2,b,c)} -function Ya(a){for(var b=0,c=[],d=0;d>=3;return""+c}function q(a,b,c){var d="";b?8=f?48:55),d=String.fromCharCode(f)+d;a>>=4}return(c?"0x":"")+d} +function ba(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0":">",'"':""","'":"'"};function ga(a){return a.replace(/[&<>"']/g,function(a){return fa[a]})}var ha=Date.now||function(){return+new Date}; +function ia(){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 r(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 ea(){return"http://"+(window?window.location.host:"www.pcjs.org")} +function t(a){window&&window.alert(a)}function ja(a){var b=!1;window&&(b=window.confirm(a));return b}var ka=null;function la(){if(null==ka){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}ka=a}return ka}function ma(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} +function na(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function oa(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 u={init:[],show:[],exit:[]},pa=!1,qa=!1,ra=!0;function sa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function v(a){u.init.push(a)} +function ta(a){if(ra)try{for(var b=0;bb?this.wb=this.id:(this.Hb=this.id.substr(0,b),this.wb=this.id.substr(b+1));this[a]=c;this.f={ready:!1,ab:!1,Ab:!1,M:!1,error:!1};this.mb=null;this.f.error=!1;this.o={};this.G=null;x.push(this)}var wa=void 0,xa={}; +if(window){wa||(wa=window.location.search.substr(1));for(var ya,za=/\+/g,Aa=/([^&=]+)=?([^&]*)/g;ya=Aa.exec(wa);)xa[decodeURIComponent(ya[1].replace(za," "))]=decodeURIComponent(ya[2].replace(za," "))}function Ba(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=Ba(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ca=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else Ca={},x=[];function Da(a,b,c){Ca[a]&&b&&(Ca[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.j&&(this.j=10);15>2;this.h=this.g-1;this.s=this.u/this.g|0;this.K=this.s-1;this.na=[];this.A=null;this.bb=this.P;a=new J;Oa(a,this.G);this.b=Array(this.s);for(b=0;b>8:d[2](b)&255}else if(b&1&&(d=c.na[a&-2],d[2]))return d[2](b&-2)>>8;c.J("warning: unconverted read access to byte @"+n(b));return c.bb(b,-1,1)} +function Qa(a,b,c){var d=this.controller,f=d.na[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.na[a&-2],f[3])){c&=-2;a=f[2]?f[2](c):0;f[3](a&255|b<<8,c);return}d.J("warning: unconverted write access to byte @"+n(c));d.bb(c,b,1)} +function Ra(a,b){var c=this.controller;if(a=c.na[a]){if(a[2])return a[2](b);if(a[0])return a[0](b)|a[0](b+1)<<8}c.J("warning: unconverted read access to word @"+n(b));return c.bb(b,-1,0)}function Sa(a,b,c){var d=this.controller;if(a=d.na[a]){if(a[3]){a[3](b,c);return}if(a[1]){a[1](b&255,c);a[1](b>>8,c+1);return}}d.J("warning: unconverted write access to word @"+n(c));d.bb(c,b,0)}I.prototype.reset=function(){this.A&&this.A()};I.prototype.P=function(){return 0}; +I.prototype.ua=function(a,b){b||this.reset();return!0};function Ta(a,b,c,d,f){for(var e=b,g=c,h=e>>>a.j;0g&&(p=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.Ra)return k.ub+=k.Ra-e,k.Ra=e,!0;if(e>=k.Ra+k.ub){p=k.size-(e-m);p>g&&(p=g);k.ub=e-k.Ra+p;e=m+a.g;g-=p;h++;continue}}return Va(1,e,g)}e=new J(e,p,a.g,d,f);Oa(e,a.G,k);a.b[h++]=e;e=m+a.g;g-=p}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Wa[d]+" at "+q(b,8,!0)),!0):Va(2,b,c)} +function Xa(a){for(var b=0,c=[],d=0;d>13&7;"undefined"===typeof b.U[e]&&(b.U[e]={cache:[],postProcess:a.qc,drive:e,blocksize:256,mapped:0,maxblock:b.Ja[e]*b.G[e],url:"rk"+e+".dsk"});b.w&=-129;switch(b.w>>1&7){case 0:b.ib=2496;b.T=0;b.w=128;b.X=0;break;case 1:if((b.X>>4&511)>=b.Ja[e]){b.T|=32832;b.w|=49152;break}if((b.X&15)>=b.G[e]){b.T|=32800;b.w|=49152;break}c=(b.X>>4&511)*b.G[e]+(b.X&15);d=(b.w&48)<<12|b.hb;f=65536-b.jb&65535;db(a,b.U[e],c,d,f);return;case 2:if((b.X>>4&511)>=b.Ja[e])b.T|=32832, -b.w|=49152;else if((b.X&15)>=b.G[e])b.T|=32800,b.w|=49152;else{c=(b.X>>4&511)*b.G[e]+(b.X&15);d=(b.w&48)<<12|b.hb;f=65536-b.jb&65535;a.tb(b.U[e],c,d,f);return}}b.ib=e<<13|b.ib&8176|b.X%9&15;I(a.a,20,5,144,function(){b.w=b.w&65534|128;return!!(b.w&64)})}l.qc=function(a,b,c,d,f){var e=this.h;e.hb=d&65535;e.w=e.w&-49|d>>12&48;e.jb=65536-f&65535;switch(a){case 1:e.T|=33024;e.w|=49152;break;case 2:e.T|=33792,e.w|=49152}I(this.a,20,5,144,function(){e.w=e.w&65534|128;return!!(e.w&64)})}; -function eb(a){var b=a.i,c,d,f,e=b.m>>8&3;b.m&=-2;"undefined"===typeof b.U[e]&&(b.U[e]={cache:[],postProcess:a.rc,drive:e,blocksize:128,mapped:1,maxblock:b.Ja[e]*b.G[e],url:"rl"+e+".dsk"});switch(b.m>>1&7){case 2:b.xa&8&&(b.m&=63);b.xa=b.cc[e]|b.Ba&64;break;case 3:1==(b.J&3)&&(b.Ba=b.J&4?b.Ba+(b.J&65408)&65408|b.J<<2&64:b.Ba-(b.J&65408)&65408|b.J<<2&64,b.J=b.Ba);break;case 4:b.xa=b.Ba;break;case 5:if(b.J>>6>=b.Ja[e]){b.m|=37888;break}if((b.J&63)>=b.G[e]){b.m|=37888;break}c=(b.J>>6)*b.G[e]+(b.J&63); -d=(b.ua&63)<<16|b.ab;f=65536-b.xa&65535;db(a,b.U[e],c,d,f);return;case 6:if(b.J>>6>=b.Ja[e])b.m|=37888;else if((b.J&63)>=b.G[e])b.m|=37888;else{c=(b.J>>6)*b.G[e]+(b.J&63);d=(b.ua&63)<<16|b.ab;f=65536-b.xa&65535;a.tb(b.U[e],c,d,f);return}}I(a.a,20,5,112,function(){b.m|=129;return!!(b.m&64)})} -l.rc=function(a,b,c,d,f){var e=this.i;e.ab=d&65535;e.m=e.m&-49|d>>12&48;e.ua=d>>16&63;e.J=~~(c/e.G[b.ka])<<6|c%e.G[b.ka];e.Ba=e.J;e.xa=65536-f&65535;switch(a){case 1:e.m|=33792;break;case 2:e.m|=40960}I(this.a,20,5,112,function(){e.m|=129;return!!(e.m&64)})};function fb(a){a=a.l;a.D=2176;a.da=0;a.V=[4544,4544,4544,4544,4544,4544,4544,4544];a.Wa=[0,0,0,0,0,0,0,0];a.Oa=a.Xa=a.Va=a.Aa=a.Ib=0} -function gb(a,b){var c=a.l,d,f,e;c.D&=-16513;c.da&=-2049;c.V[b]&=-1153;I(a.a,-1,0,172);"undefined"===typeof c.U[b]&&(c.U[b]={cache:[],postProcess:a.sc,drive:b,blocksize:256,mapped:0,maxblock:c.yb[0]*c.Ia[0]*c.G[0],url:"rp"+b+".dsk"});switch(c.D&63){case 5:c.wb[b]=c.na[b];c.D|=32896;c.V[b]|=32896;c.Oa|=1<=c.yb[0]||c.ea[b]>>8>=c.Ia[0]||(c.ea[b]&255)>=c.G[0]){c.Wa[b]|=1024;c.D|=49152;break}d=(c.na[b]*c.Ia[0]+(c.ea[b]>>8))*c.G[0]+ -(c.ea[b]&255);f=(c.Aa&63)<<16|c.Va;e=65536-c.Xa&65535;db(a,c.U[b],d,f,e);return;case 57:if(c.na[b]>=c.yb[0]||c.ea[b]>>8>=c.Ia[0]||(c.ea[b]&255)>=c.G[0])c.Wa[b]|=1024,c.D|=49152;else{d=(c.na[b]*c.Ia[0]+(c.ea[b]>>8))*c.G[0]+(c.ea[b]&255);f=(c.Aa&63)<<16|c.Va;e=65536-c.Xa&65535;a.tb(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.sc=function(a,b,c,d,f){var e=this.l;e.Xa=65536-f&65535;e.Va=d&65535;e.D=e.D&-769|d>>8&768;e.Aa=d>>16&63;f=~~(c/e.G[0]);d=~~(f/e.Ia[0]);e.ea[b.ka]=f%e.Ia[0]<<8|c%e.G[0];e.wb[b.ka]=e.na[b.ka]=d;e.Oa|=1<=b.mc-1&&(e.V[b.ka]|=1024);switch(a){case 1:e.da|=512;e.D|=49152;break;case 2:e.da|=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)})};l.kc=function(){this.g.m|=128;this.g.m&64&&I(this.a,0,6,64)}; -function hb(a,b,c,d,f,e){var g=~~((e+c.va-1)/c.va),h=new XMLHttpRequest;2048>g&&d+2048M(this.a,a.lc?ib(this.a,c):c,a.cache[b][f])){a.sb(2,a,b,c,d);return}c+=2;--d}b++}a.sb(0,a,b,c,d)}; -function db(a,b,c,d,f){for(var e,g;0g){b.sb(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.sb(0,b,c,d,f)}l.reset=function(){this.f.Ta=this.f.Ta&-120|20;this.c.ia=0;this.c.Y=128;this.g.m=0;this.h.w=128;this.i.m=128;fb(this)}; -l.bc=function(a,b,c){var d,f,e=this.a;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=e.ma&65280:(a&1&&(b<<=8),e.ma=b|255,d=0);break;case 4194298:if(0>b)d=e.vb;else{a&1&&(b<<=8);if(d=b&65024){f=d>>9;do d+=34;while(f>>=1)}e.vb=d;e.la=2}break;case 4194294:if(70!==e.Ka)return K(e,4,222);0>b?d=e.s:d=e.s=0;break;case 4194292:if(70!==e.Ka)return K(e,4,224);d=1;break;case 4194290:if(70!==e.Ka)return K(e,4,226);d=0;break;case 4194288:if(70!==e.Ka)return K(e,4,228);d=61183;break;case 4194296:0<= -b&&!(a&1)&&(b&=255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.Ka)return K(e,4,232);f=a-4194272>>1;0>b?d=e.Fb[f]:(d=J(this,e.Fb[f],a,b,c),0<=d&&(e.Fb[f]=d));break;case 4194254:return a&1?e.u>>14&1?(0<=b&&(e.b[6]=b),d=e.b[6]):(0<=b&&(e.aa[3]=b),d=e.aa[3]):e.u>>14&0?(0<=b&&(e.b[6]=b),d=e.b[6]):(0<=b&&(e.aa[1]=b),d=e.aa[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.u&2048?(0<=b&&(e.b[f]=b),d=e.b[f]):(0<=b&&(e.Na[f]= -b),d=e.Na[f]),d;case 4194246:return a&1?(0<=b&&(e.b[7]=b),d=e.b[7]):e.u>>14&0?(0<=b&&(e.b[6]=b),d=e.b[6]):(0<=b&&(e.aa[0]=b),d=e.aa[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.u&2048?(0<=b&&(e.Na[f]=b),d=e.Na[f]):(0<=b&&(e.b[f]=b),d=e.b[f]),d;default:return e.s|=16,K(e,4,124)}break;case 4194176:f=a>>1&31;d=J(this,e.R[3][f],a,b,c);0<=d&&(e.R[3][f]=d,e.R[3][f&15]&=65295);break;case 4194112:var g=this.c;f=this.g;switch(a&-2){case 4194174:d=J(this,e.Ya,a,b,c);0<=d&&(e.Ya=d);break;case 4194172:d= -e.ga;d&65280&&(d=(d<<8|d>>8)&65535);break;case 4194170:e.I=e.I&62337|e.eb<<5|e.rb<<1;0>b?d=e.I:(d=J(this,e.I,a,b,c),0<=d&&(e.I=d&=62337,e.eb=d>>5&3,e.rb=d>>1&15,d&257?(f=2,e.sa&16&&(f=1),e.Ua=d&1?Ja|D:D):(e.Ua=0,f=4),this.f.Ta=this.f.Ta&-8|f));break;case 4194168:0>b?d=this.f.zc&65535:(d=J(this,this.f.data,a,b,c),0<=d&&(this.f.data=d));break;case 4194166:0<=b&&(b&127&&(g.ec=0),g.Y&=-129,I(e,100,4,52,function(){g.Y|=128;return!!(g.Y&64)}));d=0;break;case 4194164:break;case 4194162:d=0;0>b&&(g.ia&=-129, -0b?d=g.ia:(d=J(this,g.ia,a,b,c),0<=d&&(g.ia=g.ia&128|d&-129));break;case 4194150:0>b?(d=f.m,f.m&=-129):(d=J(this,f.m,a,b,c),0<=d&&(d&64&&!f.Gb&&(setInterval(this.kc.bind(this),25),f.Gb=1),f.m=d&-129));break;default:return e.s|=16,K(e,4,126)}break;case 4194048:f=this.h;switch(a&-2){case 4194048:d=J(this,f.ib,a,b,c);0<=d&&(f.ib=d);break;case 4194050:d=J(this,f.T,a,b,c);0<=d&& -(f.T=d);break;case 4194052:d=J(this,f.w,a,b,c);0<=b&&0<=d&&(f.w=d&-36993|f.w&36992,f.w&1&&cb(this));break;case 4194054:d=J(this,f.jb,a,b,c);0<=d&&(f.jb=d);break;case 4194056:d=J(this,f.hb,a,b,c);0<=d&&(f.hb=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.Vb,a,b,c);0<=d&&(f.Vb=d);break;default:return e.s|=16,K(e,4,128)}break;case 4193728:var h=this.l;f=h.da&7;switch(a&-2){case 4193728:d=J(this,h.D,a,b,c);0<=b&&0<=d&&(h.Aa=h.Aa&60|d>>8&3,h.D= -d&17279|h.D&34944|2048,d&1&&h.D&128?gb(this,f):192==(d&192)&&I(e,0,5,172));break;case 4193730:d=J(this,h.Xa,a,b,c);0<=d&&(h.Xa=d);break;case 4193732:d=J(this,h.Va,a,b,c);0<=d&&(h.Va=d&65534);break;case 4193734:d=J(this,h.ea[f],a,b,c);0<=d&&(h.ea[f]=d&7967);break;case 4193736:d=J(this,h.da,a,b,c);0<=d&&(h.da=d&63|h.da&65472,d&128&&fb(this));break;case 4193738:d=h.V[f];break;case 4193740:d=h.Wa[f];break;case 4193742:d=J(this,h.Oa,a,b,c);0<=d&&(h.Oa=d&255);break;case 4193744:d=h.xc[f];break;case 4193746:d= -J(this,h.Wb,a,b,c);0<=d&&(h.Wb=d);break;case 4193748:d=J(this,h.Xb[f],a,b,c);0<=d&&(h.Xb[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=h.yc[f];break;case 4193754:d=J(this,h.Yb[f],a,b,c);0<=d&&(h.Yb[f]=d);break;case 4193756:d=J(this,h.na[f],a,b,c);0<=d&&(h.na[f]=d&511);break;case 4193758:h.wb[f]=h.na[f];d=h.wb[f];break;case 4193760:d=h.vc[f];break;case 4193762:d=h.wc[f];break;case 4193764:d=h.tc[f];break;case 4193766:d=h.uc[f];break;case 4193768:d=J(this,h.Aa,a,b,c);0<=d&&(h.Aa=d&63,h.D= -h.D&-769|(d&3)<<8);break;case 4193770:d=J(this,h.Ib,a,b,c);0<=d&&(h.Ib=d);break;default:return e.s|=16,K(e,4,132)}break;case 4192512:f=this.i;switch(a&-2){case 4192512:d=J(this,f.m,a,b,c);0<=b&&0<=d&&(f.ua=f.ua&60|d>>4&3,f.m=f.m&-1023|d&1022,f.m&128||eb(this));break;case 4192514:d=J(this,f.ab,a,b,c);0<=d&&(f.ab=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.ua,a,b,c);0<=d&&(f.ua=d&63,f.m=f.m&-49|(f.ua& -3)<<4);break;default:return e.s|=16,K(e,4,134)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.sa:(d=J(this,e.sa,a,b,c),0<=d&&(70!==e.Ka&&(d&=-49),e.sa=d,e.Ma[0]=d&4?15:7,e.Ma[1]=d&2?15:7,e.Ma[3]=d&1?15:7,e.Ua&&(f=2,e.sa&16&&(f=1),this.f.Ta=this.f.Ta&-8|f)));break;default:return e.s|=16,K(e,4,136)}break;case 4191424:f=a>>1&31;d=J(this,e.R[0][f],a,b,c);0<=d&&(e.R[0][f]=d,e.R[0][f&15]&=65295);break;case 4191360:f=a>>1&31;d=J(this,e.R[1][f],a,b,c);0<=d&&(e.R[1][f]=d,e.R[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!== -e.Ka)return K(e,4,234);f=a>>2&31;d=e.kb[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=J(this,d,a,b,c),0<=d&&(e.kb[f]=a&2?d<<16|e.kb[f]&65535:e.kb[f]&4294901760|d&65534));break;case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)d=Za[a>>1&255];else return e.s|=16,K(e,4,138);break;default:return e.s|=16,K(e,4,142)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)");return d}; -var jb={},$a=(jb[65534]=[null,null,H.prototype.oc,H.prototype.Bc],jb[65396]=[null,null,H.prototype.pc,H.prototype.Dc],jb);u(function(){for(var a=B(document,"pdp11","device"),b=0;b>1),this.a=new Int32Array(this.f,0,c>>2),qb(this,mb?rb:sb);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},qa:function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},Ea:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<>8);this.wa=!0},P:function(a,b){return this.W(a, -b)},ca:function(a,b){return this.oa(a,b)},Ca:function(a,b,c){this.h||this.ac(a,b,c)},Ga:function(a,b,c){this.h||this.Ha(a,b,c)},H:function(a){return this.c[a]},Z:function(a){return this.c[a]},ba:function(a){return this.g.getUint16(a,!0)},pa:function(a){return a&1?this.c[a]|this.c[a+1]<<8:this.o[a>>1]},ra:function(a,b){this.c[a]=b;this.wa=!0},Da:function(a,b){this.c[a]=b;this.wa=!0},Fa:function(a,b){this.g.setUint16(a,b,!0);this.wa=!0},Qa:function(a,b){a&1?(this.c[a]=b,this.c[a+1]=b>>8):this.o[a>> -1]=b;this.wa=!0}};function Pa(a,b,c){a.K=b;a.i=a.l=0;c&&((a.i=c.i)&&ub(a,vb,!1),(a.l=c.l)&&wb(a,vb,!1))}function wb(a,b,c){c&&a.l||(a.lb=!a.h&&b[1]||a.v,a.Cc=!a.h&&b[3]||a.B);if(c||void 0===c)a.ac=b[1]||a.v,a.Ha=b[3]||a.B}function ub(a,b,c){c&&a.i||(a.gb=b[0]||a.C,a.ub=b[2]||a.A);if(c||void 0===c)a.W=b[0]||a.C,a.oa=b[2]||a.A}function qb(a,b){b||(b=xb);ub(a,b,void 0);wb(a,b,void 0)} -var xb=[],tb=[G.prototype.$,G.prototype.Ea,G.prototype.qa,G.prototype.Ra],vb=[G.prototype.P,G.prototype.Ca,G.prototype.ca,G.prototype.Ga];if(Ia)var sb=[G.prototype.H,G.prototype.ra,G.prototype.ba,G.prototype.Fa],rb=[G.prototype.Z,G.prototype.Da,G.prototype.pa,G.prototype.Qa]; -function yb(a,b){v.call(this,"CPU",a,yb);var c=a.multiplier||1;this.Bb=a.cycles||b;this.qa=c;this.Ab=Math.round(this.Bb/1E4)/100;this.oa=this.Ab*this.qa;this.j.ja=!1;this.j.Zb=!1;this.j.$a=a.autoStart;this.j.Qb=!1;this.j.pb=!1;this.mb=this.pa=0;this.nb=a.csStart;this.Da=a.csInterval;this.Ea=a.csStop;this.Qa=[];this.Tb=this.Jb.bind(this);C(this)}x(yb);var zb=["power","reset"];l=yb.prototype; -l.La=function(a,b,c,d){this.B=a;this.A=b;this.K=d;for(b=0;ba.Z/a.oa&&(b=1),a.qa=b,b=a.Ab*a.qa,a.oa!=b)){a.oa=b;b=a.oa.toFixed(2)+"Mhz";var c=a.C.setSpeed;c&&(c.textContent=b);a.N("target speed: "+b)}Hb(a,a.W);a.W=0;a.P=ia();a.$=0;Ib(a)}function Kb(a){a.ba-=a.a;a.a=0} -l.Jb=function(){if(Ga(this,!0)){if(!this.j.ja){Gb(this);this.B&&this.B.start(this.P,Jb(this));this.j.ja=!0;this.j.Zb=!0;this.Ca&&this.Ca.start();var a=this.C.run;a&&(a.textContent="Halt");this.B&&this.B.Pa(!0)}this.Cb>=this.Bb&&Ib(this,!0);this.Ga=0;this.Ra=ia();this.$&&(a=this.Ra-this.$,a>this.Pb&&(this.P+=a,this.P>this.Ra&&(this.P=this.Ra)));try{do{for(var b,c=this.j.pb?1:this.ob,d=this.Qa.length-1;0<=d;d--){var f=this.Qa[d];0>f[0]||c>f[0]&&(c=f[0])}b=c;try{this.$b(b)}catch(m){if("number"!=typeof m)throw m; -}for(var e=this.ba-this.a,a=e,g=this.Qa.length-1;0<=g;g--){var h=this.Qa[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.Ga+=e;this.W+=e;Hb(this,0,!0);a=e;if(this.j.pb){var k=!1;this.mb=this.mb+this.Ub()|0;this.pa-=a;0>=this.pa&&(this.pa+=this.Da,k=!0);0<=this.Ea&&this.Ea<=Jb(this)&&(this.Da=this.Ea=-1,Cb(this),Fb(this),k=!0);k&&this.N(Jb(this)+" cycles: checksum="+n(this.mb))}this.Fa-=e;if(0>=this.Fa){this.Fa+=this.ob;15<=++this.Sb&&(this.B&&this.B.Pa(),this.Sb=0);break}}while(this.j.ja)}catch(m){Fb(this); -Db(this);this.B&&this.B.stop(ia(),Jb(this));Ga(this,!1);b=m.stack||m.message;this.j.error=!0;this.L(b);return}b=setTimeout;c=this.Tb;this.$=ia();d=this.Pb;this.Ga&&(d=Math.round(d*this.Ga/this.ob));d-=this.$-this.Ra;if(f=this.$-this.P)this.Z=Math.round(this.W/(10*f))/100,864E5<=f&&(this.ca=0,Gb(this));if(0>d||this.Zd&&(this.P-=d),d=0;this.Cb+=this.Ga;this.$+=d;b(c,d)}else Db(this),this.B&&this.B.stop(ia(),Jb(this))};l.$b=function(){return 0}; -function Fb(a){a.j.bb&&(a.j.Db=!0);Kb(a);Hb(a,a.W);a.W=0;if(a.j.ja){a.j.ja=!1;a.Ca&&a.Ca.stop();var b=a.C.run;b&&(b.textContent="Run")}a.j.complete=void 0}function Db(a){a.B&&a.B.Pa(void 0)} -function Lb(a){this.jc=a.resetAddr||0;yb.call(this,a,1E6);this.Kb=0;this.decode=Mb.bind(this);this.g=65536;this.f=32768;this.h=65535;this.c=32768;this.b=[0,0,0,0,0,0,0,this.jc];this.Na=[0,0,0,0,0,0];this.aa=[0,0,0,0];this.ma=255;this.rb=this.eb=this.Ua=this.v=this.sa=this.Ya=this.ga=this.I=this.s=this.vb=0;this.Ma=[7,7,7,7];this.R=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535, -65535,65535,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.kb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.Fb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.i=-1;this.F=0;this.Ka=70;this.ra=-1;this.o=[];this.Ha=0;this.la=2;Nb(this);this.j.complete=this.j.dc=!1}x(Lb,yb);l=Lb.prototype; -l.reset=function(){this.j.ja&&Fb(this);Ob(this);Bb(this);this.j.error=!1;this.parent.reset.call(this)};function Ob(a){a.ma=255;a.s=0;a.o=[];a.vb=0;a.I=a.ga=a.Ya=a.sa=a.Ua=0;a.Ma[0]=a.Ma[1]=a.Ma[3]=7;a.eb=0;Nb(a)}function Nb(a){a.Ua?(a.H=65536,a.l=a.ic,a.ub=a.S):(a.H=0,a.l=a.hc,a.ub=a.O)}l.Ub=function(){return 0};l.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.Nb,this.ca,this.qa]);a.set(2,Ya(this.A));return a.data()}; -l.restore=function(a){var b=a[1];this.Nb=b[0];this.ca=b[1];Gb(this,b[3]);a:{b=this.A;a=a[2];var c;for(c=0;cb){a.o[e].ha-=b;break}b-=a.o[e].ha}a.o.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.la=2}function ab(a){return a.u=a.u&63728|(a.c&32768?8:0)|(a.h&65535?0:4)|(a.f&32768?2:0)|(a.g&65536?1:0)} -function bb(a,b){a.c=b<<12;a.h=~b&4;a.f=b<<14;a.g=b<<16;if((b^a.u)&2048)for(var c=a.Na.length;0<=--c;){var d=a.b[c];a.b[c]=a.Na[c];a.Na[c]=d}a.v=b>>14&3;c=a.u>>14&3;a.v!=c&&(a.aa[c]=a.b[6],a.b[6]=a.aa[a.v]);a.la=2;a.u=b}function Pb(a,b){a.F&128||(a.c=a.h=a.g=b,a.f=0)}function P(a,b){a.F&128||(a.c=a.h=b,a.f=0)}function Qb(a,b,c,d){a.F&128||(a.c=a.h=a.g=b,a.f=(c^d)&(d^b))} -function K(a,b,c){var d,f,e=0;0>a.ra?a.ra=ab(a):a.v||(b=4,e=1);a.I&57344||(a.ga=63222,a.Ya=b);a.v=0;0<=(d=a.S(b|65536))&&0<=(f=a.S(b+2&65535|65536))&&(bb(a,f&53247|a.ra>>2&12288),e&&(a.s|=4,a.b[6]=4),0<=Q(a,a.ra)&&0<=Q(a,a.b[7])&&(a.b[7]=d));a.F&=-113;a.ra=-1;throw b|c<<8;}function ib(a,b){var c=b>>13&31;31>c?a.sa&32&&(b=a.kb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b} -function Rb(a,b,c){var d,f,e,g=0;if(c&a.Ua){d=b>>13&a.Ma[a.v];f=a.R[a.v][d];e=(a.R[a.v][d+16]<<6)+(b&8191)&4194303;a.sa&16?3932160<=e&&4186112>e&&(e=ib(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.s|=32,K(a,4,24)),e&1&&!(c&1)&&(a.s|=64,K(a,4,26)));switch(f&7){case 1:g=4096;case 2:f|=128;c&D&&(g=8192);break;case 4:g=4096;case 5:c&D&&(g=4096);case 6:f|=c&D?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.R[a.v][d]=f;if(4194170!==e||a.v)a.eb=a.v,a.rb=d;g&&(g&57344&&(0<=a.ra&&(g|=128),a.I&57344||(a.I=a.I|g|a.eb<<5|a.rb<<1),K(a,168,28)),a.I&61440||!(4191360>e||4194239>>b.f;a=c!=b.h?b.c[d].ub(c,a):b.c[d++].gb(c,a)|b.c[d&b.H].gb(0,a+1)<<8}return a}; -l.S=function(a){return this.O(Rb(this,a,Ja))};function M(a,b,c){c&=65535;if(4194304<=b)return a.b[b-4194304]=c;if(0<=b){a=a.A;var d=c,f=b&a.h,e=(b&a.i)>>>a.f;f!=a.h?a.c[e].Cc(f,d&65535,b):(a.c[e++].lb(f,d&255,b),a.c[e&a.H].lb(0,d>>8&255,b+1));return c}return b}function R(a,b){4194304<=b?b=a.b[b-4194304]&255:0<=b&&(a=a.A,b=a.c[(b&a.i)>>>a.f].gb(b&a.h,b));return b}function S(a,b,c){c&=255;return 4194304<=b?a.b[b-4194304]=a.b[b-4194304]&65280|c:0<=b?(a=a.A,a.c[(b&a.i)>>>a.f].lb(b&a.h,c&255,b),c):b} -function Sb(a){var b=a.S(a.b[6]|65536);0<=b&&(a.b[6]=a.b[6]+2&65535);return b}function Q(a,b){var c,d;a.b[6]=d=a.b[6]-2&65535;a.I&57344||(a.ga=a.ga<<8|246);!a.v&&d<=a.ma&&4>3&7){case 0:K(a,4,34);break;case 1:return 6===e&&!a.v&&c&D&&(a.b[6]<=a.ma||65534<=a.b[6])&&(a.b[6]<=a.ma-32||65534<=a.b[6]?(a.s|=4,a.b[6]=4,K(a,4,36)):(a.s|=8,a.F|=64)),7===e?a.b[e]:a.b[e]|a.H;case 2:f=2;d=a.b[e];7!==e&&(d|=a.H,6>e&&c&1&&(f=1));break;case 3:f=2;d=a.b[e];7!==e&&(d|=a.H);if(0>(d=a.S(d)))return d;d|=a.H;break;case 4:f=-2;6>e&&c&1&&(f=-1);d=a.b[e]+f&65535;7!==e&&(d|=a.H);break;case 5:f=-2;d=a.b[e]-2&65535;7!==e&&(d|=a.H);if(0>(d=a.S(d)))return d; -d|=a.H;break;case 6:if(0>(d=a.S(a.b[7])))return d;a.b[7]=a.b[7]+2&65535;d=d+a.b[e]&65535;return d|a.H;case 7:if(0>(d=a.S(a.b[7])))return d;a.b[7]=a.b[7]+2&65535;d=d+a.b[e]&65535;return 0>(d=a.S(d|65536))?d:d|a.H}a.b[e]=a.b[e]+f&65535;!a.H||a.I&57344||(a.ga=a.ga<<8|f<<3&248|e);6===e&&!a.v&&c&D&&0>=f&&(a.b[6]<=a.ma||65534<=a.b[6])&&(a.b[6]<=a.ma-32?(a.s|=4,a.b[6]=4,K(a,4,38)):(a.s|=8,a.F|=64));return d}l.hc=function(a,b){return T(this,a,b)};l.ic=function(a,b){return Rb(this,T(this,a,b),b)}; -function U(a,b){return b&56?a.ub(T(a,b,Ja)):a.b[b&7]}function V(a,b){return b&56?R(a,a.l(b,Ka)):a.b[b&7]&255}function Tb(a,b,c,d){b&56?(b=a.l(b,E),M(a,b,d.call(a,c,a.O(b)))):(b&=7,a.b[b]=d.call(a,c,a.b[b])&65535)}function Ub(a,b,c,d){b&56?(b=a.l(b,F),S(a,b,d.call(a,c,R(a,b)))):(b&=7,a.b[b]=a.b[b]&65280|d.call(a,c,a.b[b])&255)}function Vb(a,b,c){b&56?M(a,a.l(b,D),c):a.b[b&7]=c&65535;return c} -function Wb(a,b,c,d){b&56?S(a,a.l(b,La),c):(b&=7,a.b[b]=c?d&1?c<<24>>24&65535:a.b[b]&-256|c&255:a.b[b]&-256);return c}function W(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} -l.$b=function(a){this.j.complete=!0;this.j.dc=!1;this.j.Zb=!1;this.ba=this.a=a;this.Nb&256?(Kb(this),a=!1):a=!0;if(a){do{var b,c,d,f;this.F&112&&(this.F&32?K(this,168,52):this.F&64?K(this,4,54):this.F&16&&K(this,12,56),this.F&=-113);if(this.la)if(1===this.la)this.la=2;else{this.la=0;b=-1;c=this.vb&224;if(0<(a=this.o.length))for(;0c&&(c=this.o[a].nc, -b=a)}c>(this.u&224)&&(0>b?K(this,160,42):(K(this,this.o[b].Ac,44),this.o.splice(b,1)))}this.I&57344||(this.ga=0,this.Ya=this.b[7]);this.F=this.u&16;this.i=a=this.S(this.b[7]);0<=a&&(this.b[7]=this.b[7]+2&65535);this.decode(a);if(0>this.i)switch(a&61440){case 4096:break;case 8192:break;case 12288:break;case 16384:break;case 20480:break;case 24576:break;case 36864:break;case 40960:break;case 45056:break;case 49152:break;case 53248:break;case 57344:break;default:switch(a&65024){case 2048:0<=(d=T(this, -a,0))&&(f=a>>6&7,0<=Q(this,this.b[f])&&(this.b[f]=this.b[7],this.b[7]=d&65535));break;case 28672:0<=(b=U(this,a))&&(f=a>>6&7,b&32768&&(b|=-65536),c=this.b[f],c&32768&&(c|=-65536),a=~~(b*c),this.b[f]=a>>16&65535,this.b[f|1]=a&65535,this.c=a>>16,this.h=this.c|a,this.g=this.f=0,-32768>a||32767>6&7,c=this.b[f]<<16|this.b[f|1],this.g=this.f=0,b&32768&&(b|=-65536),a=~~(c/b),-32768<=a&&32767>=a?(this.b[f]=a&65535,this.b[f|1]=c-a*b&65535,this.h= -a>>16|a,this.c=a>>16):(this.f=32768,this.h=a>>15|a,this.c=c>>16,-1===b&&65534===this.b[f]&&(this.b[f]=this.b[f|1]=1))):(this.h=this.c=0,this.f=32768,this.g=65536));break;case 29696:0<=(b=U(this,a))&&(f=a>>6&7,a=this.b[f],a&32768&&(a|=4294901760),this.g=this.f=0,b&=63,b&32?(b=64-b,16>=b):b&&(16>15&65535)&&65535!==c&&(this.f=32768))),this.b[f]=a&65535,this.c=this.h=a);break;case 30208:if(0<=(b=U(this,a))){f=a>>6&7;c=this.b[f]<<16|this.b[f| -1];this.g=this.f=0;b&=63;if(b&32)b=64-b,32>b-1,this.g=a<<16,a>>=1,c&2147483648&&(a|=4294967295<<32-b);else if(b){if(a=c<>15,a<<=1,32>=32-b)c|=4294967295<>16&65535;this.b[f|1]=a&65535;this.c=a>>16;this.h=a>>16|a}break;case 30720:a&56?0<=(c=this.O(b=this.l(a,E)))&&(c^=this.b[a>>6&7],0<=M(this,b,c)&&(this.c=this.h=c,this.f=0)):(this.c=this.h=c=this.b[a&7]^=this.b[a>>6&7],this.f=0);break;case 32256:f= -a>>6&7;if(this.b[f]=this.b[f]-1&65535)this.b[7]=this.b[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.b[7]=W(this.b[7],a);break;case 512:this.h&65535&&(this.b[7]=W(this.b[7],a));break;case 768:this.h&65535||(this.b[7]=W(this.b[7],a));break;case 1024:(this.c&32768)===(this.f&32768)&&(this.b[7]=W(this.b[7],a));break;case 1280:(this.c&32768)!==(this.f&32768)&&(this.b[7]=W(this.b[7],a));break;case 1536:this.h&65535&&(this.c&32768)===(this.f&32768)&&(this.b[7]=W(this.b[7],a));break;case 1792:this.h& -65535&&(this.c&32768)===(this.f&32768)||(this.b[7]=W(this.b[7],a));break;case 32768:this.c&32768||(this.b[7]=W(this.b[7],a));break;case 33280:!(this.g&65536)&&this.h&65535&&(this.b[7]=W(this.b[7],a));break;case 33024:this.c&32768&&(this.b[7]=W(this.b[7],a));break;case 33536:if(this.g&65536||!(this.h&65535))this.b[7]=W(this.b[7],a);break;case 33792:this.f&32768||(this.b[7]=W(this.b[7],a));break;case 34048:this.f&32768&&(this.b[7]=W(this.b[7],a));break;case 34304:this.g&65536||(this.b[7]=W(this.b[7], -a));break;case 34560:this.g&65536&&(this.b[7]=W(this.b[7],a));break;case 34816:K(this,24,2);break;case 35072:K(this,28,4);break;default:switch(a&65472){case 64:0<=(d=T(this,a,0))&&(this.b[7]=d&65535);break;case 192:a&56?0<=(c=this.O(b=this.l(a,E)))&&(a=c<<8|c>>8,0<=M(this,b,a)&&(this.c=this.h=c&65280,this.f=this.g=0)):(f=a&7,c=this.b[f],this.b[f]=(c<<8|c>>8)&65535,this.c=this.h=c&65280,this.f=this.g=0);break;case 2560:break;case 2624:0<=(c=this.O(b=this.l(a,E)))&&(a=~c,0<=M(this,b,a)&&(this.c=this.h= -a,this.g=65536,this.f=0));break;case 2688:a&56?0<=(c=this.O(b=this.l(a,E)))&&(a=c+1,0<=M(this,b,a)&&(this.c=this.h=a,this.f=a&(a^c))):(f=a&7,c=this.b[f],a=c+1,this.b[f]=a&65535,this.c=this.h=a,this.f=a&(a^c));break;case 2752:a&56?0<=(c=this.O(b=this.l(a,E)))&&(a=c-1,0<=M(this,b,a)&&(this.c=this.h=a,this.f=(a^c)&c)):(f=a&7,c=this.b[f],a=c-1,this.b[f]=a&65535,this.c=this.h=a,this.f=(a^c)&c);break;case 2816:0<=(c=this.O(b=this.l(a,E)))&&(a=-c,0<=M(this,b,a)&&(this.g=this.c=this.h=a,this.f=a&c));break; -case 2880:0<=(c=this.O(b=this.l(a,E)))&&(a=c+(this.g>>16&1),0<=M(this,b,a)&&(this.g=this.c=this.h=a,this.f=a&(a^c)));break;case 2944:0<=(c=this.O(b=this.l(a,E)))&&(a=c-(this.g>>16&1),0<=M(this,b,a)&&(this.g=this.c=this.h=a,this.f=(a^c)&c));break;case 3008:0<=(c=U(this,a))&&(this.c=this.h=c,this.g=this.f=0);break;case 3072:a&56?0<=(c=this.O(b=this.l(a,E)))&&(a=(this.g&65536|c)>>1,0<=M(this,b,a)&&(this.g=c<<16,this.c=this.h=a,this.f=a^this.g>>1)):(f=a&7,c=this.b[f],a=(this.g&65536|c)>>1,this.b[f]=a& -65535,this.g=c<<16,this.c=this.h=a,this.f=a^this.g>>1);break;case 3136:a&56?0<=(c=this.O(b=this.l(a,E)))&&(a=c<<1|this.g>>16&1,0<=M(this,b,a)&&(this.g=this.c=this.h=a,this.f=a^c)):(f=a&7,c=this.b[f],a=c<<1|this.g>>16&1,this.b[f]=a&65535,this.g=this.c=this.h=a,this.f=a^c);break;case 3200:a&56?0<=(c=this.O(b=this.l(a,E)))&&(a=c&32768|c>>1,0<=M(this,b,a)&&(this.g=c<<16,this.c=this.h=a,this.f=this.c^this.g>>1)):(f=a&7,c=this.b[f],a=c&32768|c>>1,this.b[f]=a&65535,this.g=c<<16,this.c=this.h=a,this.f=this.c^ -this.g>>1);break;case 3264:a&56?0<=(c=this.O(b=this.l(a,E)))&&(a=c<<1,0<=M(this,b,a)&&(this.g=this.c=this.h=a,this.f=a^c)):(f=a&7,c=this.b[f],a=c<<1,this.b[f]=a&65535,this.g=this.c=this.h=a,this.f=a^c);break;case 3328:d=this.b[7]+((a&63)<<1)&65535;0<=(b=this.S(d|65536))&&(this.b[7]=this.b[5],this.b[5]=b,this.b[6]=d+2&65535);break;case 3392:a&56?0<=(d=T(this,a,0))&&(61440!==(this.u&61440)&&(d&=65535),this.v=this.u>>12&3,0<=(b=this.S(d))&&(this.v=this.u>>14&3,0<=Q(this,b)&&(this.c=this.h=b,this.f=0))): -(f=a&7,b=6!==f||(this.u>>2&12288)===(this.u&12288)?this.b[f]:this.aa[this.u>>12&3],0<=Q(this,b)&&(this.c=this.h=b,this.f=0));break;case 3456:0<=(c=Sb(this))&&((this.I&57344||(this.ga=22),a&56)?0<=(d=T(this,a,0))&&(d&=65535,this.v=this.u>>12&3,0<=(b=Rb(this,d,D))&&(this.v=this.u>>14&3,0<=M(this,b,c)&&(this.c=this.h=c,this.f=0))):(f=a&7,6!==f||(this.u>>2&12288)===(this.u&12288)?this.b[f]=c:this.aa[this.u>>12&3]=c,this.c=this.h=c,this.f=0));break;case 3520:0<=(b=this.l(a,D))&&(a=-(this.c>>15&1),0<=M(this, -b,a)&&(this.h=a,this.f=0));break;case 35328:break;case 35392:0<=(c=R(this,b=this.l(a,F)))&&(a=~c,0<=S(this,b,a)&&(this.c=this.h=a<<8,this.g=65536,this.f=0));break;case 35456:0<=(c=R(this,b=this.l(a,F)))&&(a=c+1,0<=S(this,b,a)&&(this.c=this.h=a<<8,this.f=(a&(a^c))<<8));break;case 35520:0<=(c=R(this,b=this.l(a,F)))&&(a=c-1,0<=S(this,b,a)&&(this.c=this.h=a<<8,this.f=((a^c)&c)<<8));break;case 35584:0<=(c=R(this,b=this.l(a,F)))&&(a=-c,0<=S(this,b,a)&&(this.g=this.c=this.h=a<<8,this.f=(a&c)<<8));break; -case 35648:0<=(c=R(this,b=this.l(a,F)))&&(a=c+(this.g>>16&1),0<=S(this,b,a)&&(this.c=this.h=this.g=a<<8,this.f=(a&(a^c))<<8));break;case 35712:0<=(c=R(this,b=this.l(a,F)))&&(a=c-(this.g>>16&1),0<=S(this,b,a)&&(this.c=this.h=this.g=a<<8,this.f=((a^c)&c)<<8));break;case 35776:0<=(c=V(this,a))&&(this.c=this.h=c<<8,this.g=this.f=0);break;case 35840:0<=(c=R(this,b=this.l(a,F)))&&(a=((this.g&65536)>>8|c)>>1,0<=S(this,b,a)&&(this.g=c<<16,this.c=this.h=a<<8,this.f=this.c^this.g>>1));break;case 35904:0<=(c= -R(this,b=this.l(a,F)))&&(a=c<<1|this.g>>16&1,0<=S(this,b,a)&&(this.g=this.c=this.h=a<<8,this.f=(a^c)<<8));break;case 35968:0<=(c=R(this,b=this.l(a,F)))&&(a=c&128|c>>1,0<=S(this,b,a)&&(this.g=c<<16,this.c=this.h=a<<8,this.f=this.c^this.g>>1));break;case 36032:0<=(c=R(this,b=this.l(a,F)))&&(a=c<<1,0<=S(this,b,a)&&(this.g=this.c=this.h=a<<8,this.f=(a^c)<<8));break;case 36160:a&56?0<=(d=T(this,a,0))&&(this.v=this.u>>12&3,0<=(b=this.S(d|65536))&&(this.v=this.u>>14&3,0<=Q(this,b)&&(this.c=this.h=b,this.f= -0))):(f=a&7,b=6!==f||(this.u>>2&12288)===(this.u&12288)?this.b[f]:this.aa[this.u>>12&3],0<=Q(this,b)&&(this.c=this.h=b,this.f=0));break;case 36224:0<=(c=Sb(this))&&((this.I&57344||(this.ga=22),a&56)?0<=(d=T(this,a,0))&&(this.v=this.u>>12&3,0<=(b=Rb(this,d|65536,D))&&(this.v=this.u>>14&3,0<=M(this,b,c)&&(this.c=this.h=c,this.f=0))):(f=a&7,6!==f||(this.u>>2&12288)===(this.u&12288)?this.b[f]=c:this.aa[this.u>>12&3]=c,this.c=this.h=c,this.f=0));break;default:switch(a&65528){case 128:0<=(b=Sb(this))&& -(f=a&7,this.b[7]=this.b[f],this.b[f]=b);break;case 152:this.u&49152||(this.u=this.u&63519|(a&7)<<5,this.la=1);break;case 160:case 168:break;case 176:case 184:break;default:switch(a){case 0:49152&this.u?(this.s|=128,K(this,4,46)):(this.Ha=3,Kb(this),console.log("HALT at "+this.b[7].toString(8)));break;case 1:b=0;if(0<(a=this.o.length))for(;0>12].call(this,a)} -var kc=[function(a){lc[a>>8&15].call(this,a)},function(a){P(this,Vb(this,a,U(this,a>>6)));--this.a},function(a){var b=U(this,a>>6);a=U(this,a);Qb(this,b-a,a,b);--this.a},function(a){P(this,U(this,a>>6)&U(this,a));--this.a},function(a){Tb(this,a,U(this,a>>6),Yb);--this.a},function(a){Tb(this,a,U(this,a>>6),$b);--this.a},function(a){Tb(this,a,U(this,a>>6),Xb);--this.a},function(a){mc[a>>8&15].call(this,a)},function(a){nc[a>>8&15].call(this,a)},function(a){var b=V(this,a>>6);P(this,Wb(this,a,b,1)<<8); ---this.a},function(a){var b=V(this,a>>6)<<8;a=V(this,a)<<8;Qb(this,b-a,a,b);--this.a},function(a){P(this,(V(this,a>>6)&V(this,a))<<8);--this.a},function(a){Ub(this,a,V(this,a>>6),Zb);--this.a},function(a){Ub(this,a,V(this,a>>6),ac);--this.a},function(a){Tb(this,a,U(this,a>>6),bc);--this.a},Z],lc=[function(a){oc[a>>4&15].call(this,a)},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i= --1;--this.a},function(){this.i=-1;--this.a},fc,fc,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],oc=[function(a){tc[a&15].call(this,a)},Z,Z,Z,Z,Z,Z,Z,Z,Z,function(a){uc[a&15].call(this,a)},function(a){vc[a&15].call(this,a)},Z,Z,Z,Z],uc=[hc,function(){this.g=0;--this.a},function(){this.f=0;--this.a},X,function(){this.h=1;--this.a},X,X,X,function(){this.c=0;--this.a},X,X,X,X,X,X,X],vc=[hc,function(){this.g= -65536;--this.a},function(){this.f=32768;--this.a},Y,function(){this.h=0;--this.a},Y,Y,Y,function(){this.c=32768;--this.a},Y,Y,Y,Y,Y,Y,Y],tc=[function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.u&49152||(Ob(this),this.A.reset());--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},Z,Z,Z,Z,Z,Z,Z,Z],mc=[gc,gc,ec,ec,cc,cc,dc,dc,jc,jc,Z,Z,Z,Z,ic,ic],nc=[function(){this.i= --1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--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],pc=[function(a){Pb(this,Vb(this,a,0));--this.a},function(){this.i= --1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a}],qc=[function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a}],rc=[function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a}],sc=[function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a}],wc=[function(a){Pb(this,Wb(this,a,0)); ---this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a}],xc=[function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a}],yc=[function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a}],zc=[function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a},function(){this.i=-1;--this.a}]; -function Ac(a){v.call(this,"ROM",a,Ac);this.c=null;this.l=a.addr;this.f=a.size;this.o=a.writable;this.g=a.alias;this.h=a.file;this.v=ca(this.h);if(this.h){a=this.h;var b=da(this.v);"json"!=b&&"hex"!=b&&(a=fa()+"/api/v1/dump?file="+this.h+"&format=bytes&decimal=true");var c=this;p(a,null,!0,function(a,b,e){Bc(c,a,b,e)})}}x(Ac);Ac.prototype.La=function(a,b,c,d){this.A=b;this.a=c;this.K=d;Cc(this)};Ac.prototype.za=function(){this.i&&(this.K&&this.K.a(this.id,this.l,this.f,this.i),delete this.i);return!0}; -Ac.prototype.ya=function(){return!0}; -function Bc(a,b,c,d){if(d)a.L("Unable to load system ROM (error "+d+": "+b+")");else{Ea(a.Mb,b,c);var f;if("["==c.charAt(0)||"{"==c.charAt(0))try{var e,g,h=eval("("+c+")");if(e=h.bytes)a.c=e;else if(e=h.words)for(a.c=Array(2*e.length),g=f=0;f>8&255;else if(e=h.data)for(a.c=Array(4*e.length),g=f=0;f>8&255,a.c[g++]=e[f]>>16&255,a.c[g++]=e[f]>>24&255;else a.c=h;a.i=h.symbols;if(!a.c.length){r("Empty ROM: "+b); -return}if(1==a.c.length){r(a.c[0]);return}}catch(k){a.L("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.c=Array(b.length),f=0;f>>d.f].ac(f&d.h,a.c[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.N("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bHc){if(Jc(d,this.v)){this.i=new O(this,"1.30.0","failsafe");Jc(this.i)&&(Oc(this,d),a=2,Pc(this.i));this.i.set("timestamp",ja());Qc(this.i);var f=this.c&&!this.l;if(1==a||ka("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=Nc(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?Jc(d,g):("error"== -e&&"no machine state"!=g?(this.L("Error: "+g),"unable to verify user"==g&&(oa("user",""),this.f=null)):this.N(e+": "+g),Pc(d),Jc(d)?(c=Nc(d),f=!0):c=!1))}f&&Mc(this,c?d:null)}else 2==a&&d.clear()}else Mc(this);delete this.v;delete this.B}f=y(this.id);for(e=0;ea[1];a=a[2];this.ca=!0;this.j.M=!0;var d=this.C.power;d&&(d.textContent="Shutdown");this.a&&(Rc(this,this.a,b,c,a),this.a.$a());this.W&&(Oc(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.g=0}; -function Oc(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 Sc(a,b,c){var d,f="none";if(a.g)return null;a.g--;var e=new O(a,"1.30.0"),g=new O(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&&Fb(a.a),d=a.a.ya(b,c),"object"===typeof d&&e.set(a.a.id,d),c&&(a.a.j.M=!1,!1===d&&(f=null)));for(var h=y(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(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);Zc(a,b,c)}})}else c(a,null)} -function $c(a,b,c,d){function f(a){if(void 0===h){var b=g&&B(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ha(a))}function e(a){f("Error: "+a);k&&(--Wc||va(!0));k=!1}var g,h,k=!0;Wc++;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],L=document.createElement("style");L.type="text/css";L.styleSheet?L.styleSheet.cssText=m:L.appendChild(document.createTextNode(m));q.appendChild(L)}c|| -(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?Xc(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,--Wc||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),--Wc||va(!0)):e("invalid machine element: "+ -a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(d)}):e(d)};"<"!=b.charAt(0)?Xc(b,a,d,!0,f,m):Yc(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(N){e(N.message)}return k}window.embedPDP11=function(a,b,c,d){va(!1);return $c(a,b,c,d)};window.enableEvents=va;window.sendEvent=wa;})(); +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=K.prototype; +l.Ha=function(a,b,c,d){this.j=b;this.a=c;this.G=d;a=Za;for(var f in a){var e=a[f];c=b;d=+f;for(var g=e[0]?e[0].bind(this):null,h=e[1]?e[1].bind(this):null,k=e[2]?e[2].bind(this):null,e=e[3]?e[3].bind(this):null,m=+f;m<=d;m+=2){var p=m&8191;void 0!==c.na[p]?t("I/O address already registered: "+q(m,8,!0)):c.na[p]=[g,h,k,e,!1]}}f=this.ac.bind(this);b.A=this.reset.bind(this);b.bb=f;D(this)};l.nc=function(){return $a(this.a)};l.Ac=function(a){ab(this.a,a&-1809|$a(this.a)&1808);this.a.B|=128};l.oc=function(){return this.b.U}; +l.Cc=function(a){if(128==(this.b.U&192)&&a&64){var b=this;L(this.a,8,4,52,function(){b.b.U|=128;return!!(b.b.U&64)})}this.b.U=this.b.U&128|a&-129}; +function bb(a){var b=a.l,c,d,f,e=b.T>>13&7;"undefined"===typeof b.R[e]&&(b.R[e]={cache:[],postProcess:a.pc,drive:e,blocksize:256,mapped:0,maxblock:b.Fa[e]*b.D[e],url:"rk"+e+".dsk"});b.v&=-129;switch(b.v>>1&7){case 0:b.hb=2496;b.O=0;b.v=128;b.T=0;break;case 1:if((b.T>>4&511)>=b.Fa[e]){b.O|=32832;b.v|=49152;break}if((b.T&15)>=b.D[e]){b.O|=32800;b.v|=49152;break}c=(b.T>>4&511)*b.D[e]+(b.T&15);d=(b.v&48)<<12|b.gb;f=65536-b.ib&65535;cb(a,b.R[e],c,d,f);return;case 2:if((b.T>>4&511)>=b.Fa[e])b.O|=32832, +b.v|=49152;else if((b.T&15)>=b.D[e])b.O|=32800,b.v|=49152;else{c=(b.T>>4&511)*b.D[e]+(b.T&15);d=(b.v&48)<<12|b.gb;f=65536-b.ib&65535;a.pb(b.R[e],c,d,f);return}}b.hb=e<<13|b.hb&8176|b.T%9&15;L(a.a,20,5,144,function(){b.v=b.v&65534|128;return!!(b.v&64)})}l.pc=function(a,b,c,d,f){var e=this.l;e.gb=d&65535;e.v=e.v&-49|d>>12&48;e.ib=65536-f&65535;switch(a){case 1:e.O|=33024;e.v|=49152;break;case 2:e.O|=33792,e.v|=49152}L(this.a,20,5,144,function(){e.v=e.v&65534|128;return!!(e.v&64)})}; +function db(a){var b=a.s,c,d,f,e=b.i>>8&3;b.i&=-2;"undefined"===typeof b.R[e]&&(b.R[e]={cache:[],postProcess:a.qc,drive:e,blocksize:128,mapped:1,maxblock:b.Fa[e]*b.D[e],url:"rl"+e+".dsk"});switch(b.i>>1&7){case 2:b.sa&8&&(b.i&=63);b.sa=b.bc[e]|b.ya&64;break;case 3:1==(b.F&3)&&(b.ya=b.F&4?b.ya+(b.F&65408)&65408|b.F<<2&64:b.ya-(b.F&65408)&65408|b.F<<2&64,b.F=b.ya);break;case 4:b.sa=b.ya;break;case 5:if(b.F>>6>=b.Fa[e]){b.i|=37888;break}if((b.F&63)>=b.D[e]){b.i|=37888;break}c=(b.F>>6)*b.D[e]+(b.F&63); +d=(b.oa&63)<<16|b.$a;f=65536-b.sa&65535;cb(a,b.R[e],c,d,f);return;case 6:if(b.F>>6>=b.Fa[e])b.i|=37888;else if((b.F&63)>=b.D[e])b.i|=37888;else{c=(b.F>>6)*b.D[e]+(b.F&63);d=(b.oa&63)<<16|b.$a;f=65536-b.sa&65535;a.pb(b.R[e],c,d,f);return}}L(a.a,20,5,112,function(){b.i|=129;return!!(b.i&64)})} +l.qc=function(a,b,c,d,f){var e=this.s;e.$a=d&65535;e.i=e.i&-49|d>>12&48;e.oa=d>>16&63;e.F=~~(c/e.D[b.fa])<<6|c%e.D[b.fa];e.ya=e.F;e.sa=65536-f&65535;switch(a){case 1:e.i|=33792;break;case 2:e.i|=40960}L(this.a,20,5,112,function(){e.i|=129;return!!(e.i&64)})};function eb(a){a=a.u;a.w=2176;a.Z=0;a.S=[4544,4544,4544,4544,4544,4544,4544,4544];a.Va=[0,0,0,0,0,0,0,0];a.Ka=a.Wa=a.Ua=a.xa=a.Fb=0} +function fb(a,b){var c=a.u,d,f,e;c.w&=-16513;c.Z&=-2049;c.S[b]&=-1153;L(a.a,-1,0,172);"undefined"===typeof c.R[b]&&(c.R[b]={cache:[],postProcess:a.rc,drive:b,blocksize:256,mapped:0,maxblock:c.vb[0]*c.Ea[0]*c.D[0],url:"rp"+b+".dsk"});switch(c.w&63){case 5:c.tb[b]=c.ia[b];c.w|=32896;c.S[b]|=32896;c.Ka|=1<=c.vb[0]||c.$[b]>>8>=c.Ea[0]||(c.$[b]&255)>=c.D[0]){c.Va[b]|=1024;c.w|=49152;break}d=(c.ia[b]*c.Ea[0]+(c.$[b]>>8))*c.D[0]+(c.$[b]& +255);f=(c.xa&63)<<16|c.Ua;e=65536-c.Wa&65535;cb(a,c.R[b],d,f,e);return;case 57:if(c.ia[b]>=c.vb[0]||c.$[b]>>8>=c.Ea[0]||(c.$[b]&255)>=c.D[0])c.Va[b]|=1024,c.w|=49152;else{d=(c.ia[b]*c.Ea[0]+(c.$[b]>>8))*c.D[0]+(c.$[b]&255);f=(c.xa&63)<<16|c.Ua;e=65536-c.Wa&65535;a.pb(c.R[b],d,f,e);return}}L(a.a,3,5,172,function(){c.w=c.w&65534|128;c.S[b]|=128;return!!(c.w&64)})} +l.rc=function(a,b,c,d,f){var e=this.u;e.Wa=65536-f&65535;e.Ua=d&65535;e.w=e.w&-769|d>>8&768;e.xa=d>>16&63;f=~~(c/e.D[0]);d=~~(f/e.Ea[0]);e.$[b.fa]=f%e.Ea[0]<<8|c%e.D[0];e.tb[b.fa]=e.ia[b.fa]=d;e.Ka|=1<=b.lc-1&&(e.S[b.fa]|=1024);switch(a){case 1:e.Z|=512;e.w|=49152;break;case 2:e.Z|=2048,e.w|=49152}L(this.a,20,5,172,function(){e.S[b.fa]|=128;e.w=e.w&65534|128;return!!(e.w&64)})};l.jc=function(){this.h.i|=128;this.h.i&64&&L(this.a,0,6,64)}; +function gb(a,b,c,d,f,e){var g=~~((e+c.pa-1)/c.pa),h=new XMLHttpRequest;2048>g&&d+2048hb(this.a,a.kc?ib(this.a,c):c,a.cache[b][f])){a.ob(2,a,b,c,d);return}c+=2;--d}b++}a.ob(0,a,b,c,d)}; +function cb(a,b,c,d,f){for(var e,g;0g){b.ob(2,b,c,d,f);return}b.cache[c][e]=g;d+=2;--f}c++}b.ob(0,b,c,d,f)}l.reset=function(){this.g.Sa=this.g.Sa&-120|20;this.b.da=0;this.b.U=128;this.h.i=0;this.l.v=128;this.s.i=128;eb(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.ha&65280:(a&1&&(b<<=8),e.ha=b|255,d=0);break;case 4194298:if(0>b)d=e.sb;else{a&1&&(b<<=8);if(d=b&65024){f=d>>9;do d+=34;while(f>>=1)}e.sb=d;e.va=2}break;case 4194294:if(70!==e.Ga)return N(e,4,222);0>b?d=e.m:d=e.m=0;break;case 4194292:if(70!==e.Ga)return N(e,4,224);d=1;break;case 4194290:if(70!==e.Ga)return N(e,4,226);d=0;break;case 4194288:if(70!==e.Ga)return N(e,4,228);d=61183;break;case 4194296:0<= +b&&!(a&1)&&(b&=255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==e.Ga)return N(e,4,232);f=a-4194272>>1;0>b?d=e.Cb[f]:(d=M(this,e.Cb[f],a,b,c),0<=d&&(e.Cb[f]=d));break;case 4194254:return a&1?e.X>>14&1?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.wa[3]=b),d=e.wa[3]):e.X>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.wa[1]=b),d=e.wa[1]),d;case 4194252:case 4194250:case 4194248:return f=a&7,e.X&2048?(0<=b&&(e.c[f]=b),d=e.c[f]):(0<=b&&(e.Ja[f]= +b),d=e.Ja[f]),d;case 4194246:return a&1?(0<=b&&(e.c[7]=b),d=e.c[7]):e.X>>14&0?(0<=b&&(e.c[6]=b),d=e.c[6]):(0<=b&&(e.wa[0]=b),d=e.wa[0]),d;case 4194244:case 4194242:case 4194240:return f=a&7,e.X&2048?(0<=b&&(e.Ja[f]=b),d=e.Ja[f]):(0<=b&&(e.c[f]=b),d=e.c[f]),d;default:return e.m|=16,N(e,4,124)}break;case 4194176:f=a>>1&31;d=M(this,e.N[3][f],a,b,c);0<=d&&(e.N[3][f]=d,e.N[3][f&15]&=65295);break;case 4194112:var g=this.b;f=this.h;switch(a&-2){case 4194174:d=M(this,e.Xa,a,b,c);0<=d&&(e.Xa=d);break;case 4194172:d= +e.la;d&65280&&(d=(d<<8|d>>8)&65535);break;case 4194170:e.I=e.I&62337|e.cb<<5|e.nb<<1;0>b?d=e.I:(d=M(this,e.I,a,b,c),0<=d&&(e.I=d&=62337,e.cb=d>>5&3,e.nb=d>>1&15,d&257?(f=2,e.ma&16&&(f=1),e.Ta=d&1?F|H:H):(e.Ta=0,f=4),this.g.Sa=this.g.Sa&-8|f));break;case 4194168:0>b?d=this.g.yc&65535:(d=M(this,this.g.data,a,b,c),0<=d&&(this.g.data=d));break;case 4194166:0<=b&&(b&127&&(g.dc=0),g.U&=-129,L(e,100,4,52,function(){g.U|=128;return!!(g.U&64)}));d=0;break;case 4194164:break;case 4194162:d=0;0>b&&(g.da&=-129, +0b?d=g.da:(d=M(this,g.da,a,b,c),0<=d&&(g.da=g.da&128|d&-129));break;case 4194150:0>b?(d=f.i,f.i&=-129):(d=M(this,f.i,a,b,c),0<=d&&(d&64&&!f.Db&&(setInterval(this.jc.bind(this),25),f.Db=1),f.i=d&-129));break;default:return e.m|=16,N(e,4,126)}break;case 4194048:f=this.l;switch(a&-2){case 4194048:d=M(this,f.hb,a,b,c);0<=d&&(f.hb=d);break;case 4194050:d=M(this,f.O,a,b,c);0<=d&& +(f.O=d);break;case 4194052:d=M(this,f.v,a,b,c);0<=b&&0<=d&&(f.v=d&-36993|f.v&36992,f.v&1&&bb(this));break;case 4194054:d=M(this,f.ib,a,b,c);0<=d&&(f.ib=d);break;case 4194056:d=M(this,f.gb,a,b,c);0<=d&&(f.gb=d);break;case 4194058:d=M(this,f.T,a,b,c);0<=d&&(f.T=d);break;case 4194060:break;case 4194062:d=M(this,f.Ub,a,b,c);0<=d&&(f.Ub=d);break;default:return e.m|=16,N(e,4,128)}break;case 4193728:var h=this.u;f=h.Z&7;switch(a&-2){case 4193728:d=M(this,h.w,a,b,c);0<=b&&0<=d&&(h.xa=h.xa&60|d>>8&3,h.w=d& +17279|h.w&34944|2048,d&1&&h.w&128?fb(this,f):192==(d&192)&&L(e,0,5,172));break;case 4193730:d=M(this,h.Wa,a,b,c);0<=d&&(h.Wa=d);break;case 4193732:d=M(this,h.Ua,a,b,c);0<=d&&(h.Ua=d&65534);break;case 4193734:d=M(this,h.$[f],a,b,c);0<=d&&(h.$[f]=d&7967);break;case 4193736:d=M(this,h.Z,a,b,c);0<=d&&(h.Z=d&63|h.Z&65472,d&128&&eb(this));break;case 4193738:d=h.S[f];break;case 4193740:d=h.Va[f];break;case 4193742:d=M(this,h.Ka,a,b,c);0<=d&&(h.Ka=d&255);break;case 4193744:d=h.wc[f];break;case 4193746:d= +M(this,h.Vb,a,b,c);0<=d&&(h.Vb=d);break;case 4193748:d=M(this,h.Wb[f],a,b,c);0<=d&&(h.Wb[f]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=h.xc[f];break;case 4193754:d=M(this,h.Xb[f],a,b,c);0<=d&&(h.Xb[f]=d);break;case 4193756:d=M(this,h.ia[f],a,b,c);0<=d&&(h.ia[f]=d&511);break;case 4193758:h.tb[f]=h.ia[f];d=h.tb[f];break;case 4193760:d=h.uc[f];break;case 4193762:d=h.vc[f];break;case 4193764:d=h.sc[f];break;case 4193766:d=h.tc[f];break;case 4193768:d=M(this,h.xa,a,b,c);0<=d&&(h.xa=d&63,h.w= +h.w&-769|(d&3)<<8);break;case 4193770:d=M(this,h.Fb,a,b,c);0<=d&&(h.Fb=d);break;default:return e.m|=16,N(e,4,132)}break;case 4192512:f=this.s;switch(a&-2){case 4192512:d=M(this,f.i,a,b,c);0<=b&&0<=d&&(f.oa=f.oa&60|d>>4&3,f.i=f.i&-1023|d&1022,f.i&128||db(this));break;case 4192514:d=M(this,f.$a,a,b,c);0<=d&&(f.$a=d&65534);break;case 4192516:d=M(this,f.F,a,b,c);0<=d&&(f.F=d);break;case 4192518:d=M(this,f.sa,a,b,c);0<=d&&(f.sa=d);break;case 4192520:d=M(this,f.oa,a,b,c);0<=d&&(f.oa=d&63,f.i=f.i&-49|(f.oa& +3)<<4);break;default:return e.m|=16,N(e,4,134)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=e.ma:(d=M(this,e.ma,a,b,c),0<=d&&(70!==e.Ga&&(d&=-49),e.ma=d,e.Ia[0]=d&4?15:7,e.Ia[1]=d&2?15:7,e.Ia[3]=d&1?15:7,e.Ta&&(f=2,e.ma&16&&(f=1),this.g.Sa=this.g.Sa&-8|f)));break;default:return e.m|=16,N(e,4,136)}break;case 4191424:f=a>>1&31;d=M(this,e.N[0][f],a,b,c);0<=d&&(e.N[0][f]=d,e.N[0][f&15]&=65295);break;case 4191360:f=a>>1&31;d=M(this,e.N[1][f],a,b,c);0<=d&&(e.N[1][f]=d,e.N[1][f&15]&=65295);break;case 4190400:case 4190336:if(70!== +e.Ga)return N(e,4,234);f=a>>2&31;d=e.jb[f];a&2&&(d>>=16);d&=65535;0<=b&&(d=M(this,d,a,b,c),0<=d&&(e.jb[f]=a&2?d<<16|e.jb[f]&65535:e.jb[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=Ya[a>>1&255];else return e.m|=16,N(e,4,138);break;default:return e.m|=16,N(e,4,142)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)");return d}; +var jb={},Za=(jb[65534]=[null,null,K.prototype.nc,K.prototype.Ac],jb[65396]=[null,null,K.prototype.oc,K.prototype.Cc],jb);v(function(){for(var a=C(document,"pdp11","device"),b=0;b>1),this.a=new Int32Array(this.b,0,c>>2),qb(this,mb?rb:sb);else{this.a=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},Y:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},za: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.ra=!0},P:function(a,b){return this.V(a, +b)},ca:function(a,b){return this.ja(a,b)},Ba:function(a,b,c){this.g||this.$b(a,b,c)},Na:function(a,b,c){this.g||this.Oa(a,b,c)},K:function(a){return this.o[a]},W:function(a){return this.o[a]},ba:function(a){return this.j.getUint16(a,!0)},ka:function(a){return a&1?this.o[a]|this.o[a+1]<<8:this.s[a>>1]},Aa:function(a,b){this.o[a]=b;this.ra=!0},Ca:function(a,b){this.o[a]=b;this.ra=!0},Ma:function(a,b){this.j.setUint16(a,b,!0);this.ra=!0},Pa:function(a,b){a&1?(this.o[a]=b,this.o[a+1]=b>>8):this.s[a>> +1]=b;this.ra=!0}};function Oa(a,b,c){a.G=b;a.h=a.l=0;c&&((a.h=c.h)&&ub(a,vb,!1),(a.l=c.l)&&wb(a,vb,!1))}function wb(a,b,c){c&&a.l||(a.kb=!a.g&&b[1]||a.C,a.Bc=!a.g&&b[3]||a.H);if(c||void 0===c)a.$b=b[1]||a.C,a.Oa=b[3]||a.H}function ub(a,b,c){c&&a.h||(a.fb=b[0]||a.u,a.qb=b[2]||a.A);if(c||void 0===c)a.V=b[0]||a.u,a.ja=b[2]||a.A}function qb(a,b){b||(b=xb);ub(a,b,void 0);wb(a,b,void 0)} +var xb=[],tb=[J.prototype.Y,J.prototype.Da,J.prototype.za,J.prototype.Qa],vb=[J.prototype.P,J.prototype.Ba,J.prototype.ca,J.prototype.Na];if(Ha)var sb=[J.prototype.K,J.prototype.Aa,J.prototype.ba,J.prototype.Ma],rb=[J.prototype.W,J.prototype.Ca,J.prototype.ka,J.prototype.Pa]; +function yb(a,b){w.call(this,"CPU",a,yb);var c=a.multiplier||1;this.yb=a.cycles||b;this.ja=c;this.xb=Math.round(this.yb/1E4)/100;this.ba=this.xb*this.ja;this.f.ea=!1;this.f.Yb=!1;this.f.Za=a.autoStart;this.f.Qb=!1;this.f.lb=!1;this.Oa=this.ca=0;this.Pa=a.csStart;this.Aa=a.csInterval;this.Ba=a.csStop;this.Ma=[];this.Pb=this.Gb.bind(this);D(this)}y(yb);var zb=["power","reset"];l=yb.prototype; +l.Ha=function(a,b,c,d){this.g=a;this.j=b;this.G=d;for(b=0;ba.P/a.ba&&(b=1),a.ja=b,b=a.xb*a.ja,a.ba!=b)){a.ba=b;b=a.ba.toFixed(2)+"Mhz";var c=a.o.setSpeed;c&&(c.textContent=b);a.J("target speed: "+b)}Fb(a,a.K);a.K=0;a.H=ha();a.V=0;Gb(a)} +l.Gb=function(){if(Fa(this,!0)){if(!this.f.ea){Eb(this);this.g&&this.g.start(this.H,Hb(this));this.f.ea=!0;this.f.Yb=!0;this.za&&this.za.start();var a=this.o.run;a&&(a.textContent="Halt");this.g&&this.g.La(!0)}this.zb>=this.yb&&Gb(this,!0);this.Da=0;this.Na=ha();this.V&&(a=this.Na-this.V,a>this.Mb&&(this.H+=a,this.H>this.Na&&(this.H=this.Na)));try{do{for(var b,c=this.f.lb?1:this.Qa,d=this.Ma.length-1;0<=d;d--){var f=this.Ma[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.C-this.a,a=e,g=this.Ma.length-1;0<=g;g--){var h=this.Ma[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.Da+=e;this.K+=e;Fb(this,0,!0);a=e;if(this.f.lb){var k=!1;this.Oa=this.Oa+this.Tb()|0;this.ca-=a;0>=this.ca&&(this.ca+=this.Aa,k=!0);0<=this.Ba&&this.Ba<=Hb(this)&&(this.Aa=this.Ba=-1,Cb(this),P(this),k=!0);k&&this.J(Hb(this)+" cycles: checksum="+q(this.Oa))}this.Ca-=e;if(0>=this.Ca){this.Ca+=this.Qa;15<=++this.Nb&&(this.g&&this.g.La(),this.Nb=0);break}}while(this.f.ea)}catch(m){P(this); +Db(this);this.g&&this.g.stop(ha(),Hb(this));Fa(this,!1);b=m.stack||m.message;this.f.error=!0;this.L(b);return}b=setTimeout;c=this.Pb;this.V=ha();d=this.Mb;this.Da&&(d=Math.round(d*this.Da/this.Qa));d-=this.V-this.Na;if(f=this.V-this.H)this.P=Math.round(this.K/(10*f))/100,864E5<=f&&(this.W=0,Eb(this));if(0>d||this.Pd&&(this.H-=d),d=0;this.zb+=this.Da;this.V+=d;b(c,d)}else Db(this),this.g&&this.g.stop(ha(),Hb(this))};l.Zb=function(){return 0}; +function P(a){a.f.ab&&(a.f.Ab=!0);a.C-=a.a;a.a=0;Fb(a,a.K);a.K=0;if(a.f.ea){a.f.ea=!1;a.za&&a.za.stop();var b=a.o.run;b&&(b.textContent="Run")}a.f.complete=void 0}function Db(a){a.g&&a.g.La(void 0)} +function Ib(a){this.gc=a.resetAddr||0;yb.call(this,a,1E6);this.Jb=0;this.decode=Jb.bind(this);this.A=65536;this.s=32768;this.u=65535;this.l=32768;this.c=[0,0,0,0,0,0,0,this.gc];this.Ja=[0,0,0,0,0,0];this.wa=[0,0,0,0];this.ha=255;this.nb=this.cb=this.Ta=this.h=this.ma=this.Xa=this.la=this.I=this.m=this.sb=0;this.Ia=[7,7,7,7];this.N=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.jb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.Cb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.B=0;this.Ga=70;this.ka=-1;this.b=[];this.Sb=0;this.va=2;Kb(this);this.f.complete=this.f.cc=!1}y(Ib,yb);l=Ib.prototype; +l.reset=function(){this.f.ea&&P(this);Lb(this);Bb(this);this.f.error=!1;this.parent.reset.call(this)};function Lb(a){a.ha=255;a.m=0;a.b=[];a.sb=0;a.I=a.la=a.Xa=a.ma=a.Ta=0;a.Ia[0]=a.Ia[1]=a.Ia[3]=7;a.cb=0;Kb(a)}function Kb(a){a.Ta?(a.Ib=65536,a.Y=a.ic,a.qb=a.ga):(a.Ib=0,a.Y=a.hc,a.qb=a.rb)}l.Tb=function(){return 0};l.save=function(){var a=new Q(this);a.set(0,[]);a.set(1,[this.Lb,this.W,this.ja]);a.set(2,Xa(this.j));return a.data()}; +l.restore=function(a){var b=a[1];this.Lb=b[0];this.W=b[1];Eb(this,b[3]);a:{b=this.j;a=a[2];var c;for(c=0;cb){a.b[e].qa-=b;break}b-=a.b[e].qa}a.b.splice(e+1,0,{delay:b,priority:c<<5&224,vector:d,callback:f})}a.va=2}function $a(a){return a.X=a.X&63728|(a.l&32768?8:0)|(a.u&65535?0:4)|(a.s&32768?2:0)|(a.A&65536?1:0)} +function ab(a,b){a.l=b<<12;a.u=~b&4;a.s=b<<14;a.A=b<<16;if((b^a.X)&2048)for(var c=a.Ja.length;0<=--c;){var d=a.c[c];a.c[c]=a.Ja[c];a.Ja[c]=d}a.h=b>>14&3;c=a.X>>14&3;a.h!=c&&(a.wa[c]=a.c[6],a.c[6]=a.wa[a.h]);a.va=2;a.X=b}function Mb(a,b){a.B&128||(a.l=a.u=a.A=b,a.s=0)}function R(a,b){a.B&128||(a.l=a.u=b,a.s=0)}function Nb(a,b,c,d){a.B&128||(a.l=a.u=a.A=b,a.s=(c^d)&(d^b))} +function N(a,b,c){var d=!1;0>a.ka?a.ka=$a(a):a.h||(b=4,d=!0);a.I&57344||(a.la=63222,a.Xa=b);a.h=0;var f=a.ga(b|65536),e=a.ga(b+2&65535|65536);ab(a,e&53247|a.ka>>2&12288);d&&(a.m|=4,a.c[6]=4);Ob(a,a.ka);Ob(a,a.c[7]);a.c[7]=f;a.B&=-113;a.ka=-1;throw b|c<<8;}function ib(a,b){var c=b>>13&31;31>c?a.ma&32&&(b=a.jb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b} +function Pb(a,b,c){var d,f,e,g=0;if(c&a.Ta){d=b>>13&a.Ia[a.h];f=a.N[a.h][d];e=(a.N[a.h][d+16]<<6)+(b&8191)&4194303;a.ma&16?3932160<=e&&4186112>e&&(e=ib(a,e&262143)):(e&=262143,253952<=e&&(e|=4186112));3932160>e&&(3915776<=e&&(a.m|=32,N(a,4,24)),e&1&&!(c&1)&&(a.m|=64,N(a,4,26)));switch(f&7){case 1:g=4096;case 2:f|=128;c&H&&(g=8192);break;case 4:g=4096;case 5:c&H&&(g=4096);case 6:f|=c&H?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.N[a.h][d]=f;if(4194170!==e||a.h)a.cb=a.h,a.nb=d;g&&(g&57344&&(0<=a.ka&&(g|=128),a.I&57344||(a.I=a.I|g|a.cb<<5|a.nb<<1),N(a,168,28)),a.I&61440||!(4191360>e||4194239>>b.j;a=c!=b.h?b.b[d].qb(c,a):b.b[d++].fb(c,a)|b.b[d&b.K].fb(0,a+1)<<8}return a}; +l.ga=function(a){return this.rb(Pb(this,a,F))};function hb(a,b,c){c&=65535;if(4194304<=b)return a.c[b-4194304]=c;if(0<=b){a=a.j;var d=c,f=b&a.h,e=(b&a.l)>>>a.j;f!=a.h?a.b[e].Bc(f,d&65535,b):(a.b[e++].kb(f,d&255,b),a.b[e&a.K].kb(0,d>>8&255,b+1));return c}return b}function Qb(a,b){4194304<=b?b=a.c[b-4194304]&255:0<=b&&(a=a.j,b=a.b[(b&a.l)>>>a.j].fb(b&a.h,b));return b}function Rb(a,b,c){c&=255;4194304<=b?a.c[b-4194304]=a.c[b-4194304]&65280|c:0<=b&&(a=a.j,a.b[(b&a.l)>>>a.j].kb(b&a.h,c&255,b))} +function Ob(a,b){var c=a.c[6]-2&65535;a.c[6]=c;a.I&57344||(a.la=a.la<<8|246);!a.h&&c<=a.ha&&4>3&7){case 0:N(a,4,34);break;case 1:return 6===e&&!a.h&&c&H&&(a.c[6]<=a.ha||65534<=a.c[6])&&(a.c[6]<=a.ha-32||65534<=a.c[6]?(a.m|=4,a.c[6]=4,N(a,4,36)):(a.m|=8,a.B|=64)),7===e?a.c[e]:a.c[e]|g;case 2:f=2;d=a.c[e];7!==e&&(d|=g,6>e&&c&1&&(f=1));break;case 3:f=2;d=a.c[e];7!==e&&(d|=g);if(0>(d=a.ga(d)))return d;d|=g;break;case 4:f=-2;6>e&&c&1&&(f=-1);d=a.c[e]+f&65535;7!==e&&(d|=g);break;case 5:f=-2;d=a.c[e]-2&65535;7!==e&&(d|=g);if(0>(d=a.ga(d)))return d; +d|=g;break;case 6:if(0>(d=a.ga(a.c[7])))return d;a.c[7]=a.c[7]+2&65535;d=d+a.c[e]&65535;return d|g;case 7:if(0>(d=a.ga(a.c[7])))return d;a.c[7]=a.c[7]+2&65535;d=d+a.c[e]&65535;return 0>(d=a.ga(d|65536))?d:d|g}a.c[e]=a.c[e]+f&65535;!g||a.I&57344||(a.la=a.la<<8|f<<3&248|e);6===e&&!a.h&&c&H&&0>=f&&(a.c[6]<=a.ha||65534<=a.c[6])&&(a.c[6]<=a.ha-32?(a.m|=4,a.c[6]=4,N(a,4,38)):(a.m|=8,a.B|=64));return d}l.hc=function(a,b){return Sb(this,a,b)};l.ic=function(a,b){return Pb(this,Sb(this,a,b),b)}; +function S(a,b){return b&56?a.qb(Sb(a,b,F)):a.c[b&7]}function T(a,b){return b&56?Qb(a,a.Y(b,Ja)):a.c[b&7]&255}function Tb(a,b,c,d){b&56?(b=a.Y(b,Ia),hb(a,b,d.call(a,c,a.rb(b)))):(b&=7,a.c[b]=d.call(a,c,a.c[b])&65535)}function Ub(a,b,c,d){b&56?(b=a.Y(b,La),Rb(a,b,d.call(a,c,Qb(a,b)))):(b&=7,a.c[b]=a.c[b]&65280|d.call(a,c,a.c[b])&255)}function Vb(a,b,c){b&56?hb(a,a.Y(b,H),c):a.c[b&7]=c&65535;return c} +function Wb(a,b,c,d){b&56?Rb(a,a.Y(b,Ka),c):(b&=7,a.c[b]=c?d&1?c<<24>>24&65535:a.c[b]&-256|c&255:a.c[b]&-256);return c} +l.Zb=function(a){this.f.complete=!0;this.f.cc=!1;this.f.Yb=!1;this.C=this.a=a;this.Lb&256?(this.C-=this.a,this.a=0,a=!1):a=!0;if(a){do{var b,c;this.B&112&&(this.B&32?N(this,168,52):this.B&64?N(this,4,54):this.B&16&&N(this,12,56),this.B&=-113);if(this.va)if(1===this.va)this.va=2;else{this.va=0;c=-1;a=this.sb&224;if(0<(b=this.b.length))for(;0a&& +(a=this.b[b].mc,c=b)}a>(this.X&224)&&(0>c?N(this,160,42):(N(this,this.b[c].zc,44),this.b.splice(c,1)))}this.I&57344||(this.la=0,this.Xa=this.c[7]);this.B=this.X&16;a=this.ga(this.c[7]);0<=a&&(this.c[7]=this.c[7]+2&65535);this.decode(a)}while(0>6&7;Ob(this,this.c[a]);this.c[a]=this.c[7];this.c[7]=b;--this.a}function gc(){--this.a}function hc(){--this.a}function V(a){a&1&&(this.A=65536);a&2&&(this.s=32768);a&4&&(this.u=0);a&8&&(this.l=32768);--this.a}function ic(){--this.a}function jc(){--this.a}function W(){N(this,8,48)}function Jb(a){kc[a>>12].call(this,a)} +var kc=[function(a){lc[a>>8&15].call(this,a)},function(a){R(this,Vb(this,a,S(this,a>>6)));--this.a},function(a){var b=S(this,a>>6);a=S(this,a);Nb(this,b-a,a,b);--this.a},function(a){R(this,S(this,a>>6)&S(this,a));--this.a},function(a){Tb(this,a,S(this,a>>6),Yb);--this.a},function(a){Tb(this,a,S(this,a>>6),$b);--this.a},function(a){Tb(this,a,S(this,a>>6),Xb);--this.a},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);R(this,Wb(this,a,b,1)<<8); +--this.a},function(a){var b=T(this,a>>6)<<8;a=T(this,a)<<8;Nb(this,b-a,a,b);--this.a},function(a){R(this,(T(this,a>>6)&T(this,a))<<8);--this.a},function(a){Ub(this,a,T(this,a>>6),Zb);--this.a},function(a){Ub(this,a,T(this,a>>6),ac);--this.a},function(a){Tb(this,a,S(this,a>>6),bc);--this.a},W],lc=[function(a){oc[a>>4&15].call(this,a)},function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a},fc,fc,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)},W,W],oc=[function(a){tc[a&15].call(this,a)},W,W,W,W,W,W,W,W,W,function(a){uc[a&15].call(this,a)},function(a){vc[a&15].call(this,a)},W,W,W,W],uc=[hc,function(){this.A=0;--this.a},function(){this.s=0;--this.a},U,function(){this.u=1;--this.a},U,U,U,function(){this.l=0;--this.a},U,U,U,U,U,U,U],vc=[hc,function(){this.A=65536;--this.a},function(){this.s=32768;--this.a},V,function(){this.u= +0;--this.a},V,V,V,function(){this.l=32768;--this.a},V,V,V,V,V,V,V],tc=[function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a},function(){this.X&49152||(Lb(this),this.j.reset());--this.a},function(){--this.a},function(){--this.a},W,W,W,W,W,W,W,W],mc=[gc,gc,ec,ec,cc,cc,dc,dc,jc,jc,W,W,W,W,ic,ic],nc=[function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a}, +function(){--this.a},function(){--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)},W,W],pc=[function(a){Mb(this,Vb(this,a,0));--this.a},function(){--this.a},function(){--this.a},function(){--this.a}],qc=[function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a}],rc=[function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a}],sc=[function(){--this.a}, +function(){--this.a},function(){--this.a},function(){--this.a}],wc=[function(a){Mb(this,Wb(this,a,0));--this.a},function(){--this.a},function(){--this.a},function(){--this.a}],xc=[function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a}],yc=[function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a}],zc=[function(){--this.a},function(){--this.a},function(){--this.a},function(){--this.a}]; +function X(a){w.call(this,"ROM",a,X);this.b=null;this.u=a.addr;this.g=a.size;this.A=a.writable;this.h=a.alias;this.l=a.file;this.C=ba(this.l);if(this.l){a=this.l;var b=ca(this.C);"json"!=b&&"hex"!=b&&(a=ea()+"/api/v1/dump?file="+this.l+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,e){Ac(c,a,b,e)})}}y(X);X.prototype.Ha=function(a,b,c,d){this.j=b;this.a=c;this.G=d;Bc(this)};X.prototype.ua=function(){this.s&&(this.G&&this.G.a(this.id,this.u,this.g,this.s),delete this.s);return!0}; +X.prototype.ta=function(){return!0}; +function Ac(a,b,c,d){if(d)a.L("Unable to load system ROM (error "+d+": "+b+")");else{Da(a.Hb,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.s=h.symbols;if(!a.b.length){t("Empty ROM: "+b); +return}if(1==a.b.length){t(a.b[0]);return}}catch(k){a.L("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f>>d.j].$b(f&d.h,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.h?b.push(a.h):null!=a.h&&a.h.length&&(b=a.h);for(c=0;c>>f.j;0>>=f.j;0\nLicense: GPL version 3 or later ");this.J("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bY){if(Z(d,this.C)){this.s=new Q(this,"1.30.0","failsafe");Z(this.s)&&(Lc(this,d),a=2,Mc(this.s));this.s.set("timestamp",ia());Nc(this.s);var f=this.b&&!this.u;if(1==a||ja("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=Kc(d)){var e=d.get("code"),g=d.get("data");e&&("ok"==e?Z(d,g):("error"==e&& +"no machine state"!=g?(this.L("Error: "+g),"unable to verify user"==g&&(na("user",""),this.g=null)):this.J(e+": "+g),Mc(d),Z(d)?(c=Kc(d),f=!0):c=!1))}f&&Jc(this,c?d:null)}else 2==a&&d.clear()}else Jc(this);delete this.C;delete this.H}f=z(this.id);for(e=0;ea[1];a=a[2];this.ca=!0;this.f.M=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(Oc(this,this.a,b,c,a),this.a.Za());this.V&&(Lc(this,b),b.clear());!c&&this.s&&(this.s.clear(),delete this.s);this.h=0}; +function Lc(a,b){if(ja("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.g||"";b=b.toString();var d={app:"PDP11js",ver:"1.30.0"};d.url=a.url;d.user=c;d.type="bug";d.data=b;r("http://www.pcjs.org/api/v1/report",d,!0)}} +function Pc(a,b,c){var d,f="none";if(a.h)return null;a.h--;var e=new Q(a,"1.30.0"),g=new Q(a,"1.30.0","validate"),h=ia();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.ta&&(c&&P(a.a),d=a.a.ta(b,c),"object"===typeof d&&e.set(a.a.id,d),c&&(a.a.f.M=!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(p){e=null,a=p.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");r(f,null,!0,function(e,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(e=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=h[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(e);)k=0>k.indexOf(m[1])?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+"> in "+f);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],g);Wc(a,b,c)}})}else c(a,null)} +function Xc(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=ga(a))}function e(a){f("Error: "+a);k&&(--Tc||ua(!0));k=!1}var g,h,k=!0;Tc++;Ca[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],E=document.createElement("style");E.type="text/css";E.styleSheet?E.styleSheet.cssText=m:E.appendChild(document.createTextNode(m));p.appendChild(E)}c|| +(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?Uc(c,null,null,!1,f,function(d,k){k?(Da(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--Tc||ua(!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),--Tc||ua(!0)):e("invalid machine element: "+ +a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser")):e(d)}):e(d)};"<"!=b.charAt(0)?Uc(b,a,d,!0,f,m):Vc(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(G){e(G.message)}return k}window.embedPDP11=function(a,b,c,d){ua(!1);return Xc(a,b,c,d)};window.enableEvents=ua;window.sendEvent=va;})();