(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 q(a,b){var c="";void 0===b?b=8:8=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function r(a){return"0x"+q(a,4)}function ba(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0":">",'"':""","'":"'"};function ga(a){return a.replace(/[&<>"']/g,function(a){return fa[a]})}function ia(a,b){return(a+" ").slice(0,b)}function ja(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} function ka(a,b,c){var d=0,e=a.length,f=0;for(void 0===c&&(c=function(a,b){return a>b?1:a>1,g;g=c(b,a[h]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} function na(a,b){var c;if(Array.prototype.indexOf)return a.indexOf(b,c);c=c||0;0>c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;c=this.I?10:20>=this.I?12:24>=this.I?14:15;this.Ba=1<>2;this.A=this.Ba-1;this.K=this.N/this.Ba|0;this.J=this.K-1;this.u=[];this.C=[];this.D=this.H=!1;this.Y=[];this.aa=[];a=new G;tb(a,this.G);this.V=Array(this.K);for(b=0;b>>a.la;0f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.F)return g.Fb+=g.F-e,g.F=e,!0;if(e>=g.F+g.Fb){l=g.size-(e-k);l>f&&(l=f);g.Fb=e-g.F+l;e=k+a.Ba;f-=l;h++;continue}}return vb(1,e,f)}e=new G(e,l,a.Ba,d);tb(e,a.G,g);a.V[h++]=e;e=k+a.Ba;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+wb[d]+" at "+r(b)),!0):vb(2,b,c)}m.X=function(a){return this.V[(a&this.w)>>>this.la].rb(a&this.A,a)}; function xb(a,b){return a.V[(b&a.w)>>>a.la].Db(b&a.A,b)}m.Oa=function(a){var b=a&this.A,c=(a&this.w)>>>this.la;return b!=this.A?this.V[c].tc(b,a):this.V[c++].rb(b,a)|this.V[c&this.J].rb(0,a+1)<<8};function yb(a,b){var c=b&a.A,d=(b&a.w)>>>a.la;return c!=a.A?a.V[d].Xb(c,b):a.V[d++].Db(c,b)|a.V[d&a.J].Db(0,b+1)<<8}m.qa=function(a,b){this.V[(a&this.w)>>>this.la].tb(a&this.A,b&255,a)};function zb(a,b,c){a.V[(b&a.w)>>>a.la].Gb(b&a.A,c&255,b)} m.Pb=function(a,b){var c=a&this.A,d=(a&this.w)>>>this.la;c!=this.A?this.V[d].vc(c,b&65535,a):(this.V[d++].tb(c,b&255,a),this.V[d&this.J].tb(0,b>>8&255,a+1))};function Ab(a,b){if(void 0===b)return a.D=!a.D,a.D;void 0===a.u[b]&&(a.u[b]=[null,!1]);a.u[b][1]=!a.u[b][1];return a.u[b][1]}function Bb(a,b,c){var d;void 0===d&&(d=0);if(c)for(var e in c){var f=a,h=+e+d,g=c[e].bind(b);if(void 0!==g)for(var k=+e+d;k<=h;k++)void 0!==f.u[k]?v("Input port "+r(k)+" already registered"):f.u[k]=[g,!1]}} function Cb(a,b,c){for(var d=1,e=0,f=0;0>>=f)&k;if(void 0!==h){if(h[0])h[0](b,k,d);a.G&&a.H!=h[1]&&Hb(a.G,b,k)}else a.G&&(eb(a.G,a,b,k,d),a.H&&Hb(a.G,b,k));f+=g<<3;b+=g;e-=g}} function vb(a,b,c){v("Memory block error ("+a+": "+q(b)+","+q(c)+")");return!1}var Ib;if(nb){var Rb=new ArrayBuffer(2);(new DataView(Rb)).setUint16(0,256,!0);Ib=256===(new Uint16Array(Rb))[0]}else Ib=!1;var Sb=Ib; function G(a,b,c,d){this.id=Tb+=2;this.b=null;this.F=a;this.Fb=b;this.size=c||0;this.type=d||Ub;this.L=d==Vb;tb(this);this.Ka=this.ec=!1;if(c)if(nb)this.D=new ArrayBuffer(c),this.H=new DataView(this.D,0,c),this.A=new Uint8Array(this.D,0,c),this.J=new Uint16Array(this.D,0,c>>1),this.b=new Int32Array(this.D,0,c>>2),Wb(this,Sb?Xb:Yb);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},ca:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ka: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},ya: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.Ka=!0},Y:function(a,b){if(this.G&&null!=this.F){var c=this.G;cc(c,this.F+a,1,c.Y)&&c.ja(!0)}return this.Db(a,b)},ea:function(a,b){if(this.G&&null!=this.F){var c=this.G;cc(c,this.F+a,2,c.Y)&&c.ja(!0)}return this.Xb(a,b)},ua:function(a,b,c){if(this.G&&null!=this.F){var d=this.G;cc(d,this.F+a,1,d.H)&&d.ja(!0)}this.L?this.w(a,b,c):this.Gb(a,b,c)}, Ga:function(a,b,c){if(this.G&&null!=this.F){var d=this.G;cc(d,this.F+a,2,d.H)&&d.ja(!0)}this.L?this.w(a,b,c):this.Yb(a,b,c)},U:function(a){return this.A[a]},aa:function(a){return this.A[a]},da:function(a){return this.H.getUint16(a,!0)},ga:function(a){return a&1?this.A[a]|this.A[a+1]<<8:this.J[a>>1]},ma:function(a,b){this.A[a]=b;this.Ka=!0},xa:function(a,b){this.A[a]=b;this.Ka=!0},za:function(a,b){this.H.setUint16(a,b,!0);this.Ka=!0},Ha:function(a,b){a&1?(this.A[a]=b,this.A[a+1]=b>>8):this.J[a>>1]= b;this.Ka=!0}};function tb(a,b,c){a.G=b;a.u=a.C=0;c&&((a.u=c.u)&&bc(a,ac,!1),(a.C=c.C)&&$b(a,ac,!1))}function dc(a,b){b?0===--a.C&&(a.tb=a.L?a.w:a.Gb,a.vc=a.L?a.I:a.Yb):0===--a.u&&(a.rb=a.Db,a.tc=a.Xb)}function $b(a,b,c){c&&a.C||(a.tb=!a.L&&b[2]||a.w,a.vc=!a.L&&b[3]||a.I);if(c||void 0===c)a.Gb=b[2]||a.w,a.Yb=b[3]||a.I}function bc(a,b,c){c&&a.u||(a.rb=b[0]||a.K,a.tc=b[1]||a.N);if(c||void 0===c)a.Db=b[0]||a.K,a.Xb=b[1]||a.N}function Wb(a,b){b||(b=ec);bc(a,b,void 0);$b(a,b,void 0)} var ec=[],Zb=[G.prototype.ca,G.prototype.ka,G.prototype.ya,G.prototype.cb],ac=[G.prototype.Y,G.prototype.ea,G.prototype.ua,G.prototype.Ga];if(nb)var Yb=[G.prototype.U,G.prototype.da,G.prototype.ma,G.prototype.za],Xb=[G.prototype.aa,G.prototype.ga,G.prototype.xa,G.prototype.Ha]; function fc(a,b){y.call(this,"CPU",a,fc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.qb=c;this.i.Mb=0;this.i.$a=d;this.i.Ub=Math.round(this.i.qb/1E4)/100;this.i.Ya=this.i.Ub*this.i.$a;this.B.va=!1;this.B.Sb=!1;this.B.dc=a.autoStart;this.B.fc=!1;this.B.ib=!1;this.i.xb=this.i.nb=0;this.i.yb=a.csStart;this.i.mb=a.csInterval;this.i.ob=a.csStop;this.aa=this.ab.bind(this);E(this)}Za(fc);var gc=["power","reset"];m=fc.prototype; m.Na=function(a,b,c,d){this.u=a;this.A=b;this.G=d;for(b=0;b=a.i.nb&&(a.i.nb+=a.i.mb,c=!0);0<=a.i.ob&&a.i.ob<=zc(a)&&(a.i.mb=a.i.ob=-1,jc(a),a.ja(),c=!0);c&&a.g(zc(a)+" cycles: checksum="+q(a.i.xb))}} m.pa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.L[b]=c;a=!0;break;case "run":this.L[b]=c;c.onclick=function(){var a;if(a=d.u)if(a=d.u,a.B.ra)a=!0;else{var b=null,c,g=bb(a.id);for(c=0;cc&&(c=2);var d=1;b&&1a.i.Xa/a.i.Ya?b=1:d=!0;a.i.$a=b;b=a.i.Ub*a.i.$a;if(a.i.Ya!=b){a.i.Ya=b;b=a.i.Ya.toFixed(2)+"Mhz";var e=a.L.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.u&&a.u.Eb()}Bc(a,a.H);a.H=0;a.i.lb=la();a.i.Za=0;Cc(a);return d} m.ab=function(a){if(hb(this,!0)){if(!this.B.va){Ac(this);this.u&&this.u.start(this.i.lb,zc(this));this.B.va=!0;this.B.Sb=!0;this.C&&this.C.start();var b=this.L.run;b&&(b.textContent="Halt");this.u&&(this.u.Da(!0),a&&this.u.Eb(!0))}this.i.Wb>=this.i.qb&&Cc(this,!0);this.i.Bb=0;this.i.Lb=la();this.i.Za&&(a=this.i.Lb-this.i.Za,a>this.i.mc&&(this.i.lb+=a,this.i.lb>this.i.Lb&&(this.i.lb=this.i.Lb)));try{do{this.sb(this.B.ib?1:this.i.dd);var c=this.D-this.b;this.H+=c;this.i.Bb+=c;Bc(this,0,!0);yc(this, c);this.i.Ab-=c;0>=this.i.Ab&&(this.i.Ab+=this.i.oc,this.u&&Dc(this.u,this.i.Mb++),this.i.Mb>this.K&&(this.i.Mb=0));this.i.zb-=c;0>=this.i.zb&&(this.i.zb+=this.i.nc,this.u&&this.u.Da());this.i.pb-=c;if(0>=this.i.pb){this.i.pb+=this.i.Vb;break}}while(this.B.va)}catch(e){this.ja();kc(this);this.u&&this.u.stop(la(),zc(this));hb(this,!1);mb(this,e.stack||e.message);return}c=setTimeout;a=this.aa;this.i.Za=la();b=this.i.mc;this.i.Bb&&(b=Math.round(b*this.i.Bb/this.i.Vb));var b=b-(this.i.Za-this.i.Lb),d= this.i.Za-this.i.lb;d&&(this.i.Xa=Math.round(this.H/(10*d))/100,864E5<=d&&(this.I=0,Ac(this)));if(0>b||this.i.Xa>8&255;a.P=b&255}function Nc(a){return a.R<<8|a.S}function Oc(a,b){a.R=b>>8&255;a.S=b&255}function K(a){return a.T<<8|a.W} function Pc(a,b){a.T=b>>8&255;a.W=b&255}function H(a,b){a.M=b&65535}function L(a){return a.Z&256?1:0}function Qc(a,b){a.Z=a.Z&255|b}function Rc(a){return ob[a.ba&255]?4:0}function Sc(a){return(a.ba^a.ta)&16?16:0}function Tc(a){return a.Z&255?0:64}function Uc(a){return a.ba&128?128:0}function Kc(a){return a.sa&-214|Uc(a)|Tc(a)|Sc(a)|Rc(a)|L(a)}function Ic(a,b){a.Z=a.ba=a.ta=0;b&1&&(a.Z|=256);b&4||(a.ba|=1);b&16&&(a.ta|=16);b&64||(a.Z|=255);b&128&&(a.ba^=192);a.sa=a.sa&-726|b&512|2} function Vc(a,b){a.ta=a.j^b;return a.ba=(a.Z=a.j+b)&255}function Wc(a,b){a.ta=a.j^b;return a.ba=(a.Z=a.j+b+(a.Z&256?1:0))&255}function Xc(a,b){a.Z=a.ba=a.ta=a.j&b;(a.j|b)&8&&(a.ta^=16);return a.Z}function Yc(a,b){a.ta=b^255;b=a.ba=b+255&255;a.Z=a.Z&-256|b;return b}function Zc(a,b){a.ta=b;b=a.ba=b+1&255;a.Z=a.Z&-256|b;return b}function $c(a,b){return a.ba=a.Z=a.ta=a.j|b}function M(a,b){b^=255;a.ta=a.j^b;return a.ba=(a.Z=a.j+b+1^256)&255} function ad(a,b){b^=255;a.ta=a.j^b;return a.ba=(a.Z=a.j+b+(a.Z&256?0:1)^256)&255}function bd(a,b){return a.ba=a.Z=a.ta=a.j^b}m.X=function(a){return this.A.X(a)};m.qa=function(a,b){this.A.qa(a,b)};function O(a){var b=a.X(a.M);H(a,a.M+1);return b}function P(a){var b=a.A.Oa(a.M);H(a,a.M+2);return b}function Q(a){var b=a.A.Oa(a.ia);a.ia=a.ia+2&65535;return b}function R(a,b){a.ia=a.ia-2&65535;a.A.Pb(a.ia,b)} function S(a,b,c,d){d=d||2;a.L[b]&&(void 0===c&&(mb(a,"Value for "+b+" is invalid"),a.ja()),c=!a.B.va||a.B.fc?q(c,d):"--------".substr(0,d),a.L[b].textContent!=c&&(a.L[b].textContent=c))} m.Da=function(a){this.Y&&(a||!this.B.va||this.B.fc)&&(S(this,"A",this.j),S(this,"B",this.O),S(this,"C",this.P),S(this,"BC",Lc(this),4),S(this,"D",this.R),S(this,"E",this.S),S(this,"DE",Nc(this),4),S(this,"H",this.T),S(this,"L",this.W),S(this,"HL",K(this),4),S(this,"SP",this.ia,4),S(this,"PC",this.M,4),a=Kc(this),S(this,"PS",a,4),S(this,"IF",a&512?1:0,1),S(this,"SF",a&128?1:0,1),S(this,"ZF",a&64?1:0,1),S(this,"AF",a&16?1:0,1),S(this,"PF",a&4?1:0,1),S(this,"CF",a&1?1:0,1));if(a=this.L.speed)a.textContent= this.B.va&&this.i.Xa?this.i.Xa.toFixed(2)+"Mhz":"Stopped"}; m.sb=function(a){this.B.Ib=!0;var b=this.B.Xc=this.G&&cd(this.G),c=a?this.B.Sb?0:1:-1;this.B.Sb=!1;this.D=this.b=a;do{if(this.w){var d;this.w&8&&this.sa&512?(d=199|(this.w&7)<<3,this.w&=-16,this.sa&=-513,this.N[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(wd(this.G,this.M,c)){this.ja();break}c=1}this.N[O(this)].call(this)}while(0>8;Qc(this,a&256);this.b-=4},xd,function(){var a;Pc(this,a=K(this)+Lc(this));Qc(this,a>>8&256);this.b-=10},function(){this.j=this.X(Lc(this));this.b-=7},function(){Mc(this,Lc(this)-1);this.b-= 5},function(){this.P=Zc(this,this.P);this.b-=5},function(){this.P=Yc(this,this.P);this.b-=5},function(){this.P=O(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;Qc(this,a);this.b-=4},xd,function(){Oc(this,P(this));this.b-=10},function(){this.qa(Nc(this),this.j);this.b-=7},function(){Oc(this,Nc(this)+1);this.b-=5},function(){this.R=Zc(this,this.R);this.b-=5},function(){this.R=Yc(this,this.R);this.b-=5},function(){this.R=O(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255| L(this);Qc(this,a&256);this.b-=4},xd,function(){var a;Pc(this,a=K(this)+Nc(this));Qc(this,a>>8&256);this.b-=10},function(){this.j=this.X(Nc(this));this.b-=7},function(){Oc(this,Nc(this)-1);this.b-=5},function(){this.S=Zc(this,this.S);this.b-=5},function(){this.S=Yc(this,this.S);this.b-=5},function(){this.S=O(this);this.b-=7},function(){var a=this.j<<8;this.j=(L(this)<<8|this.j)>>1;Qc(this,a&256);this.b-=4},xd,function(){Pc(this,P(this));this.b-=10},function(){var a=P(this);this.A.Pb(a,K(this));this.b-= 16},function(){Pc(this,K(this)+1);this.b-=5},function(){this.T=Zc(this,this.T);this.b-=5},function(){this.T=Yc(this,this.T);this.b-=5},function(){this.T=O(this);this.b-=7},function(){var a=0,b=L(this);if(Sc(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=Vc(this,a);Qc(this,b?256:0);this.b-=4},xd,function(){var a;Pc(this,a=K(this)+K(this));Qc(this,a>>8&256);this.b-=10},function(){var a;a=P(this);a=this.A.Oa(a);Pc(this,a);this.b-=16},function(){Pc(this,K(this)-1);this.b-=5},function(){this.W= Zc(this,this.W);this.b-=5},function(){this.W=Yc(this,this.W);this.b-=5},function(){this.W=O(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},xd,function(){this.ia=P(this)&65535;this.b-=10},function(){this.qa(P(this),this.j);this.b-=13},function(){this.ia=this.ia+1&65535;this.b-=5},function(){var a=K(this);this.qa(a,Zc(this,this.X(a)));this.b-=10},function(){var a=K(this);this.qa(a,Yc(this,this.X(a)));this.b-=10},function(){this.qa(K(this),O(this));this.b-=10},function(){this.Z|=256;this.b-= 4},xd,function(){var a;Pc(this,a=K(this)+this.ia);Qc(this,a>>8&256);this.b-=10},function(){this.j=this.X(P(this));this.b-=13},function(){this.ia=this.ia-1&65535;this.b-=5},function(){this.j=Zc(this,this.j);this.b-=5},function(){this.j=Yc(this,this.j);this.b-=5},function(){this.j=O(this);this.b-=7},function(){Qc(this,L(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.O=this.P;this.b-=5},function(){this.O=this.R;this.b-=5},function(){this.O=this.S;this.b-=5},function(){this.O=this.T;this.b-= 5},function(){this.O=this.W;this.b-=5},function(){this.O=this.X(K(this));this.b-=7},function(){this.O=this.j;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.T;this.b-=5},function(){this.P=this.W;this.b-=5},function(){this.P=this.X(K(this));this.b-=7},function(){this.P=this.j;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.T;this.b-=5},function(){this.R=this.W;this.b-=5},function(){this.R=this.X(K(this));this.b-=7},function(){this.R=this.j;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.T;this.b-=5},function(){this.S=this.W;this.b-=5},function(){this.S=this.X(K(this));this.b-=7},function(){this.S=this.j;this.b-=5},function(){this.T=this.O;this.b-=5},function(){this.T= this.P;this.b-=5},function(){this.T=this.R;this.b-=5},function(){this.T=this.S;this.b-=5},function(){this.b-=5},function(){this.T=this.W;this.b-=5},function(){this.T=this.X(K(this));this.b-=7},function(){this.T=this.j;this.b-=5},function(){this.W=this.O;this.b-=5},function(){this.W=this.P;this.b-=5},function(){this.W=this.R;this.b-=5},function(){this.W=this.S;this.b-=5},function(){this.W=this.T;this.b-=5},function(){this.b-=5},function(){this.W=this.X(K(this));this.b-=7},function(){this.W=this.j; this.b-=5},function(){this.qa(K(this),this.O);this.b-=7},function(){this.qa(K(this),this.P);this.b-=7},function(){this.qa(K(this),this.R);this.b-=7},function(){this.qa(K(this),this.S);this.b-=7},function(){this.qa(K(this),this.T);this.b-=7},function(){this.qa(K(this),this.W);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=P(this);Uc(this)||H(this,a);this.b-=10},function(){this.sa&=-513;this.b-=4},function(){var a=P(this);Uc(this)||(R(this,this.M),H(this,a),this.b-=6);this.b-=11},function(){R(this,Kc(this)&255|this.j<<8);this.b-=11},function(){this.j=$c(this,O(this));this.b-=7},function(){R(this,this.M);H(this,48);this.b-=11},function(){Uc(this)&&(H(this,Q(this)), this.b-=6);this.b-=5},function(){this.ia=K(this)&65535;this.b-=5},function(){var a=P(this);Uc(this)&&H(this,a);this.b-=10},function(){this.sa|=512;this.b-=4},function(){var a=P(this);Uc(this)&&(R(this,this.M),H(this,a),this.b-=6);this.b-=11},Ad,function(){M(this,O(this));this.b-=7},function(){R(this,this.M);H(this,56);this.b-=11}]; function T(a){y.call(this,"ChipSet",a,T,32768);var b=a.model;b&&!Bd[b]&&v("Unrecognized ChipSet model: "+b);this.w=Bd[b]||U;this.Ia=this.w.Ea;a.sound&&(this.aa=null,window&&(this.aa=window.AudioContext||window.webkitAudioContext),this.aa&&new this.aa);E(this)}Za(T); var U={Ea:1978.1,Sc:{wa:0,yd:1,Cd:16,Kd:32,Td:64,Sd:128,ub:14},Ra:{wa:1,zc:1,Oc:2,Kc:4,Lc:16,Mc:32,Nc:64,ub:8},Tc:{wa:2,xd:3,ae:4,zd:8,Od:16,Pd:32,Qd:64,Ad:128,ub:0},Wd:{wa:3},Ud:{wa:2,Ld:7},Yd:{wa:3,be:1,Xd:2,Rd:4,Hd:8,Bd:16,vd:32},Vd:{wa:4},Zd:{wa:5,Dd:1,Ed:2,Fd:4,Gd:8,ce:16}},V={Ea:100,bb:{wa:66,de:1,Ic:2,Jc:4,Nd:8,Md:16,$b:32,Zb:64,Id:128},yc:{wa:66,INIT:0},Fa:{Jd:{wa:98},Pa:{xc:0,wc:1,Qc:2,Uc:4,Cc:5,Pc:6,Rc:7},Hb:16383},Bc:{wa:162,INIT:0},Ac:{wa:194,INIT:0}},Bd={SI1978:U,VT100:V}; T.prototype.pa=function(){return!1};T.prototype.Na=function(a,b,c,d){this.A=b;this.b=c;this.G=d;this.u=a;Bb(b,this,this.w.Nb);Fb(b,this,this.w.Ob)};T.prototype.Ca=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};T.prototype.Ja=function(a){return a?this.save():!0};U.Wa=[[U.Sc.ub,U.Ra.ub,U.Tc.ub,0,0,0,0]];V.Wa=[[V.yc.INIT,V.bb.Ic|V.bb.Jc,V.Bc.INIT,V.Ac.INIT],[0,0,0,0,Array(100)]];m=T.prototype;m.reset=function(){this.restore(this.w.Wa)||this.fa("reset error")}; m.save=function(){var a=new I(this);switch(this.Ia){case U.Ea:J(a,0,[this.ma,this.D,this.ua,this.N,this.Y,this.ga,this.ka]);break;case V.Ea:J(a,0,[this.ca,this.I,this.ea,this.da]),J(a,1,[this.K,this.C,this.J,this.U,this.H])}return a.data()}; m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.Ia){case U.Ea:return this.ma=b[0],this.D=b[1],this.ua=b[2],this.N=b[3],this.Y=b[4],this.ga=b[5],this.ka=b[6],!0;case V.Ea:return this.ca=b[0],this.I=b[2],this.ea=b[3],this.da=b[4],b=a[1],this.K=b[0],this.C=b[1],this.J=b[2],this.U=b[3],this.H=b[4],!0}return!1};m.start=function(){};m.stop=function(){};function Cd(a,b,c){a.D&=~b;c&&(a.D|=b)}m.Zc=function(a,b){var c=this.ma;D(this,a,null,b,"STATUS0",c);return c}; m.$c=function(a,b){var c=this.D;D(this,a,null,b,"STATUS1",c);return c};m.ad=function(a,b){var c=this.ua;D(this,a,null,b,"STATUS2",c);return c};m.Yc=function(a,b){var c=this.N>>8-this.Y&255;D(this,a,null,b,"SHIFT.RESULT",c);return c};m.ed=function(a,b,c){D(this,a,b,c,"SHIFT.COUNT",null);this.Y=b};m.gd=function(a,b,c){D(this,a,b,c,"SOUND1",null);this.ga=b};m.fd=function(a,b,c){D(this,a,b,c,"SHIFT.DATA",null);this.N=b<<8|this.N>>8};m.hd=function(a,b,c){D(this,a,b,c,"SOUND2",null);this.ka=b}; m.jd=function(a,b,c){D(this,a,b,c,"WATCHDOG",null)};function Dd(a){var b=0,c=0,d=~a.K;for(a=0;10>a;a++)d&1&&(b=9-a),d>>=1;for(a=0;10>a;a++)d&1&&(c=9-a),d>>=1;return 10*b+c} m.bd=function(a,b){var c=this.I,c=c&~V.bb.Zb;if((zc(this.b)&64)<<1&&(c|=V.bb.Zb,c!=this.I)){var d,e;d=this.J&1;e=this.J>>1&7;switch(e){case V.Fa.Pa.Rc:break;case V.Fa.Pa.wc:this.K=this.K<<1|d;break;case V.Fa.Pa.Cc:d=Dd(this);this.H[d]=V.Fa.Hb;fb(this,"doNVRCommand(): erase data at addr "+r(d));break;case V.Fa.Pa.xc:this.C=this.C<<1|d;break;case V.Fa.Pa.Uc:d=Dd(this);e=this.C&V.Fa.Hb;this.H[d]=e;fb(this,"doNVRCommand(): write data "+r(e)+" to addr "+r(d));break;case V.Fa.Pa.Pc:d=Dd(this);e=this.H[d]; null==e&&(e=V.Fa.Hb);this.C=e;fb(this,"doNVRCommand(): read data "+r(e)+" from addr "+r(d));break;case V.Fa.Pa.Qc:this.C<<=1;this.U=this.C&V.Fa.Hb+1;break;default:fb(this,"doNVRCommand(): unrecognized command 0x"+q(e,2))}}c&=~V.bb.$b;this.U&&(c|=V.bb.$b);this.I=c;D(this,a,null,b,"FLAGS.BUFFER",c);return c};m.kd=function(a,b,c){D(this,a,b,c,"BRIGHTNESS",null);this.ca=b};m.nd=function(a,b,c){D(this,a,b,c,"NVR.LATCH",null);this.J=b};m.md=function(a,b,c){D(this,a,b,c,"DC012",null);this.ea=b}; m.ld=function(a,b,c){D(this,a,b,c,"DC011",null);this.da=b};U.Nb={0:T.prototype.Zc,1:T.prototype.$c,2:T.prototype.ad,3:T.prototype.Yc};U.Ob={2:T.prototype.ed,3:T.prototype.gd,4:T.prototype.fd,5:T.prototype.hd,6:T.prototype.jd};V.Nb={66:T.prototype.bd};V.Ob={66:T.prototype.kd,98:T.prototype.nd,162:T.prototype.md,194:T.prototype.ld};Ja(function(){for(var a=C(document,"pc8080","chipset"),b=0;b>>0,h],p=ka(n,k,a.Ta);0>p&&n.splice(-(p+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.I.push({ee:b,F:c,cd:d,Ma:e,bc:f})}delete this.Ma}return!0};Ed.prototype.Ja=function(){return!0}; function Fd(a,b,c,d){if(d)a.fa("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.Tb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.u=f;else if(h)for(a.u=Array(4*h.length),d=c=0;c>8&255,a.u[d++]=h[c]>>16&255,a.u[d++]=h[c]>>24&255;else a.u=e;a.Ma=e.symbols;if(!a.u.length){v("Empty ROM: "+b);return}if(1==a.u.length){v(a.u[0]);return}}catch(g){a.fa("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, " ").replace(/ +$/,"").split(" "),a.u=Array(b.length),e=0;e>>f.la;0>>=f.la;0Date.now()-d)return a.b[b]=d,Sd(a),!0;delete a.u[b]}if(a.C)switch(b){case "1p":Cd(a.C,U.Ra.Kc,c);break;case "2p":Cd(a.C,U.Ra.Oc,c);break;case "coin":Cd(a.C,U.Ra.zc,c);break;case "left":Cd(a.C,U.Ra.Mc,c);break;case "right":Cd(a.C,U.Ra.Nc,c);break;case "fire":Cd(a.C,U.Ra.Lc,c)}return!0} function Sd(a){for(var b=-1,c=Object.keys(a.b),d=0;db||b>f)b=f}else delete a.b[e],Qd(a,e,!1)}0<=b&&setTimeout(function(){Sd(a)},b)}X.prototype.D=function(a,b,c){D(this,a,b,c,"KBDUART.STATUS",null);this.A=b;Rd(this)};Ld.Nb={};Ld.Ob={130:X.prototype.D};Ja(function(){for(var a=C(document,"pc8080","keyboard"),b=0;b>3)*this.ca;if(this.rd||ub(this.A,this.ya,this.Va,3))1>1)),this.K=document.createElement("canvas"),this.K.width=b,this.K.height=c,this.fb= this.K.getContext("2d"),this.ma={},this.Ha=1<=a.od?8:16,f=8>(7> 4)*c)}return k} Td.prototype.Ca=function(){if(2==this.Y){for(var a={0:[32,"SET-UP A"],2:[64,'TO EXIT PRESS "SET-UP"'],22:[96," T T T T T T T T T"],23:[96,"1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"],24:[]},b=this.ya,c=-1,d=-1,e,f=-(60==this.rc?2:5);f>8&15|16;zb(this.A,b++,e);zb(this.A,b++,c& 255);if(g)break}if(h)for(c=0,e=1;ec&&(a=Math.round(c/b*100)+"%")}this.jc?(this.N.style.width=a,this.N.style.width=a,this.N.style.display="block",this.N.style.margin="auto"):(this.w.style.width=a,this.w.style.height="auto");this.w.style.backgroundColor="black";this.w.gb();a=!0}this.Ga&&this.Ga.focus()}return a}; function Wd(a,b){!b&&a.w&&(a.jc?a.N.style.width=a.N.style.height="":a.w.style.width=a.w.style.height="");fb(a,"notifyFullScreen("+b+")",!0)}function Yd(a,b){a.lc=b;a.za=!1;if(void 0===a.ka||a.ka.length!=a.lc)a.ka=Array(a.lc)}function ae(a,b,c,d,e){d=a.D?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.Y&&(208<=c&&236>c?e=a.Ha+0:28<=c&&72>c&&(e=a.Ha+1));a=a.ua[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]} function be(a){for(var b=a.ya,c=-1,d=0,e=60==a.rc?2:5,f=0,h=0;d>4)*n.ha,A=void 0,u=void 0,F=void 0,B=void 0,ha=n.oa,pa=n.ha;x?(A=k*p.oa,u=d*p.ha, F=p.oa,B=p.ha):(A=k*p.Kb,u=d*p.ic,F=p.Kb,B=p.ic);n.oa>p.oa&&(A*=2,F*=2);n.ha>p.ha&&(0==l&&(w+=p.ha),pa=p.ha);x?x.drawImage(n.canvas,t,w,ha,pa,A,u,F,B):(A+=0,u+=0,p.H.drawImage(n.canvas,t,w,ha,pa,A,u,F,B))}h++}f++}d++}}a.za=!0;h&&a.fb&&a.H.drawImage(a.K,0,0,a.J,a.ca-a.ha,0,0,a.pd,a.qd)} Ja(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<=ra().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height= (a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Ra.aspect);f&&.3<=f&&3.33>=f&&(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");xa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Td(d,e,h,f,c);db(d,c)}}); function ce(a){y.call(this,"Debugger",a,ce);this.style=de;this.ca=this.za=this.K=0;this.U=Y();this.Va=Y();this.D=-1;this.w=[];this.ea=!1;this.da=Y();this.I=[];this.ga={};this.C=this.Y=this.H=[];ee(this);this.ua=0;fe(this);this.Ga=[];ge(this,a.messages);this.Ha=a.commands;var b=this;window?void 0===window.$&&(window.$=function(a){return he(b,a)}):void 0===global.$&&(global.$=function(a){return he(b,a)})}Za(ce); var ie={"?":"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","int [#]":"request interrupt",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"}, de=8080,je="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(" "),ke="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(" "), le="B C D E H L M A BC DE HL SP PC PS PSW".split(" "),me=[[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,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]],ne={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:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};m=ce.prototype; m.Na=function(a,b,c,d){this.A=b;this.b=c;this.u=a;(a=hc(a,"messages"))&&ge(this,a);this.Sa=me;oe(this,function(a){a:{var b=d.A.V,c=a[0],g=a=0,k=b.length;if(c){a=pe(qe(d,c));if(-1===a){d.g("invalid address: "+c);break a}g=a>>>d.A.la;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=wb[c],n&&d.g(q(n.id)+" %"+q(g<>>e.la;f!=e.A?e.V[h].Yb(f,b&65535,d):(e.V[h++].Gb(f,b&255,d),e.V[h&e.J].Gb(0,b>>8&255,d+1));c&&re(a,c);kc(this.b,!0)}};function Y(a){return{F:a,La:!1}}function se(a){return[a.F,a.La]}function te(a){return{F:a[0],La:a[1]}} function qe(a,b,c){var d;c=(c?a.U:a.Va).F;if(void 0!==b){d=b=ue(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=na(le,a.substr(b,1))));return c}function Ae(a,b){var c=0,d=Be(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 Be(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.O;break;case 1:c=d.P;break;case 8:c=Lc(d);break;case 2:c=d.R;break;case 3:c=d.S;break;case 9:c=Nc(d);break;case 4:c=d.T;break;case 5:c=d.W;break;case 10:c=K(d);break;case 6:c=d.X(K(d));break;case 11:c=d.ia;break;case 12:c=d.M;break;case 13:c=Kc(d);break;case 14:c=Kc(d)&255|d.j<<8}}return c} function Ce(a,b){b=ue(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=ze(b,c+1),0<=e&&(b=b.substr(0,c)+Ae(a,e)+b.substr(c+1+le[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=qe(a,e))?(d=e+' "'+ye(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=qe(a,e))?(re(d),d=e+' "'+ ye(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+Z(Y(this.b.M).F));if(this.na&1073741824)this.ya.push(a);else if(!this.xa||a!=this.xa)if(this.xa=a,this.na&-2147483648&&(this.ja(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.pb=0;c.D-=c.b;c.b=0;kc(c)}}; function eb(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.na&g)!=g||a.message(b.cb+"."+(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):""))}m.Wa=function(){this.g("Type ? for help with PC8080 Debugger commands");this.Da();if(this.Ha){var a=this.Ha;this.Ha=null;he(this,a)}}; function fe(a){var b;if(cd(a)){if(!a.N||!a.N.length){a.N=Array(1E3);for(b=0;b>>d.la],!1)}a.Y=["br"];if(void 0!==a.H)for(b=1;b>>d.la],!0);a.H=["bw"];a.eb=0}m.Ua=function(a,b,c){var d=!0;c||He(this,a,b,!1,!0);if(a!=this.C){var e=pe(b);if(-1===e)this.g("invalid address: "+Z(b.F)),d=!1;else{var f=this.A;f.V[e>>>f.la].Ua(e&f.A,a==this.H)}}d&&(a.push(b),c?b.La=!0:(Ie(this,a,a.length-1,"set"),fe(this)));return d}; function He(a,b,c,d,e){var f=!1;c=pe(c);for(var h=1;h>>d.la],b==a.H));g.La||fe(a);break}}return f}function hf(a,b){for(var c=1;c>24,4);break;case 3:u=q(w.Oa(A,2),4);break;default:w="imm("+r(t)+")";break a}8086==w.style&&t&64?u="["+u+"]":t&16||(u=(w.style==de?"$":"0x")+u);w=u}else t& 16?(w=(p&3840)>>8,t=le[w],8086==a.style&&p&64&&(6==w&&(t="HL"),t="["+t+"]"),w=t):t&128&&(w=(f>>3&7).toString());if(!w||!w.length){g="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; function pf(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 ve(a,b,c){var d;if(b){b=ue(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=n+"b"+h;d>>=8}d="0x"+q(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function sf(a,b){if(b)return rf(a,b,a.ga[b]);var c=0;for(b in a.ga)rf(a,b,a.ga[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.cd;if(e>=h&&e>8&255;case "C":d.P=g&255;break;case "D":d.R= g&255;break;case "DE":d.R=g>>8&255;case "E":d.S=g&255;break;case "H":d.T=g&255;break;case "HL":d.T=g>>8&255;case "L":d.W=g&255;break;case "SP":d.ia=g&65535;break;case "PC":H(d,g);a.U=Y(d.M);break;case "PS":Ic(d,g);break;case "PSW":Ic(d,g&255|d.sa&-256);d.j=g>>8;break;case "CF":d.Z=g?d.Z|256:d.Z&255;break;case "PF":g?Rc(d)||(d.ba^=1):Rc(d)&&(d.ba^=1);break;case "AF":d.ta=g?~d.ba&16|d.ta&-17:d.ba&16|d.ta&-17;break;case "ZF":d.Z=g?d.Z&-256:d.Z|255;break;case "SF":g?Uc(d)||(d.ba^=192):Uc(d)&&(d.ba^=192); break;case "IF":d.sa=g?d.sa|512:d.sa&-513;break;default:a.g("unknown register: "+e);return}if(!h){a.g("invalid value: "+f);return}kc(d);a.g("updated registers:")}a.g(nf(a));c&&(a.U=Y(d.M),Fe(a,Z(a.U.F)))}}function zf(a,b){b=ja(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Ce(a,c[2])):ve(a,b,!0)}function Af(a,b,c){var d="t"!=b;c=qf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);ya(c,function(){return hb(a,!0)&&a.sb(e,d,!1)},function(){kc(a.b);hb(a,!1)})} function Fe(a,b,c,d){if(b=qe(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=qe(a,c,!0);if(!d||d.Fg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=kf(a,b,h,f);a.g(f);a.U=b;e-=b.F-k;c++}}} function xe(a,b,c,d){if(c)if(b){0>a.D&&a.w.length&&(a.D=0);if(0>a.D||b!=a.w[a.D])a.w.splice(0,0,b),a.D=0;a.D--}else a.ea?b="end":b=a.w[a.D+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(ja(b.substring(c,f))),c=f+1}}return a} function jf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.ea&&(a.g("ended assemble at "+Z(a.da.F)),a.U=a.da,a.ea=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.xa=null;if(jb(a)&&0l||"z"Ba.length&&(a.g("note: only "+Ba.length+" available"),ca=Ba.length);W-=ca;0>W&&(null==Ba[Ba.length-1].F?(ca=W+ca,W=0):W+=Ba.length); var fd=[];"call"==Oe&&(lb=1E5,fd=["CALL"]);for(void 0!==Ne&&a.g(ca+" instructions earlier:");0=Ba.length&&(W=0);a.fb=ca;Qe++;lb--}}Qe||(a.g("no "+Pe+"history available"),a.fb=void 0)}else{var mc=qe(a,za);if(mc){var nc=0;Ua&&("l"==Ua.charAt(0)&&(Ua=Ua.substr(1)||Vf),nc=qf(a,Ua)>>>0,65536>4||1;Xf--&&0rc?String.fromCharCode(rc):".";pc--}Va&&(Va+="\n");Va+=za+" "+Lb+(0==Kb?" "+hd:"")}Va&&a.g(Va);a.Va=mc}}}}break;case "e":if("else"==f[0])break;var sc=1,Te=255,Ue=a.X,Ve=a.qa;"ew"==f[0]&&(sc=2,Te=65535,Ue=a.Oa,Ve=a.Pb);var We=sc<<1,Xe=f[1];if(null==Xe)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 tc=qe(a,Xe);if(tc)for(var uc=2;ucod;){for(var Wa=null,cg=256;65536>Ob.F>>>0;){$e.F=a.Oa(Ob,2);if(null==Ob.F||!cg--)break;for(var dg=a,wc=$e,af=null,Pb=wc.F,bf=Pb,pd=1;6>=pd&&Pb;pd++){if(2\nLicense: GPL version 3 or later ");for(b=0;bKf){if(Gf(d,this.U)){this.H=new I(this,"1.23.3","failsafe");Gf(this.H)&&(Pf(this,d),a=2,Df(this.H));J(this.H,"timestamp",ma());Ef(this.H);var e=this.u&&!this.J;if(1==a||sa("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Ff(d)){var f=Hf(d,"code"),h=Hf(d,"data");f&&("ok"==f?Gf(d,h):("error"==f&& "no machine state"!=h?(this.fa("Error: "+h),"unable to verify user"==h&&(wa("user",""),this.C=null)):this.g(f+": "+h),Df(d),Gf(d)?(c=Ff(d),e=!0):c=!1))}e&&Of(this,c?d:null)}else 2==a&&d.clear()}else Of(this);delete this.U;delete this.Y}e=bb(this.id);for(f=0;fa[1];a=a[2];this.ma=!0;this.B.ra=!0;var d=this.L.power;d&&(d.textContent="Shutdown");this.b&&(Qf(this,this.b,b,c,a),lc(this.b));this.da&&(Pf(this,b),b.clear());!c&&this.H&&(this.H.clear(),delete this.H);this.w=0}; function Pf(a,b){if(sa("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.C||"",d=b.toString(),e={app:"PC8080",ver:"1.23.3"};e.url=a.ka;e.user=c;e.type="bug";e.data=d;oa("http://www.pcjs.org/api/v1/report",e,!0)}} function Bf(a,b,c){var d,e="none";if(a.w)return null;a.w--;var f=new I(a,"1.23.3"),h=new I(a,"1.23.3","validate"),g=ma();J(h,"timestamp",g);J(f,"timestamp",g);J(f,"version","1.23.3");J(f,"url",window?window.location.href:null);J(f,"browser",ra());a.b&&a.b.Ja&&(c&&a.b.ja(),d=a.b.Ja(b,c),"object"===typeof d&&J(f,a.b.id,d),c&&(a.b.B.ra=!1,!1===d&&(e=null)));for(var g=bb(a.id),k=0;k>>f.la;0>8|(u&255)<<8);n>F&A;ae(d,d.kc,n++,p,ha);F+=t}n>x&&(x=n);p=h&&(h=p+1)}g+=2;l++;if(n>=d.J&&(n=0,p++,p>d.ca))break}d.za=!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/g.exec(a)){var e=d[2];b("Loading "+e+"...");oa(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],l,n=/( [a-z]+=)(['"])(.*?)\2/g;l=n.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, "");a=a.replace(d[0],h);jg(a,b,c)}})}else c(a,null)} function kg(a,b,c,d){function e(a){if(void 0===g){var b=h&&C(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ga(a))}function f(a){e("Error: "+a);k&&(--Tf||Na(!0));k=!1}var h,g,k=!0;Tf++;$a[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],p=document.createElement("style");p.type="text/css";p.styleSheet?p.styleSheet.cssText=l:p.appendChild(document.createTextNode(l));n.appendChild(p)}c|| (c="/versions/pc8080/1.23.3/components.xsl");l=function(d,g){g?Uf(c,null,null,!1,e,function(d,k){if(k)if(ab(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--Tf||Na(!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),--Tf||Na(!0)):f("invalid machine element: "+ a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?Uf(b,a,d,!0,e,l):ig(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(x){f(x.message)}return k}window.embedPC8080=function(a,b,c,d){Na(!1);return kg(a,b,c,d)};window.enableEvents=Na;window.sendEvent=Oa; function lg(a,b,c,d){if(!c&&b){d.push(b);a=$a[d[0]];b=null;for(var e in a)if(ea(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?oa(b,null,!0,function(a,b){mg(b,d)}):mg(null,d)}else v("Error ("+c+") requesting "+a)} function mg(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=$a[f],k={},l;for(l in g){var n=g[l],p=da(l);if("xml"==p){for(p=/[ \t]*]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=p.exec(g[l]);){var x=d[2];x&&(g[x]||(n=n.replace(d[0],"")))}d=l=ba(l)}else"xsl"==p&&(e=l=ba(l));k[l]=n}a&&(k[l="css"]=a);b[2]&&(k[l="parms"]=b[2]);b[3]&&(k[l="state"]=b[3]);d&&e?(l=JSON.stringify(k),h+=".js",c=c[1]+"var resources="+l+";"+c[2]+c[3],c=c.replace(/\u00A9/g, "©"),l=h,g=null,k="data:application/javascript,",k=xa("Firefox")?k+encodeURIComponent(c):k+encodeURI(c),l&&(g=document.createElement("a"),"string"!=typeof g.download&&(g=null)),g?(g.href=k,g.download=l,document.body.appendChild(g),g.click(),document.body.removeChild(g),c="Check your Downloads folder for "+l+"."):(window.open(k),c="Check your browser for a new window/tab containing the requested data"+(l?" ("+l+")":"")+"."),c+=', copy it to your web server as "'+h+'", and then add the following to your web page:\n\n', c+='
\n',c+="...\n",c+='