Add debugger option to enable 8086-style mnemonics (to minimize brain-hurting)

This commit is contained in:
Jeff Parsons 2016-04-26 11:43:14 -07:00
commit 1e32efccc6
2 changed files with 498 additions and 476 deletions

View file

@ -87,6 +87,8 @@ function Debugger(parmsDbg)
Component.call(this, "Debugger", parmsDbg, Debugger); 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 * 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). * have been enabled (eg, one or more breakpoints have been set).
@ -98,14 +100,6 @@ function Debugger(parmsDbg)
this.nCycles = 0; this.nCycles = 0;
this.cOpcodes = this.cOpcodesStart = 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 * 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, * or dbgAddrNextData when no address has been given. doDump() and doUnassemble(), in turn,
@ -256,21 +250,18 @@ if (DEBUGGER) {
'print': "print expression", 'print': "print expression",
'r': "dump/set registers", 'r': "dump/set registers",
'reset': "reset machine", 'reset': "reset machine",
's': "set options",
't [#]': "trace", // other variations: tr (trace and dump registers) 't [#]': "trace", // other variations: tr (trace and dump registers)
'u [#]': "unassemble", 'u [#]': "unassemble",
'x': "execution options",
'v': "print version", 'v': "print version",
'var': "assign variable" 'var': "assign variable"
}; };
Debugger.STYLE_8080 = 8080;
Debugger.STYLE_8086 = 8086;
/* /*
* CPU instruction ordinals * 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 = { Debugger.INS = {
NONE: 0, ACI: 1, ADC: 2, ADD: 3, ADI: 4, ANA: 5, ANI: 6, CALL: 7, 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) * 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 = [ Debugger.INS_NAMES = [
"NONE", "ACI", "ADC", "ADD", "ADI", "ANA", "ANI", "CALL", "NONE", "ACI", "ADC", "ADD", "ADI", "ANA", "ANI", "CALL",
@ -301,8 +295,18 @@ if (DEBUGGER) {
"STC", "SUB", "SUI", "XCHG", "XRA", "XRI", "XTHL" "STC", "SUB", "SUI", "XCHG", "XRA", "XRI", "XTHL"
]; ];
Debugger.CPU_8080 = 0; Debugger.INS_NAMES_8086 = [
Debugger.CPUS = [8080]; "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_B = 0x00;
Debugger.REG_C = 0x01; Debugger.REG_C = 0x01;
@ -312,16 +316,15 @@ if (DEBUGGER) {
Debugger.REG_L = 0x05; Debugger.REG_L = 0x05;
Debugger.REG_M = 0x06; Debugger.REG_M = 0x06;
Debugger.REG_A = 0x07; Debugger.REG_A = 0x07;
Debugger.REG_F = 0x08; // the flags register ("F") Debugger.REG_BC = 0x08;
Debugger.REG_BC = 0x09; Debugger.REG_DE = 0x09;
Debugger.REG_DE = 0x0A; Debugger.REG_HL = 0x0A;
Debugger.REG_HL = 0x0B; Debugger.REG_SP = 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_PC = 0x0C;
Debugger.REG_SP = 0x0D; Debugger.REG_PS = 0x0D; // aka PSW (aka AF if Z80-style)
Debugger.REG_PC = 0x0E;
Debugger.REGS = [ 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_REG = 0x0010; // register
Debugger.TYPE_IMM = 0x0020; // immediate data Debugger.TYPE_IMM = 0x0020; // immediate data
Debugger.TYPE_ADDR = 0x0033; // immediate (word) address
Debugger.TYPE_MEM = 0x0040; // memory reference 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. * 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. * 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_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_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_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_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_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_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_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_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_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_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_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_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_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 * TYPE_OTHER bit definitions
@ -373,6 +378,7 @@ if (DEBUGGER) {
Debugger.TYPE_IN = 0x1000; // operand is input Debugger.TYPE_IN = 0x1000; // operand is input
Debugger.TYPE_OUT = 0x2000; // operand is output Debugger.TYPE_OUT = 0x2000; // operand is output
Debugger.TYPE_BOTH = (Debugger.TYPE_IN | Debugger.TYPE_OUT); 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 Debugger.TYPE_UNDOC = 0x8000; // opcode is an undocumented alternative encoding
/* /*
@ -396,261 +402,261 @@ if (DEBUGGER) {
*/ */
Debugger.aaOpDescs = [ Debugger.aaOpDescs = [
/* 0x00 */ [Debugger.INS.NOP], /* 0x00 */ [Debugger.INS.NOP],
/* 0x01 */ [Debugger.INS.LXI, Debugger.TYPE_BC, Debugger.TYPE_IMM], /* 0x01 */ [Debugger.INS.LXI, Debugger.TYPE_BC, Debugger.TYPE_IMM],
/* 0x02 */ [Debugger.INS.STAX, Debugger.TYPE_BC | Debugger.TYPE_MEM], /* 0x02 */ [Debugger.INS.STAX, Debugger.TYPE_BC | Debugger.TYPE_MEM, Debugger.TYPE_A | Debugger.TYPE_OPT],
/* 0x03 */ [Debugger.INS.INX, Debugger.TYPE_BC], /* 0x03 */ [Debugger.INS.INX, Debugger.TYPE_BC],
/* 0x04 */ [Debugger.INS.INR, Debugger.TYPE_B], /* 0x04 */ [Debugger.INS.INR, Debugger.TYPE_B],
/* 0x05 */ [Debugger.INS.DCR, 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], /* 0x07 */ [Debugger.INS.RLC],
/* 0x08 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], /* 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 /* 0x09 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_BC], // let's be more explicit about the operands
/* 0x0A */ [Debugger.INS.LDAX, Debugger.TYPE_BC | Debugger.TYPE_MEM], /* 0x0A */ [Debugger.INS.LDAX, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_BC | Debugger.TYPE_MEM],
/* 0x0B */ [Debugger.INS.DCX, Debugger.TYPE_BC], /* 0x0B */ [Debugger.INS.DCX, Debugger.TYPE_BC],
/* 0x0C */ [Debugger.INS.INR, Debugger.TYPE_C], /* 0x0C */ [Debugger.INS.INR, Debugger.TYPE_C],
/* 0x0D */ [Debugger.INS.DCR, 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], /* 0x0F */ [Debugger.INS.RRC],
/* 0x10 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], /* 0x10 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC],
/* 0x11 */ [Debugger.INS.LXI, Debugger.TYPE_DE, Debugger.TYPE_IMM], /* 0x11 */ [Debugger.INS.LXI, Debugger.TYPE_DE, Debugger.TYPE_IMM],
/* 0x12 */ [Debugger.INS.STAX, Debugger.TYPE_DE | Debugger.TYPE_MEM], /* 0x12 */ [Debugger.INS.STAX, Debugger.TYPE_DE | Debugger.TYPE_MEM, Debugger.TYPE_A | Debugger.TYPE_OPT],
/* 0x13 */ [Debugger.INS.INX, Debugger.TYPE_DE], /* 0x13 */ [Debugger.INS.INX, Debugger.TYPE_DE],
/* 0x14 */ [Debugger.INS.INR, Debugger.TYPE_D], /* 0x14 */ [Debugger.INS.INR, Debugger.TYPE_D],
/* 0x15 */ [Debugger.INS.DCR, 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], /* 0x17 */ [Debugger.INS.RAL],
/* 0x18 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], /* 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 /* 0x19 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_DE], // let's be more explicit about the operands
/* 0x1A */ [Debugger.INS.LDAX, Debugger.TYPE_DE | Debugger.TYPE_MEM], /* 0x1A */ [Debugger.INS.LDAX, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_DE | Debugger.TYPE_MEM],
/* 0x1B */ [Debugger.INS.DCX, Debugger.TYPE_DE], /* 0x1B */ [Debugger.INS.DCX, Debugger.TYPE_DE],
/* 0x1C */ [Debugger.INS.INR, Debugger.TYPE_E], /* 0x1C */ [Debugger.INS.INR, Debugger.TYPE_E],
/* 0x1D */ [Debugger.INS.DCR, 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], /* 0x1F */ [Debugger.INS.RAR],
/* 0x20 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], /* 0x20 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC],
/* 0x21 */ [Debugger.INS.LXI, Debugger.TYPE_HL, Debugger.TYPE_IMM], /* 0x21 */ [Debugger.INS.LXI, Debugger.TYPE_HL, Debugger.TYPE_IMM],
/* 0x22 */ [Debugger.INS.SHLD, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_MEM], /* 0x22 */ [Debugger.INS.SHLD, Debugger.TYPE_ADDR | Debugger.TYPE_MEM, Debugger.TYPE_HL | Debugger.TYPE_OPT],
/* 0x23 */ [Debugger.INS.INX, Debugger.TYPE_HL], /* 0x23 */ [Debugger.INS.INX, Debugger.TYPE_HL],
/* 0x24 */ [Debugger.INS.INR, Debugger.TYPE_H], /* 0x24 */ [Debugger.INS.INR, Debugger.TYPE_H],
/* 0x25 */ [Debugger.INS.DCR, 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], /* 0x27 */ [Debugger.INS.DAA],
/* 0x28 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], /* 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 /* 0x29 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_HL], // let's be more explicit about the operands
/* 0x2A */ [Debugger.INS.LHLD, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_MEM], /* 0x2A */ [Debugger.INS.LHLD, Debugger.TYPE_HL | Debugger.TYPE_OPT, Debugger.TYPE_ADDR | Debugger.TYPE_MEM],
/* 0x2B */ [Debugger.INS.DCX, Debugger.TYPE_HL], /* 0x2B */ [Debugger.INS.DCX, Debugger.TYPE_HL],
/* 0x2C */ [Debugger.INS.INR, Debugger.TYPE_L], /* 0x2C */ [Debugger.INS.INR, Debugger.TYPE_L],
/* 0x2D */ [Debugger.INS.DCR, Debugger.TYPE_L], /* 0x2D */ [Debugger.INS.DCR, Debugger.TYPE_L],
/* 0x2E */ [Debugger.INS.MVI, Debugger.TYPE_L, Debugger.TYPE_IMM], /* 0x2E */ [Debugger.INS.MVI, Debugger.TYPE_L, Debugger.TYPE_IMM],
/* 0x2F */ [Debugger.INS.CMA], /* 0x2F */ [Debugger.INS.CMA, Debugger.TYPE_A | Debugger.TYPE_OPT],
/* 0x30 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], /* 0x30 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC],
/* 0x31 */ [Debugger.INS.LXI, Debugger.TYPE_SP, Debugger.TYPE_IMM], /* 0x31 */ [Debugger.INS.LXI, Debugger.TYPE_SP, Debugger.TYPE_IMM],
/* 0x32 */ [Debugger.INS.STA, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_MEM], /* 0x32 */ [Debugger.INS.STA, Debugger.TYPE_ADDR | Debugger.TYPE_MEM, Debugger.TYPE_A | Debugger.TYPE_OPT],
/* 0x33 */ [Debugger.INS.INX, Debugger.TYPE_SP], /* 0x33 */ [Debugger.INS.INX, Debugger.TYPE_SP],
/* 0x34 */ [Debugger.INS.INR, Debugger.TYPE_M], /* 0x34 */ [Debugger.INS.INR, Debugger.TYPE_M],
/* 0x35 */ [Debugger.INS.DCR, 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], /* 0x37 */ [Debugger.INS.STC],
/* 0x38 */ [Debugger.INS.NOP, Debugger.TYPE_UNDOC], /* 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 /* 0x39 */ [Debugger.INS.DAD, Debugger.TYPE_HL, Debugger.TYPE_SP], // let's be more explicit about the operands
/* 0x3A */ [Debugger.INS.LDA, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_MEM], /* 0x3A */ [Debugger.INS.LDA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_ADDR | Debugger.TYPE_MEM],
/* 0x3B */ [Debugger.INS.DCX, Debugger.TYPE_SP], /* 0x3B */ [Debugger.INS.DCX, Debugger.TYPE_SP],
/* 0x3C */ [Debugger.INS.INR, Debugger.TYPE_A], /* 0x3C */ [Debugger.INS.INR, Debugger.TYPE_A],
/* 0x3D */ [Debugger.INS.DCR, 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], /* 0x3F */ [Debugger.INS.CMC],
/* 0x40 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_B], /* 0x40 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_B],
/* 0x41 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_C], /* 0x41 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_C],
/* 0x42 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_D], /* 0x42 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_D],
/* 0x43 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_E], /* 0x43 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_E],
/* 0x44 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_H], /* 0x44 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_H],
/* 0x45 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_L], /* 0x45 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_L],
/* 0x46 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_M], /* 0x46 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_M],
/* 0x47 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_A], /* 0x47 */ [Debugger.INS.MOV, Debugger.TYPE_B, Debugger.TYPE_A],
/* 0x48 */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_B], /* 0x48 */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_B],
/* 0x49 */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_C], /* 0x49 */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_C],
/* 0x4A */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_D], /* 0x4A */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_D],
/* 0x4B */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_E], /* 0x4B */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_E],
/* 0x4C */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_H], /* 0x4C */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_H],
/* 0x4D */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_L], /* 0x4D */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_L],
/* 0x4E */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_M], /* 0x4E */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_M],
/* 0x4F */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_A], /* 0x4F */ [Debugger.INS.MOV, Debugger.TYPE_C, Debugger.TYPE_A],
/* 0x50 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_B], /* 0x50 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_B],
/* 0x51 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_C], /* 0x51 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_C],
/* 0x52 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_D], /* 0x52 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_D],
/* 0x53 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_E], /* 0x53 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_E],
/* 0x54 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_H], /* 0x54 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_H],
/* 0x55 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_L], /* 0x55 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_L],
/* 0x56 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_M], /* 0x56 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_M],
/* 0x57 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_A], /* 0x57 */ [Debugger.INS.MOV, Debugger.TYPE_D, Debugger.TYPE_A],
/* 0x58 */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_B], /* 0x58 */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_B],
/* 0x59 */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_C], /* 0x59 */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_C],
/* 0x5A */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_D], /* 0x5A */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_D],
/* 0x5B */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_E], /* 0x5B */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_E],
/* 0x5C */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_H], /* 0x5C */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_H],
/* 0x5D */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_L], /* 0x5D */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_L],
/* 0x5E */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_M], /* 0x5E */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_M],
/* 0x5F */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_A], /* 0x5F */ [Debugger.INS.MOV, Debugger.TYPE_E, Debugger.TYPE_A],
/* 0x60 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_B], /* 0x60 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_B],
/* 0x61 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_C], /* 0x61 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_C],
/* 0x62 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_D], /* 0x62 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_D],
/* 0x63 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_E], /* 0x63 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_E],
/* 0x64 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_H], /* 0x64 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_H],
/* 0x65 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_L], /* 0x65 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_L],
/* 0x66 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_M], /* 0x66 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_M],
/* 0x67 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_A], /* 0x67 */ [Debugger.INS.MOV, Debugger.TYPE_H, Debugger.TYPE_A],
/* 0x68 */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_B], /* 0x68 */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_B],
/* 0x69 */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_C], /* 0x69 */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_C],
/* 0x6A */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_D], /* 0x6A */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_D],
/* 0x6B */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_E], /* 0x6B */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_E],
/* 0x6C */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_H], /* 0x6C */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_H],
/* 0x6D */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_L], /* 0x6D */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_L],
/* 0x6E */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_M], /* 0x6E */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_M],
/* 0x6F */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_A], /* 0x6F */ [Debugger.INS.MOV, Debugger.TYPE_L, Debugger.TYPE_A],
/* 0x70 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_B], /* 0x70 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_B],
/* 0x71 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_C], /* 0x71 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_C],
/* 0x72 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_D], /* 0x72 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_D],
/* 0x73 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_E], /* 0x73 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_E],
/* 0x74 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_H], /* 0x74 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_H],
/* 0x75 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_L], /* 0x75 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_L],
/* 0x76 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_M], /* 0x76 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_M],
/* 0x77 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_A], /* 0x77 */ [Debugger.INS.MOV, Debugger.TYPE_M, Debugger.TYPE_A],
/* 0x78 */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_B], /* 0x78 */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_B],
/* 0x79 */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_C], /* 0x79 */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_C],
/* 0x7A */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_D], /* 0x7A */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_D],
/* 0x7B */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_E], /* 0x7B */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_E],
/* 0x7C */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_H], /* 0x7C */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_H],
/* 0x7D */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_L], /* 0x7D */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_L],
/* 0x7E */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_M], /* 0x7E */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_M],
/* 0x7F */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_A], /* 0x7F */ [Debugger.INS.MOV, Debugger.TYPE_A, Debugger.TYPE_A],
/* 0x80 */ [Debugger.INS.ADD, Debugger.TYPE_B], /* 0x80 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B],
/* 0x81 */ [Debugger.INS.ADD, Debugger.TYPE_C], /* 0x81 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C],
/* 0x82 */ [Debugger.INS.ADD, Debugger.TYPE_D], /* 0x82 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D],
/* 0x83 */ [Debugger.INS.ADD, Debugger.TYPE_E], /* 0x83 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E],
/* 0x84 */ [Debugger.INS.ADD, Debugger.TYPE_H], /* 0x84 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H],
/* 0x85 */ [Debugger.INS.ADD, Debugger.TYPE_L], /* 0x85 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L],
/* 0x86 */ [Debugger.INS.ADD, Debugger.TYPE_M], /* 0x86 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M],
/* 0x87 */ [Debugger.INS.ADD, Debugger.TYPE_A], /* 0x87 */ [Debugger.INS.ADD, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A],
/* 0x88 */ [Debugger.INS.ADC, Debugger.TYPE_B], /* 0x88 */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B],
/* 0x89 */ [Debugger.INS.ADC, Debugger.TYPE_C], /* 0x89 */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C],
/* 0x8A */ [Debugger.INS.ADC, Debugger.TYPE_D], /* 0x8A */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D],
/* 0x8B */ [Debugger.INS.ADC, Debugger.TYPE_E], /* 0x8B */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E],
/* 0x8C */ [Debugger.INS.ADC, Debugger.TYPE_H], /* 0x8C */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H],
/* 0x8D */ [Debugger.INS.ADC, Debugger.TYPE_L], /* 0x8D */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L],
/* 0x8E */ [Debugger.INS.ADC, Debugger.TYPE_M], /* 0x8E */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M],
/* 0x8F */ [Debugger.INS.ADC, Debugger.TYPE_A], /* 0x8F */ [Debugger.INS.ADC, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A],
/* 0x90 */ [Debugger.INS.SUB, Debugger.TYPE_B], /* 0x90 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B],
/* 0x91 */ [Debugger.INS.SUB, Debugger.TYPE_C], /* 0x91 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C],
/* 0x92 */ [Debugger.INS.SUB, Debugger.TYPE_D], /* 0x92 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D],
/* 0x93 */ [Debugger.INS.SUB, Debugger.TYPE_E], /* 0x93 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E],
/* 0x94 */ [Debugger.INS.SUB, Debugger.TYPE_H], /* 0x94 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H],
/* 0x95 */ [Debugger.INS.SUB, Debugger.TYPE_L], /* 0x95 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L],
/* 0x96 */ [Debugger.INS.SUB, Debugger.TYPE_M], /* 0x96 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M],
/* 0x97 */ [Debugger.INS.SUB, Debugger.TYPE_A], /* 0x97 */ [Debugger.INS.SUB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A],
/* 0x98 */ [Debugger.INS.SBB, Debugger.TYPE_B], /* 0x98 */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B],
/* 0x99 */ [Debugger.INS.SBB, Debugger.TYPE_C], /* 0x99 */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C],
/* 0x9A */ [Debugger.INS.SBB, Debugger.TYPE_D], /* 0x9A */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D],
/* 0x9B */ [Debugger.INS.SBB, Debugger.TYPE_E], /* 0x9B */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E],
/* 0x9C */ [Debugger.INS.SBB, Debugger.TYPE_H], /* 0x9C */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H],
/* 0x9D */ [Debugger.INS.SBB, Debugger.TYPE_L], /* 0x9D */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L],
/* 0x9E */ [Debugger.INS.SBB, Debugger.TYPE_M], /* 0x9E */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M],
/* 0x9F */ [Debugger.INS.SBB, Debugger.TYPE_A], /* 0x9F */ [Debugger.INS.SBB, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A],
/* 0xA0 */ [Debugger.INS.ANA, Debugger.TYPE_B], /* 0xA0 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B],
/* 0xA1 */ [Debugger.INS.ANA, Debugger.TYPE_C], /* 0xA1 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C],
/* 0xA2 */ [Debugger.INS.ANA, Debugger.TYPE_D], /* 0xA2 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D],
/* 0xA3 */ [Debugger.INS.ANA, Debugger.TYPE_E], /* 0xA3 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E],
/* 0xA4 */ [Debugger.INS.ANA, Debugger.TYPE_H], /* 0xA4 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H],
/* 0xA5 */ [Debugger.INS.ANA, Debugger.TYPE_L], /* 0xA5 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L],
/* 0xA6 */ [Debugger.INS.ANA, Debugger.TYPE_M], /* 0xA6 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M],
/* 0xA7 */ [Debugger.INS.ANA, Debugger.TYPE_A], /* 0xA7 */ [Debugger.INS.ANA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A],
/* 0xA8 */ [Debugger.INS.XRA, Debugger.TYPE_B], /* 0xA8 */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B],
/* 0xA9 */ [Debugger.INS.XRA, Debugger.TYPE_C], /* 0xA9 */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C],
/* 0xAA */ [Debugger.INS.XRA, Debugger.TYPE_D], /* 0xAA */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D],
/* 0xAB */ [Debugger.INS.XRA, Debugger.TYPE_E], /* 0xAB */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E],
/* 0xAC */ [Debugger.INS.XRA, Debugger.TYPE_H], /* 0xAC */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H],
/* 0xAD */ [Debugger.INS.XRA, Debugger.TYPE_L], /* 0xAD */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L],
/* 0xAE */ [Debugger.INS.XRA, Debugger.TYPE_M], /* 0xAE */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M],
/* 0xAF */ [Debugger.INS.XRA, Debugger.TYPE_A], /* 0xAF */ [Debugger.INS.XRA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A],
/* 0xB0 */ [Debugger.INS.ORA, Debugger.TYPE_B], /* 0xB0 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B],
/* 0xB1 */ [Debugger.INS.ORA, Debugger.TYPE_C], /* 0xB1 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C],
/* 0xB2 */ [Debugger.INS.ORA, Debugger.TYPE_D], /* 0xB2 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D],
/* 0xB3 */ [Debugger.INS.ORA, Debugger.TYPE_E], /* 0xB3 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E],
/* 0xB4 */ [Debugger.INS.ORA, Debugger.TYPE_H], /* 0xB4 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H],
/* 0xB5 */ [Debugger.INS.ORA, Debugger.TYPE_L], /* 0xB5 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L],
/* 0xB6 */ [Debugger.INS.ORA, Debugger.TYPE_M], /* 0xB6 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M],
/* 0xB7 */ [Debugger.INS.ORA, Debugger.TYPE_A], /* 0xB7 */ [Debugger.INS.ORA, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A],
/* 0xB8 */ [Debugger.INS.CMP, Debugger.TYPE_B], /* 0xB8 */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_B],
/* 0xB9 */ [Debugger.INS.CMP, Debugger.TYPE_C], /* 0xB9 */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_C],
/* 0xBA */ [Debugger.INS.CMP, Debugger.TYPE_D], /* 0xBA */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_D],
/* 0xBB */ [Debugger.INS.CMP, Debugger.TYPE_E], /* 0xBB */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_E],
/* 0xBC */ [Debugger.INS.CMP, Debugger.TYPE_H], /* 0xBC */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_H],
/* 0xBD */ [Debugger.INS.CMP, Debugger.TYPE_L], /* 0xBD */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_L],
/* 0xBE */ [Debugger.INS.CMP, Debugger.TYPE_M], /* 0xBE */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_M],
/* 0xBF */ [Debugger.INS.CMP, Debugger.TYPE_A], /* 0xBF */ [Debugger.INS.CMP, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_A],
/* 0xC0 */ [Debugger.INS.RNZ], /* 0xC0 */ [Debugger.INS.RNZ],
/* 0xC1 */ [Debugger.INS.POP, Debugger.TYPE_BC], /* 0xC1 */ [Debugger.INS.POP, Debugger.TYPE_BC],
/* 0xC2 */ [Debugger.INS.JNZ, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xC2 */ [Debugger.INS.JNZ, Debugger.TYPE_ADDR],
/* 0xC3 */ [Debugger.INS.JMP, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xC3 */ [Debugger.INS.JMP, Debugger.TYPE_ADDR],
/* 0xC4 */ [Debugger.INS.CNZ, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xC4 */ [Debugger.INS.CNZ, Debugger.TYPE_ADDR],
/* 0xC5 */ [Debugger.INS.PUSH, Debugger.TYPE_BC], /* 0xC5 */ [Debugger.INS.PUSH, Debugger.TYPE_BC],
/* 0xC6 */ [Debugger.INS.ADI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xC6 */ [Debugger.INS.ADI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE],
/* 0xC7 */ [Debugger.INS.RST], /* 0xC7 */ [Debugger.INS.RST, Debugger.TYPE_INT],
/* 0xC8 */ [Debugger.INS.RZ], /* 0xC8 */ [Debugger.INS.RZ],
/* 0xC9 */ [Debugger.INS.RET], /* 0xC9 */ [Debugger.INS.RET],
/* 0xCA */ [Debugger.INS.JZ, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xCA */ [Debugger.INS.JZ, Debugger.TYPE_ADDR],
/* 0xCB */ [Debugger.INS.JMP, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_UNDOC], /* 0xCB */ [Debugger.INS.JMP, Debugger.TYPE_ADDR | Debugger.TYPE_UNDOC],
/* 0xCC */ [Debugger.INS.CZ, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xCC */ [Debugger.INS.CZ, Debugger.TYPE_ADDR],
/* 0xCD */ [Debugger.INS.CALL, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xCD */ [Debugger.INS.CALL, Debugger.TYPE_ADDR],
/* 0xCE */ [Debugger.INS.ACI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xCE */ [Debugger.INS.ACI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE],
/* 0xCF */ [Debugger.INS.RST], /* 0xCF */ [Debugger.INS.RST, Debugger.TYPE_INT],
/* 0xD0 */ [Debugger.INS.RNC], /* 0xD0 */ [Debugger.INS.RNC],
/* 0xD1 */ [Debugger.INS.POP, Debugger.TYPE_DE], /* 0xD1 */ [Debugger.INS.POP, Debugger.TYPE_DE],
/* 0xD2 */ [Debugger.INS.JNC, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xD2 */ [Debugger.INS.JNC, Debugger.TYPE_ADDR],
/* 0xD3 */ [Debugger.INS.OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xD3 */ [Debugger.INS.OUT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE, Debugger.TYPE_A | Debugger.TYPE_OPT],
/* 0xD4 */ [Debugger.INS.CNC, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xD4 */ [Debugger.INS.CNC, Debugger.TYPE_ADDR],
/* 0xD5 */ [Debugger.INS.PUSH, Debugger.TYPE_DE], /* 0xD5 */ [Debugger.INS.PUSH, Debugger.TYPE_DE],
/* 0xD6 */ [Debugger.INS.SUI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xD6 */ [Debugger.INS.SUI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE],
/* 0xD7 */ [Debugger.INS.RST], /* 0xD7 */ [Debugger.INS.RST, Debugger.TYPE_INT],
/* 0xD8 */ [Debugger.INS.RC], /* 0xD8 */ [Debugger.INS.RC],
/* 0xD9 */ [Debugger.INS.RET, Debugger.TYPE_UNDOC], /* 0xD9 */ [Debugger.INS.RET, Debugger.TYPE_UNDOC],
/* 0xDA */ [Debugger.INS.JC, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xDA */ [Debugger.INS.JC, Debugger.TYPE_ADDR],
/* 0xDB */ [Debugger.INS.IN, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xDB */ [Debugger.INS.IN, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE],
/* 0xDC */ [Debugger.INS.CC, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xDC */ [Debugger.INS.CC, Debugger.TYPE_ADDR],
/* 0xDD */ [Debugger.INS.CALL, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_UNDOC], /* 0xDD */ [Debugger.INS.CALL, Debugger.TYPE_ADDR | Debugger.TYPE_UNDOC],
/* 0xDE */ [Debugger.INS.SBI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xDE */ [Debugger.INS.SBI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE],
/* 0xDF */ [Debugger.INS.RST], /* 0xDF */ [Debugger.INS.RST, Debugger.TYPE_INT],
/* 0xE0 */ [Debugger.INS.RPO], /* 0xE0 */ [Debugger.INS.RPO],
/* 0xE1 */ [Debugger.INS.POP, Debugger.TYPE_HL], /* 0xE1 */ [Debugger.INS.POP, Debugger.TYPE_HL],
/* 0xE2 */ [Debugger.INS.JPO, 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 /* 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], /* 0xE4 */ [Debugger.INS.CPO, Debugger.TYPE_ADDR],
/* 0xE5 */ [Debugger.INS.PUSH, Debugger.TYPE_HL], /* 0xE5 */ [Debugger.INS.PUSH, Debugger.TYPE_HL],
/* 0xE6 */ [Debugger.INS.ANI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xE6 */ [Debugger.INS.ANI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE],
/* 0xE7 */ [Debugger.INS.RST], /* 0xE7 */ [Debugger.INS.RST, Debugger.TYPE_INT],
/* 0xE8 */ [Debugger.INS.RPE], /* 0xE8 */ [Debugger.INS.RPE],
/* 0xE9 */ [Debugger.INS.PCHL, Debugger.TYPE_PC, Debugger.TYPE_HL], // let's be more explicit about the operands /* 0xE9 */ [Debugger.INS.PCHL, Debugger.TYPE_HL],
/* 0xEA */ [Debugger.INS.JPE, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 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 /* 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], /* 0xEC */ [Debugger.INS.CPE, Debugger.TYPE_ADDR],
/* 0xED */ [Debugger.INS.CALL, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_UNDOC], /* 0xED */ [Debugger.INS.CALL, Debugger.TYPE_ADDR | Debugger.TYPE_UNDOC],
/* 0xEE */ [Debugger.INS.XRI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xEE */ [Debugger.INS.XRI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE],
/* 0xEF */ [Debugger.INS.RST], /* 0xEF */ [Debugger.INS.RST, Debugger.TYPE_INT],
/* 0xF0 */ [Debugger.INS.RP], /* 0xF0 */ [Debugger.INS.RP],
/* 0xF1 */ [Debugger.INS.POP, Debugger.TYPE_PS], /* 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], /* 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], /* 0xF5 */ [Debugger.INS.PUSH, Debugger.TYPE_PS],
/* 0xF6 */ [Debugger.INS.ORI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xF6 */ [Debugger.INS.ORI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE],
/* 0xF7 */ [Debugger.INS.RST], /* 0xF7 */ [Debugger.INS.RST, Debugger.TYPE_INT],
/* 0xF8 */ [Debugger.INS.RM], /* 0xF8 */ [Debugger.INS.RM],
/* 0xF9 */ [Debugger.INS.SPHL, Debugger.TYPE_SP, Debugger.TYPE_HL], // let's be more explicit about the operands /* 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], /* 0xFA */ [Debugger.INS.JM, Debugger.TYPE_ADDR],
/* 0xFB */ [Debugger.INS.EI], /* 0xFB */ [Debugger.INS.EI],
/* 0xFC */ [Debugger.INS.CM, Debugger.TYPE_IMM | Debugger.TYPE_WORD], /* 0xFC */ [Debugger.INS.CM, Debugger.TYPE_ADDR],
/* 0xFD */ [Debugger.INS.CALL, Debugger.TYPE_IMM | Debugger.TYPE_WORD | Debugger.TYPE_UNDOC], /* 0xFD */ [Debugger.INS.CALL, Debugger.TYPE_ADDR | Debugger.TYPE_UNDOC],
/* 0xFE */ [Debugger.INS.CPI, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xFE */ [Debugger.INS.CPI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE],
/* 0xFF */ [Debugger.INS.RST] /* 0xFF */ [Debugger.INS.RST, Debugger.TYPE_INT]
]; ];
/* /*
@ -713,9 +719,6 @@ if (DEBUGGER) {
var sMessages = cmp.getMachineParm('messages'); var sMessages = cmp.getMachineParm('messages');
if (sMessages) this.messageInit(sMessages); if (sMessages) this.messageInit(sMessages);
this.cchAddr = bus.getWidth() >> 2;
this.maskAddr = bus.nBusLimit;
this.aaOpDescs = Debugger.aaOpDescs; this.aaOpDescs = Debugger.aaOpDescs;
this.messageDump(Messages.BUS, function onDumpBus(asArgs) { dbg.dumpBus(asArgs); }); this.messageDump(Messages.BUS, function onDumpBus(asArgs) { dbg.dumpBus(asArgs); });
@ -1385,15 +1388,14 @@ if (DEBUGGER) {
case Debugger.REG_H: case Debugger.REG_H:
case Debugger.REG_L: case Debugger.REG_L:
case Debugger.REG_M: case Debugger.REG_M:
case Debugger.REG_F:
cch = 2; cch = 2;
break; break;
case Debugger.REG_BC: case Debugger.REG_BC:
case Debugger.REG_DE: case Debugger.REG_DE:
case Debugger.REG_HL: case Debugger.REG_HL:
case Debugger.REG_PS:
case Debugger.REG_SP: case Debugger.REG_SP:
case Debugger.REG_PC: case Debugger.REG_PC:
case Debugger.REG_PS:
cch = 4; cch = 4;
break; break;
} }
@ -1417,9 +1419,6 @@ if (DEBUGGER) {
case Debugger.REG_A: case Debugger.REG_A:
n = cpu.regA; n = cpu.regA;
break; break;
case Debugger.REG_F:
n = cpu.getPS();
break;
case Debugger.REG_B: case Debugger.REG_B:
n = cpu.regB; n = cpu.regB;
break; break;
@ -1450,15 +1449,15 @@ if (DEBUGGER) {
case Debugger.REG_M: case Debugger.REG_M:
n = cpu.getByte(cpu.getHL()); n = cpu.getByte(cpu.getHL());
break; break;
case Debugger.REG_PS:
n = (cpu.regA << 8) | (cpu.getPS() & 0xff);
break;
case Debugger.REG_SP: case Debugger.REG_SP:
n = cpu.getSP(); n = cpu.getSP();
break; break;
case Debugger.REG_PC: case Debugger.REG_PC:
n = cpu.getPC(); n = cpu.getPC();
break; break;
case Debugger.REG_PS:
n = (cpu.regA << 8) | (cpu.getPS() & 0xff);
break;
default: default:
break; break;
} }
@ -2429,7 +2428,7 @@ if (DEBUGGER) {
var bOpcode = this.getByte(dbgAddr, 1); 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 aOpDesc = this.aaOpDescs[bOpcode];
var iIns = aOpDesc[0]; var iIns = aOpDesc[0];
@ -2445,6 +2444,10 @@ if (DEBUGGER) {
type = aOpDesc[iOperand]; type = aOpDesc[iOperand];
if (type === undefined) continue; 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; var typeSize = type & Debugger.TYPE_SIZE;
if (!typeSize) { if (!typeSize) {
@ -2458,13 +2461,15 @@ if (DEBUGGER) {
type |= (iOperand == 1? Debugger.TYPE_OUT : Debugger.TYPE_IN); type |= (iOperand == 1? Debugger.TYPE_OUT : Debugger.TYPE_IN);
} }
var typeMode = type & Debugger.TYPE_MODE;
if (typeMode & Debugger.TYPE_IMM) { if (typeMode & Debugger.TYPE_IMM) {
sOperand = this.getImmOperand(type, dbgAddr); sOperand = this.getImmOperand(type, dbgAddr);
} }
else if (typeMode & Debugger.TYPE_REG) { else if (typeMode & Debugger.TYPE_REG) {
sOperand = this.getRegOperand((type & Debugger.TYPE_IREG) >> 8, type, dbgAddr); 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) { if (!sOperand || !sOperand.length) {
sOperands = "INVALID"; sOperands = "INVALID";
@ -2524,11 +2529,12 @@ if (DEBUGGER) {
sOperand = str.toHex(this.getShort(dbgAddr, 2), 4); sOperand = str.toHex(this.getShort(dbgAddr, 2), 4);
break; break;
default: default:
sOperand = "imm(" + str.toHexWord(type) + ')'; return "imm(" + str.toHexWord(type) + ')';
break;
} }
if (type & Debugger.TYPE_MEM) { if (this.style == Debugger.STYLE_8086 && (type & Debugger.TYPE_MEM)) {
sOperand = '[' + sOperand + ']'; sOperand = '[' + sOperand + ']';
} else if (!(type & Debugger.TYPE_REG)) {
sOperand = (this.style == Debugger.STYLE_8080? '$' : "0x") + sOperand;
} }
return sOperand; return sOperand;
}; };
@ -2545,11 +2551,18 @@ if (DEBUGGER) {
Debugger.prototype.getRegOperand = function(iReg, type, dbgAddr) 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() * mnemonics; specifically, "[HL]" instead of "M". This is also more in keeping with how getImmOperand()
* displays memory references (ie, by enclosing them in brackets). * 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: * 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 * A=00 BC=0000 DE=0000 HL=0000 SP=0000 PSW=0002 I0 S0 Z0 A0 P0 C0
* FFF0 C300F0 JMP F000 * 0000 00 NOP
* *
* @this {Debugger} * @this {Debugger}
* @return {string} * @return {string}
@ -2634,14 +2647,11 @@ if (DEBUGGER) {
{ {
var s; var s;
s = this.getRegOutput(Debugger.REG_A) + s = this.getRegOutput(Debugger.REG_A) +
this.getRegOutput(Debugger.REG_F) + this.getRegOutput(Debugger.REG_BC) +
this.getRegOutput(Debugger.REG_B) + this.getRegOutput(Debugger.REG_DE) +
this.getRegOutput(Debugger.REG_C) + this.getRegOutput(Debugger.REG_HL) +
this.getRegOutput(Debugger.REG_D) +
this.getRegOutput(Debugger.REG_E) +
this.getRegOutput(Debugger.REG_H) +
this.getRegOutput(Debugger.REG_L) +
this.getRegOutput(Debugger.REG_SP) + this.getRegOutput(Debugger.REG_SP) +
this.getRegOutput(Debugger.REG_PS) +
this.getFlagOutput('I') + this.getFlagOutput('S') + this.getFlagOutput('Z') + this.getFlagOutput('I') + this.getFlagOutput('S') + this.getFlagOutput('Z') +
this.getFlagOutput('A') + this.getFlagOutput('P') + this.getFlagOutput('C'); this.getFlagOutput('A') + this.getFlagOutput('P') + this.getFlagOutput('C');
return s; return s;
@ -3669,11 +3679,12 @@ if (DEBUGGER) {
aaSortedOpcodeCounts.sort(function(p, q) { aaSortedOpcodeCounts.sort(function(p, q) {
return q[1] - p[1]; 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++) { for (i = 0; i < aaSortedOpcodeCounts.length; i++) {
var bOpcode = aaSortedOpcodeCounts[i][0]; var bOpcode = aaSortedOpcodeCounts[i][0];
var cFreq = aaSortedOpcodeCounts[i][1]; var cFreq = aaSortedOpcodeCounts[i][1];
if (cFreq) { 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++; cData++;
} }
} }
@ -3833,12 +3844,7 @@ if (DEBUGGER) {
var dbgAddr = this.parseAddr(sAddr, true); var dbgAddr = this.parseAddr(sAddr, true);
if (dbgAddr) { if (dbgAddr) {
var addr = this.getAddr(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); var aSymbol = this.findSymbol(dbgAddr, true);
if (aSymbol.length) { if (aSymbol.length) {
var nDelta, sDelta, s; var nDelta, sDelta, s;
@ -3951,22 +3957,22 @@ if (DEBUGGER) {
}; };
/** /**
* doExecOptions(asArgs) * doOptions(asArgs)
* *
* @this {Debugger} * @this {Debugger}
* @param {Array.<string>} asArgs * @param {Array.<string>} 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]) { switch (asArgs[1]) {
case "8080":
this.style = Debugger.STYLE_8080;
break;
case "8086":
this.style = Debugger.STYLE_8086;
break;
case "cs": case "cs":
var nCycles; var nCycles;
if (asArgs[3] !== undefined) nCycles = +asArgs[3]; // warning: decimal instead of hex conversion if (asArgs[3] !== undefined) nCycles = +asArgs[3]; // warning: decimal instead of hex conversion
@ -3988,7 +3994,8 @@ if (DEBUGGER) {
this.cpu.resetChecksum(); this.cpu.resetChecksum();
} }
this.println("checksums " + (this.cpu.flags.fChecksum? "enabled" : "disabled")); this.println("checksums " + (this.cpu.flags.fChecksum? "enabled" : "disabled"));
break; return;
case "sp": case "sp":
if (asArgs[2] !== undefined) { if (asArgs[2] !== undefined) {
if (!this.cpu.setSpeed(+asArgs[2])) { if (!this.cpu.setSpeed(+asArgs[2])) {
@ -3996,11 +4003,26 @@ if (DEBUGGER) {
} }
} }
this.println("target speed: " + this.cpu.getSpeedTarget() + " (" + this.cpu.getSpeed() + "x)"); 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; break;
default: default:
this.println("unknown option: " + asArgs[1]); if (asArgs[1]) {
this.println("unknown option: " + asArgs[1]);
return;
}
break; break;
} }
this.println(this.style + "-style mnemonics enabled");
}; };
/** /**
@ -4077,9 +4099,6 @@ if (DEBUGGER) {
if (w !== undefined) { if (w !== undefined) {
fValid = true; fValid = true;
var sRegMatch = sReg.toUpperCase(); var sRegMatch = sReg.toUpperCase();
if (sRegMatch.charAt(0) == 'E' && this.cchReg <= 4) {
sRegMatch = null;
}
switch (sRegMatch) { switch (sRegMatch) {
case "A": case "A":
cpu.regA = w & 0xff; cpu.regA = w & 0xff;
@ -4676,6 +4695,9 @@ if (DEBUGGER) {
} }
this.doRegisters(asArgs); this.doRegisters(asArgs);
break; break;
case 's':
this.doOptions(asArgs);
break;
case 't': case 't':
this.doTrace(asArgs[0], asArgs[1]); this.doTrace(asArgs[0], asArgs[1]);
break; 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((APPNAME || "PC8080") + " version " + (XMLVERSION || APPVERSION) + " (" + this.cpu.model + (COMPILED? ",RELEASE" : (DEBUG? ",DEBUG" : ",NODEBUG")) + (TYPEDARRAYS? ",TYPEDARRAYS" : (BYTEARRAYS? ",BYTEARRAYS" : ",LONGARRAYS")) + ')');
this.println(web.getUserAgent()); this.println(web.getUserAgent());
break; break;
case 'x':
this.doExecOptions(asArgs);
break;
case '?': case '?':
if (asArgs[1]) { if (asArgs[1]) {
this.doPrint(sCmd.substr(1)); this.doPrint(sCmd.substr(1));

View file

@ -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(){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<b&&(b=8);if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;){var d=a&15,d=d+(0<=d&&9>=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&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function ca(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b} function q(a,b){var c="";void 0===b?b=8:8<b&&(b=8);if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;){var d=a&15,d=d+(0<=d&&9>=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<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function ca(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}
function da(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ea={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};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 da(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ea={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};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<b?-1:0});d<e;){var h=d+e>>1,g;g=c(b,a[h]);0<g?d=h+1:(e=h,f=!g)}return f?d:~d}var ja=Date.now||function(){return+new Date};function ka(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} function 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<b?-1:0});d<e;){var h=d+e>>1,g;g=c(b,a[h]);0<g?d=h+1:(e=h,f=!g)}return f?d:~d}var ja=Date.now||function(){return+new Date};function ka(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function 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<d;c++)if(c in a&&a[c]===b)return c;return-1} 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<d;c++)if(c in a&&a[c]===b)return c;return-1}
function ma(a,b,c,d){var e=0,f=null,h=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),h;var g=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(g.onreadystatechange=function(){4===g.readyState&&(f=g.responseText,200==g.status||!g.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=g.status||-1),d&&d(a,f,e))});if(b&&"object"== function ma(a,b,c,d){var e=0,f=null,h=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),h;var g=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(g.onreadystatechange=function(){4===g.readyState&&(f=g.responseText,200==g.status||!g.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=g.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var k="",l;for(l in b)b.hasOwnProperty(l)&&(k&&(k+="&"),k+=l+"="+encodeURIComponent(b[l]));k=k.replace(/%20/g,"+");g.open("POST",a,!!c);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!c),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();c||(f=g.responseText,200!=g.status&&(e=g.status||-1),d&&d(a,f,e),h=[f,e]);return h}function na(){return"http://"+(window?window.location.host:"www.pcjs.org")} typeof b){var k="",l;for(l in b)b.hasOwnProperty(l)&&(k&&(k+="&"),k+=l+"="+encodeURIComponent(b[l]));k=k.replace(/%20/g,"+");g.open("POST",a,!!c);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!c),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();c||(f=g.responseText,200!=g.status&&(e=g.status||-1),d&&d(a,f,e),h=[f,e]);return h}function na(){return"http://"+(window?window.location.host:"www.pcjs.org")}
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 ra=null;function ya(){if(null==ra){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}ra=a}return ra} 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 za(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Aa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ba(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 Ca(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()} 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<a?setTimeout(d,0):c()}d()}
function Da(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Ea={init:[],show:[],exit:[]},Ga=!1,Ha=!0;function Ia(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ja(a){Ea.init.push(a)} function Ba(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Ca={init:[],show:[],exit:[]},Fa=!1,Ga=!0;function Ha(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ia(a){Ca.init.push(a)}
function Oa(a){if(Ha)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.")}}function Pa(a){!Ha&&a?(Ha=!0,Ga&&Qa("init")):Ha=a}function Qa(a){Ea[a]&&Oa(Ea[a])}Ia("onload",function(){Ga=!0;Oa(Ea.init)});Ia("onpageshow",function(){Oa(Ea.show)});Ia(Ba("Opera")||Ba("iOS")?"onunload":"onbeforeunload",function(){Oa(Ea.exit)}); function Na(a){if(Ga)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.")}}function Oa(a){!Ga&&a?(Ga=!0,Fa&&Pa("init")):Ga=a}function Pa(a){Ca[a]&&Na(Ca[a])}Ha("onload",function(){Fa=!0;Na(Ca.init)});Ha("onpageshow",function(){Na(Ca.show)});Ha(za("Opera")||za("iOS")?"onunload":"onbeforeunload",function(){Na(Ca.exit)});
function v(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.Ab=b.comment;this.Ob=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.Eb=this.id.substr(0,b),this.$a=this.id.substr(b+1)):this.$a=this.id;this[a]=c;this.u={Oa:!1,La:!1,rb:!1,ga:!1,Na:!1};this.nb=null;this.u.Na=!1;this.R={};this.C=null;this.fa=d||0;w.push(this)}var Ra=void 0,Sa={}; function u(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;this.Db=b.comment;this.Qb=b;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.Hb=this.id.substr(0,b),this.bb=this.id.substr(b+1)):this.bb=this.id;this[a]=c;this.w={Qa:!1,Na:!1,tb:!1,ha:!1,Pa:!1};this.ob=null;this.w.Pa=!1;this.S={};this.D=null;this.ga=d||0;w.push(this)}var Qa=void 0,Ra={};
if(window){Ra||(Ra=window.location.search.substr(1));for(var Ta,Ua=/\+/g,Va=/([^&=]+)=?([^&]*)/g;Ta=Va.exec(Ra);)Sa[decodeURIComponent(Ta[1].replace(Ua," "))]=decodeURIComponent(Ta[2].replace(Ua," "))}function Wa(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} if(window){Qa||(Qa=window.location.search.substr(1));for(var Sa,Ta=/\+/g,Ua=/([^&=]+)=?([^&]*)/g;Sa=Ua.exec(Qa);)Ra[decodeURIComponent(Sa[1].replace(Ta," "))]=decodeURIComponent(Sa[2].replace(Ta," "))}function Va(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function x(a,b){b||(b=v);a.prototype=Wa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var w=[],Xa={};function Ya(a,b,c){Xa[a]&&b&&(Xa[a][b]=c)}function Za(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<w.length;b++){var d=w[b];a&&d.id.indexOf(a)||c.push(d)}return c} function x(a,b){b||(b=u);a.prototype=Va(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var w=[],Wa={};function Xa(a,b,c){Wa[a]&&b&&(Wa[a][b]=c)}function Ya(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<w.length;b++){var d=w[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function $a(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<w.length;d++)if(c)c==w[d]&&(c=null);else if(!(a!=w[d].type||b&&w[d].id.indexOf(b)))return w[d]}return null}function y(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b} function Za(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<w.length;d++)if(c)c==w[d]&&(c=null);else if(!(a!=w[d].type||b&&w[d].id.indexOf(b)))return w[d]}return null}function y(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
function db(a,b){for(var c=z(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var h=e[f];if(1===h.nodeType){var g=h.getAttribute("class");if(g)for(var k=g.split(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pc8080-binding":(g=y(h))&&g.binding&&a.ma(g.type,g.binding,h,g.value),l=k.length}}}} function $a(a,b){for(var c=A(b.parentNode,"pc8080-control"),d=0;d<c.length;d++)for(var e=c[d].childNodes,f=0;f<e.length;f++){var h=e[f];if(1===h.nodeType){var g=h.getAttribute("class");if(g)for(var k=g.split(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pc8080-binding":(g=y(h))&&g.binding&&a.na(g.type,g.binding,h,g.value),l=k.length}}}}
function z(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c} function A(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
v.prototype={constructor:v,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ma:function(a,b,c){switch(b){case "clear":return this.R[b]||(this.R[b]=c,c.onclick=function(a){return function(){a.R.print&&(a.R.print.value="")}}(this)),!0;case "print":return this.R[b]||(this.Da=this.R[b]=c,c.value="",this.g=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c), u.prototype={constructor:u,parent:null,toString:function(){return this.name?this.name:this.id||this.type},na:function(a,b,c){switch(b){case "clear":return this.S[b]||(this.S[b]=c,c.onclick=function(a){return function(){a.S.print&&(a.S.print.value="")}}(this)),!0;case "print":return this.S[b]||(this.Fa=this.S[b]=c,c.value="",this.g=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.ka=function(a,b,c){this.g(a,"notice",c)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.$a+": "+a)},ka:function(a,b){b||t(a)},ua:function(){return this.u.ga=!0},ta:function(a,b){b&&(this.u.ga=!1);return!0}};function gb(a,b,c,d,e,f){var h=!0;a.C&&(!0===h?h=0:null==h&&(h=a.fa),hb(a.C,a,b,c,d,e,f,h))}function ib(a,b){if(a.C){a===a.C?b|=0:b=b||a.fa;var c=a.C.fa&b;return!!b&&c===b||!!(c&a.C.Ub)}return!1} this.la=function(a,b,c){this.g(a,"notice",c)}),!0;default:return!1}},log:function(){},g:function(){},status:function(a){this.g(this.bb+": "+a)},la:function(a,b){b||t(a)},wa:function(){return this.w.ha=!0},va:function(a,b){b&&(this.w.ha=!1);return!0}};function db(a,b,c,d,e,f){var h=!0;a.D&&(!0===h?h=0:null==h&&(h=a.ga),gb(a.D,a,b,c,d,e,f,h))}function hb(a,b){if(a.D){a===a.D?b|=0:b=b||a.ga;var c=a.D.ga&b;return!!b&&c===b||!!(c&a.D.Wb)}return!1}
function jb(a,b){if(a.u.rb)return a.u.La&&(a.u.La=!1),a.u.rb=!1;if(a.u.Na)return a.g(a.toString()+" error"),!1;a.u.La=b;return a.u.La}function kb(a,b){a.u.La&&(b?a.u.rb=!0:void 0===b&&a.g(a.toString()+" busy"));return a.u.La}function B(a){if(!a.u.Na&&(a.u.Oa=!0,a.u.Oa)){var b=a.nb;a.nb=null;b&&b()}}function lb(a,b){b&&(a.u.Oa?b():a.nb=b);return a.u.Oa}function mb(a,b){a.u.Na=!0;a.ka(b)} function ib(a,b){if(a.w.tb)return a.w.Na&&(a.w.Na=!1),a.w.tb=!1;if(a.w.Pa)return a.g(a.toString()+" error"),!1;a.w.Na=b;return a.w.Na}function jb(a,b){a.w.Na&&(b?a.w.tb=!0:void 0===b&&a.g(a.toString()+" busy"));return a.w.Na}function E(a){if(!a.w.Pa&&(a.w.Qa=!0,a.w.Qa)){var b=a.ob;a.ob=null;b&&b()}}function kb(a,b){b&&(a.w.Qa?b():a.ob=b);return a.w.Qa}function lb(a,b){a.w.Pa=!0;a.la(b)}
var nb="undefined"!==typeof ArrayBuffer,ob=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1, var mb="undefined"!==typeof ArrayBuffer,nb=[1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,
0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1];function pb(a){v.call(this,"Panel",a,pb)}x(pb);m=pb.prototype;m.ma=function(a,b,c,d){return this.s&&this.s.ma(a,b,c,d)||this.b&&this.b.ma(a,b,c,d)||this.w&&this.w.ma(a,b,c,d)||this.C&&this.C.ma(a,b,c,d)?!0:this.parent.ma.call(this,a,b,c,d)};m.za=function(a,b,c,d){this.s=a;this.B=b;this.b=c;this.C=d;this.w=qb(a,"Keyboard")};m.ua=function(a,b){b||rb();return!0};m.ta=function(){return!0};m.oa=function(){}; 0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1];function ob(a){u.call(this,"Panel",a,ob)}x(ob);m=ob.prototype;m.na=function(a,b,c,d){return this.u&&this.u.na(a,b,c,d)||this.b&&this.b.na(a,b,c,d)||this.A&&this.A.na(a,b,c,d)||this.D&&this.D.na(a,b,c,d)?!0:this.parent.na.call(this,a,b,c,d)};m.Aa=function(a,b,c,d){this.u=a;this.C=b;this.b=c;this.D=d;this.A=pb(a,"Keyboard")};m.wa=function(a,b){b||qb();return!0};m.va=function(){return!0};m.qa=function(){};
function rb(){for(var a=!1,b=z(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=y(d),f;a:{f=e.id;if(void 0!==f)for(var h=void 0,h=0;h<w.length;h++)if(w[h].id===f){f=w[h];break a}f=null}f||(a=!0,f=new pb(e));db(f,d);a&&B(f)}}Ja(rb); function qb(){for(var a=!1,b=A(document,"pc8080","panel"),c=0;c<b.length;c++){var d=b[c],e=y(d),f;a:{f=e.id;if(void 0!==f)for(var h=void 0,h=0;h<w.length;h++)if(w[h].id===f){f=w[h];break a}f=null}f||(a=!0,f=new ob(e));$a(f,d);a&&E(f)}}Ia(qb);
function sb(a,b,c){v.call(this,"Bus",a,sb);this.b=b;this.C=c;this.T=a.buswidth||16;this.Y=Math.pow(2,this.T);this.G=this.Y-1|0;this.X=20>=this.T?12:24>=this.T?14:15;this.ia=1<<this.X;this.Z=this.ia>>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<this.S;b++)this.B[b]=a;a=this.b;b=this.B;c=this.X;var d=this.G;a.ja=b;a.X=c;a.ia=1<<a.X;a.G=a.ia-1;a.Y=b.length;a.W=a.Y-1;a.S=d;B(this)} function rb(a,b,c){u.call(this,"Bus",a,rb);this.b=b;this.D=c;this.U=a.buswidth||16;this.Z=Math.pow(2,this.U);this.H=this.Z-1|0;this.Y=20>=this.U?12:24>=this.U?14:15;this.ja=1<<this.Y;this.aa=this.ja>>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<this.T;b++)this.C[b]=a;a=this.b;b=this.C;c=this.Y;var d=this.H;a.ka=b;a.Y=c;a.ja=1<<a.Y;a.H=a.ja-1;a.Z=b.length;a.X=a.Z-1;a.T=d;E(this)}
x(sb);sb.prototype.reset=function(){};sb.prototype.ua=function(a,b){b||this.reset();return!0};function ub(a,b,c,d){for(var e=b>>>a.X;0<c&&e<a.B.length;){var f=a.B[e],h=e*a.ia,g=c>a.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)} x(rb);rb.prototype.reset=function(){};rb.prototype.wa=function(a,b){b||this.reset();return!0};function tb(a,b,c,d){for(var e=b>>>a.Y;0<c&&e<a.C.length;){var f=a.C[e],h=e*a.ja,g=c>a.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)}
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]} 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 Gb(a,b){for(var c=1,d=0,e=0;0<c;){var f=a.w[b],h=a.ba[b]||1,g=1==h?255:2==h?65535:-1,k=g;void 0!==f?(f[0]&&(k=f[0](b,void 0),void 0===k?k=g:k&=g),a.C&&a.H!=f[1]&&Hb(a.C,b,k)):a.C&&(hb(a.C,a,b,null,void 0),a.H&&Hb(a.C,b,k));d|=k<<e;e+=h<<3;b+=h;c-=h}return d}function Ib(a,b){if(void 0===b)return a.I=!a.I,a.I;void 0===a.D[b]&&(a.D[b]=[null,!1]);a.D[b][1]=!a.D[b][1];return a.D[b][1]} function xb(a,b){for(var c=1,d=0,e=0;0<c;){var f=a.A[b],h=a.ca[b]||1,g=1==h?255:2==h?65535:-1,k=g;void 0!==f?(f[0]&&(k=f[0](b,void 0),void 0===k?k=g:k&=g),a.D&&a.I!=f[1]&&Fb(a.D,b,k)):a.D&&(gb(a.D,a,b,null,void 0),a.I&&Fb(a.D,b,k));d|=k<<e;e+=h<<3;b+=h;c-=h}return d}function Gb(a,b){if(void 0===b)return a.J=!a.J,a.J;void 0===a.F[b]&&(a.F[b]=[null,!1]);a.F[b][1]=!a.F[b][1];return a.F[b][1]}
function Jb(a,b,c){for(var d=1,e=0;0<d;){var f=a.D[b],h=a.ea[b]||1,g=1==h?255:2==h?65535:-1,g=(c>>>=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 Hb(a,b,c){for(var d=1,e=0;0<d;){var f=a.F[b],h=a.fa[b]||1,g=1==h?255:2==h?65535:-1,g=(c>>>=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 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<this.b.length;a++)this.b[a]=0;Rb(this,Ub)}else Rb(this)}var Pb=0,Qb=2,Vb=["NONE","RAM","ROM","VIDEO","H/W"],Ob=0; 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<this.b.length;a++)this.b[a]=0;Pb(this,Sb)}else Pb(this)}var Nb=0,Ob=2,Tb=["NONE","RAM","ROM","VIDEO","H/W"],Mb=0;
C.prototype={constructor:C,parent:null,save:function(){var a,b;if(nb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.H.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(nb)for(b=0;b<a.length;b++)this.H.setInt32(b<<2,a[b],!0);else this.b=a;return this.ya=!0}return!1},Ca:function(a,b){b?0===this.w++&&Wb(this,Xb,!1):0===this.R++&&Yb(this,Xb,!1)},T:function(){this.C&&ib(this.C,129)&&this.C.message("attempt to read invalid block %"+p(this.A),!0); F.prototype={constructor:F,parent:null,save:function(){var a,b;if(mb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.I.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(a&&this.size==a.length<<2){var b;if(mb)for(b=0;b<a.length;b++)this.I.setInt32(b<<2,a[b],!0);else this.b=a;return this.za=!0}return!1},Ea:function(a,b){b?0===this.A++&&Ub(this,Vb,!1):0===this.S++&&Wb(this,Vb,!1)},U:function(){this.D&&hb(this.D,129)&&this.D.message("attempt to read invalid block %"+q(this.B),!0);
return 255},D:function(a,b){this.C&&ib(this.C,129)&&this.C.message("attempt to write "+r(b)+" to invalid block %"+p(this.A),!0)},W:function(a,b){return this.Ia(a++,b++)|this.Ia(a,b)<<8},I:function(a,b,c){this.Xa(a++,b&255,c++);this.Xa(a,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<<d)|b<<d;this.ya=!0},ab:function(a, return 255},F:function(a,b){this.D&&hb(this.D,129)&&this.D.message("attempt to write "+r(b)+" to invalid block %"+q(this.B),!0)},X:function(a,b){return this.Ka(a++,b++)|this.Ka(a,b)<<8},J:function(a,b,c){this.Za(a++,b&255,c++);this.Za(a,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<<d)|b<<d;this.za=!0},bb:function(a,
b){var c=a>>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<<d)|b<<d:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>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){var c=a>>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<<d)|b<<d:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>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.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}}; 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 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)} 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 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]; 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 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; 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.za=function(a,b,c,d){this.s=a;this.B=b;this.C=d;for(b=0;b<lc.length;b++)(c=this.R[lc[b]])&&this.s.ma(null,lc[b],c);this.xa=(b=qb(a,"Video"))&&Math.max(b.xa,b.Xb)||60;this.T=qb(a,"ChipSet");a=mc(a,"autoStart");null!=a&&(this.u.Ib="true"==a?!0:"false"==a?!1:!!a);B(this)};m.reset=function(){this.i.pb=0};m.save=function(){return null};m.restore=function(){return!1}; m.Aa=function(a,b,c,d){this.u=a;this.C=b;this.D=d;for(b=0;b<ac.length;b++)(c=this.S[ac[b]])&&this.u.na(null,ac[b],c);this.ya=(b=pb(a,"Video"))&&Math.max(b.ya,b.Zb)||60;this.U=pb(a,"ChipSet");a=bc(a,"autoStart");null!=a&&(this.w.Ib="true"==a?!0:"false"==a?!1:!!a);E(this)};m.reset=function(){this.i.qb=0};m.save=function(){return null};m.restore=function(){return!1};
m.ua=function(a,b){if(!b){if(a&&this.restore){nc(this);if(!this.restore(a))return!1;oc(this)}else this.reset();if(this.C){var c=this.C;c.g("Type ? for help with PC8080 Debugger commands");c.oa();if(c.ab){var d=c.ab;c.ab=null;pc(c,d)}}else this.g("No debugger detected")}D(this);return!0};m.ta=function(a){return a?this.save():!0};function qc(a){(a.u.Ib||!a.C&&void 0===a.R.run)&&a.Ja(!0)}m.Kb=function(){return 0}; m.wa=function(a,b){if(!b){if(a&&this.restore){lc(this);if(!this.restore(a))return!1;mc(this)}else this.reset();if(this.D){var c=this.D;c.g("Type ? for help with PC8080 Debugger commands");c.qa();if(c.rb){var d=c.rb;c.rb=null;nc(c,d)}}else this.g("No debugger detected")}G(this);return!0};m.va=function(a){return a?this.save():!0};function oc(a){(a.w.Ib||!a.D&&void 0===a.S.run)&&a.La(!0)}m.Mb=function(){return 0};
function oc(a){void 0===a.i.cb&&(a.i.cb=0);void 0===a.i.Ra&&(a.i.Ra=-1);void 0===a.i.Ta&&(a.i.Ta=-1);a.u.Ma=0<=a.i.cb&&0<a.i.Ra;a.u.Ma&&(a.i.bb=0,a.i.Sa=a.i.cb-a.I)}function rc(a,b){if(a.u.Ma){var c=!1;a.i.bb=a.i.bb+a.Kb()|0;a.i.Sa-=b;0>=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))}} function mc(a){void 0===a.i.eb&&(a.i.eb=0);void 0===a.i.Ta&&(a.i.Ta=-1);void 0===a.i.Va&&(a.i.Va=-1);a.w.Oa=0<=a.i.eb&&0<a.i.Ta;a.w.Oa&&(a.i.cb=0,a.i.Ua=a.i.eb-a.J)}function pc(a,b){if(a.w.Oa){var c=!1;a.i.cb=a.i.cb+a.Mb()|0;a.i.Ua-=b;0>=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.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;c<g.length&&(b=g[c],b===a||b.u.Oa);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.u.ga);c++);c==g.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.u.Oa?"powered yet":"ready yet"+(b.nb?" (waiting for notification)":""))+".");a=!1}a&&(d.u.ha?d.da(!0):d.Ja(!0))};a= 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;c<g.length&&(b=g[c],b===a||b.w.Qa);c++);if(c==g.length)for(c=0;c<g.length&&(b=g[c],b===a||b.w.ha);c++);c==g.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.w.Qa?"powered yet":"ready yet"+(b.ob?" (waiting for notification)":""))+".");a=!1}a&&(d.w.ia?d.ea(!0):d.La(!0))};a=
!0;break;case "speed":this.R[b]=c;a=!0;break;case "setSpeed":this.R[b]=c,c.onclick=function(){tc(d,d.i.Ha<<1,!0)},c.textContent=this.i.Fa.toFixed(2)+"Mhz",a=!0}return a};function uc(a,b,c){a.I+=b;c&&(a.D=a.b=0)} !0;break;case "speed":this.S[b]=c;a=!0;break;case "setSpeed":this.S[b]=c,c.onclick=function(){rc(d,d.i.Ja<<1,!0)},c.textContent=this.i.Ha.toFixed(2)+"Mhz",a=!0}return a};function sc(a,b,c){a.J+=b;c&&(a.F=a.b=0)}
function vc(a,b){var c=30;c<a.xa&&(c=a.xa);2>c&&(c=2);var d=1;b&&1<a.i.Ha&&a.i.Ea&&(d=a.i.Ea/a.i.tb);a.i.Lb=Math.round(1E3/30);a.i.fc=Math.floor(a.i.Va/c*d);a.i.ub=Math.floor(a.i.Va/30*d);a.i.Nb=Math.floor(a.i.Va/a.xa*d);a.i.Mb=Math.floor(a.i.Va/2*d);b||(a.i.Ua=a.i.ub,a.i.fb=a.i.Nb,a.i.eb=a.i.Mb);a.i.vb=0}function sc(a){return a.I+a.H+a.D-a.b}function nc(a){a.i.Ea=0;a.I=a.H=a.D=a.b=0;oc(a);tc(a,1)} function tc(a,b){var c=30;c<a.ya&&(c=a.ya);2>c&&(c=2);var d=1;b&&1<a.i.Ja&&a.i.Ga&&(d=a.i.Ga/a.i.vb);a.i.Nb=Math.round(1E3/30);a.i.hc=Math.floor(a.i.Xa/c*d);a.i.wb=Math.floor(a.i.Xa/30*d);a.i.Pb=Math.floor(a.i.Xa/a.ya*d);a.i.Ob=Math.floor(a.i.Xa/2*d);b||(a.i.Wa=a.i.wb,a.i.gb=a.i.Pb,a.i.fb=a.i.Ob);a.i.xb=0}function qc(a){return a.J+a.I+a.F-a.b}function lc(a){a.i.Ga=0;a.J=a.I=a.F=a.b=0;mc(a);rc(a,1)}
function tc(a,b,c){var d=!1;if(void 0!==b){.8>a.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} function rc(a,b,c){var d=!1;if(void 0!==b){.8>a.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.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; 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.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+=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.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<this.i.Fa)a=0;this.i.vb+=this.i.gb;this.i.Ga+=a;c(d,a)}else D(this),this.s&&this.s.stop(ja(),sc(this))};m.Wa=function(){return 0};m.da=function(a){kb(this,!0);this.D-=this.b;this.b=0;uc(this,this.H);this.H=0;if(this.u.ha){this.u.ha=!1;this.T&&this.T.kc();var b=this.R.run;b&&(b.textContent="Run")}this.u.mb=a}; 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<this.i.Ha)a=0;this.i.xb+=this.i.hb;this.i.Ia+=a;c(d,a)}else G(this),this.u&&this.u.stop(ja(),qc(this))};m.Ya=function(){return 0};m.ea=function(a){jb(this,!0);this.F-=this.b;this.b=0;sc(this,this.I);this.I=0;if(this.w.ia){this.w.ia=!1;this.U&&this.U.mc();var b=this.S.run;b&&(b.textContent="Run")}this.w.nb=a};
function D(a,b){a.s&&(wc(a.s,-1),a.s.oa(b))}function xc(a){this.Pa=a.model||8080;bc.call(this,a,1E6);this.Z=yc;nc(this);this.u.mb=this.u.Vb=!1;this.ba=0;this.ja=[];this.X=this.ia=this.G=this.Y=this.W=this.S=0;zc(this)}x(xc,bc);m=xc.prototype;m.reset=function(){this.u.ha&&this.da();zc(this);nc(this);this.u.Na=!1;this.parent.reset.call(this)};function zc(a){a.j=0;a.K=0;a.N=0;a.L=0;a.O=0;a.M=0;a.P=0;a.aa=0;E(a,0);Ac(a,0);a.w=0} function G(a,b){a.u&&(uc(a.u,-1),a.u.qa(b))}function vc(a){this.Ra=a.model||8080;$b.call(this,a,1E6);this.aa=wc;lc(this);this.w.nb=this.w.Xb=!1;this.ca=0;this.ka=[];this.Y=this.ja=this.H=this.Z=this.X=this.T=0;xc(this)}x(vc,$b);m=vc.prototype;m.reset=function(){this.w.ia&&this.ea();xc(this);lc(this);this.w.Pa=!1;this.parent.reset.call(this)};function xc(a){a.j=0;a.L=0;a.O=0;a.M=0;a.P=0;a.N=0;a.R=0;a.ba=0;H(a,0);yc(a,0);a.A=0}
m.Kb=function(){var a=this.j+this.K+this.N+this.L+this.O+this.M+this.P|0;return a=a+this.aa+this.J+Bc(this)|0}; m.Mb=function(){var a=this.j+this.L+this.O+this.M+this.P+this.N+this.R|0;return a=a+this.ba+this.K+zc(this)|0};
m.save=function(){var a=new G(this);H(a,0,[this.j,this.K,this.N,this.L,this.O,this.M,this.P,this.aa,this.J,Bc(this)]);H(a,1,[this.w,this.I,this.i.Ha]);for(var b=this.B,c=0,d=[],e=0;e<b.S;e++){var f=b.B[e];if(f.ya||f.Wb){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,l=[];g<f.length;){for(var n=f[g],q=g+1;q<f.length&&f[q]===n;)q++;l[k++]=q-g;l[k++]=n;g=q}if(l.length<f.length){f=l;break a}}d[h]=f}}H(a,2,d);return a.data()}; m.save=function(){var a=new J(this);K(a,0,[this.j,this.L,this.O,this.M,this.P,this.N,this.R,this.ba,this.K,zc(this)]);K(a,1,[this.A,this.J,this.i.Ja]);for(var b=this.C,c=0,d=[],e=0;e<b.T;e++){var f=b.C[e];if(f.za||f.Yb){d[c++]=e;var h=c++;a:if(f=f.save()){for(var g=0,k=0,l=[];g<f.length;){for(var n=f[g],p=g+1;p<f.length&&f[p]===n;)p++;l[k++]=p-g;l[k++]=n;g=p}if(l.length<f.length){f=l;break a}}d[h]=f}}K(a,2,d);return a.data()};
m.restore=function(a){var b=a[0];this.j=b[0];this.K=b[1];this.N=b[2];this.L=b[3];this.O=b[4];this.M=b[5];this.P=b[6];this.aa=b[7]&65535;E(this,b[8]);Ac(this,b[9]);b=a[1];this.w=b[0];this.I=b[1];tc(this,b[3]);a:{b=this.B;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.Z){for(var f=0,h=Array(b.Z),g=0;g<e.length-1;)for(var k=e[g++],l=e[g++];k--;)h[f++]=l;e=h}f=b.B[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b}; m.restore=function(a){var b=a[0];this.j=b[0];this.L=b[1];this.O=b[2];this.M=b[3];this.P=b[4];this.N=b[5];this.R=b[6];this.ba=b[7]&65535;H(this,b[8]);yc(this,b[9]);b=a[1];this.A=b[0];this.J=b[1];rc(this,b[3]);a:{b=this.C;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.aa){for(var f=0,h=Array(b.aa),g=0;g<e.length-1;)for(var k=e[g++],l=e[g++];k--;)h[f++]=l;e=h}f=b.C[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
m.ma=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "D":case "E":case "H":case "L":case "SP":case "PC":case "F":case "SF":case "ZF":case "AF":case "PF":case "CF":this.R[b]=c;this.ba++;d=!0;break;default:d=this.parent.ma.call(this,a,b,c)}return d};function Cc(a){return a.K<<8|a.N}function Dc(a,b){a.K=b>>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} m.na=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "D":case "E":case "H":case "L":case "SP":case "PC":case "F":case "SF":case "ZF":case "AF":case "PF":case "CF":this.S[b]=c;this.ca++;d=!0;break;default:d=this.parent.na.call(this,a,b,c)}return d};function Ac(a){return a.L<<8|a.O}function Bc(a,b){a.L=b>>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 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 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 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} 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.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.G)return a.ja[d].Pb(c,b);c=a.ja[d].Ia(c,b);return c|=a.ja[d+1&a.W].Ia(0,b+1)<<8}function L(a,b,c){a.ja[(b&a.S)>>>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<a.G?a.ja[e].Rb(d,c&65535,b):(a.ja[e++].Xa(d,c&255,b),a.ja[e&a.W].Xa(0,c>>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} 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.H)return a.ka[d].Rb(c,b);c=a.ka[d].Ka(c,b);return c|=a.ka[d+1&a.X].Ka(0,b+1)<<8}function N(a,b,c){a.ka[(b&a.T)>>>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<a.H?a.ka[e].Tb(d,c&65535,b):(a.ka[e++].Za(d,c&255,b),a.ka[e&a.X].Za(0,c>>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 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))} 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.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.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.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<this.b);return this.u.mb?this.D-this.b:void 0===this.u.mb?0:-1}; 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<this.b);return this.w.nb?this.F-this.b:void 0===this.w.nb?0:-1};
Ja(function(){for(var a=z(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new xc(d);db(d,c)}});function qd(){this.b-=4}function rd(){E(this,O(this));this.b-=10}function sd(){E(this,P(this));this.b-=10}function td(){var a=O(this);Q(this,this.J);E(this,a);this.b-=17} Ia(function(){for(var a=A(document,"pc8080","cpu"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new vc(d);$a(d,c)}});function pd(){this.b-=4}function qd(){H(this,P(this));this.b-=10}function rd(){H(this,R(this));this.b-=10}function sd(){var a=P(this);S(this,this.K);H(this,a);this.b-=17}
var yc=[qd,function(){Dc(this,O(this));this.b-=10},function(){L(this,Cc(this),this.j);this.b-=7},function(){Dc(this,Cc(this)+1);this.b-=5},function(){this.K=hd(this,this.K);this.b-=5},function(){this.K=gd(this,this.K);this.b-=5},function(){this.K=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255|a>>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)- var wc=[pd,function(){Bc(this,P(this));this.b-=10},function(){N(this,Ac(this),this.j);this.b-=7},function(){Bc(this,Ac(this)+1);this.b-=5},function(){this.L=gd(this,this.L);this.b-=5},function(){this.L=fd(this,this.L);this.b-=5},function(){this.L=O(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255|a>>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.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.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.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, 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,
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-= 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;
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.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,
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= 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-=
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= 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-=
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}, 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=
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-= 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=
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.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-
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); 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=
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); 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=
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, 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=
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, 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=
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, 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=
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); 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.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, 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,
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)); 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=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, 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=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}, 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(){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, 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.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, 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,
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}]; 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 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}; 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.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.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.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.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.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<<this.w>>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.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<<this.A>>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.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<a.length;b++){var c=a[b],d=y(c),d=new U(d);db(d,c)}}); 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<a.length;b++){var c=a[b],d=y(c),d=new V(d);$a(d,c)}});
function xd(a){v.call(this,"ROM",a,xd);this.s=null;this.H=a.addr;this.w=a.size;this.D=a.alias;this.G=a.file;this.I=ba(this.G);if(this.G){a=this.G;var b=ca(this.I);"json"!=b&&"hex"!=b&&(a=na()+"/api/v1/dump?file="+this.G+"&format=bytes&decimal=true");var c=this;ma(a,null,!0,function(a,b,f){yd(c,a,b,f)})}}x(xd);xd.prototype.za=function(a,b,c,d){this.B=b;this.b=c;this.C=d;zd(this)}; function wd(a){u.call(this,"ROM",a,wd);this.u=null;this.I=a.addr;this.A=a.size;this.F=a.alias;this.H=a.file;this.J=ba(this.H);if(this.H){a=this.H;var b=ca(this.J);"json"!=b&&"hex"!=b&&(a=na()+"/api/v1/dump?file="+this.H+"&format=bytes&decimal=true");var c=this;ma(a,null,!0,function(a,b,f){xd(c,a,b,f)})}}x(wd);wd.prototype.Aa=function(a,b,c,d){this.C=b;this.b=c;this.D=d;yd(this)};
xd.prototype.ua=function(){if(this.wa){if(this.C){var a=this.C,b=this.id,c=this.H,d=this.w,e=this.wa,f=[],h;for(h in e){var g=e[h];"number"==typeof g&&(e[h]=g={o:g});var k=g.o,l=g.a;if(void 0!==k){var n=f,k=[k>>>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}; wd.prototype.wa=function(){if(this.xa){if(this.D){var a=this.D,b=this.id,c=this.I,d=this.A,e=this.xa,f=[],h;for(h in e){var g=e[h];"number"==typeof g&&(e[h]=g={o:g});var k=g.o,l=g.a;if(void 0!==k){var n=f,k=[k>>>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 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<h.length;c++)a.s[d++]=h[c]&255,a.s[d++]=h[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, 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<h.length;c++)a.u[d++]=h[c]&255,a.u[d++]=h[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.s=Array(b.length),e=0;e<b.length;e++)a.s[e]=aa(b[e],16);zd(a)}} " ").replace(/ +$/,"").split(" "),a.u=Array(b.length),e=0;e<b.length;e++)a.u[e]=aa(b[e],16);yd(a)}}
function zd(a){if(!lb(a))if(!a.G)B(a);else if(a.s&&a.B){if(a.s.length!=a.w)mb(a,"ROM size (0x"+p(a.s.length)+") does not match specified size ("+("0x"+p(a.w))+")");else{var b;b=a.H;if(ub(a.B,b,a.w,Qb)){for(var c=0;c<a.s.length;c++){var d=a.B,e=b+c;d.B[(e&d.G)>>>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<b.length;c++){for(var f=a,d=b[c],e=f.B,h=f.w,g=[],k=f.H>>>e.X;0<h&&k<e.B.length;)g.push(e.B[k++]),h-=e.ia;e=f.B; function yd(a){if(!kb(a))if(!a.H)E(a);else if(a.u&&a.C){if(a.u.length!=a.A)lb(a,"ROM size (0x"+q(a.u.length)+") does not match specified size ("+("0x"+q(a.A))+")");else{var b;b=a.I;if(tb(a.C,b,a.A,Ob)){for(var c=0;c<a.u.length;c++){var d=a.C,e=b+c;d.C[(e&d.H)>>>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<b.length;c++){for(var f=a,d=b[c],e=f.C,h=f.A,g=[],k=f.I>>>e.Y;0<h&&k<e.C.length;)g.push(e.C[k++]),h-=e.ja;e=f.C;
f=f.w;h=0;for(d>>>=e.X;0<f&&d<e.B.length;){k=g[h++];if(!k)break;e.B[d++]=k;f-=e.ia}}delete a.s}}B(a)}}Ja(function(){for(var a=z(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new xd(d);db(d,c)}});function Ad(a){v.call(this,"RAM",a,Ad);this.D=a.addr;this.w=a.size;this.s=!1}x(Ad);m=Ad.prototype;m.za=function(a,b,c,d){this.B=b;this.b=c;this.C=d;B(this)};m.ua=function(a,b){b||this.reset();return!0};m.ta=function(a){return a?this.save():!0}; f=f.A;h=0;for(d>>>=e.Y;0<f&&d<e.C.length;){k=g[h++];if(!k)break;e.C[d++]=k;f-=e.ja}}delete a.u}}E(a)}}Ia(function(){for(var a=A(document,"pc8080","rom"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new wd(d);$a(d,c)}});function zd(a){u.call(this,"RAM",a,zd);this.F=a.addr;this.A=a.size;this.u=!1}x(zd);m=zd.prototype;m.Aa=function(a,b,c,d){this.C=b;this.b=c;this.D=d;E(this)};m.wa=function(a,b){b||this.reset();return!0};m.va=function(a){return a?this.save():!0};
m.reset=function(){!this.s&&this.w&&ub(this.B,this.D,this.w,1)&&(this.s=!0,this.status(Math.floor(this.w/1024)+"Kb allocated"));this.s||t("No RAM allocated")};m.save=function(){return null};m.restore=function(){return!0};Ja(function(){for(var a=z(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Ad(d);db(d,c)}});function Bd(a){v.call(this,"Keyboard",a,Bd,65536);B(this)}x(Bd); m.reset=function(){!this.u&&this.A&&tb(this.C,this.F,this.A,1)&&(this.u=!0,this.status(Math.floor(this.A/1024)+"Kb allocated"));this.u||t("No RAM allocated")};m.save=function(){return null};m.restore=function(){return!0};Ia(function(){for(var a=A(document,"pc8080","ram"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new zd(d);$a(d,c)}});function Ad(a){u.call(this,"Keyboard",a,Ad,65536);E(this)}x(Ad);
Ja(function(){for(var a=z(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Bd(d);db(d,c)}});function Cd(a){v.call(this,"Video",a,Cd,262144);this.Xb=a.interruptRate;this.xa=a.refreshRate||60;B(this)}x(Cd);Cd.prototype.za=function(a,b,c,d){this.s=a;this.B=b;this.b=c;this.C=d}; Ia(function(){for(var a=A(document,"pc8080","keyboard"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Ad(d);$a(d,c)}});function Bd(a){u.call(this,"Video",a,Bd,262144);this.Zb=a.interruptRate;this.ya=a.refreshRate||60;E(this)}x(Bd);Bd.prototype.Aa=function(a,b,c,d){this.u=a;this.C=b;this.b=c;this.D=d};
Ja(function(){for(var a=z(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=y(c),e=document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; 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= Ia(function(){for(var a=A(document,"pc8080","video"),b=0;b<a.length;b++){var c=a[b],d=y(c),e=document.createElement("canvas");if(void 0===e||!e.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; 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)}}); (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 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); 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","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(" "), 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="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], 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],
[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], [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,
[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, 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,
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, 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],[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, 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,
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; 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],
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<<d.b.X)+" %%"+p(n.A)+" "+r(n.kb)+" "+r(n.size)+ [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,
" "+l),c!=Pb&&(c=-1),l=0);a+=d.b.ia;g++}}});B(this)}; 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.ma=function(a,b,c){var d=this;switch(b){case "debugInput":return this.va=this.R[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",pc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.G<d.D.length-1&&(b=d.D[++d.G]):40==a.keyCode&&(0<d.G?b=d.D[--d.G]:(b="",d.G=-1)),null!=b){var h=b.length;c.value=b;c.setSelectionRange(h,h)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.R[b]=c,Da(c,function(){if(d.va){var a=d.va.value;d.va.value= 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<<d.b.Y)+" %%"+q(n.B)+" "+r(n.lb)+" "+r(n.size)+
"";pc(d,a,!0);return!0}return!1}),!0;case "step":return this.R[b]=c,Da(c,function(a){var b=!1;kb(d,!0)||(jb(d,!0),b=d.Wa(a?1:0),jb(d,!1));return b}),!0}return!1};m.jb=function(){this.va&&this.va.focus()};function X(a){a=a&&a.A;null==a&&(a=-1);return a}m.U=function(a,b){var c=255,d=X(a);-1!==d&&(c=wb(this.B,d),b&&Nd(a,b));return c};m.lb=function(a,b){var c=65535,d=X(a);if(-1!==d){var c=this.B,e=d&c.s,f=(d&c.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}; " "+l),c!=Nb&&(c=-1),l=0);a+=d.b.ja;g++}}});E(this)};
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]}} m.na=function(a,b,c){var d=this;switch(b){case "debugInput":return this.Ba=this.S[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",nc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.H<d.F.length-1&&(b=d.F[++d.H]):40==a.keyCode&&(0<d.H?b=d.F[--d.H]:(b="",d.H=-1)),null!=b){var h=b.length;c.value=b;c.setSelectionRange(h,h)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.S[b]=c,Ba(c,function(){if(d.Ba){var a=d.Ba.value;d.Ba.value=
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;c<a.I.length;c++){var f=a.I[c].wa[d];if(void 0!==f){d=f.o;void 0!==d&&(e=V(d));break}}if(d=e)return d;c=Rd(a,b,void 0)}null!=c&&(d=V(c));return d}function Sd(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Tb=Td(a,b.Qb=c[2]))}function Nd(a,b){null!=a.A&&(a.A+=b||1)}function Z(a){return p(a,4)} "";nc(d,a,!0);return!0}return!1}),!0;case "step":return this.S[b]=c,Ba(c,function(a){var b=!1;jb(d,!0)||(ib(d,!0),b=d.Ya(a?1:0),ib(d,!1));return b}),!0}return!1};m.kb=function(){this.Ba&&this.Ba.focus()};function X(a){a=a&&a.B;null==a&&(a=-1);return a}m.V=function(a,b){var c=255,d=X(a);-1!==d&&(c=vb(this.C,d),b&&Od(a,b));return c};m.mb=function(a,b){var c=65535,d=X(a);if(-1!==d){var c=this.C,e=d&c.u,f=(d&c.H)>>>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};
function Ud(a,b,c){var d="";for(c=c||256;d.length<c;){var e=a.U(b,1);if(!e||36==e||127<=e)break;d+=32<=e?String.fromCharCode(e):"."}return d}function Gd(a,b){a.C=a;a.fa=a.Ub=1073741824;a.Ba=null;var c=Td(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(c.length)for(var d in Ld)0<=la(c,d)&&(a.fa|=Ld[d],a.g(d+" messages enabled"))}function Md(a,b){for(var c in Ld)if(64==Ld[c]){a.Za[c]=b;break}} 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 Vd(a,b){var c;a=a.toUpperCase();null==b?c=la(Jd,a):(c=la(Jd,a.substr(b,3)),0>c&&(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 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;c<a.J.length;c++){var f=a.J[c].xa[d];if(void 0!==f){d=f.o;void 0!==d&&(e=W(d));break}}if(d=e)return d;c=Sd(a,b,void 0)}null!=c&&(d=W(c));return d}function Td(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Vb=Ud(a,b.Sb=c[2]))}function Od(a,b){null!=a.B&&(a.B+=b||1)}function Z(a){return q(a,4)}
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 Vd(a,b,c){var d="";for(c=c||256;d.length<c;){var e=a.V(b,1);if(!e||36==e||127<=e)break;d+=32<=e?String.fromCharCode(e):"."}return d}function Gd(a,b){a.D=a;a.ga=a.Wb=1073741824;a.Da=null;var c=Ud(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(c.length)for(var d in Md)0<=la(c,d)&&(a.ga|=Md[d],a.g(d+" messages enabled"))}function Nd(a,b){for(var c in Md)if(64==Md[c]){a.ab[c]=b;break}}
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+' "'+ function Wd(a,b){var c;a=a.toUpperCase();null==b?c=la(Kd,a):(c=la(Kd,a.substr(b,3)),0>c&&(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):"??"}
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 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 Fd(a){var b;if(od(a)){if(!a.W||!a.W.length){a.W=Array(1E3);for(b=0;b<a.W.length;b++)a.W[b]=V();a.ra=0;a.g("instruction history buffer allocated")}if(!a.S||!a.S.length)for(a.S=Array(256),b=0;b<a.S.length;b++)a.S[b]=[b,0]}else a.W&&a.W.length&&a.g("instruction history buffer freed"),a.ra=0,a.W=[],a.S=[]}m.Ja=function(a){if(!Zd(this))return!1;this.b.Ja(a);return!0}; 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+' "'+
m.Wa=function(a,b,c){if(!Zd(this))return!1;this.T=0;a||od(this)&&pd(this,this.b.J,0);try{var d=this.b.Wa(a);0<d&&(this.T+=d,uc(this.b,d,!0),rc(this.b,d),this.ea++)}catch(e){"number"!=typeof e&&(this.T=0,mb(this.b,e.stack||e.message))}!1!==c&&D(this.b);this.oa(b||!1);return 0<this.T};m.da=function(a){this.b&&this.b.da(a)};m.oa=function(a){void 0===a&&(a=!0);this.Y=V(this.b.J);a&&1!=this.ba?$d(this):ae(this)}; 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 Zd(a){var b;if(b=a.b&&lb(a.b))b=a.b,b.u.ga?b=!0:(b.g(b.toString()+" not powered"),b=!1);b&&!kb(a.b)?(a=a.b,a.u.Na?(a.g(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}m.ua=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};m.ta=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};m.reset=function(a){Fd(this);this.ea=this.Ka=0;this.Ba=null;this.T=0;this.Y=V(this.b.J);this.u.ha=!1;be(this);a||this.oa()}; function Fd(a){var b;if(nd(a)){if(!a.X||!a.X.length){a.X=Array(1E3);for(b=0;b<a.X.length;b++)a.X[b]=W();a.ta=0;a.g("instruction history buffer allocated")}if(!a.T||!a.T.length)for(a.T=Array(256),b=0;b<a.T.length;b++)a.T[b]=[b,0]}else a.X&&a.X.length&&a.g("instruction history buffer freed"),a.ta=0,a.X=[],a.T=[]}m.La=function(a){if(!$d(this))return!1;this.b.La(a);return!0};
m.save=function(){var a=new G(this);H(a,0,Od(this.Y));H(a,1,Od(this.na));H(a,2,[this.D,this.qa,this.fa]);H(a,3,this.I);return a.data()};m.restore=function(a){var b=0;void 0!==a[2]&&(this.Y=Pd(a[b++]),this.na=Pd(a[b++]),this.D=a[b][0],"string"==typeof this.D&&(this.D=[this.D]),this.qa=a[b][1],this.fa|=a[b][2]);a[3]&&(this.I=a[3]);return!0};m.start=function(a,b){this.ba||this.g("running");this.u.ha=!0;this.Yb=a;this.Zb=b}; m.Ya=function(a,b,c){if(!$d(this))return!1;this.U=0;a||nd(this)&&od(this,this.b.K,0);try{var d=this.b.Ya(a);0<d&&(this.U+=d,sc(this.b,d,!0),pc(this.b,d),this.oa++)}catch(e){"number"!=typeof e&&(this.U=0,lb(this.b,e.stack||e.message))}!1!==c&&G(this.b);this.qa(b||!1);return 0<this.U};m.ea=function(a){this.b&&this.b.ea(a)};m.qa=function(a){void 0===a&&(a=!0);this.Z=W(this.b.K);a&&1!=this.fa?ae(this):be(this)};
m.stop=function(a,b){if(this.u.ha){this.u.ha=!1;this.T=b-this.Zb;if(!this.ba){var c="stopped";if(this.T){var d=a-this.Yb,e=0<d?Math.round(1E3*this.T/d):0,c=c+" (";od(this)&&(c+=this.ea+" opcodes, ",this.Ka-=this.ea,this.ea=0);c+=this.T+" cycles, "+d+" ms, "+e+" hz)"}else ib(this,-2147483648)&&(c+=" (use the 't' command to execute blocked faults)");this.g(c)}this.oa(!0);this.jb();be(this,this.b.J)}};function od(a){return 1<a.w.length||!!a.Aa} function $d(a){var b;if(b=a.b&&kb(a.b))b=a.b,b.w.ha?b=!0:(b.g(b.toString()+" not powered"),b=!1);b&&!jb(a.b)?(a=a.b,a.w.Pa?(a.g(a.toString()+" error"),a=!0):a=!1,a=!a):a=!1;return a}m.wa=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};m.va=function(a,b){b&&this.g(a?"suspending":"shutting down");return a?this.save():!0};m.reset=function(a){Fd(this);this.oa=this.Ma=0;this.Da=null;this.U=0;this.Z=W(this.b.K);this.w.ia=!1;ce(this);a||this.qa()};
function pd(a,b,c){var d=a.b;if(0<c&&(a.Aa&&!--a.Aa||Zb(a,b,1,a.w)))return!0;0<=c&&a.S.length&&(a.ea++,b=wb(a.B,b),null!=b&&(a.S[b][1]++,b=a.W[a.ra],b.A=d.J,b.sa=!1,++a.ra==a.W.length&&(a.ra=0)));return!1}function Hb(a,b,c){a.g("break on input from port "+r(b)+": "+p(c));a.da(!0)}function Kb(a,b,c){a.g("break on output to port "+r(b)+": "+p(c));a.da(!0)} m.save=function(){var a=new J(this);K(a,0,Pd(this.Z));K(a,1,Pd(this.pa));K(a,2,[this.F,this.sa,this.ga]);K(a,3,this.J);return a.data()};m.restore=function(a){var b=0;void 0!==a[2]&&(this.Z=Qd(a[b++]),this.pa=Qd(a[b++]),this.F=a[b][0],"string"==typeof this.F&&(this.F=[this.F]),this.sa=a[b][1],this.ga|=a[b][2]);a[3]&&(this.J=a[3]);return!0};m.start=function(a,b){this.fa||this.g("running");this.w.ia=!0;this.$b=a;this.ec=b};
function Ed(a){var b,c;a.w=["bp"];if(void 0!==a.Z)for(b=1;b<a.Z.length;b++){c=a.Z[b];var d=a.b;$b(d.ja[X(c)>>>d.X],!1)}a.Z=["br"];if(void 0!==a.H)for(b=1;b<a.H.length;b++)c=a.H[b],d=a.b,$b(d.ja[X(c)>>>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}; m.stop=function(a,b){if(this.w.ia){this.w.ia=!1;this.U=b-this.ec;if(!this.fa){var c="stopped";if(this.U){var d=a-this.$b,e=0<d?Math.round(1E3*this.U/d):0,c=c+" (";nd(this)&&(c+=this.oa+" opcodes, ",this.Ma-=this.oa,this.oa=0);c+=this.U+" cycles, "+d+" ms, "+e+" hz)"}else hb(this,-2147483648)&&(c+=" (use the 't' command to execute blocked faults)");this.g(c)}this.qa(!0);this.kb();ce(this,this.b.K)}};function nd(a){return 1<a.A.length||!!a.Ca}
function ce(a,b,c,d,e){var f=!1;c=X(c);for(var h=1;h<b.length;h++){var g=b[h];if(c==X(g)&&(!d||g.sa)){f=!0;g.sa||e||de(a,b,h,"cleared");b.splice(h,1);b!=a.w&&(d=a.b,$b(d.ja[c>>>d.X],b==a.H));g.sa||Fd(a);break}}return f}function ee(a,b){for(var c=1;c<b.length;c++)de(a,b,c);return b.length-1}function de(a,b,c,d){c=b[c];a.g(b[0]+" "+Z(c.A)+(d?" "+d:c.Qb?' "'+c.Qb+'"':""))} function od(a,b,c){var d=a.b;if(0<c&&(a.Ca&&!--a.Ca||Xb(a,b,1,a.A)))return!0;0<=c&&a.T.length&&(a.oa++,b=vb(a.C,b),null!=b&&(a.T[b][1]++,b=a.X[a.ta],b.B=d.K,b.ua=!1,++a.ta==a.X.length&&(a.ta=0)));return!1}function Fb(a,b,c){a.g("break on input from port "+r(b)+": "+q(c));a.ea(!0)}function Ib(a,b,c){a.g("break on output to port "+r(b)+": "+q(c));a.ea(!0)}
function be(a,b){if(void 0!==b)Zb(a,b,1,a.w,!0),a.ba=0;else for(var c=1;c<a.w.length;c++){var d=a.w[c];if(d.sa){if(!ce(a,a.w,d,!0))break;c=0}}} function Ed(a){var b,c;a.A=["bp"];if(void 0!==a.ca)for(b=1;b<a.ca.length;b++){c=a.ca[b];var d=a.b;Yb(d.ka[X(c)>>>d.Y],!1)}a.ca=["br"];if(void 0!==a.I)for(b=1;b<a.I.length;b++)c=a.I[b],d=a.b,Yb(d.ka[X(c)>>>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 Zb(a,b,c,d,e){var f=!1;if(!a.Fb++)for(var h=1;!f&&h<d.length;h++){var g=d[h];if(!e||g.sa)for(var k=X(g),l=0;l<c;l++)if(b+l==k){var n,f=!0;g.sa&&(ce(a,d,g,!0),e=!0);if(n=g.Tb){for(var f=!1,q=0;q<n.length;q++)if(!fe(a,n[q],!0)){if(n[q].indexOf("if")){f=!0;break}for(var u=q+1;u<n.length&&n[u].indexOf("else");u++)q++;if(u==n.length){f=!0;break}}a.b.u.ha||(f=!0)}if(f){e||de(a,d,h,"hit");break}}}a.Fb--;return f} function de(a,b,c,d,e){var f=!1;c=X(c);for(var h=1;h<b.length;h++){var g=b[h];if(c==X(g)&&(!d||g.ua)){f=!0;g.ua||e||ee(a,b,h,"cleared");b.splice(h,1);b!=a.A&&(d=a.b,Yb(d.ka[c>>>d.Y],b==a.I));g.ua||Fd(a);break}}return f}function fe(a,b){for(var c=1;c<b.length;c++)ee(a,b,c);return b.length-1}function ee(a,b,c,d){c=b[c];a.g(b[0]+" "+Z(c.B)+(d?" "+d:c.Sb?' "'+c.Sb+'"':""))}
function ge(a,b,c,d){for(var e=V(b.A),f=a.U(b,1),h=a.zb[f],f="",g=Id[h[0]],k=h.length-1,l=0,n,q=1;q<=k;q++){var u="";n=h[q];if(void 0!==n){var W=n&15;W?l=W:n|=l;n&61440||(n|=1==q?8192:4096);W=n&240;if(W&32){var u=a,W=n,R=b,qa=" ";switch(W&15){case 1:qa=p(u.U(R,1),2);break;case 2:qa=p(u.U(R,1)<<24>>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<f.length&&(f+=",");f+= function ce(a,b){if(void 0!==b)Xb(a,b,1,a.A,!0),a.fa=0;else for(var c=1;c<a.A.length;c++){var d=a.A[c];if(d.ua){if(!de(a,a.A,d,!0))break;c=0}}}
u||"???"}}h="";k=Z(e.A)+" ";if(-1!==e.A&&-1!==b.A){do if(h+=p(a.U(e,1),2),null==e.A)break;while(e.A!=b.A)}k+=ga(h,10);k=k+(n&32768?"*":" ")+ga(g,7);f&&(k+=" "+f);c&&(k=ga(k,40)+";"+c,k=a.b.u.Ma?k+("cycles="+sc(a.b).toString()+" cs="+p(a.b.i.bb)):k+(null!=d?"="+d.toString():""));return k} function Xb(a,b,c,d,e){var f=!1;if(!a.Kb++)for(var h=1;!f&&h<d.length;h++){var g=d[h];if(!e||g.ua)for(var k=X(g),l=0;l<c;l++)if(b+l==k){var n,f=!0;g.ua&&(de(a,d,g,!0),e=!0);if(n=g.Vb){for(var f=!1,p=0;p<n.length;p++)if(!ge(a,n[p],!0)){if(n[p].indexOf("if")){f=!0;break}for(var z=p+1;z<n.length&&n[z].indexOf("else");z++)p++;if(z==n.length){f=!0;break}}a.b.w.ia||(f=!0)}if(f){e||ee(a,d,h,"hit");break}}}a.Kb--;return f}
function he(a,b){var c;switch(b){case "I":c=a.b.la&512;break;case "S":c=Jc(a.b);break;case "Z":c=Ic(a.b);break;case "A":c=Hc(a.b);break;case "P":c=Gc(a.b);break;case "C":c=K(a.b);break;default:c=0}return b+(c?"1":"0")+" "}function ie(a,b){return Jd[b]+"="+Wd(a,b)+" "}function je(a){return ie(a,7)+ie(a,8)+ie(a,0)+ie(a,1)+ie(a,2)+ie(a,3)+ie(a,4)+ie(a,5)+ie(a,13)+he(a,"I")+he(a,"S")+he(a,"Z")+he(a,"A")+he(a,"P")+he(a,"C")} function he(a,b,c,d){for(var e=W(b.B),f=a.V(b,1),h=a.Cb[f],g="",k=(a.aa!=Dd?Id:Jd)[h[0]],l=h.length-1,n=0,p,z=1;z<=l;z++){var B="";p=h[z];if(void 0!==p&&!(p&16384&&8080==a.aa)){var v=p&240;if(v){var Da=p&15;Da?n=Da:p|=n;p&61440||(p|=1==z?8192:4096);if(v&32)a:{var B=a,v=p,Da=b,C=" ";switch(v&15){case 1:C=q(B.V(Da,1),2);break;case 2:C=q(B.V(Da,1)<<24>>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&
var Je={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; 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<g.length&&(g+=",");g+=B||"???"}}}f="";h=Z(e.B)+" ";if(-1!==e.B&&-1!==b.B){do if(f+=q(a.V(e,1),2),null==e.B)break;while(e.B!=b.B)}h+=ga(f,10);h=h+(p&32768?"*":" ")+ga(k,7);g&&(h+=" "+g);c&&(h=ga(h,40)+";"+c,h=a.b.w.Oa?h+("cycles="+qc(a.b).toString()+" cs="+q(a.b.i.cb)):h+(null!=d?"="+d.toString():""));return h}
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<<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;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?1:0;break;case "&":d=f&e;break; function ie(a,b){var c;switch(b){case "I":c=a.b.ma&512;break;case "S":c=Ic(a.b);break;case "Z":c=Hc(a.b);break;case "A":c=Gc(a.b);break;case "P":c=Fc(a.b);break;case "C":c=Ec(a.b);break;default:c=0}return b+(c?"1":"0")+" "}function je(a,b){return Kd[b]+"="+Xd(a,b)+" "}function ke(a){return je(a,7)+je(a,8)+je(a,9)+je(a,10)+je(a,11)+je(a,13)+ie(a,"I")+ie(a,"S")+ie(a,"Z")+ie(a,"A")+ie(a,"P")+ie(a,"C")}
var Ke={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":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<<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;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?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} 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<l.length;){var n=l[e++],q=n.length,n=ha(n);if(!n){f=!0;break}n=Le(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}g.push(n);if(e==l.length)break;var n=l[e++],u=n.length;k.length&&Je[n]<Je[k[k.length-1]]&&Ke(g,k,1);k.push(n);b=b.substr(q+u)}Ke(g,k)&&1==g.length||(f=!0);f?c&&a.g("error parsing '"+h+"' at character "+(h.length-b.length)):(d=g.pop(),c&&Me(a,null, 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<l.length;){var n=l[e++],p=n.length,n=ha(n);if(!n){f=!0;break}n=Me(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}g.push(n);if(e==l.length)break;var n=l[e++],z=n.length;k.length&&Ke[n]<Ke[k[k.length-1]]&&Le(g,k,1);k.push(n);b=b.substr(p+z)}Le(g,k)&&1==g.length||(f=!0);f?c&&a.g("error parsing '"+h+"' at character "+(h.length-b.length)):(d=g.pop(),c&&Ne(a,null,
d))}return d}function Qd(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=Rd(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?p(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)d=Y(a,c[1]),b=b.replace("["+c[1]+"]",d?p(a.lb(d,0),4):"undefined");for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.ea-a.Ka}if(null==e)break;c=c.replace(d[0],e.toString())}return c} d))}return d}function Rd(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=Sd(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?q(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)d=Y(a,c[1]),b=b.replace("["+c[1]+"]",d?q(a.mb(d,0),4):"undefined");for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.oa-a.Ma}if(null==e)break;c=c.replace(d[0],e.toString())}return c}
function Le(a,b,c,d){var e;void 0!==b?(e=Vd(b),0<=e?e=Xd(a,e):(e=a.pa[b],void 0===e&&(e=aa(b))),void 0!==e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e} function Me(a,b,c,d){var e;void 0!==b?(e=Wd(b),0<=e?e=Yd(a,e):(e=a.ra[b],void 0===e&&(e=aa(b))),void 0!==e||d||a.g("invalid "+(c?c:"value")+": "+b)):d||a.g("missing "+(c||"value"));return e}
function Me(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f,h="";if(!f||4<f)f=4;for(var g=0;g<f;g++){h&&(h=","+h);var k=d&255,l=8,n="";void 0===l?l=32:32<l&&(l=32);if(null==k||isNaN(k))for(;0<l--;)n="?"+n;else for(;0<l--;)n=(k&1?"1":"0")+n,k>>=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 0<c}Dd.prototype.Cb=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0}; function Ne(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f,h="";if(!f||4<f)f=4;for(var g=0;g<f;g++){h&&(h=","+h);var k=d&255,l=8,n="";void 0===l?l=32:32<l&&(l=32);if(null==k||isNaN(k))for(;0<l--;)n="?"+n;else for(;0<l--;)n=(k&1?"1":"0")+n,k>>=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 0<c}Cd.prototype.Eb=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function Oe(a,b,c){var d=[],e=X(b)>>>0;for(b=0;b<a.I.length;b++){var f=a.I[b],h=f.A>>>0,g=f.ec;if(e>=h&&e<h+g){e=ia(f.Bb,[e-h],a.Cb);0<=e?Pe(a,b,e,d):c&&(e=~e,Pe(a,b,e-1,d),Pe(a,b,e,d));break}}return d}function Pe(a,b,c,d){var e={},f=a.I[b].Bb,h=0,g=null;0<=c&&c<f.length&&(h=f[c][0],g=f[c][1]);g&&(e=a.I[b].wa[g],g="."==g.charAt(0)?null:e.l||g);d.push(g);d.push(h);d.push(e.a);d.push(e.c)} function Pe(a,b,c){var d=[],e=X(b)>>>0;for(b=0;b<a.J.length;b++){var f=a.J[b],h=f.B>>>0,g=f.gc;if(e>=h&&e<h+g){e=ia(f.Bb,[e-h],a.Eb);0<=e?Qe(a,b,e,d):c&&(e=~e,Qe(a,b,e-1,d),Qe(a,b,e,d));break}}return d}function Qe(a,b,c,d){var e={},f=a.J[b].Bb,h=0,g=null;0<=c&&c<f.length&&(h=f[c][0],g=f[c][1]);g&&(e=a.J[b].xa[g],g="."==g.charAt(0)?null:e.l||g);d.push(g);d.push(h);d.push(e.a);d.push(e.c)}
function Qe(a,b){if("?"==b)a.g("frequency commands:"),a.g("\tclear\tclear all frequency counts");else{var c,d=0;if(a.S)if("clear"==b){for(c=0;c<a.S.length;c++)a.S[c]=[c,0];a.g("frequency data cleared");d++}else if(void 0!==b)a.g("unknown frequency command: "+b),d++;else{var e=a.S.slice();e.sort(function(a,b){return b[1]-a[1]});for(c=0;c<e.length;c++){var f=e[c][0],h=e[c][1];h&&(a.g((Id[a.zb[f][0]]+" ").substr(0,5)+" ("+("0x"+p(f,2))+"): "+h+" times"),d++)}}d||a.g("no frequency data available")}} function Re(a,b){if("?"==b)a.g("frequency commands:"),a.g("\tclear\tclear all frequency counts");else{var c,d=0;if(a.T)if("clear"==b){for(c=0;c<a.T.length;c++)a.T[c]=[c,0];a.g("frequency data cleared");d++}else if(void 0!==b)a.g("unknown frequency command: "+b),d++;else{var e=a.T.slice();e.sort(function(a,b){return b[1]-a[1]});var f=a.aa!=Dd?Id:Jd;for(c=0;c<e.length;c++){var h=e[c][0],g=e[c][1];g&&(a.g((f[a.Cb[h][0]]+" ").substr(0,5)+" ("+("0x"+q(h,2))+"): "+g+" times"),d++)}}d||a.g("no frequency data available")}}
function Re(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Ne(a)||a.g("no variables"),!0;if(!c[2])return Ne(a,c[1]);if(!c[3])return delete a.pa[c[1]],!0;var d=Rd(a,c[3]);return void 0!==d?(a.pa[c[1]]=d,!0):!1}a.g("invalid assignment:"+b);return!1} function Se(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Oe(a)||a.g("no variables"),!0;if(!c[2])return Oe(a,c[1]);if(!c[3])return delete a.ra[c[1]],!0;var d=Sd(a,c[3]);return void 0!==d?(a.ra[c[1]]=d,!0):!1}a.g("invalid assignment:"+b);return!1}
function Se(a,b,c){var d=null;if(b=Y(a,b,!0)){var e=Oe(a,b,!0);if(e.length){var f,h;e[0]&&(h="",(f=b.A-e[1])&&(h=" + "+r(f)),f=e[0]+" ("+Z(e[1])+")"+h,c&&a.g(f),d=f);4<e.length&&e[4]&&(h="",(f=e[5]-b.A)&&(h=" - "+r(f)),f=e[4]+" ("+Z(e[5])+")"+h,c&&a.g(f),d||(d=f))}else c&&a.g("no symbols")}return d} function Te(a,b,c){var d=null;if(b=Y(a,b,!0)){var e=Pe(a,b,!0);if(e.length){var f,h;e[0]&&(h="",(f=b.B-e[1])&&(h=" + "+r(f)),f=e[0]+" ("+Z(e[1])+")"+h,c&&a.g(f),d=f);4<e.length&&e[4]&&(h="",(f=e[5]-b.B)&&(h=" - "+r(f)),f=e[4]+" ("+Z(e[5])+")"+h,c&&a.g(f),d||(d=f))}else c&&a.g("no symbols")}return d}
function $d(a,b){var c;if(b&&"?"==b[1])a.g("register commands:"),a.g("\tr\tdump registers"),a.g("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(null!=b&&1<b.length){var e=b[1],f=null,h=e.indexOf("=");if(0<h)f=e.substr(h+1),e=e.substr(0,h);else if(2<b.length)f=b[2];else{a.g("missing value for "+b[1]);return}var h=!1,g=Rd(a,f);if(void 0!==g){var h=!0,k=e.toUpperCase();"E"==k.charAt(0)&&(k=null);switch(k){case "A":d.j=g&255;break;case "B":d.K=g&255;break;case "BC":d.K=g>> function Ue(a,b){switch(b[1]){case "8080":a.aa=8080;break;case "8086":a.aa=Dd;break;case "cs":var c;void 0!==b[3]&&(c=+b[3]);switch(b[2]){case "int":a.b.i.Ta=c;break;case "start":a.b.i.eb=c;break;case "stop":a.b.i.Va=c;break;default:a.g("unknown cs option");return}void 0!==c&&mc(a.b);a.g("checksums "+(a.b.w.Oa?"enabled":"disabled"));return;case "sp":void 0!==b[2]&&(rc(a.b,+b[2])||a.g("warning: using 1x multiplier, previous target not reached"));a.g("target speed: "+(a.b.i.Ha.toFixed(2)+"Mhz")+" ("+
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= a.b.i.Ja+"x)");return;case "?":a.g("debugger options:");a.g("\t8080\t\tselect 8080-style mnemonics");a.g("\t8086\t\tselect 8086-style mnemonics");a.g("\tcs int #\tset checksum cycle interval to #");a.g("\tcs start #\tset checksum cycle start count to #");a.g("\tcs stop #\tset checksum cycle stop count to #");a.g("\tsp #\t\tset speed multiplier to #");break;default:if(b[1]){a.g("unknown option: "+b[1]);return}}a.g(a.aa+"-style mnemonics enabled")}
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){var c;if(b&&"?"==b[1])a.g("register commands:"),a.g("\tr\tdump registers"),a.g("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(null!=b&&1<b.length){var e=b[1],f=null,h=e.indexOf("=");if(0<h)f=e.substr(h+1),e=e.substr(0,h);else if(2<b.length)f=b[2];else{a.g("missing value for "+b[1]);return}var h=!1,g=Sd(a,f);if(void 0!==g)switch(h=!0,e.toUpperCase()){case "A":d.j=g&255;break;case "B":d.L=g&255;break;case "BC":d.L=g>>8&255;case "C":d.O=g&255;break;case "D":d.M=
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.A<b.A)return;e=d.A-b.A;if(256<e){a.g("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=kb(a,!1)||a.ba?a.T:null;var h=null!=f?"cycles":null,g=Oe(a,b),k=b.A;if(g[0]&&d&&(!c&&d||0>g[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++}}} 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: "+
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} 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 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)&&0<b.length){a.qa&&(b="a "+Z(a.na.A)+" "+b);var f=b.replace(/ +/g," ").split(" ");if(f&&f.length)for(var h=f[0],g=h.charAt(0),k=1;k<h.length;k++){var l=h.charAt(k);if("?"==g||"r"==g||"a">l||"z"<l){f[0]=h.substr(k);f.unshift(h.substr(0,k));break}}switch(f[0].charAt(0)){case "a":var n=Y(a,f[1],!0);if(n)if(a.na= 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.B<b.B)return;e=d.B-b.B;if(256<e){a.g("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=jb(a,!1)||a.fa?a.U:null;var h=null!=f?"cycles":null,g=Pe(a,b),k=b.B;if(g[0]&&d&&(!c&&d||0>g[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++}}}
n,void 0===f[2])a.g("begin assemble at "+Z(n.A)),a.qa=!0,D(a.b);else{var q;a.g("not supported yet");q=[];if(q.length){for(var u=0;u<q.length;u++)a.yb(n,q[u],1);a.g(ge(a,a.na))}}break;case "b":a:{var W=f[0],R=f[1],qa=b;if("?"==R)a.g("breakpoint commands:"),a.g("\tbi [p]\ttoggle break on input port [p]"),a.g("\tbo [p]\ttoggle break on output port [p]"),a.g("\tbp [a]\tset exec breakpoint at addr [a]"),a.g("\tbr [a]\tset read breakpoint at addr [a]"),a.g("\tbw [a]\tset write breakpoint at addr [a]"), 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}
a.g("\tbc [a]\tclear breakpoint at addr [a]"),a.g("\tbl\tlist all breakpoints"),a.g("\tbn [n]\tbreak after [n] instruction(s)");else{var sa=W.charAt(1);if("l"==sa){var ab=0,ab=ab+ee(a,a.w),ab=ab+ee(a,a.Z);(ab+=ee(a,a.H))||a.g("no breakpoints")}else if("n"==sa)a.Aa=Le(a,R),a.g("break after "+a.Aa+" instruction(s)");else if(void 0===R)a.g("missing breakpoint address");else{var F=V();if("*"!=R&&(F=Y(a,R,!0),!F))break a;R=r(F.A);"c"==sa?null==F.A?(Ed(a),a.g("all breakpoints cleared")):ce(a,a.w,F)||ce(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)&&0<b.length){a.sa&&(b="a "+Z(a.pa.B)+" "+b);var f=b.replace(/ +/g," ").split(" ");if(f&&f.length)for(var h=f[0],g=h.charAt(0),k=1;k<h.length;k++){var l=h.charAt(k);if("?"==g||"r"==g||"a">l||"z"<l){f[0]=h.substr(k);f.unshift(h.substr(0,k));break}}switch(f[0].charAt(0)){case "a":var n=Y(a,f[1],!0);if(n)if(a.pa=
a.Z,F)||ce(a,a.H,F)||a.g("breakpoint missing: "+Z(F.A)):"i"==sa?a.g("breakpoint "+(Fb(a.B,F.A)?"enabled":"cleared")+": port "+R+" (input)"):"o"==sa?a.g("breakpoint "+(Ib(a.B,F.A)?"enabled":"cleared")+": port "+R+" (output)"):null!=F.A&&(Sd(a,F,qa),"p"==sa?a.Ca(a.w,F):"r"==sa?a.Ca(a.Z,F):"w"==sa?a.Ca(a.H,F):a.g("unknown breakpoint command: "+sa))}}}break;case "c":a.Da&&(a.Da.value="");break;case "d":a:{var bb,cb=f[0],ta=f[1],Ka=f[2],qf=f[3];if("?"==ta){var ua="";for(bb in Ld)a.Za[bb]&&(ua&&(ua+=","), n,void 0===f[2])a.g("begin assemble at "+Z(n.B)),a.sa=!0,G(a.b);else{var p;a.g("not supported yet");p=[];if(p.length){for(var z=0;z<p.length;z++)a.Ab(n,p[z],1);a.g(he(a,a.pa))}}break;case "b":a:{var B=f[0],v=f[1],Da=b;if("?"==v)a.g("breakpoint commands:"),a.g("\tbi [p]\ttoggle break on input port [p]"),a.g("\tbo [p]\ttoggle break on output port [p]"),a.g("\tbp [a]\tset exec breakpoint at addr [a]"),a.g("\tbr [a]\tset read breakpoint at addr [a]"),a.g("\tbw [a]\tset write breakpoint at addr [a]"),
ua+=bb);ua+=",state,symbols";a.g("dump memory commands:");a.g("\tdb [a] [#] dump # bytes at address a");a.g("\tdw [a] [#] dump # words at address a");a.g("\tdd [a] [#] dump # dwords at address a");a.g("\tdh [#] [#] dump # instructions from history");ua.length&&a.g("dump extension commands:\n\t"+ua)}else if("state"==ta){var ke=Ve(a.s,!0);"console"==Ka?console.log(ke):(a.Da&&(a.Da.value=""),a.g(ke))}else if("symbols"==ta)for(var Nc=0;Nc<a.I.length;Nc++){var Oc=a.I[Nc],eb;for(eb in Oc.wa)if("."!= a.g("\tbc [a]\tclear breakpoint at addr [a]"),a.g("\tbl\tlist all breakpoints"),a.g("\tbn [n]\tbreak after [n] instruction(s)");else{var C=B.charAt(1);if("l"==C){var ab=0,ab=ab+fe(a,a.A),ab=ab+fe(a,a.ca);(ab+=fe(a,a.I))||a.g("no breakpoints")}else if("n"==C)a.Ca=Me(a,v),a.g("break after "+a.Ca+" instruction(s)");else if(void 0===v)a.g("missing breakpoint address");else{var I=W();if("*"!=v&&(I=Y(a,v,!0),!I))break a;v=r(I.B);"c"==C?null==I.B?(Ed(a),a.g("all breakpoints cleared")):de(a,a.A,I)||de(a,
eb.charAt(0)){var le=Oc.wa[eb].o;if(void 0!==le){var me=Oc.wa[eb].l;me&&(eb=me);a.g(Z(le)+" "+eb)}}}else{if("d"==cb){for(bb in Ld)if(f[1]==bb){var ne=a.Za[bb];ne?(f.shift(),f.shift(),ne(f)):a.g("no dump registered for "+ta);break a}ta||(cb=a.$b||"db")}else a.$b=cb;if("dh"==cb){var oe=ta,pe=Ka,qe="",re=0,N=a.ra,va=a.W;if(va.length){var S=+oe||a.Hb,fb=+pe||10;isNaN(S)?S=fb:qe="more ";S>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): a.ca,I)||de(a,a.I,I)||a.g("breakpoint missing: "+Z(I.B)):"i"==C?a.g("breakpoint "+(wb(a.C,I.B)?"enabled":"cleared")+": port "+v+" (input)"):"o"==C?a.g("breakpoint "+(Gb(a.C,I.B)?"enabled":"cleared")+": port "+v+" (output)"):null!=I.B&&(Td(a,I,Da),"p"==C?a.Ea(a.A,I):"r"==C?a.Ea(a.ca,I):"w"==C?a.Ea(a.I,I):a.g("unknown breakpoint command: "+C))}}}break;case "c":a.Fa&&(a.Fa.value="");break;case "d":a:{var bb,cb=f[0],ra=f[1],Ja=f[2],sf=f[3];if("?"==ra){var sa="";for(bb in Md)a.ab[bb]&&(sa&&(sa+=","),sa+=
N+=va.length);var Pc=[];"call"==pe&&(fb=1E5,Pc=["CALL"]);for(void 0!==oe&&a.g(S+" instructions earlier:");0<fb&&N!=a.ra;){var se=va[N++];if(null==se.A)break;var xb=V(se.A),rf=S--,te=ge(a,xb,"history",rf);(!Pc.length||0<=te.indexOf(Pc[0]))&&a.g(te);xb.qb&&(N+=xb.qb,fb-=xb.qb,S-=xb.qb);N>=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<dc&&(dc=65536));for(var La= bb);sa+=",state,symbols";a.g("dump memory commands:");a.g("\tdb [a] [#] dump # bytes at address a");a.g("\tdw [a] [#] dump # words at address a");a.g("\tdd [a] [#] dump # dwords at address a");a.g("\tdh [#] [#] dump # instructions from history");sa.length&&a.g("dump extension commands:\n\t"+sa)}else if("state"==ra){var le=Xe(a.u,!0);"console"==Ja?console.log(le):(a.Fa&&(a.Fa.value=""),a.g(le))}else if("symbols"==ra)for(var Nc=0;Nc<a.J.length;Nc++){var Oc=a.J[Nc],eb;for(eb in Oc.xa)if("."!=
"",sf=(dc||128)+15>>4||1,Qc="dd"==cb?4:"dw"==cb?2:1,ue=0;ue<sf;ue++){for(var ec=0,Rc=0,yb="",Sc="",ta=Z(cc.A),Tc=0;16>Tc;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:"), eb.charAt(0)){var me=Oc.xa[eb].o;if(void 0!==me){var ne=Oc.xa[eb].l;ne&&(eb=ne);a.g(Z(me)+" "+eb)}}}else{if("d"==cb){for(bb in Md)if(f[1]==bb){var oe=a.ab[bb];oe?(f.shift(),f.shift(),oe(f)):a.g("no dump registered for "+ra);break a}ra||(cb=a.fc||"db")}else a.fc=cb;if("dh"==cb){var pe=ra,qe=Ja,re="",se=0,Q=a.ta,ta=a.X;if(ta.length){var U=+pe||a.Lb,fb=+qe||10;isNaN(U)?U=fb:re="more ";U>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):
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;ic<f.length;ic++){var zb=Rd(a,f[ic]);if(void 0===zb){a.g("unrecognized value: "+f[ic]);break}zb&~ve&&a.g("warning: "+p(zb)+" exceeds "+gc+"-byte value");var tf=we.call(a,hc);a.g("changing "+Z(hc.A)+" from 0x"+p(tf,ye)+" to 0x"+p(zb,ye));xe.call(a,hc,zb,gc)}}break;case "f":Qe(a,f[1]);break;case "g":a:{var Ae=f[1],uf=b;if(void 0!==Ae){var Uc=Y(a,Ae,!0);if(!Uc)break a; Q+=ta.length);var Pc=[];"call"==qe&&(fb=1E5,Pc=["CALL"]);for(void 0!==pe&&a.g(U+" instructions earlier:");0<fb&&Q!=a.ta;){var te=ta[Q++];if(null==te.B)break;var yb=W(te.B),tf=U--,ue=he(a,yb,"history",tf);(!Pc.length||0<=ue.indexOf(Pc[0]))&&a.g(ue);yb.sb&&(Q+=yb.sb,fb-=yb.sb,U-=yb.sb);Q>=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<dc&&(dc=65536));for(var Ka=
Sd(a,Uc,uf);a.Ca(a.w,Uc,!0)}a.Ja(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;case "h":var Vc;a.u.ha?(Vc="halting",a.da()):Vc="already halted";c||a.g(Vc);break;case "i":if("if"==f[0]){var Wc;var Ab=b.substr(2),Ab=ha(Ab);Rd(a,Ab)?(c||a.g("true: "+Ab),Wc=!0):(c||a.g("false: "+Ab),Wc=!1);Wc||(d=!1);break}var Xc=f[1];if(Xc&&"?"!=Xc){var Yc=Le(a,Xc);if(void 0!==Yc){var vf=Gb(a.B,Yc);a.g(r(Yc)+": "+("0x"+p(vf,2)))}}else a.g("input commands:"),a.g("\ti [p]\tread port [p]"),a.g("warning: port accesses can affect hardware state"); "",uf=(dc||128)+15>>4||1,Qc="dd"==cb?4:"dw"==cb?2:1,ve=0;ve<uf;ve++){for(var ec=0,Rc=0,zb="",Sc="",ra=Z(cc.B),Tc=0;16>Tc;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:"),
break;case "k":var wf=f[0];if("?"==f[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var Zc=0,Be=V(),Bb=V(a.b.aa);for(a.g("stack trace for "+Z(Bb.A));10>Zc;){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(0<kc.indexOf("CALL")){var Ee=kc.indexOf(" ");if(Cb+(kc.indexOf(" ",Ee+1)-Ee-1)/2==De){Ce=kc;break}}}Cb--}jc.A= 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;ic<f.length;ic++){var Ab=Sd(a,f[ic]);if(void 0===Ab){a.g("unrecognized value: "+f[ic]);break}Ab&~we&&a.g("warning: "+q(Ab)+" exceeds "+gc+"-byte value");var vf=xe.call(a,hc);a.g("changing "+Z(hc.B)+" from 0x"+q(vf,ze)+" to 0x"+q(Ab,ze));ye.call(a,hc,Ab,gc)}}break;case "f":Re(a,f[1]);break;case "g":a:{var Be=f[1],wf=b;if(void 0!==Be){var Uc=Y(a,Be,!0);if(!Uc)break a;
De;if(Ma=Ce)break}if(!Ma||null==Ma)break;var Fe=null;if("ks"==wf){var Ge=Ma.match(/[0-9A-F]+$/);Ge&&(Fe=Se(a,Ge[0]))}Ma=ga(Ma,50)+" ;"+(Fe||"stack="+Z(Bb.A));a.g(Ma);Zc++}Zc||a.g("no return addresses found")}break;case "l":if("ln"==f[0]){Se(a,f[1],!0);break}break;case "m":a:{var wa,xa=null,A=f[1];"?"==A&&(A=void 0);if(void 0!==A){var Na=0;if("all"==A)Na=1610481663,A=null;else if("on"==A)xa=!0,A=null;else if("off"==A)xa=!1,A=null;else{"keys"==A&&(A="key");"kbd"==A&&(A="keyboard");for(wa in Ld)if(A== Td(a,Uc,wf);a.Ea(a.A,Uc,!0)}a.La(!0)||c||a.g("cpu busy or unavailable, run command ignored")}break;case "h":var Vc;a.w.ia?(Vc="halting",a.ea()):Vc="already halted";c||a.g(Vc);break;case "i":if("if"==f[0]){var Wc;var Bb=b.substr(2),Bb=ha(Bb);Sd(a,Bb)?(c||a.g("true: "+Bb),Wc=!0):(c||a.g("false: "+Bb),Wc=!1);Wc||(d=!1);break}var Xc=f[1];if(Xc&&"?"!=Xc){var Yc=Me(a,Xc);if(void 0!==Yc){var xf=xb(a.C,Yc);a.g(r(Yc)+": "+("0x"+q(xf,2)))}}else a.g("input commands:"),a.g("\ti [p]\tread port [p]"),a.g("warning: port accesses can affect hardware state");
wa){Na=Ld[wa];xa=!!(a.fa&Na);break}if(!Na){a.g("unknown message category: "+A);break a}}Na&&("on"==f[2]?(a.fa|=Na,xa=!0):"off"==f[2]&&(a.fa&=~Na,xa=!1))}var zf=0,Fa="";for(wa in Ld)if(!A||A==wa){var Af=!!(a.fa&Ld[wa]);if(null===xa||xa==Af)Fa&&(Fa+=","),++zf%10||(Fa+="\n\t"),"key"==wa&&(wa="keys"),Fa+=wa}void 0===A&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==xa?xa?"messages on: ":"messages off: ":"message categories:\n\t")+(Fa||"none"));Fd(a)}break;case "o":var ad= break;case "k":var yf=f[0];if("?"==f[1])a.g("stack trace commands:"),a.g("\tk\tshow frame addresses"),a.g("\tks\tshow symbol information");else{var Zc=0,Ce=W(),Cb=W(a.b.ba);for(a.g("stack trace for "+Z(Cb.B));10>Zc;){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(0<kc.indexOf("CALL")){var Fe=kc.indexOf(" ");if(Db+(kc.indexOf(" ",Fe+1)-Fe-1)/2==Ee){De=kc;break}}}Db--}jc.B=
f[1],Bf=f[2];if(ad&&"?"!=ad){var bd=Le(a,ad,"port #"),cd=Le(a,Bf);void 0!==bd&&void 0!==cd&&(Jb(a.B,bd,cd),a.g(r(bd)+": "+("0x"+p(cd,2))))}else a.g("output commands:"),a.g("\to [p] [b]\twrite byte [b] to port [p]"),a.g("warning: port accesses can affect hardware state");break;case "p":if("print"==f[0]){Te(a,b.substr(5));break}var He="pr"==f[0]?1:0,Cf=1+He;if(a.ba)a.g("step in progress");else{var dd=V(a.b.J);switch(a.U(dd)){case 205:a.ba=Cf,Nd(dd,3)}a.ba?(a.Ca(a.w,dd,!0),a.Ja()||(a.s&&a.s.jb(),a.ba= Ee;if(La=De)break}if(!La||null==La)break;var Ge=null;if("ks"==yf){var He=La.match(/[0-9A-F]+$/);He&&(Ge=Te(a,He[0]))}La=ga(La,50)+" ;"+(Ge||"stack="+Z(Cb.B));a.g(La);Zc++}Zc||a.g("no return addresses found")}break;case "l":if("ln"==f[0]){Te(a,f[1],!0);break}break;case "m":a:{var ua,va=null,D=f[1];"?"==D&&(D=void 0);if(void 0!==D){var Ma=0;if("all"==D)Ma=1610481663,D=null;else if("on"==D)va=!0,D=null;else if("off"==D)va=!1,D=null;else{"keys"==D&&(D="key");"kbd"==D&&(D="keyboard");for(ua in Md)if(D==
0)):Ue(a,He?"tr":"t")}break;case "r":if("reset"==b){a.s&&a.s.reset();break}$d(a,f);break;case "t":Ue(a,f[0],f[1]);break;case "u":ae(a,f[1],f[2],8);break;case "v":if("var"==f[0]){Re(a,b.substr(3))||(d=!1);break}a.g("PC8080 version 1.21.7 ("+a.b.Pa+",RELEASE"+(nb?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(oa());break;case "x":a:if(f[1]&&"?"!=f[1])switch(f[1]){case "cs":var Db;void 0!==f[3]&&(Db=+f[3]);switch(f[2]){case "int":a.b.i.Ra=Db;break;case "start":a.b.i.cb=Db;break;case "stop":a.b.i.Ta=Db;break; ua){Ma=Md[ua];va=!!(a.ga&Ma);break}if(!Ma){a.g("unknown message category: "+D);break a}}Ma&&("on"==f[2]?(a.ga|=Ma,va=!0):"off"==f[2]&&(a.ga&=~Ma,va=!1))}var Bf=0,Ea="";for(ua in Md)if(!D||D==ua){var Cf=!!(a.ga&Md[ua]);if(null===va||va==Cf)Ea&&(Ea+=","),++Bf%10||(Ea+="\n\t"),"key"==ua&&(ua="keys"),Ea+=ua}void 0===D&&a.g("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.g((null!==va?va?"messages on: ":"messages off: ":"message categories:\n\t")+(Ea||"none"));Fd(a)}break;case "o":var ad=
default:a.g("unknown cs option");break a}void 0!==Db&&oc(a.b);a.g("checksums "+(a.b.u.Ma?"enabled":"disabled"));break;case "sp":void 0!==f[2]&&(tc(a.b,+f[2])||a.g("warning: using 1x multiplier, previous target not reached"));a.g("target speed: "+(a.b.i.Fa.toFixed(2)+"Mhz")+" ("+a.b.i.Ha+"x)");break;default:a.g("unknown option: "+f[1])}else a.g("execution options:"),a.g("\tcs int #\tset checksum cycle interval to #"),a.g("\tcs start #\tset checksum cycle start count to #"),a.g("\tcs stop #\tset checksum cycle stop count to #"), f[1],Df=f[2];if(ad&&"?"!=ad){var bd=Me(a,ad,"port #"),cd=Me(a,Df);void 0!==bd&&void 0!==cd&&(Hb(a.C,bd,cd),a.g(r(bd)+": "+("0x"+q(cd,2))))}else a.g("output commands:"),a.g("\to [p] [b]\twrite byte [b] to port [p]"),a.g("warning: port accesses can affect hardware state");break;case "p":if("print"==f[0]){Ve(a,b.substr(5));break}var Ie="pr"==f[0]?1:0,Ef=1+Ie;if(a.fa)a.g("step in progress");else{var dd=W(a.b.K);switch(a.V(dd)){case 205:a.fa=Ef,Od(dd,3)}a.fa?(a.Ea(a.A,dd,!0),a.La()||(a.u&&a.u.kb(),a.fa=
a.g("\tsp #\t\tset speed multiplier to #");break;case "?":if(f[1]){Te(a,b.substr(1));break}var Eb="commands:",ed;for(ed in Hd)Eb+="\n"+ga(ed,7)+Hd[ed];od(a)||(Eb+="\nnote: frequency/history disabled if no exec breakpoints");a.g(Eb);break;default:a.g("unknown command: "+b),d=!1}}}catch(Ie){a.g("debugger error: "+(Ie.stack||Ie.message)),d=!1}return d}function pc(a,b,c){b=Td(a,b,c);for(var d in b)if(!fe(a,b[d]))return!1;return!0} 0)):We(a,Ie?"tr":"t")}break;case "r":if("reset"==b){a.u&&a.u.reset();break}ae(a,f);break;case "s":Ue(a,f);break;case "t":We(a,f[0],f[1]);break;case "u":be(a,f[1],f[2],8);break;case "v":if("var"==f[0]){Se(a,b.substr(3))||(d=!1);break}a.g("PC8080 version 1.21.7 ("+a.b.Ra+",RELEASE"+(mb?",TYPEDARRAYS":",LONGARRAYS")+")");a.g(oa());break;case "?":if(f[1]){Ve(a,b.substr(1));break}var Eb="commands:",ed;for(ed in Hd)Eb+="\n"+ga(ed,7)+Hd[ed];nd(a)||(Eb+="\nnote: frequency/history disabled if no exec breakpoints");
Ja(function(){for(var a=z(document,"pc8080","debugger"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Dd(d);db(d,c)}});function G(a,b,c){this.id=a.id;this.key=We(a,b,c);this.C=a.C;Xe(this,a.Ob)}function We(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a} a.g(Eb);break;default:a.g("unknown command: "+b),d=!1}}}catch(Je){a.g("debugger error: "+(Je.stack||Je.message)),d=!1}return d}function nc(a,b,c){b=Ud(a,b,c);for(var d in b)if(!ge(a,b[d]))return!1;return!0}Ia(function(){for(var a=A(document,"pc8080","debugger"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Cd(d);$a(d,c)}});function J(a,b,c){this.id=a.id;this.key=Ye(a,b,c);this.D=a.D;Ze(this,a.Qb)}
G.prototype={constructor:G,value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Xe(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}}; function Ye(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
function Xe(a,b){a[a.id]={};b&&H(a,"parms",b);a.b=!1}function Ye(a){var b=!0;if(ya()){var c=JSON.stringify(a[a.id]);Aa(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Ze(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function $e(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:ya()&&(b=za(a.key))?(a[a.id]=b,a.b=!0):!1}function af(a,b){return a[a.id][b]||null}function H(a,b,c){try{a[a.id][b]=c}catch(d){}} J.prototype={constructor:J,value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Ze(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}};
function bf(a,b,c){v.call(this,"Computer",a,bf,67108864);this.u.ga=!1;cf(this,b);this.ba=mc(this,"autoPower",a);this.D=0;this.ra=a.busWidth||a.buswidth;this.s=df;this.W=null;this.I=this.qa=!1;this.va=mc(this,"url")||"";(Math.random()+.1).toString(36);this.w=ef(this);if(this.b=$a("CPU",this.id)){this.C=$a("Debugger",this.id);this.Z=[];for(b=null;b=qb(this,"Video",b);)this.Z.push(b);this.B=new sb({id:this.Eb+".bus",buswidth:this.ra},this.b,this.C);var d,e=Za(this.id);if((this.G=$a("Panel",this.id))&& function Ze(a,b){a[a.id]={};b&&K(a,"parms",b);a.b=!1}function $e(a){var b=!0;if(wa()){var c=JSON.stringify(a[a.id]);ya(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function af(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function bf(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:wa()&&(b=xa(a.key))?(a[a.id]=b,a.b=!0):!1}function cf(a,b){return a[a.id][b]||null}function K(a,b,c){try{a[a.id][b]=c}catch(d){}}
this.G.Da)for(b=0;b<e.length;b++)d=e[b],d.ka=this.G.ka,d.g=this.G.g,d.Da=this.G.Da;for(b=0;b<e.length;b++)d=e[b],d.za&&d.za(this,this.B,this.b,this.C);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.T=d:this.s=parseInt(d,10));var f;if(a=mc(this,"state")||(f=!0,a.state))b=this.ea=a,f||(this.I=!0,this.s=df),this.s&&(this.Y=new G(this,ff),$e(this.Y)?b=null:delete this.Y);!b&&this.s&&(b=gf(this))&&(this.I=!0);if(b){var h=this;ma(b,null,!0,function(a,b,c){c?(h.T=null,h.I=!1,h.ka("Unable to load machine state from server (error "+ function df(a,b,c){u.call(this,"Computer",a,df,67108864);this.w.ha=!1;ef(this,b);this.ca=bc(this,"autoPower",a);this.F=0;this.sa=a.busWidth||a.buswidth;this.u=ff;this.X=null;this.J=this.ra=!1;this.ta=bc(this,"url")||"";(Math.random()+.1).toString(36);this.A=gf(this);if(this.b=Za("CPU",this.id)){this.D=Za("Debugger",this.id);this.aa=[];for(b=null;b=pb(this,"Video",b);)this.aa.push(b);this.C=new rb({id:this.Hb+".bus",buswidth:this.sa},this.b,this.D);var d,e=Ya(this.id);if((this.H=Za("Panel",this.id))&&
c+(b?": "+ha(b):"")+")")):(h.W=b,h.qa=!0);B(h)})}else B(this);this.R.power||(this.ba=!0);!c&&this.ba&&hf(this,this.hb)}else t("Unable to find CPU component")}x(bf);var ff="1.21.7",df=0;function cf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.S=b} this.H.Fa)for(b=0;b<e.length;b++)d=e[b],d.la=this.H.la,d.g=this.H.g,d.Fa=this.H.Fa;for(b=0;b<e.length;b++)d=e[b],d.Aa&&d.Aa(this,this.C,this.b,this.D);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.U=d:this.u=parseInt(d,10));var f;if(a=bc(this,"state")||(f=!0,a.state))b=this.fa=a,f||(this.J=!0,this.u=ff),this.u&&(this.Z=new J(this,hf),bf(this.Z)?b=null:delete this.Z);!b&&this.u&&(b=jf(this))&&(this.J=!0);if(b){var h=this;ma(b,null,!0,function(a,b,c){c?(h.U=null,h.J=!1,h.la("Unable to load machine state from server (error "+
function mc(a,b,c){var d=b.toLowerCase(),d=Sa[b]||Sa[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function hf(a,b,c){for(var d=Za(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!lb(f)){lb(f,function(){hf(a,b,c)});return}}b.call(a,c)} c+(b?": "+ha(b):"")+")")):(h.X=b,h.ra=!0);E(h)})}else E(this);this.S.power||(this.ca=!0);!c&&this.ca&&kf(this,this.ib)}else t("Unable to find CPU component")}x(df);var hf="1.21.7",ff=0;function ef(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.T=b}
function jf(a,b){var c=new G(a,ff,"validate");if($e(c)&&Ze(c)){var d=af(c,"timestamp"),e=b?af(b,"timestamp"):"unknown";d!=e&&(a.ka("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}m=bf.prototype; function bc(a,b,c){var d=b.toLowerCase(),d=Ra[b]||Ra[d];void 0===d&&a.T&&(d=a.T[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function kf(a,b,c){for(var d=Ya(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!kb(f)){kb(f,function(){kf(a,b,c)});return}}b.call(a,c)}
m.hb=function(a){void 0===a&&(a=this.s||(this.W?1:df));if(!this.D){this.D++;var b=!1,c=!1;this.pa=!1;var d=this.Y||new G(this,ff);if(-1==a)b=!0;else if(a>df){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"!= function lf(a,b){var c=new J(a,hf,"validate");if(bf(c)&&af(c)){var d=cf(c,"timestamp"),e=b?cf(b,"timestamp"):"unknown";d!=e&&(a.la("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}m=df.prototype;
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;f<e.length;f++)h=e[f],h!==this&&h!=this.b&&(c=lf(this,h,d,b,c));b=[d,a,c];-1!=a?hf(this,this.Gb,b):this.Gb(b)}}; m.ib=function(a){void 0===a&&(a=this.u||(this.X?1:ff));if(!this.F){this.F++;var b=!1,c=!1;this.pa=!1;var d=this.Z||new J(this,hf);if(-1==a)b=!0;else if(a>ff){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"!=
function lf(a,b,c,d,e){if(!b.u.ga){b.u.ga=!0;if(b.ua){var f=null;e&&((f=af(c,b.id))||(f=af(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ua(f,d)&&f&&(t("Unable to restore state for "+b.type),a.ea&&!a.qa?(c.clear(),a.s=df,window&&window.location.reload()):a.pa=!0,b.ua(null),e=!1)}if(!d&&b.Ab)for(a=b.Ab.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e} 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;f<e.length;f++)h=e[f],h!==this&&h!=this.b&&(c=nf(this,h,d,b,c));b=[d,a,c];-1!=a?kf(this,this.Gb,b):this.Gb(b)}};
m.Gb=function(a){var b=a[0],c=0>a[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 <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>"),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 nf(a,b,c,d,e){if(!b.w.ha){b.w.ha=!0;if(b.wa){var f=null;e&&((f=cf(c,b.id))||(f=cf(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.wa(f,d)&&f&&(t("Unable to restore state for "+b.type),a.fa&&!a.ra?(c.clear(),a.u=ff,window&&window.location.reload()):a.pa=!0,b.wa(null),e=!1)}if(!d&&b.Db)for(a=b.Db.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
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)}} m.Gb=function(a){var b=a[0],c=0>a[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 <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>"),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 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;k<g.length;k++){var l=g[k];l.u.ga&&(l.ta&&(d=l.ta(b,c),"object"===typeof d&&H(f,l.id,d)),c&&(l.u.ga=!1,!1===d&&(e=null)))}e&&(c?(g=d= 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)}}
!1,b?(a.w&&mf(a,a.w,f.toString()),Ye(h)&&Ye(f)||(e=null,d=g=!0)):a.s&&(d=!0,g=3==a.s),d&&f.clear(g)):e=f.toString());c&&(a.u.ga=!1,b=a.R.power)&&(b.textContent="Power");a.D=0;return e}m.reset=function(){this.B&&this.B.reset&&(this.C&&ib(this,0)&&this.C.message("Resetting "+this.B.type,void 0),this.B.reset());for(var a=Za(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.B&&c.reset&&(this.C&&ib(this,0)&&this.C.message("Resetting "+c.type,void 0),c.reset())}}; 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;k<g.length;k++){var l=g[k];l.w.ha&&(l.va&&(d=l.va(b,c),"object"===typeof d&&K(f,l.id,d)),c&&(l.w.ha=!1,!1===d&&(e=null)))}e&&(c?(g=d=
m.start=function(a,b){for(var c=Za(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};m.stop=function(a,b){for(var c=Za(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}}; !1,b?(a.A&&of(a,a.A,f.toString()),$e(h)&&$e(f)||(e=null,d=g=!0)):a.u&&(d=!0,g=3==a.u),d&&f.clear(g)):e=f.toString());c&&(a.w.ha=!1,b=a.S.power)&&(b.textContent="Power");a.F=0;return e}m.reset=function(){this.C&&this.C.reset&&(this.D&&hb(this,0)&&this.D.message("Resetting "+this.C.type,void 0),this.C.reset());for(var a=Ya(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.C&&c.reset&&(this.D&&hb(this,0)&&this.D.message("Resetting "+c.type,void 0),c.reset())}};
m.ma=function(a,b,c){var d=this;switch(b){case "power":return this.R[b]=c,c.onclick=function(){d.D||(d.u.ga?Ve(d,!1,!0):hf(d,d.hb))},!0;case "reset":return this.R[b]=c,c.onclick=function(){if(d.u.ga&&!d.D)if(d.s&&!d.T){var a=pa("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Ve(d,a,!0);!a&&d.ea?window&&window.location.reload():d.hb(df)}else d.reset(),d.b&&qc(d.b)},!0;case "save":if(da(na(),"pcjs.org")){c.parentNode.removeChild(c); m.start=function(a,b){for(var c=Ya(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};m.stop=function(a,b){for(var c=Ya(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
break}this.R[b]=c;c.onclick=function(){var a=ef(d,!0);if(a){var b=!!(d.s&&!d.T||d.ea),c=Ve(d,b);b?mf(d,a,c):d.ka("Resume disabled, machine state not saved")}};return!0}return!1}; m.na=function(a,b,c){var d=this;switch(b){case "power":return this.S[b]=c,c.onclick=function(){d.F||(d.w.ha?Xe(d,!1,!0):kf(d,d.ib))},!0;case "reset":return this.S[b]=c,c.onclick=function(){if(d.w.ha&&!d.F)if(d.u&&!d.U){var a=pa("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Xe(d,a,!0);!a&&d.fa?window&&window.location.reload():d.ib(ff)}else d.reset(),d.b&&oc(d.b)},!0;case "save":if(da(na(),"pcjs.org")){c.parentNode.removeChild(c);
function ef(a,b){var c=a.w;c||(c=za("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=nf(a,c))||a.ka("The user ID is invalid."))):b&&a.ka("Browser local storage is not available"));return c} break}this.S[b]=c;c.onclick=function(){var a=gf(d,!0);if(a){var b=!!(d.u&&!d.U||d.fa),c=Xe(d,b);b?of(d,a,c):d.la("Resume disabled, machine state not saved")}};return!0}return!1};
function nf(a,b){a.w=null;var c=ma(na()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(Aa("user",c.data),a.w=c.data)}catch(e){t(e.message+" ("+d+")")}return a.w}function gf(a){var b=null;a.w&&(b=na()+"/api/v1/user?req=load&user="+a.w+"&state="+We(a,ff));return b} function gf(a,b){var c=a.A;c||(c=xa("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=pf(a,c))||a.la("The user ID is invalid."))):b&&a.la("Browser local storage is not available"));return c}
function mf(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=We(a,ff);d.data=c;b=ma(na()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.ka("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.ka(c),Aa("user",""),a.w=null)}} function pf(a,b){a.A=null;var c=ma(na()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(ya("user",c.data),a.A=c.data)}catch(e){t(e.message+" ("+d+")")}return a.A}function jf(a){var b=null;a.A&&(b=na()+"/api/v1/user?req=load&user="+a.A+"&state="+Ye(a,hf));return b}
function qb(a,b,c){a=Za(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}m.jb=function(){};m.oa=function(a){this.b&&this.b.oa(a);this.G&&this.G.oa(a)};function wc(a,b){for(var c=0;c<a.Z.length;c++){var d=a.Z[c];b&1?(d=d.b,d.w=d.w&-8|10):(d=d.b,d.w=d.w&-8|9)}} function of(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Ye(a,hf);d.data=c;b=ma(na()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.la("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.la(c),ya("user",""),a.A=null)}}
Ja(function(){for(var a=z(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=y(c),c=z(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=y(f),h=new bf(h,d,!0);db(h,f);h.ba&&hf(h,h.hb)}});Ea.show.push(function(){for(var a=z(document,"pc8080","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=$a("Computer",c.id))&&c.na&&!c.u.ga&&c.hb(-1)}}); function pb(a,b,c){a=Ya(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}m.kb=function(){};m.qa=function(a){this.b&&this.b.qa(a);this.H&&this.H.qa(a)};function uc(a,b){for(var c=0;c<a.aa.length;c++){var d=a.aa[c];b&1?(d=d.b,d.A=d.A&-8|10):(d=d.b,d.A=d.A&-8|9)}}
Ea.exit.push(function(){for(var a=z(document,"pc8080","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=$a("Computer",c.id))&&c.u.ga&&Ve(c,!(!c.s||c.T),!0)}});var of=0;function pf(a,b,c,d,e,f){e("Loading "+a+"...");ma(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):Df(g,a,b,c,d,e,f)})} Ia(function(){for(var a=A(document,"pc8080-machine"),b=0;b<a.length;b++)for(var c=a[b],d=y(c),c=A(c,"pc8080","computer"),e=0;e<c.length;e++){var f=c[e],h=y(f),h=new df(h,d,!0);$a(h,f);h.ca&&kf(h,h.ib)}});Ca.show.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=Za("Computer",c.id))&&c.oa&&!c.w.ha&&c.ib(-1)}});
function Df(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){Ya(c,b,a);var g=b;g&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+g+'"}';"object"==typeof resources&&(g=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2")); Ca.exit.push(function(){for(var a=A(document,"pc8080","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=Za("Computer",c.id))&&c.w.ha&&Xe(c,!(!c.u||c.U),!0)}});var qf=0;function rf(a,b,c,d,e,f){e("Loading "+a+"...");ma(a,null,!0,function(h,g,k){k?(g||(g="unable to load "+a+" ("+k+")"),f(g,null)):Ff(g,a,b,c,d,e,f)})}
g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\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<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?Ef(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),null)} function Ff(a,b,c,d,e,f,h){function g(a,f){if(f)h(f,null);else{if(c){Xa(c,b,a);var g=b;g&&0>g.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+g+'"}';"object"==typeof resources&&(g=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pc8080$2"));
function Ef(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/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]*/, g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\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<a.length?a.substr(0,255)+"...":a);h(a,g)}}a?e?Gf(a,f,g):g(a,null):h("no data"+(b?" for file: "+b:""),null)}
"");a=a.replace(d[0],h);Ef(a,b,c)}})}else c(a,null)} function Gf(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/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]*/,
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|| "");a=a.replace(d[0],h);Gf(a,b,c)}})}else c(a,null)}
(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: "+ 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||
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; (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: "+
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)} 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 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]*<disk [^>]*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, 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)}
"&#xA9;"),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 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]*<disk [^>]*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,
"&#xA9;"),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+='<div id="'+f+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+h+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",t(c)):t("Missing XML/XSL resources")} c+='<div id="'+f+'"></div>\n',c+="...\n",c+='<script type="text/javascript" src="'+h+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",t(c)):t("Missing XML/XSL resources")}
window.savePC=function(a,b,c){var d=$a("Computer",a),e=$a("Debugger",a);if(d){var f=Ve(d,!0),h=d.S?JSON.stringify(d.S):null;b||(b="/versions/pcjs/1.21.7/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,Ob:h}))return!0;ma(b,null,!0,function(c,d,e){Gf(c,d,e,[a,ba(b,!0),h,f])});return!0}t("Unable to identify machine '"+a+"'");return!1};})(); window.savePC=function(a,b,c){var d=Za("Computer",a),e=Za("Debugger",a);if(d){var f=Xe(d,!0),h=d.T?JSON.stringify(d.T):null;b||(b="/versions/pcjs/1.21.7/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,Qb:h}))return!0;ma(b,null,!0,function(c,d,e){If(c,d,e,[a,ba(b,!0),h,f])});return!0}t("Unable to identify machine '"+a+"'");return!1};})();