diff --git a/modules/pc8080/lib/debugger.js b/modules/pc8080/lib/debugger.js index 0f144ef90..bbc414712 100644 --- a/modules/pc8080/lib/debugger.js +++ b/modules/pc8080/lib/debugger.js @@ -87,6 +87,8 @@ function Debugger(parmsDbg) Component.call(this, "Debugger", parmsDbg, Debugger); + this.style = Debugger.STYLE_8086; + /* * These keep track of instruction activity, but only when tracing or when Debugger checks * have been enabled (eg, one or more breakpoints have been set). @@ -98,14 +100,6 @@ function Debugger(parmsDbg) this.nCycles = 0; this.cOpcodes = this.cOpcodesStart = 0; - /* - * Default number of hex chars in a register and a linear address (ie, for real-mode); - * updated by initBus(). - */ - this.cchReg = 2; - this.cchAddr = 4; - this.maskAddr = 0xffff; - /* * Most commands that require an address call parseAddr(), which defaults to dbgAddrNextCode * or dbgAddrNextData when no address has been given. doDump() and doUnassemble(), in turn, @@ -256,21 +250,18 @@ if (DEBUGGER) { 'print': "print expression", 'r': "dump/set registers", 'reset': "reset machine", + 's': "set options", 't [#]': "trace", // other variations: tr (trace and dump registers) 'u [#]': "unassemble", - 'x': "execution options", 'v': "print version", 'var': "assign variable" }; + Debugger.STYLE_8080 = 8080; + Debugger.STYLE_8086 = 8086; + /* * CPU instruction ordinals - * - * Note that individual instructions end with ordinal 162 and instruction groups begin with ordinal 163; - * the disassembler knows it's dealing with a group whenever the ordinal is not a valid index into INS_NAMES. - * - * NOTE: While this list started alphabetical, there are a few wrinkles; eg, POPA/POPF/PUSHF/PUSHA are - * sequential to make it easier to detect instructions that require a D suffix when the operand size is 32 bits. */ Debugger.INS = { NONE: 0, ACI: 1, ADC: 2, ADD: 3, ADI: 4, ANA: 5, ANI: 6, CALL: 7, @@ -287,6 +278,9 @@ if (DEBUGGER) { /* * CPU instruction names (mnemonics), indexed by CPU instruction ordinal (above) + * + * If you change the default style, using the "s" command (eg, "s 8086"), then the 8086 table + * will be used instead. TODO: Add a "s z80" command for Z80-style mnemonics. */ Debugger.INS_NAMES = [ "NONE", "ACI", "ADC", "ADD", "ADI", "ANA", "ANI", "CALL", @@ -301,8 +295,18 @@ if (DEBUGGER) { "STC", "SUB", "SUI", "XCHG", "XRA", "XRI", "XTHL" ]; - Debugger.CPU_8080 = 0; - Debugger.CPUS = [8080]; + Debugger.INS_NAMES_8086 = [ + "NONE", "ADC", "ADC", "ADD", "ADD", "AND", "AND", "CALL", + "CALLC", "CALLS", "CALLNC", "CALLNZ", "CALLNS", "CALLP", "CALLNP", "CALLZ", + "NOT", "CMC", "CMP", "CMP", "DAA", "ADD", "DEC", "DEC", + "CLI", "STI", "HLT", "IN", "INC", "INC", "JMP", "JC", + "JS", "JNC", "JNZ", "JNS", "JP", "JNP", "JZ", "LDA", + "MOV", "MOV", "MOV", "MOV", "MOV", "NOP", "OR", "OR", + "OUT", "JMP", "POP", "PUSH", "RCL", "RCR", "RET", "RETC", + "RETS", "RETNC", "RETNZ", "RETNS", "RETP", "RETNP", "RETZ", "ROL", + "ROR", "RST", "SBB", "SBB", "MOV", "MOV", "MOV", "MOV", + "STC", "SUB", "SUB", "XCHG", "XOR", "XOR", "XCHG" + ]; Debugger.REG_B = 0x00; Debugger.REG_C = 0x01; @@ -312,16 +316,15 @@ if (DEBUGGER) { Debugger.REG_L = 0x05; Debugger.REG_M = 0x06; Debugger.REG_A = 0x07; - Debugger.REG_F = 0x08; // the flags register ("F") - Debugger.REG_BC = 0x09; - Debugger.REG_DE = 0x0A; - Debugger.REG_HL = 0x0B; - Debugger.REG_PS = 0x0C; // aka PSW, which could also be called "AF", since A is the high byte and F is the low byte - Debugger.REG_SP = 0x0D; - Debugger.REG_PC = 0x0E; + Debugger.REG_BC = 0x08; + Debugger.REG_DE = 0x09; + Debugger.REG_HL = 0x0A; + Debugger.REG_SP = 0x0B; + Debugger.REG_PC = 0x0C; + Debugger.REG_PS = 0x0D; // aka PSW (aka AF if Z80-style) Debugger.REGS = [ - "B", "C", "D", "E", "H", "L", "M", "A", "F", "BC", "DE", "HL", "PSW", "SP", "PC" + "B", "C", "D", "E", "H", "L", "M", "A", "BC", "DE", "HL", "SP", "PC", "PSW" ]; /* @@ -345,27 +348,29 @@ if (DEBUGGER) { */ Debugger.TYPE_REG = 0x0010; // register Debugger.TYPE_IMM = 0x0020; // immediate data + Debugger.TYPE_ADDR = 0x0033; // immediate (word) address Debugger.TYPE_MEM = 0x0040; // memory reference + Debugger.TYPE_INT = 0x0080; // interrupt level encoded in instruction (bits 3-5) /* * TYPE_IREG values, based on the REG_* constants. * * NOte that TYPE_M isn't really a register, just an alternative form of TYPE_HL | TYPE_MEM. */ - Debugger.TYPE_A = (Debugger.REG_A << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); - Debugger.TYPE_B = (Debugger.REG_B << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); - Debugger.TYPE_C = (Debugger.REG_C << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); - Debugger.TYPE_D = (Debugger.REG_D << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); - Debugger.TYPE_E = (Debugger.REG_E << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); - Debugger.TYPE_H = (Debugger.REG_H << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); - Debugger.TYPE_L = (Debugger.REG_L << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); - Debugger.TYPE_M = (Debugger.REG_M << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE | Debugger.TYPE_MEM); - Debugger.TYPE_BC = (Debugger.REG_BC << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); - Debugger.TYPE_DE = (Debugger.REG_DE << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); - Debugger.TYPE_HL = (Debugger.REG_HL << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); - Debugger.TYPE_PS = (Debugger.REG_PS << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); - Debugger.TYPE_SP = (Debugger.REG_SP << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); - Debugger.TYPE_PC = (Debugger.REG_PC << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); + Debugger.TYPE_A = (Debugger.REG_A << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); + Debugger.TYPE_B = (Debugger.REG_B << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); + Debugger.TYPE_C = (Debugger.REG_C << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); + Debugger.TYPE_D = (Debugger.REG_D << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); + Debugger.TYPE_E = (Debugger.REG_E << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); + Debugger.TYPE_H = (Debugger.REG_H << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); + Debugger.TYPE_L = (Debugger.REG_L << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE); + Debugger.TYPE_M = (Debugger.REG_M << 8 | Debugger.TYPE_REG | Debugger.TYPE_BYTE | Debugger.TYPE_MEM); + Debugger.TYPE_BC = (Debugger.REG_BC << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); + Debugger.TYPE_DE = (Debugger.REG_DE << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); + Debugger.TYPE_HL = (Debugger.REG_HL << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); + Debugger.TYPE_SP = (Debugger.REG_SP << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); + Debugger.TYPE_PC = (Debugger.REG_PC << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); + Debugger.TYPE_PS = (Debugger.REG_PS << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); /* * TYPE_OTHER bit definitions @@ -373,6 +378,7 @@ if (DEBUGGER) { Debugger.TYPE_IN = 0x1000; // operand is input Debugger.TYPE_OUT = 0x2000; // operand is output Debugger.TYPE_BOTH = (Debugger.TYPE_IN | Debugger.TYPE_OUT); + Debugger.TYPE_OPT = 0x4000; // optional operand (ie, normally omitted in 8080 assembly language) Debugger.TYPE_UNDOC = 0x8000; // opcode is an undocumented alternative encoding /* @@ -396,261 +402,261 @@ if (DEBUGGER) { */ Debugger.aaOpDescs = [ /* 0x00 */ [Debugger.INS.NOP], - /* 0x01 */ [Debugger.INS.LXI, Debugger.TYPE_BC, Debugger.TYPE_IMM], - /* 0x02 */ [Debugger.INS.STAX, Debugger.TYPE_BC | Debugger.TYPE_MEM], + /* 0x01 */ [Debugger.INS.LXI, Debugger.TYPE_BC, Debugger.TYPE_IMM], + /* 0x02 */ [Debugger.INS.STAX, Debugger.TYPE_BC | Debugger.TYPE_MEM, Debugger.TYPE_A | Debugger.TYPE_OPT], /* 0x03 */ [Debugger.INS.INX, Debugger.TYPE_BC], /* 0x04 */ [Debugger.INS.INR, Debugger.TYPE_B], /* 0x05 */ [Debugger.INS.DCR, Debugger.TYPE_B], - /* 0x06 */ [Debugger.INS.MVI, Debugger.TYPE_B, Debugger.TYPE_IMM], + /* 0x06 */ [Debugger.INS.MVI, Debugger.TYPE_B, Debugger.TYPE_IMM], /* 0x07 */ [Debugger.INS.RLC], /* 0x08 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], - /* 0x09 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_BC | Debugger.TYPE_IN], // let's be more explicit about the operands - /* 0x0A */ [Debugger.INS.LDAX, Debugger.TYPE_BC | Debugger.TYPE_MEM], + /* 0x09 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_BC], // let's be more explicit about the operands + /* 0x0A */ [Debugger.INS.LDAX, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_BC | Debugger.TYPE_MEM], /* 0x0B */ [Debugger.INS.DCX, Debugger.TYPE_BC], /* 0x0C */ [Debugger.INS.INR, Debugger.TYPE_C], /* 0x0D */ [Debugger.INS.DCR, Debugger.TYPE_C], - /* 0x0E */ [Debugger.INS.MVI, Debugger.TYPE_C, Debugger.TYPE_IMM], + /* 0x0E */ [Debugger.INS.MVI, Debugger.TYPE_C, Debugger.TYPE_IMM], /* 0x0F */ [Debugger.INS.RRC], /* 0x10 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], - /* 0x11 */ [Debugger.INS.LXI, Debugger.TYPE_DE, Debugger.TYPE_IMM], - /* 0x12 */ [Debugger.INS.STAX, Debugger.TYPE_DE | Debugger.TYPE_MEM], + /* 0x11 */ [Debugger.INS.LXI, Debugger.TYPE_DE, Debugger.TYPE_IMM], + /* 0x12 */ [Debugger.INS.STAX, Debugger.TYPE_DE | Debugger.TYPE_MEM, Debugger.TYPE_A | Debugger.TYPE_OPT], /* 0x13 */ [Debugger.INS.INX, Debugger.TYPE_DE], /* 0x14 */ [Debugger.INS.INR, Debugger.TYPE_D], /* 0x15 */ [Debugger.INS.DCR, Debugger.TYPE_D], - /* 0x16 */ [Debugger.INS.MVI, Debugger.TYPE_D, Debugger.TYPE_IMM], + /* 0x16 */ [Debugger.INS.MVI, Debugger.TYPE_D, Debugger.TYPE_IMM], /* 0x17 */ [Debugger.INS.RAL], /* 0x18 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], - /* 0x19 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_DE | Debugger.TYPE_IN], // let's be more explicit about the operands - /* 0x1A */ [Debugger.INS.LDAX, Debugger.TYPE_DE | Debugger.TYPE_MEM], + /* 0x19 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_DE], // let's be more explicit about the operands + /* 0x1A */ [Debugger.INS.LDAX, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_DE | Debugger.TYPE_MEM], /* 0x1B */ [Debugger.INS.DCX, Debugger.TYPE_DE], /* 0x1C */ [Debugger.INS.INR, Debugger.TYPE_E], /* 0x1D */ [Debugger.INS.DCR, Debugger.TYPE_E], - /* 0x1E */ [Debugger.INS.MVI, Debugger.TYPE_E, Debugger.TYPE_IMM], + /* 0x1E */ [Debugger.INS.MVI, Debugger.TYPE_E, Debugger.TYPE_IMM], /* 0x1F */ [Debugger.INS.RAR], /* 0x20 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], - /* 0x21 */ [Debugger.INS.LXI, Debugger.TYPE_HL, Debugger.TYPE_IMM], - /* 0x22 */ [Debugger.INS.SHLD, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_MEM], + /* 0x21 */ [Debugger.INS.LXI, Debugger.TYPE_HL, Debugger.TYPE_IMM], + /* 0x22 */ [Debugger.INS.SHLD, Debugger.TYPE_ADDR | Debugger.TYPE_MEM, Debugger.TYPE_HL | Debugger.TYPE_OPT], /* 0x23 */ [Debugger.INS.INX, Debugger.TYPE_HL], /* 0x24 */ [Debugger.INS.INR, Debugger.TYPE_H], /* 0x25 */ [Debugger.INS.DCR, Debugger.TYPE_H], - /* 0x26 */ [Debugger.INS.MVI, Debugger.TYPE_H, Debugger.TYPE_IMM], + /* 0x26 */ [Debugger.INS.MVI, Debugger.TYPE_H, Debugger.TYPE_IMM], /* 0x27 */ [Debugger.INS.DAA], /* 0x28 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], - /* 0x29 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_HL | Debugger.TYPE_IN], // let's be more explicit about the operands - /* 0x2A */ [Debugger.INS.LHLD, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_MEM], + /* 0x29 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_HL], // let's be more explicit about the operands + /* 0x2A */ [Debugger.INS.LHLD, Debugger.TYPE_HL | Debugger.TYPE_OPT, Debugger.TYPE_ADDR | Debugger.TYPE_MEM], /* 0x2B */ [Debugger.INS.DCX, Debugger.TYPE_HL], /* 0x2C */ [Debugger.INS.INR, Debugger.TYPE_L], /* 0x2D */ [Debugger.INS.DCR, Debugger.TYPE_L], - /* 0x2E */ [Debugger.INS.MVI, Debugger.TYPE_L, Debugger.TYPE_IMM], - /* 0x2F */ [Debugger.INS.CMA], + /* 0x2E */ [Debugger.INS.MVI, Debugger.TYPE_L, Debugger.TYPE_IMM], + /* 0x2F */ [Debugger.INS.CMA, Debugger.TYPE_A | Debugger.TYPE_OPT], /* 0x30 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], - /* 0x31 */ [Debugger.INS.LXI, Debugger.TYPE_SP, Debugger.TYPE_IMM], - /* 0x32 */ [Debugger.INS.STA, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_MEM], + /* 0x31 */ [Debugger.INS.LXI, Debugger.TYPE_SP, Debugger.TYPE_IMM], + /* 0x32 */ [Debugger.INS.STA, Debugger.TYPE_ADDR | Debugger.TYPE_MEM, Debugger.TYPE_A | Debugger.TYPE_OPT], /* 0x33 */ [Debugger.INS.INX, Debugger.TYPE_SP], /* 0x34 */ [Debugger.INS.INR, Debugger.TYPE_M], /* 0x35 */ [Debugger.INS.DCR, Debugger.TYPE_M], - /* 0x36 */ [Debugger.INS.MVI, Debugger.TYPE_M, Debugger.TYPE_IMM], + /* 0x36 */ [Debugger.INS.MVI, Debugger.TYPE_M, Debugger.TYPE_IMM], /* 0x37 */ [Debugger.INS.STC], /* 0x38 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], - /* 0x39 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_SP | Debugger.TYPE_IN], // let's be more explicit about the operands - /* 0x3A */ [Debugger.INS.LDA, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_MEM], + /* 0x39 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_SP], // let's be more explicit about the operands + /* 0x3A */ [Debugger.INS.LDA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_ADDR | Debugger.TYPE_MEM], /* 0x3B */ [Debugger.INS.DCX, Debugger.TYPE_SP], /* 0x3C */ [Debugger.INS.INR, Debugger.TYPE_A], /* 0x3D */ [Debugger.INS.DCR, Debugger.TYPE_A], - /* 0x3E */ [Debugger.INS.MVI, Debugger.TYPE_A, Debugger.TYPE_IMM], + /* 0x3E */ [Debugger.INS.MVI, Debugger.TYPE_A, Debugger.TYPE_IMM], /* 0x3F */ [Debugger.INS.CMC], - /* 0x40 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_B], - /* 0x41 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_C], - /* 0x42 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_D], - /* 0x43 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_E], - /* 0x44 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_H], - /* 0x45 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_L], - /* 0x46 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_M], - /* 0x47 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_A], - /* 0x48 */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_B], - /* 0x49 */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_C], - /* 0x4A */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_D], - /* 0x4B */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_E], - /* 0x4C */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_H], - /* 0x4D */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_L], - /* 0x4E */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_M], - /* 0x4F */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_A], - /* 0x50 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_B], - /* 0x51 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_C], - /* 0x52 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_D], - /* 0x53 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_E], - /* 0x54 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_H], - /* 0x55 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_L], - /* 0x56 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_M], - /* 0x57 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_A], - /* 0x58 */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_B], - /* 0x59 */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_C], - /* 0x5A */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_D], - /* 0x5B */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_E], - /* 0x5C */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_H], - /* 0x5D */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_L], - /* 0x5E */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_M], - /* 0x5F */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_A], - /* 0x60 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_B], - /* 0x61 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_C], - /* 0x62 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_D], - /* 0x63 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_E], - /* 0x64 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_H], - /* 0x65 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_L], - /* 0x66 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_M], - /* 0x67 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_A], - /* 0x68 */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_B], - /* 0x69 */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_C], - /* 0x6A */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_D], - /* 0x6B */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_E], - /* 0x6C */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_H], - /* 0x6D */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_L], - /* 0x6E */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_M], - /* 0x6F */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_A], - /* 0x70 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_B], - /* 0x71 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_C], - /* 0x72 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_D], - /* 0x73 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_E], - /* 0x74 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_H], - /* 0x75 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_L], - /* 0x76 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_M], - /* 0x77 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_A], - /* 0x78 */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_B], - /* 0x79 */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_C], - /* 0x7A */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_D], - /* 0x7B */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_E], - /* 0x7C */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_H], - /* 0x7D */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_L], - /* 0x7E */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_M], - /* 0x7F */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_A], - /* 0x80 */ [Debugger.INS.ADD, Debugger.TYPE_B], - /* 0x81 */ [Debugger.INS.ADD, Debugger.TYPE_C], - /* 0x82 */ [Debugger.INS.ADD, Debugger.TYPE_D], - /* 0x83 */ [Debugger.INS.ADD, Debugger.TYPE_E], - /* 0x84 */ [Debugger.INS.ADD, Debugger.TYPE_H], - /* 0x85 */ [Debugger.INS.ADD, Debugger.TYPE_L], - /* 0x86 */ [Debugger.INS.ADD, Debugger.TYPE_M], - /* 0x87 */ [Debugger.INS.ADD, Debugger.TYPE_A], - /* 0x88 */ [Debugger.INS.ADC, Debugger.TYPE_B], - /* 0x89 */ [Debugger.INS.ADC, Debugger.TYPE_C], - /* 0x8A */ [Debugger.INS.ADC, Debugger.TYPE_D], - /* 0x8B */ [Debugger.INS.ADC, Debugger.TYPE_E], - /* 0x8C */ [Debugger.INS.ADC, Debugger.TYPE_H], - /* 0x8D */ [Debugger.INS.ADC, Debugger.TYPE_L], - /* 0x8E */ [Debugger.INS.ADC, Debugger.TYPE_M], - /* 0x8F */ [Debugger.INS.ADC, Debugger.TYPE_A], - /* 0x90 */ [Debugger.INS.SUB, Debugger.TYPE_B], - /* 0x91 */ [Debugger.INS.SUB, Debugger.TYPE_C], - /* 0x92 */ [Debugger.INS.SUB, Debugger.TYPE_D], - /* 0x93 */ [Debugger.INS.SUB, Debugger.TYPE_E], - /* 0x94 */ [Debugger.INS.SUB, Debugger.TYPE_H], - /* 0x95 */ [Debugger.INS.SUB, Debugger.TYPE_L], - /* 0x96 */ [Debugger.INS.SUB, Debugger.TYPE_M], - /* 0x97 */ [Debugger.INS.SUB, Debugger.TYPE_A], - /* 0x98 */ [Debugger.INS.SBB, Debugger.TYPE_B], - /* 0x99 */ [Debugger.INS.SBB, Debugger.TYPE_C], - /* 0x9A */ [Debugger.INS.SBB, Debugger.TYPE_D], - /* 0x9B */ [Debugger.INS.SBB, Debugger.TYPE_E], - /* 0x9C */ [Debugger.INS.SBB, Debugger.TYPE_H], - /* 0x9D */ [Debugger.INS.SBB, Debugger.TYPE_L], - /* 0x9E */ [Debugger.INS.SBB, Debugger.TYPE_M], - /* 0x9F */ [Debugger.INS.SBB, Debugger.TYPE_A], - /* 0xA0 */ [Debugger.INS.ANA, Debugger.TYPE_B], - /* 0xA1 */ [Debugger.INS.ANA, Debugger.TYPE_C], - /* 0xA2 */ [Debugger.INS.ANA, Debugger.TYPE_D], - /* 0xA3 */ [Debugger.INS.ANA, Debugger.TYPE_E], - /* 0xA4 */ [Debugger.INS.ANA, Debugger.TYPE_H], - /* 0xA5 */ [Debugger.INS.ANA, Debugger.TYPE_L], - /* 0xA6 */ [Debugger.INS.ANA, Debugger.TYPE_M], - /* 0xA7 */ [Debugger.INS.ANA, Debugger.TYPE_A], - /* 0xA8 */ [Debugger.INS.XRA, Debugger.TYPE_B], - /* 0xA9 */ [Debugger.INS.XRA, Debugger.TYPE_C], - /* 0xAA */ [Debugger.INS.XRA, Debugger.TYPE_D], - /* 0xAB */ [Debugger.INS.XRA, Debugger.TYPE_E], - /* 0xAC */ [Debugger.INS.XRA, Debugger.TYPE_H], - /* 0xAD */ [Debugger.INS.XRA, Debugger.TYPE_L], - /* 0xAE */ [Debugger.INS.XRA, Debugger.TYPE_M], - /* 0xAF */ [Debugger.INS.XRA, Debugger.TYPE_A], - /* 0xB0 */ [Debugger.INS.ORA, Debugger.TYPE_B], - /* 0xB1 */ [Debugger.INS.ORA, Debugger.TYPE_C], - /* 0xB2 */ [Debugger.INS.ORA, Debugger.TYPE_D], - /* 0xB3 */ [Debugger.INS.ORA, Debugger.TYPE_E], - /* 0xB4 */ [Debugger.INS.ORA, Debugger.TYPE_H], - /* 0xB5 */ [Debugger.INS.ORA, Debugger.TYPE_L], - /* 0xB6 */ [Debugger.INS.ORA, Debugger.TYPE_M], - /* 0xB7 */ [Debugger.INS.ORA, Debugger.TYPE_A], - /* 0xB8 */ [Debugger.INS.CMP, Debugger.TYPE_B], - /* 0xB9 */ [Debugger.INS.CMP, Debugger.TYPE_C], - /* 0xBA */ [Debugger.INS.CMP, Debugger.TYPE_D], - /* 0xBB */ [Debugger.INS.CMP, Debugger.TYPE_E], - /* 0xBC */ [Debugger.INS.CMP, Debugger.TYPE_H], - /* 0xBD */ [Debugger.INS.CMP, Debugger.TYPE_L], - /* 0xBE */ [Debugger.INS.CMP, Debugger.TYPE_M], - /* 0xBF */ [Debugger.INS.CMP, Debugger.TYPE_A], + /* 0x40 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_B], + /* 0x41 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_C], + /* 0x42 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_D], + /* 0x43 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_E], + /* 0x44 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_H], + /* 0x45 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_L], + /* 0x46 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_M], + /* 0x47 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_A], + /* 0x48 */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_B], + /* 0x49 */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_C], + /* 0x4A */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_D], + /* 0x4B */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_E], + /* 0x4C */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_H], + /* 0x4D */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_L], + /* 0x4E */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_M], + /* 0x4F */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_A], + /* 0x50 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_B], + /* 0x51 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_C], + /* 0x52 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_D], + /* 0x53 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_E], + /* 0x54 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_H], + /* 0x55 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_L], + /* 0x56 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_M], + /* 0x57 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_A], + /* 0x58 */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_B], + /* 0x59 */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_C], + /* 0x5A */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_D], + /* 0x5B */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_E], + /* 0x5C */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_H], + /* 0x5D */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_L], + /* 0x5E */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_M], + /* 0x5F */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_A], + /* 0x60 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_B], + /* 0x61 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_C], + /* 0x62 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_D], + /* 0x63 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_E], + /* 0x64 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_H], + /* 0x65 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_L], + /* 0x66 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_M], + /* 0x67 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_A], + /* 0x68 */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_B], + /* 0x69 */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_C], + /* 0x6A */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_D], + /* 0x6B */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_E], + /* 0x6C */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_H], + /* 0x6D */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_L], + /* 0x6E */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_M], + /* 0x6F */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_A], + /* 0x70 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_B], + /* 0x71 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_C], + /* 0x72 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_D], + /* 0x73 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_E], + /* 0x74 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_H], + /* 0x75 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_L], + /* 0x76 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_M], + /* 0x77 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_A], + /* 0x78 */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_B], + /* 0x79 */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_C], + /* 0x7A */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_D], + /* 0x7B */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_E], + /* 0x7C */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_H], + /* 0x7D */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_L], + /* 0x7E */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_M], + /* 0x7F */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_A], + /* 0x80 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B], + /* 0x81 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C], + /* 0x82 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D], + /* 0x83 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E], + /* 0x84 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H], + /* 0x85 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L], + /* 0x86 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M], + /* 0x87 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A], + /* 0x88 */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B], + /* 0x89 */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C], + /* 0x8A */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D], + /* 0x8B */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E], + /* 0x8C */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H], + /* 0x8D */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L], + /* 0x8E */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M], + /* 0x8F */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A], + /* 0x90 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B], + /* 0x91 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C], + /* 0x92 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D], + /* 0x93 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E], + /* 0x94 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H], + /* 0x95 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L], + /* 0x96 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M], + /* 0x97 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A], + /* 0x98 */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B], + /* 0x99 */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C], + /* 0x9A */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D], + /* 0x9B */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E], + /* 0x9C */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H], + /* 0x9D */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L], + /* 0x9E */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M], + /* 0x9F */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A], + /* 0xA0 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B], + /* 0xA1 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C], + /* 0xA2 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D], + /* 0xA3 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E], + /* 0xA4 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H], + /* 0xA5 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L], + /* 0xA6 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M], + /* 0xA7 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A], + /* 0xA8 */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B], + /* 0xA9 */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C], + /* 0xAA */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D], + /* 0xAB */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E], + /* 0xAC */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H], + /* 0xAD */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L], + /* 0xAE */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M], + /* 0xAF */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A], + /* 0xB0 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B], + /* 0xB1 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C], + /* 0xB2 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D], + /* 0xB3 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E], + /* 0xB4 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H], + /* 0xB5 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L], + /* 0xB6 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M], + /* 0xB7 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A], + /* 0xB8 */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B], + /* 0xB9 */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C], + /* 0xBA */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D], + /* 0xBB */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E], + /* 0xBC */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H], + /* 0xBD */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L], + /* 0xBE */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M], + /* 0xBF */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A], /* 0xC0 */ [Debugger.INS.RNZ], /* 0xC1 */ [Debugger.INS.POP, Debugger.TYPE_BC], - /* 0xC2 */ [Debugger.INS.JNZ, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xC3 */ [Debugger.INS.JMP, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xC4 */ [Debugger.INS.CNZ, Debugger.TYPE_IMM | Debugger.TYPE_WORD], + /* 0xC2 */ [Debugger.INS.JNZ, Debugger.TYPE_ADDR], + /* 0xC3 */ [Debugger.INS.JMP, Debugger.TYPE_ADDR], + /* 0xC4 */ [Debugger.INS.CNZ, Debugger.TYPE_ADDR], /* 0xC5 */ [Debugger.INS.PUSH, Debugger.TYPE_BC], - /* 0xC6 */ [Debugger.INS.ADI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], - /* 0xC7 */ [Debugger.INS.RST], + /* 0xC6 */ [Debugger.INS.ADI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], + /* 0xC7 */ [Debugger.INS.RST, Debugger.TYPE_INT], /* 0xC8 */ [Debugger.INS.RZ], /* 0xC9 */ [Debugger.INS.RET], - /* 0xCA */ [Debugger.INS.JZ, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xCB */ [Debugger.INS.JMP, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_UNDOC], - /* 0xCC */ [Debugger.INS.CZ, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xCD */ [Debugger.INS.CALL, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xCE */ [Debugger.INS.ACI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], - /* 0xCF */ [Debugger.INS.RST], + /* 0xCA */ [Debugger.INS.JZ, Debugger.TYPE_ADDR], + /* 0xCB */ [Debugger.INS.JMP, Debugger.TYPE_ADDR | Debugger.TYPE_UNDOC], + /* 0xCC */ [Debugger.INS.CZ, Debugger.TYPE_ADDR], + /* 0xCD */ [Debugger.INS.CALL, Debugger.TYPE_ADDR], + /* 0xCE */ [Debugger.INS.ACI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], + /* 0xCF */ [Debugger.INS.RST, Debugger.TYPE_INT], /* 0xD0 */ [Debugger.INS.RNC], /* 0xD1 */ [Debugger.INS.POP, Debugger.TYPE_DE], - /* 0xD2 */ [Debugger.INS.JNC, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xD3 */ [Debugger.INS.OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], - /* 0xD4 */ [Debugger.INS.CNC, Debugger.TYPE_IMM | Debugger.TYPE_WORD], + /* 0xD2 */ [Debugger.INS.JNC, Debugger.TYPE_ADDR], + /* 0xD3 */ [Debugger.INS.OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE, Debugger.TYPE_A | Debugger.TYPE_OPT], + /* 0xD4 */ [Debugger.INS.CNC, Debugger.TYPE_ADDR], /* 0xD5 */ [Debugger.INS.PUSH, Debugger.TYPE_DE], - /* 0xD6 */ [Debugger.INS.SUI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], - /* 0xD7 */ [Debugger.INS.RST], + /* 0xD6 */ [Debugger.INS.SUI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], + /* 0xD7 */ [Debugger.INS.RST, Debugger.TYPE_INT], /* 0xD8 */ [Debugger.INS.RC], /* 0xD9 */ [Debugger.INS.RET, Debugger.TYPE_UNDOC], - /* 0xDA */ [Debugger.INS.JC, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xDB */ [Debugger.INS.IN, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], - /* 0xDC */ [Debugger.INS.CC, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xDD */ [Debugger.INS.CALL, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_UNDOC], - /* 0xDE */ [Debugger.INS.SBI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], - /* 0xDF */ [Debugger.INS.RST], + /* 0xDA */ [Debugger.INS.JC, Debugger.TYPE_ADDR], + /* 0xDB */ [Debugger.INS.IN, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], + /* 0xDC */ [Debugger.INS.CC, Debugger.TYPE_ADDR], + /* 0xDD */ [Debugger.INS.CALL, Debugger.TYPE_ADDR | Debugger.TYPE_UNDOC], + /* 0xDE */ [Debugger.INS.SBI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], + /* 0xDF */ [Debugger.INS.RST, Debugger.TYPE_INT], /* 0xE0 */ [Debugger.INS.RPO], /* 0xE1 */ [Debugger.INS.POP, Debugger.TYPE_HL], - /* 0xE2 */ [Debugger.INS.JPO, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xE3 */ [Debugger.INS.XTHL, Debugger.TYPE_SP | Debugger.TYPE_MEM, Debugger.TYPE_HL], // let's be more explicit about the operands - /* 0xE4 */ [Debugger.INS.CPO, Debugger.TYPE_IMM | Debugger.TYPE_WORD], + /* 0xE2 */ [Debugger.INS.JPO, Debugger.TYPE_ADDR], + /* 0xE3 */ [Debugger.INS.XTHL, Debugger.TYPE_SP | Debugger.TYPE_MEM, Debugger.TYPE_HL],// let's be more explicit about the operands + /* 0xE4 */ [Debugger.INS.CPO, Debugger.TYPE_ADDR], /* 0xE5 */ [Debugger.INS.PUSH, Debugger.TYPE_HL], - /* 0xE6 */ [Debugger.INS.ANI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], - /* 0xE7 */ [Debugger.INS.RST], + /* 0xE6 */ [Debugger.INS.ANI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], + /* 0xE7 */ [Debugger.INS.RST, Debugger.TYPE_INT], /* 0xE8 */ [Debugger.INS.RPE], - /* 0xE9 */ [Debugger.INS.PCHL, Debugger.TYPE_PC, Debugger.TYPE_HL], // let's be more explicit about the operands - /* 0xEA */ [Debugger.INS.JPE, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xEB */ [Debugger.INS.XCHG, Debugger.TYPE_HL, Debugger.TYPE_DE], // let's be more explicit about the operands - /* 0xEC */ [Debugger.INS.CPE, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xED */ [Debugger.INS.CALL, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_UNDOC], - /* 0xEE */ [Debugger.INS.XRI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], - /* 0xEF */ [Debugger.INS.RST], + /* 0xE9 */ [Debugger.INS.PCHL, Debugger.TYPE_HL], + /* 0xEA */ [Debugger.INS.JPE, Debugger.TYPE_ADDR], + /* 0xEB */ [Debugger.INS.XCHG, Debugger.TYPE_HL, Debugger.TYPE_DE], // let's be more explicit about the operands + /* 0xEC */ [Debugger.INS.CPE, Debugger.TYPE_ADDR], + /* 0xED */ [Debugger.INS.CALL, Debugger.TYPE_ADDR | Debugger.TYPE_UNDOC], + /* 0xEE */ [Debugger.INS.XRI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], + /* 0xEF */ [Debugger.INS.RST, Debugger.TYPE_INT], /* 0xF0 */ [Debugger.INS.RP], /* 0xF1 */ [Debugger.INS.POP, Debugger.TYPE_PS], - /* 0xF2 */ [Debugger.INS.JP, Debugger.TYPE_IMM | Debugger.TYPE_WORD], + /* 0xF2 */ [Debugger.INS.JP, Debugger.TYPE_ADDR], /* 0xF3 */ [Debugger.INS.DI], - /* 0xF4 */ [Debugger.INS.CP, Debugger.TYPE_IMM | Debugger.TYPE_WORD], + /* 0xF4 */ [Debugger.INS.CP, Debugger.TYPE_ADDR], /* 0xF5 */ [Debugger.INS.PUSH, Debugger.TYPE_PS], - /* 0xF6 */ [Debugger.INS.ORI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], - /* 0xF7 */ [Debugger.INS.RST], + /* 0xF6 */ [Debugger.INS.ORI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], + /* 0xF7 */ [Debugger.INS.RST, Debugger.TYPE_INT], /* 0xF8 */ [Debugger.INS.RM], - /* 0xF9 */ [Debugger.INS.SPHL, Debugger.TYPE_SP, Debugger.TYPE_HL], // let's be more explicit about the operands - /* 0xFA */ [Debugger.INS.JM, Debugger.TYPE_IMM | Debugger.TYPE_WORD], + /* 0xF9 */ [Debugger.INS.SPHL, Debugger.TYPE_SP, Debugger.TYPE_HL], // let's be more explicit about the operands + /* 0xFA */ [Debugger.INS.JM, Debugger.TYPE_ADDR], /* 0xFB */ [Debugger.INS.EI], - /* 0xFC */ [Debugger.INS.CM, Debugger.TYPE_IMM | Debugger.TYPE_WORD], - /* 0xFD */ [Debugger.INS.CALL, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_UNDOC], - /* 0xFE */ [Debugger.INS.CPI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], - /* 0xFF */ [Debugger.INS.RST] + /* 0xFC */ [Debugger.INS.CM, Debugger.TYPE_ADDR], + /* 0xFD */ [Debugger.INS.CALL, Debugger.TYPE_ADDR | Debugger.TYPE_UNDOC], + /* 0xFE */ [Debugger.INS.CPI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], + /* 0xFF */ [Debugger.INS.RST, Debugger.TYPE_INT] ]; /* @@ -713,9 +719,6 @@ if (DEBUGGER) { var sMessages = cmp.getMachineParm('messages'); if (sMessages) this.messageInit(sMessages); - this.cchAddr = bus.getWidth() >> 2; - this.maskAddr = bus.nBusLimit; - this.aaOpDescs = Debugger.aaOpDescs; this.messageDump(Messages.BUS, function onDumpBus(asArgs) { dbg.dumpBus(asArgs); }); @@ -1385,15 +1388,14 @@ if (DEBUGGER) { case Debugger.REG_H: case Debugger.REG_L: case Debugger.REG_M: - case Debugger.REG_F: cch = 2; break; case Debugger.REG_BC: case Debugger.REG_DE: case Debugger.REG_HL: - case Debugger.REG_PS: case Debugger.REG_SP: case Debugger.REG_PC: + case Debugger.REG_PS: cch = 4; break; } @@ -1417,9 +1419,6 @@ if (DEBUGGER) { case Debugger.REG_A: n = cpu.regA; break; - case Debugger.REG_F: - n = cpu.getPS(); - break; case Debugger.REG_B: n = cpu.regB; break; @@ -1450,15 +1449,15 @@ if (DEBUGGER) { case Debugger.REG_M: n = cpu.getByte(cpu.getHL()); break; - case Debugger.REG_PS: - n = (cpu.regA << 8) | (cpu.getPS() & 0xff); - break; case Debugger.REG_SP: n = cpu.getSP(); break; case Debugger.REG_PC: n = cpu.getPC(); break; + case Debugger.REG_PS: + n = (cpu.regA << 8) | (cpu.getPS() & 0xff); + break; default: break; } @@ -2429,7 +2428,7 @@ if (DEBUGGER) { var bOpcode = this.getByte(dbgAddr, 1); - var asOpcodes = Debugger.INS_NAMES; + var asOpcodes = this.style != Debugger.STYLE_8086? Debugger.INS_NAMES : Debugger.INS_NAMES_8086; var aOpDesc = this.aaOpDescs[bOpcode]; var iIns = aOpDesc[0]; @@ -2445,6 +2444,10 @@ if (DEBUGGER) { type = aOpDesc[iOperand]; if (type === undefined) continue; + if ((type & Debugger.TYPE_OPT) && this.style == Debugger.STYLE_8080) continue; + + var typeMode = type & Debugger.TYPE_MODE; + if (!typeMode) continue; var typeSize = type & Debugger.TYPE_SIZE; if (!typeSize) { @@ -2458,13 +2461,15 @@ if (DEBUGGER) { type |= (iOperand == 1? Debugger.TYPE_OUT : Debugger.TYPE_IN); } - var typeMode = type & Debugger.TYPE_MODE; if (typeMode & Debugger.TYPE_IMM) { sOperand = this.getImmOperand(type, dbgAddr); } else if (typeMode & Debugger.TYPE_REG) { sOperand = this.getRegOperand((type & Debugger.TYPE_IREG) >> 8, type, dbgAddr); } + else if (typeMode & Debugger.TYPE_INT) { + sOperand = ((bOpcode >> 3) & 0x7).toString(); + } if (!sOperand || !sOperand.length) { sOperands = "INVALID"; @@ -2524,11 +2529,12 @@ if (DEBUGGER) { sOperand = str.toHex(this.getShort(dbgAddr, 2), 4); break; default: - sOperand = "imm(" + str.toHexWord(type) + ')'; - break; + return "imm(" + str.toHexWord(type) + ')'; } - if (type & Debugger.TYPE_MEM) { + if (this.style == Debugger.STYLE_8086 && (type & Debugger.TYPE_MEM)) { sOperand = '[' + sOperand + ']'; + } else if (!(type & Debugger.TYPE_REG)) { + sOperand = (this.style == Debugger.STYLE_8080? '$' : "0x") + sOperand; } return sOperand; }; @@ -2545,11 +2551,18 @@ if (DEBUGGER) { Debugger.prototype.getRegOperand = function(iReg, type, dbgAddr) { /* - * Although this breaks with assembler conventions, I'm going to experiment with some different + * Although this breaks with 8080 assembler conventions, I'm going to experiment with some different * mnemonics; specifically, "[HL]" instead of "M". This is also more in keeping with how getImmOperand() * displays memory references (ie, by enclosing them in brackets). */ - return iReg == Debugger.REG_M? "[HL]" : Debugger.REGS[iReg]; + var sOperand = Debugger.REGS[iReg]; + if (this.style == Debugger.STYLE_8086 && (type & Debugger.TYPE_MEM)) { + if (iReg == Debugger.REG_M) { + sOperand = "HL"; + } + sOperand = '[' + sOperand + ']'; + } + return sOperand; }; /** @@ -2624,8 +2637,8 @@ if (DEBUGGER) { * * Sample 8080 register dump: * - * A=00 B=00 C=00 D=00 E=00 H=00 L=00 SP=0000 PS=00 I0 S0 Z0 A0 P0 C0 - * FFF0 C300F0 JMP F000 + * A=00 BC=0000 DE=0000 HL=0000 SP=0000 PSW=0002 I0 S0 Z0 A0 P0 C0 + * 0000 00 NOP * * @this {Debugger} * @return {string} @@ -2634,14 +2647,11 @@ if (DEBUGGER) { { var s; s = this.getRegOutput(Debugger.REG_A) + - this.getRegOutput(Debugger.REG_F) + - this.getRegOutput(Debugger.REG_B) + - this.getRegOutput(Debugger.REG_C) + - this.getRegOutput(Debugger.REG_D) + - this.getRegOutput(Debugger.REG_E) + - this.getRegOutput(Debugger.REG_H) + - this.getRegOutput(Debugger.REG_L) + + this.getRegOutput(Debugger.REG_BC) + + this.getRegOutput(Debugger.REG_DE) + + this.getRegOutput(Debugger.REG_HL) + this.getRegOutput(Debugger.REG_SP) + + this.getRegOutput(Debugger.REG_PS) + this.getFlagOutput('I') + this.getFlagOutput('S') + this.getFlagOutput('Z') + this.getFlagOutput('A') + this.getFlagOutput('P') + this.getFlagOutput('C'); return s; @@ -3669,11 +3679,12 @@ if (DEBUGGER) { aaSortedOpcodeCounts.sort(function(p, q) { return q[1] - p[1]; }); + var asOpcodes = this.style != Debugger.STYLE_8086? Debugger.INS_NAMES : Debugger.INS_NAMES_8086; for (i = 0; i < aaSortedOpcodeCounts.length; i++) { var bOpcode = aaSortedOpcodeCounts[i][0]; var cFreq = aaSortedOpcodeCounts[i][1]; if (cFreq) { - this.println((Debugger.INS_NAMES[this.aaOpDescs[bOpcode][0]] + " ").substr(0, 5) + " (" + str.toHexByte(bOpcode) + "): " + cFreq + " times"); + this.println((asOpcodes[this.aaOpDescs[bOpcode][0]] + " ").substr(0, 5) + " (" + str.toHexByte(bOpcode) + "): " + cFreq + " times"); cData++; } } @@ -3833,12 +3844,7 @@ if (DEBUGGER) { var dbgAddr = this.parseAddr(sAddr, true); if (dbgAddr) { - var addr = this.getAddr(dbgAddr); - if (MAXDEBUG && fPrint) { - this.println(this.toHexAddr(dbgAddr) + " (%" + str.toHex(addr, this.cchAddr) + ')'); - } - var aSymbol = this.findSymbol(dbgAddr, true); if (aSymbol.length) { var nDelta, sDelta, s; @@ -3951,22 +3957,22 @@ if (DEBUGGER) { }; /** - * doExecOptions(asArgs) + * doOptions(asArgs) * * @this {Debugger} * @param {Array.} asArgs */ - Debugger.prototype.doExecOptions = function(asArgs) + Debugger.prototype.doOptions = function(asArgs) { - if (!asArgs[1] || asArgs[1] == '?') { - this.println("execution options:"); - this.println("\tcs int #\tset checksum cycle interval to #"); - this.println("\tcs start #\tset checksum cycle start count to #"); - this.println("\tcs stop #\tset checksum cycle stop count to #"); - this.println("\tsp #\t\tset speed multiplier to #"); - return; - } switch (asArgs[1]) { + case "8080": + this.style = Debugger.STYLE_8080; + break; + + case "8086": + this.style = Debugger.STYLE_8086; + break; + case "cs": var nCycles; if (asArgs[3] !== undefined) nCycles = +asArgs[3]; // warning: decimal instead of hex conversion @@ -3988,7 +3994,8 @@ if (DEBUGGER) { this.cpu.resetChecksum(); } this.println("checksums " + (this.cpu.flags.fChecksum? "enabled" : "disabled")); - break; + return; + case "sp": if (asArgs[2] !== undefined) { if (!this.cpu.setSpeed(+asArgs[2])) { @@ -3996,11 +4003,26 @@ if (DEBUGGER) { } } this.println("target speed: " + this.cpu.getSpeedTarget() + " (" + this.cpu.getSpeed() + "x)"); + return; + + case "?": + this.println("debugger options:"); + this.println("\t8080\t\tselect 8080-style mnemonics"); + this.println("\t8086\t\tselect 8086-style mnemonics"); + this.println("\tcs int #\tset checksum cycle interval to #"); + this.println("\tcs start #\tset checksum cycle start count to #"); + this.println("\tcs stop #\tset checksum cycle stop count to #"); + this.println("\tsp #\t\tset speed multiplier to #"); break; + default: - this.println("unknown option: " + asArgs[1]); + if (asArgs[1]) { + this.println("unknown option: " + asArgs[1]); + return; + } break; } + this.println(this.style + "-style mnemonics enabled"); }; /** @@ -4077,9 +4099,6 @@ if (DEBUGGER) { if (w !== undefined) { fValid = true; var sRegMatch = sReg.toUpperCase(); - if (sRegMatch.charAt(0) == 'E' && this.cchReg <= 4) { - sRegMatch = null; - } switch (sRegMatch) { case "A": cpu.regA = w & 0xff; @@ -4676,6 +4695,9 @@ if (DEBUGGER) { } this.doRegisters(asArgs); break; + case 's': + this.doOptions(asArgs); + break; case 't': this.doTrace(asArgs[0], asArgs[1]); break; @@ -4692,9 +4714,6 @@ if (DEBUGGER) { this.println((APPNAME || "PC8080") + " version " + (XMLVERSION || APPVERSION) + " (" + this.cpu.model + (COMPILED? ",RELEASE" : (DEBUG? ",DEBUG" : ",NODEBUG")) + (TYPEDARRAYS? ",TYPEDARRAYS" : (BYTEARRAYS? ",BYTEARRAYS" : ",LONGARRAYS")) + ')'); this.println(web.getUserAgent()); break; - case 'x': - this.doExecOptions(asArgs); - break; case '?': if (asArgs[1]) { this.doPrint(sCmd.substr(1)); diff --git a/versions/pc8080/1.21.7/pc8080-dbg.js b/versions/pc8080/1.21.7/pc8080-dbg.js index c8cb01052..ba22c622c 100644 --- a/versions/pc8080/1.21.7/pc8080-dbg.js +++ b/versions/pc8080/1.21.7/pc8080-dbg.js @@ -1,197 +1,200 @@ (function(){var m;function aa(a,b){var c;if(a){b||(b=16);if("$"==a.charAt(0))b=16,a=a.substr(1);else if("0x"==a.substr(0,2))b=16,a=a.substr(2);else{var d=a.charAt(a.length-1).toLowerCase();"h"==d?(b=16,d=null):"."==d&&(b=10,d=null);null==d&&(a=a.substr(0,a.length-1))}var e,d=a,f=b;(f&&10!=f?16==f?null!==d.match(/^[0-9a-f]+$/i):2==f&&null!==d.match(/^[01]+$/i):null!==d.match(/^[0-9]+$/))&&!isNaN(e=parseInt(a,b))&&(c=e|0)}return c} -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 r(a){return"0x"+p(a,4)}function ba(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function r(a){return"0x"+q(a,4)}function ba(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0":">",'"':""","'":"'"};function fa(a){return a.replace(/[&<>"']/g,function(a){return ea[a]})}function ga(a,b){return(a+" ").slice(0,b)}function ha(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} function ia(a,b,c){var d=0,e=a.length,f=0;for(void 0===c&&(c=function(a,b){return a>b?1:a>1,g;g=c(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 la(a,b){var c;if(Array.prototype.indexOf)return a.indexOf(b,c);c=c||0;0>c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;c=this.T?12:24>=this.T?14:15;this.ia=1<>2;this.s=this.ia-1;this.S=this.Y/this.ia|0;this.W=this.S-1;this.w=[];this.D=[];this.H=this.I=!1;this.ba=[];this.ea=[];a=new C;tb(a,this.C);this.B=Array(this.S);for(b=0;b>>a.X;0a.ia?a.ia:c;if(f&&f.size){if(f.type==d){if(b+c<=f.A)return f.kb+=f.A-b,f.A=b,!0;if(b>=f.A+f.kb){g=f.size-(b-h);g>c&&(g=c);f.kb=b-f.A+g;c-=g;b=h+a.ia;continue}}return vb(1,b,c)}f=a.B[e];b=new C(b,g,a.ia,d);tb(b,a.C,f);a.B[e++]=b;b=h+a.ia;c-=g}return 0>=c?!0:vb(2,b,c)} -sb.prototype.U=function(a){return this.B[(a&this.G)>>>this.X].Ia(a&this.s,a)};function wb(a,b){return a.B[(b&a.G)>>>a.X].ib(b&a.s,b)}function Fb(a,b){if(void 0===b)return a.H=!a.H,a.H;void 0===a.w[b]&&(a.w[b]=[null,!1]);a.w[b][1]=!a.w[b][1];return a.w[b][1]} -function Gb(a,b){for(var c=1,d=0,e=0;0>>=e)&g;if(void 0!==f){if(f[0])f[0](b,g,void 0);a.C&&a.I!=f[1]&&Kb(a.C,b,g)}else a.C&&(hb(a.C,a,b,g,void 0),a.I&&Kb(a.C,b,g));e+=h<<3;b+=h;d-=h}}function vb(a,b,c){t("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}var Lb;if(nb){var Mb=new ArrayBuffer(2);(new DataView(Mb)).setUint16(0,256,!0);Lb=256===(new Uint16Array(Mb))[0]}else Lb=!1;var Nb=Lb; -function C(a,b,c,d){this.id=Ob+=2;this.b=null;this.A=a;this.kb=b;this.size=c||0;this.type=d||Pb;this.s=d==Qb;tb(this);this.ya=this.Wb=!1;if(c)if(nb)this.G=new ArrayBuffer(c),this.H=new DataView(this.G,0,c),this.B=new Uint8Array(this.G,0,c),this.S=new Uint16Array(this.G,0,c>>1),this.b=new Int32Array(this.G,0,c>>2),Rb(this,Nb?Sb:Tb);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},ea:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ra:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},Ba:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<>8);this.ya=!0},Z:function(a,b){if(this.C&&null!=this.A){var c=this.C;Zb(c,this.A+a,1,c.Z)&&c.da(!0)}return this.ib(a,b)},pa:function(a,b){if(this.C&&null!=this.A){var c=this.C;Zb(c,this.A+a,2,c.Z)&&c.da(!0)}return this.wb(a,b)},va:function(a,b,c){if(this.C&&null!=this.A){var d=this.C;Zb(d,this.A+a,1,d.H)&&d.da(!0)}this.s?this.D(a,b,c):this.Ya(a,b,c)},Za:function(a, -b,c){if(this.C&&null!=this.A){var d=this.C;Zb(d,this.A+a,2,d.H)&&d.da(!0)}this.s?this.D(a,b,c):this.xb(a,b,c)},Y:function(a){return this.B[a]},ba:function(a){return this.B[a]},na:function(a){return this.H.getUint16(a,!0)},qa:function(a){return a&1?this.B[a]|this.B[a+1]<<8:this.S[a>>1]},xa:function(a,b){this.B[a]=b;this.ya=!0},Aa:function(a,b){this.B[a]=b;this.ya=!0},Ka:function(a,b){this.H.setUint16(a,b,!0);this.ya=!0},$a:function(a,b){a&1?(this.B[a]=b,this.B[a+1]=b>>8):this.S[a>>1]=b;this.ya=!0}}; -function tb(a,b,c){a.C=b;a.R=a.w=0;c&&((a.R=c.R)&&Yb(a,Xb,!1),(a.w=c.w)&&Wb(a,Xb,!1))}function $b(a,b){b?0===--a.w&&(a.Xa=a.s?a.D:a.Ya,a.Rb=a.s?a.I:a.xb):0===--a.R&&(a.Ia=a.ib,a.Pb=a.wb)}function Wb(a,b,c){c&&a.w||(a.Xa=!a.s&&b[2]||a.D,a.Rb=!a.s&&b[3]||a.I);if(c||void 0===c)a.Ya=b[2]||a.D,a.xb=b[3]||a.I}function Yb(a,b,c){c&&a.R||(a.Ia=b[0]||a.T,a.Pb=b[1]||a.W);if(c||void 0===c)a.ib=b[0]||a.T,a.wb=b[1]||a.W}function Rb(a,b){b||(b=ac);Yb(a,b,void 0);Wb(a,b,void 0)} -var ac=[],Ub=[C.prototype.ea,C.prototype.ra,C.prototype.Ba,C.prototype.ab],Xb=[C.prototype.Z,C.prototype.pa,C.prototype.va,C.prototype.Za];if(nb)var Tb=[C.prototype.Y,C.prototype.na,C.prototype.xa,C.prototype.Ka],Sb=[C.prototype.ba,C.prototype.qa,C.prototype.Aa,C.prototype.$a]; -function bc(a,b){v.call(this,"CPU",a,bc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.Va=c;this.i.pb=0;this.i.Ha=d;this.i.tb=Math.round(this.i.Va/1E4)/100;this.i.Fa=this.i.tb*this.i.Ha;this.u.ha=!1;this.u.sb=!1;this.u.Ib=a.autoStart;this.u.Jb=!1;this.u.Ma=!1;this.i.bb=this.i.Sa=0;this.i.cb=a.csStart;this.i.Ra=a.csInterval;this.i.Ta=a.csStop;this.ea=this.Ja.bind(this);B(this)}x(bc);var lc=["power","reset"];m=bc.prototype; -m.za=function(a,b,c,d){this.s=a;this.B=b;this.C=d;for(b=0;b=a.i.Sa&&(a.i.Sa+=a.i.Ra,c=!0);0<=a.i.Ta&&a.i.Ta<=sc(a)&&(a.i.Ra=a.i.Ta=-1,oc(a),a.da(),c=!0);c&&a.g(sc(a)+" cycles: checksum="+p(a.i.bb))}} -m.ma=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.R[b]=c;a=!0;break;case "run":this.R[b]=c;c.onclick=function(){var a;if(a=d.s)if(a=d.s,a.u.ga)a=!0;else{var b=null,c,g=Za(a.id);for(c=0;cc&&(c=2);var d=1;b&&1a.i.Ea/a.i.Fa?b=1:d=!0;a.i.Ha=b;b=a.i.tb*a.i.Ha;if(a.i.Fa!=b){a.i.Fa=b;b=a.i.Fa.toFixed(2)+"Mhz";var e=a.R.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.s&&a.s.jb()}uc(a,a.H);a.H=0;a.i.Qa=ja();a.i.Ga=0;vc(a);return d} -m.Ja=function(a){if(jb(this,!0)){if(!this.u.ha){tc(this);this.s&&this.s.start(this.i.Qa,sc(this));this.u.ha=!0;this.u.sb=!0;this.T&&this.T.kc();var b=this.R.run;b&&(b.textContent="Halt");this.s&&(this.s.oa(!0),a&&this.s.jb(!0))}this.i.vb>=this.i.Va&&vc(this,!0);this.i.gb=0;this.i.ob=ja();this.i.Ga&&(a=this.i.ob-this.i.Ga,a>this.i.Lb&&(this.i.Qa+=a,this.i.Qa>this.i.ob&&(this.i.Qa=this.i.ob)));try{do{var c=this.u.Ma?1:this.i.fc;try{this.Wa(c)}catch(e){if("number"!=typeof e)throw e;}var d=this.D-this.b; -this.H+=d;this.i.gb+=d;uc(this,0,!0);rc(this,d);this.i.fb-=d;0>=this.i.fb&&(this.i.fb+=this.i.Nb,this.s&&wc(this.s,this.i.pb++),this.i.pb>this.xa&&(this.i.pb=0));this.i.eb-=d;0>=this.i.eb&&(this.i.eb+=this.i.Mb,this.s&&this.s.oa());this.i.Ua-=d;if(0>=this.i.Ua){this.i.Ua+=this.i.ub;break}}while(this.u.ha)}catch(e){this.da();D(this);this.s&&this.s.stop(ja(),sc(this));jb(this,!1);mb(this,e.stack||e.message);return}c=setTimeout;d=this.ea;this.i.Ga=ja();a=this.i.Lb;this.i.gb&&(a=Math.round(a*this.i.gb/ -this.i.ub));a-=this.i.Ga-this.i.ob;if(b=this.i.Ga-this.i.Qa)this.i.Ea=Math.round(this.H/(10*b))/100,864E5<=b&&(this.I=0,tc(this));if(0>a||this.i.Ea>8&255;a.N=b&255}function Ec(a){return a.L<<8|a.O}function Fc(a,b){a.L=b>>8&255;a.O=b&255}function I(a){return a.M<<8|a.P}function J(a,b){a.M=b>>8&255;a.P=b&255} -function E(a,b){a.J=b&65535}function K(a){return a.F&256?1:0}function Gc(a){return ob[a.V&255]?4:0}function Hc(a){return(a.V^a.ca)&16?16:0}function Ic(a){return a.F&255?0:64}function Jc(a){return a.V&128?128:0}function Bc(a){return a.la&-214|Jc(a)|Ic(a)|Hc(a)|Gc(a)|K(a)}function Ac(a,b){a.F=a.V=a.ca=0;b&1&&(a.F|=256);b&4||(a.V|=1);b&16&&(a.ca|=16);b&64||(a.F|=255);b&128&&(a.V^=192);a.la=a.la&-513|b&512|2}function Kc(a,b){a.ca=a.j^b;return(a.F=a.V=a.j+b)&255} -function Lc(a,b){a.ca=a.j^b;return(a.F=a.V=a.j+b+(a.F&256?1:0))&255}function Mc(a,b){return a.F=a.V=a.ca=a.j&b}function fd(a,b){a.ca=a.j^b;a.F=a.V=a.j-b}function gd(a,b){a.ca=b;b=(a.V=b-1)&255;a.F=a.F&-256|b;return b}function hd(a,b){a.ca=b;b=(a.V=b+1)&255;a.F=a.F&-256|b;return b}function id(a,b){return a.F=a.V=a.ca=a.j|b}function jd(a,b){a.ca=a.j^b;return(a.F=a.V=a.j-b)&255}function kd(a,b){a.ca=a.j^b;return(a.F=a.V=a.j-b-(a.F&256?1:0))&255}function ld(a,b){return a.F=a.V=a.ca=a.j^b} -m.U=function(a){return this.ja[(a&this.S)>>>this.X].Ia(a&this.G,a)};function md(a,b){var c=b&a.G,d=(b&a.S)>>>a.X;if(c>>a.X].Xa(b&a.G,c&255,b)}function nd(a,b,c){var d=b&a.G,e=(b&a.S)>>>a.X;d>8&255,b+1))}function M(a){var b=a.U(a.J);E(a,a.J+1);return b}function O(a){var b=md(a,a.J);E(a,a.J+2);return b} -function P(a){var b=md(a,a.aa);a.aa=a.aa+2&65535;return b}function Q(a,b){a.aa=a.aa-2&65535;nd(a,a.aa,b)}function T(a,b,c,d){d=d||2;a.R[b]&&(void 0===c&&(mb(a,"Value for "+b+" is invalid"),a.da()),c=!a.u.ha||a.u.Jb?p(c,d):"--------".substr(0,d),a.R[b].textContent!=c&&(a.R[b].textContent=c))} -m.oa=function(a){this.ba&&(a||!this.u.ha||this.u.Jb)&&(T(this,"A",this.j),T(this,"B",this.K),T(this,"C",this.N),T(this,"D",this.L),T(this,"E",this.O),T(this,"H",this.M),T(this,"L",this.P),T(this,"SP",this.aa,4),T(this,"PC",this.J,4),a=Bc(this),T(this,"F",a,2),T(this,"SF",a&128,1),T(this,"ZF",a&64,1),T(this,"AF",a&16,1),T(this,"PF",a&4,1),T(this,"CF",a&1,1));if(a=this.R.speed)a.textContent=this.u.ha&&this.i.Ea?this.i.Ea.toFixed(2)+"Mhz":"Stopped"}; -m.Wa=function(a){this.u.mb=!0;var b=this.u.Vb=this.C&&od(this.C),c=a?this.u.sb?0:1:-1;this.u.sb=!1;this.D=this.b=a;do{if(this.w){var d;this.w&8&&this.la&512?(d=199|(this.w&7)<<3,this.w&=-16,this.la&=-513,this.Z[d].call(this),d=!0):d=!1;if(d){if(!a){this.g("interrupt dispatched");break}}else if(this.w&16){this.b=0;break}}if(b){if(pd(this.C,this.J,c)){this.da();break}c=1}this.Z[M(this)].call(this)}while(0>8;this.F=this.F&255|a&256;this.b-=4},qd,function(){var a;J(this,a=I(this)+Cc(this));this.F=this.F&255|a>>8&256;this.b-=10},function(){this.j=this.U(Cc(this));this.b-=7},function(){Dc(this,Cc(this)- -1);this.b-=5},function(){this.N=hd(this,this.N);this.b-=5},function(){this.N=gd(this,this.N);this.b-=5},function(){this.N=M(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;this.F=this.F&255|a;this.b-=4},qd,function(){Fc(this,O(this));this.b-=10},function(){L(this,Ec(this),this.j);this.b-=7},function(){Fc(this,Ec(this)+1);this.b-=5},function(){this.L=hd(this,this.L);this.b-=5},function(){this.L=gd(this,this.L);this.b-=5},function(){this.L=M(this);this.b-=7},function(){var a=this.j<< -1;this.j=a&255|this.F>>8;this.F=this.F&255|a&256;this.b-=4},qd,function(){var a;J(this,a=I(this)+Ec(this));this.F=this.F&255|a>>8&256;this.b-=10},function(){this.j=this.U(Ec(this));this.b-=7},function(){Fc(this,Ec(this)-1);this.b-=5},function(){this.O=hd(this,this.O);this.b-=5},function(){this.O=gd(this,this.O);this.b-=5},function(){this.O=M(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(this.F&256|this.j)>>1;this.F=this.F&255|a;this.b-=4},qd,function(){J(this,O(this));this.b-=10},function(){nd(this, -O(this),I(this));this.b-=16},function(){J(this,I(this)+1);this.b-=5},function(){this.M=hd(this,this.M);this.b-=5},function(){this.M=gd(this,this.M);this.b-=5},function(){this.M=M(this);this.b-=7},function(){var a=this.j,b=!!K(this),c=!!Hc(this);9<(a&15)||c?(a+=6,c=!0):c=!1;160<=a||b?(a+=96,b=!0):b=!1;this.F=this.V=this.j=a&255;this.F=b?this.F|256:this.F&-257;this.ca=c?~this.V&16|this.ca&-17:this.V&16|this.ca&-17;this.b-=4},qd,function(){var a;J(this,a=I(this)+I(this));this.F=this.F&255|a>>8&256;this.b-= -10},function(){J(this,md(this,O(this)));this.b-=16},function(){J(this,I(this)-1);this.b-=5},function(){this.P=hd(this,this.P);this.b-=5},function(){this.P=gd(this,this.P);this.b-=5},function(){this.P=M(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},qd,function(){this.aa=O(this)&65535;this.b-=10},function(){L(this,O(this),this.j);this.b-=13},function(){this.aa=this.aa+1&65535;this.b-=5},function(){var a=I(this);L(this,a,hd(this,this.U(a)));this.b-=10},function(){var a=I(this);L(this,a,gd(this, -this.U(a)));this.b-=10},function(){L(this,I(this),M(this));this.b-=10},function(){this.F|=256;this.b-=4},qd,function(){var a;this.aa=(a=I(this)+this.aa)&65535;this.F=this.F&255|a>>8&256;this.b-=10},function(){this.j=this.U(O(this));this.b-=13},function(){this.aa=this.aa-1&65535;this.b-=5},function(){this.j=hd(this,this.j);this.b-=5},function(){this.j=gd(this,this.j);this.b-=5},function(){this.j=M(this);this.b-=7},function(){this.F=K(this)?this.F&-257:this.F|256;this.b-=4},function(){this.b-=5},function(){this.K= -this.N;this.b-=5},function(){this.K=this.L;this.b-=5},function(){this.K=this.O;this.b-=5},function(){this.K=this.M;this.b-=5},function(){this.K=this.P;this.b-=5},function(){this.K=this.U(I(this));this.b-=7},function(){this.K=this.j;this.b-=5},function(){this.N=this.K;this.b-=5},function(){this.b-=5},function(){this.N=this.L;this.b-=5},function(){this.N=this.O;this.b-=5},function(){this.N=this.M;this.b-=5},function(){this.N=this.P;this.b-=5},function(){this.N=this.U(I(this));this.b-=7},function(){this.N= -this.j;this.b-=5},function(){this.L=this.K;this.b-=5},function(){this.L=this.N;this.b-=5},function(){this.b-=5},function(){this.L=this.O;this.b-=5},function(){this.L=this.M;this.b-=5},function(){this.L=this.P;this.b-=5},function(){this.L=this.U(I(this));this.b-=7},function(){this.L=this.j;this.b-=5},function(){this.O=this.K;this.b-=5},function(){this.O=this.N;this.b-=5},function(){this.O=this.L;this.b-=5},function(){this.b-=5},function(){this.O=this.M;this.b-=5},function(){this.O=this.P;this.b-=5}, -function(){this.O=this.U(I(this));this.b-=7},function(){this.O=this.j;this.b-=5},function(){this.M=this.K;this.b-=5},function(){this.M=this.N;this.b-=5},function(){this.M=this.L;this.b-=5},function(){this.M=this.O;this.b-=5},function(){this.b-=5},function(){this.M=this.P;this.b-=5},function(){this.M=this.U(I(this));this.b-=7},function(){this.M=this.j;this.b-=5},function(){this.P=this.K;this.b-=5},function(){this.P=this.N;this.b-=5},function(){this.P=this.L;this.b-=5},function(){this.P=this.O;this.b-= -5},function(){this.P=this.M;this.b-=5},function(){this.b-=5},function(){this.P=this.U(I(this));this.b-=7},function(){this.P=this.j;this.b-=5},function(){L(this,I(this),this.K);this.b-=7},function(){L(this,I(this),this.N);this.b-=7},function(){L(this,I(this),this.L);this.b-=7},function(){L(this,I(this),this.O);this.b-=7},function(){L(this,I(this),this.M);this.b-=7},function(){L(this,I(this),this.P);this.b-=7},function(){this.w|=16;this.b-=7;this.C&&ib(this,-2147483648)?(E(this,this.J-1),this.C.da()): -this.la&512||(this.C&&E(this,this.J-1),this.da())},function(){L(this,I(this),this.j);this.b-=7},function(){this.j=this.K;this.b-=5},function(){this.j=this.N;this.b-=5},function(){this.j=this.L;this.b-=5},function(){this.j=this.O;this.b-=5},function(){this.j=this.M;this.b-=5},function(){this.j=this.P;this.b-=5},function(){this.j=this.U(I(this));this.b-=7},function(){this.b-=5},function(){this.j=Kc(this,this.K);this.b-=4},function(){this.j=Kc(this,this.N);this.b-=4},function(){this.j=Kc(this,this.L); -this.b-=4},function(){this.j=Kc(this,this.O);this.b-=4},function(){this.j=Kc(this,this.M);this.b-=4},function(){this.j=Kc(this,this.P);this.b-=4},function(){this.j=Kc(this,this.U(I(this)));this.b-=7},function(){this.j=Kc(this,this.j);this.b-=4},function(){this.j=Lc(this,this.K);this.b-=4},function(){this.j=Lc(this,this.N);this.b-=4},function(){this.j=Lc(this,this.L);this.b-=4},function(){this.j=Lc(this,this.O);this.b-=4},function(){this.j=Lc(this,this.M);this.b-=4},function(){this.j=Lc(this,this.P); -this.b-=4},function(){this.j=Lc(this,this.U(I(this)));this.b-=7},function(){this.j=Lc(this,this.j);this.b-=4},function(){this.j=jd(this,this.K);this.b-=4},function(){this.j=jd(this,this.N);this.b-=4},function(){this.j=jd(this,this.L);this.b-=4},function(){this.j=jd(this,this.O);this.b-=4},function(){this.j=jd(this,this.M);this.b-=4},function(){this.j=jd(this,this.P);this.b-=4},function(){this.j=jd(this,this.U(I(this)));this.b-=7},function(){this.j=jd(this,this.j);this.b-=4},function(){this.j=kd(this, -this.K);this.b-=4},function(){this.j=kd(this,this.N);this.b-=4},function(){this.j=kd(this,this.L);this.b-=4},function(){this.j=kd(this,this.O);this.b-=4},function(){this.j=kd(this,this.M);this.b-=4},function(){this.j=kd(this,this.P);this.b-=4},function(){this.j=kd(this,this.U(I(this)));this.b-=7},function(){this.j=kd(this,this.j);this.b-=4},function(){this.j=Mc(this,this.K);this.b-=4},function(){this.j=Mc(this,this.N);this.b-=4},function(){this.j=Mc(this,this.L);this.b-=4},function(){this.j=Mc(this, -this.O);this.b-=4},function(){this.j=Mc(this,this.M);this.b-=4},function(){this.j=Mc(this,this.P);this.b-=4},function(){this.j=Mc(this,this.U(I(this)));this.b-=7},function(){this.j=Mc(this,this.j);this.b-=4},function(){this.j=ld(this,this.K);this.b-=4},function(){this.j=ld(this,this.N);this.b-=4},function(){this.j=ld(this,this.L);this.b-=4},function(){this.j=ld(this,this.O);this.b-=4},function(){this.j=ld(this,this.M);this.b-=4},function(){this.j=ld(this,this.P);this.b-=4},function(){this.j=ld(this, -this.U(I(this)));this.b-=7},function(){this.j=ld(this,this.j);this.b-=4},function(){this.j=id(this,this.K);this.b-=4},function(){this.j=id(this,this.N);this.b-=4},function(){this.j=id(this,this.L);this.b-=4},function(){this.j=id(this,this.O);this.b-=4},function(){this.j=id(this,this.M);this.b-=4},function(){this.j=id(this,this.P);this.b-=4},function(){this.j=id(this,this.U(I(this)));this.b-=7},function(){this.j=id(this,this.j);this.b-=4},function(){fd(this,this.K);this.b-=4},function(){fd(this,this.N); -this.b-=4},function(){fd(this,this.L);this.b-=4},function(){fd(this,this.O);this.b-=4},function(){fd(this,this.M);this.b-=4},function(){fd(this,this.P);this.b-=4},function(){fd(this,this.U(I(this)));this.b-=7},function(){fd(this,this.j);this.b-=4},function(){Ic(this)||(E(this,P(this)),this.b-=6);this.b-=5},function(){Dc(this,P(this));this.b-=10},function(){var a=O(this);Ic(this)||E(this,a);this.b-=10},rd,function(){var a=O(this);Ic(this)||(Q(this,this.J),E(this,a),this.b-=6);this.b-=11},function(){Q(this, -Cc(this));this.b-=11},function(){this.j=Kc(this,M(this));this.b-=7},function(){Q(this,this.J);E(this,0);this.b-=11},function(){Ic(this)&&(E(this,P(this)),this.b-=6);this.b-=5},sd,function(){var a=O(this);Ic(this)&&E(this,a);this.b-=10},rd,function(){var a=O(this);Ic(this)&&(Q(this,this.J),E(this,a),this.b-=6);this.b-=11},td,function(){this.j=Lc(this,M(this));this.b-=7},function(){Q(this,this.J);E(this,8);this.b-=11},function(){K(this)||(E(this,P(this)),this.b-=6);this.b-=5},function(){Fc(this,P(this)); -this.b-=10},function(){var a=O(this);K(this)||E(this,a);this.b-=10},function(){var a=M(this);Jb(this.B,a,this.j);this.b-=10},function(){var a=O(this);K(this)||(Q(this,this.J),E(this,a),this.b-=6);this.b-=11},function(){Q(this,Ec(this));this.b-=11},function(){this.j=jd(this,M(this));this.b-=7},function(){Q(this,this.J);E(this,16);this.b-=11},function(){K(this)&&(E(this,P(this)),this.b-=6);this.b-=5},sd,function(){var a=O(this);K(this)&&E(this,a);this.b-=10},function(){var a=M(this);this.j=Gb(this.B, -a)&255;this.b-=10},function(){var a=O(this);K(this)&&(Q(this,this.J),E(this,a),this.b-=6);this.b-=11},td,function(){this.j=kd(this,M(this));this.b-=7},function(){Q(this,this.J);E(this,24);this.b-=11},function(){Gc(this)||(E(this,P(this)),this.b-=6);this.b-=5},function(){J(this,P(this));this.b-=10},function(){var a=O(this);Gc(this)||E(this,a);this.b-=10},function(){var a=P(this);Q(this,I(this));J(this,a);this.b-=18},function(){var a=O(this);Gc(this)||(Q(this,this.J),E(this,a),this.b-=6);this.b-=11}, -function(){Q(this,I(this));this.b-=11},function(){this.j=Mc(this,M(this));this.b-=7},function(){Q(this,this.J);E(this,32);this.b-=11},function(){Gc(this)&&(E(this,P(this)),this.b-=6);this.b-=5},function(){E(this,I(this));this.b-=5},function(){var a=O(this);Gc(this)&&E(this,a);this.b-=10},function(){var a=I(this);J(this,Ec(this));Fc(this,a);this.b-=5},function(){var a=O(this);Gc(this)&&(Q(this,this.J),E(this,a),this.b-=6);this.b-=11},td,function(){this.j=ld(this,M(this));this.b-=7},function(){Q(this, -this.J);E(this,40);this.b-=11},function(){Jc(this)||(E(this,P(this)),this.b-=6);this.b-=5},function(){var a=P(this);Ac(this,a);this.j=a>>8;this.b-=10},function(){var a=O(this);Jc(this)||E(this,a);this.b-=10},function(){this.la&=-513;this.b-=4},function(){var a=O(this);Jc(this)||(Q(this,this.J),E(this,a),this.b-=6);this.b-=11},function(){Q(this,Bc(this)&255|this.j<<8);this.b-=11},function(){this.j=id(this,M(this));this.b-=7},function(){Q(this,this.J);E(this,48);this.b-=11},function(){Jc(this)&&(E(this, -P(this)),this.b-=6);this.b-=5},function(){this.aa=I(this)&65535;this.b-=5},function(){var a=O(this);Jc(this)&&E(this,a);this.b-=10},function(){this.la|=512;this.b-=4},function(){var a=O(this);Jc(this)&&(Q(this,this.J),E(this,a),this.b-=6);this.b-=11},td,function(){fd(this,M(this));this.b-=7},function(){Q(this,this.J);E(this,56);this.b-=11}]; -function U(a){v.call(this,"ChipSet",a,U,32768);var b=a.model;b&&!ud[b]&&t("Unrecognized ChipSet model: "+b);this.Pa=ud[b];a.sound&&(this.W=null,window&&(this.W=window.AudioContext||window.webkitAudioContext),this.W&&new this.W);B(this)}x(U);var ud={SI1978:1978.1};m=U.prototype;m.ma=function(){return!1}; -m.za=function(a,b,c,d){this.B=b;this.b=c;this.C=d;this.s=a;if(1978.1==this.Pa){var e;a=vd;void 0===e&&(e=0);for(var f in a){c=b;d=+f+e;var h=a[f].bind(this);if(void 0!==h)for(var g=+f+e;g<=d;g++)void 0!==c.w[g]?t("Input port "+r(g)+" already registered"):c.w[g]=[h,!1]}var k;e=wd;void 0===k&&(k=0);for(var l in e)if(f=b,a=+l+k,c=e[l].bind(this),void 0!==c)for(d=+l+k;d<=a;d++)void 0!==f.D[d]?t("Output port "+r(d)+" already registered"):f.D[d]=[c,!1]}}; -m.ua=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};m.ta=function(a){return a?this.save():!0};m.reset=function(){this.G=this.H=this.w=this.D=this.T=this.S=this.I=0};m.save=function(){var a=new G(this);1978.1==this.Pa&&H(a,0,[this.I,this.S,this.T,this.D,this.w,this.G,this.H]);return a.data()};m.restore=function(a){a=a[0];1978.1==this.Pa&&(this.I=a[0],this.S=a[1],this.T=a[2],this.D=a[3],this.w=a[4],this.G=a[5],this.H=a[6]);return!0}; -m.bc=function(a,b){var c=this.I;gb(this,a,null,b,"STATUS0",c);return c};m.cc=function(a,b){var c=this.S;gb(this,a,null,b,"STATUS1",c);return c};m.dc=function(a,b){var c=this.T;gb(this,a,null,b,"STATUS2",c);return c};m.ac=function(a,b){var c=this.D<>8&255;gb(this,a,null,b,"SHIFT.RESULT",c);return c};m.gc=function(a,b,c){gb(this,a,b,c,"SHIFT.COUNT",null);this.w=b};m.ic=function(a,b,c){gb(this,a,b,c,"SOUND1",null);this.G=b};m.hc=function(a,b,c){gb(this,a,b,c,"SHIFT.DATA",null);this.D=b}; -m.jc=function(a,b,c){gb(this,a,b,c,"SOUND2",null);this.H=b};var vd={0:U.prototype.bc,1:U.prototype.cc,2:U.prototype.dc,3:U.prototype.ac},wd={2:U.prototype.gc,3:U.prototype.ic,4:U.prototype.hc,5:U.prototype.jc};Ja(function(){for(var a=z(document,"pc8080","chipset"),b=0;b>>0,h],q=ia(n,k,a.Cb);0>q&&n.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.I.push({lc:b,A:c,ec:d,wa:e,Bb:f})}delete this.wa}return!0};xd.prototype.ta=function(){return!0}; -function yd(a,b,c,d){if(d)a.ka("Unable to load system ROM (error "+d+": "+b+")");else{Ya(a.Eb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.s=f;else if(h)for(a.s=Array(4*h.length),d=c=0;c>8&255,a.s[d++]=h[c]>>16&255,a.s[d++]=h[c]>>24&255;else a.s=e;a.wa=e.symbols;if(!a.s.length){t("Empty ROM: "+b);return}if(1==a.s.length){t(a.s[0]);return}}catch(g){a.ka("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, -" ").replace(/ +$/,"").split(" "),a.s=Array(b.length),e=0;e>>d.X].Ya(e&d.s,a.s[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.D?b.push(a.D):null!=a.D&&a.D.length&&(b=a.D);for(c=0;c>>e.X;0>>=e.X;0Missing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=oa().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height= -(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Sa.aspect);f&&.3<=f&&3.33>=f&&(Ia("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");Ba("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);e.getContext("2d");d=new Cd(d);db(d,c)}}); -function Dd(a){v.call(this,"Debugger",a,Dd);this.ea=this.Ka=this.T=0;this.Y=V();this.Db=V();this.G=-1;this.D=[];this.qa=!1;this.na=V();this.I=[];this.pa={};this.w=this.Z=this.H=[];Ed(this);this.Aa=0;Fd(this);this.Za=[];Gd(this,a.messages);this.ab=a.commands;var b=this;window?void 0===window.$&&(window.$=function(a){return pc(b,a)}):void 0===global.$&&(global.$=function(a){return pc(b,a)})}x(Dd); -var Hd={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression",k:"stack trace",ln:"list nearest symbol(s)",m:"messages","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine","t [#]":"trace","u [#]":"unassemble",x:"execution options",v:"print version","var":"assign variable"},Id="NONE ACI ADC ADD ADI ANA ANI CALL CC CM CNC CNZ CP CPE CPO CZ CMA CMC CMP CPI DAA DAD DCR DCX DI EI HLT IN INR INX JMP JC JM JNC JNZ JP JPE JPO JZ LDA LDAX LHLD LXI MOV MVI NOP ORA ORI OUT PCHL POP PUSH RAL RAR RET RC RM RNC RNZ RP RPE RPO RZ RLC RRC RST SBB SBI SHLD SPHL STA STAX STC SUB SUI XCHG XRA XRI XTHL".split(" "), -Jd="B C D E H L M A F BC DE HL PSW SP PC".split(" "),Kd=[[45],[42,2323,32],[71,2387],[29,2323],[28,17],[22,17],[44,17,32],[63],[45,32768],[21,2835,6419],[40,2387],[23,2323],[28,273],[22,273],[44,273,32],[64],[45,32768],[42,2579,32],[71,2643],[29,2579],[28,529],[22,529],[44,529,32],[52],[45,32768],[21,2835,6675],[40,2643],[23,2579],[28,785],[22,785],[44,785,32],[53],[45,32768],[42,2835,32],[68,99],[29,2835],[28,1041],[22,1041],[44,1041,32],[20],[45,32768],[21,2835,6931],[41,99],[23,2835],[28,1297], -[22,1297],[44,1297,32],[16],[45,32768],[42,3347,32],[70,99],[29,3347],[28,1617],[22,1617],[44,1617,32],[72],[45,32768],[21,2835,7443],[39,99],[23,3347],[28,1809],[22,1809],[44,1809,32],[17],[43,17,17],[43,17,273],[43,17,529],[43,17,785],[43,17,1041],[43,17,1297],[43,17,1617],[43,17,1809],[43,273,17],[43,273,273],[43,273,529],[43,273,785],[43,273,1041],[43,273,1297],[43,273,1617],[43,273,1809],[43,529,17],[43,529,273],[43,529,529],[43,529,785],[43,529,1041],[43,529,1297],[43,529,1617],[43,529,1809], -[43,785,17],[43,785,273],[43,785,529],[43,785,785],[43,785,1041],[43,785,1297],[43,785,1617],[43,785,1809],[43,1041,17],[43,1041,273],[43,1041,529],[43,1041,785],[43,1041,1041],[43,1041,1297],[43,1041,1617],[43,1041,1809],[43,1297,17],[43,1297,273],[43,1297,529],[43,1297,785],[43,1297,1041],[43,1297,1297],[43,1297,1617],[43,1297,1809],[43,1617,17],[43,1617,273],[43,1617,529],[43,1617,785],[43,1617,1041],[43,1617,1297],[43,1617,1617],[43,1617,1809],[43,1809,17],[43,1809,273],[43,1809,529],[43,1809, -785],[43,1809,1041],[43,1809,1297],[43,1809,1617],[43,1809,1809],[3,17],[3,273],[3,529],[3,785],[3,1041],[3,1297],[3,1617],[3,1809],[2,17],[2,273],[2,529],[2,785],[2,1041],[2,1297],[2,1617],[2,1809],[73,17],[73,273],[73,529],[73,785],[73,1041],[73,1297],[73,1617],[73,1809],[66,17],[66,273],[66,529],[66,785],[66,1041],[66,1297],[66,1617],[66,1809],[5,17],[5,273],[5,529],[5,785],[5,1041],[5,1297],[5,1617],[5,1809],[76,17],[76,273],[76,529],[76,785],[76,1041],[76,1297],[76,1617],[76,1809],[46,17],[46, -273],[46,529],[46,785],[46,1041],[46,1297],[46,1617],[46,1809],[18,17],[18,273],[18,529],[18,785],[18,1041],[18,1297],[18,1617],[18,1809],[58],[50,2323],[34,35],[30,35],[11,35],[51,2323],[4,33],[65],[62],[54],[38,35],[30,32803],[15,35],[7,35],[1,33],[65],[57],[50,2579],[33,35],[48,33],[10,35],[51,2579],[74,33],[65],[55],[54,32768],[31,35],[27,33],[8,35],[7,32803],[67,33],[65],[61],[50,2835],[37,35],[78,3411,2835],[14,35],[51,2835],[6,33],[65],[60],[49,3603,2835],[36,35],[75,2835,2579],[13,35],[7, -32803],[77,33],[65],[59],[50,3091],[35,35],[24],[12,35],[51,3091],[47,33],[65],[56],[69,3347,2835],[32,35],[25],[9,35],[7,32803],[19,33],[65]],Ld={cpu:1,bus:64,mem:128,port:256,chipset:32768,keyboard:65536,key:131072,video:262144,fdc:524288,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:536870912,warn:1073741824,halt:-2147483648};m=Dd.prototype; -m.za=function(a,b,c,d){this.B=b;this.b=c;this.s=a;(a=mc(a,"messages"))&&Gd(this,a);this.zb=Kd;Md(this,function(a){a:{var b=d.b.ja,c=a[0],g=a=0,k=b.length;if(c){a=X(Y(d,c));if(-1===a){d.g("invalid address: "+c);break a}g=a>>>d.b.X;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var n=b[g];n.type==c?l++||d.g("..."):(c=n.type,l=Vb[c],n&&d.g(p(n.id)+" %"+p(g<>>c.X,c=e!=c.s?c.B[f].wb(e,d):c.B[f++].ib(e,d)|c.B[f&c.W].ib(0,d+1)<<8;b&&Nd(a,b)}return c}; -m.yb=function(a,b,c){var d=X(a);if(-1!==d){var e=this.B;e.B[(d&e.G)>>>e.X].Ya(d&e.s,b&255,d);c&&Nd(a,c);D(this.b,!0)}};m.Sb=function(a,b,c){var d=X(a);if(-1!==d){var e=this.B,f=d&e.s,h=(d&e.G)>>>e.X;f!=e.s?e.B[h].xb(f,b&65535,d):(e.B[h++].Ya(f,b&255,d),e.B[h&e.W].Ya(0,b>>8&255,d+1));c&&Nd(a,c);D(this.b,!0)}};function V(a){return{A:a||0,sa:!1}}function Od(a){return[a.A,a.sa]}function Pd(a){return{A:a[0],sa:a[1]}} -function Y(a,b,c){var d;c=(c?a.Y:a.Db).A;if(void 0!==b){d=b=Qd(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=la(Jd,a.substr(b,2))));return c}function Wd(a,b){var c=0,d=Xd(a,b);if(void 0!==d)switch(b){case 7:case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 8:c=2;break;case 9:case 10:case 11:case 12:case 13:case 14:c=4}return c?p(d,c):"??"} -function Xd(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 8:c=Bc(d);break;case 0:c=d.K;break;case 1:c=d.N;break;case 9:c=Cc(d);break;case 2:c=d.L;break;case 3:c=d.O;break;case 10:c=Ec(d);break;case 4:c=d.M;break;case 5:c=d.P;break;case 11:c=I(d);break;case 6:c=d.U(I(d));break;case 12:c=d.j<<8|Bc(d)&255;break;case 13:c=d.aa;break;case 14:c=d.J}}return c} -function Yd(a,b){b=Qd(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Vd(b,c+1),0<=e&&(b=b.substr(0,c)+Wd(a,e)+b.substr(c+1+Jd[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=aa(e,16),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=Y(a,e))?(d=e+' "'+Ud(a,d)+'"',b=b.replace("$"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("^",c));)e=b.substr(c+1,9),(d=Y(a,e))?(Nd(d),d=e+' "'+ -Ud(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+Z(V(this.b.J).A));if(!this.Ba||a!=this.Ba)if(this.Ba=a,this.fa&-2147483648&&(this.da(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.Ua=0;c.D-=c.b;c.b=0;D(c)}};function hb(a,b,c,d,e,f,h,g){g|=256;null!=e&&(a.fa&g)!=g||a.message(b.$a+"."+(null!=d?"outPort":"inPort")+"("+r(c)+","+(f?f:"unknown")+(null!=d?",0x"+p(d,2):"")+")"+(null!=h?": 0x"+p(h,2):"")+(null!=e?" at "+Z(e):""))} -function Fd(a){var b;if(od(a)){if(!a.W||!a.W.length){a.W=Array(1E3);for(b=0;b>>d.X],!1)}a.Z=["br"];if(void 0!==a.H)for(b=1;b>>d.X],!0);a.H=["bw"];a.Fb=0}m.Ca=function(a,b,c){var d=!0;c||ce(this,a,b,!1,!0);if(a!=this.w){var e=X(b);if(-1===e)this.g("invalid address: "+Z(b.A)),d=!1;else{var f=this.b;f.ja[e>>>f.X].Ca(e&f.G,a==this.H)}}d&&(a.push(b),c?b.sa=!0:(de(this,a,a.length-1,"set"),Fd(this)));return d}; -function ce(a,b,c,d,e){var f=!1;c=X(c);for(var h=1;h>>d.X],b==a.H));g.sa||Fd(a);break}}return f}function ee(a,b){for(var c=1;c>24,4);break;case 3:qa=p(u.lb(R,2),4);break;default:qa="imm("+r(W)+")"}W&64&&(qa="["+qa+"]");u=qa}else W&16&&(u=(n&3840)>>8,u=6==u?"[HL]":Jd[u]);if(!u||!u.length){f="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; -function Ke(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break; +function oa(){return window?window.navigator.userAgent:""}function t(a){window&&window.alert(a)}function pa(a){var b=!1;window&&(b=window.confirm(a));return b}var qa=null;function wa(){if(null==qa){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}qa=a}return qa} +function xa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function ya(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function za(a){if(window){var b=oa();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 Aa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0=this.U?12:24>=this.U?14:15;this.ja=1<>2;this.u=this.ja-1;this.T=this.Z/this.ja|0;this.X=this.T-1;this.A=[];this.F=[];this.I=this.J=!1;this.ca=[];this.fa=[];a=new F;sb(a,this.D);this.C=Array(this.T);for(b=0;b>>a.Y;0a.ja?a.ja:c;if(f&&f.size){if(f.type==d){if(b+c<=f.B)return f.lb+=f.B-b,f.B=b,!0;if(b>=f.B+f.lb){g=f.size-(b-h);g>c&&(g=c);f.lb=b-f.B+g;c-=g;b=h+a.ja;continue}}return ub(1,b,c)}f=a.C[e];b=new F(b,g,a.ja,d);sb(b,a.D,f);a.C[e++]=b;b=h+a.ja;c-=g}return 0>=c?!0:ub(2,b,c)} +rb.prototype.V=function(a){return this.C[(a&this.H)>>>this.Y].Ka(a&this.u,a)};function vb(a,b){return a.C[(b&a.H)>>>a.Y].jb(b&a.u,b)}function wb(a,b){if(void 0===b)return a.I=!a.I,a.I;void 0===a.A[b]&&(a.A[b]=[null,!1]);a.A[b][1]=!a.A[b][1];return a.A[b][1]} +function xb(a,b){for(var c=1,d=0,e=0;0>>=e)&g;if(void 0!==f){if(f[0])f[0](b,g,void 0);a.D&&a.J!=f[1]&&Ib(a.D,b,g)}else a.D&&(gb(a.D,a,b,g,void 0),a.J&&Ib(a.D,b,g));e+=h<<3;b+=h;d-=h}}function ub(a,b,c){t("Memory block error ("+a+": "+q(b)+","+q(c)+")");return!1}var Jb;if(mb){var Kb=new ArrayBuffer(2);(new DataView(Kb)).setUint16(0,256,!0);Jb=256===(new Uint16Array(Kb))[0]}else Jb=!1;var Lb=Jb; +function F(a,b,c,d){this.id=Mb+=2;this.b=null;this.B=a;this.lb=b;this.size=c||0;this.type=d||Nb;this.u=d==Ob;sb(this);this.za=this.Yb=!1;if(c)if(mb)this.H=new ArrayBuffer(c),this.I=new DataView(this.H,0,c),this.C=new Uint8Array(this.H,0,c),this.T=new Uint16Array(this.H,0,c>>1),this.b=new Int32Array(this.H,0,c>>2),Pb(this,Lb?Qb:Rb);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},fa:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},sa:function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},Ca:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<>8);this.za=!0},aa:function(a,b){if(this.D&&null!=this.B){var c=this.D;Xb(c,this.B+a,1,c.ca)&&c.ea(!0)}return this.jb(a,b)},pa:function(a,b){if(this.D&&null!=this.B){var c=this.D;Xb(c,this.B+a,2,c.ca)&&c.ea(!0)}return this.yb(a,b)},ya:function(a,b,c){if(this.D&&null!=this.B){var d=this.D;Xb(d,this.B+a,1,d.I)&&d.ea(!0)}this.u?this.F(a,b,c):this.$a(a,b,c)},Ma:function(a, +b,c){if(this.D&&null!=this.B){var d=this.D;Xb(d,this.B+a,2,d.I)&&d.ea(!0)}this.u?this.F(a,b,c):this.zb(a,b,c)},Z:function(a){return this.C[a]},ca:function(a){return this.C[a]},oa:function(a){return this.I.getUint16(a,!0)},ra:function(a){return a&1?this.C[a]|this.C[a+1]<<8:this.T[a>>1]},ta:function(a,b){this.C[a]=b;this.za=!0},Ba:function(a,b){this.C[a]=b;this.za=!0},Da:function(a,b){this.I.setUint16(a,b,!0);this.za=!0},ab:function(a,b){a&1?(this.C[a]=b,this.C[a+1]=b>>8):this.T[a>>1]=b;this.za=!0}}; +function sb(a,b,c){a.D=b;a.S=a.A=0;c&&((a.S=c.S)&&Wb(a,Vb,!1),(a.A=c.A)&&Ub(a,Vb,!1))}function Yb(a,b){b?0===--a.A&&(a.Za=a.u?a.F:a.$a,a.Tb=a.u?a.J:a.zb):0===--a.S&&(a.Ka=a.jb,a.Rb=a.yb)}function Ub(a,b,c){c&&a.A||(a.Za=!a.u&&b[2]||a.F,a.Tb=!a.u&&b[3]||a.J);if(c||void 0===c)a.$a=b[2]||a.F,a.zb=b[3]||a.J}function Wb(a,b,c){c&&a.S||(a.Ka=b[0]||a.U,a.Rb=b[1]||a.X);if(c||void 0===c)a.jb=b[0]||a.U,a.yb=b[1]||a.X}function Pb(a,b){b||(b=Zb);Wb(a,b,void 0);Ub(a,b,void 0)} +var Zb=[],Sb=[F.prototype.fa,F.prototype.sa,F.prototype.Ca,F.prototype.bb],Vb=[F.prototype.aa,F.prototype.pa,F.prototype.ya,F.prototype.Ma];if(mb)var Rb=[F.prototype.Z,F.prototype.oa,F.prototype.ta,F.prototype.Da],Qb=[F.prototype.ca,F.prototype.ra,F.prototype.Ba,F.prototype.ab]; +function $b(a,b){u.call(this,"CPU",a,$b,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.Xa=c;this.i.qb=0;this.i.Ja=d;this.i.vb=Math.round(this.i.Xa/1E4)/100;this.i.Ha=this.i.vb*this.i.Ja;this.w.ia=!1;this.w.ub=!1;this.w.Ib=a.autoStart;this.w.Jb=!1;this.w.Oa=!1;this.i.cb=this.i.Ua=0;this.i.eb=a.csStart;this.i.Ta=a.csInterval;this.i.Va=a.csStop;this.fa=this.La.bind(this);E(this)}x($b);var ac=["power","reset"];m=$b.prototype; +m.Aa=function(a,b,c,d){this.u=a;this.C=b;this.D=d;for(b=0;b=a.i.Ua&&(a.i.Ua+=a.i.Ta,c=!0);0<=a.i.Va&&a.i.Va<=qc(a)&&(a.i.Ta=a.i.Va=-1,mc(a),a.ea(),c=!0);c&&a.g(qc(a)+" cycles: checksum="+q(a.i.cb))}} +m.na=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.S[b]=c;a=!0;break;case "run":this.S[b]=c;c.onclick=function(){var a;if(a=d.u)if(a=d.u,a.w.ha)a=!0;else{var b=null,c,g=Ya(a.id);for(c=0;cc&&(c=2);var d=1;b&&1a.i.Ga/a.i.Ha?b=1:d=!0;a.i.Ja=b;b=a.i.vb*a.i.Ja;if(a.i.Ha!=b){a.i.Ha=b;b=a.i.Ha.toFixed(2)+"Mhz";var e=a.S.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.u&&a.u.kb()}sc(a,a.I);a.I=0;a.i.Sa=ja();a.i.Ia=0;tc(a);return d} +m.La=function(a){if(ib(this,!0)){if(!this.w.ia){rc(this);this.u&&this.u.start(this.i.Sa,qc(this));this.w.ia=!0;this.w.ub=!0;this.U&&this.U.mc();var b=this.S.run;b&&(b.textContent="Halt");this.u&&(this.u.qa(!0),a&&this.u.kb(!0))}this.i.xb>=this.i.Xa&&tc(this,!0);this.i.hb=0;this.i.pb=ja();this.i.Ia&&(a=this.i.pb-this.i.Ia,a>this.i.Nb&&(this.i.Sa+=a,this.i.Sa>this.i.pb&&(this.i.Sa=this.i.pb)));try{do{var c=this.w.Oa?1:this.i.hc;try{this.Ya(c)}catch(e){if("number"!=typeof e)throw e;}var d=this.F-this.b; +this.I+=d;this.i.hb+=d;sc(this,0,!0);pc(this,d);this.i.gb-=d;0>=this.i.gb&&(this.i.gb+=this.i.Pb,this.u&&uc(this.u,this.i.qb++),this.i.qb>this.ya&&(this.i.qb=0));this.i.fb-=d;0>=this.i.fb&&(this.i.fb+=this.i.Ob,this.u&&this.u.qa());this.i.Wa-=d;if(0>=this.i.Wa){this.i.Wa+=this.i.wb;break}}while(this.w.ia)}catch(e){this.ea();G(this);this.u&&this.u.stop(ja(),qc(this));ib(this,!1);lb(this,e.stack||e.message);return}c=setTimeout;d=this.fa;this.i.Ia=ja();a=this.i.Nb;this.i.hb&&(a=Math.round(a*this.i.hb/ +this.i.wb));a-=this.i.Ia-this.i.pb;if(b=this.i.Ia-this.i.Sa)this.i.Ga=Math.round(this.I/(10*b))/100,864E5<=b&&(this.J=0,rc(this));if(0>a||this.i.Ga>8&255;a.O=b&255}function Cc(a){return a.M<<8|a.P}function Dc(a,b){a.M=b>>8&255;a.P=b&255}function L(a){return a.N<<8|a.R}function M(a,b){a.N=b>>8&255;a.R=b&255} +function H(a,b){a.K=b&65535}function Ec(a){return a.G&256?1:0}function Fc(a){return nb[a.W&255]?4:0}function Gc(a){return(a.W^a.da)&16?16:0}function Hc(a){return a.G&255?0:64}function Ic(a){return a.W&128?128:0}function zc(a){return a.ma&-214|Ic(a)|Hc(a)|Gc(a)|Fc(a)|Ec(a)}function yc(a,b){a.G=a.W=a.da=0;b&1&&(a.G|=256);b&4||(a.W|=1);b&16&&(a.da|=16);b&64||(a.G|=255);b&128&&(a.W^=192);a.ma=a.ma&-513|b&512|2}function Jc(a,b){a.da=a.j^b;return(a.G=a.W=a.j+b)&255} +function Kc(a,b){a.da=a.j^b;return(a.G=a.W=a.j+b+(a.G&256?1:0))&255}function Lc(a,b){return a.G=a.W=a.da=a.j&b}function Mc(a,b){a.da=a.j^b;a.G=a.W=a.j-b}function fd(a,b){a.da=b;b=(a.W=b-1)&255;a.G=a.G&-256|b;return b}function gd(a,b){a.da=b;b=(a.W=b+1)&255;a.G=a.G&-256|b;return b}function hd(a,b){return a.G=a.W=a.da=a.j|b}function id(a,b){a.da=a.j^b;return(a.G=a.W=a.j-b)&255}function jd(a,b){a.da=a.j^b;return(a.G=a.W=a.j-b-(a.G&256?1:0))&255}function kd(a,b){return a.G=a.W=a.da=a.j^b} +m.V=function(a){return this.ka[(a&this.T)>>>this.Y].Ka(a&this.H,a)};function ld(a,b){var c=b&a.H,d=(b&a.T)>>>a.Y;if(c>>a.Y].Za(b&a.H,c&255,b)}function md(a,b,c){var d=b&a.H,e=(b&a.T)>>>a.Y;d>8&255,b+1))}function O(a){var b=a.V(a.K);H(a,a.K+1);return b}function P(a){var b=ld(a,a.K);H(a,a.K+2);return b} +function R(a){var b=ld(a,a.ba);a.ba=a.ba+2&65535;return b}function S(a,b){a.ba=a.ba-2&65535;md(a,a.ba,b)}function T(a,b,c,d){d=d||2;a.S[b]&&(void 0===c&&(lb(a,"Value for "+b+" is invalid"),a.ea()),c=!a.w.ia||a.w.Jb?q(c,d):"--------".substr(0,d),a.S[b].textContent!=c&&(a.S[b].textContent=c))} +m.qa=function(a){this.ca&&(a||!this.w.ia||this.w.Jb)&&(T(this,"A",this.j),T(this,"B",this.L),T(this,"C",this.O),T(this,"D",this.M),T(this,"E",this.P),T(this,"H",this.N),T(this,"L",this.R),T(this,"SP",this.ba,4),T(this,"PC",this.K,4),a=zc(this),T(this,"F",a,2),T(this,"SF",a&128,1),T(this,"ZF",a&64,1),T(this,"AF",a&16,1),T(this,"PF",a&4,1),T(this,"CF",a&1,1));if(a=this.S.speed)a.textContent=this.w.ia&&this.i.Ga?this.i.Ga.toFixed(2)+"Mhz":"Stopped"}; +m.Ya=function(a){this.w.nb=!0;var b=this.w.Xb=this.D&&nd(this.D),c=a?this.w.ub?0:1:-1;this.w.ub=!1;this.F=this.b=a;do{if(this.A){var d;this.A&8&&this.ma&512?(d=199|(this.A&7)<<3,this.A&=-16,this.ma&=-513,this.aa[d].call(this),d=!0):d=!1;if(d){if(!a){this.g("interrupt dispatched");break}}else if(this.A&16){this.b=0;break}}if(b){if(od(this.D,this.K,c)){this.ea();break}c=1}this.aa[O(this)].call(this)}while(0>8;this.G=this.G&255|a&256;this.b-=4},pd,function(){var a;M(this,a=L(this)+Ac(this));this.G=this.G&255|a>>8&256;this.b-=10},function(){this.j=this.V(Ac(this));this.b-=7},function(){Bc(this,Ac(this)- +1);this.b-=5},function(){this.O=gd(this,this.O);this.b-=5},function(){this.O=fd(this,this.O);this.b-=5},function(){this.O=O(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;this.G=this.G&255|a;this.b-=4},pd,function(){Dc(this,P(this));this.b-=10},function(){N(this,Cc(this),this.j);this.b-=7},function(){Dc(this,Cc(this)+1);this.b-=5},function(){this.M=gd(this,this.M);this.b-=5},function(){this.M=fd(this,this.M);this.b-=5},function(){this.M=O(this);this.b-=7},function(){var a=this.j<< +1;this.j=a&255|this.G>>8;this.G=this.G&255|a&256;this.b-=4},pd,function(){var a;M(this,a=L(this)+Cc(this));this.G=this.G&255|a>>8&256;this.b-=10},function(){this.j=this.V(Cc(this));this.b-=7},function(){Dc(this,Cc(this)-1);this.b-=5},function(){this.P=gd(this,this.P);this.b-=5},function(){this.P=fd(this,this.P);this.b-=5},function(){this.P=O(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(this.G&256|this.j)>>1;this.G=this.G&255|a;this.b-=4},pd,function(){M(this,P(this));this.b-=10},function(){md(this, +P(this),L(this));this.b-=16},function(){M(this,L(this)+1);this.b-=5},function(){this.N=gd(this,this.N);this.b-=5},function(){this.N=fd(this,this.N);this.b-=5},function(){this.N=O(this);this.b-=7},function(){var a=this.j,b=!!Ec(this),c=!!Gc(this);9<(a&15)||c?(a+=6,c=!0):c=!1;160<=a||b?(a+=96,b=!0):b=!1;this.G=this.W=this.j=a&255;this.G=b?this.G|256:this.G&-257;this.da=c?~this.W&16|this.da&-17:this.W&16|this.da&-17;this.b-=4},pd,function(){var a;M(this,a=L(this)+L(this));this.G=this.G&255|a>>8&256; +this.b-=10},function(){M(this,ld(this,P(this)));this.b-=16},function(){M(this,L(this)-1);this.b-=5},function(){this.R=gd(this,this.R);this.b-=5},function(){this.R=fd(this,this.R);this.b-=5},function(){this.R=O(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},pd,function(){this.ba=P(this)&65535;this.b-=10},function(){N(this,P(this),this.j);this.b-=13},function(){this.ba=this.ba+1&65535;this.b-=5},function(){var a=L(this);N(this,a,gd(this,this.V(a)));this.b-=10},function(){var a=L(this);N(this, +a,fd(this,this.V(a)));this.b-=10},function(){N(this,L(this),O(this));this.b-=10},function(){this.G|=256;this.b-=4},pd,function(){var a;this.ba=(a=L(this)+this.ba)&65535;this.G=this.G&255|a>>8&256;this.b-=10},function(){this.j=this.V(P(this));this.b-=13},function(){this.ba=this.ba-1&65535;this.b-=5},function(){this.j=gd(this,this.j);this.b-=5},function(){this.j=fd(this,this.j);this.b-=5},function(){this.j=O(this);this.b-=7},function(){this.G=Ec(this)?this.G&-257:this.G|256;this.b-=4},function(){this.b-= +5},function(){this.L=this.O;this.b-=5},function(){this.L=this.M;this.b-=5},function(){this.L=this.P;this.b-=5},function(){this.L=this.N;this.b-=5},function(){this.L=this.R;this.b-=5},function(){this.L=this.V(L(this));this.b-=7},function(){this.L=this.j;this.b-=5},function(){this.O=this.L;this.b-=5},function(){this.b-=5},function(){this.O=this.M;this.b-=5},function(){this.O=this.P;this.b-=5},function(){this.O=this.N;this.b-=5},function(){this.O=this.R;this.b-=5},function(){this.O=this.V(L(this));this.b-= +7},function(){this.O=this.j;this.b-=5},function(){this.M=this.L;this.b-=5},function(){this.M=this.O;this.b-=5},function(){this.b-=5},function(){this.M=this.P;this.b-=5},function(){this.M=this.N;this.b-=5},function(){this.M=this.R;this.b-=5},function(){this.M=this.V(L(this));this.b-=7},function(){this.M=this.j;this.b-=5},function(){this.P=this.L;this.b-=5},function(){this.P=this.O;this.b-=5},function(){this.P=this.M;this.b-=5},function(){this.b-=5},function(){this.P=this.N;this.b-=5},function(){this.P= +this.R;this.b-=5},function(){this.P=this.V(L(this));this.b-=7},function(){this.P=this.j;this.b-=5},function(){this.N=this.L;this.b-=5},function(){this.N=this.O;this.b-=5},function(){this.N=this.M;this.b-=5},function(){this.N=this.P;this.b-=5},function(){this.b-=5},function(){this.N=this.R;this.b-=5},function(){this.N=this.V(L(this));this.b-=7},function(){this.N=this.j;this.b-=5},function(){this.R=this.L;this.b-=5},function(){this.R=this.O;this.b-=5},function(){this.R=this.M;this.b-=5},function(){this.R= +this.P;this.b-=5},function(){this.R=this.N;this.b-=5},function(){this.b-=5},function(){this.R=this.V(L(this));this.b-=7},function(){this.R=this.j;this.b-=5},function(){N(this,L(this),this.L);this.b-=7},function(){N(this,L(this),this.O);this.b-=7},function(){N(this,L(this),this.M);this.b-=7},function(){N(this,L(this),this.P);this.b-=7},function(){N(this,L(this),this.N);this.b-=7},function(){N(this,L(this),this.R);this.b-=7},function(){this.A|=16;this.b-=7;this.D&&hb(this,-2147483648)?(H(this,this.K- +1),this.D.ea()):this.ma&512||(this.D&&H(this,this.K-1),this.ea())},function(){N(this,L(this),this.j);this.b-=7},function(){this.j=this.L;this.b-=5},function(){this.j=this.O;this.b-=5},function(){this.j=this.M;this.b-=5},function(){this.j=this.P;this.b-=5},function(){this.j=this.N;this.b-=5},function(){this.j=this.R;this.b-=5},function(){this.j=this.V(L(this));this.b-=7},function(){this.b-=5},function(){this.j=Jc(this,this.L);this.b-=4},function(){this.j=Jc(this,this.O);this.b-=4},function(){this.j= +Jc(this,this.M);this.b-=4},function(){this.j=Jc(this,this.P);this.b-=4},function(){this.j=Jc(this,this.N);this.b-=4},function(){this.j=Jc(this,this.R);this.b-=4},function(){this.j=Jc(this,this.V(L(this)));this.b-=7},function(){this.j=Jc(this,this.j);this.b-=4},function(){this.j=Kc(this,this.L);this.b-=4},function(){this.j=Kc(this,this.O);this.b-=4},function(){this.j=Kc(this,this.M);this.b-=4},function(){this.j=Kc(this,this.P);this.b-=4},function(){this.j=Kc(this,this.N);this.b-=4},function(){this.j= +Kc(this,this.R);this.b-=4},function(){this.j=Kc(this,this.V(L(this)));this.b-=7},function(){this.j=Kc(this,this.j);this.b-=4},function(){this.j=id(this,this.L);this.b-=4},function(){this.j=id(this,this.O);this.b-=4},function(){this.j=id(this,this.M);this.b-=4},function(){this.j=id(this,this.P);this.b-=4},function(){this.j=id(this,this.N);this.b-=4},function(){this.j=id(this,this.R);this.b-=4},function(){this.j=id(this,this.V(L(this)));this.b-=7},function(){this.j=id(this,this.j);this.b-=4},function(){this.j= +jd(this,this.L);this.b-=4},function(){this.j=jd(this,this.O);this.b-=4},function(){this.j=jd(this,this.M);this.b-=4},function(){this.j=jd(this,this.P);this.b-=4},function(){this.j=jd(this,this.N);this.b-=4},function(){this.j=jd(this,this.R);this.b-=4},function(){this.j=jd(this,this.V(L(this)));this.b-=7},function(){this.j=jd(this,this.j);this.b-=4},function(){this.j=Lc(this,this.L);this.b-=4},function(){this.j=Lc(this,this.O);this.b-=4},function(){this.j=Lc(this,this.M);this.b-=4},function(){this.j= +Lc(this,this.P);this.b-=4},function(){this.j=Lc(this,this.N);this.b-=4},function(){this.j=Lc(this,this.R);this.b-=4},function(){this.j=Lc(this,this.V(L(this)));this.b-=7},function(){this.j=Lc(this,this.j);this.b-=4},function(){this.j=kd(this,this.L);this.b-=4},function(){this.j=kd(this,this.O);this.b-=4},function(){this.j=kd(this,this.M);this.b-=4},function(){this.j=kd(this,this.P);this.b-=4},function(){this.j=kd(this,this.N);this.b-=4},function(){this.j=kd(this,this.R);this.b-=4},function(){this.j= +kd(this,this.V(L(this)));this.b-=7},function(){this.j=kd(this,this.j);this.b-=4},function(){this.j=hd(this,this.L);this.b-=4},function(){this.j=hd(this,this.O);this.b-=4},function(){this.j=hd(this,this.M);this.b-=4},function(){this.j=hd(this,this.P);this.b-=4},function(){this.j=hd(this,this.N);this.b-=4},function(){this.j=hd(this,this.R);this.b-=4},function(){this.j=hd(this,this.V(L(this)));this.b-=7},function(){this.j=hd(this,this.j);this.b-=4},function(){Mc(this,this.L);this.b-=4},function(){Mc(this, +this.O);this.b-=4},function(){Mc(this,this.M);this.b-=4},function(){Mc(this,this.P);this.b-=4},function(){Mc(this,this.N);this.b-=4},function(){Mc(this,this.R);this.b-=4},function(){Mc(this,this.V(L(this)));this.b-=7},function(){Mc(this,this.j);this.b-=4},function(){Hc(this)||(H(this,R(this)),this.b-=6);this.b-=5},function(){Bc(this,R(this));this.b-=10},function(){var a=P(this);Hc(this)||H(this,a);this.b-=10},qd,function(){var a=P(this);Hc(this)||(S(this,this.K),H(this,a),this.b-=6);this.b-=11},function(){S(this, +Ac(this));this.b-=11},function(){this.j=Jc(this,O(this));this.b-=7},function(){S(this,this.K);H(this,0);this.b-=11},function(){Hc(this)&&(H(this,R(this)),this.b-=6);this.b-=5},rd,function(){var a=P(this);Hc(this)&&H(this,a);this.b-=10},qd,function(){var a=P(this);Hc(this)&&(S(this,this.K),H(this,a),this.b-=6);this.b-=11},sd,function(){this.j=Kc(this,O(this));this.b-=7},function(){S(this,this.K);H(this,8);this.b-=11},function(){Ec(this)||(H(this,R(this)),this.b-=6);this.b-=5},function(){Dc(this,R(this)); +this.b-=10},function(){var a=P(this);Ec(this)||H(this,a);this.b-=10},function(){var a=O(this);Hb(this.C,a,this.j);this.b-=10},function(){var a=P(this);Ec(this)||(S(this,this.K),H(this,a),this.b-=6);this.b-=11},function(){S(this,Cc(this));this.b-=11},function(){this.j=id(this,O(this));this.b-=7},function(){S(this,this.K);H(this,16);this.b-=11},function(){Ec(this)&&(H(this,R(this)),this.b-=6);this.b-=5},rd,function(){var a=P(this);Ec(this)&&H(this,a);this.b-=10},function(){var a=O(this);this.j=xb(this.C, +a)&255;this.b-=10},function(){var a=P(this);Ec(this)&&(S(this,this.K),H(this,a),this.b-=6);this.b-=11},sd,function(){this.j=jd(this,O(this));this.b-=7},function(){S(this,this.K);H(this,24);this.b-=11},function(){Fc(this)||(H(this,R(this)),this.b-=6);this.b-=5},function(){M(this,R(this));this.b-=10},function(){var a=P(this);Fc(this)||H(this,a);this.b-=10},function(){var a=R(this);S(this,L(this));M(this,a);this.b-=18},function(){var a=P(this);Fc(this)||(S(this,this.K),H(this,a),this.b-=6);this.b-=11}, +function(){S(this,L(this));this.b-=11},function(){this.j=Lc(this,O(this));this.b-=7},function(){S(this,this.K);H(this,32);this.b-=11},function(){Fc(this)&&(H(this,R(this)),this.b-=6);this.b-=5},function(){H(this,L(this));this.b-=5},function(){var a=P(this);Fc(this)&&H(this,a);this.b-=10},function(){var a=L(this);M(this,Cc(this));Dc(this,a);this.b-=5},function(){var a=P(this);Fc(this)&&(S(this,this.K),H(this,a),this.b-=6);this.b-=11},sd,function(){this.j=kd(this,O(this));this.b-=7},function(){S(this, +this.K);H(this,40);this.b-=11},function(){Ic(this)||(H(this,R(this)),this.b-=6);this.b-=5},function(){var a=R(this);yc(this,a);this.j=a>>8;this.b-=10},function(){var a=P(this);Ic(this)||H(this,a);this.b-=10},function(){this.ma&=-513;this.b-=4},function(){var a=P(this);Ic(this)||(S(this,this.K),H(this,a),this.b-=6);this.b-=11},function(){S(this,zc(this)&255|this.j<<8);this.b-=11},function(){this.j=hd(this,O(this));this.b-=7},function(){S(this,this.K);H(this,48);this.b-=11},function(){Ic(this)&&(H(this, +R(this)),this.b-=6);this.b-=5},function(){this.ba=L(this)&65535;this.b-=5},function(){var a=P(this);Ic(this)&&H(this,a);this.b-=10},function(){this.ma|=512;this.b-=4},function(){var a=P(this);Ic(this)&&(S(this,this.K),H(this,a),this.b-=6);this.b-=11},sd,function(){Mc(this,O(this));this.b-=7},function(){S(this,this.K);H(this,56);this.b-=11}]; +function V(a){u.call(this,"ChipSet",a,V,32768);var b=a.model;b&&!td[b]&&t("Unrecognized ChipSet model: "+b);this.Ra=td[b];a.sound&&(this.X=null,window&&(this.X=window.AudioContext||window.webkitAudioContext),this.X&&new this.X);E(this)}x(V);var td={SI1978:1978.1};m=V.prototype;m.na=function(){return!1}; +m.Aa=function(a,b,c,d){this.C=b;this.b=c;this.D=d;this.u=a;if(1978.1==this.Ra){var e;a=ud;void 0===e&&(e=0);for(var f in a){c=b;d=+f+e;var h=a[f].bind(this);if(void 0!==h)for(var g=+f+e;g<=d;g++)void 0!==c.A[g]?t("Input port "+r(g)+" already registered"):c.A[g]=[h,!1]}var k;e=vd;void 0===k&&(k=0);for(var l in e)if(f=b,a=+l+k,c=e[l].bind(this),void 0!==c)for(d=+l+k;d<=a;d++)void 0!==f.F[d]?t("Output port "+r(d)+" already registered"):f.F[d]=[c,!1]}}; +m.wa=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};m.va=function(a){return a?this.save():!0};m.reset=function(){this.H=this.I=this.A=this.F=this.U=this.T=this.J=0};m.save=function(){var a=new J(this);1978.1==this.Ra&&K(a,0,[this.J,this.T,this.U,this.F,this.A,this.H,this.I]);return a.data()};m.restore=function(a){a=a[0];1978.1==this.Ra&&(this.J=a[0],this.T=a[1],this.U=a[2],this.F=a[3],this.A=a[4],this.H=a[5],this.I=a[6]);return!0}; +m.bc=function(a,b){var c=this.J;db(this,a,null,b,"STATUS0",c);return c};m.cc=function(a,b){var c=this.T;db(this,a,null,b,"STATUS1",c);return c};m.dc=function(a,b){var c=this.U;db(this,a,null,b,"STATUS2",c);return c};m.ac=function(a,b){var c=this.F<>8&255;db(this,a,null,b,"SHIFT.RESULT",c);return c};m.ic=function(a,b,c){db(this,a,b,c,"SHIFT.COUNT",null);this.A=b};m.kc=function(a,b,c){db(this,a,b,c,"SOUND1",null);this.H=b};m.jc=function(a,b,c){db(this,a,b,c,"SHIFT.DATA",null);this.F=b}; +m.lc=function(a,b,c){db(this,a,b,c,"SOUND2",null);this.I=b};var ud={0:V.prototype.bc,1:V.prototype.cc,2:V.prototype.dc,3:V.prototype.ac},vd={2:V.prototype.ic,3:V.prototype.kc,4:V.prototype.jc,5:V.prototype.lc};Ia(function(){for(var a=A(document,"pc8080","chipset"),b=0;b>>0,h],p=ia(n,k,a.Eb);0>p&&n.splice(-(p+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.J.push({nc:b,B:c,gc:d,xa:e,Bb:f})}delete this.xa}return!0};wd.prototype.va=function(){return!0}; +function xd(a,b,c,d){if(d)a.la("Unable to load system ROM (error "+d+": "+b+")");else{Xa(a.Hb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.u=f;else if(h)for(a.u=Array(4*h.length),d=c=0;c>8&255,a.u[d++]=h[c]>>16&255,a.u[d++]=h[c]>>24&255;else a.u=e;a.xa=e.symbols;if(!a.u.length){t("Empty ROM: "+b);return}if(1==a.u.length){t(a.u[0]);return}}catch(g){a.la("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, +" ").replace(/ +$/,"").split(" "),a.u=Array(b.length),e=0;e>>d.Y].$a(e&d.u,a.u[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.F?b.push(a.F):null!=a.F&&a.F.length&&(b=a.F);for(c=0;c>>e.Y;0>>=e.Y;0Missing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=oa().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height= +(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Ra.aspect);f&&.3<=f&&3.33>=f&&(Ha("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");za("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);e.getContext("2d");d=new Bd(d);$a(d,c)}}); +function Cd(a){u.call(this,"Debugger",a,Cd);this.aa=Dd;this.oa=this.Ma=this.U=0;this.Z=W();this.Fb=W();this.H=-1;this.F=[];this.sa=!1;this.pa=W();this.J=[];this.ra={};this.A=this.ca=this.I=[];Ed(this);this.Ca=0;Fd(this);this.ab=[];Gd(this,a.messages);this.rb=a.commands;var b=this;window?void 0===window.$&&(window.$=function(a){return nc(b,a)}):void 0===global.$&&(global.$=function(a){return nc(b,a)})}x(Cd); +var Hd={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression",k:"stack trace",ln:"list nearest symbol(s)",m:"messages","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble",v:"print version","var":"assign variable"},Dd=8086,Id="NONE ACI ADC ADD ADI ANA ANI CALL CC CM CNC CNZ CP CPE CPO CZ CMA CMC CMP CPI DAA DAD DCR DCX DI EI HLT IN INR INX JMP JC JM JNC JNZ JP JPE JPO JZ LDA LDAX LHLD LXI MOV MVI NOP ORA ORI OUT PCHL POP PUSH RAL RAR RET RC RM RNC RNZ RP RPE RPO RZ RLC RRC RST SBB SBI SHLD SPHL STA STAX STC SUB SUI XCHG XRA XRI XTHL".split(" "), +Jd="NONE ADC ADC ADD ADD AND AND CALL CALLC CALLS CALLNC CALLNZ CALLNS CALLP CALLNP CALLZ NOT CMC CMP CMP DAA ADD DEC DEC CLI STI HLT IN INC INC JMP JC JS JNC JNZ JNS JP JNP JZ LDA MOV MOV MOV MOV MOV NOP OR OR OUT JMP POP PUSH RCL RCR RET RETC RETS RETNC RETNZ RETNS RETP RETNP RETZ ROL ROR RST SBB SBB MOV MOV MOV MOV STC SUB SUB XCHG XOR XOR XCHG".split(" "),Kd="B C D E H L M A BC DE HL SP PC PSW".split(" "),Ld=[[45],[42,2067,32],[71,2131,18193],[29,2067],[28,17],[22,17],[44,17,32],[63],[45,32768], +[21,2579,2067],[40,18193,2131],[23,2067],[28,273],[22,273],[44,273,32],[64],[45,32768],[42,2323,32],[71,2387,18193],[29,2323],[28,529],[22,529],[44,529,32],[52],[45,32768],[21,2579,2323],[40,18193,2387],[23,2323],[28,785],[22,785],[44,785,32],[53],[45,32768],[42,2579,32],[68,115,18963],[29,2579],[28,1041],[22,1041],[44,1041,32],[20],[45,32768],[21,2579,2579],[41,18963,115],[23,2579],[28,1297],[22,1297],[44,1297,32],[16,18193],[45,32768],[42,2835,32],[70,115,18193],[29,2835],[28,1617],[22,1617],[44, +1617,32],[72],[45,32768],[21,2579,2835],[39,18193,115],[23,2835],[28,1809],[22,1809],[44,1809,32],[17],[43,17,17],[43,17,273],[43,17,529],[43,17,785],[43,17,1041],[43,17,1297],[43,17,1617],[43,17,1809],[43,273,17],[43,273,273],[43,273,529],[43,273,785],[43,273,1041],[43,273,1297],[43,273,1617],[43,273,1809],[43,529,17],[43,529,273],[43,529,529],[43,529,785],[43,529,1041],[43,529,1297],[43,529,1617],[43,529,1809],[43,785,17],[43,785,273],[43,785,529],[43,785,785],[43,785,1041],[43,785,1297],[43,785, +1617],[43,785,1809],[43,1041,17],[43,1041,273],[43,1041,529],[43,1041,785],[43,1041,1041],[43,1041,1297],[43,1041,1617],[43,1041,1809],[43,1297,17],[43,1297,273],[43,1297,529],[43,1297,785],[43,1297,1041],[43,1297,1297],[43,1297,1617],[43,1297,1809],[43,1617,17],[43,1617,273],[43,1617,529],[43,1617,785],[43,1617,1041],[43,1617,1297],[43,1617,1617],[43,1617,1809],[43,1809,17],[43,1809,273],[43,1809,529],[43,1809,785],[43,1809,1041],[43,1809,1297],[43,1809,1617],[43,1809,1809],[3,18193,17],[3,18193, +273],[3,18193,529],[3,18193,785],[3,18193,1041],[3,18193,1297],[3,18193,1617],[3,18193,1809],[2,18193,17],[2,18193,273],[2,18193,529],[2,18193,785],[2,18193,1041],[2,18193,1297],[2,18193,1617],[2,18193,1809],[73,18193,17],[73,18193,273],[73,18193,529],[73,18193,785],[73,18193,1041],[73,18193,1297],[73,18193,1617],[73,18193,1809],[66,18193,17],[66,18193,273],[66,18193,529],[66,18193,785],[66,18193,1041],[66,18193,1297],[66,18193,1617],[66,18193,1809],[5,18193,17],[5,18193,273],[5,18193,529],[5,18193, +785],[5,18193,1041],[5,18193,1297],[5,18193,1617],[5,18193,1809],[76,18193,17],[76,18193,273],[76,18193,529],[76,18193,785],[76,18193,1041],[76,18193,1297],[76,18193,1617],[76,18193,1809],[46,18193,17],[46,18193,273],[46,18193,529],[46,18193,785],[46,18193,1041],[46,18193,1297],[46,18193,1617],[46,18193,1809],[18,18193,17],[18,18193,273],[18,18193,529],[18,18193,785],[18,18193,1041],[18,18193,1297],[18,18193,1617],[18,18193,1809],[58],[50,2067],[34,51],[30,51],[11,51],[51,2067],[4,18193,33],[65,128], +[62],[54],[38,51],[30,32819],[15,51],[7,51],[1,18193,33],[65,128],[57],[50,2323],[33,51],[48,33,18193],[10,51],[51,2323],[74,18193,33],[65,128],[55],[54,32768],[31,51],[27,18193,33],[8,51],[7,32819],[67,18193,33],[65,128],[61],[50,2579],[37,51],[78,2899,2579],[14,51],[51,2579],[6,18193,33],[65,128],[60],[49,2579],[36,51],[75,2579,2323],[13,51],[7,32819],[77,18193,33],[65,128],[59],[50,3347],[35,51],[24],[12,51],[51,3347],[47,18193,33],[65,128],[56],[69,2835,2579],[32,51],[25],[9,51],[7,32819],[19, +18193,33],[65,128]],Md={cpu:1,bus:64,mem:128,port:256,chipset:32768,keyboard:65536,key:131072,video:262144,fdc:524288,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:536870912,warn:1073741824,halt:-2147483648};m=Cd.prototype; +m.Aa=function(a,b,c,d){this.C=b;this.b=c;this.u=a;(a=bc(a,"messages"))&&Gd(this,a);this.Cb=Ld;Nd(this,function(a){a:{var b=d.b.ka,c=a[0],g=a=0,k=b.length;if(c){a=X(Y(d,c));if(-1===a){d.g("invalid address: "+c);break a}g=a>>>d.b.Y;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var n=b[g];n.type==c?l++||d.g("..."):(c=n.type,l=Tb[c],n&&d.g(q(n.id)+" %"+q(g<>>c.Y,c=e!=c.u?c.C[f].yb(e,d):c.C[f++].jb(e,d)|c.C[f&c.X].jb(0,d+1)<<8;b&&Od(a,b)}return c}; +m.Ab=function(a,b,c){var d=X(a);if(-1!==d){var e=this.C;e.C[(d&e.H)>>>e.Y].$a(d&e.u,b&255,d);c&&Od(a,c);G(this.b,!0)}};m.Ub=function(a,b,c){var d=X(a);if(-1!==d){var e=this.C,f=d&e.u,h=(d&e.H)>>>e.Y;f!=e.u?e.C[h].zb(f,b&65535,d):(e.C[h++].$a(f,b&255,d),e.C[h&e.X].$a(0,b>>8&255,d+1));c&&Od(a,c);G(this.b,!0)}};function W(a){return{B:a||0,ua:!1}}function Pd(a){return[a.B,a.ua]}function Qd(a){return{B:a[0],ua:a[1]}} +function Y(a,b,c){var d;c=(c?a.Z:a.Fb).B;if(void 0!==b){d=b=Rd(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=la(Kd,a.substr(b,2))));return c}function Xd(a,b){var c=0,d=Yd(a,b);if(void 0!==d)switch(b){case 7:case 0:case 1:case 2:case 3:case 4:case 5:case 6:c=2;break;case 8:case 9:case 10:case 11:case 12:case 13:c=4}return c?q(d,c):"??"} +function Yd(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.L;break;case 1:c=d.O;break;case 8:c=Ac(d);break;case 2:c=d.M;break;case 3:c=d.P;break;case 9:c=Cc(d);break;case 4:c=d.N;break;case 5:c=d.R;break;case 10:c=L(d);break;case 6:c=d.V(L(d));break;case 11:c=d.ba;break;case 12:c=d.K;break;case 13:c=d.j<<8|zc(d)&255}}return c} +function Zd(a,b){b=Rd(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Wd(b,c+1),0<=e&&(b=b.substr(0,c)+Xd(a,e)+b.substr(c+1+Kd[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=aa(e,16),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=Y(a,e))?(d=e+' "'+Vd(a,d)+'"',b=b.replace("$"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("^",c));)e=b.substr(c+1,9),(d=Y(a,e))?(Od(d),d=e+' "'+ +Vd(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+Z(W(this.b.K).B));if(!this.Da||a!=this.Da)if(this.Da=a,this.ga&-2147483648&&(this.ea(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.Wa=0;c.F-=c.b;c.b=0;G(c)}};function gb(a,b,c,d,e,f,h,g){g|=256;null!=e&&(a.ga&g)!=g||a.message(b.bb+"."+(null!=d?"outPort":"inPort")+"("+r(c)+","+(f?f:"unknown")+(null!=d?",0x"+q(d,2):"")+")"+(null!=h?": 0x"+q(h,2):"")+(null!=e?" at "+Z(e):""))} +function Fd(a){var b;if(nd(a)){if(!a.X||!a.X.length){a.X=Array(1E3);for(b=0;b>>d.Y],!1)}a.ca=["br"];if(void 0!==a.I)for(b=1;b>>d.Y],!0);a.I=["bw"];a.Kb=0}m.Ea=function(a,b,c){var d=!0;c||de(this,a,b,!1,!0);if(a!=this.A){var e=X(b);if(-1===e)this.g("invalid address: "+Z(b.B)),d=!1;else{var f=this.b;f.ka[e>>>f.Y].Ea(e&f.H,a==this.I)}}d&&(a.push(b),c?b.ua=!0:(ee(this,a,a.length-1,"set"),Fd(this)));return d}; +function de(a,b,c,d,e){var f=!1;c=X(c);for(var h=1;h>>d.Y],b==a.I));g.ua||Fd(a);break}}return f}function fe(a,b){for(var c=1;c>24,4);break;case 3:C=q(B.mb(Da,2),4);break;default:B="imm("+r(v)+")";break a}B.aa==Dd&&v&64?C="["+C+"]":v&16||(C=(8080==B.aa?"$":"0x")+C);B=C}else v& +16?(B=(p&3840)>>8,v=Kd[B],a.aa==Dd&&p&64&&(6==B&&(v="HL"),v="["+v+"]"),B=v):v&128&&(B=(f>>3&7).toString());if(!B||!B.length){g="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; +function Le(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break; case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0} -function Rd(a,b,c){var d;if(b){b=Qd(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=n+"b"+h;d>>=8}d="0x"+p(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Ne(a,b){if(b)return Me(a,b,a.pa[b]);var c=0;for(b in a.pa)Me(a,b,a.pa[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.ec;if(e>=h&&e> -8&255;case "C":d.N=g&255;break;case "D":d.L=g&255;break;case "DE":d.L=g>>8&255;case "E":d.O=g&255;break;case "H":d.M=g&255;break;case "HL":d.M=g>>8&255;case "L":d.P=g&255;break;case "SP":d.aa=g&65535;break;case "PC":E(d,g);a.Y=V(d.J);break;case "PS":Ac(d,g);break;case "C":d.F=g?d.F|256:d.F&255;break;case "P":g?Gc(d)||(d.V^=1):Gc(d)&&(d.V^=1);break;case "A":d.ca=g?~d.V&16|d.ca&-17:d.V&16|d.ca&-17;break;case "Z":d.F=g?d.F&-256:d.F|255;break;case "S":g?Jc(d)||(d.V^=192):Jc(d)&&(d.V^=192);break;case "I":d.la= -g?d.la|512:d.la&-513;break;default:a.g("unknown register: "+e);return}}if(!h){a.g("invalid value: "+f);return}D(d);a.g("updated registers:")}a.g(je(a));c&&(a.Y=V(d.J),ae(a,Z(a.Y.A)))}}function Te(a,b){b=ha(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Yd(a,c[2])):Rd(a,b,!0)}function Ue(a,b,c){var d="t"!=b;c=Le(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ca(c,function(){return jb(a,!0)&&a.Wa(e,d,!1)},function(){D(a.b);jb(a,!1)})} -function ae(a,b,c,d){if(b=Y(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=Y(a,c,!0);if(!d||d.Ag[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=ge(a,b,h,f);a.g(f);a.Y=b;e-=b.A-k;c++}}} -function Td(a,b,c,d){if(c)if(b){0>a.G&&a.D.length&&(a.G=0);if(0>a.G||b!=a.D[a.G])a.D.splice(0,0,b),a.G=0;a.G--}else b=a.D[a.G+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var e=null;d=d||";";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==d&&!e||!h)a.push(ha(b.substring(c,f))),c=f+1}}return a} -function fe(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.qa&&(a.g("ended assemble at "+Z(a.na.A)),a.Y=a.na,a.qa=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.Ba=null;if(lb(a)&&0l||"z"va.length&&(a.g("note: only "+va.length+" available"),S=va.length);N-=S;0>N&&(null==va[va.length-1].A?(S=N+S,N=0): -N+=va.length);var Pc=[];"call"==pe&&(fb=1E5,Pc=["CALL"]);for(void 0!==oe&&a.g(S+" instructions earlier:");0=va.length&&(N=0);a.Hb=S;re++;fb--}}re||(a.g("no "+qe+"history available"),a.Hb=void 0)}else{var cc=Y(a,ta);if(cc){var dc=0;Ka&&("l"==Ka.charAt(0)&&(Ka=Ka.substr(1)||qf),dc=Le(a,Ka)>>>0,65536>4||1,Qc="dd"==cb?4:"dw"==cb?2:1,ue=0;ueTc;Tc++){var fc=a.U(cc,1),ec=ec|fc<<(Rc++<<3);Rc==Qc&&(yb+=p(ec,2*Qc),yb+=1==Qc?7==Tc?"-":" ":" ",ec=Rc=0);Sc+=32<=fc&&128>fc?String.fromCharCode(fc):"."}La&&(La+="\n");La+=ta+" "+yb+" "+Sc}La&&a.g(La);a.Db=cc}}}}break;case "e":if("else"==f[0])break;var gc=1,ve=255,we=a.U,xe=a.yb;"ew"==f[0]&&(gc=2,ve=65535,we=a.lb,xe=a.Sb);var ye=gc<<1,ze=f[1];if(null==ze)a.g("edit memory commands:"), -a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var hc=Y(a,ze);if(hc)for(var ic=2;icZc;){for(var Ma=null,xf=256;65536>Bb.A>>>0;){Be.A=a.lb(Bb,2);if(null==Bb.A||!xf--)break;for(var yf=a,jc=Be,Ce=null,Cb=jc.A,De=Cb,$c=1;6>=$c&&Cb;$c++){if(2<$c){jc.A=Cb;var kc=ge(yf,jc);if(0df){if($e(d,this.W)){this.H=new G(this,ff,"failsafe");$e(this.H)&&(kf(this,d),a=2,Xe(this.H));H(this.H,"timestamp",ka());Ye(this.H);var e=this.s&&!this.I;if(1==a||pa("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Ze(d)){var f=af(d,"code"),h=af(d,"data");f&&("ok"==f?$e(d,h):("error"==f&&"no machine state"!= -h?(this.ka("Error: "+h),"unable to verify user"==h&&(Aa("user",""),this.w=null)):this.g(f+": "+h),Xe(d),$e(d)?(c=Ze(d),e=!0):c=!1))}e&&jf(this,c?d:null)}else 2==a&&d.clear()}else jf(this);delete this.W;delete this.Y}e=Za(this.id);for(f=0;fa[1];a=a[2];this.u.ga=!0;var d=this.R.power;d&&(d.textContent="Shutdown");this.na||(this.g("PC8080 v"+ff+"\nCopyright \u00a9 2012-2016 Jeff Parsons \nLicense: GPL version 3 or later "),this.na=!0);this.b&&(lf(this,this.b,b,c,a),qc(this.b));this.pa&&(kf(this,b),b.clear());!c&&this.H&&(this.H.clear(),delete this.H);this.D=0}; -function kf(a,b){if(pa("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.va,d=a.w||"",e=b.toString(),f={app:"PC8080"};f.ver=ff;f.url=c;f.user=d;f.type="bug";f.data=e;ma("http://www.pcjs.org/api/v1/report",f,!0)}} -function Ve(a,b,c){var d,e="none";if(a.D)return null;a.D--;var f=new G(a,ff),h=new G(a,ff,"validate"),g=ka();H(h,"timestamp",g);H(f,"timestamp",g);H(f,"version","1.21.7");H(f,"url",window?window.location.href:null);H(f,"browser",oa());a.b&&a.b.ta&&(c&&a.b.da(),d=a.b.ta(b,c),"object"===typeof d&&H(f,a.b.id,d),c&&(a.b.u.ga=!1,!1===d&&(e=null)));for(var g=Za(a.id),k=0;kg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pc8080$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: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");ma(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[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{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],h);Ef(a,b,c)}})}else c(a,null)} -function Ff(a,b,c,d){function e(a){if(void 0===g){var b=h&&z(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=fa(a))}function f(a){e("Error: "+a);k&&(--of||Pa(!0));k=!1}var h,g,k=!0;of++;Xa[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)}c|| -(c="/versions/pc8080/1.21.7/components.xsl");l=function(d,g){g?pf(c,null,null,!1,e,function(d,k){if(k)if(Ya(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--of||Pa(!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),--of||Pa(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?pf(b,a,d,!0,e,l):Df(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(u){f(u.message)}return k}window.embedPC8080=function(a,b,c,d){Pa(!1);return Ff(a,b,c,d)};window.enableEvents=Pa;window.sendEvent=Qa; -function Gf(a,b,c,d){if(!c&&b){d.push(b);a=Xa[d[0]];b=null;for(var e in a)if(da(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?ma(b,null,!0,function(a,b){Hf(b,d)}):Hf(null,d)}else t("Error ("+c+") requesting "+a)} -function Hf(a,b){var c,d,e,f=b[0],h=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var g=Xa[f],k={},l;for(l in g){var n=g[l],q=ca(l);if("xml"==q){for(q=/[ \t]*]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=q.exec(g[l]);){var u=d[2];u&&(g[u]||(n=n.replace(d[0],"")))}d=l=ba(l)}else"xsl"==q&&(e=l=ba(l));k[l]=n}a&&(k[l="css"]=a);b[2]&&(k[l="parms"]=b[2]);b[3]&&(k[l="state"]=b[3]);d&&e?(l=JSON.stringify(k),h+=".js",c=c[1]+"var resources="+l+";"+c[2]+c[3],c=c.replace(/\u00A9/g, -"©"),l=h,g=null,k="data:application/javascript,",k=Ba("Firefox")?k+encodeURIComponent(c):k+encodeURI(c),l&&(g=document.createElement("a"),"string"!=typeof g.download&&(g=null)),g?(g.href=k,g.download=l,document.body.appendChild(g),g.click(),document.body.removeChild(g),c="Check your Downloads folder for "+l+"."):(window.open(k),c="Check your browser for a new window/tab containing the requested data"+(l?" ("+l+")":"")+"."),c+=', copy it to your web server as "'+h+'", and then add the following to your web page:\n\n', +function Sd(a,b,c){var d;if(b){b=Rd(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=n+"b"+h;d>>=8}d="0x"+q(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Oe(a,b){if(b)return Ne(a,b,a.ra[b]);var c=0;for(b in a.ra)Ne(a,b,a.ra[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.gc;if(e>=h&&e>8&255;case "C":d.O=g&255;break;case "D":d.M= +g&255;break;case "DE":d.M=g>>8&255;case "E":d.P=g&255;break;case "H":d.N=g&255;break;case "HL":d.N=g>>8&255;case "L":d.R=g&255;break;case "SP":d.ba=g&65535;break;case "PC":H(d,g);a.Z=W(d.K);break;case "PS":yc(d,g);break;case "C":d.G=g?d.G|256:d.G&255;break;case "P":g?Fc(d)||(d.W^=1):Fc(d)&&(d.W^=1);break;case "A":d.da=g?~d.W&16|d.da&-17:d.W&16|d.da&-17;break;case "Z":d.G=g?d.G&-256:d.G|255;break;case "S":g?Ic(d)||(d.W^=192):Ic(d)&&(d.W^=192);break;case "I":d.ma=g?d.ma|512:d.ma&-513;break;default:a.g("unknown register: "+ +e);return}if(!h){a.g("invalid value: "+f);return}G(d);a.g("updated registers:")}a.g(ke(a));c&&(a.Z=W(d.K),be(a,Z(a.Z.B)))}}function Ve(a,b){b=ha(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Zd(a,c[2])):Sd(a,b,!0)}function We(a,b,c){var d="t"!=b;c=Me(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Aa(c,function(){return ib(a,!0)&&a.Ya(e,d,!1)},function(){G(a.b);ib(a,!1)})} +function be(a,b,c,d){if(b=Y(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=Y(a,c,!0);if(!d||d.Bg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=he(a,b,h,f);a.g(f);a.Z=b;e-=b.B-k;c++}}} +function Ud(a,b,c,d){if(c)if(b){0>a.H&&a.F.length&&(a.H=0);if(0>a.H||b!=a.F[a.H])a.F.splice(0,0,b),a.H=0;a.H--}else b=a.F[a.H+1];a=[];if(b){b=b.toLowerCase().replace(/""/g,"'");c=0;var e=null;d=d||";";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==d&&!e||!h)a.push(ha(b.substring(c,f))),c=f+1}}return a} +function ge(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.sa&&(a.g("ended assemble at "+Z(a.pa.B)),a.Z=a.pa,a.sa=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.Da=null;if(kb(a)&&0l||"z"ta.length&&(a.g("note: only "+ta.length+" available"),U=ta.length);Q-=U;0>Q&&(null==ta[ta.length-1].B?(U=Q+U,Q=0): +Q+=ta.length);var Pc=[];"call"==qe&&(fb=1E5,Pc=["CALL"]);for(void 0!==pe&&a.g(U+" instructions earlier:");0=ta.length&&(Q=0);a.Lb=U;se++;fb--}}se||(a.g("no "+re+"history available"),a.Lb=void 0)}else{var cc=Y(a,ra);if(cc){var dc=0;Ja&&("l"==Ja.charAt(0)&&(Ja=Ja.substr(1)||sf),dc=Me(a,Ja)>>>0,65536>4||1,Qc="dd"==cb?4:"dw"==cb?2:1,ve=0;veTc;Tc++){var fc=a.V(cc,1),ec=ec|fc<<(Rc++<<3);Rc==Qc&&(zb+=q(ec,2*Qc),zb+=1==Qc?7==Tc?"-":" ":" ",ec=Rc=0);Sc+=32<=fc&&128>fc?String.fromCharCode(fc):"."}Ka&&(Ka+="\n");Ka+=ra+" "+zb+" "+Sc}Ka&&a.g(Ka);a.Fb=cc}}}}break;case "e":if("else"==f[0])break;var gc=1,we=255,xe=a.V,ye=a.Ab;"ew"==f[0]&&(gc=2,we=65535,xe=a.mb,ye=a.Ub);var ze=gc<<1,Ae=f[1];if(null==Ae)a.g("edit memory commands:"), +a.g("\teb [a] [...] edit bytes at address a"),a.g("\tew [a] [...] edit words at address a");else{var hc=Y(a,Ae);if(hc)for(var ic=2;icZc;){for(var La=null,zf=256;65536>Cb.B>>>0;){Ce.B=a.mb(Cb,2);if(null==Cb.B||!zf--)break;for(var Af=a,jc=Ce,De=null,Db=jc.B,Ee=Db,$c=1;6>=$c&&Db;$c++){if(2<$c){jc.B=Db;var kc=he(Af,jc);if(0ff){if(bf(d,this.X)){this.I=new J(this,hf,"failsafe");bf(this.I)&&(mf(this,d),a=2,Ze(this.I));K(this.I,"timestamp",ka());$e(this.I);var e=this.u&&!this.J;if(1==a||pa("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=af(d)){var f=cf(d,"code"),h=cf(d,"data");f&&("ok"==f?bf(d,h):("error"==f&&"no machine state"!= +h?(this.la("Error: "+h),"unable to verify user"==h&&(ya("user",""),this.A=null)):this.g(f+": "+h),Ze(d),bf(d)?(c=af(d),e=!0):c=!1))}e&&lf(this,c?d:null)}else 2==a&&d.clear()}else lf(this);delete this.X;delete this.Z}e=Ya(this.id);for(f=0;fa[1];a=a[2];this.w.ha=!0;var d=this.S.power;d&&(d.textContent="Shutdown");this.oa||(this.g("PC8080 v"+hf+"\nCopyright \u00a9 2012-2016 Jeff Parsons \nLicense: GPL version 3 or later "),this.oa=!0);this.b&&(nf(this,this.b,b,c,a),oc(this.b));this.pa&&(mf(this,b),b.clear());!c&&this.I&&(this.I.clear(),delete this.I);this.F=0}; +function mf(a,b){if(pa("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.ta,d=a.A||"",e=b.toString(),f={app:"PC8080"};f.ver=hf;f.url=c;f.user=d;f.type="bug";f.data=e;ma("http://www.pcjs.org/api/v1/report",f,!0)}} +function Xe(a,b,c){var d,e="none";if(a.F)return null;a.F--;var f=new J(a,hf),h=new J(a,hf,"validate"),g=ka();K(h,"timestamp",g);K(f,"timestamp",g);K(f,"version","1.21.7");K(f,"url",window?window.location.href:null);K(f,"browser",oa());a.b&&a.b.va&&(c&&a.b.ea(),d=a.b.va(b,c),"object"===typeof d&&K(f,a.b.id,d),c&&(a.b.w.ha=!1,!1===d&&(e=null)));for(var g=Ya(a.id),k=0;kg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pc8080$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=d[2];b("Loading "+e+"...");ma(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[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{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],h);Gf(a,b,c)}})}else c(a,null)} +function Hf(a,b,c,d){function e(a){if(void 0===g){var b=h&&A(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=fa(a))}function f(a){e("Error: "+a);k&&(--qf||Oa(!0));k=!1}var h,g,k=!0;qf++;Wa[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)}c|| +(c="/versions/pc8080/1.21.7/components.xsl");l=function(d,g){g?rf(c,null,null,!1,e,function(d,k){if(k)if(Xa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--qf||Oa(!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),--qf||Oa(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?rf(b,a,d,!0,e,l):Ff(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(z){f(z.message)}return k}window.embedPC8080=function(a,b,c,d){Oa(!1);return Hf(a,b,c,d)};window.enableEvents=Oa;window.sendEvent=Pa; +function If(a,b,c,d){if(!c&&b){d.push(b);a=Wa[d[0]];b=null;for(var e in a)if(da(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?ma(b,null,!0,function(a,b){Jf(b,d)}):Jf(null,d)}else t("Error ("+c+") requesting "+a)} +function Jf(a,b){var c,d,e,f=b[0],h=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var g=Wa[f],k={},l;for(l in g){var n=g[l],p=ca(l);if("xml"==p){for(p=/[ \t]*]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=p.exec(g[l]);){var z=d[2];z&&(g[z]||(n=n.replace(d[0],"")))}d=l=ba(l)}else"xsl"==p&&(e=l=ba(l));k[l]=n}a&&(k[l="css"]=a);b[2]&&(k[l="parms"]=b[2]);b[3]&&(k[l="state"]=b[3]);d&&e?(l=JSON.stringify(k),h+=".js",c=c[1]+"var resources="+l+";"+c[2]+c[3],c=c.replace(/\u00A9/g, +"©"),l=h,g=null,k="data:application/javascript,",k=za("Firefox")?k+encodeURIComponent(c):k+encodeURI(c),l&&(g=document.createElement("a"),"string"!=typeof g.download&&(g=null)),g?(g.href=k,g.download=l,document.body.appendChild(g),g.click(),document.body.removeChild(g),c="Check your Downloads folder for "+l+"."):(window.open(k),c="Check your browser for a new window/tab containing the requested data"+(l?" ("+l+")":"")+"."),c+=', copy it to your web server as "'+h+'", and then add the following to your web page:\n\n', c+='
\n',c+="...\n",c+='