diff --git a/modules/pc8080/lib/cpudef.js b/modules/pc8080/lib/cpudef.js index 6002ff022..ec6dce7fa 100644 --- a/modules/pc8080/lib/cpudef.js +++ b/modules/pc8080/lib/cpudef.js @@ -69,7 +69,7 @@ var CPUDef = { BIT5: 0x0020, // bit 5: reserved, always clear ZF: 0x0040, // bit 6: Zero flag SF: 0x0080, // bit 7: Sign flag - ALL: 0x00D5, // CF, PF, AF, ZF, SF + ALL: 0x00D5, // all "arithmetic" flags (CF, PF, AF, ZF, SF) MASK: 0x00FF, // IF: 0x0200 // bit 9: Interrupt flag (for internal use only) }, @@ -113,18 +113,19 @@ var CPUDef = { }; /* - * Some PS flags are stored directly in regPS, hence the "direct" designation. + * These are the internal PS bits (outside of PS.MASK) that getPS() and setPS() can get and set, + * but which cannot be seen with any of the documented instructions. */ -CPUDef.PS.DIRECT = (CPUDef.PS.IF); +CPUDef.PS.INTERNAL = (CPUDef.PS.IF); /* - * However, PS "arithmetic" flags are NOT stored in regPS; they are maintained across - * separate result registers, hence the "indirect" designation. + * PS "arithmetic" flags are NOT stored in regPS; they are maintained across separate result registers, + * hence the RESULT designation. */ -CPUDef.PS.INDIRECT = (CPUDef.PS.CF | CPUDef.PS.PF | CPUDef.PS.AF | CPUDef.PS.ZF | CPUDef.PS.SF); +CPUDef.PS.RESULT = (CPUDef.PS.CF | CPUDef.PS.PF | CPUDef.PS.AF | CPUDef.PS.ZF | CPUDef.PS.SF); /* - * These are the default "always set" PS bits for the 8080. + * These are the "always set" PS bits for the 8080. */ CPUDef.PS.SET = (CPUDef.PS.BIT1); diff --git a/modules/pc8080/lib/cpuops.js b/modules/pc8080/lib/cpuops.js index d3f23d153..d7578c336 100644 --- a/modules/pc8080/lib/cpuops.js +++ b/modules/pc8080/lib/cpuops.js @@ -2703,9 +2703,7 @@ CPUDef.opRP = function() */ CPUDef.opPOPSW = function() { - var w = this.popWord(); - this.setPS(w); - this.regA = w >> 8; + this.setPSW(this.popWord()); this.nStepCycles -= 10; }; @@ -2755,7 +2753,7 @@ CPUDef.opCP = function() */ CPUDef.opPUPSW = function() { - this.pushWord((this.getPS() & 0xff) | (this.regA << 8)); + this.pushWord(this.getPSW()); this.nStepCycles -= 11; }; diff --git a/modules/pc8080/lib/cpusim.js b/modules/pc8080/lib/cpusim.js index ab2c6fec2..e0a413ae8 100644 --- a/modules/pc8080/lib/cpusim.js +++ b/modules/pc8080/lib/cpusim.js @@ -162,8 +162,7 @@ CPUSim.prototype.resetRegs = function() this.setPC(this.addrReset); /* - * This resets the Processor Status flags (regPS), along with all the internal "result registers"; - * we've taken care to ensure that both CPL and IOPL are initialized before this first setPS() call. + * This resets the Processor Status flags (regPS), along with all the internal "result registers". */ this.setPS(0); @@ -415,6 +414,16 @@ CPUSim.prototype.setPC = function(off) this.regPC = off & 0xffff; }; +/** + * clearCF() + * + * @this {CPUSim} + */ +CPUSim.prototype.clearCF = function() +{ + this.resultZeroCarry &= 0xff; +}; + /** * getCF() * @@ -426,121 +435,6 @@ CPUSim.prototype.getCF = function() return (this.resultZeroCarry & 0x100)? CPUDef.PS.CF : 0; }; -/** - * getPF() - * - * @this {CPUSim} - * @return {number} 0 or CPUDef.PS.PF - */ -CPUSim.prototype.getPF = function() -{ - return (CPUDef.PARITY[this.resultParitySign & 0xff])? CPUDef.PS.PF : 0; -}; - -/** - * getAF() - * - * @this {CPUSim} - * @return {number} 0 or CPUDef.PS.AF - */ -CPUSim.prototype.getAF = function() -{ - return ((this.resultParitySign ^ this.resultAuxOverflow) & 0x10)? CPUDef.PS.AF : 0; -}; - -/** - * getZF() - * - * @this {CPUSim} - * @return {number} 0 or CPUDef.PS.ZF - */ -CPUSim.prototype.getZF = function() -{ - return (this.resultZeroCarry & 0xff)? 0 : CPUDef.PS.ZF; -}; - -/** - * getSF() - * - * @this {CPUSim} - * @return {number} 0 or CPUDef.PS.SF - */ -CPUSim.prototype.getSF = function() -{ - return (this.resultParitySign & 0x80)? CPUDef.PS.SF : 0; -}; - -/** - * getIF() - * - * @this {CPUSim} - * @return {number} 0 or CPUDef.PS.IF - */ -CPUSim.prototype.getIF = function() -{ - return (this.regPS & CPUDef.PS.IF); -}; - -/** - * clearCF() - * - * @this {CPUSim} - */ -CPUSim.prototype.clearCF = function() -{ - this.resultZeroCarry &= 0xff; -}; - -/** - * clearPF() - * - * @this {CPUSim} - */ -CPUSim.prototype.clearPF = function() -{ - if (this.getPF()) this.resultParitySign ^= 0x1; -}; - -/** - * clearAF() - * - * @this {CPUSim} - */ -CPUSim.prototype.clearAF = function() -{ - this.resultAuxOverflow = (this.resultParitySign & 0x10) | (this.resultAuxOverflow & ~0x10); -}; - -/** - * clearZF() - * - * @this {CPUSim} - */ -CPUSim.prototype.clearZF = function() -{ - this.resultZeroCarry |= 0xff; -}; - -/** - * clearSF() - * - * @this {CPUSim} - */ -CPUSim.prototype.clearSF = function() -{ - if (this.getSF()) this.resultParitySign ^= 0xc0; -}; - -/** - * clearIF() - * - * @this {CPUSim} - */ -CPUSim.prototype.clearIF = function() -{ - this.regPS &= ~CPUDef.PS.IF; -}; - /** * setCF() * @@ -551,71 +445,6 @@ CPUSim.prototype.setCF = function() this.resultZeroCarry |= 0x100; }; -/** - * setPF() - * - * @this {CPUSim} - */ -CPUSim.prototype.setPF = function() -{ - if (!this.getPF()) this.resultParitySign ^= 0x1; -}; - -/** - * setAF() - * - * @this {CPUSim} - */ -CPUSim.prototype.setAF = function() -{ - this.resultAuxOverflow = (~this.resultParitySign & 0x10) | (this.resultAuxOverflow & ~0x10); -}; - -/** - * setZF() - * - * @this {CPUSim} - */ -CPUSim.prototype.setZF = function() -{ - this.resultZeroCarry &= ~0xff; -}; - -/** - * setSF() - * - * @this {CPUSim} - */ -CPUSim.prototype.setSF = function() -{ - if (!this.getSF()) this.resultParitySign ^= 0xc0; -}; - -/** - * setIF() - * - * @this {CPUSim} - */ -CPUSim.prototype.setIF = function() -{ - this.regPS |= CPUDef.PS.IF; -}; - -/** - * updateAF(fAuxCarry) - * - * @this {CPUSim} - * @param {boolean} fAuxCarry - */ -CPUSim.prototype.updateAF = function(fAuxCarry) -{ - if (fAuxCarry) { - this.setAF(); - } else { - this.clearAF(); - } -}; - /** * updateCF(fCarry) * @@ -631,6 +460,176 @@ CPUSim.prototype.updateCF = function(fCarry) } }; +/** + * clearPF() + * + * @this {CPUSim} + */ +CPUSim.prototype.clearPF = function() +{ + if (this.getPF()) this.resultParitySign ^= 0x1; +}; + +/** + * getPF() + * + * @this {CPUSim} + * @return {number} 0 or CPUDef.PS.PF + */ +CPUSim.prototype.getPF = function() +{ + return (CPUDef.PARITY[this.resultParitySign & 0xff])? CPUDef.PS.PF : 0; +}; + +/** + * setPF() + * + * @this {CPUSim} + */ +CPUSim.prototype.setPF = function() +{ + if (!this.getPF()) this.resultParitySign ^= 0x1; +}; + +/** + * clearAF() + * + * @this {CPUSim} + */ +CPUSim.prototype.clearAF = function() +{ + this.resultAuxOverflow = (this.resultParitySign & 0x10) | (this.resultAuxOverflow & ~0x10); +}; + +/** + * getAF() + * + * @this {CPUSim} + * @return {number} 0 or CPUDef.PS.AF + */ +CPUSim.prototype.getAF = function() +{ + return ((this.resultParitySign ^ this.resultAuxOverflow) & 0x10)? CPUDef.PS.AF : 0; +}; + +/** + * setAF() + * + * @this {CPUSim} + */ +CPUSim.prototype.setAF = function() +{ + this.resultAuxOverflow = (~this.resultParitySign & 0x10) | (this.resultAuxOverflow & ~0x10); +}; + +/** + * updateAF(fAuxCarry) + * + * @this {CPUSim} + * @param {boolean} fAuxCarry + */ +CPUSim.prototype.updateAF = function(fAuxCarry) +{ + if (fAuxCarry) { + this.setAF(); + } else { + this.clearAF(); + } +}; + +/** + * clearZF() + * + * @this {CPUSim} + */ +CPUSim.prototype.clearZF = function() +{ + this.resultZeroCarry |= 0xff; +}; + +/** + * getZF() + * + * @this {CPUSim} + * @return {number} 0 or CPUDef.PS.ZF + */ +CPUSim.prototype.getZF = function() +{ + return (this.resultZeroCarry & 0xff)? 0 : CPUDef.PS.ZF; +}; + +/** + * setZF() + * + * @this {CPUSim} + */ +CPUSim.prototype.setZF = function() +{ + this.resultZeroCarry &= ~0xff; +}; + +/** + * clearSF() + * + * @this {CPUSim} + */ +CPUSim.prototype.clearSF = function() +{ + if (this.getSF()) this.resultParitySign ^= 0xc0; +}; + +/** + * getSF() + * + * @this {CPUSim} + * @return {number} 0 or CPUDef.PS.SF + */ +CPUSim.prototype.getSF = function() +{ + return (this.resultParitySign & 0x80)? CPUDef.PS.SF : 0; +}; + +/** + * setSF() + * + * @this {CPUSim} + */ +CPUSim.prototype.setSF = function() +{ + if (!this.getSF()) this.resultParitySign ^= 0xc0; +}; + +/** + * clearIF() + * + * @this {CPUSim} + */ +CPUSim.prototype.clearIF = function() +{ + this.regPS &= ~CPUDef.PS.IF; +}; + +/** + * getIF() + * + * @this {CPUSim} + * @return {number} 0 or CPUDef.PS.IF + */ +CPUSim.prototype.getIF = function() +{ + return (this.regPS & CPUDef.PS.IF); +}; + +/** + * setIF() + * + * @this {CPUSim} + */ +CPUSim.prototype.setIF = function() +{ + this.regPS |= CPUDef.PS.IF; +}; + /** * getPS() * @@ -639,7 +638,7 @@ CPUSim.prototype.updateCF = function(fCarry) */ CPUSim.prototype.getPS = function() { - return (this.regPS & ~CPUDef.PS.INDIRECT) | (this.getSF() | this.getZF() | this.getAF() | this.getPF() | this.getCF()); + return (this.regPS & ~CPUDef.PS.RESULT) | (this.getSF() | this.getZF() | this.getAF() | this.getPF() | this.getCF()); }; /** @@ -656,8 +655,31 @@ CPUSim.prototype.setPS = function(regPS) if (regPS & CPUDef.PS.AF) this.resultAuxOverflow |= 0x10; if (!(regPS & CPUDef.PS.ZF)) this.resultZeroCarry |= 0xff; if (regPS & CPUDef.PS.SF) this.resultParitySign ^= 0xc0; - this.regPS = (this.regPS & ~CPUDef.PS.DIRECT) | (regPS & CPUDef.PS.DIRECT) | CPUDef.PS.SET; - Component.assert((regPS & CPUDef.PS.INDIRECT) == (this.getPS() & CPUDef.PS.INDIRECT)); + this.regPS = (this.regPS & ~(CPUDef.PS.RESULT | CPUDef.PS.INTERNAL)) | (regPS & CPUDef.PS.INTERNAL) | CPUDef.PS.SET; + Component.assert((regPS & CPUDef.PS.RESULT) == (this.getPS() & CPUDef.PS.RESULT)); +}; + +/** + * getPSW() + * + * @this {CPUSim} + * @return {number} + */ +CPUSim.prototype.getPSW = function() +{ + return (this.getPS() & CPUDef.PS.MASK) | (this.regA << 8); +}; + +/** + * setPSW(w) + * + * @this {CPUSim} + * @param {number} w + */ +CPUSim.prototype.setPSW = function(w) +{ + this.setPS((w & CPUDef.PS.MASK) | (this.regPS & ~CPUDef.PS.MASK)); + this.regA = w >> 8; }; /** diff --git a/modules/pc8080/lib/debugger.js b/modules/pc8080/lib/debugger.js index e58ea61e9..7ca601724 100644 --- a/modules/pc8080/lib/debugger.js +++ b/modules/pc8080/lib/debugger.js @@ -321,10 +321,15 @@ if (DEBUGGER) { Debugger.REG_HL = 0x0A; Debugger.REG_SP = 0x0B; Debugger.REG_PC = 0x0C; - Debugger.REG_PS = 0x0D; // aka PSW (aka AF if Z80-style mnemonics) + Debugger.REG_PS = 0x0D; + Debugger.REG_PSW = 0x0E; // aka AF if Z80-style mnemonics + /* + * NOTE: "PS" is the complete processor status, which includes bits like the Interrupt flag (IF), + * which is NOT the same as "PSW", which is the low 8 bits of "PS" combined with "A" in the high byte. + */ Debugger.REGS = [ - "B", "C", "D", "E", "H", "L", "M", "A", "BC", "DE", "HL", "SP", "PC", "PSW" + "B", "C", "D", "E", "H", "L", "M", "A", "BC", "DE", "HL", "SP", "PC", "PS", "PSW" ]; /* @@ -370,7 +375,7 @@ if (DEBUGGER) { Debugger.TYPE_HL = (Debugger.REG_HL << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); Debugger.TYPE_SP = (Debugger.REG_SP << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); Debugger.TYPE_PC = (Debugger.REG_PC << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); - Debugger.TYPE_PS = (Debugger.REG_PS << 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); + Debugger.TYPE_PSW = (Debugger.REG_PSW<< 8 | Debugger.TYPE_REG | Debugger.TYPE_WORD); /* * TYPE_OTHER bit definitions @@ -642,11 +647,11 @@ if (DEBUGGER) { /* 0xEE */ [Debugger.INS.XRI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xEF */ [Debugger.INS.RST, Debugger.TYPE_INT], /* 0xF0 */ [Debugger.INS.RP], - /* 0xF1 */ [Debugger.INS.POP, Debugger.TYPE_PS], + /* 0xF1 */ [Debugger.INS.POP, Debugger.TYPE_PSW], /* 0xF2 */ [Debugger.INS.JP, Debugger.TYPE_ADDR], /* 0xF3 */ [Debugger.INS.DI], /* 0xF4 */ [Debugger.INS.CP, Debugger.TYPE_ADDR], - /* 0xF5 */ [Debugger.INS.PUSH, Debugger.TYPE_PS], + /* 0xF5 */ [Debugger.INS.PUSH, Debugger.TYPE_PSW], /* 0xF6 */ [Debugger.INS.ORI, Debugger.TYPE_A | Debugger.TYPE_OPT, Debugger.TYPE_IMM | Debugger.TYPE_BYTE], /* 0xF7 */ [Debugger.INS.RST, Debugger.TYPE_INT], /* 0xF8 */ [Debugger.INS.RM], @@ -1347,8 +1352,8 @@ if (DEBUGGER) { if (off == null) { i = usr.indexOf(Debugger.REGS, sReg); } else { - i = usr.indexOf(Debugger.REGS, sReg.substr(off, 3)); - if (i < 0) i = usr.indexOf(Debugger.REGS, sReg.substr(off, 2)); + i = usr.indexOf(Debugger.REGS, sReg.substr(off, 2)); + if (i < 0) i = usr.indexOf(Debugger.REGS, sReg.substr(off, 1)); } return i; }; @@ -1382,6 +1387,7 @@ if (DEBUGGER) { case Debugger.REG_SP: case Debugger.REG_PC: case Debugger.REG_PS: + case Debugger.REG_PSW: cch = 4; break; } @@ -1442,7 +1448,10 @@ if (DEBUGGER) { n = cpu.getPC(); break; case Debugger.REG_PS: - n = (cpu.regA << 8) | (cpu.getPS() & 0xff); + n = cpu.getPS(); + break; + case Debugger.REG_PSW: + n = cpu.getPSW(); break; default: break; @@ -2581,29 +2590,29 @@ if (DEBUGGER) { { var b; switch (sFlag) { - case 'I': + case "IF": b = this.cpu.getIF(); break; - case 'S': + case "SF": b = this.cpu.getSF(); break; - case 'Z': + case "ZF": b = this.cpu.getZF(); break; - case 'A': + case "AF": b = this.cpu.getAF(); break; - case 'P': + case "PF": b = this.cpu.getPF(); break; - case 'C': + case "CF": b = this.cpu.getCF(); break; default: b = 0; break; } - return sFlag + (b? '1' : '0') + ' '; + return sFlag.charAt(0) + (b? '1' : '0') + ' '; }; /** @@ -2624,7 +2633,7 @@ if (DEBUGGER) { * * Sample 8080 register dump: * - * A=00 BC=0000 DE=0000 HL=0000 SP=0000 PSW=0002 I0 S0 Z0 A0 P0 C0 + * A=00 BC=0000 DE=0000 HL=0000 SP=0000 I0 S0 Z0 A0 P0 C0 * 0000 00 NOP * * @this {Debugger} @@ -2638,8 +2647,8 @@ if (DEBUGGER) { this.getRegOutput(Debugger.REG_DE) + this.getRegOutput(Debugger.REG_HL) + this.getRegOutput(Debugger.REG_SP) + - this.getFlagOutput('I') + this.getFlagOutput('S') + this.getFlagOutput('Z') + - this.getFlagOutput('A') + this.getFlagOutput('P') + this.getFlagOutput('C'); + this.getFlagOutput("IF") + this.getFlagOutput("SF") + this.getFlagOutput("ZF") + + this.getFlagOutput("AF") + this.getFlagOutput("PF") + this.getFlagOutput("CF"); return s; }; @@ -4131,22 +4140,25 @@ if (DEBUGGER) { case "PS": cpu.setPS(w); break; - case 'C': + case "PSW": + cpu.setPSW(w); + break; + case "CF": if (w) cpu.setCF(); else cpu.clearCF(); break; - case 'P': + case "PF": if (w) cpu.setPF(); else cpu.clearPF(); break; - case 'A': + case "AF": if (w) cpu.setAF(); else cpu.clearAF(); break; - case 'Z': + case "ZF": if (w) cpu.setZF(); else cpu.clearZF(); break; - case 'S': + case "SF": if (w) cpu.setSF(); else cpu.clearSF(); break; - case 'I': + case "IF": if (w) cpu.setIF(); else cpu.clearIF(); break; default: diff --git a/versions/pc8080/1.22.0/pc8080-dbg.js b/versions/pc8080/1.22.0/pc8080-dbg.js index 75702bce5..fa2051980 100644 --- a/versions/pc8080/1.22.0/pc8080-dbg.js +++ b/versions/pc8080/1.22.0/pc8080-dbg.js @@ -13,32 +13,32 @@ function v(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b. if(window){Pa||(Pa=window.location.search.substr(1));for(var Ra,Sa=/\+/g,Ta=/([^&=]+)=?([^&]*)/g;Ra=Ta.exec(Pa);)Qa[decodeURIComponent(Ra[1].replace(Sa," "))]=decodeURIComponent(Ra[2].replace(Sa," "))}function Ua(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 Va(a,b){b||(b=v);a.prototype=Ua(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var y=[],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=this.J?10:20>=this.J?12:24>=this.J?14:15;this.ua=1<>2;this.B=this.ua-1;this.L=this.W/this.ua|0;this.K=this.L-1;this.w=[];this.u=[];this.G=this.H=!1;this.aa=[];this.ba=[];a=new E;qb(a,this.F);this.U=Array(this.L);for(b=0;b>>a.ea;0f&&(k=f);if(g&&g.size){if(g.type==d){if(e+f<=g.D)return g.nb+=g.D-e,g.D=e,!0;if(e>=g.D+g.nb){k=g.size-(e-l);k>f&&(k=f);g.nb=e-g.D+k;e=l+a.ua;f-=k;h++;continue}}return sb(1,e,f)}e=new E(e,k,a.ua,d);qb(e,a.F,g);a.U[h++]=e;e=l+a.ua;f-=k}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+tb[d]+" at "+r(b)),!0):sb(2,b,c)}m.X=function(a){return this.U[(a&this.C)>>>this.ea].ab(a&this.B,a)}; function ub(a,b){return a.U[(b&a.C)>>>a.ea].lb(b&a.B,b)}m.Ha=function(a){var b=a&this.B,c=(a&this.C)>>>this.ea;return b!=this.B?this.U[c].Tb(b,a):this.U[c++].ab(b,a)|this.U[c&this.K].ab(0,a+1)<<8};function vb(a,b){var c=b&a.B,d=(b&a.C)>>>a.ea;return c!=a.B?a.U[d].Cb(c,b):a.U[d++].lb(c,b)|a.U[d&a.K].lb(0,b+1)<<8}m.ga=function(a,b){this.U[(a&this.C)>>>this.ea].cb(a&this.B,b&255,a)};function wb(a,b,c){a.U[(b&a.C)>>>a.ea].ob(b&a.B,c&255,b)} m.vb=function(a,b){var c=a&this.B,d=(a&this.C)>>>this.ea;c!=this.B?this.U[d].Vb(c,b&65535,a):(this.U[d++].cb(c,b&255,a),this.U[d&this.K].cb(0,b>>8&255,a+1))};function xb(a,b){if(void 0===b)return a.G=!a.G,a.G;void 0===a.w[b]&&(a.w[b]=[null,!1]);a.w[b][1]=!a.w[b][1];return a.w[b][1]} -function yb(a,b,c){for(var d=1,e=0,f=0;0>>=f)&l;if(void 0!==h){if(h[0])h[0](b,l,d);a.F&&a.H!=h[1]&&Kb(a.F,b,l)}else a.F&&(db(a.F,a,b,l,d),a.H&&Kb(a.F,b,l));f+=g<<3;b+=g;e-=g}}function sb(a,b,c){t("Memory block error ("+a+": "+q(b)+","+q(c)+")");return!1}var Lb;if(kb){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 E(a,b,c,d){this.id=Ob+=2;this.b=null;this.D=a;this.nb=b;this.size=c||0;this.type=d||Pb;this.w=d==Qb;qb(this);this.ya=this.Lb=!1;if(c)if(kb)this.G=new ArrayBuffer(c),this.H=new DataView(this.G,0,c),this.B=new Uint8Array(this.G,0,c),this.K=new Uint16Array(this.G,0,c>>1),this.b=new Int32Array(this.G,0,c>>2),Rb(this,Nb?Sb:Tb);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},fa:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},qa: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},xa:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<>8,c)},fa: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},xa:function(a,b){var c=a>>2,d=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2,d=(a&3)<<3;24>d?this.b[c]=this.b[c]&~(65535<>8);this.ya=!0},aa:function(a,b){if(this.F&&null!=this.D){var c=this.F;Yb(c,this.D+a,1,c.aa)&&c.da(!0)}return this.lb(a,b)},ia:function(a,b){if(this.F&&null!=this.D){var c=this.F;Yb(c,this.D+a,2,c.aa)&&c.da(!0)}return this.Cb(a,b)},sa:function(a,b,c){if(this.F&&null!=this.D){var d=this.F;Yb(d,this.D+a,1,d.H)&&d.da(!0)}this.w?this.C(a,b,c):this.ob(a,b,c)},Fa:function(a, -b,c){if(this.F&&null!=this.D){var d=this.F;Yb(d,this.D+a,2,d.H)&&d.da(!0)}this.w?this.C(a,b,c):this.Db(a,b,c)},Y:function(a){return this.B[a]},ba:function(a){return this.B[a]},ha:function(a){return this.H.getUint16(a,!0)},oa:function(a){return a&1?this.B[a]|this.B[a+1]<<8:this.K[a>>1]},Ea:function(a,b){this.B[a]=b;this.ya=!0},wa:function(a,b){this.B[a]=b;this.ya=!0},Ca:function(a,b){this.H.setUint16(a,b,!0);this.ya=!0},eb:function(a,b){a&1?(this.B[a]=b,this.B[a+1]=b>>8):this.K[a>>1]=b;this.ya=!0}}; +b,c){if(this.F&&null!=this.D){var d=this.F;Yb(d,this.D+a,2,d.H)&&d.da(!0)}this.w?this.C(a,b,c):this.Db(a,b,c)},Y:function(a){return this.B[a]},ba:function(a){return this.B[a]},ha:function(a){return this.H.getUint16(a,!0)},pa:function(a){return a&1?this.B[a]|this.B[a+1]<<8:this.K[a>>1]},Ea:function(a,b){this.B[a]=b;this.ya=!0},wa:function(a,b){this.B[a]=b;this.ya=!0},Ca:function(a,b){this.H.setUint16(a,b,!0);this.ya=!0},eb:function(a,b){a&1?(this.B[a]=b,this.B[a+1]=b>>8):this.K[a>>1]=b;this.ya=!0}}; function qb(a,b,c){a.F=b;a.T=a.u=0;c&&((a.T=c.T)&&Xb(a,Wb,!1),(a.u=c.u)&&Vb(a,Wb,!1))}function Zb(a,b){b?0===--a.u&&(a.cb=a.w?a.C:a.ob,a.Vb=a.w?a.J:a.Db):0===--a.T&&(a.ab=a.lb,a.Tb=a.Cb)}function Vb(a,b,c){c&&a.u||(a.cb=!a.w&&b[2]||a.C,a.Vb=!a.w&&b[3]||a.J);if(c||void 0===c)a.ob=b[2]||a.C,a.Db=b[3]||a.J}function Xb(a,b,c){c&&a.T||(a.ab=b[0]||a.L,a.Tb=b[1]||a.W);if(c||void 0===c)a.lb=b[0]||a.L,a.Cb=b[1]||a.W}function Rb(a,b){b||(b=$b);Xb(a,b,void 0);Vb(a,b,void 0)} -var $b=[],Ub=[E.prototype.fa,E.prototype.qa,E.prototype.xa,E.prototype.Ga],Wb=[E.prototype.aa,E.prototype.ia,E.prototype.sa,E.prototype.Fa];if(kb)var Tb=[E.prototype.Y,E.prototype.ha,E.prototype.Ea,E.prototype.Ca],Sb=[E.prototype.ba,E.prototype.oa,E.prototype.wa,E.prototype.eb]; +var $b=[],Ub=[E.prototype.fa,E.prototype.ra,E.prototype.xa,E.prototype.Ga],Wb=[E.prototype.aa,E.prototype.ia,E.prototype.sa,E.prototype.Fa];if(kb)var Tb=[E.prototype.Y,E.prototype.ha,E.prototype.Ea,E.prototype.Ca],Sb=[E.prototype.ba,E.prototype.pa,E.prototype.wa,E.prototype.eb]; function ac(a,b){v.call(this,"CPU",a,ac,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.$a=c;this.i.ub=0;this.i.Na=d;this.i.zb=Math.round(this.i.$a/1E4)/100;this.i.La=this.i.zb*this.i.Na;this.A.ma=!1;this.A.yb=!1;this.A.Kb=a.autoStart;this.A.Mb=!1;this.A.Ra=!1;this.i.fb=this.i.Xa=0;this.i.gb=a.csStart;this.i.Wa=a.csInterval;this.i.Ya=a.csStop;this.aa=this.Oa.bind(this);D(this)}Va(ac);var bc=["power","reset"];m=ac.prototype; -m.Ia=function(a,b,c,d){this.w=a;this.B=b;this.F=d;for(b=0;b=a.i.Xa&&(a.i.Xa+=a.i.Wa,c=!0);0<=a.i.Ya&&a.i.Ya<=uc(a)&&(a.i.Wa=a.i.Ya=-1,pc(a),a.da(),c=!0);c&&a.g(uc(a)+" cycles: checksum="+q(a.i.fb))}} -m.pa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.T[b]=c;a=!0;break;case "run":this.T[b]=c;c.onclick=function(){var a;if(a=d.w)if(a=d.w,a.A.ka)a=!0;else{var b=null,c,g=Ya(a.id);for(c=0;cc&&(c=2);var d=1;b&&1a.i.Ka/a.i.La?b=1:d=!0;a.i.Na=b;b=a.i.zb*a.i.Na;if(a.i.La!=b){a.i.La=b;b=a.i.La.toFixed(2)+"Mhz";var e=a.T.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.w&&a.w.mb()}wc(a,a.G);a.G=0;a.i.Va=ka();a.i.Ma=0;xc(a);return d} @@ -49,15 +49,15 @@ function rc(a,b){a.w&&(yc(a.w,-1),a.w.va(b))}function zc(a){this.Ua=a.model||808 m.Ob=function(){var a=this.j+this.N+this.O+this.P+this.R+this.S+this.V|0;return a=a+this.ca+this.M+Fc(this)|0}; m.save=function(){var a=new Gc(this);H(a,0,[this.j,this.N,this.O,this.P,this.R,this.S,this.V,this.ca,this.M,Fc(this)]);H(a,1,[this.u,this.H,this.i.Na]);for(var b=this.B,c=0,d=[],e=0;e>8&255;a.O=b&255}function Jc(a){return a.P<<8|a.R}function Kc(a,b){a.P=b>>8&255;a.R=b&255}function I(a){return a.S<<8|a.V} -function Lc(a,b){a.S=b>>8&255;a.V=b&255}function F(a,b){a.M=b&65535}function Mc(a){return a.I&256?1:0}function Nc(a){return lb[a.Z&255]?4:0}function Oc(a){return(a.Z^a.la)&16?16:0}function Pc(a){return a.I&255?0:64}function Qc(a){return a.Z&128?128:0}function Fc(a){return a.ra&-214|Qc(a)|Pc(a)|Oc(a)|Nc(a)|Mc(a)}function Dc(a,b){a.I=a.Z=a.la=0;b&1&&(a.I|=256);b&4||(a.Z|=1);b&16&&(a.la|=16);b&64||(a.I|=255);b&128&&(a.Z^=192);a.ra=a.ra&-513|b&512|2} +m.qa=function(a,b,c){var d=!1;switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.T[b]=c;this.Y++;d=!0;break;default:d=this.parent.qa.call(this,a,b,c)}return d};function Hc(a){return a.N<<8|a.O}function Ic(a,b){a.N=b>>8&255;a.O=b&255}function Jc(a){return a.P<<8|a.R}function Kc(a,b){a.P=b>>8&255;a.R=b&255}function I(a){return a.S<<8|a.V} +function Lc(a,b){a.S=b>>8&255;a.V=b&255}function F(a,b){a.M=b&65535}function Mc(a){return a.I&256?1:0}function Nc(a){return lb[a.Z&255]?4:0}function Oc(a){return(a.Z^a.la)&16?16:0}function Pc(a){return a.I&255?0:64}function Qc(a){return a.Z&128?128:0}function Fc(a){return a.oa&-214|Qc(a)|Pc(a)|Oc(a)|Nc(a)|Mc(a)}function Dc(a,b){a.I=a.Z=a.la=0;b&1&&(a.I|=256);b&4||(a.Z|=1);b&16&&(a.la|=16);b&64||(a.I|=255);b&128&&(a.Z^=192);a.oa=a.oa&-726|b&512|2} function Rc(a,b){a.la=a.j^b;return a.Z=(a.I=a.j+b)&255}function Sc(a,b){a.la=a.j^b;return a.Z=(a.I=a.j+b+(a.I&256?1:0))&255}function Tc(a,b){a.I=a.Z=a.la=a.j&b;(a.j|b)&8&&(a.la^=16);return a.I}function kd(a,b){a.la=b^255;b=a.Z=b+255&255;a.I=a.I&-256|b;return b}function ld(a,b){a.la=b;b=a.Z=b+1&255;a.I=a.I&-256|b;return b}function md(a,b){return a.Z=a.I=a.la=a.j|b}function J(a,b){b^=255;a.la=a.j^b;return a.Z=(a.I=a.j+b+1^256)&255} function nd(a,b){b^=255;a.la=a.j^b;return a.Z=(a.I=a.j+b+(a.I&256?0:1)^256)&255}function od(a,b){return a.Z=a.I=a.la=a.j^b}m.X=function(a){return this.B.X(a)};m.ga=function(a,b){this.B.ga(a,b)};function L(a){var b=a.X(a.M);F(a,a.M+1);return b}function N(a){var b=a.B.Ha(a.M);F(a,a.M+2);return b}function O(a){var b=a.B.Ha(a.ca);a.ca=a.ca+2&65535;return b}function Q(a,b){a.ca=a.ca-2&65535;a.B.vb(a.ca,b)} function R(a,b,c,d){d=d||2;a.T[b]&&(void 0===c&&(jb(a,"Value for "+b+" is invalid"),a.da()),c=!a.A.ma||a.A.Mb?q(c,d):"--------".substr(0,d),a.T[b].textContent!=c&&(a.T[b].textContent=c))} m.va=function(a){this.Y&&(a||!this.A.ma||this.A.Mb)&&(R(this,"A",this.j),R(this,"B",this.N),R(this,"C",this.O),R(this,"BC",Hc(this),4),R(this,"D",this.P),R(this,"E",this.R),R(this,"DE",Jc(this),4),R(this,"H",this.S),R(this,"L",this.V),R(this,"HL",I(this),4),R(this,"SP",this.ca,4),R(this,"PC",this.M,4),a=Fc(this),R(this,"PS",a,4),R(this,"IF",a&512?1:0,1),R(this,"SF",a&128?1:0,1),R(this,"ZF",a&64?1:0,1),R(this,"AF",a&16?1:0,1),R(this,"PF",a&4?1:0,1),R(this,"CF",a&1?1:0,1));if(a=this.T.speed)a.textContent= this.A.ma&&this.i.Ka?this.i.Ka.toFixed(2)+"Mhz":"Stopped"}; -m.bb=function(a){this.A.rb=!0;var b=this.A.Yb=this.F&&pd(this.F),c=a?this.A.yb?0:1:-1;this.A.yb=!1;this.C=this.b=a;do{if(this.u){var d;this.u&8&&this.ra&512?(d=199|(this.u&7)<<3,this.u&=-16,this.ra&=-513,this.L[d].call(this),d=!0):d=!1;if(d){if(!a){this.g("interrupt dispatched");break}}else if(this.u&16){this.b=0;break}}if(b){if(qd(this.F,this.M,c)){this.da();break}c=1}this.L[L(this)].call(this)}while(0>8;this.I=this.I&255|a&256;this.b-=4},rd,function(){var a;Lc(this,a=I(this)+Hc(this));this.I=this.I&255|a>>8&256;this.b-=10},function(){this.j=this.X(Hc(this));this.b-=7},function(){Ic(this,Hc(this)- 1);this.b-=5},function(){this.O=ld(this,this.O);this.b-=5},function(){this.O=kd(this,this.O);this.b-=5},function(){this.O=L(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;this.I=this.I&255|a;this.b-=4},rd,function(){Kc(this,N(this));this.b-=10},function(){this.ga(Jc(this),this.j);this.b-=7},function(){Kc(this,Jc(this)+1);this.b-=5},function(){this.P=ld(this,this.P);this.b-=5},function(){this.P=kd(this,this.P);this.b-=5},function(){this.P=L(this);this.b-=7},function(){var a=this.j<< 1;this.j=a&255|this.I>>8;this.I=this.I&255|a&256;this.b-=4},rd,function(){var a;Lc(this,a=I(this)+Jc(this));this.I=this.I&255|a>>8&256;this.b-=10},function(){this.j=this.X(Jc(this));this.b-=7},function(){Kc(this,Jc(this)-1);this.b-=5},function(){this.R=ld(this,this.R);this.b-=5},function(){this.R=kd(this,this.R);this.b-=5},function(){this.R=L(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(this.I&256|this.j)>>1;this.I=this.I&255|a;this.b-=4},rd,function(){Lc(this,N(this));this.b-=10},function(){var a= @@ -68,7 +68,7 @@ this.b-=5},function(){this.N=this.R;this.b-=5},function(){this.N=this.S;this.b-= this.N;this.b-=5},function(){this.P=this.O;this.b-=5},function(){this.b-=5},function(){this.P=this.R;this.b-=5},function(){this.P=this.S;this.b-=5},function(){this.P=this.V;this.b-=5},function(){this.P=this.X(I(this));this.b-=7},function(){this.P=this.j;this.b-=5},function(){this.R=this.N;this.b-=5},function(){this.R=this.O;this.b-=5},function(){this.R=this.P;this.b-=5},function(){this.b-=5},function(){this.R=this.S;this.b-=5},function(){this.R=this.V;this.b-=5},function(){this.R=this.X(I(this)); this.b-=7},function(){this.R=this.j;this.b-=5},function(){this.S=this.N;this.b-=5},function(){this.S=this.O;this.b-=5},function(){this.S=this.P;this.b-=5},function(){this.S=this.R;this.b-=5},function(){this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.X(I(this));this.b-=7},function(){this.S=this.j;this.b-=5},function(){this.V=this.N;this.b-=5},function(){this.V=this.O;this.b-=5},function(){this.V=this.P;this.b-=5},function(){this.V=this.R;this.b-=5},function(){this.V=this.S;this.b-= 5},function(){this.b-=5},function(){this.V=this.X(I(this));this.b-=7},function(){this.V=this.j;this.b-=5},function(){this.ga(I(this),this.N);this.b-=7},function(){this.ga(I(this),this.O);this.b-=7},function(){this.ga(I(this),this.P);this.b-=7},function(){this.ga(I(this),this.R);this.b-=7},function(){this.ga(I(this),this.S);this.b-=7},function(){this.ga(I(this),this.V);this.b-=7},function(){var a=this.M-1;if(this.J.length)for(var b=0;b>8;this.b-=10},function(){var a=N(this);Qc(this)||F(this,a);this.b-=10},function(){this.ra&=-513;this.b-=4},function(){var a=N(this);Qc(this)||(Q(this,this.M),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Fc(this)&255|this.j<<8);this.b-=11},function(){this.j=md(this,L(this));this.b-=7},function(){Q(this, -this.M);F(this,48);this.b-=11},function(){Qc(this)&&(F(this,O(this)),this.b-=6);this.b-=5},function(){this.ca=I(this)&65535;this.b-=5},function(){var a=N(this);Qc(this)&&F(this,a);this.b-=10},function(){this.ra|=512;this.b-=4},function(){var a=N(this);Qc(this)&&(Q(this,this.M),F(this,a),this.b-=6);this.b-=11},ud,function(){J(this,L(this));this.b-=7},function(){Q(this,this.M);F(this,56);this.b-=11}]; -function S(a){v.call(this,"ChipSet",a,S,32768);var b=a.model;b&&!vd[b]&&t("Unrecognized ChipSet model: "+b);this.Ua=vd[b]||wd;a.sound&&(this.W=null,window&&(this.W=window.AudioContext||window.webkitAudioContext),this.W&&new this.W);D(this)}Va(S);var wd=1978.1,vd={SI1978:wd};m=S.prototype;m.pa=function(){return!1}; +11},ud,function(){this.j=od(this,L(this));this.b-=7},function(){Q(this,this.M);F(this,40);this.b-=11},function(){Qc(this)||(F(this,O(this)),this.b-=6);this.b-=5},function(){var a=O(this);Dc(this,a&255|this.oa&-256);this.j=a>>8;this.b-=10},function(){var a=N(this);Qc(this)||F(this,a);this.b-=10},function(){this.oa&=-513;this.b-=4},function(){var a=N(this);Qc(this)||(Q(this,this.M),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Fc(this)&255|this.j<<8);this.b-=11},function(){this.j=md(this,L(this)); +this.b-=7},function(){Q(this,this.M);F(this,48);this.b-=11},function(){Qc(this)&&(F(this,O(this)),this.b-=6);this.b-=5},function(){this.ca=I(this)&65535;this.b-=5},function(){var a=N(this);Qc(this)&&F(this,a);this.b-=10},function(){this.oa|=512;this.b-=4},function(){var a=N(this);Qc(this)&&(Q(this,this.M),F(this,a),this.b-=6);this.b-=11},ud,function(){J(this,L(this));this.b-=7},function(){Q(this,this.M);F(this,56);this.b-=11}]; +function S(a){v.call(this,"ChipSet",a,S,32768);var b=a.model;b&&!vd[b]&&t("Unrecognized ChipSet model: "+b);this.Ua=vd[b]||wd;a.sound&&(this.W=null,window&&(this.W=window.AudioContext||window.webkitAudioContext),this.W&&new this.W);D(this)}Va(S);var wd=1978.1,vd={SI1978:wd};m=S.prototype;m.qa=function(){return!1}; m.Ia=function(a,b,c,d){this.B=b;this.b=c;this.F=d;this.w=a;if(this.Ua==wd){var e;a=xd;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 l;e=yd;void 0===l&&(l=0);for(var k in e)if(f=b,a=+k+l,c=e[k].bind(this),void 0!==c)for(d=+k+l;d<=a;d++)void 0!==f.u[d]?t("Output port "+r(d)+" already registered"):f.u[d]=[c,!1]}}; m.Ba=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};m.Aa=function(a){return a?this.save():!0};m.reset=function(){this.G=this.H=this.C=this.u=this.L=this.K=this.J=0};m.save=function(){var a=new Gc(this);this.Ua==wd&&H(a,0,[this.J,this.K,this.L,this.u,this.C,this.G,this.H]);return a.data()};m.restore=function(a){a=a[0];this.Ua==wd&&(this.J=a[0],this.K=a[1],this.L=a[2],this.u=a[3],this.C=a[4],this.G=a[5],this.H=a[6]);return!0};m.start=function(){};m.stop=function(){}; m.cc=function(a,b){var c=this.J;cb(this,a,null,b,"STATUS0",c);return c};m.dc=function(a,b){var c=this.K;cb(this,a,null,b,"STATUS1",c);return c};m.ec=function(a,b){var c=this.L;cb(this,a,null,b,"STATUS2",c);return c};m.bc=function(a,b){var c=this.u>>8-this.C&255;cb(this,a,null,b,"SHIFT.RESULT",c);return c};m.ic=function(a,b,c){cb(this,a,b,c,"SHIFT.COUNT",null);this.C=b};m.kc=function(a,b,c){cb(this,a,b,c,"SOUND1",null);this.G=b}; -m.jc=function(a,b,c){cb(this,a,b,c,"SHIFT.DATA",null);this.u=b<<8|this.u>>8};m.lc=function(a,b,c){cb(this,a,b,c,"SOUND2",null);this.H=b};m.mc=function(a,b,c){cb(this,a,b,c,"WATCHDOG",null)};var xd={0:S.prototype.cc,1:S.prototype.dc,2:S.prototype.ec,3:S.prototype.bc},yd={2:S.prototype.ic,3:S.prototype.kc,4:S.prototype.jc,5:S.prototype.lc,6:S.prototype.mc};Ia(function(){for(var a=C(document,"pc8080","chipset"),b=0;b>8};m.lc=function(a,b,c){cb(this,a,b,c,"SOUND2",null);this.H=b};m.mc=function(a,b,c){cb(this,a,b,c,"WATCHDOG",null)};var xd={0:S.prototype.cc,1:S.prototype.dc,2:S.prototype.ec,3:S.prototype.bc},yd={2:S.prototype.ic,3:S.prototype.kc,4:S.prototype.jc,5:S.prototype.lc,6:S.prototype.mc};Ia(function(){for(var a=C(document,"pc8080","chipset"),b=0;b>>0,h],p=ja(n,l,a.qb);0>p&&n.splice(-(p+1),0,l)}k&&(g.a=k.replace(/''/g,'"'))}a.J.push({nc:b,D:c,gc:d,Da:e,Eb:f})}delete this.Da}return!0};zd.prototype.Aa=function(){return!0}; function Ad(a,b,c,d){if(d)a.na("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.w=f;else if(h)for(a.w=Array(4*h.length),d=c=0;c>8&255,a.w[d++]=h[c]>>16&255,a.w[d++]=h[c]>>24&255;else a.w=e;a.Da=e.symbols;if(!a.w.length){t("Empty ROM: "+b);return}if(1==a.w.length){t(a.w[0]);return}}catch(g){a.na("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, " ").replace(/ +$/,"").split(" "),a.w=Array(b.length),e=0;e>>f.ea;0>>=f.ea;0>3)*this.Y;rb(this.B,this.qa,this.oa,3)&&(this.Fa=this.oa>>1,this.Ga=16/this.ia|0,this.sa=!1,void 0===this.fa||this.fa.length!=this.Fa)&&(this.fa=Array(this.Fa));D(this)};Hd.prototype.pa=function(a,b,c){var d=this;switch(b){case "fullScreen":return this.T[b]=c,this.u&&this.u.Pa?c.onclick=function(){d.Pa()}:c.parentNode.removeChild(c),!0}return!1}; +Hd.prototype.Ia=function(a,b,c,d){this.w=a;this.B=b;this.b=c;this.F=d;this.pa=(this.J*this.ia>>3)*this.Y;rb(this.B,this.ra,this.pa,3)&&(this.Fa=this.pa>>1,this.Ga=16/this.ia|0,this.sa=!1,void 0===this.fa||this.fa.length!=this.Fa)&&(this.fa=Array(this.Fa));D(this)};Hd.prototype.qa=function(a,b,c){var d=this;switch(b){case "fullScreen":return this.T[b]=c,this.u&&this.u.Pa?c.onclick=function(){d.Pa()}:c.parentNode.removeChild(c),!0}return!1}; Hd.prototype.Pa=function(){var a=!1;if(this.u){if(this.u.Pa){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.ha/this.aa;b>c&&(a=Math.round(c/b*100)+"%")}this.wa?(this.L.style.width=a,this.L.style.width=a,this.L.style.display="block",this.L.style.margin="auto"):(this.u.style.width=a,this.u.style.height="auto");this.u.style.backgroundColor="black";this.u.Pa();a=!0}this.Ca&&this.Ca.focus()}return a}; function Id(a,b){!b&&a.u&&(a.wa?a.L.style.width=a.L.style.height="":a.u.style.width=a.u.style.height="");eb(a,"notifyFullScreen("+b+")",!0)} Ia(function(){for(var a=C(document,"pc8080","video"),b=0;bMissing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=qa().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||Qa.aspect);f&&.3<=f&&3.33>=f&&(Ga("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");wa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Hd(d,e,h,f,c);bb(d,c)}}); -function Jd(a){v.call(this,"Debugger",a,Jd);this.style=Kd;this.fa=this.Ca=this.L=0;this.Y=T();this.Gb=T();this.G=-1;this.C=[];this.ia=!1;this.ha=T();this.J=[];this.oa={};this.u=this.aa=this.H=[];Ld(this);this.wa=0;Md(this);this.Fa=[];Nd(this,a.messages);this.Ga=a.commands;var b=this;window?void 0===window.$&&(window.$=function(a){return qc(b,a)}):void 0===global.$&&(global.$=function(a){return qc(b,a)})}Va(Jd); +(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Qa.aspect);f&&.3<=f&&3.33>=f&&(Ga("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");wa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Hd(d,e,h,f,c);$a(d,c)}}); +function Jd(a){v.call(this,"Debugger",a,Jd);this.style=Kd;this.fa=this.Ca=this.L=0;this.Y=T();this.Gb=T();this.G=-1;this.C=[];this.ia=!1;this.ha=T();this.J=[];this.pa={};this.u=this.aa=this.H=[];Ld(this);this.wa=0;Md(this);this.Fa=[];Nd(this,a.messages);this.Ga=a.commands;var b=this;window?void 0===window.$&&(window.$=function(a){return qc(b,a)}):void 0===global.$&&(global.$=function(a){return qc(b,a)})}Va(Jd); var Od={"?":"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"},Kd=8080,Pd="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(" "), -Qd="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 MOV 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(" "),Rd="B C D E H L M A BC DE HL SP PC PSW".split(" "),Sd=[[45],[42,2067,32],[71,2131,18193],[29,2067],[28,17],[22,17],[44,17,32],[63],[45,32768], +Qd="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 MOV 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(" "),Rd="B C D E H L M A BC DE HL SP PC PS PSW".split(" "),Sd=[[45],[42,2067,32],[71,2131,18193],[29,2067],[28,17],[22,17],[44,17,32],[63],[45,32768], [21,18963,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,18963,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,18963,2579],[41,18963,115],[23,2579],[28,1297],[22,1297],[44,1297,32],[16,18193],[45,32768],[42,2835,32],[70,115,18193],[29,2835],[28,1617],[22,1617], [44,1617,32],[72],[45,32768],[21,18963,2835],[39,18193,115],[23,2835],[28,1809],[22,1809],[44,1809,32],[17],[43,17,17],[43,17,273],[43,17,529],[43,17,785],[43,17,1041],[43,17,1297],[43,17,1617],[43,17,1809],[43,273,17],[43,273,273],[43,273,529],[43,273,785],[43,273,1041],[43,273,1297],[43,273,1617],[43,273,1809],[43,529,17],[43,529,273],[43,529,529],[43,529,785],[43,529,1041],[43,529,1297],[43,529,1617],[43,529,1809],[43,785,17],[43,785,273],[43,785,529],[43,785,785],[43,785,1041],[43,785,1297],[43, 785,1617],[43,785,1809],[43,1041,17],[43,1041,273],[43,1041,529],[43,1041,785],[43,1041,1041],[43,1041,1297],[43,1041,1617],[43,1041,1809],[43,1297,17],[43,1297,273],[43,1297,529],[43,1297,785],[43,1297,1041],[43,1297,1297],[43,1297,1617],[43,1297,1809],[43,1617,17],[43,1617,273],[43,1617,529],[43,1617,785],[43,1617,1041],[43,1617,1297],[26],[43,1617,1809],[43,1809,17],[43,1809,273],[43,1809,529],[43,1809,785],[43,1809,1041],[43,1809,1297],[43,1809,1617],[43,1809,1809],[3,18193,17],[3,18193,273], [3,18193,529],[3,18193,785],[3,18193,1041],[3,18193,1297],[3,18193,1617],[3,18193,1809],[2,18193,17],[2,18193,273],[2,18193,529],[2,18193,785],[2,18193,1041],[2,18193,1297],[2,18193,1617],[2,18193,1809],[73,18193,17],[73,18193,273],[73,18193,529],[73,18193,785],[73,18193,1041],[73,18193,1297],[73,18193,1617],[73,18193,1809],[66,18193,17],[66,18193,273],[66,18193,529],[66,18193,785],[66,18193,1041],[66,18193,1297],[66,18193,1617],[66,18193,1809],[5,18193,17],[5,18193,273],[5,18193,529],[5,18193,785], [5,18193,1041],[5,18193,1297],[5,18193,1617],[5,18193,1809],[76,18193,17],[76,18193,273],[76,18193,529],[76,18193,785],[76,18193,1041],[76,18193,1297],[76,18193,1617],[76,18193,1809],[46,18193,17],[46,18193,273],[46,18193,529],[46,18193,785],[46,18193,1041],[46,18193,1297],[46,18193,1617],[46,18193,1809],[18,18193,17],[18,18193,273],[18,18193,529],[18,18193,785],[18,18193,1041],[18,18193,1297],[18,18193,1617],[18,18193,1809],[58],[50,2067],[34,51],[30,51],[11,51],[51,2067],[4,18193,33],[65,128],[62], -[54],[38,51],[30,32819],[15,51],[7,51],[1,18193,33],[65,128],[57],[50,2323],[33,51],[48,33,18193],[10,51],[51,2323],[74,18193,33],[65,128],[55],[54,32768],[31,51],[27,18193,33],[8,51],[7,32819],[67,18193,33],[65,128],[61],[50,2579],[37,51],[78,19283,18963],[14,51],[51,2579],[6,18193,33],[65,128],[60],[49,2579],[36,51],[75,18963,18707],[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,19219,18963],[32,51],[25],[9,51],[7,32819],[19, +[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,19283,18963],[14,51],[51,2579],[6,18193,33],[65,128],[60],[49,2579],[36,51],[75,18963,18707],[13,51],[7,32819],[77,18193,33],[65,128],[59],[50,3603],[35,51],[24],[12,51],[51,3603],[47,18193,33],[65,128],[56],[69,19219,18963],[32,51],[25],[9,51],[7,32819],[19, 18193,33],[65,128]],Td={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=Jd.prototype; m.Ia=function(a,b,c,d){this.B=b;this.b=c;this.w=a;(a=cc(a,"messages"))&&Nd(this,a);this.pb=Sd;Ud(this,function(a){a:{var b=d.B.U,c=a[0],g=a=0,l=b.length;if(c){a=V(W(d,c));if(-1===a){d.g("invalid address: "+c);break a}g=a>>>d.B.ea;l=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,k=0;l--;){var n=b[g];n.type==c?k++||d.g("..."):(c=n.type,k=tb[c],n&&d.g(q(n.id)+" %"+q(g<>>e.ea;f!=e.B?e.U[h].Db(f,b&65535,d):(e.U[h++].ob(f,b&255,d),e.U[h&e.K].ob(0,b>>8&255,d+1));c&&Vd(a,c);rc(this.b,!0)}};function T(a){return{D:a,za:!1}}function Wd(a){return[a.D,a.za]}function Xd(a){return{D:a[0],za:a[1]}} function W(a,b,c){var d;c=(c?a.Y:a.Gb).D;if(void 0!==b){d=b=Yd(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=na(Rd,a.substr(b,2))));return c}function de(a,b){var c=0,d=ee(a,b);if(void 0!==d)switch(b){case 7:case 0:case 1:case 2:case 3:case 4:case 5:case 6:c=2;break;case 8:case 9:case 10:case 11:case 12:case 13:c=4}return c?q(d,c):"??"} -function ee(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.N;break;case 1:c=d.O;break;case 8:c=Hc(d);break;case 2:c=d.P;break;case 3:c=d.R;break;case 9:c=Jc(d);break;case 4:c=d.S;break;case 5:c=d.V;break;case 10:c=I(d);break;case 6:c=d.X(I(d));break;case 11:c=d.ca;break;case 12:c=d.M;break;case 13:c=d.j<<8|Fc(d)&255}}return c} +function ce(a,b){var c;a=a.toUpperCase();null==b?c=na(Rd,a):(c=na(Rd,a.substr(b,2)),0>c&&(c=na(Rd,a.substr(b,1))));return c}function de(a,b){var c=0,d=ee(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:case 14:c=4}return c?q(d,c):"??"} +function ee(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.N;break;case 1:c=d.O;break;case 8:c=Hc(d);break;case 2:c=d.P;break;case 3:c=d.R;break;case 9:c=Jc(d);break;case 4:c=d.S;break;case 5:c=d.V;break;case 10:c=I(d);break;case 6:c=d.X(I(d));break;case 11:c=d.ca;break;case 12:c=d.M;break;case 13:c=Fc(d);break;case 14:c=Fc(d)&255|d.j<<8}}return c} function fe(a,b){b=Yd(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=ce(b,c+1),0<=e&&(b=b.substr(0,c)+de(a,e)+b.substr(c+1+Rd[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=W(a,e))?(d=e+' "'+be(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=W(a,e))?(Vd(d),d=e+' "'+ be(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+Z(T(this.b.M).D));if(!this.xa||a!=this.xa)if(this.xa=a,this.ja&-2147483648&&(this.da(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.Za=0;c.C-=c.b;c.b=0;rc(c)}};function db(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.ja&g)!=g||a.message(b.eb+"."+(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 Md(a){var b;if(pd(a)){if(!a.W||!a.W.length){a.W=Array(1E3);for(b=0;b>>d.ea],!1)}a.aa=["br"];if(void 0!==a.H)for(b=1;b>>d.ea],!0);a.H=["bw"];a.Jb=0}m.Ja=function(a,b,c){var d=!0;c||ke(this,a,b,!1,!0);if(a!=this.u){var e=V(b);if(-1===e)this.g("invalid address: "+Z(b.D)),d=!1;else{var f=this.B;f.U[e>>>f.ea].Ja(e&f.B,a==this.H)}}d&&(a.push(b),c?b.za=!0:(le(this,a,a.length-1,"set"),Md(this)));return d}; function ke(a,b,c,d,e){var f=!1;c=V(c);for(var h=1;h>>d.ea],b==a.H));g.za||Md(a);break}}return f}function me(a,b){for(var c=1;c>24,4);break;case 3:w=q(B.Ha(la,2),4);break;default:B="imm("+r(u)+")";break a}8086==B.style&&u&64?w="["+w+"]":u&16||(w=(B.style==Kd?"$":"0x")+w); B=w}else u&16?(B=(p&3840)>>8,u=Rd[B],8086==a.style&&p&64&&(6==B&&(u="HL"),u="["+u+"]"),B=u):u&128&&(B=(f>>3&7).toString());if(!B||!B.length){g="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; function Re(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break; case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0} function Zd(a,b,c){var d;if(b){b=Yd(a,b);for(var e=0,f=!1,h=b,g=[],l=[],k=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=n+"b"+h;d>>=8}d="0x"+q(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Ue(a,b){if(b)return Te(a,b,a.oa[b]);var c=0;for(b in a.oa)Te(a,b,a.oa[b]),c++;return 0b[0]?1:a[0]>=1;h=n+"b"+h;d>>=8}d="0x"+q(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Ue(a,b){if(b)return Te(a,b,a.pa[b]);var c=0;for(b in a.pa)Te(a,b,a.pa[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.gc;if(e>=h&&e>8&255;case "C":d.O=g&255;break;case "D":d.P= -g&255;break;case "DE":d.P=g>>8&255;case "E":d.R=g&255;break;case "H":d.S=g&255;break;case "HL":d.S=g>>8&255;case "L":d.V=g&255;break;case "SP":d.ca=g&65535;break;case "PC":F(d,g);a.Y=T(d.M);break;case "PS":Dc(d,g);break;case "C":d.I=g?d.I|256:d.I&255;break;case "P":g?Nc(d)||(d.Z^=1):Nc(d)&&(d.Z^=1);break;case "A":d.la=g?~d.Z&16|d.la&-17:d.Z&16|d.la&-17;break;case "Z":d.I=g?d.I&-256:d.I|255;break;case "S":g?Qc(d)||(d.Z^=192):Qc(d)&&(d.Z^=192);break;case "I":d.ra=g?d.ra|512:d.ra&-513;break;default:a.g("unknown register: "+ -e);return}if(!h){a.g("invalid value: "+f);return}rc(d);a.g("updated registers:")}a.g(Pe(a));c&&(a.Y=T(d.M),ie(a,Z(a.Y.D)))}}function af(a,b){b=ia(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(fe(a,c[2])):Zd(a,b,!0)}function bf(a,b,c){var d="t"!=b;c=Se(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ba(c,function(){return gb(a,!0)&&a.bb(e,d,!1)},function(){rc(a.b);gb(a,!1)})} +g&255;break;case "DE":d.P=g>>8&255;case "E":d.R=g&255;break;case "H":d.S=g&255;break;case "HL":d.S=g>>8&255;case "L":d.V=g&255;break;case "SP":d.ca=g&65535;break;case "PC":F(d,g);a.Y=T(d.M);break;case "PS":Dc(d,g);break;case "PSW":Dc(d,g&255|d.oa&-256);d.j=g>>8;break;case "CF":d.I=g?d.I|256:d.I&255;break;case "PF":g?Nc(d)||(d.Z^=1):Nc(d)&&(d.Z^=1);break;case "AF":d.la=g?~d.Z&16|d.la&-17:d.Z&16|d.la&-17;break;case "ZF":d.I=g?d.I&-256:d.I|255;break;case "SF":g?Qc(d)||(d.Z^=192):Qc(d)&&(d.Z^=192);break; +case "IF":d.oa=g?d.oa|512:d.oa&-513;break;default:a.g("unknown register: "+e);return}if(!h){a.g("invalid value: "+f);return}rc(d);a.g("updated registers:")}a.g(Pe(a));c&&(a.Y=T(d.M),ie(a,Z(a.Y.D)))}}function af(a,b){b=ia(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(fe(a,c[2])):Zd(a,b,!0)}function bf(a,b,c){var d="t"!=b;c=Se(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ba(c,function(){return gb(a,!0)&&a.bb(e,d,!1)},function(){rc(a.b);gb(a,!1)})} function ie(a,b,c,d){if(b=W(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=W(a,c,!0);if(!d||d.Dg[0].indexOf("+"))){var k=g[0]+":";g[2]&&(k+=" "+g[2]);a.g(k)}g[3]&&(h=g[3],f=null);f=oe(a,b,h,f);a.g(f);a.Y=b;e-=b.D-l;c++}}} function ae(a,b,c,d){if(c)if(b){0>a.G&&a.C.length&&(a.G=0);if(0>a.G||b!=a.C[a.G])a.C.splice(0,0,b),a.G=0;a.G--}else a.ia?b="end":b=a.C[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(ia(b.substring(c,f))),c=f+1}}return a} function ne(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.ia&&(a.g("ended assemble at "+Z(a.ha.D)),a.Y=a.ha,a.ia=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.xa=null;if(ib(a)&&0k||"z"ya.length&&(a.g("note: only "+ya.length+" available"),Y=ya.length);U-=Y;0>U&&(null==ya[ya.length-1].D?(Y=U+Y,U=0):U+=ya.length);var Wc=[];"call"== -we&&(ab=1E5,Wc=["CALL"]);for(void 0!==ve&&a.g(Y+" instructions earlier:");0=ya.length&&(U=0);a.Nb=Y;ye++;ab--}}ye||(a.g("no "+xe+"history available"),a.Nb=void 0)}else{var dc=W(a,A);if(dc){var ec=0;X&&("l"==X.charAt(0)&&(X=X.substr(1)||zf),ec=Se(a,X)>>>0,65536>4||1;Bf--&&0ic?String.fromCharCode(ic):".";gc--}La&&(La+="\n");La+=A+" "+Cb+(0==Bb?" "+Yc:"")}La&&a.g(La);a.Gb=dc}}}}break;case "e":if("else"==f[0])break;var jc=1,Be=255,Ce=a.X,De=a.ga;"ew"==f[0]&&(jc=2,Be=65535,Ce=a.Ha,De=a.vb);var Ee=jc<<1,Fe=f[1];if(null==Fe)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"), -a.g("\tew [a] [...] edit words at address a");else{var kc=W(a,Fe);if(kc)for(var lc=2;lcdd;){for(var Ma=null,Gf=256;65536>Fb.D>>>0;){He.D=a.Ha(Fb,2);if(null==Fb.D||!Gf--)break;for(var Hf=a,mc=He,Ie=null,Gb=mc.D,Je=Gb,ed=1;6>=ed&&Gb;ed++){if(2ya.length&&(a.g("note: only "+ya.length+" available"),Y=ya.length);U-=Y;0>U&&(null==ya[ya.length-1].D?(Y=U+Y,U=0):U+=ya.length);var Wc=[];"call"== +we&&(bb=1E5,Wc=["CALL"]);for(void 0!==ve&&a.g(Y+" instructions earlier:");0=ya.length&&(U=0);a.Nb=Y;ye++;bb--}}ye||(a.g("no "+xe+"history available"),a.Nb=void 0)}else{var dc=W(a,A);if(dc){var ec=0;X&&("l"==X.charAt(0)&&(X=X.substr(1)||zf),ec=Se(a,X)>>>0,65536>4||1;Bf--&&0ic?String.fromCharCode(ic):".";gc--}La&&(La+="\n");La+=A+" "+Db+(0==Cb?" "+Yc:"")}La&&a.g(La);a.Gb=dc}}}}break;case "e":if("else"==f[0])break;var jc=1,Be=255,Ce=a.X,De=a.ga;"ew"==f[0]&&(jc=2,Be=65535,Ce=a.Ha,De=a.vb);var Ee=jc<<1,Fe=f[1];if(null==Fe)a.g("edit memory commands:"),a.g("\teb [a] [...] edit bytes at address a"), +a.g("\tew [a] [...] edit words at address a");else{var kc=W(a,Fe);if(kc)for(var lc=2;lcdd;){for(var Ma=null,Gf=256;65536>Gb.D>>>0;){He.D=a.Ha(Gb,2);if(null==Gb.D||!Gf--)break;for(var Hf=a,mc=He,Ie=null,Hb=mc.D,Je=Hb,ed=1;6>=ed&&Hb;ed++){if(2a[1];a=a[2];this.sa=!0;this.A.ka=!0;var d=this.T.power;d&&(d.textContent="Shutdown");this.b&&(wf(this,this.b,b,c,a),sc(this.b));this.ha&&(vf(this,b),b.clear());!c&&this.H&&(this.H.clear(),delete this.H);this.C=0}; -function vf(a,b){if(ra("There may be a problem with your "+of+" machine.\n\nTo help us diagnose it, click OK to send this "+of+" machine state to http://www.pcjs.org.")){var c=a.qa,d=a.u||"",e=b.toString(),f=pf,h={};h.app=of;h.ver=f;h.url=c;h.user=d;h.type="bug";h.data=e;oa("http://www.pcjs.org/api/v1/report",h,!0)}} +function vf(a,b){if(ra("There may be a problem with your "+of+" machine.\n\nTo help us diagnose it, click OK to send this "+of+" machine state to http://www.pcjs.org.")){var c=a.ra,d=a.u||"",e=b.toString(),f=pf,h={};h.app=of;h.ver=f;h.url=c;h.user=d;h.type="bug";h.data=e;oa("http://www.pcjs.org/api/v1/report",h,!0)}} function cf(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new Gc(a,pf),h=new Gc(a,pf,"validate"),g=ma();H(h,"timestamp",g);H(f,"timestamp",g);H(f,"version","1.22.0");H(f,"url",window?window.location.href:null);H(f,"browser",qa());a.b&&a.b.Aa&&(c&&a.b.da(),d=a.b.Aa(b,c),"object"===typeof d&&H(f,a.b.id,d),c&&(a.b.A.ka=!1,!1===d&&(e=null)));for(var g=Ya(a.id),l=0;l>>e.ea;0>8|(w&255)<<8);n>>e.ea;0>8|(w&255)<<8);n>da&la,P=d.xa,A=n++,X=M,M=void 0,M=d.C?(P.height-A-1)*P.width+p:A+p*P.width;X&&(208<=A&&236>A?X=d.ba+0:28<=A&&72>A&&(X=d.ba+1));A=d.W[X];M*=A.length;P.data[M]=A[0];P.data[M+1]=A[1];P.data[M+2]=A[2];P.data[M+3]=A[3];da+=u}n>x&&(x=n);p=h&&(h=p+1)}g+=2;k++;if(n>=d.J&&(n=0,p++,p>d.Y))break}d.sa=!0;eg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pc8080$2")); g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){g=null,a=p.message}else a="unrecognized XML: "+(255>8&255;a.v=b&255}function G(a){return a.i<<8|a.w}function Lb(a,b){a.i=b>>8&255;a.w=b&255}function H(a){return a.j<<8|a.l} -function J(a,b){a.j=b>>8&255;a.l=b&255}function D(a,b){a.m=b&65535}function K(a){return a.f&256?1:0}function Mb(a){return Pa[a.s&255]?4:0}function Ib(a){return a.G&-214|(a.s&128?128:0)|(a.f&255?0:64)|((a.s^a.C)&16?16:0)|Mb(a)|K(a)}function Gb(a,b){a.f=a.s=a.C=0;b&1&&(a.f|=256);b&4||(a.s|=1);b&16&&(a.C|=16);b&64||(a.f|=255);b&128&&(a.s^=192);a.G=a.G&-513|b&512|2}function M(a,b){a.C=a.b^b;return a.s=(a.f=a.b+b)&255}function N(a,b){a.C=a.b^b;return a.s=(a.f=a.b+b+(a.f&256?1:0))&255} +function J(a,b){a.j=b>>8&255;a.l=b&255}function D(a,b){a.m=b&65535}function K(a){return a.f&256?1:0}function Mb(a){return Pa[a.s&255]?4:0}function Ib(a){return a.G&-214|(a.s&128?128:0)|(a.f&255?0:64)|((a.s^a.C)&16?16:0)|Mb(a)|K(a)}function Gb(a,b){a.f=a.s=a.C=0;b&1&&(a.f|=256);b&4||(a.s|=1);b&16&&(a.C|=16);b&64||(a.f|=255);b&128&&(a.s^=192);a.G=a.G&-726|b&512|2}function M(a,b){a.C=a.b^b;return a.s=(a.f=a.b+b)&255}function N(a,b){a.C=a.b^b;return a.s=(a.f=a.b+b+(a.f&256?1:0))&255} function O(a,b){a.f=a.s=a.C=a.b&b;(a.b|b)&8&&(a.C^=16);return a.f}function Nb(a,b){a.C=b^255;b=a.s=b+255&255;a.f=a.f&-256|b;return b}function Ob(a,b){a.C=b;b=a.s=b+1&255;a.f=a.f&-256|b;return b}function P(a,b){return a.s=a.f=a.C=a.b|b}function Q(a,b){b^=255;a.C=a.b^b;return a.s=(a.f=a.b+b+1^256)&255}function R(a,b){b^=255;a.C=a.b^b;return a.s=(a.f=a.b+b+(a.f&256?0:1)^256)&255}function S(a,b){return a.s=a.f=a.C=a.b^b}m.F=function(a){return this.o.F(a)};m.N=function(a,b){this.o.N(a,b)}; function T(a){var b=a.F(a.m);D(a,a.m+1);return b}function U(a){var b=Za(a.o,a.m);D(a,a.m+2);return b}function V(a){var b=Za(a.o,a.A);a.A=a.A+2&65535;return b}function W(a,b){a.A=a.A-2&65535;ab(a.o,a.A,b)}function X(a,b,c,d){d=d||2;a.B[b]&&(void 0===c&&(a.h.ca=!0,a.I("Value for "+b+" is invalid"),wb(a)),c=!a.h.T||a.h.Ua?n(c,d):"--------".substr(0,d),a.B[b].textContent!=c&&(a.B[b].textContent=c))} m.ga=function(a){this.ba&&(a||!this.h.T||this.h.Ua)&&(X(this,"A",this.b),X(this,"B",this.g),X(this,"C",this.v),X(this,"BC",Jb(this),4),X(this,"D",this.i),X(this,"E",this.w),X(this,"DE",G(this),4),X(this,"H",this.j),X(this,"L",this.l),X(this,"HL",H(this),4),X(this,"SP",this.A,4),X(this,"PC",this.m,4),a=Ib(this),X(this,"PS",a,4),X(this,"IF",a&512?1:0,1),X(this,"SF",a&128?1:0,1),X(this,"ZF",a&64?1:0,1),X(this,"AF",a&16?1:0,1),X(this,"PF",a&4?1:0,1),X(this,"CF",a&1?1:0,1));if(a=this.B.speed)a.textContent= @@ -70,8 +70,8 @@ this.a-=4},function(){this.b=R(this,this.w);this.a-=4},function(){this.b=R(this, c=this.b,d=this.m+-2&65535,e=1,f=0;0>>=f)&l;if(void 0!==h&&h[0])h[0](a,l,d);f+=g<<3;a+=g;e-=g}this.a-=10},function(){var a=U(this);K(this)||(W(this,this.m),D(this,a),this.a-=6);this.a-=11},function(){W(this,G(this));this.a-=11},function(){this.b=Q(this,T(this));this.a-=7},function(){W(this,this.m);D(this,16);this.a-=11},function(){K(this)&&(D(this,V(this)),this.a-=6);this.a-=5},Rb,function(){var a=U(this);K(this)&&D(this,a);this.a-=10},function(){for(var a= T(this),b=this.o,c=this.m+-2&65535,d=1,e=0,f=0;0>8;this.a-=10},function(){var a=U(this);this.s&128||D(this,a);this.a-=10},function(){this.G&=-513;this.a-=4},function(){var a=U(this);this.s&128||(W(this,this.m),D(this,a),this.a-=6); -this.a-=11},function(){W(this,Ib(this)&255|this.b<<8);this.a-=11},function(){this.b=P(this,T(this));this.a-=7},function(){W(this,this.m);D(this,48);this.a-=11},function(){this.s&128&&(D(this,V(this)),this.a-=6);this.a-=5},function(){this.A=H(this)&65535;this.a-=5},function(){var a=U(this);this.s&128&&D(this,a);this.a-=10},function(){this.G|=512;this.a-=4},function(){var a=U(this);this.s&128&&(W(this,this.m),D(this,a),this.a-=6);this.a-=11},Sb,function(){Q(this,T(this));this.a-=7},function(){W(this, +G(this));Lb(this,a);this.a-=5},function(){var a=U(this);Mb(this)&&(W(this,this.m),D(this,a),this.a-=6);this.a-=11},Sb,function(){this.b=S(this,T(this));this.a-=7},function(){W(this,this.m);D(this,40);this.a-=11},function(){this.s&128||(D(this,V(this)),this.a-=6);this.a-=5},function(){var a=V(this);Gb(this,a&255|this.G&-256);this.b=a>>8;this.a-=10},function(){var a=U(this);this.s&128||D(this,a);this.a-=10},function(){this.G&=-513;this.a-=4},function(){var a=U(this);this.s&128||(W(this,this.m),D(this, +a),this.a-=6);this.a-=11},function(){W(this,Ib(this)&255|this.b<<8);this.a-=11},function(){this.b=P(this,T(this));this.a-=7},function(){W(this,this.m);D(this,48);this.a-=11},function(){this.s&128&&(D(this,V(this)),this.a-=6);this.a-=5},function(){this.A=H(this)&65535;this.a-=5},function(){var a=U(this);this.s&128&&D(this,a);this.a-=10},function(){this.G|=512;this.a-=4},function(){var a=U(this);this.s&128&&(W(this,this.m),D(this,a),this.a-=6);this.a-=11},Sb,function(){Q(this,T(this));this.a-=7},function(){W(this, this.m);D(this,56);this.a-=11}];function Y(a){u.call(this,"ChipSet",a,Y);var b=a.model;b&&!Tb[b]&&r("Unrecognized ChipSet model: "+b);this.O=Tb[b]||Ub;a.sound&&(this.m=null,window&&(this.m=window.AudioContext||window.webkitAudioContext),this.m&&new this.m);B(this)}w(Y);var Ub=1978.1,Tb={SI1978:Ub};m=Y.prototype;m.P=function(){return!1}; m.da=function(a,b,c,d){this.o=b;this.a=c;this.J=d;this.u=a;if(this.O==Ub){var e;a=Vb;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.o[g]?r("Input port 0x"+n(g,4)+" already registered"):c.o[g]=[h,!1]}var l;e=Wb;void 0===l&&(l=0);for(var k in e)if(f=b,a=+k+l,c=e[k].bind(this),void 0!==c)for(d=+k+l;d<=a;d++)void 0!==f.m[d]?r("Output port 0x"+n(d,4)+" already registered"):f.m[d]=[c,!1]}}; m.X=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};m.W=function(a){return a?this.save():!0};m.reset=function(){this.f=this.g=this.c=this.b=this.l=this.j=this.i=0};m.save=function(){var a=new E(this);this.O==Ub&&F(a,0,[this.i,this.j,this.l,this.b,this.c,this.f,this.g]);return a.data()};m.restore=function(a){a=a[0];this.O==Ub&&(this.i=a[0],this.j=a[1],this.l=a[2],this.b=a[3],this.c=a[4],this.f=a[5],this.g=a[6]);return!0};m.start=function(){};m.stop=function(){};