From d8856ac8bdb165eb5f494efbbe297c7e72730d4a Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Fri, 16 Sep 2016 14:53:05 -0700 Subject: [PATCH] Making some headway on the PDP-11 debugger (finally) --- modules/pdp11/lib/debugger.js | 455 +++++++++++++++++------------ modules/shared/lib/debugger.js | 4 +- modules/shared/lib/keys.js | 5 +- modules/shared/lib/strlib.js | 3 +- versions/c1pjs/1.30.0/c1p-dbg.js | 2 +- versions/c1pjs/1.30.0/c1p.js | 10 +- versions/pdp11/1.30.0/pdp11-dbg.js | 328 ++++++++++----------- 7 files changed, 452 insertions(+), 355 deletions(-) diff --git a/modules/pdp11/lib/debugger.js b/modules/pdp11/lib/debugger.js index cc6583601..e67adbf52 100644 --- a/modules/pdp11/lib/debugger.js +++ b/modules/pdp11/lib/debugger.js @@ -195,7 +195,6 @@ if (DEBUGGER) { 'c': "clear output", 'd [#]': "dump memory", // additional syntax: d [#] [l#], where l# is a number of bytes to dump 'e [#]': "edit memory", - 'f': "frequencies", 'g [#]': "go [to #]", 'h': "halt", 'if': "eval expression", @@ -215,17 +214,41 @@ if (DEBUGGER) { }; /* - * CPU instruction ordinals + * CPU opcode ordinals */ - DebuggerPDP11.INS = { - NONE: 0 + DebuggerPDP11.OPS = { + NONE: 0, ADC: 1, ADCB: 2, ADD: 3, ASL: 4, ASLB: 5, ASR: 6, ASRB: 7, + BCC: 8, BCS: 9, BEQ: 10, BGE: 11, BGT: 12, BHI: 13, BIC: 14, BICB: 15, + BIS: 16, BISB: 17, BIT: 18, BITB: 19, BLE: 20, BLOS: 21, BLT: 22, BMI: 23, + BNE: 24, BPL: 25, BPT: 26, BR: 27, BVC: 28, BVS: 29, CCC: 30, CLC: 31, + CLCN: 32, CLCV: 32, CLCVN: 33, CLCVZ: 34, CLCZ: 35, CLCZN: 36, CLN: 37, CLR: 38, + CLRB: 40, CLV: 41, CLVN: 42, CLVZ: 43, CLVZN: 44, CLZ: 45, CLZN: 46, CMP: 47, + CMPB: 48, COM: 49, COMB: 50, DEC: 51, DECB: 52, INC: 53, INCB: 54, HALT: 55, + JMP: 56, JSR: 57, MARK: 58, MFPD: 59, MFPI: 60, MFPS: 61, MOV: 62, MOVB: 63, + MTPD: 64, MTPI: 65, MTPS: 66, NEG: 67, NEGB: 68, NOP: 69, RESET: 70, ROL: 71, + ROLB: 72, ROR: 73, RORB: 74, RTI: 75, RTS: 76, SBC: 77, SBCB: 78, SCC: 79, + SEC: 80, SECN: 81, SECV: 82, SECVN: 83, SECVZ: 84, SECZ: 85, SECZN: 86, SEN: 87, + SEV: 88, SEVN: 89, SEVZ: 90, SEVZN: 91, SEZ: 92, SEZN: 93, SUB: 94, SWAB: 95, + SXT: 96, TST: 97, TSTB: 98, WAIT: 99 }; /* - * CPU instruction names (mnemonics), indexed by CPU instruction ordinal (above) + * CPU opcode names, indexed by CPU opcode ordinal (above) */ - DebuggerPDP11.INS_NAMES = [ - "NONE" + DebuggerPDP11.OPNAMES = [ + "NONE", "ADC", "ADCB", "ADD", "ASL", "ASLB", "ASR", "ASRB", + "BCC", "BCS", "BEQ", "BGE", "BGT", "BHI", "BIC", "BICB", + "BIS", "BISB", "BIT", "BITB", "BLE", "BLOS", "BLT", "BMI", + "BNE", "BPL", "BPT", "BR", "BVC", "BVS", "CCC", "CLC", + "CLCN", "CLCV", "CLCVN", "CLCVZ", "CLCZ", "CLCZN", "CLN", "CLR", + "CLRB", "CLV", "CLVN", "CLVZ", "CLVZN", "CLZ", "CLZN", "CMP", + "CMPB", "COM", "COMB", "DEC", "DECB", "INC", "INCB", "HALT", + "JMP", "JSR", "MARK", "MFPD", "MFPI", "MFPS", "MOV", "MOVB", + "MTPD", "MTPI", "MTPS", "NEG", "NEGB", "NOP", "RESET", "ROL", + "ROLB", "ROR", "RORB", "RTI", "RTS", "SBC", "SBCB", "SCC", + "SEC", "SECN", "SECV", "SECVN", "SECVZ", "SECZ", "SECZN", "SEN", + "SEV", "SEVN", "SEVZ", "SEVZN", "SEZ", "SEZN", "SUB", "SWAB", + "SXT", "TST", "TSTB", "WAIT" ]; DebuggerPDP11.REG_PC = 0x0C; @@ -235,68 +258,152 @@ if (DEBUGGER) { "PC", "PSW" ]; - /* - * Operand type descriptor masks and definitions - */ - DebuggerPDP11.TYPE_SIZE = 0x000F; // size field - DebuggerPDP11.TYPE_MODE = 0x00F0; // mode field - DebuggerPDP11.TYPE_IREG = 0x0F00; // implied register field - DebuggerPDP11.TYPE_OTHER = 0xF000; // "other" field + DebuggerPDP11.MODE_REG = 0x0; // REGISTER (register is operand) + DebuggerPDP11.MODE_REGD = 0x1; // REGISTER DEFERRED (register is address of operand) + DebuggerPDP11.MODE_POSTINC = 0x2; // POST-INCREMENT (register is address of operand, register incremented) + DebuggerPDP11.MODE_POSTINCD = 0x3; // POST-INCREMENT DEFERRED (register is address of address of operand, register incremented) + DebuggerPDP11.MODE_PREDEC = 0x4; // PRE-DECREMENT (register decremented, register is address of operand) + DebuggerPDP11.MODE_PREDECD = 0x5; // PRE-DECREMENT DEFERRED (register decremented, register is address of address of operand) + DebuggerPDP11.MODE_INDEX = 0x6; // INDEX (register + next word is address of operand) + DebuggerPDP11.MODE_INDEXD = 0x7; // INDEX DEFERRED (register + next word is address of address of operand) /* - * TYPE_SIZE values + * Operand descriptor masks */ - DebuggerPDP11.TYPE_NONE = 0x0000; // (all other TYPE fields ignored) - DebuggerPDP11.TYPE_BYTE = 0x0001; // byte, regardless of operand size - DebuggerPDP11.TYPE_SBYTE = 0x0002; // byte sign-extended to word - DebuggerPDP11.TYPE_WORD = 0x0003; // word (16-bit value) + DebuggerPDP11.TYPE_DSTREG = 0x0007; + DebuggerPDP11.TYPE_DSTMOD = 0x0038; + DebuggerPDP11.TYPE_DST = (DebuggerPDP11.TYPE_DSTMOD | DebuggerPDP11.TYPE_DSTREG); + DebuggerPDP11.TYPE_SRCREG = 0x01C0; + DebuggerPDP11.TYPE_SRCMOD = 0x0E00; + DebuggerPDP11.TYPE_SRC = (DebuggerPDP11.TYPE_SRCMOD | DebuggerPDP11.TYPE_SRCREG); + DebuggerPDP11.TYPE_BRANCH = 0x1000; /* - * TYPE_MODE values - */ - DebuggerPDP11.TYPE_REG = 0x0010; // register - DebuggerPDP11.TYPE_IMM = 0x0020; // immediate data - DebuggerPDP11.TYPE_ADDR = 0x0033; // immediate (word) address - DebuggerPDP11.TYPE_MEM = 0x0040; // memory reference - DebuggerPDP11.TYPE_INT = 0x0080; // interrupt level encoded in instruction (bits 3-5) - - /* - * TYPE_IREG values, based on the REG_* constants. + * The opMasks table contains opcode masks, and each mask refers to table of possible values, + * and each value refers to an array that contains: * - * Note that TYPE_M isn't really a register, just an alternative form of TYPE_HL | TYPE_MEM. - */ - DebuggerPDP11.TYPE_PC = (DebuggerPDP11.REG_PC << 8 | DebuggerPDP11.TYPE_REG | DebuggerPDP11.TYPE_WORD); - DebuggerPDP11.TYPE_PSW = (DebuggerPDP11.REG_PSW<< 8 | DebuggerPDP11.TYPE_REG | DebuggerPDP11.TYPE_WORD); - - /* - * TYPE_OTHER bit definitions - */ - DebuggerPDP11.TYPE_IN = 0x1000; // operand is input - DebuggerPDP11.TYPE_OUT = 0x2000; // operand is output - DebuggerPDP11.TYPE_BOTH = (DebuggerPDP11.TYPE_IN | DebuggerPDP11.TYPE_OUT); - DebuggerPDP11.TYPE_UNDOC = 0x8000; // opcode is an undocumented alternative encoding - - /* - * The aaOpDescs array is indexed by opcode, and each element is a sub-array (aOpDesc) that describes - * the corresponding opcode. The sub-elements are as follows: - * - * [0]: {number} of the opcode name (see INS.*) - * [1]: {number} containing the destination operand descriptor bit(s), if any - * [2]: {number} containing the source operand descriptor bit(s), if any - * [3]: {number} containing the occasional third operand descriptor bit(s), if any + * [0]: {number} of the opcode name (see OP.*) + * [1]: {number} containing the first operand descriptor bit(s), if any + * [2]: {number} containing the second operand descriptor bit(s), if any * * These sub-elements are all optional. If [0] is not present, the opcode is undefined; if [1] is not * present (or contains zero), the opcode has no (or only implied) operands; if [2] is not present, the * opcode has only a single operand. And so on. - * - * Additional default rules: - * - * 1) If no TYPE_OTHER bits are specified for the first (destination) operand, TYPE_OUT is assumed; - * 2) If no TYPE_OTHER bits are specified for the second (source) operand, TYPE_IN is assumed; - * 3) If no size is specified for the second operand, the size is assumed to match the first operand. */ - DebuggerPDP11.aaOpDescs = [ - ]; + DebuggerPDP11.opMasks = { + 0xF000: { + 0x1000: [DebuggerPDP11.OPS.MOV, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0x2000: [DebuggerPDP11.OPS.CMP, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0x3000: [DebuggerPDP11.OPS.BIT, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0x4000: [DebuggerPDP11.OPS.BIC, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0x5000: [DebuggerPDP11.OPS.BIS, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0x6000: [DebuggerPDP11.OPS.ADD, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0x9000: [DebuggerPDP11.OPS.MOVB, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0xA000: [DebuggerPDP11.OPS.CMPB, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0xB000: [DebuggerPDP11.OPS.BITB, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0xC000: [DebuggerPDP11.OPS.BICB, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0xD000: [DebuggerPDP11.OPS.BISB, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST], + 0xE000: [DebuggerPDP11.OPS.SUB, DebuggerPDP11.TYPE_SRC, DebuggerPDP11.TYPE_DST] + }, + 0xFE00: { + 0x0800: [DebuggerPDP11.OPS.JSR, DebuggerPDP11.TYPE_SRCREG, DebuggerPDP11.TYPE_DST] + }, + 0xFF00: { + 0x0100: [DebuggerPDP11.OPS.BR, DebuggerPDP11.TYPE_BRANCH], + 0x0200: [DebuggerPDP11.OPS.BNE, DebuggerPDP11.TYPE_BRANCH], + 0x0300: [DebuggerPDP11.OPS.BEQ, DebuggerPDP11.TYPE_BRANCH], + 0x0400: [DebuggerPDP11.OPS.BGE, DebuggerPDP11.TYPE_BRANCH], + 0x0500: [DebuggerPDP11.OPS.BLT, DebuggerPDP11.TYPE_BRANCH], + 0x0600: [DebuggerPDP11.OPS.BGT, DebuggerPDP11.TYPE_BRANCH], + 0x0700: [DebuggerPDP11.OPS.BLE, DebuggerPDP11.TYPE_BRANCH], + 0x8000: [DebuggerPDP11.OPS.BPL, DebuggerPDP11.TYPE_BRANCH], + 0x8100: [DebuggerPDP11.OPS.BMI, DebuggerPDP11.TYPE_BRANCH], + 0x8200: [DebuggerPDP11.OPS.BHI, DebuggerPDP11.TYPE_BRANCH], + 0x8300: [DebuggerPDP11.OPS.BLOS, DebuggerPDP11.TYPE_BRANCH], + 0x8400: [DebuggerPDP11.OPS.BVC, DebuggerPDP11.TYPE_BRANCH], + 0x8500: [DebuggerPDP11.OPS.BVS, DebuggerPDP11.TYPE_BRANCH], + 0x8600: [DebuggerPDP11.OPS.BCC, DebuggerPDP11.TYPE_BRANCH], + 0x8700: [DebuggerPDP11.OPS.BCS, DebuggerPDP11.TYPE_BRANCH] + }, + 0xFFC0: { + 0x0010: [DebuggerPDP11.OPS.JMP, DebuggerPDP11.TYPE_DST], + 0x00C0: [DebuggerPDP11.OPS.SWAB, DebuggerPDP11.TYPE_DST], + 0x0480: [DebuggerPDP11.OPS.INC, DebuggerPDP11.TYPE_DST], + 0x0A00: [DebuggerPDP11.OPS.CLR, DebuggerPDP11.TYPE_DST], + 0x0A40: [DebuggerPDP11.OPS.COM, DebuggerPDP11.TYPE_DST], + 0x0AC0: [DebuggerPDP11.OPS.DEC, DebuggerPDP11.TYPE_DST], + 0x0B00: [DebuggerPDP11.OPS.NEG, DebuggerPDP11.TYPE_DST], + 0x0B40: [DebuggerPDP11.OPS.ADC, DebuggerPDP11.TYPE_DST], + 0x0B80: [DebuggerPDP11.OPS.SBC, DebuggerPDP11.TYPE_DST], + 0x0BC0: [DebuggerPDP11.OPS.TST, DebuggerPDP11.TYPE_DST], + 0x0C00: [DebuggerPDP11.OPS.ROR, DebuggerPDP11.TYPE_DST], + 0x0C40: [DebuggerPDP11.OPS.ROL, DebuggerPDP11.TYPE_DST], + 0x0C80: [DebuggerPDP11.OPS.ASR, DebuggerPDP11.TYPE_DST], + 0x0CC0: [DebuggerPDP11.OPS.ASL, DebuggerPDP11.TYPE_DST], + 0x0D00: [DebuggerPDP11.OPS.MARK, DebuggerPDP11.TYPE_DST], + 0x0D40: [DebuggerPDP11.OPS.MFPI, DebuggerPDP11.TYPE_DST], + 0x0D80: [DebuggerPDP11.OPS.MTPI, DebuggerPDP11.TYPE_DST], + 0x0DC0: [DebuggerPDP11.OPS.SXT, DebuggerPDP11.TYPE_DST], + 0x8480: [DebuggerPDP11.OPS.INCB, DebuggerPDP11.TYPE_DST], + 0x8A00: [DebuggerPDP11.OPS.CLRB, DebuggerPDP11.TYPE_DST], + 0x8A40: [DebuggerPDP11.OPS.COMB, DebuggerPDP11.TYPE_DST], + 0x8AC0: [DebuggerPDP11.OPS.DECB, DebuggerPDP11.TYPE_DST], + 0x8B00: [DebuggerPDP11.OPS.NEGB, DebuggerPDP11.TYPE_DST], + 0x8B40: [DebuggerPDP11.OPS.ADCB, DebuggerPDP11.TYPE_DST], + 0x8B80: [DebuggerPDP11.OPS.SBCB, DebuggerPDP11.TYPE_DST], + 0x8BC0: [DebuggerPDP11.OPS.TSTB, DebuggerPDP11.TYPE_DST], + 0x8C00: [DebuggerPDP11.OPS.RORB, DebuggerPDP11.TYPE_DST], + 0x8C40: [DebuggerPDP11.OPS.ROLB, DebuggerPDP11.TYPE_DST], + 0x8C80: [DebuggerPDP11.OPS.ASRB, DebuggerPDP11.TYPE_DST], + 0x8CC0: [DebuggerPDP11.OPS.ASLB, DebuggerPDP11.TYPE_DST], + 0x8D00: [DebuggerPDP11.OPS.MTPS, DebuggerPDP11.TYPE_DST], // only on LSI-11 + 0x8D40: [DebuggerPDP11.OPS.MFPD, DebuggerPDP11.TYPE_DST], // same as MFPI if no separate instruction/data spaces + 0x8D80: [DebuggerPDP11.OPS.MTPD, DebuggerPDP11.TYPE_DST], // same as MTPI if no separate instruction/data spaces + 0x8DC0: [DebuggerPDP11.OPS.MFPS, DebuggerPDP11.TYPE_DST] // only on LSI-11 + }, + 0xFFF8: { + 0x0080: [DebuggerPDP11.OPS.RTS, DebuggerPDP11.TYPE_SRCREG] + }, + 0xFFFF: { + 0x0000: [DebuggerPDP11.OPS.HALT], + 0x0001: [DebuggerPDP11.OPS.WAIT], + 0x0002: [DebuggerPDP11.OPS.RTI], + 0x0004: [DebuggerPDP11.OPS.BPT], + 0x0005: [DebuggerPDP11.OPS.RESET], + 0x00A0: [DebuggerPDP11.OPS.NOP], + 0x00A1: [DebuggerPDP11.OPS.CLC], + 0x00A2: [DebuggerPDP11.OPS.CLV], + 0x00A3: [DebuggerPDP11.OPS.CLCV], + 0x00A4: [DebuggerPDP11.OPS.CLZ], + 0x00A5: [DebuggerPDP11.OPS.CLCZ], + 0x00A6: [DebuggerPDP11.OPS.CLVZ], + 0x00A7: [DebuggerPDP11.OPS.CLCVZ], + 0x00A8: [DebuggerPDP11.OPS.CLN], + 0x00A9: [DebuggerPDP11.OPS.CLCN], + 0x00AA: [DebuggerPDP11.OPS.CLVN], + 0x00AB: [DebuggerPDP11.OPS.CLCVN], + 0x00AC: [DebuggerPDP11.OPS.CLZN], + 0x00AD: [DebuggerPDP11.OPS.CLCZN], + 0x00AE: [DebuggerPDP11.OPS.CLVZN], + 0x00AF: [DebuggerPDP11.OPS.CCC], // aka CLCVZN + 0x00B0: [DebuggerPDP11.OPS.NOP], + 0x00B1: [DebuggerPDP11.OPS.SEC], + 0x00B2: [DebuggerPDP11.OPS.SEV], + 0x00B3: [DebuggerPDP11.OPS.SECV], + 0x00B4: [DebuggerPDP11.OPS.SEZ], + 0x00B5: [DebuggerPDP11.OPS.SECZ], + 0x00B6: [DebuggerPDP11.OPS.SEVZ], + 0x00B7: [DebuggerPDP11.OPS.SECVZ], + 0x00B8: [DebuggerPDP11.OPS.SEN], + 0x00B9: [DebuggerPDP11.OPS.SECN], + 0x00BA: [DebuggerPDP11.OPS.SEVN], + 0x00BB: [DebuggerPDP11.OPS.SECVN], + 0x00BC: [DebuggerPDP11.OPS.SEZN], + 0x00BD: [DebuggerPDP11.OPS.SECZN], + 0x00BE: [DebuggerPDP11.OPS.SEVZN], + 0x00BF: [DebuggerPDP11.OPS.SCC] // aka SECVZN + } + }; DebuggerPDP11.HISTORY_LIMIT = DEBUG? 100000 : 1000; @@ -321,7 +428,7 @@ if (DEBUGGER) { var sMessages = cmp.getMachineParm('messages'); if (sMessages) this.messageInit(sMessages); - this.aaOpDescs = DebuggerPDP11.aaOpDescs; + this.opMasks = DebuggerPDP11.opMasks; this.messageDump(MessagesPDP11.BUS, function onDumpBus(asArgs) { dbg.dumpBus(asArgs); }); @@ -1492,7 +1599,7 @@ if (DEBUGGER) { * checkInstruction(addr, nState) * * This "check" function is called by the CPU to inform us about the next instruction to be executed, - * giving us an opportunity to look for "exec" breakpoints and update opcode frequencies and instruction history. + * giving us an opportunity to look for "exec" breakpoints and update opcode instruction history. * * @this {DebuggerPDP11} * @param {number} addr @@ -1520,9 +1627,8 @@ if (DEBUGGER) { */ if (nState >= 0 && this.aaOpcodeCounts.length) { this.cOpcodes++; - var bOpcode = this.bus.getByteDirect(addr); - if (bOpcode != null) { - this.aaOpcodeCounts[bOpcode][1]++; + var opCode = this.bus.getShortDirect(addr); + if (opCode != null) { var dbgAddr = this.aOpcodeHistory[this.iOpcodeHistory]; this.setAddr(dbgAddr, cpu.getPC()); if (DEBUG) dbgAddr.cycleCount = cpu.getCycles(); @@ -1804,8 +1910,8 @@ if (DEBUGGER) { DebuggerPDP11.prototype.checkBreakpoint = function(addr, nb, aBreak, fTemporary) { /* - * Time to check for execution breakpoints; note that this should be done BEFORE updating frequency - * or history data (see checkInstruction), since we might not actually execute the current instruction. + * Time to check for execution breakpoints; note that this should be done BEFORE updating + * history data (see checkInstruction), since we might not actually execute the current instruction. */ var fBreak = false; @@ -1889,6 +1995,8 @@ if (DEBUGGER) { /** * getInstruction(dbgAddr, sComment, nSequence) * + * Get the next instruction, by decoding the opcode and any operands. + * * @this {DebuggerPDP11} * @param {DbgAddrPDP11} dbgAddr * @param {string} [sComment] is an associated comment @@ -1897,72 +2005,50 @@ if (DEBUGGER) { */ DebuggerPDP11.prototype.getInstruction = function(dbgAddr, sComment, nSequence) { - var dbgAddrIns = this.newAddr(dbgAddr.addr); + var opNames = DebuggerPDP11.OPNAMES; + var dbgAddrOp = this.newAddr(dbgAddr.addr); + var opCode = this.getWord(dbgAddr, true); - var bOpcode = this.getByte(dbgAddr, 1); - - var asOpcodes = DebuggerPDP11.INS_NAMES; - var aOpDesc = this.aaOpDescs[bOpcode] || [DebuggerPDP11.INS.NONE]; - var iIns = aOpDesc[0]; + var opDesc; + for (var mask in this.opMasks) { + var opMask = this.opMasks[mask]; + var bits = opCode & mask; + opDesc = opMask[bits]; + if (opDesc) break; + } + if (!opDesc) opDesc = [DebuggerPDP11.OPS.NONE]; var sOperands = ""; - var sOpcode = asOpcodes[iIns]; - var cOperands = aOpDesc.length - 1; - var typeSizeDefault = DebuggerPDP11.TYPE_NONE, type; + var sOpName = opNames[opDesc[0]]; + var cOperands = opDesc.length - 1; for (var iOperand = 1; iOperand <= cOperands; iOperand++) { - var disp, off, cch; - var sOperand = ""; - - type = aOpDesc[iOperand]; + var type = opDesc[iOperand]; if (type === undefined) continue; - var typeMode = type & DebuggerPDP11.TYPE_MODE; - if (!typeMode) continue; - - var typeSize = type & DebuggerPDP11.TYPE_SIZE; - if (!typeSize) { - type |= typeSizeDefault; - } else { - typeSizeDefault = typeSize; - } - - var typeOther = type & DebuggerPDP11.TYPE_OTHER; - if (!typeOther) { - type |= (iOperand == 1? DebuggerPDP11.TYPE_OUT : DebuggerPDP11.TYPE_IN); - } - - if (typeMode & DebuggerPDP11.TYPE_IMM) { - sOperand = this.getImmOperand(type, dbgAddr); - } - else if (typeMode & DebuggerPDP11.TYPE_REG) { - sOperand = this.getRegOperand((type & DebuggerPDP11.TYPE_IREG) >> 8, type, dbgAddr); - } - else if (typeMode & DebuggerPDP11.TYPE_INT) { - sOperand = ((bOpcode >> 3) & 0x7).toString(); - } + var sOperand = this.getOperand(opCode, type, dbgAddr); if (!sOperand || !sOperand.length) { sOperands = "INVALID"; break; } + if (sOperands.length > 0) sOperands += ','; sOperands += (sOperand || "???"); } var sBytes = ""; - var sLine = this.toHexAddr(dbgAddrIns) + ' '; - if (dbgAddrIns.addr !== PDP11.ADDR_INVALID && dbgAddr.addr !== PDP11.ADDR_INVALID) { + var sLine = this.toHexAddr(dbgAddrOp) + ' '; + if (dbgAddrOp.addr !== PDP11.ADDR_INVALID && dbgAddr.addr !== PDP11.ADDR_INVALID) { do { - sBytes += str.toHex(this.getByte(dbgAddrIns, 1), 2); - if (dbgAddrIns.addr == null) break; - } while (dbgAddrIns.addr != dbgAddr.addr); + sBytes += str.toHex(this.getByte(dbgAddrOp, 1), 2); + if (dbgAddrOp.addr == null) break; + } while (dbgAddrOp.addr != dbgAddr.addr); } sLine += str.pad(sBytes, 10); - sLine += (type & DebuggerPDP11.TYPE_UNDOC)? '*' : ' '; - sLine += str.pad(sOpcode, 7); + sLine += str.pad(sOpName, 7); if (sOperands) sLine += ' ' + sOperands; if (sComment) { @@ -1978,35 +2064,92 @@ if (DEBUGGER) { }; /** - * getImmOperand(type, dbgAddr) + * getOperand(opCode, type, dbgAddr) * * @this {DebuggerPDP11} + * @param {number} opCode * @param {number} type * @param {DbgAddrPDP11} dbgAddr * @return {string} operand */ - DebuggerPDP11.prototype.getImmOperand = function(type, dbgAddr) + DebuggerPDP11.prototype.getOperand = function(opCode, type, dbgAddr) { - var sOperand = ' '; - var typeSize = type & DebuggerPDP11.TYPE_SIZE; - - switch (typeSize) { - case DebuggerPDP11.TYPE_BYTE: - sOperand = str.toHex(this.getByte(dbgAddr, 1), 2); - break; - case DebuggerPDP11.TYPE_SBYTE: - sOperand = str.toHex((this.getByte(dbgAddr, 1) << 24) >> 24, 4); - break; - case DebuggerPDP11.TYPE_WORD: - sOperand = str.toHex(this.getShort(dbgAddr, 2), 4); - break; - default: - return "imm(" + str.toHexWord(type) + ')'; + var sOperand = ""; + if (type & DebuggerPDP11.TYPE_BRANCH) { + var disp = ((opCode & 0xff) << 24) >> 24; + var addr = (dbgAddr.addr + disp) & 0xffff; + sOperand = str.toHexWord(addr); } - if (type & DebuggerPDP11.TYPE_MEM) { - sOperand = '[' + sOperand + ']'; - } else if (!(type & DebuggerPDP11.TYPE_REG)) { - sOperand = "0x" + sOperand; + else { + /* + * Isolate all SRC or DST bits from opcode in the mode variable. + */ + var mode = opCode & type; + /* + * Convert SRC bits into DST bits, since they use the same format. + */ + if (type & DebuggerPDP11.TYPE_SRC) { + mode >>= 6; + type >>= 6; + } + if (type & DebuggerPDP11.TYPE_DST) { + var wIndex; + var reg = mode & DebuggerPDP11.TYPE_DSTREG; + /* + * Note that opcodes that specify only REG bits in the type mask (ie, no MOD bits) + * will automatically default to MODE_REG below. + */ + switch(mode & DebuggerPDP11.TYPE_DSTMOD) { + case DebuggerPDP11.MODE_REG: // 0x0: REGISTER + sOperand = "R" + reg; + break; + case DebuggerPDP11.MODE_REGD: // 0x1: REGISTER DEFERRED + sOperand = "@R" + reg; + break; + case DebuggerPDP11.MODE_POSTINC: // 0x2: POST-INCREMENT + if (reg < 7) { + sOperand = "(R" + reg + ")+"; + } else { + /* + * When using R7 (aka PC), POST-INCREMENT is known as IMMEDIATE + */ + wIndex = this.getWord(dbgAddr, true); + sOperand = "#" + str.toHexWord(wIndex); + } + break; + case DebuggerPDP11.MODE_POSTINCD: // 0x3: POST-INCREMENT DEFERRED + if (reg < 7) { + sOperand = "@(R" + reg + ")+"; + } else { + /* + * When using R7 (aka PC), POST-INCREMENT DEFERRED is known as ABSOLUTE + */ + wIndex = this.getWord(dbgAddr, true); + sOperand = "@#" + str.toHexWord(wIndex); + } + break; + case DebuggerPDP11.MODE_PREDEC: // 0x4: PRE-DECREMENT + sOperand = "-(R" + reg + ")"; + break; + case DebuggerPDP11.MODE_PREDECD: // 0x5: PRE-DECREMENT DEFERRED + sOperand = "@-R(" + reg + ")"; + break; + case DebuggerPDP11.MODE_INDEX: // 0x6: INDEX + wIndex = this.getWord(dbgAddr, true); + /* + * When using R7 (aka PC), INDEX is known as RELATIVE + */ + sOperand = str.toHexWord(wIndex) + (reg < 7? "(R" + reg + ")" : "(PC)"); + break; + case DebuggerPDP11.MODE_INDEXD: // 0x7: INDEX DEFERRED + wIndex = this.getWord(dbgAddr, true); + /* + * When using R7 (aka PC), INDEX DEFERRED is known as RELATIVE DEFERRED + */ + sOperand = '@' + str.toHexWord(wIndex) + (reg < 7? "(R" + reg + ")" : "(PC)"); + break; + } + } } return sOperand; }; @@ -2350,7 +2493,7 @@ if (DEBUGGER) { for (var sCommand in DebuggerPDP11.COMMANDS) { s += '\n' + str.pad(sCommand, 9) + DebuggerPDP11.COMMANDS[sCommand]; } - if (!this.checksEnabled()) s += "\nnote: frequency/history disabled if no exec breakpoints"; + if (!this.checksEnabled()) s += "\nnote: history disabled if no exec breakpoints"; this.println(s); }; @@ -2702,53 +2845,6 @@ if (DEBUGGER) { } }; - /** - * doFreqs(sParm) - * - * @this {DebuggerPDP11} - * @param {string|undefined} sParm - */ - DebuggerPDP11.prototype.doFreqs = function(sParm) - { - if (sParm == '?') { - this.println("frequency commands:"); - this.println("\tclear\tclear all frequency counts"); - return; - } - var i; - var cData = 0; - if (this.aaOpcodeCounts) { - if (sParm == "clear") { - for (i = 0; i < this.aaOpcodeCounts.length; i++) - this.aaOpcodeCounts[i] = [i, 0]; - this.println("frequency data cleared"); - cData++; - } - else if (sParm !== undefined) { - this.println("unknown frequency command: " + sParm); - cData++; - } - else { - var aaSortedOpcodeCounts = this.aaOpcodeCounts.slice(); - aaSortedOpcodeCounts.sort(function(p, q) { - return q[1] - p[1]; - }); - var asOpcodes = DebuggerPDP11.INS_NAMES; - for (i = 0; i < aaSortedOpcodeCounts.length; i++) { - var bOpcode = aaSortedOpcodeCounts[i][0]; - var cFreq = aaSortedOpcodeCounts[i][1]; - if (cFreq) { - this.println((asOpcodes[this.aaOpDescs[bOpcode][0]] + " ").substr(0, 5) + " (" + str.toHexByte(bOpcode) + "): " + cFreq + " times"); - cData++; - } - } - } - } - if (!cData) { - this.println("no frequency data available"); - } - }; - /** * doHalt(fQuiet) * @@ -3515,9 +3611,6 @@ if (DEBUGGER) { if (asArgs[0] == "else") break; this.doEdit(asArgs); break; - case 'f': - this.doFreqs(asArgs[1]); - break; case 'g': this.doRun(asArgs[0], asArgs[1], sCmd, fQuiet); break; diff --git a/modules/shared/lib/debugger.js b/modules/shared/lib/debugger.js index 034099ff8..d15831ac4 100644 --- a/modules/shared/lib/debugger.js +++ b/modules/shared/lib/debugger.js @@ -108,7 +108,9 @@ function Debugger(parmsDbg) * unprefixed hex value (eg, "a5" as opposed to "0xa5") will trump the numeric value. Unprefixed * hex values are a convenience of parseValue(), which always calls str.parseInt() with a default * base of 16; however, that default be overridden with a variety of explicit prefixes or suffixes - * (eg, a leading zero to indicate octal, or a trailing period to indicate decimal). + * (eg, a leading "0o" to indicate octal, a trailing period to indicate decimal, etc.) + * + * See str.parseInt() for more details about supported numbers. */ this.aVariables = {}; diff --git a/modules/shared/lib/keys.js b/modules/shared/lib/keys.js index e1c2f2d8f..ac80f390e 100644 --- a/modules/shared/lib/keys.js +++ b/modules/shared/lib/keys.js @@ -62,13 +62,12 @@ var Keys = { * keyCodes for most common ASCII keys can simply use the appropriate ASCII code above. * * Most of these represent non-ASCII keys (eg, the LEFT arrow key), yet for some reason, browsers defined - * them using ASCII codes (eg, the LEFT arrow key uses the ASCII code for '%' or 37). This conflict is - * discussed further in the definition of CLICKCODE below. + * them using ASCII codes (eg, the LEFT arrow key uses the ASCII code for '%' or 37). */ KEYCODE: { /* 0x08 */ BS: 8, /* 0x09 */ TAB: 9, - /* 0x0A */ LF: 10, // TODO: Determine if any key actually generates this (I suspect there is none) + /* 0x0A */ LF: 10, // TODO: Determine if any key actually generates this /* 0x0D */ CR: 13, /* 0x10 */ SHIFT: 16, /* 0x11 */ CTRL: 17, diff --git a/modules/shared/lib/strlib.js b/modules/shared/lib/strlib.js index 2f5e7963f..671741eff 100644 --- a/modules/shared/lib/strlib.js +++ b/modules/shared/lib/strlib.js @@ -71,7 +71,8 @@ str.isValidInt = function(s, base) * * To summarize our non-standard alternatives: a 'y' suffix indicates binary, a '#' prefix indicates * octal, a '$' prefix indicates hex, and a "0b" prefix indicates binary IF at least one comma is present. - * Commas are useful for grouping binary digits, but if you don't want to use them, then use a 'y' suffix. + * Commas are useful for grouping binary digits, but if you don't want to use them, then you must use a + * 'y' suffix for binary numbers. * * @param {string} s is the string representation of some number * @param {number} [base] is the radix to use (default is 10); can be overridden by prefixes/suffixes diff --git a/versions/c1pjs/1.30.0/c1p-dbg.js b/versions/c1pjs/1.30.0/c1p-dbg.js index 9613d5692..4ba8aa039 100644 --- a/versions/c1pjs/1.30.0/c1p-dbg.js +++ b/versions/c1pjs/1.30.0/c1p-dbg.js @@ -1,4 +1,4 @@ -(function(){var f;function p(a,b){var c="";void 0===b?b=8:8=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function q(a){return"0x"+p(a,2)}function r(a){return"0x"+p(a,4)}function aa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function q(a){return p(a,2,!0)}function r(a){return p(a,4,!0)}function aa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0":">",'"':""","'":"'"};function da(a){return a.replace(/[&<>"']/g,function(a){return ca[a]})}var ea=Date.now||function(){return+new Date}; function t(a,b){var c=0,d=null;if("object"==typeof resources&&(d=resources[a]))b&&b(a,d,c);else if("function"==typeof resources)resources(a,function(c,d){b&&b(a,c,d)});else{var e=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");e.onreadystatechange=function(){4===e.readyState&&(d=e.responseText,200==e.status||!e.status&&d.length&&"file:"==(window?window.location.protocol:"file:")||(c=e.status||-1),b&&b(a,d,c))};e.open("GET",a,!0);e.send()}} function u(a){window&&window.alert(a)}function v(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function fa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function aa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0":">",'"':""","'":"'"}; +(function(){var e;function p(a,b,c){var d="";b?8=f?48:55),d=String.fromCharCode(f)+d;a>>=4}return(c?"0x":"")+d}function aa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0":">",'"':""","'":"'"}; function da(a){return a.replace(/[&<>"']/g,function(a){return ca[a]})}var q=Date.now||function(){return+new Date}; function r(a,b){var c=0,d=null;if("object"==typeof resources&&(d=resources[a]))b&&b(a,d,c);else if("function"==typeof resources)resources(a,function(c,d){b&&b(a,c,d)});else{var f=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");f.onreadystatechange=function(){4===f.readyState&&(d=f.responseText,200==f.status||!f.status&&d.length&&"file:"==(window?window.location.protocol:"file:")||(c=f.status||-1),b&&b(a,d,c))};f.open("GET",a,!0);f.send()}} function t(a){window&&window.alert(a)}function v(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 w={init:[],show:[],exit:[]},ea=!1,fa=!1,x=!0;function ga(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function y(a){w.init.push(a)} @@ -71,12 +71,12 @@ e.Wa=function(){this.b=this.a[this.c++]+this.m&255;this.f=this.g-this.a[this.b]- e.Dd=function(){this.B|=8;this.v[97]=this.ib;this.v[101]=this.kb;this.v[105]=this.hb;this.v[109]=this.eb;this.v[113]=this.jb;this.v[117]=this.lb;this.v[121]=this.gb;this.v[125]=this.fb;this.v[225]=this.yd;this.v[229]=this.Ad;this.v[233]=this.xd;this.v[237]=this.ud;this.v[241]=this.zd;this.v[245]=this.Bd;this.v[249]=this.wd;this.v[253]=this.vd}; e.Ra=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.wd=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.o;this.g=R(this,this.g,this.a[this.b])}; e.Qa=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.vd=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.g=R(this,this.g,this.a[this.b])};e.qc=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.a[this.j]=this.a[this.j]+1&255}; -e.Sd=function(){var a;a=this.a[this.c++];switch(a){case 0:this.F("HALT");M(this);break;case 1:a=this.c;for(var b="";a=e?48:55),c=String.fromCharCode(e)+c;a>>=4}return(d?"0x":"")+c}function ea(a){var b=a,d=a.lastIndexOf("/");0<=d&&(b=a.substr(d+1));d=b.indexOf("&");0":">",'"':""","'":"'"};function ma(a){return a.replace(/[&<>"']/g,function(a){return la[a]})}function na(a,b){return(a+" ").slice(0,b)}function oa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} +function ea(a){var b=16,d;if(a){b||(b=10);var c=a.charAt(0),e=0=e?48:55),c=String.fromCharCode(e)+c;a>>=4}return(d?"0x":"")+c}function r(a){return q(a,4,!0)}function fa(a){var b=a,d=a.lastIndexOf("/");0<=d&&(b=a.substr(d+1));d=b.indexOf("&");0":">",'"':""","'":"'"};function ma(a){return a.replace(/[&<>"']/g,function(a){return la[a]})}function na(a,b){return(a+" ").slice(0,b)}function oa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} function sa(a,b,d){var c=0,e=a.length,f=0;for(void 0===d&&(d=function(a,b){return a>b?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 va(a,b){var d;if(Array.prototype.indexOf)return a.indexOf(b,d);d=d||0;0>d&&(d+=a.length);0>d&&(d=0);for(var c=a.length;db?this.Xa=this.id:(this.pb=this.id.substr(0,b),this.Xa=this.id.substr(b+1));this[a]=d;this.A={ready:!1,Da:!1,Va:!1,X:!1,error:!1};this.Ta=null;this.A.error=!1;this.K={};this.F=null;this.Y=c||0;u.push(this)}var Ta=void 0,Ua={}; -if(window){Ta||(Ta=window.location.search.substr(1));for(var Va,Wa=/\+/g,Xa=/([^&=]+)=?([^&]*)/g;Va=Xa.exec(Ta);)Ua[decodeURIComponent(Va[1].replace(Wa," "))]=decodeURIComponent(Va[2].replace(Wa," "))}function Ya(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 v(a,b){b||(b=t);a.prototype=Ya(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Za=window.PCjs.Machines||(window.PCjs.Machines={}),u=window.PCjs.Components||(window.PCjs.Components=[])}else Za={},u=[];function $a(a,b,d){Za[a]&&b&&(Za[a][b]=d)}function ab(a){var b,d=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b=this.w?10:20>=this.w?12:24>=this.w?14:15;this.la=1<>2;this.i=this.la-1;this.H=this.D/this.la|0;this.G=this.H-1;a=new D;vb(a,this.F);this.P=Array(this.H);for(b=0;b>>a.aa;0f&&(l=f);if(g&&g.size){if(g.type==c){if(e+f<=g.B)return g.Sa+=g.B-e,g.B=e,!0;if(e>=g.B+g.Sa){l=g.size-(e-k);l>f&&(l=f);g.Sa=e-g.B+l;e=k+a.la;f-=l;h++;continue}}return xb(1,e,f)}e=new D(e,l,a.la,c);vb(e,a.F,g);a.P[h++]=e;e=k+a.la;f-=l}return 0>=f?(a.status(Math.floor(d/1024)+"Kb "+yb[c]+" at "+p(b,4,!0)),!0):xb(2,b,d)}function zb(a,b){return a.P[(b&a.j)>>>a.aa].Qa(b&a.i,b)} -function xb(a,b,d){r("Memory block error ("+a+": "+p(b)+","+p(d)+")");return!1}var Ab;if(rb){var Mb=new ArrayBuffer(2);(new DataView(Mb)).setUint16(0,256,!0);Ab=256===(new Uint16Array(Mb))[0]}else Ab=!1;var Nb=Ab; -function D(a,b,d,c){this.id=Ob+=2;this.b=null;this.B=a;this.Sa=b;this.size=d||0;this.type=c||Pb;this.C=c==Qb;vb(this);this.va=this.Fb=!1;if(d)if(rb)this.K=new ArrayBuffer(d),this.D=new DataView(this.K,0,d),this.i=new Uint8Array(this.K,0,d),this.L=new Uint16Array(this.K,0,d>>1),this.b=new Int32Array(this.K,0,d>>2),Rb(this,Nb?Sb:Tb);else{this.b=Array(d>>2);for(a=0;a>2),b=0;b>8,d)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},$:function(a){var b=a>>2;a=(a&3)<<3;var d=this.b[b]>>a;return 24>a?d&65535:d&255|(this.b[b+1]&255)<<8},ga:function(a,b){var d=a>>2,c=(a&3)<<3;this.b[d]=this.b[d]&~(255<>2,c=(a&3)<<3;24>c?this.b[d]=this.b[d]&~(65535<>8);this.va=!0},O:function(a,b){if(this.F&&null!=this.B){var d=this.F;Yb(d,this.B+a,1,d.O)&&d.ba(!0)}return this.Qa(a,b)},U:function(a,b){if(this.F&&null!=this.B){var d=this.F;Yb(d,this.B+a,2,d.O)&&d.ba(!0)}return this.xb(a,b)},da:function(a,b,d){if(this.F&&null!=this.B){var c=this.F;Yb(c,this.B+a,1,c.C)&&c.ba(!0)}this.C?this.H(a,b,d):this.Ia(a,b,d)},ka:function(a, -b,d){if(this.F&&null!=this.B){var c=this.F;Yb(c,this.B+a,2,c.C)&&c.ba(!0)}this.C?this.H(a,b,d):this.Ab(a,b,d)},N:function(a){return this.i[a]},R:function(a){return this.i[a]},T:function(a){return this.D.getUint16(a,!0)},W:function(a){return a&1?this.i[a]|this.i[a+1]<<8:this.L[a>>1]},ca:function(a,b){this.i[a]=b;this.va=!0},fa:function(a,b){this.i[a]=b;this.va=!0},ja:function(a,b){this.D.setUint16(a,b,!0);this.va=!0},pa:function(a,b){a&1?(this.i[a]=b,this.i[a+1]=b>>8):this.L[a>>1]=b;this.va=!0}}; -function vb(a,b,d){a.F=b;a.j=a.w=0;d&&((a.j=d.j)&&Xb(a,Wb,!1),(a.w=d.w)&&Vb(a,Wb,!1))}function Zb(a,b){b?0===--a.w&&(a.J=a.C?a.H:a.Ia):0===--a.j&&(a.G=a.Qa)}function Vb(a,b,d){d&&a.w||(a.J=!a.C&&b[2]||a.H);if(d||void 0===d)a.Ia=b[2]||a.H,a.Ab=b[3]||a.oa}function Xb(a,b,d){d&&a.j||(a.G=b[0]||a.M);if(d||void 0===d)a.Qa=b[0]||a.M,a.xb=b[1]||a.V}function Rb(a,b){b||(b=$b);Xb(a,b,void 0);Vb(a,b,void 0)} -var $b=[],Ub=[D.prototype.S,D.prototype.$,D.prototype.ga,D.prototype.na],Wb=[D.prototype.O,D.prototype.U,D.prototype.da,D.prototype.ka];if(rb)var Tb=[D.prototype.N,D.prototype.T,D.prototype.ca,D.prototype.ja],Sb=[D.prototype.R,D.prototype.W,D.prototype.fa,D.prototype.pa]; -function ac(a,b){t.call(this,"CPU",a,ac,1);var d=a.multiplier||1;this.$a=a.cycles||b;this.Ba=d;this.La=Math.round(this.$a/1E4)/100;this.Aa=this.La*this.Ba;this.A.Z=!1;this.A.fb=!1;this.A.Ja=a.autoStart;this.A.kb=!1;this.A.Ea=!1;this.Na=this.ca=0;this.Oa=a.csStart;this.Fa=a.csInterval;this.Ga=a.csStop;this.oa=[];this.Ib=this.Ca.bind(this);A(this)}v(ac);var bc=["power","reset"];m=ac.prototype; -m.za=function(a,b,d,c){this.D=a;this.H=b;this.F=c;for(b=0;b=a.ca&&(a.ca+=a.Fa,d=!0);0<=a.Ga&&a.Ga<=hc(a)&&(a.Fa=a.Ga=-1,ec(a),a.ba(),d=!0);d&&a.u(hc(a)+" cycles: checksum="+p(a.Na))}} -function ic(a,b,d,c){a.K[b]&&(void 0===d&&(qb(a,"Value for "+b+" is invalid"),a.ba()),d=!a.A.Z||a.A.kb?p(d,c):"--------".substr(0,c),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.D)if(a=c.D,a.A.X)a=!0;else{var b=null,d,g=ab(a.id);for(d=0;da.S/a.Aa?b=1:c=!0;a.Ba=b;b=a.La*a.Ba;if(a.Aa!=b){a.Aa=b;b=a.Aa.toFixed(2)+"Mhz";var e=a.K.setSpeed;e&&(e.textContent=b);a.u("target speed: "+b)}d&&a.D&&a.D.Ra()}kc(a,a.O);a.O=0;a.N=ta();a.T=0;lc(a);return c}function mc(a){a.U-=a.R;a.R=0} -m.Ca=function(a){if(nb(this,!0)){if(!this.A.Z){jc(this);this.D&&this.D.start(this.N,hc(this));this.A.Z=!0;this.A.fb=!0;this.ja&&this.ja.start();var b=this.K.run;b&&(b.textContent="Halt");this.D&&(this.D.ia(!0),a&&this.D.Ra(!0))}this.cb>=this.$a&&lc(this,!0);this.ka=0;this.na=ta();this.T&&(a=this.na-this.T,a>this.ub&&(this.N+=a,this.N>this.na&&(this.N=this.na)));try{do{for(var d=this.A.Ea?1:this.wa,c=this.oa.length-1;0<=c;c--){var e=this.oa[c];0>e[0]||d>e[0]&&(d=e[0])}this.Ha(d);var f=this.U-this.R; -a=f;for(var h=this.oa.length-1;0<=h;h--){var g=this.oa[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ka+=f;this.O+=f;kc(this,0,!0);gc(this,f);this.da-=f;if(0>=this.da){this.da+=this.wa;15<=++this.vb&&(this.D&&this.D.ia(),this.vb=0);break}}while(this.A.Z)}catch(k){this.ba();F(this);this.D&&this.D.stop(ta(),hc(this));nb(this,!1);qb(this,k.stack||k.message);return}d=setTimeout;c=this.Ib;this.T=ta();e=this.ub;this.ka&&(e=Math.round(e*this.ka/this.wa));e=e-(this.T-this.na);if(f=this.T-this.N)this.S= -Math.round(this.O/(10*f))/100,864E5<=f&&(this.V=0,jc(this));if(0>e||this.Se&&(this.N-=e),e=0;this.cb+=this.ka;this.T+=e;d(c,e)}else F(this),this.D&&this.D.stop(ta(),hc(this))};m.Ha=function(){return 0};m.ba=function(a){ob(this,!0);mc(this);kc(this,this.O);this.O=0;if(this.A.Z){this.A.Z=!1;this.ja&&this.ja.stop();var b=this.K.run;b&&(b.textContent="Run")}this.A.complete=a};function F(a,b){a.D&&a.D.ia(b)} -function zc(a){this.rb=+a.model||1170;ac.call(this,a,1E6);this.nb=0;this.w=65536;this.i=this.b=32768;this.j=65535;this.I=15;this.g=[0,0,0,0,0,0,0,0];this.zb=[0,0,0,0,0,0];this.fa=[0,0,0,0];this.memory=[];this.J=[];this.eb=this.wb=0;this.W=2;this.$=255;this.G=0;this.ga=-1;this.tb=this.Ma=this.sb=this.C=this.Ka=this.M=this.L=0;this.pa=[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.Kb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.A.complete=this.A.Eb=!1}v(zc,ac);m=zc.prototype;m.reset=function(){this.A.Z&&this.ba();Ac(this);dc(this);this.A.error=!1;this.parent.reset.call(this)}; -function Ac(a){a.$=255;a.J=[];a.wb=0;a.L=a.M=a.Ka=a.sb=0;a.pa[0]=a.pa[1]=a.pa[3]=7;a.Ma=0}m.mb=function(){return 0};m.save=function(){var a=new G(this);H(a,0,[]);H(a,1,[this.qb,this.V,this.Ba]);for(var b=this.H,d=0,c=[],e=0;ed;d++)c=a.g[d],a.g[d]=a.zb[d],a.zb[d]=c;(a.C=b>>14&3)!==(a.I>>14&3)&&(a.fa[c]=a.g[6],a.g[6]=a.fa[a.C]);a.W=2;a.I=b} -function I(a,b){var d,c,e=0;0>a.ga?(a.I=a.I&63728|a.b>>12&8|a.i>>14&2|a.w>>16&1,a.j&65535||(a.I|=4),a.ga=a.I):a.C||(b=4,e=1);a.L&57344||(a.M=63222);a.C=0;0<=(d=L(a,b|65536))&&0<=(c=L(a,b+2&65535|65536))&&(Bc(a,c&53247|a.ga>>2&12288),e&&(a.g[6]=4),0<=Cc(a,a.ga)&&0<=Cc(a,a.g[7])&&(a.g[7]=d));a.G=0;return a.ga=-1} -function Dc(a,b,d){var c,e,f,h=0;if(d&a.sb){c=b>>13&a.pa[a.C];e=a.Za[a.C][c];f=(a.Za[a.C][c+16]<<6)+(b&8191)&4194303;if(a.Ka&16){if(3932160<=f&&4186112>f){f=f&262143;var g=f>>13&31;31>g?a.Ka&32&&(f=a.Kb[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 I(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.Za[a.C][c]=e;if(4194170!==f||a.C)a.Ma=a.C,a.tb=c;if(h){if(h&57344)return 0<=a.ga&&(h|=128),a.L&57344||(a.L=a.L|h|a.Ma<<5|a.tb<<1),I(a,168);a.L&61440||!(4191360>f||4194239>1]:b} -function N(a,b,d){d&=65535;return 4194304<=b?a.g[b-4194304]=d:3932160<=b?-1:0<=b?a.memory[b>>1]=d:b}function Q(a,b){var d;return 4194304<=b?a.g[b-4194304]&255:3932160<=b?-1:0<=b?(d=a.memory[b>>1],b&1&&(d=d>>8),d&255):b}function R(a,b,d){d&=255;return 4194304<=b?a.g[b-4194304]=a.g[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 M(a,Dc(a,b,2))} -function Ec(a){var b=L(a,a.g[6]|65536);0<=b&&(a.g[6]=a.g[6]+2&65535);return b}function Cc(a,b){var d,c;a.g[6]=c=a.g[6]-2&65535;a.L&57344||(a.M=a.M<<8|246);if(!a.C&&c<=a.$&&4>3&7){case 0:return I(a,4);case 1:if(6===f&&!a.C&&d&4&&(a.g[6]<=a.$||65534<=a.g[6])){if(a.g[6]<=a.$-32||65534<=a.g[6])return a.g[6]=4,I(a,4);a.G|=4}return 7===f?a.g[f]:a.g[f]|65536;case 2:e=2;c=a.g[f];7!==f&&(c|=65536,6>f&&d&1&&(e=1));break;case 3:e=2;c=a.g[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.g[f]+e&65535;7!==f&&(c|=65536);break;case 5:e=-2;c=a.g[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.g[7])))return c;a.g[7]=a.g[7]+2&65535;c=c+a.g[f]&65535;return c|65536;case 7:if(0>(c=L(a,a.g[7])))return c;a.g[7]=a.g[7]+2&65535;c=c+a.g[f]&65535;return 0>(c=L(a,c|65536))?c:c|65536}a.g[f]=a.g[f]+e&65535;a.L&57344||(a.M=a.M<<8|e<<3&248|f);if(6===f&&!a.C&&d&4&&0>=e&&(a.g[6]<=a.$||65534<=a.g[6])){if(a.g[6]<=a.$-32)return a.g[6]=4,I(a,4);a.G|=4}return c}function S(a,b,d){var c;return b&56?(0<=(c=Fc(a,b,d))&&(c=Dc(a,c,d)),c):4194304+(b&7)} -function T(a,b){var d;b&56?0<=(d=S(a,b,2))&&(d=M(a,d)):d=a.g[b&7];return d}function Gc(a,b){var d;b&56?0<=(d=S(a,b,3))&&(d=Q(a,d)):d=a.g[b&7]&255;return d}function U(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} -m.Ha=function(a){this.A.complete=!0;var b=this.A.Eb=this.F&&Hc(this.F),d=a?this.A.fb?0:1:-1;this.A.fb=!1;this.U=this.R=a;this.qb&256?(mc(this),a=!1):a=!0;if(a){do{if(b){if(Ic(this.F,this.g[7],d)){this.ba();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.wb&224;if(0<(a=this.J.length))for(;0c&&(c=this.J[a].Hb,g= -a)}c>(this.I&224)&&(0>g?I(this,160):(I(this,this.J[g].Mb),this.J.splice(g,1)))}this.L&57344||(this.M=0);this.G=this.I&16;if(0<=(a=L(this,this.g[7])))switch(this.g[7]=this.g[7]+2&65535,a&61440){case 4096:0<=(c=T(this,a>>6))&&(a&56?0<=(f=S(this,a,4))&&0<=N(this,f,c)&&(this.b=this.j=c,this.i=0):(this.b=this.j=this.g[a&7]=c,this.i=0));break;case 8192:0<=(c=T(this,a>>6))&&0<=(e=T(this,a))&&(this.b=this.j=this.w=a=c-e,this.i=(c^e)&(c^a));break;case 12288:0<=(c=T(this,a>>6))&&0<=(e=T(this,a))&&(this.b=this.j= -c&e,this.i=0);break;case 16384:0<=(c=T(this,a>>6))&&(a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e&~c,0<=N(this,f,a)&&(this.b=this.j=a,this.i=0)):(this.b=this.j=a=this.g[a&7]&=~c,this.i=0));break;case 20480:0<=(c=T(this,a>>6))&&(a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e|c,0<=N(this,f,a)&&(this.b=this.j=a,this.i=0)):(this.b=this.j=a=this.g[a&7]|=c,this.i=0));break;case 24576:0<=(c=T(this,a>>6))&&(a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=c+e,0<=N(this,f,a)&&(this.b=this.j=this.w=a,this.i=(c^a)&(e^a))):(g=a&7, -e=this.g[g],this.g[g]=(a=c+e)&65535,this.b=this.j=this.w=a,this.i=(c^a)&(e^a)));break;case 36864:0<=(c=Gc(this,a>>6))&&(a&56?0<=(f=S(this,a,5))&&0<=R(this,f,c)&&(this.b=this.j=c<<8,this.i=0):(c&128&&(c|=65280),this.b=this.j=this.g[a&7]=c,this.i=0));break;case 40960:0<=(c=Gc(this,a>>6))&&0<=(e=Gc(this,a))&&(a=c-e,this.b=this.j=this.w=a<<8,this.i=((c^e)&(c^a))<<8);break;case 45056:0<=(c=Gc(this,a>>6))&&0<=(e=Gc(this,a))&&(this.b=this.j=(c&e)<<8,this.i=0);break;case 49152:0<=(c=Gc(this,a>>6))&&0<=(e= -Q(this,f=S(this,a,7)))&&(a=e&~c,0<=R(this,f,a)&&(this.b=this.j=a<<8,this.i=0));break;case 53248:0<=(c=Gc(this,a>>6))&&0<=(e=Q(this,f=S(this,a,7)))&&(a=e|c,0<=R(this,f,a)&&(this.b=this.j=a<<8,this.i=0));break;case 57344:0<=(c=T(this,a>>6))&&(a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e-c,0<=N(this,f,a)&&(this.b=this.j=this.w=a,this.i=(c^e)&(e^a))):(g=a&7,e=this.g[g],this.g[g]=(a=e-c)&65535,this.b=this.j=this.w=a,this.i=(c^e)&(e^a)));break;default:switch(a&65024){case 2048:0<=(h=Fc(this,a,0))&&(g=a>>6&7, -0<=Cc(this,this.g[g])&&(this.g[g]=this.g[7],this.g[7]=h&65535));break;case 28672:0<=(c=T(this,a))&&(g=a>>6&7,c&32768&&(c|=-65536),e=this.g[g],e&32768&&(e|=-65536),a=~~(c*e),this.g[g]=a>>16&65535,this.g[g|1]=a&65535,this.b=a>>16,this.j=this.b|a,this.w=this.i=0,-32768>a||32767>6&7,e=this.g[g]<<16|this.g[g|1],this.w=this.i=0,c&32768&&(c|=-65536),a=~~(e/c),-32768<=a&&32767>=a?(this.g[g]=a&65535,this.g[g|1]=e-a*c&65535,this.j=a>>16|a,this.b= -a>>16):(this.i=32768,this.j=a>>15|a,this.b=e>>16,-1===c&&65534===this.g[g]&&(this.g[g]=this.g[g|1]=1))):(this.j=this.b=0,this.i=32768,this.w=65536));break;case 29696:0<=(c=T(this,a))&&(g=a>>6&7,a=this.g[g],a&32768&&(a|=4294901760),this.w=this.i=0,c&=63,c&32?(c=64-c,16>c):c&&(16>15&65535)&&65535!==e&&(this.i=32768))),this.g[g]=a&65535,this.b=this.j=a);break;case 30208:if(0<=(c=T(this,a))){g=a>>6&7;e=this.g[g]<<16|this.g[g|1];this.w= -this.i=0;c&=63;if(c&32)c=64-c,32>c-1,this.w=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.g[g|1]=a&65535;this.b=a>>16;this.j=a>>16|a}break;case 30720:a&56?0<=(e=M(this,f=S(this,a,6)))&&(e^=this.g[a>>6&7],0<=N(this,f,e)&&(this.b=this.j=e,this.i=0)):(this.b=this.j=e=this.g[a&7]^=this.g[a>>6&7],this.i=0);break;case 32256:g=a>> -6&7;if(this.g[g]=this.g[g]-1&65535)this.g[7]=this.g[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.g[7]=U(this.g[7],a);break;case 512:this.j&65535&&(this.g[7]=U(this.g[7],a));break;case 768:this.j&65535||(this.g[7]=U(this.g[7],a));break;case 1024:(this.b&32768)===(this.i&32768)&&(this.g[7]=U(this.g[7],a));break;case 1280:(this.b&32768)!==(this.i&32768)&&(this.g[7]=U(this.g[7],a));break;case 1536:this.j&65535&&(this.b&32768)===(this.i&32768)&&(this.g[7]=U(this.g[7],a));break;case 1792:this.j& -65535&&(this.b&32768)===(this.i&32768)||(this.g[7]=U(this.g[7],a));break;case 32768:this.b&32768||(this.g[7]=U(this.g[7],a));break;case 33280:!(this.w&65536)&&this.j&65535&&(this.g[7]=U(this.g[7],a));break;case 33024:this.b&32768&&(this.g[7]=U(this.g[7],a));break;case 33536:if(this.w&65536||!(this.j&65535))this.g[7]=U(this.g[7],a);break;case 33792:this.i&32768||(this.g[7]=U(this.g[7],a));break;case 34048:this.i&32768&&(this.g[7]=U(this.g[7],a));break;case 34304:this.w&65536||(this.g[7]=U(this.g[7], -a));break;case 34560:this.w&65536&&(this.g[7]=U(this.g[7],a));break;case 34816:I(this,24);break;case 35072:I(this,28);break;default:switch(a&65472){case 64:0<=(h=Fc(this,a,0))&&(this.g[7]=h&65535);break;case 192:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e<<8|e>>8,0<=N(this,f,a)&&(this.b=this.j=e&65280,this.i=this.w=0)):(g=a&7,e=this.g[g],this.g[g]=(e<<8|e>>8)&65535,this.b=this.j=e&65280,this.i=this.w=0);break;case 2560:a&56?0<=(f=S(this,a,4))&&0<=N(this,f,0)&&(this.b=this.w=this.i=this.j=0):this.b=this.w= -this.i=this.j=this.g[a&7]=0;break;case 2624:0<=(e=M(this,f=S(this,a,6)))&&(a=~e,0<=N(this,f,a)&&(this.b=this.j=a,this.w=65536,this.i=0));break;case 2688:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e+1,0<=N(this,f,a)&&(this.b=this.j=a,this.i=a&(a^e))):(g=a&7,e=this.g[g],a=e+1,this.g[g]=a&65535,this.b=this.j=a,this.i=a&(a^e));break;case 2752:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e-1,0<=N(this,f,a)&&(this.b=this.j=a,this.i=(a^e)&e)):(g=a&7,e=this.g[g],a=e-1,this.g[g]=a&65535,this.b=this.j=a,this.i=(a^e)&e); -break;case 2816:0<=(e=M(this,f=S(this,a,6)))&&(a=-e,0<=N(this,f,a)&&(this.w=this.b=this.j=a,this.i=a&e));break;case 2880:0<=(e=M(this,f=S(this,a,6)))&&(a=e+(this.w>>16&1),0<=N(this,f,a)&&(this.w=this.b=this.j=a,this.i=a&(a^e)));break;case 2944:0<=(e=M(this,f=S(this,a,6)))&&(a=e-(this.w>>16&1),0<=N(this,f,a)&&(this.w=this.b=this.j=a,this.i=(a^e)&e));break;case 3008:0<=(e=T(this,a))&&(this.b=this.j=e,this.w=this.i=0);break;case 3072:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=(this.w&65536|e)>>1,0<=N(this, -f,a)&&(this.w=e<<16,this.b=this.j=a,this.i=a^this.w>>1)):(g=a&7,e=this.g[g],a=(this.w&65536|e)>>1,this.g[g]=a&65535,this.w=e<<16,this.b=this.j=a,this.i=a^this.w>>1);break;case 3136:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e<<1|this.w>>16&1,0<=N(this,f,a)&&(this.w=this.b=this.j=a,this.i=a^e)):(g=a&7,e=this.g[g],a=e<<1|this.w>>16&1,this.g[g]=a&65535,this.w=this.b=this.j=a,this.i=a^e);break;case 3200:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e&32768|e>>1,0<=N(this,f,a)&&(this.w=e<<16,this.b=this.j=a,this.i= -this.b^this.w>>1)):(g=a&7,e=this.g[g],a=e&32768|e>>1,this.g[g]=a&65535,this.w=e<<16,this.b=this.j=a,this.i=this.b^this.w>>1);break;case 3264:a&56?0<=(e=M(this,f=S(this,a,6)))&&(a=e<<1,0<=N(this,f,a)&&(this.w=this.b=this.j=a,this.i=a^e)):(g=a&7,e=this.g[g],a=e<<1,this.g[g]=a&65535,this.w=this.b=this.j=a,this.i=a^e);break;case 3328:h=this.g[7]+((a&63)<<1)&65535;0<=(c=L(this,h|65536))&&(this.g[7]=this.g[5],this.g[5]=c,this.g[6]=h+2&65535);break;case 3392:a&56?0<=(h=Fc(this,a,0))&&(61440!==(this.I&61440)&& -(h&=65535),this.C=this.I>>12&3,0<=(c=L(this,h))&&(this.C=this.I>>14&3,0<=Cc(this,c)&&(this.b=this.j=c,this.i=0))):(g=a&7,c=6!==g||(this.I>>2&12288)===(this.I&12288)?this.g[g]:this.fa[this.I>>12&3],0<=Cc(this,c)&&(this.b=this.j=c,this.i=0));break;case 3456:0<=(e=Ec(this))&&((this.L&57344||(this.M=22),a&56)?0<=(h=Fc(this,a,0))&&(h&=65535,this.C=this.I>>12&3,0<=(f=Dc(this,h,4))&&(this.C=this.I>>14&3,0<=N(this,f,e)&&(this.b=this.j=e,this.i=0))):(g=a&7,6!==g||(this.I>>2&12288)===(this.I&12288)?this.g[g]= -e:this.fa[this.I>>12&3]=e,this.b=this.j=e,this.i=0));break;case 3520:0<=(f=S(this,a,4))&&(a=-(this.b>>15&1),0<=N(this,f,a)&&(this.j=a,this.i=0));break;case 35328:a&56?0<=(f=S(this,a,5))&&0<=R(this,f,0)&&(this.b=this.w=this.i=this.j=0):(this.g[a&7]&=65280,this.b=this.w=this.i=this.j=0);break;case 35392:0<=(e=Q(this,f=S(this,a,7)))&&(a=~e,0<=R(this,f,a)&&(this.b=this.j=a<<8,this.w=65536,this.i=0));break;case 35456:0<=(e=Q(this,f=S(this,a,7)))&&(a=e+1,0<=R(this,f,a)&&(this.b=this.j=a<<8,this.i=(a&(a^ -e))<<8));break;case 35520:0<=(e=Q(this,f=S(this,a,7)))&&(a=e-1,0<=R(this,f,a)&&(this.b=this.j=a<<8,this.i=((a^e)&e)<<8));break;case 35584:0<=(e=Q(this,f=S(this,a,7)))&&(a=-e,0<=R(this,f,a)&&(this.w=this.b=this.j=a<<8,this.i=(a&e)<<8));break;case 35648:0<=(e=Q(this,f=S(this,a,7)))&&(a=e+(this.w>>16&1),0<=R(this,f,a)&&(this.b=this.j=this.w=a<<8,this.i=(a&(a^e))<<8));break;case 35712:0<=(e=Q(this,f=S(this,a,7)))&&(a=e-(this.w>>16&1),0<=R(this,f,a)&&(this.b=this.j=this.w=a<<8,this.i=((a^e)&e)<<8));break; -case 35776:0<=(e=Gc(this,a))&&(this.b=this.j=e<<8,this.w=this.i=0);break;case 35840:0<=(e=Q(this,f=S(this,a,7)))&&(a=((this.w&65536)>>8|e)>>1,0<=R(this,f,a)&&(this.w=e<<16,this.b=this.j=a<<8,this.i=this.b^this.w>>1));break;case 35904:0<=(e=Q(this,f=S(this,a,7)))&&(a=e<<1|this.w>>16&1,0<=R(this,f,a)&&(this.w=this.b=this.j=a<<8,this.i=(a^e)<<8));break;case 35968:0<=(e=Q(this,f=S(this,a,7)))&&(a=e&128|e>>1,0<=R(this,f,a)&&(this.w=e<<16,this.b=this.j=a<<8,this.i=this.b^this.w>>1));break;case 36032:0<= -(e=Q(this,f=S(this,a,7)))&&(a=e<<1,0<=R(this,f,a)&&(this.w=this.b=this.j=a<<8,this.i=(a^e)<<8));break;case 36160:a&56?0<=(h=Fc(this,a,0))&&(this.C=this.I>>12&3,0<=(c=L(this,h|65536))&&(this.C=this.I>>14&3,0<=Cc(this,c)&&(this.b=this.j=c,this.i=0))):(g=a&7,c=6!==g||(this.I>>2&12288)===(this.I&12288)?this.g[g]:this.fa[this.I>>12&3],0<=Cc(this,c)&&(this.b=this.j=c,this.i=0));break;case 36224:0<=(e=Ec(this))&&((this.L&57344||(this.M=22),a&56)?0<=(h=Fc(this,a,0))&&(this.C=this.I>>12&3,0<=(f=Dc(this,h| -65536,4))&&(this.C=this.I>>14&3,0<=N(this,f,e)&&(this.b=this.j=e,this.i=0))):(g=a&7,6!==g||(this.I>>2&12288)===(this.I&12288)?this.g[g]=e:this.fa[this.I>>12&3]=e,this.b=this.j=e,this.i=0));break;default:switch(a&65528){case 128:0<=(c=Ec(this))&&(g=a&7,this.g[7]=this.g[g],this.g[g]=c);break;case 152:this.I&49152||(this.I=this.I&63519|(a&7)<<5,this.W=1);break;case 160:case 168:a&1&&(this.w=0);a&2&&(this.i=0);a&4&&(this.j=1);a&8&&(this.b=0);break;case 176:case 184:a&1&&(this.w=65536);a&2&&(this.i=32768); -a&4&&(this.j=0);a&8&&(this.b=32768);break;default:switch(a){case 0:49152&this.I?I(this,4):(this.eb=3,mc(this),console.log("HALT at "+this.g[7].toString(8)));break;case 1:g=0;if(0<(a=this.J.length))for(;0>>0,h],q=sa(n,k,a.jb);0>q&&n.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.G.push({Lb:b,B:d,Gb:c,qa:e,hb:f})}delete this.qa}return!0};Jc.prototype.ra=function(){return!0}; -function Kc(a,b,d,c){if(c)a.ea("Unable to load system ROM (error "+c+": "+b+")");else{$a(a.pb,b,d);if("["==d.charAt(0)||"{"==d.charAt(0))try{var e=eval("("+d+")"),f=e.bytes,h=e.data;if(f)a.i=f;else if(h)for(a.i=Array(4*h.length),c=d=0;d>8&255,a.i[c++]=h[d]>>16&255,a.i[c++]=h[d]>>24&255;else a.i=e;a.qa=e.symbols;if(!a.i.length){r("Empty ROM: "+b);return}if(1==a.i.length){r(a.i[0]);return}}catch(g){a.ea("ROM data error: "+g.message);return}else for(b=d.replace(/\n/gm, -" ").replace(/ +$/,"").split(" "),a.i=Array(b.length),e=0;e>>c.aa].Ia(e&c.i,a.i[d]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.w?b.push(a.w):null!=a.w&&a.w.length&&(b=a.w);for(d=0;d>>e.aa;0>>=e.aa;0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Oc.prototype.ab=function(){return-1};Oc.prototype.bb=function(){}; -function Qc(a,b,d,c){if(d)if(b){0>a.w&&a.j.length&&(a.w=0);if(0>a.w||b!=a.j[a.w])a.j.splice(0,0,b),a.w=0;a.w--}else a.T?b="end":b=a.j[a.w+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(oa(b.substring(d,f))),d=f+1}}return a} -function Rc(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; +function t(a){window&&window.alert(a)}function xa(a){var b=!1;window&&(b=window.confirm(a));return b}var ya=null;function za(){if(null==ya){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}ya=a}return ya}function Ga(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.Ua=this.id:(this.ob=this.id.substr(0,b),this.Ua=this.id.substr(b+1));this[a]=d;this.w={ready:!1,Ca:!1,Va:!1,W:!1,error:!1};this.Ta=null;this.w.error=!1;this.J={};this.D=null;this.X=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=v);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.u?10:20>=this.u?12:24>=this.u?14:15;this.ka=1<>2;this.g=this.ka-1;this.G=this.C/this.ka|0;this.F=this.G-1;a=new G;wb(a,this.D);this.N=Array(this.G);for(b=0;b>>a.$;0f&&(l=f);if(g&&g.size){if(g.type==c){if(e+f<=g.A)return g.Sa+=g.A-e,g.A=e,!0;if(e>=g.A+g.Sa){l=g.size-(e-k);l>f&&(l=f);g.Sa=e-g.A+l;e=k+a.ka;f-=l;h++;continue}}return yb(1,e,f)}e=new G(e,l,a.ka,c);wb(e,a.D,g);a.N[h++]=e;e=k+a.ka;f-=l}return 0>=f?(a.status(Math.floor(d/1024)+"Kb "+zb[c]+" at "+r(b)),!0):yb(2,b,d)} +function Ab(a,b){var d=b&a.g,c=(b&a.i)>>>a.$;return d!=a.g?a.N[c].xb(d,b):a.N[c++].Qa(d,b)|a.N[c&a.F].Qa(0,b+1)<<8}function yb(a,b,d){t("Memory block error ("+a+": "+q(b)+","+q(d)+")");return!1}var Bb;if(sb){var Nb=new ArrayBuffer(2);(new DataView(Nb)).setUint16(0,256,!0);Bb=256===(new Uint16Array(Nb))[0]}else Bb=!1;var Ob=Bb; +function G(a,b,d,c){this.id=Pb+=2;this.b=null;this.A=a;this.Sa=b;this.size=d||0;this.type=c||Qb;this.B=c==Rb;wb(this);this.ta=this.Eb=!1;if(d)if(sb)this.J=new ArrayBuffer(d),this.C=new DataView(this.J,0,d),this.g=new Uint8Array(this.J,0,d),this.K=new Uint16Array(this.J,0,d>>1),this.b=new Int32Array(this.J,0,d>>2),Sb(this,Ob?Tb:Ub);else{this.b=Array(d>>2);for(a=0;a>2),b=0;b>8,d)},R:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},Z:function(a){var b=a>>2;a=(a&3)<<3;var d=this.b[b]>>a;return 24>a?d&65535:d&255|(this.b[b+1]&255)<<8},fa:function(a,b){var d=a>>2,c=(a&3)<<3;this.b[d]=this.b[d]&~(255<>2,c=(a&3)<<3;24>c?this.b[d]=this.b[d]&~(65535<>8);this.ta=!0},O:function(a,b){if(this.D&&null!=this.A){var d=this.D;Zb(d,this.A+a,1,d.M)&&d.aa(!0)}return this.Qa(a,b)},T:function(a,b){if(this.D&&null!=this.A){var d=this.D;Zb(d,this.A+a,2,d.M)&&d.aa(!0)}return this.xb(a,b)},ca:function(a,b,d){if(this.D&&null!=this.A){var c=this.D;Zb(c,this.A+a,1,c.B)&&c.aa(!0)}this.B?this.G(a,b,d):this.Ha(a,b,d)},ja:function(a,b,d){if(this.D&& +null!=this.A){var c=this.D;Zb(c,this.A+a,2,c.B)&&c.aa(!0)}this.B?this.G(a,b,d):this.zb(a,b,d)},M:function(a){return this.g[a]},P:function(a){return this.g[a]},S:function(a){return this.C.getUint16(a,!0)},V:function(a){return a&1?this.g[a]|this.g[a+1]<<8:this.K[a>>1]},ba:function(a,b){this.g[a]=b;this.ta=!0},ea:function(a,b){this.g[a]=b;this.ta=!0},ia:function(a,b){this.C.setUint16(a,b,!0);this.ta=!0},na:function(a,b){a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.K[a>>1]=b;this.ta=!0}}; +function wb(a,b,d){a.D=b;a.i=a.u=0;d&&((a.i=d.i)&&Yb(a,Xb,!1),(a.u=d.u)&&Wb(a,Xb,!1))}function $b(a,b){b?0===--a.u&&(a.I=a.B?a.G:a.Ha):0===--a.i&&(a.F=a.Qa)}function Wb(a,b,d){d&&a.u||(a.I=!a.B&&b[2]||a.G);if(d||void 0===d)a.Ha=b[2]||a.G,a.zb=b[3]||a.ma}function Yb(a,b,d){d&&a.i||(a.F=b[0]||a.L);if(d||void 0===d)a.Qa=b[0]||a.L,a.xb=b[1]||a.U}function Sb(a,b){b||(b=ac);Yb(a,b,void 0);Wb(a,b,void 0)} +var ac=[],Vb=[G.prototype.R,G.prototype.Z,G.prototype.fa,G.prototype.oa],Xb=[G.prototype.O,G.prototype.T,G.prototype.ca,G.prototype.ja];if(sb)var Ub=[G.prototype.M,G.prototype.S,G.prototype.ba,G.prototype.ia],Tb=[G.prototype.P,G.prototype.V,G.prototype.ea,G.prototype.na]; +function bc(a,b){v.call(this,"CPU",a,bc,1);var d=a.multiplier||1;this.Za=a.cycles||b;this.Aa=d;this.La=Math.round(this.Za/1E4)/100;this.za=this.La*this.Aa;this.w.Y=!1;this.w.eb=!1;this.w.Ka=a.autoStart;this.w.jb=!1;this.w.Da=!1;this.Na=this.ba=0;this.Oa=a.csStart;this.Ea=a.csInterval;this.Fa=a.csStop;this.ma=[];this.Hb=this.Ba.bind(this);E(this)}y(bc);var cc=["power","reset"];m=bc.prototype; +m.ya=function(a,b,d,c){this.C=a;this.G=b;this.D=c;for(b=0;b=a.ba&&(a.ba+=a.Ea,d=!0);0<=a.Fa&&a.Fa<=ic(a)&&(a.Ea=a.Fa=-1,fc(a),a.aa(),d=!0);d&&a.j(ic(a)+" cycles: checksum="+q(a.Na))}} +function jc(a,b,d,c){a.J[b]&&(void 0===d&&(rb(a,"Value for "+b+" is invalid"),a.aa()),d=!a.w.Y||a.w.jb?q(d,c):"--------".substr(0,c),a.J[b].textContent!=d&&(a.J[b].textContent=d))} +m.ga=function(a,b,d){var c=this;a=!1;switch(b){case "power":case "reset":this.J[b]=d;a=!0;break;case "run":this.J[b]=d;d.onclick=function(){var a;if(a=c.C)if(a=c.C,a.w.W)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.La*a.Aa;if(a.za!=b){a.za=b;b=a.za.toFixed(2)+"Mhz";var e=a.J.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}d&&a.C&&a.C.Ra()}lc(a,a.O);a.O=0;a.M=ta();a.S=0;mc(a);return c}function nc(a){a.T-=a.P;a.P=0} +m.Ba=function(a){if(ob(this,!0)){if(!this.w.Y){kc(this);this.C&&this.C.start(this.M,ic(this));this.w.Y=!0;this.w.eb=!0;this.ia&&this.ia.start();var b=this.J.run;b&&(b.textContent="Halt");this.C&&(this.C.ha(!0),a&&this.C.Ra(!0))}this.$a>=this.Za&&mc(this,!0);this.ja=0;this.oa=ta();this.S&&(a=this.oa-this.S,a>this.tb&&(this.M+=a,this.M>this.oa&&(this.M=this.oa)));try{do{for(var d=this.w.Da?1:this.ua,c=this.ma.length-1;0<=c;c--){var e=this.ma[c];0>e[0]||d>e[0]&&(d=e[0])}this.Ga(d);var f=this.T-this.P; +a=f;for(var h=this.ma.length-1;0<=h;h--){var g=this.ma[h];0>g[0]||(g[0]-=a,0>=g[0]&&(g[0]=-1,g[1]()))}this.ja+=f;this.O+=f;lc(this,0,!0);hc(this,f);this.ca-=f;if(0>=this.ca){this.ca+=this.ua;15<=++this.ub&&(this.C&&this.C.ha(),this.ub=0);break}}while(this.w.Y)}catch(k){this.aa();H(this);this.C&&this.C.stop(ta(),ic(this));ob(this,!1);rb(this,k.stack||k.message);return}d=setTimeout;c=this.Hb;this.S=ta();e=this.tb;this.ja&&(e=Math.round(e*this.ja/this.ua));e=e-(this.S-this.oa);if(f=this.S-this.M)this.R= +Math.round(this.O/(10*f))/100,864E5<=f&&(this.U=0,kc(this));if(0>e||this.Re&&(this.M-=e),e=0;this.$a+=this.ja;this.S+=e;d(c,e)}else H(this),this.C&&this.C.stop(ta(),ic(this))};m.Ga=function(){return 0};m.aa=function(a){pb(this,!0);nc(this);lc(this,this.O);this.O=0;if(this.w.Y){this.w.Y=!1;this.ia&&this.ia.stop();var b=this.J.run;b&&(b.textContent="Run")}this.w.complete=a};function H(a,b){a.C&&a.C.ha(b)} +function Ac(a){this.rb=+a.model||1170;bc.call(this,a,1E6);this.mb=0;this.u=65536;this.g=this.b=32768;this.i=65535;this.H=15;this.f=[0,0,0,0,0,0,0,0];this.wb=[0,0,0,0,0,0];this.ea=[0,0,0,0];this.memory=[];this.I=[];this.cb=this.vb=0;this.V=2;this.Z=255;this.F=0;this.fa=-1;this.sb=this.Ma=this.qb=this.B=this.Ja=this.L=this.K=0;this.na=[7,7,7,7];this.Ya=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535, +65535,65535,65535,65535,65535,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Jb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.w.complete=this.w.Db=!1}y(Ac,bc);m=Ac.prototype;m.reset=function(){this.w.Y&&this.aa();Bc(this);ec(this);this.w.error=!1;this.parent.reset.call(this)}; +function Bc(a){a.Z=255;a.I=[];a.vb=0;a.K=a.L=a.Ja=a.qb=0;a.na[0]=a.na[1]=a.na[3]=7;a.Ma=0}m.lb=function(){return 0};m.save=function(){var a=new I(this);J(a,0,[]);J(a,1,[this.pb,this.U,this.Aa]);for(var b=this.G,d=0,c=[],e=0;ed;d++)c=a.f[d],a.f[d]=a.wb[d],a.wb[d]=c;(a.B=b>>14&3)!==(a.H>>14&3)&&(a.ea[c]=a.f[6],a.f[6]=a.ea[a.B]);a.V=2;a.H=b} +function L(a,b){var d,c,e=0;0>a.fa?(a.H=a.H&63728|a.b>>12&8|a.g>>14&2|a.u>>16&1,a.i&65535||(a.H|=4),a.fa=a.H):a.B||(b=4,e=1);a.K&57344||(a.L=63222);a.B=0;0<=(d=M(a,b|65536))&&0<=(c=M(a,b+2&65535|65536))&&(Cc(a,c&53247|a.fa>>2&12288),e&&(a.f[6]=4),0<=Dc(a,a.fa)&&0<=Dc(a,a.f[7])&&(a.f[7]=d));a.F=0;return a.fa=-1} +function Ec(a,b,d){var c,e,f,h=0;if(d&a.qb){c=b>>13&a.na[a.B];e=a.Ya[a.B][c];f=(a.Ya[a.B][c+16]<<6)+(b&8191)&4194303;if(a.Ja&16){if(3932160<=f&&4186112>f){f=f&262143;var g=f>>13&31;31>g?a.Ja&32&&(f=a.Jb[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 L(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.Ya[a.B][c]=e;if(4194170!==f||a.B)a.Ma=a.B,a.sb=c;if(h){if(h&57344)return 0<=a.fa&&(h|=128),a.K&57344||(a.K=a.K|h|a.Ma<<5|a.sb<<1),L(a,168);a.K&61440||!(4191360>f||4194239>1]:b} +function Q(a,b,d){d&=65535;return 4194304<=b?a.f[b-4194304]=d:3932160<=b?-1:0<=b?a.memory[b>>1]=d:b}function R(a,b){var d;return 4194304<=b?a.f[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.f[b-4194304]=a.f[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 M(a,b){return N(a,Ec(a,b,2))} +function Fc(a){var b=M(a,a.f[6]|65536);0<=b&&(a.f[6]=a.f[6]+2&65535);return b}function Dc(a,b){var d,c;a.f[6]=c=a.f[6]-2&65535;a.K&57344||(a.L=a.L<<8|246);if(!a.B&&c<=a.Z&&4>3&7){case 0:return L(a,4);case 1:if(6===f&&!a.B&&d&4&&(a.f[6]<=a.Z||65534<=a.f[6])){if(a.f[6]<=a.Z-32||65534<=a.f[6])return a.f[6]=4,L(a,4);a.F|=4}return 7===f?a.f[f]:a.f[f]|65536;case 2:e=2;c=a.f[f];7!==f&&(c|=65536,6>f&&d&1&&(e=1));break;case 3:e=2;c=a.f[f];7!==f&&(c|=65536);if(0>(c=M(a,c)))return c;c|=65536;break;case 4:e=-2;6>f&&d&1&&(e=-1);c=a.f[f]+e&65535;7!==f&&(c|=65536);break;case 5:e=-2;c=a.f[f]-2&65535;7!==f&&(c|=65536);if(0>(c=M(a,c)))return c; +c|=65536;break;case 6:if(0>(c=M(a,a.f[7])))return c;a.f[7]=a.f[7]+2&65535;c=c+a.f[f]&65535;return c|65536;case 7:if(0>(c=M(a,a.f[7])))return c;a.f[7]=a.f[7]+2&65535;c=c+a.f[f]&65535;return 0>(c=M(a,c|65536))?c:c|65536}a.f[f]=a.f[f]+e&65535;a.K&57344||(a.L=a.L<<8|e<<3&248|f);if(6===f&&!a.B&&d&4&&0>=e&&(a.f[6]<=a.Z||65534<=a.f[6])){if(a.f[6]<=a.Z-32)return a.f[6]=4,L(a,4);a.F|=4}return c}function T(a,b,d){var c;return b&56?(0<=(c=Gc(a,b,d))&&(c=Ec(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.f[b&7];return d}function Hc(a,b){var d;b&56?0<=(d=T(a,b,3))&&(d=R(a,d)):d=a.f[b&7]&255;return d}function V(a,b){return((b&128?b|65280:b&255)<<1)+a&65535} +m.Ga=function(a){this.w.complete=!0;var b=this.w.Db=this.D&&Ic(this.D),d=a?this.w.eb?0:1:-1;this.w.eb=!1;this.T=this.P=a;this.pb&256?(nc(this),a=!1):a=!0;if(a){do{if(b){if(Jc(this.D,this.f[7],d)){this.aa();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.vb&224;if(0<(a=this.I.length))for(;0c&&(c=this.I[a].Gb,g= +a)}c>(this.H&224)&&(0>g?L(this,160):(L(this,this.I[g].Lb),this.I.splice(g,1)))}this.K&57344||(this.L=0);this.F=this.H&16;if(0<=(a=M(this,this.f[7])))switch(this.f[7]=this.f[7]+2&65535,a&61440){case 4096:0<=(c=U(this,a>>6))&&(a&56?0<=(f=T(this,a,4))&&0<=Q(this,f,c)&&(this.b=this.i=c,this.g=0):(this.b=this.i=this.f[a&7]=c,this.g=0));break;case 8192:0<=(c=U(this,a>>6))&&0<=(e=U(this,a))&&(this.b=this.i=this.u=a=c-e,this.g=(c^e)&(c^a));break;case 12288:0<=(c=U(this,a>>6))&&0<=(e=U(this,a))&&(this.b=this.i= +c&e,this.g=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<=Q(this,f,a)&&(this.b=this.i=a,this.g=0)):(this.b=this.i=a=this.f[a&7]&=~c,this.g=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<=Q(this,f,a)&&(this.b=this.i=a,this.g=0)):(this.b=this.i=a=this.f[a&7]|=c,this.g=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<=Q(this,f,a)&&(this.b=this.i=this.u=a,this.g=(c^a)&(e^a))):(g=a&7, +e=this.f[g],this.f[g]=(a=c+e)&65535,this.b=this.i=this.u=a,this.g=(c^a)&(e^a)));break;case 36864:0<=(c=Hc(this,a>>6))&&(a&56?0<=(f=T(this,a,5))&&0<=S(this,f,c)&&(this.b=this.i=c<<8,this.g=0):(c&128&&(c|=65280),this.b=this.i=this.f[a&7]=c,this.g=0));break;case 40960:0<=(c=Hc(this,a>>6))&&0<=(e=Hc(this,a))&&(a=c-e,this.b=this.i=this.u=a<<8,this.g=((c^e)&(c^a))<<8);break;case 45056:0<=(c=Hc(this,a>>6))&&0<=(e=Hc(this,a))&&(this.b=this.i=(c&e)<<8,this.g=0);break;case 49152:0<=(c=Hc(this,a>>6))&&0<=(e= +R(this,f=T(this,a,7)))&&(a=e&~c,0<=S(this,f,a)&&(this.b=this.i=a<<8,this.g=0));break;case 53248:0<=(c=Hc(this,a>>6))&&0<=(e=R(this,f=T(this,a,7)))&&(a=e|c,0<=S(this,f,a)&&(this.b=this.i=a<<8,this.g=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<=Q(this,f,a)&&(this.b=this.i=this.u=a,this.g=(c^e)&(e^a))):(g=a&7,e=this.f[g],this.f[g]=(a=e-c)&65535,this.b=this.i=this.u=a,this.g=(c^e)&(e^a)));break;default:switch(a&65024){case 2048:0<=(h=Gc(this,a,0))&&(g=a>>6&7, +0<=Dc(this,this.f[g])&&(this.f[g]=this.f[7],this.f[7]=h&65535));break;case 28672:0<=(c=U(this,a))&&(g=a>>6&7,c&32768&&(c|=-65536),e=this.f[g],e&32768&&(e|=-65536),a=~~(c*e),this.f[g]=a>>16&65535,this.f[g|1]=a&65535,this.b=a>>16,this.i=this.b|a,this.u=this.g=0,-32768>a||32767>6&7,e=this.f[g]<<16|this.f[g|1],this.u=this.g=0,c&32768&&(c|=-65536),a=~~(e/c),-32768<=a&&32767>=a?(this.f[g]=a&65535,this.f[g|1]=e-a*c&65535,this.i=a>>16|a,this.b= +a>>16):(this.g=32768,this.i=a>>15|a,this.b=e>>16,-1===c&&65534===this.f[g]&&(this.f[g]=this.f[g|1]=1))):(this.i=this.b=0,this.g=32768,this.u=65536));break;case 29696:0<=(c=U(this,a))&&(g=a>>6&7,a=this.f[g],a&32768&&(a|=4294901760),this.u=this.g=0,c&=63,c&32?(c=64-c,16>c):c&&(16>15&65535)&&65535!==e&&(this.g=32768))),this.f[g]=a&65535,this.b=this.i=a);break;case 30208:if(0<=(c=U(this,a))){g=a>>6&7;e=this.f[g]<<16|this.f[g|1];this.u= +this.g=0;c&=63;if(c&32)c=64-c,32>c-1,this.u=a<<16,a>>=1,e&2147483648&&(a|=4294967295<<32-c);else if(c){if(a=e<>15,a<<=1,32>=32-c)e|=4294967295<>16&65535;this.f[g|1]=a&65535;this.b=a>>16;this.i=a>>16|a}break;case 30720:a&56?0<=(e=N(this,f=T(this,a,6)))&&(e^=this.f[a>>6&7],0<=Q(this,f,e)&&(this.b=this.i=e,this.g=0)):(this.b=this.i=e=this.f[a&7]^=this.f[a>>6&7],this.g=0);break;case 32256:g=a>> +6&7;if(this.f[g]=this.f[g]-1&65535)this.f[7]=this.f[7]-((a&63)<<1)&65535;break;default:switch(a&65280){case 256:this.f[7]=V(this.f[7],a);break;case 512:this.i&65535&&(this.f[7]=V(this.f[7],a));break;case 768:this.i&65535||(this.f[7]=V(this.f[7],a));break;case 1024:(this.b&32768)===(this.g&32768)&&(this.f[7]=V(this.f[7],a));break;case 1280:(this.b&32768)!==(this.g&32768)&&(this.f[7]=V(this.f[7],a));break;case 1536:this.i&65535&&(this.b&32768)===(this.g&32768)&&(this.f[7]=V(this.f[7],a));break;case 1792:this.i& +65535&&(this.b&32768)===(this.g&32768)||(this.f[7]=V(this.f[7],a));break;case 32768:this.b&32768||(this.f[7]=V(this.f[7],a));break;case 33280:!(this.u&65536)&&this.i&65535&&(this.f[7]=V(this.f[7],a));break;case 33024:this.b&32768&&(this.f[7]=V(this.f[7],a));break;case 33536:if(this.u&65536||!(this.i&65535))this.f[7]=V(this.f[7],a);break;case 33792:this.g&32768||(this.f[7]=V(this.f[7],a));break;case 34048:this.g&32768&&(this.f[7]=V(this.f[7],a));break;case 34304:this.u&65536||(this.f[7]=V(this.f[7], +a));break;case 34560:this.u&65536&&(this.f[7]=V(this.f[7],a));break;case 34816:L(this,24);break;case 35072:L(this,28);break;default:switch(a&65472){case 64:0<=(h=Gc(this,a,0))&&(this.f[7]=h&65535);break;case 192:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<8|e>>8,0<=Q(this,f,a)&&(this.b=this.i=e&65280,this.g=this.u=0)):(g=a&7,e=this.f[g],this.f[g]=(e<<8|e>>8)&65535,this.b=this.i=e&65280,this.g=this.u=0);break;case 2560:a&56?0<=(f=T(this,a,4))&&0<=Q(this,f,0)&&(this.b=this.u=this.g=this.i=0):this.b=this.u= +this.g=this.i=this.f[a&7]=0;break;case 2624:0<=(e=N(this,f=T(this,a,6)))&&(a=~e,0<=Q(this,f,a)&&(this.b=this.i=a,this.u=65536,this.g=0));break;case 2688:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e+1,0<=Q(this,f,a)&&(this.b=this.i=a,this.g=a&(a^e))):(g=a&7,e=this.f[g],a=e+1,this.f[g]=a&65535,this.b=this.i=a,this.g=a&(a^e));break;case 2752:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e-1,0<=Q(this,f,a)&&(this.b=this.i=a,this.g=(a^e)&e)):(g=a&7,e=this.f[g],a=e-1,this.f[g]=a&65535,this.b=this.i=a,this.g=(a^e)&e); +break;case 2816:0<=(e=N(this,f=T(this,a,6)))&&(a=-e,0<=Q(this,f,a)&&(this.u=this.b=this.i=a,this.g=a&e));break;case 2880:0<=(e=N(this,f=T(this,a,6)))&&(a=e+(this.u>>16&1),0<=Q(this,f,a)&&(this.u=this.b=this.i=a,this.g=a&(a^e)));break;case 2944:0<=(e=N(this,f=T(this,a,6)))&&(a=e-(this.u>>16&1),0<=Q(this,f,a)&&(this.u=this.b=this.i=a,this.g=(a^e)&e));break;case 3008:0<=(e=U(this,a))&&(this.b=this.i=e,this.u=this.g=0);break;case 3072:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=(this.u&65536|e)>>1,0<=Q(this, +f,a)&&(this.u=e<<16,this.b=this.i=a,this.g=a^this.u>>1)):(g=a&7,e=this.f[g],a=(this.u&65536|e)>>1,this.f[g]=a&65535,this.u=e<<16,this.b=this.i=a,this.g=a^this.u>>1);break;case 3136:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<1|this.u>>16&1,0<=Q(this,f,a)&&(this.u=this.b=this.i=a,this.g=a^e)):(g=a&7,e=this.f[g],a=e<<1|this.u>>16&1,this.f[g]=a&65535,this.u=this.b=this.i=a,this.g=a^e);break;case 3200:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e&32768|e>>1,0<=Q(this,f,a)&&(this.u=e<<16,this.b=this.i=a,this.g= +this.b^this.u>>1)):(g=a&7,e=this.f[g],a=e&32768|e>>1,this.f[g]=a&65535,this.u=e<<16,this.b=this.i=a,this.g=this.b^this.u>>1);break;case 3264:a&56?0<=(e=N(this,f=T(this,a,6)))&&(a=e<<1,0<=Q(this,f,a)&&(this.u=this.b=this.i=a,this.g=a^e)):(g=a&7,e=this.f[g],a=e<<1,this.f[g]=a&65535,this.u=this.b=this.i=a,this.g=a^e);break;case 3328:h=this.f[7]+((a&63)<<1)&65535;0<=(c=M(this,h|65536))&&(this.f[7]=this.f[5],this.f[5]=c,this.f[6]=h+2&65535);break;case 3392:a&56?0<=(h=Gc(this,a,0))&&(61440!==(this.H&61440)&& +(h&=65535),this.B=this.H>>12&3,0<=(c=M(this,h))&&(this.B=this.H>>14&3,0<=Dc(this,c)&&(this.b=this.i=c,this.g=0))):(g=a&7,c=6!==g||(this.H>>2&12288)===(this.H&12288)?this.f[g]:this.ea[this.H>>12&3],0<=Dc(this,c)&&(this.b=this.i=c,this.g=0));break;case 3456:0<=(e=Fc(this))&&((this.K&57344||(this.L=22),a&56)?0<=(h=Gc(this,a,0))&&(h&=65535,this.B=this.H>>12&3,0<=(f=Ec(this,h,4))&&(this.B=this.H>>14&3,0<=Q(this,f,e)&&(this.b=this.i=e,this.g=0))):(g=a&7,6!==g||(this.H>>2&12288)===(this.H&12288)?this.f[g]= +e:this.ea[this.H>>12&3]=e,this.b=this.i=e,this.g=0));break;case 3520:0<=(f=T(this,a,4))&&(a=-(this.b>>15&1),0<=Q(this,f,a)&&(this.i=a,this.g=0));break;case 35328:a&56?0<=(f=T(this,a,5))&&0<=S(this,f,0)&&(this.b=this.u=this.g=this.i=0):(this.f[a&7]&=65280,this.b=this.u=this.g=this.i=0);break;case 35392:0<=(e=R(this,f=T(this,a,7)))&&(a=~e,0<=S(this,f,a)&&(this.b=this.i=a<<8,this.u=65536,this.g=0));break;case 35456:0<=(e=R(this,f=T(this,a,7)))&&(a=e+1,0<=S(this,f,a)&&(this.b=this.i=a<<8,this.g=(a&(a^ +e))<<8));break;case 35520:0<=(e=R(this,f=T(this,a,7)))&&(a=e-1,0<=S(this,f,a)&&(this.b=this.i=a<<8,this.g=((a^e)&e)<<8));break;case 35584:0<=(e=R(this,f=T(this,a,7)))&&(a=-e,0<=S(this,f,a)&&(this.u=this.b=this.i=a<<8,this.g=(a&e)<<8));break;case 35648:0<=(e=R(this,f=T(this,a,7)))&&(a=e+(this.u>>16&1),0<=S(this,f,a)&&(this.b=this.i=this.u=a<<8,this.g=(a&(a^e))<<8));break;case 35712:0<=(e=R(this,f=T(this,a,7)))&&(a=e-(this.u>>16&1),0<=S(this,f,a)&&(this.b=this.i=this.u=a<<8,this.g=((a^e)&e)<<8));break; +case 35776:0<=(e=Hc(this,a))&&(this.b=this.i=e<<8,this.u=this.g=0);break;case 35840:0<=(e=R(this,f=T(this,a,7)))&&(a=((this.u&65536)>>8|e)>>1,0<=S(this,f,a)&&(this.u=e<<16,this.b=this.i=a<<8,this.g=this.b^this.u>>1));break;case 35904:0<=(e=R(this,f=T(this,a,7)))&&(a=e<<1|this.u>>16&1,0<=S(this,f,a)&&(this.u=this.b=this.i=a<<8,this.g=(a^e)<<8));break;case 35968:0<=(e=R(this,f=T(this,a,7)))&&(a=e&128|e>>1,0<=S(this,f,a)&&(this.u=e<<16,this.b=this.i=a<<8,this.g=this.b^this.u>>1));break;case 36032:0<= +(e=R(this,f=T(this,a,7)))&&(a=e<<1,0<=S(this,f,a)&&(this.u=this.b=this.i=a<<8,this.g=(a^e)<<8));break;case 36160:a&56?0<=(h=Gc(this,a,0))&&(this.B=this.H>>12&3,0<=(c=M(this,h|65536))&&(this.B=this.H>>14&3,0<=Dc(this,c)&&(this.b=this.i=c,this.g=0))):(g=a&7,c=6!==g||(this.H>>2&12288)===(this.H&12288)?this.f[g]:this.ea[this.H>>12&3],0<=Dc(this,c)&&(this.b=this.i=c,this.g=0));break;case 36224:0<=(e=Fc(this))&&((this.K&57344||(this.L=22),a&56)?0<=(h=Gc(this,a,0))&&(this.B=this.H>>12&3,0<=(f=Ec(this,h| +65536,4))&&(this.B=this.H>>14&3,0<=Q(this,f,e)&&(this.b=this.i=e,this.g=0))):(g=a&7,6!==g||(this.H>>2&12288)===(this.H&12288)?this.f[g]=e:this.ea[this.H>>12&3]=e,this.b=this.i=e,this.g=0));break;default:switch(a&65528){case 128:0<=(c=Fc(this))&&(g=a&7,this.f[7]=this.f[g],this.f[g]=c);break;case 152:this.H&49152||(this.H=this.H&63519|(a&7)<<5,this.V=1);break;case 160:case 168:a&1&&(this.u=0);a&2&&(this.g=0);a&4&&(this.i=1);a&8&&(this.b=0);break;case 176:case 184:a&1&&(this.u=65536);a&2&&(this.g=32768); +a&4&&(this.i=0);a&8&&(this.b=32768);break;default:switch(a){case 0:49152&this.H?L(this,4):(this.cb=3,nc(this),console.log("HALT at "+this.f[7].toString(8)));break;case 1:g=0;if(0<(a=this.I.length))for(;0>>0,h],p=sa(n,k,a.ib);0>p&&n.splice(-(p+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.F.push({Kb:b,A:d,Fb:c,pa:e,gb:f})}delete this.pa}return!0};Kc.prototype.qa=function(){return!0}; +function Lc(a,b,d,c){if(c)a.da("Unable to load system ROM (error "+c+": "+b+")");else{ab(a.ob,b,d);if("["==d.charAt(0)||"{"==d.charAt(0))try{var e=eval("("+d+")"),f=e.bytes,h=e.data;if(f)a.g=f;else if(h)for(a.g=Array(4*h.length),c=d=0;d>8&255,a.g[c++]=h[d]>>16&255,a.g[c++]=h[d]>>24&255;else a.g=e;a.pa=e.symbols;if(!a.g.length){t("Empty ROM: "+b);return}if(1==a.g.length){t(a.g[0]);return}}catch(g){a.da("ROM data error: "+g.message);return}else for(b=d.replace(/\n/gm, +" ").replace(/ +$/,"").split(" "),a.g=Array(b.length),e=0;e>>c.$].Ha(e&c.g,a.g[d]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.u?b.push(a.u):null!=a.u&&a.u.length&&(b=a.u);for(d=0;d>>e.$;0>>=e.$;0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Pc.prototype.ab=function(){return-1};Pc.prototype.bb=function(){}; +function Rc(a,b,d,c){if(d)if(b){0>a.u&&a.i.length&&(a.u=0);if(0>a.u||b!=a.i[a.u])a.i.splice(0,0,b),a.u=0;a.u--}else a.R?b="end":b=a.i[a.u+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(oa(b.substring(d,f))),d=f+1}}return a} +function Sc(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 Sc(a,b,d){var c;if(b){b=Tc(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;c=n+c;f>>=8}f=d;h=0;g="";h?11>=3;c=p(d,0,!0)+" "+d+". "+("0o"+g)+" "+("0b"+c)}a.u((null!=b?b+": ":"")+c);return e} -function Wc(a,b){if(b)return Vc(a,b,a.V[b]);var d=0;for(b in a.V)Vc(a,b,a.V[b]),d++;return 0>>c.H.aa;k=1}c.u("blockid physical blockaddr used size type");c.u("-------- --------- ---------- ------ ------ ----");for(var d=-1,l=0;k--;){var n=b[g];n.type==d?l++||c.u("..."):(d=n.type,l=yb[d],n&&c.u(p(n.id)+" %"+p(g<>>d.aa,d=e!=d.i?d.P[f].xb(e,c):d.P[f++].Qa(e,c)|d.P[f&d.G].Qa(0,c+1)<<8;b&&fd(a,b)}return d}; -m.gb=function(a,b,d){var c=W(a);if(-1!==c){var e=this.H;e.P[(c&e.j)>>>e.aa].Ia(c&e.i,b&255,c);d&&fd(a,d);F(this.b,!0)}};m.Bb=function(a,b,d){var c=W(a);if(-1!==c){var e=this.H,f=c&e.i,h=(c&e.j)>>>e.aa;f!=e.i?e.P[h].Ab(f,b&65535,c):(e.P[h++].Ia(f,b&255,c),e.P[h&e.G].Ia(0,b>>8&255,c+1));d&&fd(a,d);F(this.b,!0)}};function V(a){return{B:a,ma:!1}}function gd(a){return[a.B,a.ma]}function hd(a){return{B:a[0],ma:a[1]}} -function X(a,b,d){var c;d=(d?a.N:a.pa).B;if(void 0!==b){c=b=Tc(a,b);var e;if(c.match(/^[a-z_][a-z0-9_]*$/i))for(c=c.toUpperCase(),d=0;dd&&(d=va(cd,a.substr(b,1))));return d};m.bb=function(a){var b;if(0<=a){var d=this.b;switch(a){case 12:b=d.g[7];break;case 14:b=d.I&-14|0|(d.ta&255?0:4)|(d.ta&256?1:0)}}return b}; -function kd(a,b){b=Tc(a,b);for(var d=0,c,e;0<=(d=b.indexOf("@",d));){e=a.ab(b,d+1);if(0<=e){c=0;var f=a.bb(e);if(void 0!==f)switch(e){case 12:case 14:c=4}b=b.substr(0,d)+(c?p(f,c):"??")+b.substr(d+1+cd[e].length)}d++}for(d=0;0<=(d=b.indexOf("#",d));)e=b.substr(d+1,2),c=da(e),null!=c&&32<=c&&128>c?(c=e+" '"+String.fromCharCode(c)+"'",b=b.replace("#"+e,c),d+=c.length):d++;for(d=0;0<=(d=b.indexOf("$",d));)e=b.substr(d+1,9),(c=X(a,e))?(c=e+' "'+jd(a,c)+'"',b=b.replace("$"+e,c),d+=c.length):d++;for(d= -0;0<=(d=b.indexOf("^",d));)e=b.substr(d+1,9),(c=X(a,e))?(fd(c),c=e+' "'+jd(a,c,11)+'"',b=b.replace("^"+e,c),d+=c.length):d++;return b}m.message=function(a,b){b&&(a+=" at "+p(V(this.b.g[7]).B,4));if(this.Y&1073741824)this.fa.push(a);else if(!this.da||a!=this.da)if(this.da=a,this.Y&-2147483648&&(this.ba(),a+=" (cpu halted)"),this.u(a),this.b){var d=this.b;mc(d);d.da=0;F(d)}}; -function Zc(a){var b;if(Hc(a)){if(!a.M||!a.M.length){a.M=Array(1E3);for(b=0;b>>c.aa],!1)}a.O=["br"];if(void 0!==a.C)for(b=1;b>>c.aa],!0);a.C=["bw"];a.na=0} -m.xa=function(a,b,d){var c=!0;d||pd(this,a,b,!1,!0);if(a!=this.i){var e=W(b);if(-1===e)this.u("invalid address: "+p(b.B,4)),c=!1;else{var f=this.H;f.P[e>>>f.aa].xa(e&f.i,a==this.C)}}c&&(a.push(b),d?b.ma=!0:(qd(this,a,a.length-1,"set"),Zc(this)));return c};function pd(a,b,d,c,e){var f=!1;d=W(d);for(var h=1;h>>c.aa],b==a.C));g.ma||Zc(a);break}}return f} -function rd(a,b){for(var d=1;d>24,4);break;case 3:B=p(J.Ua(ga,2),4);break;default:J="imm("+p(E,4,!0)+")";break a}E&64?B="["+B+"]":E&16||(B="0x"+B);J=B}else E&16?J=cd[(q&3840)>>8]:E&128&&(J=(f>>3&7).toString()); -if(!J||!J.length){g="INVALID";break}0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Gb;if(e>=h&&eg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.u(l)}g[3]&&(h=g[3],f=null);f=Rd(a,b,h,f);a.u(f);a.N=b;e-=b.B-k;d++}}} -function sd(a,b,d){var c=!0;try{b.length&&"end"!=b?d||a.u(">> "+b):(a.T&&(a.u("ended assemble at "+p(a.S.B,4)),a.N=a.S,a.T=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.da=null;if(pb(a)&&0l||"z"aa.length&&(a.u("note: only "+aa.length+" available"),P=aa.length);K-=P;0>K&&(null==aa[aa.length-1].B?(P=K+P,K=0):K+=aa.length);var pc=[];"call"==yd&&(Ea=1E5,pc=["CALL"]);for(void 0!==xd&&a.u(P+" instructions earlier:");0=aa.length&&(K=0);a.wa=P;Ad++;Ea--}}Ad||(a.u("no "+zd+ -"history available"),a.wa=void 0)}else{var Bb=X(a,Y);if(Bb){var Cb=0;pa&&("l"==pa.charAt(0)&&(pa=pa.substr(1)||re),Cb=Uc(a,pa)>>>0,65536>4||1;te--&&0Gb?String.fromCharCode(Gb):".";Eb--}qa&&(qa+="\n");qa+=Y+" "+eb+(0==db?" "+rc:"")}qa&& -a.u(qa);a.pa=Bb}}}}break;case "e":if("else"==f[0])break;var Hb=1,Dd=255,Ed=a.ua,Fd=a.gb;"ew"==f[0]&&(Hb=2,Dd=65535,Ed=a.Ua,Fd=a.Bb);var Gd=Hb<<1,Hd=f[1];if(null==Hd)a.u("edit memory commands:"),a.u("\teb [a] [...] edit bytes at address a"),a.u("\tew [a] [...] edit words at address a");else{var Ib=X(a,Hd);if(Ib)for(var Jb=2;Jbvc;){for(var ra=null,xe=256;65536>hb.B>>>0;){Jd.B=a.Ua(hb,2);if(null==hb.B||!xe--)break;for(var ye=a,Kb=Jd,Kd=null,ib=Kb.B,Ld=ib,wc=1;6>=wc&&ib;wc++){if(2\nLicense: GPL version 3 or later ");this.u("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bbe){if(de(c,this.L)){this.C=new G(this,"1.30.0","failsafe");de(this.C)&&(je(this,c),a=2,ke(this.C));H(this.C,"timestamp",ua());le(this.C);var e=this.i&&!this.G;if(1==a||xa("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(d=he(c)){var f=ie(c,"code"),h=ie(c,"data");f&&("ok"==f?de(c,h):("error"==f&& -"no machine state"!=h?(this.ea("Error: "+h),"unable to verify user"==h&&(Ga("user",""),this.j=null)):this.u(f+": "+h),ke(c),de(c)?(d=he(c),e=!0):d=!1))}e&&ge(this,d?c:null)}else 2==a&&c.clear()}else ge(this);delete this.L;delete this.M}e=ab(this.id);for(f=0;fa[1];a=a[2];this.W=!0;this.A.X=!0;var c=this.K.power;c&&(c.textContent="Shutdown");this.b&&(me(this,this.b,b,d,a),this.b.Ja());this.R&&(je(this,b),b.clear());!d&&this.C&&(this.C.clear(),delete this.C);this.w=0}; -function je(a,b){if(xa("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var d=a.j||"",c=b.toString(),e={app:"PDP11js",ver:"1.30.0"};e.url=a.V;e.user=d;e.type="bug";e.data=c;wa("http://www.pcjs.org/api/v1/report",e,!0)}} -function Zd(a,b,d){var c,e="none";if(a.w)return null;a.w--;var f=new G(a,"1.30.0"),h=new G(a,"1.30.0","validate"),g=ua();H(h,"timestamp",g);H(f,"timestamp",g);H(f,"version","1.30.0");H(f,"url",window?window.location.href:null);H(f,"browser",window?window.navigator.userAgent:"");a.b&&a.b.ra&&(d&&a.b.ba(),c=a.b.ra(b,d),"object"===typeof c&&H(f,a.b.id,c),d&&(a.b.A.X=!1,!1===c&&(e=null)));for(var g=ab(a.id),k=0;k=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;c=n+c;f>>=8}f=d;h=0;g="";h?11>=3;c=q(d,0,!0)+" "+d+". "+("0o"+g)+" "+("0b"+c)}a.j((null!=b?b+": ":"")+c);return e} +function Xc(a,b){if(b)return Wc(a,b,a.T[b]);var d=0;for(b in a.T)Wc(a,b,a.T[b]),d++;return 0>>c.G.$;k=1}c.j("blockid physical blockaddr used size type");c.j("-------- --------- ---------- ------ ------ ----");for(var d=-1,l=0;k--;){var n=b[g];n.type==d?l++||c.j("..."):(d=n.type,l=zb[d],n&&c.j(q(n.id)+" %"+q(g<>>d.$].Qa(c&d.g,c),b&&gd(a,b));return d};m.va=function(a,b){var d=65535,c=X(a);-1!==c&&(d=Ab(this.G,c),b&&gd(a,b));return d}; +m.fb=function(a,b,d){var c=X(a);if(-1!==c){var e=this.G;e.N[(c&e.i)>>>e.$].Ha(c&e.g,b&255,c);d&&gd(a,d);H(this.b,!0)}};m.Ab=function(a,b,d){var c=X(a);if(-1!==c){var e=this.G,f=c&e.g,h=(c&e.i)>>>e.$;f!=e.g?e.N[h].zb(f,b&65535,c):(e.N[h++].Ha(f,b&255,c),e.N[h&e.F].Ha(0,b>>8&255,c+1));d&&gd(a,d);H(this.b,!0)}};function W(a){return{A:a,la:!1}}function hd(a){return[a.A,a.la]}function id(a){return{A:a[0],la:a[1]}} +function Y(a,b,d){var c;d=(d?a.L:a.ma).A;if(void 0!==b){c=b=Uc(a,b);var e;if(c.match(/^[a-z_][a-z0-9_]*$/i))for(c=c.toUpperCase(),d=0;dd&&(d=va(dd,a.substr(b,1))));return d};m.bb=function(a){var b;if(0<=a){var d=this.b;switch(a){case 12:b=d.f[7];break;case 14:b=d.H&-14|0|(d.sa&255?0:4)|(d.sa&256?1:0)}}return b}; +function ld(a,b){b=Uc(a,b);for(var d=0,c,e;0<=(d=b.indexOf("@",d));){e=a.ab(b,d+1);if(0<=e){c=0;var f=a.bb(e);if(void 0!==f)switch(e){case 12:case 14:c=4}b=b.substr(0,d)+(c?q(f,c):"??")+b.substr(d+1+dd[e].length)}d++}for(d=0;0<=(d=b.indexOf("#",d));)e=b.substr(d+1,2),c=ea(e),null!=c&&32<=c&&128>c?(c=e+" '"+String.fromCharCode(c)+"'",b=b.replace("#"+e,c),d+=c.length):d++;for(d=0;0<=(d=b.indexOf("$",d));)e=b.substr(d+1,9),(c=Y(a,e))?(c=e+' "'+kd(a,c)+'"',b=b.replace("$"+e,c),d+=c.length):d++;for(d= +0;0<=(d=b.indexOf("^",d));)e=b.substr(d+1,9),(c=Y(a,e))?(gd(c),c=e+' "'+kd(a,c,11)+'"',b=b.replace("^"+e,c),d+=c.length):d++;return b}m.message=function(a,b){b&&(a+=" at "+q(W(this.b.f[7]).A,4));if(this.X&1073741824)this.ea.push(a);else if(!this.ca||a!=this.ca)if(this.ca=a,this.X&-2147483648&&(this.aa(),a+=" (cpu halted)"),this.j(a),this.b){var d=this.b;nc(d);d.ca=0;H(d)}}; +function $c(a){var b;if(Ic(a)){if(!a.K||!a.K.length){a.K=Array(1E3);for(b=0;b>>c.$],!1)}a.M=["br"];if(void 0!==a.B)for(b=1;b>>c.$],!0);a.B=["bw"];a.na=0} +m.wa=function(a,b,d){var c=!0;d||qd(this,a,b,!1,!0);if(a!=this.g){var e=X(b);if(-1===e)this.j("invalid address: "+q(b.A,4)),c=!1;else{var f=this.G;f.N[e>>>f.$].wa(e&f.g,a==this.B)}}c&&(a.push(b),d?b.la=!0:(rd(this,a,a.length-1,"set"),$c(this)));return c};function qd(a,b,d,c,e){var f=!1;d=X(d);for(var h=1;h>>c.$],b==a.B));g.la||$c(a);break}}return f} +function sd(a,b){for(var d=1;d>24)&65535);else{var Aa=f&C;C&4032&&(Aa>>=6,C>>=6);if(C&63){var C=void 0,w=Aa&7;switch(Aa&56){case 0:z="R"+w;break;case 1:z="@R"+w;break;case 2:7>w?z="(R"+w+")+":(C=u.va(p,2),z="#"+r(C));break;case 3:7>w?z="@(R"+w+")+":(C=u.va(p,2),z="@#"+r(C));break;case 4:z="-(R"+w+ +")";break;case 5:z="@-R("+w+")";break;case 6:C=u.va(p,2);z=r(C)+(7>w?"(R"+w+")":"(PC)");break;case 7:C=u.va(p,2),z="@"+r(C)+(7>w?"(R"+w+")":"(PC)")}}}u=z;if(!u||!u.length){g="INVALID";break}0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Fb;if(e>=h&&eg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.j(l)}g[3]&&(h=g[3],f=null);f=Sd(a,b,h,f);a.j(f);a.L=b;e-=b.A-k;d++}}} +function Rd(a,b,d){var c=!0;try{b.length&&"end"!=b?d||a.j(">> "+b):(a.R&&(a.j("ended assemble at "+q(a.P.A,4)),a.L=a.P,a.R=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ca=null;if(qb(a)&&0l||"z"ba.length&&(a.j("note: only "+ba.length+" available"),P=ba.length);K-=P;0>K&&(null==ba[ba.length-1].A?(P=K+P,K=0):K+=ba.length);var qc=[];"call"==yd&&(Fa=1E5,qc=["CALL"]);for(void 0!==xd&&a.j(P+" instructions earlier:");0=ba.length&&(K=0);a.oa=P;Ad++;Fa--}}Ad||(a.j("no "+zd+ +"history available"),a.oa=void 0)}else{var Cb=Y(a,Z);if(Cb){var Db=0;pa&&("l"==pa.charAt(0)&&(pa=pa.substr(1)||re),Db=Vc(a,pa)>>>0,65536>4||1;te--&&0Hb?String.fromCharCode(Hb):".";Fb--}qa&&(qa+="\n");qa+=Z+" "+eb+(0==db?" "+sc:"")}qa&& +a.j(qa);a.ma=Cb}}}}break;case "e":if("else"==f[0])break;var Ib=1,Dd=255,Ed=a.Ia,Fd=a.fb;"ew"==f[0]&&(Ib=2,Dd=65535,Ed=a.va,Fd=a.Ab);var Gd=Ib<<1,Hd=f[1];if(null==Hd)a.j("edit memory commands:"),a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var Jb=Y(a,Hd);if(Jb)for(var Kb=2;Kbwc;){for(var ra=null,xe=256;65536>hb.A>>>0;){Jd.A=a.va(hb,2);if(null==hb.A||!xe--)break;for(var ye=a,Lb=Jd,Kd=null,ib=Lb.A,Ld=ib,xc=1;6>=xc&&ib;xc++){if(2\nLicense: GPL version 3 or later ");this.j("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis ");for(b=0;bbe){if(de(c,this.K)){this.B=new I(this,"1.30.0","failsafe");de(this.B)&&(je(this,c),a=2,ke(this.B));J(this.B,"timestamp",ua());le(this.B);var e=this.g&&!this.F;if(1==a||xa("Click OK to restore the previous PDP11js machine state, or CANCEL to reset the machine.")){if(d=he(c)){var f=ie(c,"code"),h=ie(c,"data");f&&("ok"==f?de(c,h):("error"==f&& +"no machine state"!=h?(this.da("Error: "+h),"unable to verify user"==h&&(Ha("user",""),this.i=null)):this.j(f+": "+h),ke(c),de(c)?(d=he(c),e=!0):d=!1))}e&&ge(this,d?c:null)}else 2==a&&c.clear()}else ge(this);delete this.K;delete this.L}e=bb(this.id);for(f=0;fa[1];a=a[2];this.V=!0;this.w.W=!0;var c=this.J.power;c&&(c.textContent="Shutdown");this.b&&(me(this,this.b,b,d,a),this.b.Ka());this.P&&(je(this,b),b.clear());!d&&this.B&&(this.B.clear(),delete this.B);this.u=0}; +function je(a,b){if(xa("There may be a problem with your PDP11js machine.\n\nTo help us diagnose it, click OK to send this PDP11js machine state to http://www.pcjs.org.")){var d=a.i||"",c=b.toString(),e={app:"PDP11js",ver:"1.30.0"};e.url=a.U;e.user=d;e.type="bug";e.data=c;wa("http://www.pcjs.org/api/v1/report",e,!0)}} +function Zd(a,b,d){var c,e="none";if(a.u)return null;a.u--;var f=new I(a,"1.30.0"),h=new I(a,"1.30.0","validate"),g=ua();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.b&&a.b.qa&&(d&&a.b.aa(),c=a.b.qa(b,d),"object"===typeof c&&J(f,a.b.id,c),d&&(a.b.w.W=!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(q){g=null,a=q.message}else a="unrecognized XML: "+(255g.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+"...");wa(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);Ee(a,b,d)}})}else d(a,null)} -function Fe(a,b,d,c){function e(a){if(void 0===g){var b=h&&z(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ma(a))}function f(a){e("Error: "+a);k&&(--qe||Ra(!0));k=!1}var h,g,k=!0;qe++;Za[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));n.appendChild(q)}d|| -(d="/versions/pdp11/1.30.0/components.xsl");l=function(c,g){g?Ce(d,null,null,!1,e,function(c,k){if(k)if($a(a,d,c),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--qe||Ra(!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),--qe||Ra(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(c)}):f(c)};"<"!=b.charAt(0)?Ce(b,a,c,!0,e,l):De(b,null,a,c,!1,e,l)}else f("missing machine element: "+a)}catch(y){f(y.message)}return k}window.embedPDP11=function(a,b,d,c){Ra(!1);return Fe(a,b,d,c)};window.enableEvents=Ra;window.sendEvent=Sa;})(); +function Fe(a,b,d,c){function e(a){if(void 0===g){var b=h&&D(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ma(a))}function f(a){e("Error: "+a);k&&(--qe||Sa(!0));k=!1}var h,g,k=!0;qe++;$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?Ce(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,--qe||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),--qe||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)?Ce(b,a,c,!0,e,l):De(b,null,a,c,!1,e,l)}else f("missing machine element: "+a)}catch(u){f(u.message)}return k}window.embedPDP11=function(a,b,d,c){Sa(!1);return Fe(a,b,d,c)};window.enableEvents=Sa;window.sendEvent=Ta;})();