From 614fc11acad767a6b326f28468a91915ce63f832 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 20 Sep 2016 11:19:42 -0700 Subject: [PATCH] Restored support for custom memory controllers in the PDP11 emulator (to be used for UNIBUS I/O) --- devices/pdp11/panel/1170/wide.xml | 30 ++- modules/pc8080/lib/rom.js | 2 +- modules/pdp11/lib/bus.js | 138 +++++++++++- modules/pdp11/lib/cpu.js | 9 +- modules/pdp11/lib/cpustate.js | 187 ++++++---------- modules/pdp11/lib/defines.js | 4 +- modules/pdp11/lib/memory.js | 68 +++++- modules/pdp11/lib/rom.js | 5 +- versions/pc8080/1.30.0/pc8080-dbg.js | 22 +- versions/pdp11/1.30.0/pdp11-dbg.js | 316 ++++++++++++++------------- versions/pdp11/1.30.0/pdp11.js | 218 +++++++++--------- 11 files changed, 568 insertions(+), 431 deletions(-) diff --git a/devices/pdp11/panel/1170/wide.xml b/devices/pdp11/panel/1170/wide.xml index a934b7677..276211716 100644 --- a/devices/pdp11/panel/1170/wide.xml +++ b/devices/pdp11/panel/1170/wide.xml @@ -1,24 +1,32 @@ Control Panel - + + + + Enter + Clear + - - 0000 + + 0000 + 0000 + 0000 + 0000 + 0000 + 0000 + 0000 + 0000 - 0 + 0 0 + 0 0 - Speed: - Stopped - - - Enter - Clear - Run + + Run Step Reset Fast diff --git a/modules/pc8080/lib/rom.js b/modules/pc8080/lib/rom.js index b8a6e1ae6..da0dee586 100644 --- a/modules/pc8080/lib/rom.js +++ b/modules/pc8080/lib/rom.js @@ -59,7 +59,7 @@ if (NODE) { * is the ROM you expected. * * Finally, while making ROM "writable" may seem a contradiction in terms, I want to be able to load selected - * CP/M binary files into memory purely for testing purposes, and the RAM component has no "file" option, so the + * binary files into memory purely for testing purposes, and the RAM component has no "file" option, so the * simplest solution was to add the option to load binary files into memory as "writable" ROMs. * * Moreover, if a "writable" ROM is installed at addr 0x100, that triggers our "Fake CP/M" support, providing diff --git a/modules/pdp11/lib/bus.js b/modules/pdp11/lib/bus.js index af176401e..393fd770e 100644 --- a/modules/pdp11/lib/bus.js +++ b/modules/pdp11/lib/bus.js @@ -106,7 +106,9 @@ function BusPDP11(parmsBus, cpu, dbg) * Bus Width Block Shift Block Size * --------- ----------- ---------- * 16 bits (64Kb address space): 10 1Kb (64 maximum blocks) + * 18 bits (256Kb address space): 11 2Kb (128 maximum blocks) * 20 bits (1Mb address space): 12 4Kb (256 maximum blocks) + * 22 bits (4Mb address space): 13 8Kb (512 maximum blocks) * 24 bits (16Mb address space): 14 16Kb (1K maximum blocks) * 32 bits (4Gb address space); 15 32Kb (128K maximum blocks) * @@ -117,7 +119,9 @@ function BusPDP11(parmsBus, cpu, dbg) */ this.addrTotal = Math.pow(2, this.nBusWidth); this.nBusLimit = this.nBusMask = (this.addrTotal - 1) | 0; - this.nBlockShift = (this.nBusWidth <= 16)? 10 : ((this.nBusWidth <= 20)? 12 : (this.nBusWidth <= 24? 14 : 15)); + this.nBlockShift = (this.nBusWidth >> 1) + 2; + if (this.nBlockShift < 10) this.nBlockShift = 10; + if (this.nBlockShift > 15) this.nBlockShift = 15; this.nBlockSize = 1 << this.nBlockShift; this.nBlockLen = this.nBlockSize >> 2; this.nBlockLimit = this.nBlockSize - 1; @@ -168,9 +172,17 @@ function BusPDP11(parmsBus, cpu, dbg) Component.subclass(BusPDP11); +BusPDP11.IOBASE_VIRT = 0xE000; /*000160000*/ +BusPDP11.IOBASE_18BIT = 0x3E000; /*000760000*/ +BusPDP11.IOBASE_UNIBUS = 0x3C0000; /*017000000*/ +BusPDP11.IOBASE_22BIT = 0x3FE000; /*017760000*/ +BusPDP11.MAX_MEMORY = BusPDP11.IOBASE_UNIBUS - 16384; // Maximum memory address (need less memory for BSD 2.9 boot) +BusPDP11.MAX_ADDRESS = 0x400000; /*020000000*/ // Register addresses are above 22 bit addressing + BusPDP11.ERROR = { ADD_MEM_INUSE: 1, ADD_MEM_BADRANGE: 2, + SET_MEM_NOCTRL: 3, SET_MEM_BADRANGE: 4, REM_MEM_BADRANGE: 5 }; @@ -222,6 +234,89 @@ BusPDP11.prototype.initMemory = function() for (var iBlock = 0; iBlock < this.nBlockTotal; iBlock++) { this.aMemBlocks[iBlock] = block; } + this.afnCtrl = new Array(4); + this.afnCtrl[0] = this.readCtrlByte; + this.afnCtrl[1] = this.readCtrlWord; + this.afnCtrl[2] = this.writeCtrlByte; + this.afnCtrl[3] = this.writeCtrlWord; + this.addMemory(BusPDP11.IOBASE_22BIT, 8192, MemoryPDP11.TYPE.CTRL, this); +}; + +/** + * getMemoryBuffer(addr) + * + * Our Bus component also acts as custom memory controller, so it must also provide this function. + * + * @this {BusPDP11} + * @param {number} addr + * @return {Array} containing the buffer (and the offset within that buffer that corresponds to the requested block) + */ +BusPDP11.prototype.getMemoryBuffer = function(addr) +{ + return [null, 0]; +}; + +/** + * getMemoryAccess() + * + * Our Bus component also acts as custom memory controller, so it must also provide this function. + * + * @this {BusPDP11} + * @return {Array.} + */ +BusPDP11.prototype.getMemoryAccess = function() +{ + return this.afnCtrl; +}; + +/** + * readCtrlByte(off, addr) + * + * @this {BusPDP11} + * @param {number} off + * @param {number} [addr] + * @return {number} + */ +BusPDP11.prototype.readCtrlByte = function(off, addr) +{ + return 0; +}; + +/** + * readCtrlWord(off, addr) + * + * @this {BusPDP11} + * @param {number} off + * @param {number} [addr] + * @return {number} + */ +BusPDP11.prototype.readCtrlWord = function(off, addr) +{ + return 0; +}; + +/** + * writeCtrlByte(off, b, addr) + * + * @this {BusPDP11} + * @param {number} off + * @param {number} b (which should already be pre-masked to 8 bits) + * @param {number} [addr] + */ +BusPDP11.prototype.writeCtrlByte = function(off, b, addr) +{ +}; + +/** + * writeCtrlWord(off, w, addr) + * + * @this {BusPDP11} + * @param {number} off + * @param {number} w (which should already be pre-masked to 16 bits) + * @param {number} [addr] + */ +BusPDP11.prototype.writeCtrlWord = function(off, w, addr) +{ }; /** @@ -257,7 +352,7 @@ BusPDP11.prototype.powerUp = function(data, fRepower) }; /** - * addMemory(addr, size, type) + * addMemory(addr, size, type, controller) * * Adds new Memory blocks to the specified address range. Any Memory blocks previously * added to that range must first be removed via removeMemory(); otherwise, you'll get @@ -283,9 +378,10 @@ BusPDP11.prototype.powerUp = function(data, fRepower) * @param {number} addr is the starting physical address of the request * @param {number} size of the request, in bytes * @param {number} type is one of the MemoryPDP11.TYPE constants + * @param {Object} [controller] is an optional memory controller component * @return {boolean} true if successful, false if not */ -BusPDP11.prototype.addMemory = function(addr, size, type) +BusPDP11.prototype.addMemory = function(addr, size, type, controller) { var addrNext = addr; var sizeLeft = size; @@ -299,7 +395,7 @@ BusPDP11.prototype.addMemory = function(addr, size, type) if (sizeBlock > sizeLeft) sizeBlock = sizeLeft; if (block && block.size) { - if (block.type == type) { + if (block.type == type && block.controller == controller) { /* * Where there is already a similar block with a non-zero size, we allow the allocation only if: * @@ -324,7 +420,7 @@ BusPDP11.prototype.addMemory = function(addr, size, type) return this.reportError(BusPDP11.ERROR.ADD_MEM_INUSE, addrNext, sizeLeft); } - var blockNew = new MemoryPDP11(addrNext, sizeBlock, this.nBlockSize, type); + var blockNew = new MemoryPDP11(addrNext, sizeBlock, this.nBlockSize, type, controller); blockNew.copyBreakpoints(this.dbg, block); this.aMemBlocks[iBlock++] = blockNew; @@ -456,6 +552,38 @@ BusPDP11.prototype.getMemoryBlocks = function(addr, size) return aBlocks; }; +/** + * setMemoryAccess(addr, size, afn, fQuiet) + * + * Updates the access functions in every block of the specified address range. Since the only components + * that should be dynamically modifying the memory access functions are those that use addMemory() with a custom + * memory controller, we require that the block(s) being updated do in fact have a controller. + * + * @this {BusPDP11} + * @param {number} addr + * @param {number} size + * @param {Array.} [afn] + * @param {boolean} [fQuiet] (true if any error should be quietly logged) + * @return {boolean} true if successful, false if not + */ +BusPDP11.prototype.setMemoryAccess = function(addr, size, afn, fQuiet) +{ + if (!(addr & this.nBlockLimit) && size && !(size & this.nBlockLimit)) { + var iBlock = addr >>> this.nBlockShift; + while (size > 0) { + var block = this.aMemBlocks[iBlock]; + if (!block.controller) { + return this.reportError(BusPDP11.ERROR.SET_MEM_NOCTRL, addr, size, fQuiet); + } + block.setAccess(afn, true); + size -= this.nBlockSize; + iBlock++; + } + return true; + } + return this.reportError(BusPDP11.ERROR.SET_MEM_BADRANGE, addr, size); +}; + /** * setMemoryBlocks(addr, size, aBlocks, type) * diff --git a/modules/pdp11/lib/cpu.js b/modules/pdp11/lib/cpu.js index 6480d1493..df1f658b2 100644 --- a/modules/pdp11/lib/cpu.js +++ b/modules/pdp11/lib/cpu.js @@ -433,12 +433,12 @@ CPUPDP11.prototype.displayChecksum = function() * displayValue(sLabel, nValue, cch) * * This is principally for displaying register values, but in reality, it can be used to display any - * numeric (hex) value bound to the given label. + * numeric value bound to the given label. * * @this {CPUPDP11} * @param {string} sLabel * @param {number} nValue - * @param {number} cch + * @param {number} [cch] */ CPUPDP11.prototype.displayValue = function(sLabel, nValue, cch) { @@ -448,10 +448,11 @@ CPUPDP11.prototype.displayValue = function(sLabel, nValue, cch) this.stopCPU(); } var sVal; + var nBase = this.dbg && this.dbg.nBase || 8; if (!this.flags.running || this.flags.displayLiveRegs) { - sVal = str.toHex(nValue, cch); + sVal = nBase == 8? str.toOct(nValue, cch) : str.toHex(nValue, cch); } else { - sVal = "--------".substr(0, cch); + sVal = "--------".substr(0, cch || 4); } /* * TODO: Determine if this test actually avoids any redrawing when a register hasn't changed, and/or if diff --git a/modules/pdp11/lib/cpustate.js b/modules/pdp11/lib/cpustate.js index 3a82c9db2..0e7cb0f0f 100644 --- a/modules/pdp11/lib/cpustate.js +++ b/modules/pdp11/lib/cpustate.js @@ -128,47 +128,16 @@ CPUStatePDP11.prototype.reset = function() CPUStatePDP11.prototype.initRegs = function() { /* - * Instead of having separate flagC, flagZ and flagN variables, I would prefer to have only one: flagsCZN. - * The C and N flags don't conflict; they are always bits 16 and 15 of the last 16-bit arithmetic result (or - * bits 8 and 7 of the last 8-bit arithmetic result). The Z flag is a "bit" more complicated, because it's a - * representation of bits 15-0 (or 7-0), which overlap the N flag bit. That overlap is fine after any given - * arithmetic operation, because of the four possible N and Z combinations: - * - * N Z - * - - - * 0 0 Positive non-zero number - * 0 1 Zero - * 1 0 Negative non-zero number - * 1 1 INVALID - * - * the fourth combination is an impossibility (the world of floating point numbers, with their NaNs, positive - * and negative zeros, infinities, etc, is another story, which doesn't concern us here). - * - * The problem is that some intervening NON-arithmetic instruction (eg, SEN or SEZ) could be executed that sets - * either N or Z independently, resulting in BOTH flags being set. - * - * One way to support that combination would be to define Z as the result of all non-sign bits. However, - * that means that, after any arithmetic operation, we would have to propagate the sign bit of the result to - * one or more other bits in flagsCZN; eg: - * - * flagsCZN = result | ((result & 0x8000) >> 1) - * or: - * flagsCZN = result | ((result & 0xffff)? 1 : 0) - * - * It's worth noting that all that extra work is actually required for only ONE 16-bit value: -32768 or 0x8000 - * (and ONE 8-bit value: -128 or 0x80), because all other negative numbers already have 1 or more lower bits set. - * - * A simpler approach would be to leave flagN independent, and only combine flagC and flagZ (into flagCZ). - * Alternatively, we could combine flagC and flagN and leave flagZ independent; the choice is arbitrary. -JP + * TODO: Verify the initial state of all PDP-11 flags (are they documented?) */ this.flagC = 0x10000; // PSW C bit this.flagV = 0x8000; // PSW V bit - this.flagZ = 0xffff; // ~ PSW Z bit + this.flagZ = 0xffff; // ~ PSW Z bit (TODO: Why is Z clear instead of set like all other flags?) this.flagN = 0x8000; // PSW N bit this.PSW = 0xf; // PSW other bits this.regsGen = [ // General R0 - R7 - 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, this.resetAddr ]; this.regsAlt = [ // Alternate R0 - R5 0, 0, 0, 0, 0, 0 @@ -212,7 +181,6 @@ CPUStatePDP11.prototype.initRegs = function() this.controlReg = [ // various control registers we don't really care about 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; - this.debugPC = -1; }; /** @@ -222,7 +190,6 @@ CPUStatePDP11.prototype.initRegs = function() */ CPUStatePDP11.prototype.resetRegs = function() { - this.setPC(this.resetAddr); this.stackLimit = 0xff; this.CPU_Error = 0; this.interruptQueue = []; @@ -292,12 +259,19 @@ CPUStatePDP11.prototype.setBinding = function(sHTMLType, sBinding, control, sVal { var fBound = false; switch (sBinding) { - case "PC": - case "PSW": + case "R0": + case "R1": + case "R2": + case "R3": + case "R4": + case "R5": + case "R6": + case "R7": case "NF": case "ZF": case "VF": case "CF": + case "PSW": this.bindings[sBinding] = control; this.cLiveRegs++; fBound = true; @@ -309,6 +283,34 @@ CPUStatePDP11.prototype.setBinding = function(sHTMLType, sBinding, control, sVal return fBound; }; +/** + * updateStatus(fForce) + * + * This provides periodic Control Panel updates (a few times per second; see YIELDS_PER_STATUS). + * this is where we take care of any DOM updates (eg, register values) while the CPU is running. + * + * @this {CPUStatePDP11} + * @param {boolean} [fForce] (true will display registers even if the CPU is running and "live" registers are not enabled) + */ +CPUStatePDP11.prototype.updateStatus = function(fForce) +{ + if (this.cLiveRegs) { + if (fForce || !this.flags.running || this.flags.displayLiveRegs) { + for (var i = 0; i < this.regsGen.length; i++) { + this.displayValue('R'+i, this.regsGen[i]); + } + var regPSW = this.getPSW(); + this.displayValue("PSW", regPSW); + this.displayValue("NF", (regPSW & PDP11.PSW.NF)? 1 : 0, 1); + this.displayValue("ZF", (regPSW & PDP11.PSW.ZF)? 1 : 0, 1); + this.displayValue("VF", (regPSW & PDP11.PSW.VF)? 1 : 0, 1); + this.displayValue("CF", (regPSW & PDP11.PSW.CF)? 1 : 0, 1); + } + } + var controlSpeed = this.bindings["speed"]; + if (controlSpeed) controlSpeed.textContent = this.getSpeedCurrent(); +}; + /** * clearCF() * @@ -316,7 +318,7 @@ CPUStatePDP11.prototype.setBinding = function(sHTMLType, sBinding, control, sVal */ CPUStatePDP11.prototype.clearCF = function() { - // this.resultZeroCarry &= 0xff; + this.flagC = 0; }; /** @@ -337,7 +339,7 @@ CPUStatePDP11.prototype.getCF = function() */ CPUStatePDP11.prototype.setCF = function() { - // this.resultZeroCarry |= 0x100; + this.flagC = 0x10000; }; /** @@ -347,7 +349,7 @@ CPUStatePDP11.prototype.setCF = function() */ CPUStatePDP11.prototype.clearVF = function() { - // this.resultZeroCarry |= 0xff; + this.flagV = 0; }; /** @@ -368,7 +370,7 @@ CPUStatePDP11.prototype.getVF = function() */ CPUStatePDP11.prototype.setVF = function() { - // this.resultZeroCarry &= ~0xff; + this.flagV = 0x8000; }; /** @@ -378,7 +380,7 @@ CPUStatePDP11.prototype.setVF = function() */ CPUStatePDP11.prototype.clearZF = function() { - // this.resultZeroCarry |= 0xff; + this.flagZ = 1; }; /** @@ -399,7 +401,7 @@ CPUStatePDP11.prototype.getZF = function() */ CPUStatePDP11.prototype.setZF = function() { - // this.resultZeroCarry &= ~0xff; + this.flagZ = 0; }; /** @@ -409,7 +411,7 @@ CPUStatePDP11.prototype.setZF = function() */ CPUStatePDP11.prototype.clearNF = function() { - // if (this.getNF()) this.resultParitySign ^= 0xc0; + this.flagN = 0; }; /** @@ -420,7 +422,7 @@ CPUStatePDP11.prototype.clearNF = function() */ CPUStatePDP11.prototype.getNF = function() { - return (this.flagN >> (15 - PDP11.PSW.NF_SHIFT)) & PDP11.PSW.NF; + return (this.flagN & 0x8000)? PDP11.PSW.NF : 0; }; /** @@ -430,7 +432,7 @@ CPUStatePDP11.prototype.getNF = function() */ CPUStatePDP11.prototype.setNF = function() { - // if (!this.getNF()) this.resultParitySign ^= 0xc0; + this.flagN = 0x8000; }; /** @@ -527,48 +529,6 @@ CPUStatePDP11.prototype.requestHALT = function() this.endBurst(); }; -/** - * updateReg(sReg, nValue, cch) - * - * This function helps updateStatus() by massaging the register names and values according to - * CPU type before passing the call to displayValue(); in the "old days", updateStatus() called - * displayValue() directly (although then it was called displayReg()). - * - * @this {CPUStatePDP11} - * @param {string} sReg - * @param {number} nValue - * @param {number} [cch] (default is 4 hex digits) - */ -CPUStatePDP11.prototype.updateReg = function(sReg, nValue, cch) -{ - this.displayValue(sReg, nValue, cch || 4); -}; - -/** - * updateStatus(fForce) - * - * This provides periodic Control Panel updates (eg, a few times per second; see YIELDS_PER_STATUS). - * this is where we take care of any DOM updates (eg, register values) while the CPU is running. - * - * @this {CPUStatePDP11} - * @param {boolean} [fForce] (true will display registers even if the CPU is running and "live" registers are not enabled) - */ -CPUStatePDP11.prototype.updateStatus = function(fForce) -{ - if (this.cLiveRegs) { - if (fForce || !this.flags.running || this.flags.displayLiveRegs) { - var regPSW = this.getPSW(); - this.updateReg("PSW", regPSW, 4); - this.updateReg("NF", (regPSW & PDP11.PSW.NF)? 1 : 0, 1); - this.updateReg("ZF", (regPSW & PDP11.PSW.ZF)? 1 : 0, 1); - this.updateReg("VF", (regPSW & PDP11.PSW.VF)? 1 : 0, 1); - this.updateReg("CF", (regPSW & PDP11.PSW.CF)? 1 : 0, 1); - } - } - var controlSpeed = this.bindings["speed"]; - if (controlSpeed) controlSpeed.textContent = this.getSpeedCurrent(); -}; - /** * interrupt(delay, priority, vector, callback) * @@ -931,7 +891,7 @@ CPUStatePDP11.prototype.readWordByAddr = function(physicalAddress) return this.bus.access_iopage(physicalAddress, -1, 0); } else { if (physicalAddress >= 0) { - return this.memory[physicalAddress >> 1]; + return this.bus.getShort(physicalAddress); } } } @@ -952,13 +912,14 @@ CPUStatePDP11.prototype.writeWordByAddr = function(physicalAddress, data) if (physicalAddress >= PDP11.MAX_ADDRESS) { return (this.regsGen[physicalAddress - PDP11.MAX_ADDRESS] = data); } else { - if (physicalAddress >= PDP11.IOBASE_UNIBUS) { - return this.bus.access_iopage(physicalAddress, data, 0); - } else { + // if (physicalAddress >= PDP11.IOBASE_UNIBUS) { + // return this.bus.access_iopage(physicalAddress, data, 0); + // } else { if (physicalAddress >= 0) { - return (this.memory[physicalAddress >> 1] = data); + this.bus.setShort(physicalAddress, data); + return data; } - } + // } } return physicalAddress; }; @@ -980,11 +941,7 @@ CPUStatePDP11.prototype.readByteByAddr = function(physicalAddress) return this.bus.access_iopage(physicalAddress, -1, 1); } else { if (physicalAddress >= 0) { - result = this.memory[physicalAddress >> 1]; - if (physicalAddress & 1) { - result = result >> 8; - } - return (result & 0xff); + return this.bus.getByte(physicalAddress); } } } @@ -1009,11 +966,8 @@ CPUStatePDP11.prototype.writeByteByAddr = function(physicalAddress, data) return this.bus.access_iopage(physicalAddress, data, 1); } else { if (physicalAddress >= 0) { - if (physicalAddress & 1) { - return (this.memory[physicalAddress >> 1] = (data << 8) | (this.memory[physicalAddress >> 1] & 0xff)); - } else { - return (this.memory[physicalAddress >> 1] = (this.memory[physicalAddress >> 1] & 0xff00) | data); - } + this.bus.setByte(physicalAddress, data); + return data; } } } @@ -1404,11 +1358,6 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles) } } } - //if (this.regsGen[7] === this.debugPC) { - //LOG_PRINT(); - // - //} - // Initialize this.memory before getting an instruction if (!(this.MMR0 & 0xe000)) { this.MMR1 = 0; this.MMR2 = this.regsGen[7]; @@ -2332,19 +2281,17 @@ CPUStatePDP11.prototype.stepCPU = function(nMinCycles) break; case 0xA0: /*0000240*/ // CLR CC 00024M Part 1 without N case 0xA8: /*0000250*/ // CLR CC 00025M Part 2 with N - //LOG_INSTRUCTION(instruction, 10, "CLR CC"); - if (instruction & 1) this.flagC = 0; // CLC - if (instruction & 2) this.flagV = 0; // CLV - if (instruction & 4) this.flagZ = 1; // CLZ - if (instruction & 8) this.flagN = 0; // CLN + if (instruction & 1) this.clearCF(); // CLC + if (instruction & 2) this.clearVF(); // CLV + if (instruction & 4) this.clearZF(); // CLZ + if (instruction & 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 - //LOG_INSTRUCTION(instruction, 10, "SET CC"); - if (instruction & 1) this.flagC = 0x10000; // SEC - if (instruction & 2) this.flagV = 0x8000; // SEV - if (instruction & 4) this.flagZ = 0; // SEZ - if (instruction & 8) this.flagN = 0x8000; // SEN + if (instruction & 1) this.setCF(); // SEC + if (instruction & 2) this.setVF(); // SEV + if (instruction & 4) this.setZF(); // SEZ + if (instruction & 8) this.setNF(); // SEN break; default: // Misc instructions (decode ALL remaining bits) xxxxxx switch (instruction) { diff --git a/modules/pdp11/lib/defines.js b/modules/pdp11/lib/defines.js index c4b0de4b6..772a79831 100644 --- a/modules/pdp11/lib/defines.js +++ b/modules/pdp11/lib/defines.js @@ -150,9 +150,9 @@ var PDP11 = { PRI_SHIFT: 5, UNUSED: 0x0700, // bits 8-10: unused REGSET: 0x0800, // bit 11: Register Set - PMODE: 0x3000, // bits 12-13: Previous Mode (see PDP11.MODE) + PMODE: 0x3000, // bits 12-13: Prev Mode (see PDP11.MODE) PMODE_SHIFT:12, - CMODE: 0xC000, // bits 14-15: Current Mode (see PDP11.MODE) + CMODE: 0xC000, // bits 14-15: Curr Mode (see PDP11.MODE) CMODE_SHIFT:14 }, /* diff --git a/modules/pdp11/lib/memory.js b/modules/pdp11/lib/memory.js index 1ebc94fbb..b1dba574c 100644 --- a/modules/pdp11/lib/memory.js +++ b/modules/pdp11/lib/memory.js @@ -57,7 +57,7 @@ var littleEndian = (TYPEDARRAYS? (function() { })() : false); /** - * MemoryPDP11(addr, used, size, type) + * MemoryPDP11(addr, used, size, type, controller) * * The Bus component allocates MemoryPDP11 objects so that each has a memory buffer with a * block-granular starting address and an address range equal to bus.nBlockSize; however, @@ -94,8 +94,9 @@ var littleEndian = (TYPEDARRAYS? (function() { * @param {number} [used] portion of block in bytes (0 for none); must be a multiple of 4 * @param {number} [size] of block's buffer in bytes (0 for none); must be a multiple of 4 * @param {number} [type] is one of the MemoryPDP11.TYPE constants (default is MemoryPDP11.TYPE.NONE) + * @param {Object} [controller] is an optional memory controller component */ -function MemoryPDP11(addr, used, size, type) +function MemoryPDP11(addr, used, size, type, controller) { var i; this.id = (MemoryPDP11.idBlock += 2); @@ -106,6 +107,7 @@ function MemoryPDP11(addr, used, size, type) this.size = size || 0; this.type = type || MemoryPDP11.TYPE.NONE; this.fReadOnly = (type == MemoryPDP11.TYPE.ROM); + this.controller = null; this.copyBreakpoints(); // initialize the block's Debugger info; the caller will reinitialize /* @@ -129,6 +131,19 @@ function MemoryPDP11(addr, used, size, type) return; } + /* + * When a controller is specified, the controller must provide a buffer, + * via getMemoryBuffer(), and memory access functions, via getMemoryAccess(). + */ + if (controller) { + this.controller = controller; + var a = controller.getMemoryBuffer(addr); + this.adw = a[0]; + this.offset = a[1]; + this.setAccess(controller.getMemoryAccess()); + return; + } + /* * This is the normal case: allocate a buffer that provides 8 bits of data per address; * no controller is required because our default memory access functions (see afnMemory) @@ -285,7 +300,10 @@ MemoryPDP11.prototype = { */ save: function() { var adw, i; - if (BYTEARRAYS) { + if (this.controller) { + adw = null; + } + else if (BYTEARRAYS) { adw = new Array(this.size >> 2); var off = 0; for (i = 0; i < adw.length; i++) { @@ -327,6 +345,9 @@ MemoryPDP11.prototype = { * @return {boolean} true if successful, false if block size mismatch */ restore: function(adw) { + if (this.controller) { + return (adw == null); + } /* * At this point, it's a consistency error for adw to be null; it's happened once already, * when there was a restore bug in the Video component that added the frame buffer at the video @@ -809,18 +830,45 @@ MemoryPDP11.prototype = { /* * This is the effective definition of afnNone, but we need not fully define it, because setAccess() - * uses these defaults when any of the 6 handlers (ie, 3 read handlers and 3 write handlers) are undefined. + * uses these defaults when any of the 4 handlers (ie, 2 read handlers and 2 write handlers) are undefined. * -MemoryPDP11.afnNone = [MemoryPDP11.prototype.readNone, MemoryPDP11.prototype.readShortDefault, MemoryPDP11.prototype.writeNone, MemoryPDP11.prototype.writeShortDefault]; +MemoryPDP11.afnNone = [ + MemoryPDP11.prototype.readNone, + MemoryPDP11.prototype.readShortDefault, + MemoryPDP11.prototype.writeNone, + MemoryPDP11.prototype.writeShortDefault +]; */ +MemoryPDP11.afnNone = []; -MemoryPDP11.afnNone = []; -MemoryPDP11.afnMemory = [MemoryPDP11.prototype.readByteMemory, MemoryPDP11.prototype.readShortMemory, MemoryPDP11.prototype.writeByteMemory, MemoryPDP11.prototype.writeShortMemory]; -MemoryPDP11.afnChecked = [MemoryPDP11.prototype.readByteChecked, MemoryPDP11.prototype.readShortChecked, MemoryPDP11.prototype.writeByteChecked, MemoryPDP11.prototype.writeShortChecked]; +MemoryPDP11.afnMemory = [ + MemoryPDP11.prototype.readByteMemory, + MemoryPDP11.prototype.readShortMemory, + MemoryPDP11.prototype.writeByteMemory, + MemoryPDP11.prototype.writeShortMemory +]; + +MemoryPDP11.afnChecked = [ + MemoryPDP11.prototype.readByteChecked, + MemoryPDP11.prototype.readShortChecked, + MemoryPDP11.prototype.writeByteChecked, + MemoryPDP11.prototype.writeShortChecked +]; if (TYPEDARRAYS) { - MemoryPDP11.afnArrayBE = [MemoryPDP11.prototype.readByteBE, MemoryPDP11.prototype.readShortBE, MemoryPDP11.prototype.writeByteBE, MemoryPDP11.prototype.writeShortBE]; - MemoryPDP11.afnArrayLE = [MemoryPDP11.prototype.readByteLE, MemoryPDP11.prototype.readShortLE, MemoryPDP11.prototype.writeByteLE, MemoryPDP11.prototype.writeShortLE]; + MemoryPDP11.afnArrayBE = [ + MemoryPDP11.prototype.readByteBE, + MemoryPDP11.prototype.readShortBE, + MemoryPDP11.prototype.writeByteBE, + MemoryPDP11.prototype.writeShortBE + ]; + + MemoryPDP11.afnArrayLE = [ + MemoryPDP11.prototype.readByteLE, + MemoryPDP11.prototype.readShortLE, + MemoryPDP11.prototype.writeByteLE, + MemoryPDP11.prototype.writeShortLE + ]; } if (NODE) module.exports = MemoryPDP11; diff --git a/modules/pdp11/lib/rom.js b/modules/pdp11/lib/rom.js index 0d34fd90c..be9486101 100644 --- a/modules/pdp11/lib/rom.js +++ b/modules/pdp11/lib/rom.js @@ -60,12 +60,9 @@ if (NODE) { * is the ROM you expected. * * Finally, while making ROM "writable" may seem a contradiction in terms, I want to be able to load selected - * CP/M binary files into memory purely for testing purposes, and the RAM component has no "file" option, so the + * binary files into memory purely for testing purposes, and the RAM component has no "file" option, so the * simplest solution was to add the option to load binary files into memory as "writable" ROMs. * - * Moreover, if a "writable" ROM is installed at addr 0x100, that triggers our "Fake CP/M" support, providing - * a quick-and-dirty means of loading simple CP/M test binaries. See addROM() for details. - * * @constructor * @extends Component * @param {Object} parmsROM diff --git a/versions/pc8080/1.30.0/pc8080-dbg.js b/versions/pc8080/1.30.0/pc8080-dbg.js index d67b373e2..36597fd35 100644 --- a/versions/pc8080/1.30.0/pc8080-dbg.js +++ b/versions/pc8080/1.30.0/pc8080-dbg.js @@ -12,7 +12,7 @@ function ya(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}re function Ca(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Da={init:[],show:[],exit:[]},Ea=!1,Fa=!1,Ka=!0;function La(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ma(a){Da.init.push(a)} function Na(a){if(Ka)try{for(var b=0;bb?this.cb=this.id:(this.Bb=this.id.substr(0,b),this.cb=this.id.substr(b+1));this[a]=c;this.C={ready:!1,eb:!1,Kb:!1,xa:!1,error:!1};this.Eb=null;this.C.error=!1;this.N={};this.H=null;this.ta=d||0;Ra.push(this)}var Sa=void 0,Va={}; -if(window){Sa||(Sa=window.location.search.substr(1));for(var Wa,Xa=/\+/g,$a=/([^&=]+)=?([^&]*)/g;Wa=$a.exec(Sa);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function ab(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} +if(window){Sa||(Sa=window.location.search.substr(1));for(var Wa,Xa=/\+/g,Ya=/([^&=]+)=?([^&]*)/g;Wa=Ya.exec(Sa);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function ab(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 bb(a,b){b||(b=z);a.prototype=ab(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var cb=window.PCjs.Machines||(window.PCjs.Machines={}),Ra=window.PCjs.Components||(window.PCjs.Components=[])}else cb={},Ra=[];function db(a,b,c){cb[a]&&b&&(cb[a][b]=c)}function Oa(a,b,c){b||w((c?c+": ":"")+a)} function eb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b=a.O&&(a.O+=a.hb,c=!0);0<=a.ib&&a.ib<=Fc(a)&&(a.hb=a.ib=-1,pc(a),a.pa(),c=!0);c&&a.g(Fc(a)+" cycles: checksum="+t(a.tb))}} +function pc(a){void 0===a.ub&&(a.ub=0);void 0===a.hb&&(a.hb=-1);void 0===a.ib&&(a.ib=-1);a.C.fb=0<=a.ub&&0=a.O&&(a.O+=a.hb,c=!0);0<=a.ib&&a.ib<=Fc(a)&&(a.hb=a.ib=-1,pc(a),a.pa(),c=!0);c&&a.g(Fc(a)+" cycles: checksum="+t(a.tb))}} l.oa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.N[b]=c;a=!0;break;case "run":this.N[b]=c;c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.C.xa)a=!0;else{var b=null,c,g=eb(a.id);for(c=0;ca.K/a.ab?b=1:d=!0;a.Ra=b;b=a.ha*a.Ra;if(a.ab!=b){a.ab=b;b=a.ab.toFixed(2)+"Mhz";var e=a.N.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.B&&a.B.xb()}Hc(a,a.G);a.G=0;a.D=pa();a.J=0;Ic(a);return d}function Jc(a,b){var c=a.w.length;a.w.push([-1,b]);return c}function Kc(a,b,c){var d=-1;0<=b&&b=this.Y&&Ic(this,!0);this.ba=0;this.ea=pa();this.J&&(a=this.ea-this.J,a>this.wa&&(this.D+=a,this.D>this.ea&&(this.D=this.ea)));try{do{for(var c=this.C.fb?1:this.fa,d=this.w.length-1;0<=d;d--){var e=this.w[d];0>e[0]||c>e[0]&&(c=e[0])}this.kb(c);var f=this.L-this.b;a= -f;for(var h=this.w.length-1;0<=h;h--){var g=this.w[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ba+=f;this.G+=f;Hc(this,0,!0);sc(this,f);this.P-=f;if(0>=this.P){this.P+=this.fa;15<=++this.za&&(this.B&&this.B.Ja(),this.za=0);break}}while(this.C.Aa)}catch(k){this.pa();rc(this);this.B&&this.B.stop(pa(),Fc(this));lb(this,!1);ob(this,k.stack||k.message);return}c=setTimeout;d=this.Fa;this.J=pa();e=this.wa;this.ba&&(e=Math.round(e*this.ba/this.fa));e=e-(this.J-this.ea);if(f=this.J-this.D)this.K=Math.round(this.G/ +f;for(var h=this.w.length-1;0<=h;h--){var g=this.w[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ba+=f;this.G+=f;Hc(this,0,!0);Ec(this,f);this.P-=f;if(0>=this.P){this.P+=this.fa;15<=++this.za&&(this.B&&this.B.Ja(),this.za=0);break}}while(this.C.Aa)}catch(k){this.pa();rc(this);this.B&&this.B.stop(pa(),Fc(this));lb(this,!1);ob(this,k.stack||k.message);return}c=setTimeout;d=this.Fa;this.J=pa();e=this.wa;this.ba&&(e=Math.round(e*this.ba/this.fa));e=e-(this.J-this.ea);if(f=this.J-this.D)this.K=Math.round(this.G/ (10*f))/100,864E5<=f&&(this.M=0,Gc(this));if(0>e||this.Ke&&(this.D-=e),e=0;this.ia+=this.ba;this.J+=e;c(d,e)}else rc(this),this.B&&this.B.stop(pa(),Fc(this))};l.kb=function(){return 0};l.pa=function(a){mb(this,!0);Lc(this);Hc(this,this.G);this.G=0;if(this.C.Aa){this.C.Aa=!1;this.I&&this.I.stop();var b=this.N.run;b&&(b.textContent="Run")}this.C.complete=a};function rc(a,b){if(a.B){for(var c=a.B,d=0;d>=1;d=p+d;f>>=8}f=c;h=0;g="";h?11>=3;d=t(c,0,!0)+" "+c+". "+("0o"+g)+" "+("0b"+d)}a.g((null!=b?b+": ":"")+d);return e} -function Fe(a,b){if(b)return Ee(a,b,a.ea[b]);var c=0;for(b in a.ea)Ee(a,b,a.ea[b]),c++;return 0Ha.length&&(a.g("note: only "+Ha.length+" available"),ia=Ha.length);da-=ia;0>da&&(null==Ha[Ha.length-1].F?(ia=da+ia,da=0):da+=Ha.length);var pd=[];"call"==af&&(qb=1E5,pd=["CALL"]);for(void 0!==$e&&a.g(ia+" instructions earlier:");0< -qb&&da!=a.fa;){var df=Ha[da++];if(null==df.F)break;var Lb=W(df.F),jg=ia--,ef=Ff(a,Lb,"history",jg);(!pd.length||0<=ef.indexOf(pd[0]))&&a.g(ef);Lb.Lb&&(da+=Lb.Lb,qb-=Lb.Lb,ia-=Lb.Lb);da>=Ha.length&&(da=0);a.Wa=ia;cf++;qb--}}cf||(a.g("no "+bf+"history available"),a.Wa=void 0)}else{var tc=Re(a,Z);if(tc){var uc=0;va&&("l"==va.charAt(0)&&(va=va.substr(1)||Hb),uc=De(a,va)>>>0,65536>4||1;kg--&&0yc?String.fromCharCode(yc):".";wc--}Ya&&(Ya+="\n");Ya+=Z+" "+Nb+(0==Mb?" "+rd:"")}Ya&&a.g(Ya);a.Ua=tc}}}}break;case "e":if("else"==f[0])break;var zc=1,ff=255,gf=a.aa,hf=a.va;"ew"==f[0]&&(zc=2,ff=65535,gf=a.$a,hf=a.Ib);var jf=zc<<1,kf=f[1];if(null==kf)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a"); -else{var Ac=Re(a,kf);if(Ac)for(var Bc=2;Bcyd;){for(var Za=null,qg=256;65536>Qb.F>>>0;){mf.F=a.$a(Qb,2);if(null==Qb.F||!qg--)break;for(var rg=a,Dc=mf,nf= -null,Rb=Dc.F,of=Rb,zd=1;6>=zd&&Rb;zd++){if(2=Ha.length&&(da=0);a.Wa=ia;cf++;qb--}}cf||(a.g("no "+bf+"history available"),a.Wa=void 0)}else{var sc=Re(a,Z);if(sc){var tc=0;va&&("l"==va.charAt(0)&&(va=va.substr(1)||Hb),tc=De(a,va)>>>0,65536>4||1;kg--&&0xc?String.fromCharCode(xc):".";vc--}Za&&(Za+="\n");Za+=Z+" "+Nb+(0==Mb?" "+rd:"")}Za&&a.g(Za);a.Ua=sc}}}}break;case "e":if("else"==f[0])break;var yc=1,ff=255,gf=a.aa,hf=a.va;"ew"==f[0]&&(yc=2,ff=65535,gf=a.$a,hf=a.Ib);var jf=yc<<1,kf=f[1];if(null==kf)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a"); +else{var zc=Re(a,kf);if(zc)for(var Ac=2;Acyd;){for(var $a=null,qg=256;65536>Qb.F>>>0;){mf.F=a.$a(Qb,2);if(null==Qb.F||!qg--)break;for(var rg=a,Cc=mf,nf= +null,Rb=Cc.F,of=Rb,zd=1;6>=zd&&Rb;zd++){if(2b?1:a>1,g;g=d(b,a[h]);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 xa(a,b,d,c){var e=0,f=null,h=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)}),h;var g=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");d&&(g.onreadystatechange=function(){4===g.readyState&&(f=g.responseText,200==g.status||!g.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=g.status||-1),c&&c(a,f,e))});if(b&&"object"== typeof b){var k="",l;for(l in b)b.hasOwnProperty(l)&&(k&&(k+="&"),k+=l+"="+encodeURIComponent(b[l]));k=k.replace(/%20/g,"+");g.open("POST",a,!!d);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!d),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();d||(f=g.responseText,200!=g.status&&(e=g.status||-1),c&&c(a,f,e),h=[f,e]);return h}function ma(){return"http://"+(window?window.location.host:"www.pcjs.org")} -function t(a){window&&window.alert(a)}function ya(a){var b=!1;window&&(b=window.confirm(a));return b}var za=null;function Aa(){if(null==za){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}za=a}return za}function Ga(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(d){}return b} +function t(a){window&&window.alert(a)}function ya(a){var b=!1;window&&(b=window.confirm(a));return b}var za=null;function Aa(){if(null==za){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}za=a}return za}function Ba(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(d){}return b} function Ha(a,b){try{return window.localStorage.setItem(a,b),!0}catch(d){}return!1}function Ia(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 Ja(a,b,d){function c(){--a;0<=a&&(b()||(a=0));0b?this.Ma=this.id:(this.lb=this.id.substr(0,b),this.Ma=this.id.substr(b+1));this[a]=d;this.A={ready:!1,Ga:!1,$a:!1,Z:!1,error:!1};this.Xa=null;this.A.error=!1;this.L={};this.I=null;this.$=c||0;x.push(this)}var Ua=void 0,Va={}; +function u(a,b,d,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.qb=b.comment;this.Jb=b;b=this.id.indexOf(".");0>b?this.cb=this.id:(this.rb=this.id.substr(0,b),this.cb=this.id.substr(b+1));this[a]=d;this.A={ready:!1,Ga:!1,eb:!1,$:!1,error:!1};this.$a=null;this.A.error=!1;this.K={};this.I=null;this.aa=c||0;x.push(this)}var Ua=void 0,Va={}; if(window){Ua||(Ua=window.location.search.substr(1));for(var Wa,Xa=/\+/g,Ya=/([^&=]+)=?([^&]*)/g;Wa=Ya.exec(Ua);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function Za(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var d=typeof a;if("object"!==d&&"function"!==d)throw new TypeError;}b.prototype=a;return new b} function y(a,b){b||(b=u);a.prototype=Za(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var $a=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else $a={},x=[];function ab(a,b,d){$a[a]&&b&&($a[a][b]=d)}function bb(a){var b,d=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b=this.B?10:20>=this.B?12:24>=this.B?14:15;this.ma=1<>2;this.H=this.ma-1;this.F=this.G/this.ma|0;this.K=this.F-1;a=new G;xb(a,this.I);this.P=Array(this.F);for(b=0;b>>a.ba;0f&&(l=f);if(g&&g.size){if(g.type==c){if(e+f<=g.D)return g.Va+=g.D-e,g.D=e,!0;if(e>=g.D+g.Va){l=g.size-(e-k);l>f&&(l=f);g.Va=e-g.D+l;e=k+a.ma;f-=l;h++;continue}}return zb(1,e,f)}e=new G(e,l,a.ma,c);xb(e,a.I,g);a.P[h++]=e;e=k+a.ma;f-=l}return 0>=f?(a.status(Math.floor(d/1024)+"Kb "+Ab[c]+" at "+r(b,8,!0)),!0):zb(2,b,d)} -function Bb(a,b){var d=b&a.H,c=(b&a.w)>>>a.ba;return d!=a.H?a.P[c].ub(d,b):a.P[c++].Ta(d,b)|a.P[c&a.K].Ta(0,b+1)<<8}function zb(a,b,d){t("Memory block error ("+a+": "+r(b)+","+r(d)+")");return!1}var Cb;if(tb){var Ob=new ArrayBuffer(2);(new DataView(Ob)).setUint16(0,256,!0);Cb=256===(new Uint16Array(Ob))[0]}else Cb=!1;var Pb=Cb; -function G(a,b,d,c){this.id=Qb+=2;this.f=null;this.D=a;this.Va=b;this.size=d||0;this.type=c||Rb;this.J=c==Sb;xb(this);this.va=this.Bb=!1;if(d)if(tb)this.F=new ArrayBuffer(d),this.G=new DataView(this.F,0,d),this.H=new Uint8Array(this.F,0,d),this.N=new Uint16Array(this.F,0,d>>1),this.f=new Int32Array(this.F,0,d>>2),Tb(this,Pb?Ub:Vb);else{this.f=Array(d>>2);for(a=0;a>2),b=0;b>8,d)},U:function(a){return this.f[a>>2]>>>((a&3)<<3)&255},da:function(a){var b=a>>2;a=(a&3)<<3;var d=this.f[b]>>a;return 24>a?d&65535:d&255|(this.f[b+1]&255)<<8},ka:function(a,b){var d=a>>2,c=(a&3)<<3;this.f[d]=this.f[d]&~(255<>2,c=(a&3)<<3;24>c?this.f[d]=this.f[d]&~(65535<>8);this.va=!0},S:function(a,b){if(this.I&&null!=this.D){var d=this.I;$b(d,this.D+a,1,d.R)&&d.ca(!0)}return this.Ta(a,b)},W:function(a,b){if(this.I&&null!=this.D){var d=this.I;$b(d,this.D+a,2,d.R)&&d.ca(!0)}return this.ub(a,b)},ga:function(a,b,d){if(this.I&&null!=this.D){var c=this.I;$b(c,this.D+a,1,c.J)&&c.ca(!0)}this.J?this.B(a,b,d):this.La(a,b,d)},na:function(a, -b,d){if(this.I&&null!=this.D){var c=this.I;$b(c,this.D+a,2,c.J)&&c.ca(!0)}this.J?this.B(a,b,d):this.wb(a,b,d)},R:function(a){return this.H[a]},T:function(a){return this.H[a]},V:function(a){return this.G.getUint16(a,!0)},Y:function(a){return a&1?this.H[a]|this.H[a+1]<<8:this.N[a>>1]},fa:function(a,b){this.H[a]=b;this.va=!0},ja:function(a,b){this.H[a]=b;this.va=!0},la:function(a,b){this.G.setUint16(a,b,!0);this.va=!0},Ma:function(a,b){a&1?(this.H[a]=b,this.H[a+1]=b>>8):this.N[a>>1]=b;this.va=!0}}; -function xb(a,b,d){a.I=b;a.L=a.w=0;d&&((a.L=d.L)&&Zb(a,Yb,!1),(a.w=d.w)&&Xb(a,Yb,!1))}function ac(a,b){b?0===--a.w&&(a.M=a.J?a.B:a.La):0===--a.L&&(a.K=a.Ta)}function Xb(a,b,d){d&&a.w||(a.M=!a.J&&b[2]||a.B);if(d||void 0===d)a.La=b[2]||a.B,a.wb=b[3]||a.pa}function Zb(a,b,d){d&&a.L||(a.K=b[0]||a.O);if(d||void 0===d)a.Ta=b[0]||a.O,a.ub=b[1]||a.X}function Tb(a,b){b||(b=bc);Zb(a,b,void 0);Xb(a,b,void 0)} -var bc=[],Wb=[G.prototype.U,G.prototype.da,G.prototype.ka,G.prototype.ua],Yb=[G.prototype.S,G.prototype.W,G.prototype.ga,G.prototype.na];if(tb)var Vb=[G.prototype.R,G.prototype.V,G.prototype.fa,G.prototype.la],Ub=[G.prototype.T,G.prototype.Y,G.prototype.ja,G.prototype.Ma]; -function cc(a,b){u.call(this,"CPU",a,cc,1);var d=a.multiplier||1;this.Fa=a.cycles||b;this.Aa=d;this.ua=Math.round(this.Fa/1E4)/100;this.za=this.ua*this.Aa;this.A.aa=!1;this.A.cb=!1;this.A.Na=a.autoStart;this.A.ib=!1;this.A.Ha=!1;this.Qa=this.X=0;this.Ra=a.csStart;this.Ia=a.csInterval;this.Ja=a.csStop;this.ja=[];this.Db=this.Ca.bind(this);E(this)}y(cc);var dc=["power","reset"];m=cc.prototype; -m.ya=function(a,b,d,c){this.w=a;this.H=b;this.I=c;for(b=0;b=a.X&&(a.X+=a.Ia,d=!0);0<=a.Ja&&a.Ja<=jc(a)&&(a.Ia=a.Ja=-1,gc(a),a.ca(),d=!0);d&&a.g(jc(a)+" cycles: checksum="+r(a.Qa))}} -function kc(a,b,d,c){a.L[b]&&(void 0===d&&(sb(a,"Value for "+b+" is invalid"),a.ca()),d=!a.A.aa||a.A.ib?r(d,c):"--------".substr(0,c),a.L[b].textContent!=d&&(a.L[b].textContent=d))} -m.ha=function(a,b,d){var c=this;a=!1;switch(b){case "power":case "reset":this.L[b]=d;a=!0;break;case "run":this.L[b]=d;d.onclick=function(){var a;if(a=c.w)if(a=c.w,a.A.Z)a=!0;else{var b=null,d,g=bb(a.id);for(d=0;da.R/a.za?b=1:c=!0;a.Aa=b;b=a.ua*a.Aa;if(a.za!=b){a.za=b;b=a.za.toFixed(2)+"Mhz";var e=a.L.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}d&&a.w&&a.w.Ua()}mc(a,a.N);a.N=0;a.M=va();a.S=0;nc(a);return c}function Ac(a){a.T-=a.O;a.O=0} -m.Ca=function(a){if(pb(this,!0)){if(!this.A.aa){lc(this);this.w&&this.w.start(this.M,jc(this));this.A.aa=!0;this.A.cb=!0;this.fa&&this.fa.start();var b=this.L.run;b&&(b.textContent="Halt");this.w&&(this.w.ia(!0),a&&this.w.Ua(!0))}this.Oa>=this.Fa&&nc(this,!0);this.ga=0;this.la=va();this.S&&(a=this.la-this.S,a>this.qb&&(this.M+=a,this.M>this.la&&(this.M=this.la)));try{do{for(var d=this.A.Ha?1:this.na,c=this.ja.length-1;0<=c;c--){var e=this.ja[c];0>e[0]||d>e[0]&&(d=e[0])}this.Ka(d);var f=this.T-this.O; -a=f;for(var h=this.ja.length-1;0<=h;h--){var g=this.ja[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ga+=f;this.N+=f;mc(this,0,!0);ic(this,f);this.Y-=f;if(0>=this.Y){this.Y+=this.na;15<=++this.rb&&(this.w&&this.w.ia(),this.rb=0);break}}while(this.A.aa)}catch(k){this.ca();H(this);this.w&&this.w.stop(va(),jc(this));pb(this,!1);sb(this,k.stack||k.message);return}d=setTimeout;c=this.Db;this.S=va();e=this.qb;this.ga&&(e=Math.round(e*this.ga/this.na));e=e-(this.S-this.la);if(f=this.S-this.M)this.R= -Math.round(this.N/(10*f))/100,864E5<=f&&(this.U=0,lc(this));if(0>e||this.Re&&(this.M-=e),e=0;this.Oa+=this.ga;this.S+=e;d(c,e)}else H(this),this.w&&this.w.stop(va(),jc(this))};m.Ka=function(){return 0};m.ca=function(a){qb(this,!0);Ac(this);mc(this,this.N);this.N=0;if(this.A.aa){this.A.aa=!1;this.fa&&this.fa.stop();var b=this.L.run;b&&(b.textContent="Run")}this.A.complete=a};function H(a,b){a.w&&a.w.ia(b)} -function Bc(a){this.tb=+a.model||1170;this.Fb=a.resetAddr||0;cc.call(this,a,1E6);this.Wa=0;this.C=65536;this.j=32768;this.u=65535;this.i=32768;this.f=15;this.b=[0,0,0,0,0,0,0,0];this.Ya=[0,0,0,0,0,0];this.Ba=[0,0,0,0];this.memory=[];this.G=[];this.Pa=this.sb=0;this.V=2;this.W=255;this.F=0;this.da=-1;this.pb=this.Da=this.ob=this.B=this.pa=this.K=this.J=0;this.ka=[7,7,7,7];this.Ea=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.Hb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.A.complete=this.A.Ab=!1}y(Bc,cc);m=Bc.prototype;m.reset=function(){this.A.aa&&this.ca();Cc(this);fc(this);this.A.error=!1;this.parent.reset.call(this)}; -function Cc(a){a.b[7]=a.Fb;a.W=255;a.G=[];a.sb=0;a.J=a.K=a.pa=a.ob=0;a.ka[0]=a.ka[1]=a.ka[3]=7;a.Da=0}m.mb=function(){return 0};m.save=function(){var a=new I(this);J(a,0,[]);J(a,1,[this.nb,this.U,this.Aa]);for(var b=this.H,d=0,c=[],e=0;e>12&8|(a.u&65535?0:4)|(a.j&32768?2:0)|(a.C&65536?1:0)} -m.ia=function(a){this.Wa&&(a||!this.A.aa||this.A.ib)&&(a=Dc(this),kc(this,"PSW",a,4),kc(this,"NF",a&8?1:0,1),kc(this,"ZF",a&4?1:0,1),kc(this,"VF",a&2?1:0,1),kc(this,"CF",a&1?1:0,1));if(a=this.L.speed)a.textContent=this.A.aa&&this.R?this.R.toFixed(2)+"Mhz":"Stopped"};function Ec(a,b){a.i=b<<12;a.u=~b&4;a.j=b<<14;a.C=b<<16;if((b^a.f)&2048)for(var d=a.Ya.length;0<=--d;){var c=a.b[d];a.b[d]=a.Ya[d];a.Ya[d]=c}a.B=b>>14&3;d=a.f>>14&3;a.B!=d&&(a.Ba[d]=a.b[6],a.b[6]=a.Ba[a.B]);a.V=2;a.f=b} -function K(a,b){var d,c,e=0;0>a.da?a.da=a.f=a.f&63728|a.i>>12&8|(a.u&65535?0:4)|(a.j&32768?2:0)|(a.C&65536?1:0):a.B||(b=4,e=1);a.J&57344||(a.K=63222);a.B=0;0<=(d=L(a,b|65536))&&0<=(c=L(a,b+2&65535|65536))&&(Ec(a,c&53247|a.da>>2&12288),e&&(a.b[6]=4),0<=Fc(a,a.da)&&0<=Fc(a,a.b[7])&&(a.b[7]=d));a.F=0;return a.da=-1} -function Gc(a,b,d){var c,e,f,h=0;if(d&a.ob){c=b>>13&a.ka[a.B];e=a.Ea[a.B][c];f=(a.Ea[a.B][c+16]<<6)+(b&8191)&4194303;if(a.pa&16){if(3932160<=f&&4186112>f){f=f&262143;var g=f>>13&31;31>g?a.pa&32&&(f=a.Hb[g]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}}else f&=262143,253952<=f&&(f|=4186112);if(3932160>f&&(3915776<=f||f&1&&!(d&1)))return K(a,4);switch(e&7){case 1:h=4096;case 2:e|=128;d&4&&(h=8192);break;case 4:h=4096;case 5:d&4&&(h=4096);case 6:e|=d&4?192:128;break; -default:h=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(h|=16384):(b&8128)>(e>>2&8128)&&(h|=16384));a.Ea[a.B][c]=e;if(4194170!==f||a.B)a.Da=a.B,a.pb=c;if(h){if(h&57344)return 0<=a.da&&(h|=128),a.J&57344||(a.J=a.J|h|a.Da<<5|a.pb<<1),K(a,168);a.J&61440||!(4191360>f||4194239>1]:b} -function O(a,b,d){d&=65535;return 4194304<=b?a.b[b-4194304]=d:3932160<=b?-1:0<=b?a.memory[b>>1]=d:b}function P(a,b){var d;return 4194304<=b?a.b[b-4194304]&255:3932160<=b?-1:0<=b?(d=a.memory[b>>1],b&1&&(d=d>>8),d&255):b}function S(a,b,d){d&=255;return 4194304<=b?a.b[b-4194304]=a.b[b-4194304]&65280|d:3932160<=b?-1:0<=b?b&1?a.memory[b>>1]=d<<8|a.memory[b>>1]&255:a.memory[b>>1]=a.memory[b>>1]&65280|d:b}function L(a,b){return N(a,Gc(a,b,2))} -function Hc(a){var b=L(a,a.b[6]|65536);0<=b&&(a.b[6]=a.b[6]+2&65535);return b}function Fc(a,b){var d,c;a.b[6]=c=a.b[6]-2&65535;a.J&57344||(a.K=a.K<<8|246);if(!a.B&&c<=a.W&&4>3&7){case 0:return K(a,4);case 1:if(6===f&&!a.B&&d&4&&(a.b[6]<=a.W||65534<=a.b[6])){if(a.b[6]<=a.W-32||65534<=a.b[6])return a.b[6]=4,K(a,4);a.F|=4}return 7===f?a.b[f]:a.b[f]|65536;case 2:e=2;c=a.b[f];7!==f&&(c|=65536,6>f&&d&1&&(e=1));break;case 3:e=2;c=a.b[f];7!==f&&(c|=65536);if(0>(c=L(a,c)))return c;c|=65536;break;case 4:e=-2;6>f&&d&1&&(e=-1);c=a.b[f]+e&65535;7!==f&&(c|=65536);break;case 5:e=-2;c=a.b[f]-2&65535;7!==f&&(c|=65536);if(0>(c=L(a,c)))return c; -c|=65536;break;case 6:if(0>(c=L(a,a.b[7])))return c;a.b[7]=a.b[7]+2&65535;c=c+a.b[f]&65535;return c|65536;case 7:if(0>(c=L(a,a.b[7])))return c;a.b[7]=a.b[7]+2&65535;c=c+a.b[f]&65535;return 0>(c=L(a,c|65536))?c:c|65536}a.b[f]=a.b[f]+e&65535;a.J&57344||(a.K=a.K<<8|e<<3&248|f);if(6===f&&!a.B&&d&4&&0>=e&&(a.b[6]<=a.W||65534<=a.b[6])){if(a.b[6]<=a.W-32)return a.b[6]=4,K(a,4);a.F|=4}return c}function T(a,b,d){var c;return b&56?(0<=(c=Ic(a,b,d))&&(c=Gc(a,c,d)),c):4194304+(b&7)} -function U(a,b){var d;b&56?0<=(d=T(a,b,2))&&(d=N(a,d)):d=a.b[b&7];return d}function Jc(a,b){var d;b&56?0<=(d=T(a,b,3))&&(d=P(a,d)):d=a.b[b&7]&255;return d}function V(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} -m.Ka=function(a){this.A.complete=!0;var b=this.A.Ab=this.I&&Kc(this.I),d=a?this.A.cb?0:1:-1;this.A.cb=!1;this.T=this.O=a;this.nb&256?(Ac(this),a=!1):a=!0;if(a){do{if(b){if(Lc(this.I,this.b[7],d)){this.ca();break}d=1}var c,e,f,h,g;if(this.V)if(1===this.V)this.V=2;else{this.V=0;g=-1;c=this.sb&224;if(0<(a=this.G.length))for(;0c&&(c=this.G[a].Gb,g= -a)}c>(this.f&224)&&(0>g?K(this,160):(K(this,this.G[g].Jb),this.G.splice(g,1)))}this.J&57344||(this.K=0);this.F=this.f&16;if(0<=(a=L(this,this.b[7])))switch(this.b[7]=this.b[7]+2&65535,a&61440){case 4096:0<=(c=U(this,a>>6))&&(a&56?0<=(f=T(this,a,4))&&0<=O(this,f,c)&&(this.i=this.u=c,this.j=0):(this.i=this.u=this.b[a&7]=c,this.j=0));break;case 8192:0<=(c=U(this,a>>6))&&0<=(e=U(this,a))&&(this.i=this.u=this.C=a=c-e,this.j=(c^e)&(c^a));break;case 12288:0<=(c=U(this,a>>6))&&0<=(e=U(this,a))&&(this.i=this.u= -c&e,this.j=0);break;case 16384:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e&~c,0<=O(this,f,a)&&(this.i=this.u=a,this.j=0)):(this.i=this.u=a=this.b[a&7]&=~c,this.j=0));break;case 20480:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e|c,0<=O(this,f,a)&&(this.i=this.u=a,this.j=0)):(this.i=this.u=a=this.b[a&7]|=c,this.j=0));break;case 24576:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=c+e,0<=O(this,f,a)&&(this.i=this.u=this.C=a,this.j=(c^a)&(e^a))):(g=a&7, -e=this.b[g],this.b[g]=(a=c+e)&65535,this.i=this.u=this.C=a,this.j=(c^a)&(e^a)));break;case 36864:0<=(c=Jc(this,a>>6))&&(a&56?0<=(f=T(this,a,5))&&0<=S(this,f,c)&&(this.i=this.u=c<<8,this.j=0):(c&128&&(c|=65280),this.i=this.u=this.b[a&7]=c,this.j=0));break;case 40960:0<=(c=Jc(this,a>>6))&&0<=(e=Jc(this,a))&&(a=c-e,this.i=this.u=this.C=a<<8,this.j=((c^e)&(c^a))<<8);break;case 45056:0<=(c=Jc(this,a>>6))&&0<=(e=Jc(this,a))&&(this.i=this.u=(c&e)<<8,this.j=0);break;case 49152:0<=(c=Jc(this,a>>6))&&0<=(e= -P(this,f=T(this,a,7)))&&(a=e&~c,0<=S(this,f,a)&&(this.i=this.u=a<<8,this.j=0));break;case 53248:0<=(c=Jc(this,a>>6))&&0<=(e=P(this,f=T(this,a,7)))&&(a=e|c,0<=S(this,f,a)&&(this.i=this.u=a<<8,this.j=0));break;case 57344:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e-c,0<=O(this,f,a)&&(this.i=this.u=this.C=a,this.j=(c^e)&(e^a))):(g=a&7,e=this.b[g],this.b[g]=(a=e-c)&65535,this.i=this.u=this.C=a,this.j=(c^e)&(e^a)));break;default:switch(a&65024){case 2048:0<=(h=Ic(this,a,0))&&(g=a>>6&7, -0<=Fc(this,this.b[g])&&(this.b[g]=this.b[7],this.b[7]=h&65535));break;case 28672:0<=(c=U(this,a))&&(g=a>>6&7,c&32768&&(c|=-65536),e=this.b[g],e&32768&&(e|=-65536),a=~~(c*e),this.b[g]=a>>16&65535,this.b[g|1]=a&65535,this.i=a>>16,this.u=this.i|a,this.C=this.j=0,-32768>a||32767>6&7,e=this.b[g]<<16|this.b[g|1],this.C=this.j=0,c&32768&&(c|=-65536),a=~~(e/c),-32768<=a&&32767>=a?(this.b[g]=a&65535,this.b[g|1]=e-a*c&65535,this.u=a>>16|a,this.i= -a>>16):(this.j=32768,this.u=a>>15|a,this.i=e>>16,-1===c&&65534===this.b[g]&&(this.b[g]=this.b[g|1]=1))):(this.u=this.i=0,this.j=32768,this.C=65536));break;case 29696:0<=(c=U(this,a))&&(g=a>>6&7,a=this.b[g],a&32768&&(a|=4294901760),this.C=this.j=0,c&=63,c&32?(c=64-c,16>c):c&&(16>15&65535)&&65535!==e&&(this.j=32768))),this.b[g]=a&65535,this.i=this.u=a);break;case 30208:if(0<=(c=U(this,a))){g=a>>6&7;e=this.b[g]<<16|this.b[g|1];this.C= -this.j=0;c&=63;if(c&32)c=64-c,32>c-1,this.C=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.b[g|1]=a&65535;this.i=a>>16;this.u=a>>16|a}break;case 30720:a&56?0<=(e=N(this,f=T(this,a,6)))&&(e^=this.b[a>>6&7],0<=O(this,f,e)&&(this.i=this.u=e,this.j=0)):(this.i=this.u=e=this.b[a&7]^=this.b[a>>6&7],this.j=0);break;case 32256:g=a>> -6&7;if(this.b[g]=this.b[g]-1&65535)this.b[7]=this.b[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.b[7]=V(this.b[7],a);break;case 512:this.u&65535&&(this.b[7]=V(this.b[7],a));break;case 768:this.u&65535||(this.b[7]=V(this.b[7],a));break;case 1024:(this.i&32768)===(this.j&32768)&&(this.b[7]=V(this.b[7],a));break;case 1280:(this.i&32768)!==(this.j&32768)&&(this.b[7]=V(this.b[7],a));break;case 1536:this.u&65535&&(this.i&32768)===(this.j&32768)&&(this.b[7]=V(this.b[7],a));break;case 1792:this.u& -65535&&(this.i&32768)===(this.j&32768)||(this.b[7]=V(this.b[7],a));break;case 32768:this.i&32768||(this.b[7]=V(this.b[7],a));break;case 33280:!(this.C&65536)&&this.u&65535&&(this.b[7]=V(this.b[7],a));break;case 33024:this.i&32768&&(this.b[7]=V(this.b[7],a));break;case 33536:if(this.C&65536||!(this.u&65535))this.b[7]=V(this.b[7],a);break;case 33792:this.j&32768||(this.b[7]=V(this.b[7],a));break;case 34048:this.j&32768&&(this.b[7]=V(this.b[7],a));break;case 34304:this.C&65536||(this.b[7]=V(this.b[7], -a));break;case 34560:this.C&65536&&(this.b[7]=V(this.b[7],a));break;case 34816:K(this,24);break;case 35072:K(this,28);break;default:switch(a&65472){case 64:0<=(h=Ic(this,a,0))&&(this.b[7]=h&65535);break;case 192:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<8|e>>8,0<=O(this,f,a)&&(this.i=this.u=e&65280,this.j=this.C=0)):(g=a&7,e=this.b[g],this.b[g]=(e<<8|e>>8)&65535,this.i=this.u=e&65280,this.j=this.C=0);break;case 2560:a&56?0<=(f=T(this,a,4))&&0<=O(this,f,0)&&(this.i=this.C=this.j=this.u=0):this.i=this.C= -this.j=this.u=this.b[a&7]=0;break;case 2624:0<=(e=N(this,f=T(this,a,6)))&&(a=~e,0<=O(this,f,a)&&(this.i=this.u=a,this.C=65536,this.j=0));break;case 2688:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e+1,0<=O(this,f,a)&&(this.i=this.u=a,this.j=a&(a^e))):(g=a&7,e=this.b[g],a=e+1,this.b[g]=a&65535,this.i=this.u=a,this.j=a&(a^e));break;case 2752:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e-1,0<=O(this,f,a)&&(this.i=this.u=a,this.j=(a^e)&e)):(g=a&7,e=this.b[g],a=e-1,this.b[g]=a&65535,this.i=this.u=a,this.j=(a^e)&e); -break;case 2816:0<=(e=N(this,f=T(this,a,6)))&&(a=-e,0<=O(this,f,a)&&(this.C=this.i=this.u=a,this.j=a&e));break;case 2880:0<=(e=N(this,f=T(this,a,6)))&&(a=e+(this.C>>16&1),0<=O(this,f,a)&&(this.C=this.i=this.u=a,this.j=a&(a^e)));break;case 2944:0<=(e=N(this,f=T(this,a,6)))&&(a=e-(this.C>>16&1),0<=O(this,f,a)&&(this.C=this.i=this.u=a,this.j=(a^e)&e));break;case 3008:0<=(e=U(this,a))&&(this.i=this.u=e,this.C=this.j=0);break;case 3072:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=(this.C&65536|e)>>1,0<=O(this, -f,a)&&(this.C=e<<16,this.i=this.u=a,this.j=a^this.C>>1)):(g=a&7,e=this.b[g],a=(this.C&65536|e)>>1,this.b[g]=a&65535,this.C=e<<16,this.i=this.u=a,this.j=a^this.C>>1);break;case 3136:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<1|this.C>>16&1,0<=O(this,f,a)&&(this.C=this.i=this.u=a,this.j=a^e)):(g=a&7,e=this.b[g],a=e<<1|this.C>>16&1,this.b[g]=a&65535,this.C=this.i=this.u=a,this.j=a^e);break;case 3200:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e&32768|e>>1,0<=O(this,f,a)&&(this.C=e<<16,this.i=this.u=a,this.j= -this.i^this.C>>1)):(g=a&7,e=this.b[g],a=e&32768|e>>1,this.b[g]=a&65535,this.C=e<<16,this.i=this.u=a,this.j=this.i^this.C>>1);break;case 3264:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<1,0<=O(this,f,a)&&(this.C=this.i=this.u=a,this.j=a^e)):(g=a&7,e=this.b[g],a=e<<1,this.b[g]=a&65535,this.C=this.i=this.u=a,this.j=a^e);break;case 3328:h=this.b[7]+((a&63)<<1)&65535;0<=(c=L(this,h|65536))&&(this.b[7]=this.b[5],this.b[5]=c,this.b[6]=h+2&65535);break;case 3392:a&56?0<=(h=Ic(this,a,0))&&(61440!==(this.f&61440)&& -(h&=65535),this.B=this.f>>12&3,0<=(c=L(this,h))&&(this.B=this.f>>14&3,0<=Fc(this,c)&&(this.i=this.u=c,this.j=0))):(g=a&7,c=6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]:this.Ba[this.f>>12&3],0<=Fc(this,c)&&(this.i=this.u=c,this.j=0));break;case 3456:0<=(e=Hc(this))&&((this.J&57344||(this.K=22),a&56)?0<=(h=Ic(this,a,0))&&(h&=65535,this.B=this.f>>12&3,0<=(f=Gc(this,h,4))&&(this.B=this.f>>14&3,0<=O(this,f,e)&&(this.i=this.u=e,this.j=0))):(g=a&7,6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]= -e:this.Ba[this.f>>12&3]=e,this.i=this.u=e,this.j=0));break;case 3520:0<=(f=T(this,a,4))&&(a=-(this.i>>15&1),0<=O(this,f,a)&&(this.u=a,this.j=0));break;case 35328:a&56?0<=(f=T(this,a,5))&&0<=S(this,f,0)&&(this.i=this.C=this.j=this.u=0):(this.b[a&7]&=65280,this.i=this.C=this.j=this.u=0);break;case 35392:0<=(e=P(this,f=T(this,a,7)))&&(a=~e,0<=S(this,f,a)&&(this.i=this.u=a<<8,this.C=65536,this.j=0));break;case 35456:0<=(e=P(this,f=T(this,a,7)))&&(a=e+1,0<=S(this,f,a)&&(this.i=this.u=a<<8,this.j=(a&(a^ -e))<<8));break;case 35520:0<=(e=P(this,f=T(this,a,7)))&&(a=e-1,0<=S(this,f,a)&&(this.i=this.u=a<<8,this.j=((a^e)&e)<<8));break;case 35584:0<=(e=P(this,f=T(this,a,7)))&&(a=-e,0<=S(this,f,a)&&(this.C=this.i=this.u=a<<8,this.j=(a&e)<<8));break;case 35648:0<=(e=P(this,f=T(this,a,7)))&&(a=e+(this.C>>16&1),0<=S(this,f,a)&&(this.i=this.u=this.C=a<<8,this.j=(a&(a^e))<<8));break;case 35712:0<=(e=P(this,f=T(this,a,7)))&&(a=e-(this.C>>16&1),0<=S(this,f,a)&&(this.i=this.u=this.C=a<<8,this.j=((a^e)&e)<<8));break; -case 35776:0<=(e=Jc(this,a))&&(this.i=this.u=e<<8,this.C=this.j=0);break;case 35840:0<=(e=P(this,f=T(this,a,7)))&&(a=((this.C&65536)>>8|e)>>1,0<=S(this,f,a)&&(this.C=e<<16,this.i=this.u=a<<8,this.j=this.i^this.C>>1));break;case 35904:0<=(e=P(this,f=T(this,a,7)))&&(a=e<<1|this.C>>16&1,0<=S(this,f,a)&&(this.C=this.i=this.u=a<<8,this.j=(a^e)<<8));break;case 35968:0<=(e=P(this,f=T(this,a,7)))&&(a=e&128|e>>1,0<=S(this,f,a)&&(this.C=e<<16,this.i=this.u=a<<8,this.j=this.i^this.C>>1));break;case 36032:0<= -(e=P(this,f=T(this,a,7)))&&(a=e<<1,0<=S(this,f,a)&&(this.C=this.i=this.u=a<<8,this.j=(a^e)<<8));break;case 36160:a&56?0<=(h=Ic(this,a,0))&&(this.B=this.f>>12&3,0<=(c=L(this,h|65536))&&(this.B=this.f>>14&3,0<=Fc(this,c)&&(this.i=this.u=c,this.j=0))):(g=a&7,c=6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]:this.Ba[this.f>>12&3],0<=Fc(this,c)&&(this.i=this.u=c,this.j=0));break;case 36224:0<=(e=Hc(this))&&((this.J&57344||(this.K=22),a&56)?0<=(h=Ic(this,a,0))&&(this.B=this.f>>12&3,0<=(f=Gc(this,h| -65536,4))&&(this.B=this.f>>14&3,0<=O(this,f,e)&&(this.i=this.u=e,this.j=0))):(g=a&7,6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]=e:this.Ba[this.f>>12&3]=e,this.i=this.u=e,this.j=0));break;default:switch(a&65528){case 128:0<=(c=Hc(this))&&(g=a&7,this.b[7]=this.b[g],this.b[g]=c);break;case 152:this.f&49152||(this.f=this.f&63519|(a&7)<<5,this.V=1);break;case 160:case 168:a&1&&(this.C=0);a&2&&(this.j=0);a&4&&(this.u=1);a&8&&(this.i=0);break;case 176:case 184:a&1&&(this.C=65536);a&2&&(this.j=32768); -a&4&&(this.u=0);a&8&&(this.i=32768);break;default:switch(a){case 0:49152&this.f?K(this,4):(this.Pa=3,Ac(this),console.log("HALT at "+this.b[7].toString(8)));break;case 1:g=0;if(0<(a=this.G.length))for(;0>>0,h],p=ua(n,k,a.hb);0>p&&n.splice(-(p+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.K.push({Ib:b,D:d,Cb:c,qa:e,fb:f})}delete this.qa}return!0};Mc.prototype.ra=function(){return!0}; -function Nc(a,b,d,c){if(c)a.ea("Unable to load system ROM (error "+c+": "+b+")");else{ab(a.lb,b,d);var e;if("["==d.charAt(0)||"{"==d.charAt(0))try{var f,h,g=eval("("+d+")");if(f=g.bytes)a.w=f;else if(f=g.words)for(a.w=Array(2*f.length),h=e=0;e>8&255;else if(f=g.data)for(a.w=Array(4*f.length),h=e=0;e>8&255,a.w[h++]=f[e]>>16&255,a.w[h++]=f[e]>>24&255;else a.w=g;a.qa=g.symbols;if(!a.w.length){t("Empty ROM: "+ -b);return}if(1==a.w.length){t(a.w[0]);return}}catch(k){a.ea("ROM data error: "+k.message);return}else for(b=d.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.w=Array(b.length),e=0;e>>c.ba].La(e&c.H,a.w[d]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.F?b.push(a.F):null!=a.F&&a.F.length&&(b=a.F);for(d=0;d>>e.ba;0>>=e.ba;0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; -function Tc(a,b,d,c){if(d)if(b){0>a.G&&a.F.length&&(a.G=0);if(0>a.G||b!=a.F[a.G])a.F.splice(0,0,b),a.G=0;a.G--}else a.U?b="end":b=a.F[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 h=b.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==c&&!e||!h)a.push(qa(b.substring(d,f))),d=f+1}}return a} -function Uc(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; +u.prototype={constructor:u,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ha:function(a,b,d){switch(b){case "clear":return this.K[b]||(this.K[b]=d,d.onclick=function(a){return function(){a.K.print&&(a.K.print.value="")}}(this)),!0;case "print":return this.K[b]||(this.wa=this.K[b]=d,d.value="",this.g=function(a){return function(b,d){8192>1)+2;10>this.S&&(this.S=10);15>2;this.F=this.ma-1;this.G=this.J/this.ma|0;this.B=this.G-1;a=new G;xb(a,this.I);this.M=Array(this.G);for(b=0;b>>a.S;0h&&(n=h);if(k&&k.size){if(k.type==c&&k.controller==e){if(f+h<=k.D)return k.Ya+=k.D-f,k.D=f,!0;if(f>=k.D+k.Ya){n=k.size-(f-l);n>h&&(n=h);k.Ya=f-k.D+n;f=l+a.ma;h-=n;g++;continue}}return Ab(1,f,h)}f=new G(f,n,a.ma,c,e);xb(f,a.I,k);a.M[g++]=f;f=l+a.ma;h-=n}return 0>=h?(a.status(Math.floor(d/1024)+"Kb "+Bb[c]+" at "+r(b,8,!0)),!0):Ab(2,b,d)} +m.Sa=function(a){return this.M[(a&this.u)>>>this.S].Ka(a&this.F,a)};m.pa=function(a){var b=a&this.F,d=(a&this.u)>>>this.S;return b!=this.F?this.M[d].Ab(b,a):this.M[d++].Ka(b,a)|this.M[d&this.B].Ka(0,a+1)<<8};function Cb(a,b){var d=b&a.F,c=(b&a.u)>>>a.S;return d!=a.F?a.M[c].hb(d,b):a.M[c++].Wa(d,b)|a.M[c&a.B].Wa(0,b+1)<<8}m.bb=function(a,b){this.M[(a&this.u)>>>this.S].Ma(a&this.F,b&255,a)}; +m.ib=function(a,b){var d=a&this.F,c=(a&this.u)>>>this.S;d!=this.F?this.M[c].Cb(d,b&65535,a):(this.M[c++].Ma(d,b&255,a),this.M[c&this.B].Ma(0,b>>8&255,a+1))};function Ab(a,b,d){t("Memory block error ("+a+": "+r(b)+","+r(d)+")");return!1}var Db;if(tb){var Pb=new ArrayBuffer(2);(new DataView(Pb)).setUint16(0,256,!0);Db=256===(new Uint16Array(Pb))[0]}else Db=!1;var Qb=Db; +function G(a,b,d,c,e){this.id=Rb+=2;this.f=null;this.D=a;this.Ya=b;this.size=d||0;this.type=c||Sb;this.K=c==Tb;this.controller=null;xb(this);this.ua=this.Gb=!1;if(d)if(e)this.controller=e,this.f=null,Ub(this,e.Oa);else if(tb)this.H=new ArrayBuffer(d),this.J=new DataView(this.H,0,d),this.F=new Uint8Array(this.H,0,d),this.N=new Uint16Array(this.H,0,d>>1),this.f=new Int32Array(this.H,0,d>>2),Ub(this,Qb?Vb:Wb);else{this.f=Array(d>>2);for(a=0;a>2),b=0;b>8,d)},V:function(a){return this.f[a>>2]>>>((a&3)<<3)&255},Z:function(a){var b=a>>2;a=(a&3)<<3;var d=this.f[b]>>a;return 24>a?d&65535:d&255|(this.f[b+1]&255)<<8},ia:function(a,b){var d=a>>2,c=(a& +3)<<3;this.f[d]=this.f[d]&~(255<>2,c=(a&3)<<3;24>c?this.f[d]=this.f[d]&~(65535<>8);this.ua=!0},T:function(a,b){if(this.I&&null!=this.D){var d=this.I;ac(d,this.D+a,1,d.R)&&d.ca(!0)}return this.Wa(a,b)},X:function(a,b){if(this.I&&null!=this.D){var d=this.I;ac(d,this.D+a,2,d.R)&&d.ca(!0)}return this.hb(a,b)},fa:function(a,b,d){if(this.I&&null!=this.D){var c=this.I;ac(c,this.D+a,1, +c.J)&&c.ca(!0)}this.K?this.G(a,b,d):this.Na(a,b,d)},la:function(a,b,d){if(this.I&&null!=this.D){var c=this.I;ac(c,this.D+a,2,c.J)&&c.ca(!0)}this.K?this.G(a,b,d):this.kb(a,b,d)},R:function(a){return this.F[a]},U:function(a){return this.F[a]},W:function(a){return this.J.getUint16(a,!0)},Y:function(a){return a&1?this.F[a]|this.F[a+1]<<8:this.N[a>>1]},da:function(a,b){this.F[a]=b;this.ua=!0},ga:function(a,b){this.F[a]=b;this.ua=!0},ka:function(a,b){this.J.setUint16(a,b,!0);this.ua=!0},na:function(a,b){a& +1?(this.F[a]=b,this.F[a+1]=b>>8):this.N[a>>1]=b;this.ua=!0}};function xb(a,b,d){a.I=b;a.u=a.B=0;d&&((a.u=d.u)&&$b(a,Zb,!1),(a.B=d.B)&&Yb(a,Zb,!1))}function bc(a,b){b?0===--a.B&&(a.Ma=a.K?a.G:a.Na,a.Cb=a.K?a.L:a.kb):0===--a.u&&(a.Ka=a.Wa,a.Ab=a.hb)}function Yb(a,b,d){d&&a.B||(a.Ma=!a.K&&b[2]||a.G,a.Cb=!a.K&&b[3]||a.L);if(d||void 0===d)a.Na=b[2]||a.G,a.kb=b[3]||a.L}function $b(a,b,d){d&&a.u||(a.Ka=b[0]||a.O,a.Ab=b[1]||a.P);if(d||void 0===d)a.Wa=b[0]||a.O,a.hb=b[1]||a.P} +function Ub(a,b){b||(b=cc);$b(a,b,void 0);Yb(a,b,void 0)}var cc=[],Xb=[G.prototype.V,G.prototype.Z,G.prototype.ia,G.prototype.qa],Zb=[G.prototype.T,G.prototype.X,G.prototype.fa,G.prototype.la];if(tb)var Wb=[G.prototype.R,G.prototype.W,G.prototype.da,G.prototype.ka],Vb=[G.prototype.U,G.prototype.Y,G.prototype.ga,G.prototype.na]; +function dc(a,b){u.call(this,"CPU",a,dc,1);var d=a.multiplier||1;this.Fa=a.cycles||b;this.za=d;this.Da=Math.round(this.Fa/1E4)/100;this.ya=this.Da*this.za;this.A.ba=!1;this.A.jb=!1;this.A.Pa=a.autoStart;this.A.ob=!1;this.A.Ha=!1;this.Ta=this.Y=0;this.Ua=a.csStart;this.Ia=a.csInterval;this.Ja=a.csStop;this.ia=[];this.Ib=this.Ba.bind(this);E(this)}y(dc);var ec=["power","reset"];m=dc.prototype; +m.xa=function(a,b,d,c){this.u=a;this.F=b;this.I=c;for(b=0;b=a.Y&&(a.Y+=a.Ia,d=!0);0<=a.Ja&&a.Ja<=kc(a)&&(a.Ia=a.Ja=-1,hc(a),a.ca(),d=!0);d&&a.g(kc(a)+" cycles: checksum="+r(a.Ta))}} +function lc(a,b,d,c){if(a.K[b]){void 0===d&&(sb(a,"Value for "+b+" is invalid"),a.ca());var e=a.I&&a.I.fa||8;d=!a.A.ba||a.A.ob?8==e?ga(d,c):r(d,c):"--------".substr(0,c||4);a.K[b].textContent!=d&&(a.K[b].textContent=d)}} +m.ha=function(a,b,d){var c=this;a=!1;switch(b){case "power":case "reset":this.K[b]=d;a=!0;break;case "run":this.K[b]=d;d.onclick=function(){var a;if(a=c.u)if(a=c.u,a.A.$)a=!0;else{var b=null,d,g=bb(a.id);for(d=0;da.R/a.ya?b=1:c=!0;a.za=b;b=a.Da*a.za;if(a.ya!=b){a.ya=b;b=a.ya.toFixed(2)+"Mhz";var e=a.K.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}d&&a.u&&a.u.Xa()}nc(a,a.O);a.O=0;a.N=va();a.T=0;oc(a);return c}function pc(a){a.U-=a.P;a.P=0} +m.Ba=function(a){if(pb(this,!0)){if(!this.A.ba){mc(this);this.u&&this.u.start(this.N,kc(this));this.A.ba=!0;this.A.jb=!0;this.fa&&this.fa.start();var b=this.K.run;b&&(b.textContent="Halt");this.u&&(this.u.ja(!0),a&&this.u.Xa(!0))}this.Qa>=this.Fa&&oc(this,!0);this.ga=0;this.la=va();this.T&&(a=this.la-this.T,a>this.wb&&(this.N+=a,this.N>this.la&&(this.N=this.la)));try{do{for(var d=this.A.Ha?1:this.na,c=this.ia.length-1;0<=c;c--){var e=this.ia[c];0>e[0]||d>e[0]&&(d=e[0])}this.La(d);var f=this.U-this.P; +a=f;for(var h=this.ia.length-1;0<=h;h--){var g=this.ia[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ga+=f;this.O+=f;nc(this,0,!0);jc(this,f);this.Z-=f;if(0>=this.Z){this.Z+=this.na;15<=++this.xb&&(this.u&&this.u.ja(),this.xb=0);break}}while(this.A.ba)}catch(k){this.ca();H(this);this.u&&this.u.stop(va(),kc(this));pb(this,!1);sb(this,k.stack||k.message);return}d=setTimeout;c=this.Ib;this.T=va();e=this.wb;this.ga&&(e=Math.round(e*this.ga/this.na));e=e-(this.T-this.la);if(f=this.T-this.N)this.R= +Math.round(this.O/(10*f))/100,864E5<=f&&(this.V=0,mc(this));if(0>e||this.Re&&(this.N-=e),e=0;this.Qa+=this.ga;this.T+=e;d(c,e)}else H(this),this.u&&this.u.stop(va(),kc(this))};m.La=function(){return 0};m.ca=function(a){qb(this,!0);pc(this);nc(this,this.O);this.O=0;if(this.A.ba){this.A.ba=!1;this.fa&&this.fa.stop();var b=this.K.run;b&&(b.textContent="Run")}this.A.complete=a};function H(a,b){a.u&&a.u.ja(b)} +function Cc(a){this.zb=+a.model||1170;this.Kb=a.resetAddr||0;dc.call(this,a,1E6);this.Za=0;this.C=65536;this.j=32768;this.w=65535;this.i=32768;this.f=15;this.b=[0,0,0,0,0,0,0,this.Kb];this.ab=[0,0,0,0,0,0];this.Aa=[0,0,0,0];this.memory=[];this.H=[];this.Ra=this.yb=0;this.W=2;this.X=255;this.G=0;this.da=-1;this.vb=this.Ca=this.ub=this.B=this.qa=this.L=this.J=0;this.ka=[7,7,7,7];this.Ea=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.Mb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.A.complete=this.A.Fb=!1}y(Cc,dc);m=Cc.prototype;m.reset=function(){this.A.ba&&this.ca();Dc(this);gc(this);this.A.error=!1;this.parent.reset.call(this)}; +function Dc(a){a.X=255;a.H=[];a.yb=0;a.J=a.L=a.qa=a.ub=0;a.ka[0]=a.ka[1]=a.ka[3]=7;a.Ca=0}m.sb=function(){return 0};m.save=function(){var a=new I(this);J(a,0,[]);J(a,1,[this.tb,this.V,this.za]);for(var b=this.F,d=0,c=[],e=0;e>14&3;d=a.f>>14&3;a.B!=d&&(a.Aa[d]=a.b[6],a.b[6]=a.Aa[a.B]);a.W=2;a.f=b} +function K(a,b){var d,c,e=0;0>a.da?a.da=a.f=a.f&63728|(a.i&32768?8:0)|(a.w&65535?0:4)|(a.j&32768?2:0)|(a.C&65536?1:0):a.B||(b=4,e=1);a.J&57344||(a.L=63222);a.B=0;0<=(d=L(a,b|65536))&&0<=(c=L(a,b+2&65535|65536))&&(Fc(a,c&53247|a.da>>2&12288),e&&(a.b[6]=4),0<=Gc(a,a.da)&&0<=Gc(a,a.b[7])&&(a.b[7]=d));a.G=0;return a.da=-1} +function Hc(a,b,d){var c,e,f,h=0;if(d&a.ub){c=b>>13&a.ka[a.B];e=a.Ea[a.B][c];f=(a.Ea[a.B][c+16]<<6)+(b&8191)&4194303;if(a.qa&16){if(3932160<=f&&4186112>f){f=f&262143;var g=f>>13&31;31>g?a.qa&32&&(f=a.Mb[g]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}}else f&=262143,253952<=f&&(f|=4186112);if(3932160>f&&(3915776<=f||f&1&&!(d&1)))return K(a,4);switch(e&7){case 1:h=4096;case 2:e|=128;d&4&&(h=8192);break;case 4:h=4096;case 5:d&4&&(h=4096);case 6:e|=d&4?192:128;break; +default:h=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(h|=16384):(b&8128)>(e>>2&8128)&&(h|=16384));a.Ea[a.B][c]=e;if(4194170!==f||a.B)a.Ca=a.B,a.vb=c;if(h){if(h&57344)return 0<=a.da&&(h|=128),a.J&57344||(a.J=a.J|h|a.Ca<<5|a.vb<<1),K(a,168);a.J&61440||!(4191360>f||4194239>3&7){case 0:return K(a,4);case 1:if(6===f&&!a.B&&d&4&&(a.b[6]<=a.X||65534<=a.b[6])){if(a.b[6]<=a.X-32||65534<=a.b[6])return a.b[6]=4,K(a,4);a.G|=4}return 7===f?a.b[f]:a.b[f]|65536;case 2:e=2;c=a.b[f];7!==f&&(c|=65536,6>f&&d&1&&(e=1));break;case 3:e=2;c=a.b[f];7!==f&&(c|=65536);if(0>(c=L(a,c)))return c;c|=65536;break;case 4:e=-2;6>f&&d&1&&(e=-1);c=a.b[f]+e&65535;7!==f&&(c|=65536);break;case 5:e=-2;c=a.b[f]-2&65535;7!==f&&(c|=65536);if(0>(c=L(a,c)))return c; +c|=65536;break;case 6:if(0>(c=L(a,a.b[7])))return c;a.b[7]=a.b[7]+2&65535;c=c+a.b[f]&65535;return c|65536;case 7:if(0>(c=L(a,a.b[7])))return c;a.b[7]=a.b[7]+2&65535;c=c+a.b[f]&65535;return 0>(c=L(a,c|65536))?c:c|65536}a.b[f]=a.b[f]+e&65535;a.J&57344||(a.L=a.L<<8|e<<3&248|f);if(6===f&&!a.B&&d&4&&0>=e&&(a.b[6]<=a.X||65534<=a.b[6])){if(a.b[6]<=a.X-32)return a.b[6]=4,K(a,4);a.G|=4}return c}function T(a,b,d){var c;return b&56?(0<=(c=Jc(a,b,d))&&(c=Hc(a,c,d)),c):4194304+(b&7)} +function U(a,b){var d;b&56?0<=(d=T(a,b,2))&&(d=N(a,d)):d=a.b[b&7];return d}function Kc(a,b){var d;b&56?0<=(d=T(a,b,3))&&(d=P(a,d)):d=a.b[b&7]&255;return d}function V(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} +m.La=function(a){this.A.complete=!0;var b=this.A.Fb=this.I&&Lc(this.I),d=a?this.A.jb?0:1:-1;this.A.jb=!1;this.U=this.P=a;this.tb&256?(pc(this),a=!1):a=!0;if(a){do{if(b){if(Mc(this.I,this.b[7],d)){this.ca();break}d=1}var c,e,f,h,g;if(this.W)if(1===this.W)this.W=2;else{this.W=0;g=-1;c=this.yb&224;if(0<(a=this.H.length))for(;0c&&(c=this.H[a].Lb,g= +a)}c>(this.f&224)&&(0>g?K(this,160):(K(this,this.H[g].Sb),this.H.splice(g,1)))}this.J&57344||(this.L=0);this.G=this.f&16;if(0<=(a=L(this,this.b[7])))switch(this.b[7]=this.b[7]+2&65535,a&61440){case 4096:0<=(c=U(this,a>>6))&&(a&56?0<=(f=T(this,a,4))&&0<=O(this,f,c)&&(this.i=this.w=c,this.j=0):(this.i=this.w=this.b[a&7]=c,this.j=0));break;case 8192:0<=(c=U(this,a>>6))&&0<=(e=U(this,a))&&(this.i=this.w=this.C=a=c-e,this.j=(c^e)&(c^a));break;case 12288:0<=(c=U(this,a>>6))&&0<=(e=U(this,a))&&(this.i=this.w= +c&e,this.j=0);break;case 16384:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e&~c,0<=O(this,f,a)&&(this.i=this.w=a,this.j=0)):(this.i=this.w=a=this.b[a&7]&=~c,this.j=0));break;case 20480:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e|c,0<=O(this,f,a)&&(this.i=this.w=a,this.j=0)):(this.i=this.w=a=this.b[a&7]|=c,this.j=0));break;case 24576:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=c+e,0<=O(this,f,a)&&(this.i=this.w=this.C=a,this.j=(c^a)&(e^a))):(g=a&7, +e=this.b[g],this.b[g]=(a=c+e)&65535,this.i=this.w=this.C=a,this.j=(c^a)&(e^a)));break;case 36864:0<=(c=Kc(this,a>>6))&&(a&56?0<=(f=T(this,a,5))&&0<=S(this,f,c)&&(this.i=this.w=c<<8,this.j=0):(c&128&&(c|=65280),this.i=this.w=this.b[a&7]=c,this.j=0));break;case 40960:0<=(c=Kc(this,a>>6))&&0<=(e=Kc(this,a))&&(a=c-e,this.i=this.w=this.C=a<<8,this.j=((c^e)&(c^a))<<8);break;case 45056:0<=(c=Kc(this,a>>6))&&0<=(e=Kc(this,a))&&(this.i=this.w=(c&e)<<8,this.j=0);break;case 49152:0<=(c=Kc(this,a>>6))&&0<=(e= +P(this,f=T(this,a,7)))&&(a=e&~c,0<=S(this,f,a)&&(this.i=this.w=a<<8,this.j=0));break;case 53248:0<=(c=Kc(this,a>>6))&&0<=(e=P(this,f=T(this,a,7)))&&(a=e|c,0<=S(this,f,a)&&(this.i=this.w=a<<8,this.j=0));break;case 57344:0<=(c=U(this,a>>6))&&(a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e-c,0<=O(this,f,a)&&(this.i=this.w=this.C=a,this.j=(c^e)&(e^a))):(g=a&7,e=this.b[g],this.b[g]=(a=e-c)&65535,this.i=this.w=this.C=a,this.j=(c^e)&(e^a)));break;default:switch(a&65024){case 2048:0<=(h=Jc(this,a,0))&&(g=a>>6&7, +0<=Gc(this,this.b[g])&&(this.b[g]=this.b[7],this.b[7]=h&65535));break;case 28672:0<=(c=U(this,a))&&(g=a>>6&7,c&32768&&(c|=-65536),e=this.b[g],e&32768&&(e|=-65536),a=~~(c*e),this.b[g]=a>>16&65535,this.b[g|1]=a&65535,this.i=a>>16,this.w=this.i|a,this.C=this.j=0,-32768>a||32767>6&7,e=this.b[g]<<16|this.b[g|1],this.C=this.j=0,c&32768&&(c|=-65536),a=~~(e/c),-32768<=a&&32767>=a?(this.b[g]=a&65535,this.b[g|1]=e-a*c&65535,this.w=a>>16|a,this.i= +a>>16):(this.j=32768,this.w=a>>15|a,this.i=e>>16,-1===c&&65534===this.b[g]&&(this.b[g]=this.b[g|1]=1))):(this.w=this.i=0,this.j=32768,this.C=65536));break;case 29696:0<=(c=U(this,a))&&(g=a>>6&7,a=this.b[g],a&32768&&(a|=4294901760),this.C=this.j=0,c&=63,c&32?(c=64-c,16>c):c&&(16>15&65535)&&65535!==e&&(this.j=32768))),this.b[g]=a&65535,this.i=this.w=a);break;case 30208:if(0<=(c=U(this,a))){g=a>>6&7;e=this.b[g]<<16|this.b[g|1];this.C= +this.j=0;c&=63;if(c&32)c=64-c,32>c-1,this.C=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.b[g|1]=a&65535;this.i=a>>16;this.w=a>>16|a}break;case 30720:a&56?0<=(e=N(this,f=T(this,a,6)))&&(e^=this.b[a>>6&7],0<=O(this,f,e)&&(this.i=this.w=e,this.j=0)):(this.i=this.w=e=this.b[a&7]^=this.b[a>>6&7],this.j=0);break;case 32256:g=a>> +6&7;if(this.b[g]=this.b[g]-1&65535)this.b[7]=this.b[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.b[7]=V(this.b[7],a);break;case 512:this.w&65535&&(this.b[7]=V(this.b[7],a));break;case 768:this.w&65535||(this.b[7]=V(this.b[7],a));break;case 1024:(this.i&32768)===(this.j&32768)&&(this.b[7]=V(this.b[7],a));break;case 1280:(this.i&32768)!==(this.j&32768)&&(this.b[7]=V(this.b[7],a));break;case 1536:this.w&65535&&(this.i&32768)===(this.j&32768)&&(this.b[7]=V(this.b[7],a));break;case 1792:this.w& +65535&&(this.i&32768)===(this.j&32768)||(this.b[7]=V(this.b[7],a));break;case 32768:this.i&32768||(this.b[7]=V(this.b[7],a));break;case 33280:!(this.C&65536)&&this.w&65535&&(this.b[7]=V(this.b[7],a));break;case 33024:this.i&32768&&(this.b[7]=V(this.b[7],a));break;case 33536:if(this.C&65536||!(this.w&65535))this.b[7]=V(this.b[7],a);break;case 33792:this.j&32768||(this.b[7]=V(this.b[7],a));break;case 34048:this.j&32768&&(this.b[7]=V(this.b[7],a));break;case 34304:this.C&65536||(this.b[7]=V(this.b[7], +a));break;case 34560:this.C&65536&&(this.b[7]=V(this.b[7],a));break;case 34816:K(this,24);break;case 35072:K(this,28);break;default:switch(a&65472){case 64:0<=(h=Jc(this,a,0))&&(this.b[7]=h&65535);break;case 192:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<8|e>>8,0<=O(this,f,a)&&(this.i=this.w=e&65280,this.j=this.C=0)):(g=a&7,e=this.b[g],this.b[g]=(e<<8|e>>8)&65535,this.i=this.w=e&65280,this.j=this.C=0);break;case 2560:a&56?0<=(f=T(this,a,4))&&0<=O(this,f,0)&&(this.i=this.C=this.j=this.w=0):this.i=this.C= +this.j=this.w=this.b[a&7]=0;break;case 2624:0<=(e=N(this,f=T(this,a,6)))&&(a=~e,0<=O(this,f,a)&&(this.i=this.w=a,this.C=65536,this.j=0));break;case 2688:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e+1,0<=O(this,f,a)&&(this.i=this.w=a,this.j=a&(a^e))):(g=a&7,e=this.b[g],a=e+1,this.b[g]=a&65535,this.i=this.w=a,this.j=a&(a^e));break;case 2752:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e-1,0<=O(this,f,a)&&(this.i=this.w=a,this.j=(a^e)&e)):(g=a&7,e=this.b[g],a=e-1,this.b[g]=a&65535,this.i=this.w=a,this.j=(a^e)&e); +break;case 2816:0<=(e=N(this,f=T(this,a,6)))&&(a=-e,0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.j=a&e));break;case 2880:0<=(e=N(this,f=T(this,a,6)))&&(a=e+(this.C>>16&1),0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.j=a&(a^e)));break;case 2944:0<=(e=N(this,f=T(this,a,6)))&&(a=e-(this.C>>16&1),0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.j=(a^e)&e));break;case 3008:0<=(e=U(this,a))&&(this.i=this.w=e,this.C=this.j=0);break;case 3072:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=(this.C&65536|e)>>1,0<=O(this, +f,a)&&(this.C=e<<16,this.i=this.w=a,this.j=a^this.C>>1)):(g=a&7,e=this.b[g],a=(this.C&65536|e)>>1,this.b[g]=a&65535,this.C=e<<16,this.i=this.w=a,this.j=a^this.C>>1);break;case 3136:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<1|this.C>>16&1,0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.j=a^e)):(g=a&7,e=this.b[g],a=e<<1|this.C>>16&1,this.b[g]=a&65535,this.C=this.i=this.w=a,this.j=a^e);break;case 3200:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e&32768|e>>1,0<=O(this,f,a)&&(this.C=e<<16,this.i=this.w=a,this.j= +this.i^this.C>>1)):(g=a&7,e=this.b[g],a=e&32768|e>>1,this.b[g]=a&65535,this.C=e<<16,this.i=this.w=a,this.j=this.i^this.C>>1);break;case 3264:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<1,0<=O(this,f,a)&&(this.C=this.i=this.w=a,this.j=a^e)):(g=a&7,e=this.b[g],a=e<<1,this.b[g]=a&65535,this.C=this.i=this.w=a,this.j=a^e);break;case 3328:h=this.b[7]+((a&63)<<1)&65535;0<=(c=L(this,h|65536))&&(this.b[7]=this.b[5],this.b[5]=c,this.b[6]=h+2&65535);break;case 3392:a&56?0<=(h=Jc(this,a,0))&&(61440!==(this.f&61440)&& +(h&=65535),this.B=this.f>>12&3,0<=(c=L(this,h))&&(this.B=this.f>>14&3,0<=Gc(this,c)&&(this.i=this.w=c,this.j=0))):(g=a&7,c=6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]:this.Aa[this.f>>12&3],0<=Gc(this,c)&&(this.i=this.w=c,this.j=0));break;case 3456:0<=(e=Ic(this))&&((this.J&57344||(this.L=22),a&56)?0<=(h=Jc(this,a,0))&&(h&=65535,this.B=this.f>>12&3,0<=(f=Hc(this,h,4))&&(this.B=this.f>>14&3,0<=O(this,f,e)&&(this.i=this.w=e,this.j=0))):(g=a&7,6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]= +e:this.Aa[this.f>>12&3]=e,this.i=this.w=e,this.j=0));break;case 3520:0<=(f=T(this,a,4))&&(a=-(this.i>>15&1),0<=O(this,f,a)&&(this.w=a,this.j=0));break;case 35328:a&56?0<=(f=T(this,a,5))&&0<=S(this,f,0)&&(this.i=this.C=this.j=this.w=0):(this.b[a&7]&=65280,this.i=this.C=this.j=this.w=0);break;case 35392:0<=(e=P(this,f=T(this,a,7)))&&(a=~e,0<=S(this,f,a)&&(this.i=this.w=a<<8,this.C=65536,this.j=0));break;case 35456:0<=(e=P(this,f=T(this,a,7)))&&(a=e+1,0<=S(this,f,a)&&(this.i=this.w=a<<8,this.j=(a&(a^ +e))<<8));break;case 35520:0<=(e=P(this,f=T(this,a,7)))&&(a=e-1,0<=S(this,f,a)&&(this.i=this.w=a<<8,this.j=((a^e)&e)<<8));break;case 35584:0<=(e=P(this,f=T(this,a,7)))&&(a=-e,0<=S(this,f,a)&&(this.C=this.i=this.w=a<<8,this.j=(a&e)<<8));break;case 35648:0<=(e=P(this,f=T(this,a,7)))&&(a=e+(this.C>>16&1),0<=S(this,f,a)&&(this.i=this.w=this.C=a<<8,this.j=(a&(a^e))<<8));break;case 35712:0<=(e=P(this,f=T(this,a,7)))&&(a=e-(this.C>>16&1),0<=S(this,f,a)&&(this.i=this.w=this.C=a<<8,this.j=((a^e)&e)<<8));break; +case 35776:0<=(e=Kc(this,a))&&(this.i=this.w=e<<8,this.C=this.j=0);break;case 35840:0<=(e=P(this,f=T(this,a,7)))&&(a=((this.C&65536)>>8|e)>>1,0<=S(this,f,a)&&(this.C=e<<16,this.i=this.w=a<<8,this.j=this.i^this.C>>1));break;case 35904:0<=(e=P(this,f=T(this,a,7)))&&(a=e<<1|this.C>>16&1,0<=S(this,f,a)&&(this.C=this.i=this.w=a<<8,this.j=(a^e)<<8));break;case 35968:0<=(e=P(this,f=T(this,a,7)))&&(a=e&128|e>>1,0<=S(this,f,a)&&(this.C=e<<16,this.i=this.w=a<<8,this.j=this.i^this.C>>1));break;case 36032:0<= +(e=P(this,f=T(this,a,7)))&&(a=e<<1,0<=S(this,f,a)&&(this.C=this.i=this.w=a<<8,this.j=(a^e)<<8));break;case 36160:a&56?0<=(h=Jc(this,a,0))&&(this.B=this.f>>12&3,0<=(c=L(this,h|65536))&&(this.B=this.f>>14&3,0<=Gc(this,c)&&(this.i=this.w=c,this.j=0))):(g=a&7,c=6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]:this.Aa[this.f>>12&3],0<=Gc(this,c)&&(this.i=this.w=c,this.j=0));break;case 36224:0<=(e=Ic(this))&&((this.J&57344||(this.L=22),a&56)?0<=(h=Jc(this,a,0))&&(this.B=this.f>>12&3,0<=(f=Hc(this,h| +65536,4))&&(this.B=this.f>>14&3,0<=O(this,f,e)&&(this.i=this.w=e,this.j=0))):(g=a&7,6!==g||(this.f>>2&12288)===(this.f&12288)?this.b[g]=e:this.Aa[this.f>>12&3]=e,this.i=this.w=e,this.j=0));break;default:switch(a&65528){case 128:0<=(c=Ic(this))&&(g=a&7,this.b[7]=this.b[g],this.b[g]=c);break;case 152:this.f&49152||(this.f=this.f&63519|(a&7)<<5,this.W=1);break;case 160:case 168:a&1&&(this.C=0);a&2&&(this.j=0);a&4&&(this.w=1);a&8&&(this.i=0);break;case 176:case 184:a&1&&(this.C=65536);a&2&&(this.j=32768); +a&4&&(this.w=0);a&8&&(this.i=32768);break;default:switch(a){case 0:49152&this.f?K(this,4):(this.Ra=3,pc(this),console.log("HALT at "+this.b[7].toString(8)));break;case 1:g=0;if(0<(a=this.H.length))for(;0>>0,h],p=ua(n,k,a.nb);0>p&&n.splice(-(p+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.L.push({Rb:b,D:d,Hb:c,ra:e,lb:f})}delete this.ra}return!0};Nc.prototype.sa=function(){return!0}; +function Oc(a,b,d,c){if(c)a.ea("Unable to load system ROM (error "+c+": "+b+")");else{ab(a.rb,b,d);var e;if("["==d.charAt(0)||"{"==d.charAt(0))try{var f,h,g=eval("("+d+")");if(f=g.bytes)a.u=f;else if(f=g.words)for(a.u=Array(2*f.length),h=e=0;e>8&255;else if(f=g.data)for(a.u=Array(4*f.length),h=e=0;e>8&255,a.u[h++]=f[e]>>16&255,a.u[h++]=f[e]>>24&255;else a.u=g;a.ra=g.symbols;if(!a.u.length){t("Empty ROM: "+ +b);return}if(1==a.u.length){t(a.u[0]);return}}catch(k){a.ea("ROM data error: "+k.message);return}else for(b=d.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.u=Array(b.length),e=0;e>>c.S].Na(e&c.F,a.u[d]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.G?b.push(a.G):null!=a.G&&a.G.length&&(b=a.G);for(d=0;d>>e.S;0>>=e.S;0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; +function Uc(a,b,d,c){if(d)if(b){0>a.H&&a.G.length&&(a.H=0);if(0>a.H||b!=a.G[a.H])a.G.splice(0,0,b),a.H=0;a.H--}else a.V?b="end":b=a.G[a.H+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 h=b.charAt(f);if('"'==h||"'"==h)e?h==e&&(e=null):e=h;else if(h==c&&!e||!h)a.push(qa(b.substring(d,f))),d=f+1}}return a} +function Vc(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 Vc(a,b,d){var c;if(b){b=Wc(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=n+h;c>>=8}c=r(d,0,!0)+" "+d+". "+ga(d,0,!0)+" "+("0b"+h)}a.g((null!=b?b+": ":"")+c);return e} -function Zc(a,b){if(b)return Yc(a,b,a.W[b]);var d=0;for(b in a.W)Yc(a,b,a.W[b]),d++;return 0=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=n+h;c>>=8}c=r(d,0,!0)+" "+d+". "+ga(d,0,!0)+" "+("0b"+h)}a.g((null!=b?b+": ":"")+c);return e} +function $c(a,b){if(b)return Zc(a,b,a.X[b]);var d=0;for(b in a.X)Zc(a,b,a.X[b]),d++;return 0>>c.H.ba;k=1}c.g("blockid physical blockaddr used size type");c.g("-------- --------- ---------- ------ ------ ----");for(var d=-1,l=0;k--;){var n=b[g];n.type==d?l++||c.g("..."):(d=n.type,l=Ab[d],n&&c.g(r(n.id,8)+" %"+r(g<>>d.ba].Ta(c&d.H,c),b&&hd(a,b));return d};m.ta=function(a,b){var d=65535,c=Y(a);-1!==c&&(d=Bb(this.H,c),b&&hd(a,b));return d}; -m.eb=function(a,b,d){var c=Y(a);if(-1!==c){var e=this.H;e.P[(c&e.w)>>>e.ba].La(c&e.H,b&255,c);d&&hd(a,d);H(this.f,!0)}};m.xb=function(a,b,d){var c=Y(a);if(-1!==c){var e=this.H,f=c&e.H,h=(c&e.w)>>>e.ba;f!=e.H?e.P[h].wb(f,b&65535,c):(e.P[h++].La(f,b&255,c),e.P[h&e.K].La(0,b>>8&255,c+1));d&&hd(a,d);H(this.f,!0)}};function X(a){return{D:a,oa:!1}}function id(a){return[a.D,a.oa]}function jd(a){return{D:a[0],oa:a[1]}} -function Z(a,b,d){var c;d=(d?a.O:a.ua).D;if(void 0!==b){c=b=Wc(a,b);var e;if(c.match(/^[a-z_][a-z0-9_]*$/i))for(c=c.toUpperCase(),d=0;de&&(e+=d.length);0>e&&(e=0);for(var f=d.length;e>>c.ba],!1)}a.R=["br"];if(void 0!==a.J)for(b=1;b>>c.ba],!0);a.J=["bw"];a.Da=0} -m.wa=function(a,b,d){var c=!0;d||pd(this,a,b,!1,!0);if(a!=this.B){var e=Y(b);if(-1===e)this.g("invalid address: "+W(this,b.D)),c=!1;else{var f=this.H;f.P[e>>>f.ba].wa(e&f.H,a==this.J)}}c&&(a.push(b),d?b.oa=!0:(qd(this,a,a.length-1,"set"),bd(this)));return c};function pd(a,b,d,c,e){var f=!1;d=Y(d);for(var h=1;h>>c.ba],b==a.J));g.oa||bd(a);break}}return f} -function rd(a,b){for(var d=1;d>23,w=p.D+w&65535,v=W(q,w);else if(8192==w)w=(f&63)<<1,w=p.D-w&65535,v=W(q,w);else if(12288==w)w=f&7,v=W(q,w,2);else if(24576==w)w=f&63,v=W(q,w);else if(w=f&A,A&4032&&(w>>=6,A>>=6),A&63){var A=void 0,z=w&7;switch((w&56)>>3){case 0:v=ud(z);break; -case 1:v="@"+ud(z);break;case 2:7>z?v="("+ud(z)+")+":(A=q.ta(p,2),v="#"+W(q,A));break;case 3:7>z?v="@("+ud(z)+")+":(A=q.ta(p,2),v="@#"+W(q,A));break;case 4:v="-("+ud(z)+")";break;case 5:v="@-("+ud(z)+")";break;case 6:A=q.ta(p,2);v=W(q,A)+"("+ud(z)+")";7==z&&(v=[v,W(q,A+p.D&65535)]);break;case 7:A=q.ta(p,2),v="@"+W(q,A)+"("+ud(z)+")",7==z&&(v=[v,W(q,A+p.D&65535)])}}q=v;if(!q||!q.length){g="INVALID";break}"string"!=typeof q&&(d||(d=q[1]),q=q[0]);0>12&8;break;case "Z":d=a.f.u&65535?0:4;break;case "V":d=a.f.j&32768?2:0;break;case "C":d=a.f.C&65536?1:0;break;default:d=0}return b.charAt(0)+(d?"1":"0")+" "}function ud(a){return 6>a?"R"+a:6==a?"SP":"PC"} -function Ud(a,b){var d="",c=a.f;8>b?(d=ud(b),d+="="+W(a,c.b[b])):13>b?d="A"+(b-8)+"="+W(a,c.Ya[b-8]):16<=b&&20>b?d="S"+(b-16)+"="+W(a,c.Ba[b-16]):20==b&&(d="PS="+W(a,Dc(c)));d&&(d+=" ");return d}m.hb=function(a,b){return a[0]>b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Cb;if(e>=h&&ee;e++)f+=Ud(a,e);f=f+"\n"+(Ud(a,6)+Ud(a,7));f+=vd(a,"T")+vd(a,"N")+vd(a,"Z")+vd(a,"V")+vd(a,"C");a.g(f);d&&(a.O=X(c.b[7]),nd(a,W(a,a.O.D)))}}function Zd(a,b){b=qa(b);var d=b.match(/^(['"])(.*?)\1$/);d?a.g(d[2]):Vc(a,b,!0)} -function $d(a,b,d){var c="t"!=b;d=Xc(a,d,null,!0)||1;var e=1==d?0:1;"tc"==b&&(e=d,d=1);Ja(d,function(){return pb(a,!0)&&a.Ka(e,c,!1)},function(){H(a.f);pb(a,!1)})} -function nd(a,b,d,c){if(b=Z(a,b,!0)){void 0===c&&(c=1);var e=256;if(void 0!==d){c=Z(a,d,!0);if(!c||c.Dg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=td(a,b,h,f);a.g(f);a.O=b;e-=b.D-k;d++}}} -function sd(a,b,d){var c=!0;try{b.length&&"end"!=b?d||a.g(">> "+b):(a.U&&(a.g("ended assemble at "+W(a,a.T.D)),a.O=a.T,a.U=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ga=null;if(rb(a)&&0l||"z"da.length&&(a.g("note: only "+da.length+" available"),R=da.length);M-=R;0>M&&(null==da[da.length-1].D?(R=M+R,M=0):M+=da.length);var qc=[];"call"==Bd&&(Fa=1E5,qc=["CALL"]);for(void 0!==Ad&&a.g(R+" instructions earlier:");0=da.length&&(M=0);a.Ea=R;Dd++;Fa--}}Dd||(a.g("no "+Cd+ -"history available"),a.Ea=void 0)}else{var Db=Z(a,ba);if(Db){var Eb=0;ra&&("l"==ra.charAt(0)&&(ra=ra.substr(1)||te),Eb=Xc(a,ra)>>>0,65536>4||1;ve--&&0Ib?String.fromCharCode(Ib):".";Gb--}sa&&(sa+="\n");sa+=ba+" "+fb+(0==eb?" "+sc: -"")}sa&&a.g(sa);a.ua=Db}}}}break;case "e":if("else"==f[0])break;var Jb=1,Gd=255,Hd=a.Za,Id=a.eb;"ew"==f[0]&&(Jb=2,Gd=65535,Hd=a.ta,Id=a.xb);var Jd=Jb<<1,Kd=f[1];if(null==Kd)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var Kb=Z(a,Kd);if(Kb)for(var Lb=2;Lbwc;){for(var ta=null,ze=256;65536>ib.D>>>0;){Md.D=a.ta(ib,2);if(null==ib.D||!ze--)break;for(var Ae=a,Mb=Md,Nd=null,jb=Mb.D,Od=jb,xc=1;6>=xc&&jb;xc++){if(2\nLicense: GPL version 3 or later ");this.g("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bde){if(fe(c,this.N)){this.J=new I(this,"1.30.0","failsafe");fe(this.J)&&(le(this,c),a=2,me(this.J));J(this.J,"timestamp",wa());ne(this.J);var e=this.w&&!this.K;if(1==a||ya("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(d=je(c)){var f=ke(c,"code"),h=ke(c,"data");f&&("ok"==f?fe(c,h):("error"==f&& -"no machine state"!=h?(this.ea("Error: "+h),"unable to verify user"==h&&(Ha("user",""),this.B=null)):this.g(f+": "+h),me(c),fe(c)?(d=je(c),e=!0):d=!1))}e&&ie(this,d?c:null)}else 2==a&&c.clear()}else ie(this);delete this.N;delete this.O}e=bb(this.id);for(f=0;fa[1];a=a[2];this.Y=!0;this.A.Z=!0;var c=this.L.power;c&&(c.textContent="Shutdown");this.f&&(oe(this,this.f,b,d,a),this.f.Na());this.T&&(le(this,b),b.clear());!d&&this.J&&(this.J.clear(),delete this.J);this.F=0}; -function le(a,b){if(ya("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.B||"",c=b.toString(),e={app:"PDP11js",ver:"1.30.0"};e.url=a.X;e.user=d;e.type="bug";e.data=c;xa("http://www.pcjs.org/api/v1/report",e,!0)}} -function ae(a,b,d){var c,e="none";if(a.F)return null;a.F--;var f=new I(a,"1.30.0"),h=new I(a,"1.30.0","validate"),g=wa();J(h,"timestamp",g);J(f,"timestamp",g);J(f,"version","1.30.0");J(f,"url",window?window.location.href:null);J(f,"browser",window?window.navigator.userAgent:"");a.f&&a.f.ra&&(d&&a.f.ca(),c=a.f.ra(b,d),"object"===typeof c&&J(f,a.f.id,c),d&&(a.f.A.Z=!1,!1===c&&(e=null)));for(var g=bb(a.id),k=0;k>>c.F.S;k=1}c.g("blockid physical blockaddr used size type");c.g("-------- --------- ---------- ------ ------ ----");for(var d=-1,l=0;k--;){var n=b[g];n.type==d?l++||c.g("..."):(d=n.type,l=Bb[d],n&&c.g(r(n.id,8)+" %"+r(g<>>d.S].Wa(c&d.F,c),b&&id(a,b));return d};m.pa=function(a,b){var d=65535,c=Y(a);-1!==c&&(d=Cb(this.F,c),b&&id(a,b));return d}; +m.bb=function(a,b,d){var c=Y(a);if(-1!==c){var e=this.F;e.M[(c&e.u)>>>e.S].Na(c&e.F,b&255,c);d&&id(a,d);H(this.f,!0)}};m.ib=function(a,b,d){var c=Y(a);if(-1!==c){var e=this.F,f=c&e.F,h=(c&e.u)>>>e.S;f!=e.F?e.M[h].kb(f,b&65535,c):(e.M[h++].Na(f,b&255,c),e.M[h&e.B].Na(0,b>>8&255,c+1));d&&id(a,d);H(this.f,!0)}};function X(a){return{D:a,oa:!1}}function jd(a){return[a.D,a.oa]}function kd(a){return{D:a[0],oa:a[1]}} +function Z(a,b,d){var c;d=(d?a.P:a.Da).D;if(void 0!==b){c=b=Xc(a,b);var e;if(c.match(/^[a-z_][a-z0-9_]*$/i))for(c=c.toUpperCase(),d=0;de&&(e+=d.length);0>e&&(e=0);for(var f=d.length;e>>c.S],!1)}a.R=["br"];if(void 0!==a.J)for(b=1;b>>c.S],!0);a.J=["bw"];a.Ca=0} +m.va=function(a,b,d){var c=!0;d||qd(this,a,b,!1,!0);if(a!=this.B){var e=Y(b);if(-1===e)this.g("invalid address: "+W(this,b.D)),c=!1;else{var f=this.F;f.M[e>>>f.S].va(e&f.F,a==this.J)}}c&&(a.push(b),d?b.oa=!0:(rd(this,a,a.length-1,"set"),cd(this)));return c};function qd(a,b,d,c,e){var f=!1;d=Y(d);for(var h=1;h>>c.S],b==a.J));g.oa||cd(a);break}}return f} +function sd(a,b){for(var d=1;d>23,w=p.D+w&65535,v=W(q,w);else if(8192==w)w=(f&63)<<1,w=p.D-w&65535,v=W(q,w);else if(12288==w)w=f&7,v=W(q,w,2);else if(24576==w)w=f&63,v=W(q,w);else if(w=f&A,A&4032&&(w>>=6,A>>=6),A&63){var A=void 0,z=w&7;switch((w&56)>>3){case 0:v=vd(z);break; +case 1:v="@"+vd(z);break;case 2:7>z?v="("+vd(z)+")+":(A=q.pa(p,2),v="#"+W(q,A));break;case 3:7>z?v="@("+vd(z)+")+":(A=q.pa(p,2),v="@#"+W(q,A));break;case 4:v="-("+vd(z)+")";break;case 5:v="@-("+vd(z)+")";break;case 6:A=q.pa(p,2);v=W(q,A)+"("+vd(z)+")";7==z&&(v=[v,W(q,A+p.D&65535)]);break;case 7:A=q.pa(p,2),v="@"+W(q,A)+"("+vd(z)+")",7==z&&(v=[v,W(q,A+p.D&65535)])}}q=v;if(!q||!q.length){g="INVALID";break}"string"!=typeof q&&(d||(d=q[1]),q=q[0]);0a?"R"+a:6==a?"SP":"PC"}function Vd(a,b){var d="",c=a.f;8>b?(d=vd(b),d+="="+W(a,c.b[b])):13>b?d="A"+(b-8)+"="+W(a,c.ab[b-8]):16<=b&&20>b?d="S"+(b-16)+"="+W(a,c.Aa[b-16]):20==b&&(d="PS="+W(a,Ec(c)));d&&(d+=" ");return d}m.nb=function(a,b){return a[0]>b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Hb;if(e>=h&&ee;e++)f+=Vd(a,e);f=f+"\n"+(Vd(a,6)+Vd(a,7));f+=Ud(a,"T")+Ud(a,"N")+Ud(a,"Z")+Ud(a,"V")+Ud(a,"C");a.g(f);d&&(a.P=X(c.b[7]),od(a,W(a,a.P.D)))}}function $d(a,b){b=qa(b);var d=b.match(/^(['"])(.*?)\1$/);d?a.g(d[2]):Wc(a,b,!0)} +function ae(a,b,d){var c="t"!=b;d=Yc(a,d,null,!0)||1;var e=1==d?0:1;"tc"==b&&(e=d,d=1);Ja(d,function(){return pb(a,!0)&&a.La(e,c,!1)},function(){H(a.f);pb(a,!1)})} +function od(a,b,d,c){if(b=Z(a,b,!0)){void 0===c&&(c=1);var e=256;if(void 0!==d){c=Z(a,d,!0);if(!c||c.Dg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=ud(a,b,h,f);a.g(f);a.P=b;e-=b.D-k;d++}}} +function td(a,b,d){var c=!0;try{b.length&&"end"!=b?d||a.g(">> "+b):(a.V&&(a.g("ended assemble at "+W(a,a.U.D)),a.P=a.U,a.V=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(rb(a)&&0l||"z"da.length&&(a.g("note: only "+da.length+" available"),R=da.length);M-=R;0>M&&(null==da[da.length-1].D?(R=M+R,M=0):M+=da.length);var sc=[];"call"==Bd&&(Ga=1E5,sc=["CALL"]);for(void 0!==Ad&&a.g(R+" instructions earlier:");0=da.length&&(M=0);a.Ea=R;Dd++;Ga--}}Dd||(a.g("no "+Cd+ +"history available"),a.Ea=void 0)}else{var Eb=Z(a,ba);if(Eb){var Fb=0;ra&&("l"==ra.charAt(0)&&(ra=ra.substr(1)||ue),Fb=Yc(a,ra)>>>0,65536>4||1;we--&&0Jb?String.fromCharCode(Jb):".";Hb--}sa&&(sa+="\n");sa+=ba+" "+eb+(0==db?" "+uc: +"")}sa&&a.g(sa);a.Da=Eb}}}}break;case "e":if("else"==f[0])break;var Kb=1,Gd=255,Hd=a.Sa,Id=a.bb;"ew"==f[0]&&(Kb=2,Gd=65535,Hd=a.pa,Id=a.ib);var Jd=Kb<<1,Kd=f[1];if(null==Kd)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var Lb=Z(a,Kd);if(Lb)for(var Mb=2;Mbyc;){for(var ta=null,Ae=256;65536>hb.D>>>0;){Md.D=a.pa(hb,2);if(null==hb.D||!Ae--)break;for(var Be=a,Nb=Md,Nd=null,ib=Nb.D,Od=ib,zc=1;6>=zc&&ib;zc++){if(2\nLicense: GPL version 3 or later ");this.g("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bee){if(ge(c,this.O)){this.J=new I(this,"1.30.0","failsafe");ge(this.J)&&(me(this,c),a=2,ne(this.J));J(this.J,"timestamp",wa());oe(this.J);var e=this.u&&!this.L;if(1==a||ya("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(d=ke(c)){var f=le(c,"code"),h=le(c,"data");f&&("ok"==f?ge(c,h):("error"==f&& +"no machine state"!=h?(this.ea("Error: "+h),"unable to verify user"==h&&(Ha("user",""),this.B=null)):this.g(f+": "+h),ne(c),ge(c)?(d=ke(c),e=!0):d=!1))}e&&je(this,d?c:null)}else 2==a&&c.clear()}else je(this);delete this.O;delete this.P}e=bb(this.id);for(f=0;fa[1];a=a[2];this.Z=!0;this.A.$=!0;var c=this.K.power;c&&(c.textContent="Shutdown");this.f&&(pe(this,this.f,b,d,a),this.f.Pa());this.U&&(me(this,b),b.clear());!d&&this.J&&(this.J.clear(),delete this.J);this.G=0}; +function me(a,b){if(ya("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.B||"",c=b.toString(),e={app:"PDP11js",ver:"1.30.0"};e.url=a.Y;e.user=d;e.type="bug";e.data=c;xa("http://www.pcjs.org/api/v1/report",e,!0)}} +function be(a,b,d){var c,e="none";if(a.G)return null;a.G--;var f=new I(a,"1.30.0"),h=new I(a,"1.30.0","validate"),g=wa();J(h,"timestamp",g);J(f,"timestamp",g);J(f,"version","1.30.0");J(f,"url",window?window.location.href:null);J(f,"browser",window?window.navigator.userAgent:"");a.f&&a.f.sa&&(d&&a.f.ca(),c=a.f.sa(b,d),"object"===typeof c&&J(f,a.f.id,c),d&&(a.f.A.$=!1,!1===c&&(e=null)));for(var g=bb(a.id),k=0;kg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);c?"}"==c.slice(-1)?(c=c.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+d+"$2"+(c?" parms='"+c+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDP11js$2"), -a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){g=null,a=p.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=c[2];b("Loading "+e+"...");xa(e,null,!0,function(f,h,g){if(g||!h)d(a,"unable to resolve XML reference: "+c[0]+" ("+g+")");else{if(f=c[3])if(g=h.match(new RegExp("<"+c[1]+"[^>]*>"))){for(var k=g[0],l,n=/( [a-z]+=)(['"])(.*?)\2/g;l=n.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{d(a,"missing <"+c[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(c[0],h);Ge(a,b,d)}})}else d(a,null)} -function He(a,b,d,c){function e(a){if(void 0===g){var b=h&&C(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=oa(a))}function f(a){e("Error: "+a);k&&(--se||Sa(!0));k=!1}var h,g,k=!0;se++;$a[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],p=document.createElement("style");p.type="text/css";p.styleSheet?p.styleSheet.cssText=l:p.appendChild(document.createTextNode(l));n.appendChild(p)}d|| -(d="/versions/pdp11/1.30.0/components.xsl");l=function(c,g){g?Ee(d,null,null,!1,e,function(c,k){if(k)if(ab(a,d,c),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--se||Sa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--se||Sa(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(c)}):f(c)};"<"!=b.charAt(0)?Ee(b,a,c,!0,e,l):Fe(b,null,a,c,!1,e,l)}else f("missing machine element: "+a)}catch(q){f(q.message)}return k}window.embedPDP11=function(a,b,d,c){Sa(!1);return He(a,b,d,c)};window.enableEvents=Sa;window.sendEvent=Ta;})(); +m.ha=function(a,b,d){var c=this;switch(b){case "power":return this.K[b]=d,d.onclick=function(){c.G||(c.A.$?be(c,!1,!0):ie(c,c.Va))},!0;case "reset":return this.K[b]=d,d.onclick=function(){if(c.A.$&&!c.G)if(c.u&&!c.N){var a=ya("Click OK to save changes to this PDP11js machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");be(c,a,!0);!a&&c.T?window&&window.location.reload():c.Va(ee)}else c.reset(),c.f&&c.f.Pa()},!0;case "save":if(la()){d.parentNode.removeChild(d);break}this.K[b]= +d;d.onclick=function(){var a=fe(c,!0);if(a){var b=!!(c.u&&!c.N||c.T),d=be(c,b);b?qe(c,a,d):c.ea("Resume disabled, machine state not saved")}};return!0}return!1}; +function fe(a,b){var d=a.B;d||(d=Ba("user"),void 0!==d?!d&&b&&(d=null,window&&(d=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),d&&((d=re(a,d))||a.ea("The user ID is invalid."))):b&&a.ea("Browser local storage is not available"));return d} +function re(a,b){a.B=null;var d=xa(ma()+"/api/v1/user?req=verify&user="+b),c=d[1];if(!d[0]&&c)try{d=eval("("+c+")"),d.code&&"ok"==d.code&&(Ha("user",d.data),a.B=d.data)}catch(e){t(e.message+" ("+c+")")}return a.B}function he(a){var b=null;a.B&&(b=ma()+"/api/v1/user?req=load&user="+a.B+"&state="+se(a,"1.30.0"));return b} +function qe(a,b,d){if(d){var c={req:"store"};c.user=b;c.state=se(a,"1.30.0");c.data=d;b=xa(ma()+"/api/v1/user",c);c=b[0];if(b[1]){if(c){var e=c.indexOf("\n");0g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);c?"}"==c.slice(-1)?(c=c.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+d+"$2"+(c?" parms='"+c+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDP11js$2"), +a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){g=null,a=p.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=c[2];b("Loading "+e+"...");xa(e,null,!0,function(f,h,g){if(g||!h)d(a,"unable to resolve XML reference: "+c[0]+" ("+g+")");else{if(f=c[3])if(g=h.match(new RegExp("<"+c[1]+"[^>]*>"))){for(var k=g[0],l,n=/( [a-z]+=)(['"])(.*?)\2/g;l=n.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{d(a,"missing <"+c[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(c[0],h);He(a,b,d)}})}else d(a,null)} +function Ie(a,b,d,c){function e(a){if(void 0===g){var b=h&&C(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=oa(a))}function f(a){e("Error: "+a);k&&(--te||Sa(!0));k=!1}var h,g,k=!0;te++;$a[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],p=document.createElement("style");p.type="text/css";p.styleSheet?p.styleSheet.cssText=l:p.appendChild(document.createTextNode(l));n.appendChild(p)}d|| +(d="/versions/pdp11/1.30.0/components.xsl");l=function(c,g){g?Fe(d,null,null,!1,e,function(c,k){if(k)if(ab(a,d,c),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--te||Sa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--te||Sa(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(c)}):f(c)};"<"!=b.charAt(0)?Fe(b,a,c,!0,e,l):Ge(b,null,a,c,!1,e,l)}else f("missing machine element: "+a)}catch(q){f(q.message)}return k}window.embedPDP11=function(a,b,d,c){Sa(!1);return Ie(a,b,d,c)};window.enableEvents=Sa;window.sendEvent=Ta;})(); diff --git a/versions/pdp11/1.30.0/pdp11.js b/versions/pdp11/1.30.0/pdp11.js index d65efed91..dcae511b4 100644 --- a/versions/pdp11/1.30.0/pdp11.js +++ b/versions/pdp11/1.30.0/pdp11.js @@ -1,114 +1,118 @@ -(function(){var m; +(function(){var l; function aa(a){var b=16,c;if(a){b||(b=10);var d=a.charAt(0),f=0=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 fa(a){return a.replace(/[&<>"']/g,function(a){return ea[a]})}var q=Date.now||function(){return+new Date}; -function ga(){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,h=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)}),h;var g=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(g.onreadystatechange=function(){4===g.readyState&&(e=g.responseText,200==g.status||!g.status&&e.length&&"file:"==(window?window.location.protocol:"file:")||(f=g.status||-1),d&&d(a,e,f))});if(b&&"object"== -typeof b){var k="",l;for(l in b)b.hasOwnProperty(l)&&(k&&(k+="&"),k+=l+"="+encodeURIComponent(b[l]));k=k.replace(/%20/g,"+");g.open("POST",a,!!c);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!c),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();c||(e=g.responseText,200!=g.status&&(f=g.status||-1),d&&d(a,e,f),h=[e,f]);return h}function p(){return"http://"+(window?window.location.host:"www.pcjs.org")} -function t(a){window&&window.alert(a)}function ha(a){var b=!1;window&&(b=window.confirm(a));return b}var ia=null;function ja(){if(null==ia){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}ia=a}return ia}function ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} -function la(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function ma(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:[]},na=!1,oa=!1,pa=!0;function qa(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 ra(a){if(pa)try{for(var b=0;bb?this.ta=this.id:(this.La=this.id.substr(0,b),this.ta=this.id.substr(b+1));this[a]=c;this.h={ready:!1,ha:!1,ua:!1,A:!1,error:!1};this.qa=null;this.h.error=!1;this.o={};this.B=null;x.push(this)}var ua=void 0,va={}; -if(window){ua||(ua=window.location.search.substr(1));for(var wa,xa=/\+/g,ya=/([^&=]+)=?([^&]*)/g;wa=ya.exec(ua);)va[decodeURIComponent(wa[1].replace(xa," "))]=decodeURIComponent(wa[2].replace(xa," "))}function za(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} -function y(a,b){b||(b=w);a.prototype=za(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Aa=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else Aa={},x=[];function Ba(a,b,c){Aa[a]&&b&&(Aa[a][b]=c)}function A(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b":">",'"':""","'":"'"};function fa(a){return a.replace(/[&<>"']/g,function(a){return ea[a]})}var ga=Date.now||function(){return+new Date}; +function ha(){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 q(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 p(){return"http://"+(window?window.location.host:"www.pcjs.org")} +function r(a){window&&window.alert(a)}function ia(a){var b=!1;window&&(b=window.confirm(a));return b}var ja=null;function ka(){if(null==ja){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}ja=a}return ja}function la(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b} +function ma(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function na(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var t={init:[],show:[],exit:[]},oa=!1,pa=!1,qa=!0;function ra(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function v(a){t.init.push(a)} +function sa(a){if(qa)try{for(var b=0;bb?this.wa=this.id:(this.Oa=this.id.substr(0,b),this.wa=this.id.substr(b+1));this[a]=c;this.h={ready:!1,ia:!1,xa:!1,B:!1,error:!1};this.ta=null;this.h.error=!1;this.o={};this.w=null;x.push(this)}var va=void 0,wa={}; +if(window){va||(va=window.location.search.substr(1));for(var xa,ya=/\+/g,za=/([^&=]+)=?([^&]*)/g;xa=za.exec(va);)wa[decodeURIComponent(xa[1].replace(ya," "))]=decodeURIComponent(xa[2].replace(ya," "))}function Aa(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} +function y(a,b){b||(b=w);a.prototype=Aa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Ba=window.PCjs.Machines||(window.PCjs.Machines={}),x=window.PCjs.Components||(window.PCjs.Components=[])}else Ba={},x=[];function Ca(a,b,c){Ba[a]&&b&&(Ba[a][b]=c)}function z(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b=this.g?10:20>=this.g?12:24>=this.g?14:15;this.c=1<>2;this.m=this.c-1;this.i=this.j/this.c|0;a=new F;Ja(a,this.B);this.b=Array(this.i);for(b=0;b>>a.f;0e&&(l=e);if(g&&g.size){if(g.type==d){if(f+e<=g.fa)return g.ra+=g.fa-f,g.fa=f,!0;if(f>=g.fa+g.ra){l=g.size-(f-k);l>e&&(l=e);g.ra=f-g.fa+l;f=k+a.c;e-=l;h++;continue}}return La(1,f,e)}f=new F(f,l,a.c,d);Ja(f,a.B,g);a.b[h++]=f;f=k+a.c;e-=l}return 0>=e?(a.status(Math.floor(c/1024)+"Kb "+Ma[d]+" at "+n(b,8,!0)),!0):La(2,b,c)} -function La(a,b,c){t("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Na;if(Fa){var Oa=new ArrayBuffer(2);(new DataView(Oa)).setUint16(0,256,!0);Na=256===(new Uint16Array(Oa))[0]}else Na=!1;var Pa=Na; -function F(a,b,c,d){this.id=Qa+=2;this.a=null;this.fa=a;this.ra=b;this.size=c||0;this.type=d||Ra;this.o=d==Sa;Ja(this);this.W=this.Wa=!1;if(c)if(Fa)this.c=new ArrayBuffer(c),this.f=new DataView(this.c,0,c),this.b=new Uint8Array(this.c,0,c),this.j=new Uint16Array(this.c,0,c>>1),this.a=new Int32Array(this.c,0,c>>2),Ta(this,Pa?Ua:Va);else{this.a=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},G:function(a){return this.a[a>> -2]>>>((a&3)<<3)&255},P: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},U:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<>2,d=(a&3)<<3;24>d?this.a[c]=this.a[c]&~(65535<>8);this.W=!0},C:function(a,b){return this.D(a,b)},J:function(a,b){return this.N(a,b)},S:function(a,b,c){this.o||this.Ua(a,b,c)},Z:function(a,b,c){this.o|| -this.aa(a,b,c)},v:function(a){return this.b[a]},F:function(a){return this.b[a]},I:function(a){return this.f.getUint16(a,!0)},O:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.j[a>>1]},R:function(a,b){this.b[a]=b;this.W=!0},T:function(a,b){this.b[a]=b;this.W=!0},V:function(a,b){this.f.setUint16(a,b,!0);this.W=!0},ba:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.j[a>>1]=b;this.W=!0}};function Ja(a,b,c){a.B=b;a.g=a.i=0;c&&((a.g=c.g)&&Xa(a,Ya,!1),(a.i=c.i)&&Za(a,Ya,!1))} -function Za(a,b,c){c&&a.i||(a.u=!a.o&&b[2]||a.s);if(c||void 0===c)a.Ua=b[2]||a.s,a.aa=b[3]||a.$}function Xa(a,b,c){c&&a.g||(a.l=b[0]||a.m);if(c||void 0===c)a.D=b[0]||a.m,a.N=b[1]||a.K}function Ta(a,b){b||(b=$a);Xa(a,b,void 0);Za(a,b,void 0)}var $a=[],Wa=[F.prototype.G,F.prototype.P,F.prototype.U,F.prototype.ca],Ya=[F.prototype.C,F.prototype.J,F.prototype.S,F.prototype.Z];if(Fa)var Va=[F.prototype.v,F.prototype.I,F.prototype.R,F.prototype.V],Ua=[F.prototype.F,F.prototype.O,F.prototype.T,F.prototype.ba]; -function ab(a,b){w.call(this,"CPU",a,ab);var c=a.multiplier||1;this.Aa=a.cycles||b;this.T=c;this.va=Math.round(this.Aa/1E4)/100;this.R=this.va*this.T;this.h.M=!1;this.h.Sa=!1;this.h.ga=a.autoStart;this.h.Ga=!1;this.h.pa=!1;this.na=this.S=0;this.oa=a.csStart;this.$=a.csInterval;this.aa=a.csStop;this.ka=[];this.Za=this.Ea.bind(this);E(this)}y(ab);var bb=["power","reset"];m=ab.prototype; -m.ea=function(a,b,c,d){this.l=a;this.u=b;this.B=d;for(b=0;ba.I/a.R&&(b=1);a.T=b;var c=a.va*a.T;if(a.R!=c){a.R=c;var c=a.R.toFixed(2)+"Mhz",d=a.o.setSpeed;d&&(d.textContent=c);a.H("target speed: "+c)}}ib(a,a.F);a.F=0;a.D=q();a.J=0;jb(a)}function lb(a){a.K-=a.G;a.G=0} -m.Ea=function(){if(Da(this,!0)){if(!this.h.M){hb(this);this.l&&this.l.start(this.D,kb(this));this.h.M=!0;this.h.Sa=!0;this.Z&&this.Z.start();var a=this.o.run;a&&(a.textContent="Halt");this.l&&this.l.da(!0)}this.Ba>=this.Aa&&jb(this,!0);this.ca=0;this.ma=q();this.J&&(a=this.ma-this.J,a>this.Pa&&(this.D+=a,this.D>this.ma&&(this.D=this.ma)));try{do{for(var b=this.h.pa?1:this.ja,c=this.ka.length-1;0<=c;c--){var d=this.ka[c];0>d[0]||b>d[0]&&(b=d[0])}this.Ta(b);for(var f=this.K-this.G,a=f,e=this.ka.length- -1;0<=e;e--){var h=this.ka[e];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.ca+=f;this.F+=f;ib(this,0,!0);a=f;if(this.h.pa){var g=!1;this.na=this.na+this.Ia()|0;this.S-=a;0>=this.S&&(this.S+=this.$,g=!0);0<=this.aa&&this.aa<=kb(this)&&(this.$=this.aa=-1,eb(this),G(this),g=!0);g&&this.H(kb(this)+" cycles: checksum="+n(this.na))}this.ba-=f;if(0>=this.ba){this.ba+=this.ja;15<=++this.Qa&&(this.l&&this.l.da(),this.Qa=0);break}}while(this.h.M)}catch(k){G(this);fb(this);this.l&&this.l.stop(q(),kb(this)); -Da(this,!1);b=k.stack||k.message;this.h.error=!0;this.w(b);return}b=setTimeout;c=this.Za;this.J=q();d=this.Pa;this.ca&&(d=Math.round(d*this.ca/this.ja));d=d-(this.J-this.ma);if(f=this.J-this.D)this.I=Math.round(this.F/(10*f))/100,864E5<=f&&(this.N=0,hb(this));if(0>d||this.Id&&(this.D-=d),d=0;this.Ba+=this.ca;this.J+=d;b(c,d)}else fb(this),this.l&&this.l.stop(q(),kb(this))};m.Ta=function(){return 0}; -function G(a){a.h.ha&&(a.h.ua=!0);lb(a);ib(a,a.F);a.F=0;if(a.h.M){a.h.M=!1;a.Z&&a.Z.stop();var b=a.o.run;b&&(b.textContent="Run")}a.h.complete=void 0}function fb(a){a.l&&a.l.da(void 0)} -function mb(a){this.Ya=+a.model||1170;this.ab=a.resetAddr||0;ab.call(this,a,1E6);this.Ja=0;this.g=65536;this.c=32768;this.f=65535;this.b=32768;this.i=15;this.a=[0,0,0,0,0,0,0,0];this.Ca=[0,0,0,0,0,0];this.U=[0,0,0,0];this.memory=[];this.s=[];this.Da=this.Ra=0;this.O=2;this.P=255;this.m=0;this.V=-1;this.Oa=this.xa=this.Na=this.j=this.sa=this.C=this.v=0;this.la=[7,7,7,7];this.za=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.bb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.h.complete=this.h.Va=!1}y(mb,ab);m=mb.prototype;m.reset=function(){this.h.M&&G(this);nb(this);db(this);this.h.error=!1;this.parent.reset.call(this)}; -function nb(a){a.a[7]=a.ab;a.P=255;a.s=[];a.Ra=0;a.v=a.C=a.sa=a.Na=0;a.la[0]=a.la[1]=a.la[3]=7;a.xa=0}m.Ia=function(){return 0};m.save=function(){var a=new H(this);I(a,0,[]);I(a,1,[this.Ma,this.N,this.T]);for(var b=this.u,c=0,d=[],f=0;f>12&8|(this.f&65535?0:4)|(this.c&32768?2:0)|(this.g&65536?1:0),gb(this,"PSW",a,4),gb(this,"NF",a&8?1:0,1),gb(this,"ZF",a&4?1:0,1),gb(this,"VF",a&2?1:0,1),gb(this,"CF",a&1?1:0,1));if(a=this.o.speed)a.textContent=this.h.M&&this.I?this.I.toFixed(2)+"Mhz":"Stopped"}; -function ob(a,b){a.b=b<<12;a.f=~b&4;a.c=b<<14;a.g=b<<16;if((b^a.i)&2048)for(var c=a.Ca.length;0<=--c;){var d=a.a[c];a.a[c]=a.Ca[c];a.Ca[c]=d}a.j=b>>14&3;c=a.i>>14&3;a.j!=c&&(a.U[c]=a.a[6],a.a[6]=a.U[a.j]);a.O=2;a.i=b} -function J(a,b){var c,d,f=0;0>a.V?a.V=a.i=a.i&63728|a.b>>12&8|(a.f&65535?0:4)|(a.c&32768?2:0)|(a.g&65536?1:0):a.j||(b=4,f=1);a.v&57344||(a.C=63222);a.j=0;0<=(c=K(a,b|65536))&&0<=(d=K(a,b+2&65535|65536))&&(ob(a,d&53247|a.V>>2&12288),f&&(a.a[6]=4),0<=L(a,a.V)&&0<=L(a,a.a[7])&&(a.a[7]=c));a.m=0;return a.V=-1} -function pb(a,b,c){var d,f,e,h=0;if(c&a.Na){d=b>>13&a.la[a.j];f=a.za[a.j][d];e=(a.za[a.j][d+16]<<6)+(b&8191)&4194303;if(a.sa&16){if(3932160<=e&&4186112>e){e=e&262143;var g=e>>13&31;31>g?a.sa&32&&(e=a.bb[g]+(e&8190)&4194302,3932160<=e&&4186112>e&&console.log("panic(898)")):e|=4186112}}else e&=262143,253952<=e&&(e|=4186112);if(3932160>e&&(3915776<=e||e&1&&!(c&1)))return J(a,4);switch(f&7){case 1:h=4096;case 2:f|=128;c&4&&(h=8192);break;case 4:h=4096;case 5:c&4&&(h=4096);case 6:f|=c&4?192:128;break; -default:h=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(h|=16384):(b&8128)>(f>>2&8128)&&(h|=16384));a.za[a.j][d]=f;if(4194170!==e||a.j)a.xa=a.j,a.Oa=d;if(h){if(h&57344)return 0<=a.V&&(h|=128),a.v&57344||(a.v=a.v|h|a.xa<<5|a.Oa<<1),J(a,168);a.v&61440||!(4191360>e||4194239>1]:b} -function N(a,b,c){c&=65535;return 4194304<=b?a.a[b-4194304]=c:3932160<=b?-1:0<=b?a.memory[b>>1]=c:b}function O(a,b){var c;return 4194304<=b?a.a[b-4194304]&255:3932160<=b?-1:0<=b?(c=a.memory[b>>1],b&1&&(c=c>>8),c&255):b}function P(a,b,c){c&=255;return 4194304<=b?a.a[b-4194304]=a.a[b-4194304]&65280|c:3932160<=b?-1:0<=b?b&1?a.memory[b>>1]=c<<8|a.memory[b>>1]&255:a.memory[b>>1]=a.memory[b>>1]&65280|c:b}function K(a,b){return M(a,pb(a,b,2))} -function qb(a){var b=K(a,a.a[6]|65536);0<=b&&(a.a[6]=a.a[6]+2&65535);return b}function L(a,b){var c,d;a.a[6]=d=a.a[6]-2&65535;a.v&57344||(a.C=a.C<<8|246);if(!a.j&&d<=a.P&&4>3&7){case 0:return J(a,4);case 1:if(6===e&&!a.j&&c&4&&(a.a[6]<=a.P||65534<=a.a[6])){if(a.a[6]<=a.P-32||65534<=a.a[6])return a.a[6]=4,J(a,4);a.m|=4}return 7===e?a.a[e]:a.a[e]|65536;case 2:f=2;d=a.a[e];7!==e&&(d|=65536,6>e&&c&1&&(f=1));break;case 3:f=2;d=a.a[e];7!==e&&(d|=65536);if(0>(d=K(a,d)))return d;d|=65536;break;case 4:f=-2;6>e&&c&1&&(f=-1);d=a.a[e]+f&65535;7!==e&&(d|=65536);break;case 5:f=-2;d=a.a[e]-2&65535;7!==e&&(d|=65536);if(0>(d=K(a,d)))return d; -d|=65536;break;case 6:if(0>(d=K(a,a.a[7])))return d;a.a[7]=a.a[7]+2&65535;d=d+a.a[e]&65535;return d|65536;case 7:if(0>(d=K(a,a.a[7])))return d;a.a[7]=a.a[7]+2&65535;d=d+a.a[e]&65535;return 0>(d=K(a,d|65536))?d:d|65536}a.a[e]=a.a[e]+f&65535;a.v&57344||(a.C=a.C<<8|f<<3&248|e);if(6===e&&!a.j&&c&4&&0>=f&&(a.a[6]<=a.P||65534<=a.a[6])){if(a.a[6]<=a.P-32)return a.a[6]=4,J(a,4);a.m|=4}return d}function S(a,b,c){var d;return b&56?(0<=(d=R(a,b,c))&&(d=pb(a,d,c)),d):4194304+(b&7)} -function T(a,b){var c;b&56?0<=(c=S(a,b,2))&&(c=M(a,c)):c=a.a[b&7];return c}function U(a,b){var c;b&56?0<=(c=S(a,b,3))&&(c=O(a,c)):c=a.a[b&7]&255;return c}function V(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} -m.Ta=function(a){this.h.complete=!0;this.h.Va=!1;this.h.Sa=!1;this.K=this.G=a;this.Ma&256?(lb(this),a=!1):a=!0;if(a){do{var b,c,d,f,e;if(this.O)if(1===this.O)this.O=2;else{this.O=0;e=-1;b=this.Ra&224;if(0<(a=this.s.length))for(;0b&&(b=this.s[a].Xa,e=a)}b>(this.i&224)&&(0>e?J(this,160):(J(this,this.s[e].cb),this.s.splice(e,1)))}this.v&57344||(this.C= -0);this.m=this.i&16;if(0<=(a=K(this,this.a[7])))switch(this.a[7]=this.a[7]+2&65535,a&61440){case 4096:0<=(b=T(this,a>>6))&&(a&56?0<=(d=S(this,a,4))&&0<=N(this,d,b)&&(this.b=this.f=b,this.c=0):(this.b=this.f=this.a[a&7]=b,this.c=0));break;case 8192:0<=(b=T(this,a>>6))&&0<=(c=T(this,a))&&(this.b=this.f=this.g=a=b-c,this.c=(b^c)&(b^a));break;case 12288:0<=(b=T(this,a>>6))&&0<=(c=T(this,a))&&(this.b=this.f=b&c,this.c=0);break;case 16384:0<=(b=T(this,a>>6))&&(a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c&~b, -0<=N(this,d,a)&&(this.b=this.f=a,this.c=0)):(this.b=this.f=a=this.a[a&7]&=~b,this.c=0));break;case 20480:0<=(b=T(this,a>>6))&&(a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c|b,0<=N(this,d,a)&&(this.b=this.f=a,this.c=0)):(this.b=this.f=a=this.a[a&7]|=b,this.c=0));break;case 24576:0<=(b=T(this,a>>6))&&(a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=b+c,0<=N(this,d,a)&&(this.b=this.f=this.g=a,this.c=(b^a)&(c^a))):(e=a&7,c=this.a[e],this.a[e]=(a=b+c)&65535,this.b=this.f=this.g=a,this.c=(b^a)&(c^a)));break;case 36864:0<= -(b=U(this,a>>6))&&(a&56?0<=(d=S(this,a,5))&&0<=P(this,d,b)&&(this.b=this.f=b<<8,this.c=0):(b&128&&(b|=65280),this.b=this.f=this.a[a&7]=b,this.c=0));break;case 40960:0<=(b=U(this,a>>6))&&0<=(c=U(this,a))&&(a=b-c,this.b=this.f=this.g=a<<8,this.c=((b^c)&(b^a))<<8);break;case 45056:0<=(b=U(this,a>>6))&&0<=(c=U(this,a))&&(this.b=this.f=(b&c)<<8,this.c=0);break;case 49152:0<=(b=U(this,a>>6))&&0<=(c=O(this,d=S(this,a,7)))&&(a=c&~b,0<=P(this,d,a)&&(this.b=this.f=a<<8,this.c=0));break;case 53248:0<=(b=U(this, -a>>6))&&0<=(c=O(this,d=S(this,a,7)))&&(a=c|b,0<=P(this,d,a)&&(this.b=this.f=a<<8,this.c=0));break;case 57344:0<=(b=T(this,a>>6))&&(a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c-b,0<=N(this,d,a)&&(this.b=this.f=this.g=a,this.c=(b^c)&(c^a))):(e=a&7,c=this.a[e],this.a[e]=(a=c-b)&65535,this.b=this.f=this.g=a,this.c=(b^c)&(c^a)));break;default:switch(a&65024){case 2048:0<=(f=R(this,a,0))&&(e=a>>6&7,0<=L(this,this.a[e])&&(this.a[e]=this.a[7],this.a[7]=f&65535));break;case 28672:0<=(b=T(this,a))&&(e=a>>6&7,b& +w.prototype={constructor:w,parent:null,toString:function(){return this.name?this.name:this.id||this.type},L:function(a,b,c){switch(b){case "clear":return this.o[b]||(this.o[b]=c,c.onclick=function(a){return function(){a.o.print&&(a.o.print.value="")}}(this)),!0;case "print":return this.o[b]||(this.za=this.o[b]=c,c.value="",this.H=function(a){return function(b,c){8192>1)+2;10>this.c&&(this.c=10);15>2;this.g=this.f-1;this.j=this.l/this.f|0;this.u=this.j-1;a=new F;Ka(a,this.w);this.b=Array(this.j);for(b=0;b>>a.c;0g&&(u=g);if(k&&k.size){if(k.type==d&&k.controller==f){if(e+g<=k.fa)return k.ua+=k.fa-e,k.fa=e,!0;if(e>=k.fa+k.ua){u=k.size-(e-m);u>g&&(u=g);k.ua=e-k.fa+u;e=m+a.f;g-=u;h++;continue}}return Na(1,e,g)}e=new F(e,u,a.f,d,f);Ka(e,a.w,k);a.b[h++]=e;e=m+a.f;g-=u}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Oa[d]+" at "+n(b,8,!0)),!0):Na(2,b,c)} +function Na(a,b,c){r("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Pa;if(Ga){var Qa=new ArrayBuffer(2);(new DataView(Qa)).setUint16(0,256,!0);Pa=256===(new Uint16Array(Qa))[0]}else Pa=!1;var Ra=Pa; +function F(a,b,c,d,f){this.id=Sa+=2;this.a=null;this.fa=a;this.ua=b;this.size=c||0;this.type=d||Ta;this.g=d==Ua;this.controller=null;Ka(this);this.W=this.Za=!1;if(c)if(f)this.controller=f,this.a=null,Va(this,f.ga);else if(Ga)this.c=new ArrayBuffer(c),this.f=new DataView(this.c,0,c),this.b=new Uint8Array(this.c,0,c),this.j=new Uint16Array(this.c,0,c>>1),this.a=new Int32Array(this.c,0,c>>2),Va(this,Ra?Wa:Xa);else{this.a=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},G:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},O: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},T:function(a,b){var c=a>>2,d=(a&3)<<3;this.a[c]=this.a[c]&~(255<>2,d=(a&3)<<3;24>d?this.a[c]=this.a[c]&~(65535<>8);this.W=!0},C:function(a,b){return this.D(a,b)},J:function(a,b){return this.K(a, +b)},R:function(a,b,c){this.g||this.Xa(a,b,c)},V:function(a,b,c){this.g||this.Z(a,b,c)},v:function(a){return this.b[a]},F:function(a){return this.b[a]},I:function(a){return this.f.getUint16(a,!0)},N:function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.j[a>>1]},P:function(a,b){this.b[a]=b;this.W=!0},S:function(a,b){this.b[a]=b;this.W=!0},U:function(a,b){this.f.setUint16(a,b,!0);this.W=!0},$:function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.j[a>>1]=b;this.W=!0}}; +function Ka(a,b,c){a.w=b;a.i=a.o=0;c&&((a.i=c.i)&&Za(a,$a,!1),(a.o=c.o)&&ab(a,$a,!1))}function ab(a,b,c){c&&a.o||(a.la=!a.g&&b[2]||a.m,a.lb=!a.g&&b[3]||a.u);if(c||void 0===c)a.Xa=b[2]||a.m,a.Z=b[3]||a.u}function Za(a,b,c){c&&a.i||(a.ka=b[0]||a.s,a.cb=b[1]||a.l);if(c||void 0===c)a.D=b[0]||a.s,a.K=b[1]||a.l}function Va(a,b){b||(b=bb);Za(a,b,void 0);ab(a,b,void 0)}var bb=[],Ya=[F.prototype.G,F.prototype.O,F.prototype.T,F.prototype.aa],$a=[F.prototype.C,F.prototype.J,F.prototype.R,F.prototype.V]; +if(Ga)var Xa=[F.prototype.v,F.prototype.I,F.prototype.P,F.prototype.U],Wa=[F.prototype.F,F.prototype.N,F.prototype.S,F.prototype.$];function cb(a,b){w.call(this,"CPU",a,cb);var c=a.multiplier||1;this.Da=a.cycles||b;this.T=c;this.ya=Math.round(this.Da/1E4)/100;this.R=this.ya*this.T;this.h.M=!1;this.h.Va=!1;this.h.ha=a.autoStart;this.h.Ja=!1;this.h.sa=!1;this.qa=this.S=0;this.ra=a.csStart;this.$=a.csInterval;this.aa=a.csStop;this.na=[];this.fb=this.Ha.bind(this);E(this)}y(cb);var db=["power","reset"]; +l=cb.prototype;l.ca=function(a,b,c,d){this.l=a;this.s=b;this.w=d;for(b=0;b>=3;d=""+f}else d=n(c,d);else d="--------".substr(0,d||4);a.o[b].textContent!=d&&(a.o[b].textContent=d)}} +l.L=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.o[b]=c;a=!0;break;case "run":this.o[b]=c;c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.h.B)a=!0;else{var b=null,c,h=z(a.id);for(c=0;ca.I/a.R&&(b=1);a.T=b;var c=a.ya*a.T;if(a.R!=c){a.R=c;var c=a.R.toFixed(2)+"Mhz",d=a.o.setSpeed;d&&(d.textContent=c);a.H("target speed: "+c)}}jb(a,a.F);a.F=0;a.D=ga();a.J=0;kb(a)}function mb(a){a.K-=a.G;a.G=0} +l.Ha=function(){if(Ea(this,!0)){if(!this.h.M){ib(this);this.l&&this.l.start(this.D,lb(this));this.h.M=!0;this.h.Va=!0;this.Z&&this.Z.start();var a=this.o.run;a&&(a.textContent="Halt");this.l&&this.l.ba(!0)}this.Ea>=this.Da&&kb(this,!0);this.ea=0;this.pa=ga();this.J&&(a=this.pa-this.J,a>this.Sa&&(this.D+=a,this.D>this.pa&&(this.D=this.pa)));try{do{for(var b=this.h.sa?1:this.ma,c=this.na.length-1;0<=c;c--){var d=this.na[c];0>d[0]||b>d[0]&&(b=d[0])}this.Wa(b);for(var f=this.K-this.G,a=f,e=this.na.length- +1;0<=e;e--){var g=this.na[e];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ea+=f;this.F+=f;jb(this,0,!0);a=f;if(this.h.sa){var h=!1;this.qa=this.qa+this.La()|0;this.S-=a;0>=this.S&&(this.S+=this.$,h=!0);0<=this.aa&&this.aa<=lb(this)&&(this.$=this.aa=-1,gb(this),H(this),h=!0);h&&this.H(lb(this)+" cycles: checksum="+n(this.qa))}this.da-=f;if(0>=this.da){this.da+=this.ma;15<=++this.Ta&&(this.l&&this.l.ba(),this.Ta=0);break}}while(this.h.M)}catch(k){H(this);hb(this);this.l&&this.l.stop(ga(),lb(this)); +Ea(this,!1);b=k.stack||k.message;this.h.error=!0;this.A(b);return}b=setTimeout;c=this.fb;this.J=ga();d=this.Sa;this.ea&&(d=Math.round(d*this.ea/this.ma));d=d-(this.J-this.pa);if(f=this.J-this.D)this.I=Math.round(this.F/(10*f))/100,864E5<=f&&(this.N=0,ib(this));if(0>d||this.Id&&(this.D-=d),d=0;this.Ea+=this.ea;this.J+=d;b(c,d)}else hb(this),this.l&&this.l.stop(ga(),lb(this))};l.Wa=function(){return 0}; +function H(a){a.h.ia&&(a.h.xa=!0);mb(a);jb(a,a.F);a.F=0;if(a.h.M){a.h.M=!1;a.Z&&a.Z.stop();var b=a.o.run;b&&(b.textContent="Run")}a.h.complete=void 0}function hb(a){a.l&&a.l.ba(void 0)} +function nb(a){this.eb=+a.model||1170;this.hb=a.resetAddr||0;cb.call(this,a,1E6);this.Ma=0;this.g=65536;this.c=32768;this.f=65535;this.b=32768;this.i=15;this.a=[0,0,0,0,0,0,0,this.hb];this.Fa=[0,0,0,0,0,0];this.U=[0,0,0,0];this.memory=[];this.u=[];this.Ga=this.Ua=0;this.O=2;this.P=255;this.m=0;this.V=-1;this.Ra=this.Aa=this.Qa=this.j=this.va=this.C=this.v=0;this.oa=[7,7,7,7];this.Ca=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.ib=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.h.complete=this.h.Ya=!1}y(nb,cb);l=nb.prototype;l.reset=function(){this.h.M&&H(this);ob(this);fb(this);this.h.error=!1;this.parent.reset.call(this)}; +function ob(a){a.P=255;a.u=[];a.Ua=0;a.v=a.C=a.va=a.Qa=0;a.oa[0]=a.oa[1]=a.oa[3]=7;a.Aa=0}l.La=function(){return 0};l.save=function(){var a=new I(this);J(a,0,[]);J(a,1,[this.Pa,this.N,this.T]);for(var b=this.s,c=0,d=[],f=0;f>14&3;c=a.i>>14&3;a.j!=c&&(a.U[c]=a.a[6],a.a[6]=a.U[a.j]);a.O=2;a.i=b} +function K(a,b){var c,d,f=0;0>a.V?a.V=a.i=a.i&63728|(a.b&32768?8:0)|(a.f&65535?0:4)|(a.c&32768?2:0)|(a.g&65536?1:0):a.j||(b=4,f=1);a.v&57344||(a.C=63222);a.j=0;0<=(c=L(a,b|65536))&&0<=(d=L(a,b+2&65535|65536))&&(pb(a,d&53247|a.V>>2&12288),f&&(a.a[6]=4),0<=M(a,a.V)&&0<=M(a,a.a[7])&&(a.a[7]=c));a.m=0;return a.V=-1} +function qb(a,b,c){var d,f,e,g=0;if(c&a.Qa){d=b>>13&a.oa[a.j];f=a.Ca[a.j][d];e=(a.Ca[a.j][d+16]<<6)+(b&8191)&4194303;if(a.va&16){if(3932160<=e&&4186112>e){e=e&262143;var h=e>>13&31;31>h?a.va&32&&(e=a.ib[h]+(e&8190)&4194302,3932160<=e&&4186112>e&&console.log("panic(898)")):e|=4186112}}else e&=262143,253952<=e&&(e|=4186112);if(3932160>e&&(3915776<=e||e&1&&!(c&1)))return K(a,4);switch(f&7){case 1:g=4096;case 2:f|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:f|=c&4?192:128;break; +default:g=32768}32512!==(f&32520)&&(f&8?f&32512&&(b&8128)<(f>>2&8128)&&(g|=16384):(b&8128)>(f>>2&8128)&&(g|=16384));a.Ca[a.j][d]=f;if(4194170!==e||a.j)a.Aa=a.j,a.Ra=d;if(g){if(g&57344)return 0<=a.V&&(g|=128),a.v&57344||(a.v=a.v|g|a.Aa<<5|a.Ra<<1),K(a,168);a.v&61440||!(4191360>e||4194239>>c.c;c=d!=c.g?c.b[f].cb(d,b):c.b[f++].ka(d,b)|c.b[f&c.u].ka(0,b+1)<<8}else c=b;return c}function O(a,b,c){c&=65535;if(4194304<=b)return a.a[b-4194304]=c;if(0<=b){a=a.s;var d=c,f=b&a.g,e=(b&a.i)>>>a.c;f!=a.g?a.b[e].lb(f,d&65535,b):(a.b[e++].la(f,d&255,b),a.b[e&a.u].la(0,d>>8&255,b+1));return c}return b} +function P(a,b){var c;4194304<=b?c=a.a[b-4194304]&255:3932160<=b?c=-1:0<=b?(c=a.s,c=c.b[(b&c.i)>>>c.c].ka(b&c.g,b)):c=b;return c}function Q(a,b,c){c&=255;return 4194304<=b?a.a[b-4194304]=a.a[b-4194304]&65280|c:3932160<=b?-1:0<=b?(a=a.s,a.b[(b&a.i)>>>a.c].la(b&a.g,c&255,b),c):b}function L(a,b){return N(a,qb(a,b,2))}function rb(a){var b=L(a,a.a[6]|65536);0<=b&&(a.a[6]=a.a[6]+2&65535);return b} +function M(a,b){var c,d;a.a[6]=d=a.a[6]-2&65535;a.v&57344||(a.C=a.C<<8|246);if(!a.j&&d<=a.P&&4>3&7){case 0:return K(a,4);case 1:if(6===e&&!a.j&&c&4&&(a.a[6]<=a.P||65534<=a.a[6])){if(a.a[6]<=a.P-32||65534<=a.a[6])return a.a[6]=4,K(a,4);a.m|=4}return 7===e?a.a[e]:a.a[e]|65536;case 2:f=2;d=a.a[e];7!==e&&(d|=65536,6>e&&c&1&&(f=1));break;case 3:f=2;d=a.a[e];7!==e&&(d|=65536);if(0>(d=L(a,d)))return d;d|=65536;break;case 4:f=-2;6>e&&c&1&&(f=-1);d=a.a[e]+f&65535;7!==e&&(d|=65536);break;case 5:f=-2;d=a.a[e]-2&65535;7!==e&&(d|=65536);if(0>(d=L(a,d)))return d; +d|=65536;break;case 6:if(0>(d=L(a,a.a[7])))return d;a.a[7]=a.a[7]+2&65535;d=d+a.a[e]&65535;return d|65536;case 7:if(0>(d=L(a,a.a[7])))return d;a.a[7]=a.a[7]+2&65535;d=d+a.a[e]&65535;return 0>(d=L(a,d|65536))?d:d|65536}a.a[e]=a.a[e]+f&65535;a.v&57344||(a.C=a.C<<8|f<<3&248|e);if(6===e&&!a.j&&c&4&&0>=f&&(a.a[6]<=a.P||65534<=a.a[6])){if(a.a[6]<=a.P-32)return a.a[6]=4,K(a,4);a.m|=4}return d}function S(a,b,c){var d;return b&56?(0<=(d=R(a,b,c))&&(d=qb(a,d,c)),d):4194304+(b&7)} +function T(a,b){var c;b&56?0<=(c=S(a,b,2))&&(c=N(a,c)):c=a.a[b&7];return c}function U(a,b){var c;b&56?0<=(c=S(a,b,3))&&(c=P(a,c)):c=a.a[b&7]&255;return c}function V(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} +l.Wa=function(a){this.h.complete=!0;this.h.Ya=!1;this.h.Va=!1;this.K=this.G=a;this.Pa&256?(mb(this),a=!1):a=!0;if(a){do{var b,c,d,f,e;if(this.O)if(1===this.O)this.O=2;else{this.O=0;e=-1;b=this.Ua&224;if(0<(a=this.u.length))for(;0b&&(b=this.u[a].$a,e=a)}b>(this.i&224)&&(0>e?K(this,160):(K(this,this.u[e].mb),this.u.splice(e,1)))}this.v&57344||(this.C= +0);this.m=this.i&16;if(0<=(a=L(this,this.a[7])))switch(this.a[7]=this.a[7]+2&65535,a&61440){case 4096:0<=(b=T(this,a>>6))&&(a&56?0<=(d=S(this,a,4))&&0<=O(this,d,b)&&(this.b=this.f=b,this.c=0):(this.b=this.f=this.a[a&7]=b,this.c=0));break;case 8192:0<=(b=T(this,a>>6))&&0<=(c=T(this,a))&&(this.b=this.f=this.g=a=b-c,this.c=(b^c)&(b^a));break;case 12288:0<=(b=T(this,a>>6))&&0<=(c=T(this,a))&&(this.b=this.f=b&c,this.c=0);break;case 16384:0<=(b=T(this,a>>6))&&(a&56?0<=(c=N(this,d=S(this,a,6)))&&(a=c&~b, +0<=O(this,d,a)&&(this.b=this.f=a,this.c=0)):(this.b=this.f=a=this.a[a&7]&=~b,this.c=0));break;case 20480:0<=(b=T(this,a>>6))&&(a&56?0<=(c=N(this,d=S(this,a,6)))&&(a=c|b,0<=O(this,d,a)&&(this.b=this.f=a,this.c=0)):(this.b=this.f=a=this.a[a&7]|=b,this.c=0));break;case 24576:0<=(b=T(this,a>>6))&&(a&56?0<=(c=N(this,d=S(this,a,6)))&&(a=b+c,0<=O(this,d,a)&&(this.b=this.f=this.g=a,this.c=(b^a)&(c^a))):(e=a&7,c=this.a[e],this.a[e]=(a=b+c)&65535,this.b=this.f=this.g=a,this.c=(b^a)&(c^a)));break;case 36864:0<= +(b=U(this,a>>6))&&(a&56?0<=(d=S(this,a,5))&&0<=Q(this,d,b)&&(this.b=this.f=b<<8,this.c=0):(b&128&&(b|=65280),this.b=this.f=this.a[a&7]=b,this.c=0));break;case 40960:0<=(b=U(this,a>>6))&&0<=(c=U(this,a))&&(a=b-c,this.b=this.f=this.g=a<<8,this.c=((b^c)&(b^a))<<8);break;case 45056:0<=(b=U(this,a>>6))&&0<=(c=U(this,a))&&(this.b=this.f=(b&c)<<8,this.c=0);break;case 49152:0<=(b=U(this,a>>6))&&0<=(c=P(this,d=S(this,a,7)))&&(a=c&~b,0<=Q(this,d,a)&&(this.b=this.f=a<<8,this.c=0));break;case 53248:0<=(b=U(this, +a>>6))&&0<=(c=P(this,d=S(this,a,7)))&&(a=c|b,0<=Q(this,d,a)&&(this.b=this.f=a<<8,this.c=0));break;case 57344:0<=(b=T(this,a>>6))&&(a&56?0<=(c=N(this,d=S(this,a,6)))&&(a=c-b,0<=O(this,d,a)&&(this.b=this.f=this.g=a,this.c=(b^c)&(c^a))):(e=a&7,c=this.a[e],this.a[e]=(a=c-b)&65535,this.b=this.f=this.g=a,this.c=(b^c)&(c^a)));break;default:switch(a&65024){case 2048:0<=(f=R(this,a,0))&&(e=a>>6&7,0<=M(this,this.a[e])&&(this.a[e]=this.a[7],this.a[7]=f&65535));break;case 28672:0<=(b=T(this,a))&&(e=a>>6&7,b& 32768&&(b|=-65536),c=this.a[e],c&32768&&(c|=-65536),a=~~(b*c),this.a[e]=a>>16&65535,this.a[e|1]=a&65535,this.b=a>>16,this.f=this.b|a,this.g=this.c=0,-32768>a||32767>6&7,c=this.a[e]<<16|this.a[e|1],this.g=this.c=0,b&32768&&(b|=-65536),a=~~(c/b),-32768<=a&&32767>=a?(this.a[e]=a&65535,this.a[e|1]=c-a*b&65535,this.f=a>>16|a,this.b=a>>16):(this.c=32768,this.f=a>>15|a,this.b=c>>16,-1===b&&65534===this.a[e]&&(this.a[e]=this.a[e|1]=1))):(this.f= this.b=0,this.c=32768,this.g=65536));break;case 29696:0<=(b=T(this,a))&&(e=a>>6&7,a=this.a[e],a&32768&&(a|=4294901760),this.g=this.c=0,b&=63,b&32?(b=64-b,16>b):b&&(16>15&65535)&&65535!==c&&(this.c=32768))),this.a[e]=a&65535,this.b=this.f=a);break;case 30208:if(0<=(b=T(this,a))){e=a>>6&7;c=this.a[e]<<16|this.a[e|1];this.g=this.c=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.a[e|1]=a&65535;this.b=a>>16;this.f=a>>16|a}break;case 30720:a&56?0<=(c=M(this,d=S(this,a,6)))&&(c^=this.a[a>>6&7],0<=N(this,d,c)&&(this.b=this.f=c,this.c=0)):(this.b=this.f=c=this.a[a&7]^=this.a[a>>6&7],this.c=0);break;case 32256:e=a>>6&7;if(this.a[e]=this.a[e]-1&65535)this.a[7]=this.a[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.a[7]=V(this.a[7], +c<>15,a<<=1,32>=32-b)c|=4294967295<>16&65535;this.a[e|1]=a&65535;this.b=a>>16;this.f=a>>16|a}break;case 30720:a&56?0<=(c=N(this,d=S(this,a,6)))&&(c^=this.a[a>>6&7],0<=O(this,d,c)&&(this.b=this.f=c,this.c=0)):(this.b=this.f=c=this.a[a&7]^=this.a[a>>6&7],this.c=0);break;case 32256:e=a>>6&7;if(this.a[e]=this.a[e]-1&65535)this.a[7]=this.a[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.a[7]=V(this.a[7], a);break;case 512:this.f&65535&&(this.a[7]=V(this.a[7],a));break;case 768:this.f&65535||(this.a[7]=V(this.a[7],a));break;case 1024:(this.b&32768)===(this.c&32768)&&(this.a[7]=V(this.a[7],a));break;case 1280:(this.b&32768)!==(this.c&32768)&&(this.a[7]=V(this.a[7],a));break;case 1536:this.f&65535&&(this.b&32768)===(this.c&32768)&&(this.a[7]=V(this.a[7],a));break;case 1792:this.f&65535&&(this.b&32768)===(this.c&32768)||(this.a[7]=V(this.a[7],a));break;case 32768:this.b&32768||(this.a[7]=V(this.a[7], -a));break;case 33280:!(this.g&65536)&&this.f&65535&&(this.a[7]=V(this.a[7],a));break;case 33024:this.b&32768&&(this.a[7]=V(this.a[7],a));break;case 33536:if(this.g&65536||!(this.f&65535))this.a[7]=V(this.a[7],a);break;case 33792:this.c&32768||(this.a[7]=V(this.a[7],a));break;case 34048:this.c&32768&&(this.a[7]=V(this.a[7],a));break;case 34304:this.g&65536||(this.a[7]=V(this.a[7],a));break;case 34560:this.g&65536&&(this.a[7]=V(this.a[7],a));break;case 34816:J(this,24);break;case 35072:J(this,28);break; -default:switch(a&65472){case 64:0<=(f=R(this,a,0))&&(this.a[7]=f&65535);break;case 192:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c<<8|c>>8,0<=N(this,d,a)&&(this.b=this.f=c&65280,this.c=this.g=0)):(e=a&7,c=this.a[e],this.a[e]=(c<<8|c>>8)&65535,this.b=this.f=c&65280,this.c=this.g=0);break;case 2560:a&56?0<=(d=S(this,a,4))&&0<=N(this,d,0)&&(this.b=this.g=this.c=this.f=0):this.b=this.g=this.c=this.f=this.a[a&7]=0;break;case 2624:0<=(c=M(this,d=S(this,a,6)))&&(a=~c,0<=N(this,d,a)&&(this.b=this.f=a,this.g= -65536,this.c=0));break;case 2688:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c+1,0<=N(this,d,a)&&(this.b=this.f=a,this.c=a&(a^c))):(e=a&7,c=this.a[e],a=c+1,this.a[e]=a&65535,this.b=this.f=a,this.c=a&(a^c));break;case 2752:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c-1,0<=N(this,d,a)&&(this.b=this.f=a,this.c=(a^c)&c)):(e=a&7,c=this.a[e],a=c-1,this.a[e]=a&65535,this.b=this.f=a,this.c=(a^c)&c);break;case 2816:0<=(c=M(this,d=S(this,a,6)))&&(a=-c,0<=N(this,d,a)&&(this.g=this.b=this.f=a,this.c=a&c));break;case 2880:0<= -(c=M(this,d=S(this,a,6)))&&(a=c+(this.g>>16&1),0<=N(this,d,a)&&(this.g=this.b=this.f=a,this.c=a&(a^c)));break;case 2944:0<=(c=M(this,d=S(this,a,6)))&&(a=c-(this.g>>16&1),0<=N(this,d,a)&&(this.g=this.b=this.f=a,this.c=(a^c)&c));break;case 3008:0<=(c=T(this,a))&&(this.b=this.f=c,this.g=this.c=0);break;case 3072:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=(this.g&65536|c)>>1,0<=N(this,d,a)&&(this.g=c<<16,this.b=this.f=a,this.c=a^this.g>>1)):(e=a&7,c=this.a[e],a=(this.g&65536|c)>>1,this.a[e]=a&65535,this.g= -c<<16,this.b=this.f=a,this.c=a^this.g>>1);break;case 3136:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c<<1|this.g>>16&1,0<=N(this,d,a)&&(this.g=this.b=this.f=a,this.c=a^c)):(e=a&7,c=this.a[e],a=c<<1|this.g>>16&1,this.a[e]=a&65535,this.g=this.b=this.f=a,this.c=a^c);break;case 3200:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c&32768|c>>1,0<=N(this,d,a)&&(this.g=c<<16,this.b=this.f=a,this.c=this.b^this.g>>1)):(e=a&7,c=this.a[e],a=c&32768|c>>1,this.a[e]=a&65535,this.g=c<<16,this.b=this.f=a,this.c=this.b^this.g>> -1);break;case 3264:a&56?0<=(c=M(this,d=S(this,a,6)))&&(a=c<<1,0<=N(this,d,a)&&(this.g=this.b=this.f=a,this.c=a^c)):(e=a&7,c=this.a[e],a=c<<1,this.a[e]=a&65535,this.g=this.b=this.f=a,this.c=a^c);break;case 3328:f=this.a[7]+((a&63)<<1)&65535;0<=(b=K(this,f|65536))&&(this.a[7]=this.a[5],this.a[5]=b,this.a[6]=f+2&65535);break;case 3392:a&56?0<=(f=R(this,a,0))&&(61440!==(this.i&61440)&&(f&=65535),this.j=this.i>>12&3,0<=(b=K(this,f))&&(this.j=this.i>>14&3,0<=L(this,b)&&(this.b=this.f=b,this.c=0))):(e=a& -7,b=6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]:this.U[this.i>>12&3],0<=L(this,b)&&(this.b=this.f=b,this.c=0));break;case 3456:0<=(c=qb(this))&&((this.v&57344||(this.C=22),a&56)?0<=(f=R(this,a,0))&&(f&=65535,this.j=this.i>>12&3,0<=(d=pb(this,f,4))&&(this.j=this.i>>14&3,0<=N(this,d,c)&&(this.b=this.f=c,this.c=0))):(e=a&7,6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]=c:this.U[this.i>>12&3]=c,this.b=this.f=c,this.c=0));break;case 3520:0<=(d=S(this,a,4))&&(a=-(this.b>>15&1),0<=N(this,d, -a)&&(this.f=a,this.c=0));break;case 35328:a&56?0<=(d=S(this,a,5))&&0<=P(this,d,0)&&(this.b=this.g=this.c=this.f=0):(this.a[a&7]&=65280,this.b=this.g=this.c=this.f=0);break;case 35392:0<=(c=O(this,d=S(this,a,7)))&&(a=~c,0<=P(this,d,a)&&(this.b=this.f=a<<8,this.g=65536,this.c=0));break;case 35456:0<=(c=O(this,d=S(this,a,7)))&&(a=c+1,0<=P(this,d,a)&&(this.b=this.f=a<<8,this.c=(a&(a^c))<<8));break;case 35520:0<=(c=O(this,d=S(this,a,7)))&&(a=c-1,0<=P(this,d,a)&&(this.b=this.f=a<<8,this.c=((a^c)&c)<<8)); -break;case 35584:0<=(c=O(this,d=S(this,a,7)))&&(a=-c,0<=P(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a&c)<<8));break;case 35648:0<=(c=O(this,d=S(this,a,7)))&&(a=c+(this.g>>16&1),0<=P(this,d,a)&&(this.b=this.f=this.g=a<<8,this.c=(a&(a^c))<<8));break;case 35712:0<=(c=O(this,d=S(this,a,7)))&&(a=c-(this.g>>16&1),0<=P(this,d,a)&&(this.b=this.f=this.g=a<<8,this.c=((a^c)&c)<<8));break;case 35776:0<=(c=U(this,a))&&(this.b=this.f=c<<8,this.g=this.c=0);break;case 35840:0<=(c=O(this,d=S(this,a,7)))&&(a=((this.g& -65536)>>8|c)>>1,0<=P(this,d,a)&&(this.g=c<<16,this.b=this.f=a<<8,this.c=this.b^this.g>>1));break;case 35904:0<=(c=O(this,d=S(this,a,7)))&&(a=c<<1|this.g>>16&1,0<=P(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a^c)<<8));break;case 35968:0<=(c=O(this,d=S(this,a,7)))&&(a=c&128|c>>1,0<=P(this,d,a)&&(this.g=c<<16,this.b=this.f=a<<8,this.c=this.b^this.g>>1));break;case 36032:0<=(c=O(this,d=S(this,a,7)))&&(a=c<<1,0<=P(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a^c)<<8));break;case 36160:a&56?0<=(f=R(this, -a,0))&&(this.j=this.i>>12&3,0<=(b=K(this,f|65536))&&(this.j=this.i>>14&3,0<=L(this,b)&&(this.b=this.f=b,this.c=0))):(e=a&7,b=6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]:this.U[this.i>>12&3],0<=L(this,b)&&(this.b=this.f=b,this.c=0));break;case 36224:0<=(c=qb(this))&&((this.v&57344||(this.C=22),a&56)?0<=(f=R(this,a,0))&&(this.j=this.i>>12&3,0<=(d=pb(this,f|65536,4))&&(this.j=this.i>>14&3,0<=N(this,d,c)&&(this.b=this.f=c,this.c=0))):(e=a&7,6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]= -c:this.U[this.i>>12&3]=c,this.b=this.f=c,this.c=0));break;default:switch(a&65528){case 128:0<=(b=qb(this))&&(e=a&7,this.a[7]=this.a[e],this.a[e]=b);break;case 152:this.i&49152||(this.i=this.i&63519|(a&7)<<5,this.O=1);break;case 160:case 168:a&1&&(this.g=0);a&2&&(this.c=0);a&4&&(this.f=1);a&8&&(this.b=0);break;case 176:case 184:a&1&&(this.g=65536);a&2&&(this.c=32768);a&4&&(this.f=0);a&8&&(this.b=32768);break;default:switch(a){case 0:49152&this.i?J(this,4):(this.Da=3,lb(this),console.log("HALT at "+ -this.a[7].toString(8)));break;case 1:e=0;if(0<(a=this.s.length))for(;0>8,0<=O(this,d,a)&&(this.b=this.f=c&65280,this.c=this.g=0)):(e=a&7,c=this.a[e],this.a[e]=(c<<8|c>>8)&65535,this.b=this.f=c&65280,this.c=this.g=0);break;case 2560:a&56?0<=(d=S(this,a,4))&&0<=O(this,d,0)&&(this.b=this.g=this.c=this.f=0):this.b=this.g=this.c=this.f=this.a[a&7]=0;break;case 2624:0<=(c=N(this,d=S(this,a,6)))&&(a=~c,0<=O(this,d,a)&&(this.b=this.f=a,this.g= +65536,this.c=0));break;case 2688:a&56?0<=(c=N(this,d=S(this,a,6)))&&(a=c+1,0<=O(this,d,a)&&(this.b=this.f=a,this.c=a&(a^c))):(e=a&7,c=this.a[e],a=c+1,this.a[e]=a&65535,this.b=this.f=a,this.c=a&(a^c));break;case 2752:a&56?0<=(c=N(this,d=S(this,a,6)))&&(a=c-1,0<=O(this,d,a)&&(this.b=this.f=a,this.c=(a^c)&c)):(e=a&7,c=this.a[e],a=c-1,this.a[e]=a&65535,this.b=this.f=a,this.c=(a^c)&c);break;case 2816:0<=(c=N(this,d=S(this,a,6)))&&(a=-c,0<=O(this,d,a)&&(this.g=this.b=this.f=a,this.c=a&c));break;case 2880:0<= +(c=N(this,d=S(this,a,6)))&&(a=c+(this.g>>16&1),0<=O(this,d,a)&&(this.g=this.b=this.f=a,this.c=a&(a^c)));break;case 2944:0<=(c=N(this,d=S(this,a,6)))&&(a=c-(this.g>>16&1),0<=O(this,d,a)&&(this.g=this.b=this.f=a,this.c=(a^c)&c));break;case 3008:0<=(c=T(this,a))&&(this.b=this.f=c,this.g=this.c=0);break;case 3072:a&56?0<=(c=N(this,d=S(this,a,6)))&&(a=(this.g&65536|c)>>1,0<=O(this,d,a)&&(this.g=c<<16,this.b=this.f=a,this.c=a^this.g>>1)):(e=a&7,c=this.a[e],a=(this.g&65536|c)>>1,this.a[e]=a&65535,this.g= +c<<16,this.b=this.f=a,this.c=a^this.g>>1);break;case 3136:a&56?0<=(c=N(this,d=S(this,a,6)))&&(a=c<<1|this.g>>16&1,0<=O(this,d,a)&&(this.g=this.b=this.f=a,this.c=a^c)):(e=a&7,c=this.a[e],a=c<<1|this.g>>16&1,this.a[e]=a&65535,this.g=this.b=this.f=a,this.c=a^c);break;case 3200:a&56?0<=(c=N(this,d=S(this,a,6)))&&(a=c&32768|c>>1,0<=O(this,d,a)&&(this.g=c<<16,this.b=this.f=a,this.c=this.b^this.g>>1)):(e=a&7,c=this.a[e],a=c&32768|c>>1,this.a[e]=a&65535,this.g=c<<16,this.b=this.f=a,this.c=this.b^this.g>> +1);break;case 3264:a&56?0<=(c=N(this,d=S(this,a,6)))&&(a=c<<1,0<=O(this,d,a)&&(this.g=this.b=this.f=a,this.c=a^c)):(e=a&7,c=this.a[e],a=c<<1,this.a[e]=a&65535,this.g=this.b=this.f=a,this.c=a^c);break;case 3328:f=this.a[7]+((a&63)<<1)&65535;0<=(b=L(this,f|65536))&&(this.a[7]=this.a[5],this.a[5]=b,this.a[6]=f+2&65535);break;case 3392:a&56?0<=(f=R(this,a,0))&&(61440!==(this.i&61440)&&(f&=65535),this.j=this.i>>12&3,0<=(b=L(this,f))&&(this.j=this.i>>14&3,0<=M(this,b)&&(this.b=this.f=b,this.c=0))):(e=a& +7,b=6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]:this.U[this.i>>12&3],0<=M(this,b)&&(this.b=this.f=b,this.c=0));break;case 3456:0<=(c=rb(this))&&((this.v&57344||(this.C=22),a&56)?0<=(f=R(this,a,0))&&(f&=65535,this.j=this.i>>12&3,0<=(d=qb(this,f,4))&&(this.j=this.i>>14&3,0<=O(this,d,c)&&(this.b=this.f=c,this.c=0))):(e=a&7,6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]=c:this.U[this.i>>12&3]=c,this.b=this.f=c,this.c=0));break;case 3520:0<=(d=S(this,a,4))&&(a=-(this.b>>15&1),0<=O(this,d, +a)&&(this.f=a,this.c=0));break;case 35328:a&56?0<=(d=S(this,a,5))&&0<=Q(this,d,0)&&(this.b=this.g=this.c=this.f=0):(this.a[a&7]&=65280,this.b=this.g=this.c=this.f=0);break;case 35392:0<=(c=P(this,d=S(this,a,7)))&&(a=~c,0<=Q(this,d,a)&&(this.b=this.f=a<<8,this.g=65536,this.c=0));break;case 35456:0<=(c=P(this,d=S(this,a,7)))&&(a=c+1,0<=Q(this,d,a)&&(this.b=this.f=a<<8,this.c=(a&(a^c))<<8));break;case 35520:0<=(c=P(this,d=S(this,a,7)))&&(a=c-1,0<=Q(this,d,a)&&(this.b=this.f=a<<8,this.c=((a^c)&c)<<8)); +break;case 35584:0<=(c=P(this,d=S(this,a,7)))&&(a=-c,0<=Q(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a&c)<<8));break;case 35648:0<=(c=P(this,d=S(this,a,7)))&&(a=c+(this.g>>16&1),0<=Q(this,d,a)&&(this.b=this.f=this.g=a<<8,this.c=(a&(a^c))<<8));break;case 35712:0<=(c=P(this,d=S(this,a,7)))&&(a=c-(this.g>>16&1),0<=Q(this,d,a)&&(this.b=this.f=this.g=a<<8,this.c=((a^c)&c)<<8));break;case 35776:0<=(c=U(this,a))&&(this.b=this.f=c<<8,this.g=this.c=0);break;case 35840:0<=(c=P(this,d=S(this,a,7)))&&(a=((this.g& +65536)>>8|c)>>1,0<=Q(this,d,a)&&(this.g=c<<16,this.b=this.f=a<<8,this.c=this.b^this.g>>1));break;case 35904:0<=(c=P(this,d=S(this,a,7)))&&(a=c<<1|this.g>>16&1,0<=Q(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a^c)<<8));break;case 35968:0<=(c=P(this,d=S(this,a,7)))&&(a=c&128|c>>1,0<=Q(this,d,a)&&(this.g=c<<16,this.b=this.f=a<<8,this.c=this.b^this.g>>1));break;case 36032:0<=(c=P(this,d=S(this,a,7)))&&(a=c<<1,0<=Q(this,d,a)&&(this.g=this.b=this.f=a<<8,this.c=(a^c)<<8));break;case 36160:a&56?0<=(f=R(this, +a,0))&&(this.j=this.i>>12&3,0<=(b=L(this,f|65536))&&(this.j=this.i>>14&3,0<=M(this,b)&&(this.b=this.f=b,this.c=0))):(e=a&7,b=6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]:this.U[this.i>>12&3],0<=M(this,b)&&(this.b=this.f=b,this.c=0));break;case 36224:0<=(c=rb(this))&&((this.v&57344||(this.C=22),a&56)?0<=(f=R(this,a,0))&&(this.j=this.i>>12&3,0<=(d=qb(this,f|65536,4))&&(this.j=this.i>>14&3,0<=O(this,d,c)&&(this.b=this.f=c,this.c=0))):(e=a&7,6!==e||(this.i>>2&12288)===(this.i&12288)?this.a[e]= +c:this.U[this.i>>12&3]=c,this.b=this.f=c,this.c=0));break;default:switch(a&65528){case 128:0<=(b=rb(this))&&(e=a&7,this.a[7]=this.a[e],this.a[e]=b);break;case 152:this.i&49152||(this.i=this.i&63519|(a&7)<<5,this.O=1);break;case 160:case 168:a&1&&(this.g=0);a&2&&(this.c=0);a&4&&(this.f=1);a&8&&(this.b=0);break;case 176:case 184:a&1&&(this.g=65536);a&2&&(this.c=32768);a&4&&(this.f=0);a&8&&(this.b=32768);break;default:switch(a){case 0:49152&this.i?K(this,4):(this.Ga=3,mb(this),console.log("HALT at "+ +this.a[7].toString(8)));break;case 1:e=0;if(0<(a=this.u.length))for(;0>8&255;else if(e=g.data)for(a.b=Array(4*e.length),h=f=0;f>8&255,a.b[h++]=e[f]>>16&255,a.b[h++]=e[f]>>24&255;else a.b=g;a.i=g.symbols;if(!a.b.length){t("Empty ROM: "+b); -return}if(1==a.b.length){t(a.b[0]);return}}catch(k){a.w("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f>>d.f].Ua(f&d.m,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.f?b.push(a.f):null!=a.f&&a.f.length&&(b=a.f);for(c=0;c>>f.f;0>>=f.f;0\nLicense: GPL version 3 or later ");this.H("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bX){if(Y(d,this.m)){this.i=new H(this,"1.30.0","failsafe");Y(this.i)&&(Cb(this,d),a=2,Db(this.i));I(this.i,"timestamp",ga());Eb(this.i);var f=this.b&&!this.j;if(1==a||ha("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=Bb(d)){var e=Z(d,"code"),h=Z(d,"data");e&&("ok"==e?Y(d,h):("error"==e&&"no machine state"!= -h?(this.w("Error: "+h),"unable to verify user"==h&&(la("user",""),this.c=null)):this.H(e+": "+h),Db(d),Y(d)?(c=Bb(d),f=!0):c=!1))}f&&Ab(this,c?d:null)}else 2==a&&d.clear()}else Ab(this);delete this.m;delete this.s}f=A(this.id);for(e=0;ea[1];a=a[2];this.K=!0;this.h.A=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(Fb(this,this.a,b,c,a),this.a.ga());this.D&&(Cb(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0}; -function Cb(a,b){if(ha("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.c||"",d=b.toString(),f={app:"PDP11js",ver:"1.30.0"};f.url=a.J;f.user=c;f.type="bug";f.data=d;r("http://www.pcjs.org/api/v1/report",f,!0)}} -function Gb(a,b,c){var d,f="none";if(a.f)return null;a.f--;var e=new H(a,"1.30.0"),h=new H(a,"1.30.0","validate"),g=ga();I(h,"timestamp",g);I(e,"timestamp",g);I(e,"version","1.30.0");I(e,"url",window?window.location.href:null);I(e,"browser",window?window.navigator.userAgent:"");a.a&&a.a.X&&(c&&G(a.a),d=a.a.X(b,c),"object"===typeof d&&I(e,a.a.id,d),c&&(a.a.h.A=!1,!1===d&&(f=null)));for(var g=A(a.id),k=0;kg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}f||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDP11js$2"), -a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));g=null;if("<"==a.charAt(0))try{f||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(z){g=null,a=z.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");r(f,null,!0,function(e,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(e=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],l,Q=/( [a-z]+=)(['"])(.*?)\2/g;l=Q.exec(e);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+f);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],h);Nb(a,b,c)}})}else c(a,null)} -function Ob(a,b,c,d){function f(a){if(void 0===g){var b=h&&D(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=fa(a))}function e(a){f("Error: "+a);k&&(--Kb||sa(!0));k=!1}var h,g,k=!0;Kb++;Aa[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var Q=document.head||document.getElementsByTagName("head")[0],z=document.createElement("style");z.type="text/css";z.styleSheet?z.styleSheet.cssText=l:z.appendChild(document.createTextNode(l));Q.appendChild(z)}c|| -(c="/versions/pdp11/1.30.0/components.xsl");l=function(d,g){g?Lb(c,null,null,!1,f,function(d,k){if(k)if(Ba(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--Kb||sa(!0)):e("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--Kb||sa(!0)):e("invalid machine element: "+ -a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser");else e(d)}):e(d)};"<"!=b.charAt(0)?Lb(b,a,d,!0,f,l):Mb(b,null,a,d,!1,f,l)}else e("missing machine element: "+a)}catch(Pb){e(Pb.message)}return k}window.embedPDP11=function(a,b,c,d){sa(!1);return Ob(a,b,c,d)};window.enableEvents=sa;window.sendEvent=ta;})(); +function sb(a,b,c,d){if(d)a.A("Unable to load system ROM (error "+d+": "+b+")");else{Ca(a.Oa,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.i=h.symbols;if(!a.b.length){r("Empty ROM: "+b); +return}if(1==a.b.length){r(a.b[0]);return}}catch(k){a.A("ROM data error: "+k.message);return}else for(b=c.replace(/\n/gm," ").replace(/ +$/,"").split(" "),a.b=Array(b.length),f=0;f>>d.c].Xa(f&d.g,a.b[c]&255,f)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.f?b.push(a.f):null!=a.f&&a.f.length&&(b=a.f);for(c=0;c>>f.c;0>>=f.c;0\nLicense: GPL version 3 or later ");this.H("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bX){if(Y(d,this.m)){this.i=new I(this,"1.30.0","failsafe");Y(this.i)&&(Db(this,d),a=2,Eb(this.i));J(this.i,"timestamp",ha());Fb(this.i);var f=this.b&&!this.j;if(1==a||ia("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(c=Cb(d)){var e=Z(d,"code"),g=Z(d,"data");e&&("ok"==e?Y(d,g):("error"==e&&"no machine state"!= +g?(this.A("Error: "+g),"unable to verify user"==g&&(ma("user",""),this.c=null)):this.H(e+": "+g),Eb(d),Y(d)?(c=Cb(d),f=!0):c=!1))}f&&Bb(this,c?d:null)}else 2==a&&d.clear()}else Bb(this);delete this.m;delete this.u}f=z(this.id);for(e=0;ea[1];a=a[2];this.K=!0;this.h.B=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(Gb(this,this.a,b,c,a),this.a.ha());this.D&&(Db(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.f=0}; +function Db(a,b){if(ia("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var c=a.c||"",d=b.toString(),f={app:"PDP11js",ver:"1.30.0"};f.url=a.J;f.user=c;f.type="bug";f.data=d;q("http://www.pcjs.org/api/v1/report",f,!0)}} +function Hb(a,b,c){var d,f="none";if(a.f)return null;a.f--;var e=new I(a,"1.30.0"),g=new I(a,"1.30.0","validate"),h=ha();J(g,"timestamp",h);J(e,"timestamp",h);J(e,"version","1.30.0");J(e,"url",window?window.location.href:null);J(e,"browser",window?window.navigator.userAgent:"");a.a&&a.a.X&&(c&&H(a.a),d=a.a.X(b,c),"object"===typeof d&&J(e,a.a.id,d),c&&(a.a.h.B=!1,!1===d&&(f=null)));for(var h=z(a.id),k=0;kh.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(h=window.location.pathname+h);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(h?' url="'+h+'"':""))}f||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDP11js$2"), +a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));h=null;if("<"==a.charAt(0))try{f||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(h=new window.ActiveXObject("Microsoft.XMLDOM"),h.async=!1,h.loadXML(a)):h=(new window.DOMParser).parseFromString(a,"text/xml")}catch(A){h=null,a=A.message}else a="unrecognized XML: "+(255/g.exec(a)){var f=d[2];b("Loading "+f+"...");q(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,u=/( [a-z]+=)(['"])(.*?)\2/g;m=u.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);Ob(a,b,c)}})}else c(a,null)} +function Pb(a,b,c,d){function f(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=fa(a))}function e(a){f("Error: "+a);k&&(--Lb||ta(!0));k=!1}var g,h,k=!0;Lb++;Ba[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var u=document.head||document.getElementsByTagName("head")[0],A=document.createElement("style");A.type="text/css";A.styleSheet?A.styleSheet.cssText=m:A.appendChild(document.createTextNode(m));u.appendChild(A)}c|| +(c="/versions/pdp11/1.30.0/components.xsl");m=function(d,h){h?Mb(c,null,null,!1,f,function(d,k){if(k)if(Ca(a,c,d),f("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=h.transformNode(k);m?(g.outerHTML=m,--Lb||ta(!0)):e("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(k),(m=m.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Lb||ta(!0)):e("invalid machine element: "+ +a):e("transformToFragment failed")):e("unable to transform XML: unsupported browser");else e(d)}):e(d)};"<"!=b.charAt(0)?Mb(b,a,d,!0,f,m):Nb(b,null,a,d,!1,f,m)}else e("missing machine element: "+a)}catch(Qb){e(Qb.message)}return k}window.embedPDP11=function(a,b,c,d){ta(!1);return Pb(a,b,c,d)};window.enableEvents=ta;window.sendEvent=ua;})();