(function(){/* http://pcjs.org/modules/shared/es6/dumpapi.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/reportapi.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/userapi.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/keys.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/strlib.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/weblib.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/cpudef.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/messages.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/state.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/embed.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/defines.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/component.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/usrlib.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/defines.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/panel.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/bus.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/memory.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/cpu.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/cpustate.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/cpuops.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/chipset.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/rom.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/ram.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/keyboard.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/video.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/serial.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/debugger.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/debugger.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pc8080/lib/computer.js (C) Jeff Parsons 2012-2017 */ var k;function ba(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a;for(var d in b)if(Object.defineProperties){var e=Object.getOwnPropertyDescriptor(b,d);e&&Object.defineProperty(a,d,e)}else a[d]=b[d]} var m={le:0,oe:1,pe:2,qe:3,re:4,se:5,te:6,ue:7,ve:8,we:9,xe:10,ye:11,ze:12,Ae:13,Be:14,Ce:15,De:16,Ee:17,Fe:18,Ge:19,He:20,Ie:21,Je:22,Ke:23,Le:24,Me:25,Ne:26," ":32,"!":33,'"':34,"#":35,$:36,"%":37,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,",":44,"-":45,".":46,"/":47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,";":59,"<":60,"=":61,">":62,"?":63,"@":64,pb:65,rc:66,tc:67,Rb:68,E:69,xc:70,yc:71,zc:72,Ac:73,Hc:74,Ic:75,Ub:76,Pc:77,Qc:78,Sc:79,Tc:80,Q:81,Zc:82,bd:83,hd:84,jd:85,kd:86,ld:87, nd:88,od:89,Db:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,pd:97,wf:98,xf:99,d:100,e:101,yf:102,zf:103,Af:104,Bf:105,Cf:106,k:107,Df:108,Ef:109,n:110,Ff:111,p:112,q:113,r:114,Gf:115,t:116,If:117,Jf:118,Kf:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126,Oe:127}; function n(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.bc=b.comment;this.wd=b;this.exports={};a=this.id.indexOf(".");0>a?this.$a=this.id:(this.ab=this.id.substr(0,a),this.$a=this.id.substr(a+1));this.G={ready:!1,jb:!1,Eb:!1,ja:!1,error:!1};this.vb=null;this.G.error=!1;this.P={};this.ha=d||0;this.K=this.u=this.H=this.S=this.ta=null;ca.push(this)}function da(a,b,c){ea[a]&&b&&(ea[a][b]=c)}function fa(){return Date.now()||+new Date} function ga(a,b,c){b||q((c?c+": ":"")+a)}function q(a){window&&window.alert(a)}function ha(a){var b=!1;window&&(b=window.confirm(a));return b}function ja(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>=3;return(c?"0o":"")+d}function x(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d} function Da(a){return x(a,2,!0)}function y(a){return x(a,4,!0)}function Ea(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0"']/g,function(a){return Ja[a]})}function Ka(a,b){return(a+" ").slice(0,b)} function Na(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var Ja={"&":"&","<":"<",">":">",'"':""","'":"'"},Oa={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"}; function Pa(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a>1,h;h=c(b,a[g]);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 Ra(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;cb.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Qa=g.load;d.Ia=g.exec;if(e=g.bytes)d.ma=e;else if(e=g.words)for(d.ma=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.ma=Array(4*e.length),f=c=0;c>8&255,d.ma[f++]=e[c]>>16&255,d.ma[f++]=e[c]>>24&255;else d.ma=g;d.ra=g.symbols;d.ma.length?1==d.ma.length&&(q(d.ma[0]),d=null):(q("Empty resource: "+a),d=null)}catch(h){q("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c>1)+2;10>this.g&&(this.g=10);15>2;this.j=this.w-1;this.L=this.N/this.w|0;this.I=this.L-1;this.A=[];this.B=[];this.D=this.F=!1;this.R=[];this.T=[];a=new z;yb(a,this.K);this.b=Array(this.L);for(b=0;b>>a.g;0f&&(p=f);if(h&&h.size){if(h.type==d){if(e+f<=h.J)return h.mb+=h.J-e,h.J=e,!0;if(e>=h.J+h.mb){p=h.size-(e-l);p>f&&(p=f);h.mb=e-h.J+p;e=l+a.w;f-=p;g++;continue}}return Ab(Bb,e,f)}e=new z(e,p,a.w,d);yb(e,a.K,h);a.b[g++]=e;e=l+a.w;f-=p}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Cb[d]+" at "+y(b)),!0):Ab(Db,b,c)} function Eb(a,b){return a.b[(b&a.C)>>>a.g].lb(b&a.j,b)}function Fb(a,b){var c=b&a.j,d=(b&a.C)>>>a.g;return c!=a.j?a.b[d].kc(c,b):a.b[d++].Xa(c,b)|a.b[d&a.I].Xa(0,b+1)<<8}function Gb(a,b){var c=b&a.j,d=(b&a.C)>>>a.g;return c!=a.j?a.b[d].Jb(c,b):a.b[d++].lb(c,b)|a.b[d&a.I].lb(0,b+1)<<8}function Hb(a,b,c){a.b[(b&a.C)>>>a.g].nb(b&a.j,c&255,b)}function Ib(a,b,c){var d=b&a.j,e=(b&a.C)>>>a.g;d!=a.j?a.b[e].nc(d,c&65535,b):(a.b[e++].Ya(d,c&255,b),a.b[e&a.I].Ya(0,c>>8&255,b+1))} function Jb(a){for(var b=0,c=[],d=0;d>>=f)&l;if(void 0!==g){if(g[0])g[0](b,l,d);a.K&&a.F!=g[1]&&Tb(a.K,b,l)}else a.K&&(za(a.K,a,b,l,d),a.F&&Tb(a.K,b,l));f+=h<<3;b+=h;e-=h}}function Ab(a,b,c){q("Memory block error ("+a+": "+x(b)+","+x(c)+")");return!1}var Bb=1,Db=2,Ub;if(qb){var Vb=new ArrayBuffer(2);(new DataView(Vb)).setUint16(0,256,!0);Ub=256===(new Uint16Array(Vb))[0]}else Ub=!1;var Wb=Ub; function z(a,b,c,d){this.id=Xb+=2;this.b=null;this.J=a;this.mb=b;this.size=c||0;this.type=d||Yb;this.u=d==Zb;yb(this);this.Ca=this.gc=!1;if(c)if(qb)this.j=new ArrayBuffer(c),this.w=new DataView(this.j,0,c),this.g=new Uint8Array(this.j,0,c),this.A=new Uint16Array(this.j,0,c>>1),this.b=new Int32Array(this.j,0,c>>2),$b(this,Wb?ac:bc);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)};k.Xd=function(a){return this.b[a>>2]>>>((a&3)<<3)&255};k.ae=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};k.fe=function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<>8);this.Ca=!0};k.Vd=function(a,b){if(this.K&&null!=this.J){var c=this.K;sc(c,this.J+a,1,c.I)&&c.da(!0)}return this.lb(a,b)};k.Zd=function(a,b){if(this.K&&null!=this.J){var c=this.K;sc(c,this.J+a,2,c.I)&&c.da(!0)}return this.Jb(a,b)}; k.de=function(a,b,c){if(this.K&&null!=this.J){var d=this.K;sc(d,this.J+a,1,d.w)&&d.da(!0)}this.u?this.ob(0,b):this.nb(a,b,c)};k.he=function(a,b,c){if(this.K&&null!=this.J){var d=this.K;sc(d,this.J+a,2,d.w)&&d.da(!0)}this.u?this.ob(0,b):this.Ob(a,b,c)};k.Ud=function(a){return this.g[a]};k.Wd=function(a){return this.g[a]};k.Yd=function(a){return this.w.getUint16(a,!0)};k.$d=function(a){return a&1?this.g[a]|this.g[a+1]<<8:this.A[a>>1]};k.ce=function(a,b){this.g[a]=b;this.Ca=!0}; k.ee=function(a,b){this.g[a]=b;this.Ca=!0};k.ge=function(a,b){this.w.setUint16(a,b,!0);this.Ca=!0};k.ie=function(a,b){a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.A[a>>1]=b;this.Ca=!0};var Yb=0,Zb=2,Cb=["NONE","RAM","ROM","VID","H/W"],Xb=0,ec=[],cc=[z.prototype.Xd,z.prototype.fe,z.prototype.ae,z.prototype.je],hc=[z.prototype.Vd,z.prototype.de,z.prototype.Zd,z.prototype.he];if(qb)var bc=[z.prototype.Ud,z.prototype.ce,z.prototype.Yd,z.prototype.ge],ac=[z.prototype.Wd,z.prototype.ee,z.prototype.$d,z.prototype.ie]; function tc(a,b){n.call(this,"CPU",a,0,1);var c=a.multiplier||1;this.Fa=a.cycles||b;this.U=c;this.Sa=Math.round(this.Fa/1E4)/100;this.Z=this.Sa*this.U;this.G.ka=!1;this.G.Mb=!1;this.G.ib=a.autoStart;this.G.ec=!1;this.G.Va=!1;this.ya=this.oa=0;this.za=a.csStart;this.na=a.csInterval;this.sa=a.csStop;this.T=[];this.zb=this.qb.bind(this);sa(this)}ba(tc,n);k=tc.prototype; k.Ea=function(a,b,c,d){this.S=a;this.H=b;this.K=d;for(b=0;b=a.oa&&(a.oa+=a.na,c=!0);0<=a.sa&&a.sa<=Cc(a)&&(a.na=a.sa=-1,xc(a),a.da(),c=!0);c&&a.i(Cc(a)+" cycles: checksum="+x(a.ya))}} k.ca=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.P[b]=c;a=!0;break;case "run":this.P[b]=c;c.onclick=function(){var a;if(a=d.S)if(a=d.S,a.G.ja)a=!0;else{var b=null,c,h=ja(a.id);for(c=0;ca.Y/a.Z?b=1:d=!0;a.U=b;b=a.Sa*a.U;if(a.Z!=b){a.Z=b;b=a.Z.toFixed(2)+"Mhz";var e=a.P.setSpeed;e&&(e.textContent=b);a.i("target speed: "+b)}c&&a.S&&Hc(a.S)}Ec(a,a.X);a.X=0;a.V=fa();a.ea=0;Fc(a);return d}function Ic(a,b){var c=a.T.length;a.T.push([-1,b]);return c}function Jc(a,b,c){0<=b&&ba.T[b][0]&&(c*=a.Fa*a.U/1E3,a.T[b][0]=c+Kc(a))}function Kc(a,b){var c=a.ga-=a.b;a.b=0;b&&(a.ga=0);return c} k.qb=function(a){if(va(this,!0)){if(!this.G.ka){Dc(this);this.S&&this.S.start(this.V,Cc(this));this.G.ka=!0;this.G.Mb=!0;this.W&&this.W.start();var b=this.P.run;b&&(b.textContent="Halt");this.S&&(Lc(this.S,!0),a&&Hc(this.S,!0))}this.Ua>=this.Fa&&Fc(this,!0);this.Ha=0;this.Ma=fa();this.ea&&(a=this.Ma-this.ea,a>this.gb&&(this.V+=a,this.V>this.Ma&&(this.V=this.Ma)));try{do{for(var c,d=this.G.Va?1:this.Na,e=this.T.length-1;0<=e;e--){var f=this.T[e];0>f[0]||d>f[0]&&(d=f[0])}c=d;this.Ab(c);c=Kc(this,!0); this.Ha+=c;this.X+=c;Bc(this,c);a=c;for(var g=this.T.length-1;0<=g;g--){var h=this.T[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.va-=c;if(0>=this.va){this.va+=this.Na;++this.hb>=Mc&&(this.S&&Lc(this.S),this.hb=0);break}}while(this.G.ka)}catch(l){this.da();Ac(this);this.S&&this.S.stop(fa(),Cc(this));va(this,!1);qa(this,l.stack||l.message);return}c=setTimeout;d=this.zb;this.ea=fa();e=this.gb;this.Ha&&(e=Math.round(e*this.Ha/this.Na));e-=this.ea-this.Ma;if(f=this.ea-this.V)this.Y=Math.round(this.X/ (10*f))/100,864E5<=f&&(this.la=0,Dc(this));if(0>e||this.Ye&&(this.V-=e),e=0;this.Ua+=this.Ha;this.ea+=e;c(d,e)}else Ac(this),this.S&&this.S.stop(fa(),Cc(this))};k.Ab=function(){return 0};k.da=function(a){ua(this,!0);Kc(this);Ec(this,this.X);this.X=0;if(this.G.ka){this.G.ka=!1;this.W&&this.W.stop();var b=this.P.run;b&&(b.textContent="Run")}this.G.complete=a};function Ac(a,b){if(a.S){for(var c=a.S,d=0;d>8&255;a.A=b&255}function jd(a){return a.B<<8|a.C}function kd(a,b){a.B=b>>8&255;a.C=b&255}function D(a){return a.D<<8|a.F} function ld(a,b){a.D=b>>8&255;a.F=b&255}function C(a,b){a.j=b&65535}function md(a){return a.I&256?1:0}function nd(a,b){a.I=a.I&255|b}function od(a){return sb[a.L&255]?4:0}function pd(a){return(a.L^a.O)&16?16:0}function qd(a){return a.I&255?0:64}function rd(a){return a.L&128?128:0}function Uc(a){return a.N&-214|rd(a)|qd(a)|pd(a)|od(a)|md(a)}function Sc(a,b){a.I=a.L=a.O=0;b&1&&(a.I|=256);b&4||(a.L|=1);b&16&&(a.O|=16);b&64||(a.I|=255);b&128&&(a.L^=192);a.N=a.N&-726|b&512|2} function sd(a,b){a.O=a.g^b;return a.L=(a.I=a.g+b)&255}function td(a,b){a.O=a.g^b;return a.L=(a.I=a.g+b+(a.I&256?1:0))&255}function ud(a,b){a.I=a.L=a.O=a.g&b;(a.g|b)&8&&(a.O^=16);return a.I}function vd(a,b){a.O=b^255;b=a.L=b+255&255;a.I=a.I&-256|b;return b}function wd(a,b){a.O=b;b=a.L=b+1&255;a.I=a.I&-256|b;return b}function xd(a,b){return a.L=a.I=a.O=a.g|b}function E(a,b){b^=255;a.O=a.g^b;return a.L=(a.I=a.g+b+1^256)&255} function yd(a,b){b^=255;a.O=a.g^b;return a.L=(a.I=a.g+b+(a.I&256?0:1)^256)&255}function zd(a,b){return a.L=a.I=a.O=a.g^b}function F(a,b){a=a.H;return a.b[(b&a.C)>>>a.g].Xa(b&a.j,b)}function Ad(a,b,c){a=a.H;a.b[(b&a.C)>>>a.g].Ya(b&a.j,c&255,b)}function G(a){var b=F(a,a.j);C(a,a.j+1);return b}function H(a){var b=Fb(a.H,a.j);C(a,a.j+2);return b}function Bd(a){var b=Fb(a.H,a.M);a.M=a.M+2&65535;return b}function I(a,b){a.M=a.M-2&65535;Ib(a.H,a.M,b)} function Cd(a){if(a.b&&a.R&255&&a.N&512){for(var b=0;8>b&&!(a.R&1<b?255:1<>8;nd(this,a&256);this.b-=4},Gd,function(){var a;ld(this,a=D(this)+Wc(this));nd(this,a>>8&256);this.b-=10},function(){this.g=F(this,Wc(this));this.b-=7},function(){id(this,Wc(this)-1);this.b-= 5},function(){this.A=wd(this,this.A);this.b-=5},function(){this.A=vd(this,this.A);this.b-=5},function(){this.A=G(this);this.b-=7},function(){var a=this.g<<8&256;this.g=(a|this.g)>>1;nd(this,a);this.b-=4},Gd,function(){kd(this,H(this));this.b-=10},function(){Ad(this,jd(this),this.g);this.b-=7},function(){kd(this,jd(this)+1);this.b-=5},function(){this.B=wd(this,this.B);this.b-=5},function(){this.B=vd(this,this.B);this.b-=5},function(){this.B=G(this);this.b-=7},function(){var a=this.g<<1;this.g=a&255| md(this);nd(this,a&256);this.b-=4},Gd,function(){var a;ld(this,a=D(this)+jd(this));nd(this,a>>8&256);this.b-=10},function(){this.g=F(this,jd(this));this.b-=7},function(){kd(this,jd(this)-1);this.b-=5},function(){this.C=wd(this,this.C);this.b-=5},function(){this.C=vd(this,this.C);this.b-=5},function(){this.C=G(this);this.b-=7},function(){var a=this.g<<8;this.g=(md(this)<<8|this.g)>>1;nd(this,a&256);this.b-=4},Gd,function(){ld(this,H(this));this.b-=10},function(){var a=H(this);Ib(this.H,a,D(this)); this.b-=16},function(){ld(this,D(this)+1);this.b-=5},function(){this.D=wd(this,this.D);this.b-=5},function(){this.D=vd(this,this.D);this.b-=5},function(){this.D=G(this);this.b-=7},function(){var a=0,b=md(this);if(pd(this)||9<(this.g&15))a|=6;if(b||154<=this.g)a|=96,b=1;this.g=sd(this,a);nd(this,b?256:0);this.b-=4},Gd,function(){var a;ld(this,a=D(this)+D(this));nd(this,a>>8&256);this.b-=10},function(){var a;a=H(this);a=Fb(this.H,a);ld(this,a);this.b-=16},function(){ld(this,D(this)-1);this.b-=5},function(){this.F= wd(this,this.F);this.b-=5},function(){this.F=vd(this,this.F);this.b-=5},function(){this.F=G(this);this.b-=7},function(){this.g=~this.g&255;this.b-=4},Gd,function(){this.M=H(this)&65535;this.b-=10},function(){Ad(this,H(this),this.g);this.b-=13},function(){this.M=this.M+1&65535;this.b-=5},function(){var a=D(this);Ad(this,a,wd(this,F(this,a)));this.b-=10},function(){var a=D(this);Ad(this,a,vd(this,F(this,a)));this.b-=10},function(){Ad(this,D(this),G(this));this.b-=10},function(){this.I|=256;this.b-= 4},Gd,function(){var a;ld(this,a=D(this)+this.M);nd(this,a>>8&256);this.b-=10},function(){this.g=F(this,H(this));this.b-=13},function(){this.M=this.M-1&65535;this.b-=5},function(){this.g=wd(this,this.g);this.b-=5},function(){this.g=vd(this,this.g);this.b-=5},function(){this.g=G(this);this.b-=7},function(){nd(this,md(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.w=this.A;this.b-=5},function(){this.w=this.B;this.b-=5},function(){this.w=this.C;this.b-=5},function(){this.w=this.D;this.b-= 5},function(){this.w=this.F;this.b-=5},function(){this.w=F(this,D(this));this.b-=7},function(){this.w=this.g;this.b-=5},function(){this.A=this.w;this.b-=5},function(){this.b-=5},function(){this.A=this.B;this.b-=5},function(){this.A=this.C;this.b-=5},function(){this.A=this.D;this.b-=5},function(){this.A=this.F;this.b-=5},function(){this.A=F(this,D(this));this.b-=7},function(){this.A=this.g;this.b-=5},function(){this.B=this.w;this.b-=5},function(){this.B=this.A;this.b-=5},function(){this.b-=5},function(){this.B= this.C;this.b-=5},function(){this.B=this.D;this.b-=5},function(){this.B=this.F;this.b-=5},function(){this.B=F(this,D(this));this.b-=7},function(){this.B=this.g;this.b-=5},function(){this.C=this.w;this.b-=5},function(){this.C=this.A;this.b-=5},function(){this.C=this.B;this.b-=5},function(){this.b-=5},function(){this.C=this.D;this.b-=5},function(){this.C=this.F;this.b-=5},function(){this.C=F(this,D(this));this.b-=7},function(){this.C=this.g;this.b-=5},function(){this.D=this.w;this.b-=5},function(){this.D= this.A;this.b-=5},function(){this.D=this.B;this.b-=5},function(){this.D=this.C;this.b-=5},function(){this.b-=5},function(){this.D=this.F;this.b-=5},function(){this.D=F(this,D(this));this.b-=7},function(){this.D=this.g;this.b-=5},function(){this.F=this.w;this.b-=5},function(){this.F=this.A;this.b-=5},function(){this.F=this.B;this.b-=5},function(){this.F=this.C;this.b-=5},function(){this.F=this.D;this.b-=5},function(){this.b-=5},function(){this.F=F(this,D(this));this.b-=7},function(){this.F=this.g; this.b-=5},function(){Ad(this,D(this),this.w);this.b-=7},function(){Ad(this,D(this),this.A);this.b-=7},function(){Ad(this,D(this),this.B);this.b-=7},function(){Ad(this,D(this),this.C);this.b-=7},function(){Ad(this,D(this),this.D);this.b-=7},function(){Ad(this,D(this),this.F);this.b-=7},function(){var a=this.j-1;if(this.La.length)for(var b=0;b>8;this.b-=10},function(){var a=H(this);rd(this)||C(this,a);this.b-=10},function(){this.N&=-513;this.b-=4},function(){var a=H(this);rd(this)||(I(this,this.j),C(this,a),this.b-=6);this.b-=11},function(){I(this,Uc(this)&255|this.g<<8);this.b-=11},function(){this.g=xd(this,G(this));this.b-=7},function(){I(this,this.j);C(this,48);this.b-=11},function(){rd(this)&& (C(this,Bd(this)),this.b-=6);this.b-=5},function(){this.M=D(this)&65535;this.b-=5},function(){var a=H(this);rd(this)&&C(this,a);this.b-=10},function(){this.N|=512;this.b-=4;Cd(this)},function(){var a=H(this);rd(this)&&(I(this,this.j),C(this,a),this.b-=6);this.b-=11},Jd,function(){E(this,G(this));this.b-=7},function(){I(this,this.j);C(this,56);this.b-=11}]; function Kd(a){n.call(this,"ChipSet",a,0,32768);var b=a.model;b&&!Ld[b]&&ga("Unrecognized ChipSet model: "+b);this.g=Ld[b]||{};a.sound&&(this.U=null,window&&(this.U=window.AudioContext||window.webkitAudioContext),this.U&&new this.U);sa(this)}ba(Kd,n);k=Kd.prototype;k.ca=function(){return!1}; k.Ea=function(a,b,c,d){this.H=b;this.u=c;this.K=d;this.S=a;this.B=vb(a,"Keyboard");this.C=vb(a,"SerialPort");this.video=vb(a,"Video");Nb(b,this,this.g.xb);Rb(b,this,this.g.yb);if(d){var e=this;Md(d,16384,function(){for(var a="",b=0;b>8-this.T&255;v(this,a,null,b,"SHIFT.RESULT",c,!0);return c};k.Kd=function(a,b,c){v(this,a,b,c,"SHIFT.COUNT",null,!0);this.T=b};k.Md=function(a,b,c){v(this,a,b,c,"SOUND1",null,!0);this.Y=b};k.Ld=function(a,b,c){v(this,a,b,c,"SHIFT.DATA",null,!0);this.N=b<<8|this.N>>8}; k.Nd=function(a,b,c){v(this,a,b,c,"SOUND2",null,!0);this.Z=b};k.Od=function(a,b,c){v(this,a,b,c,"WATCHDOG",null,!0)};function Od(a){var b=0,c=0,d=~a.M;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} k.Ed=function(a,b){var c=this.D,c=c&~L.xa.Yb;if((Cc(this.u)&64)<<1&&(c|=L.xa.Yb,c!=this.D)){var d,e;d=this.L&1;e=this.L>>1&7;switch(e){case L.Aa.Ja.dd:break;case L.Aa.Ja.oc:this.M=this.M<<1|d;break;case L.Aa.Ja.wc:d=Od(this);this.j[d]=L.Aa.sb;xa(this,"doNVRCommand(): erase data at addr "+y(d));break;case L.Aa.Ja.pc:this.b=this.b<<1|d;break;case L.Aa.Ja.md:d=Od(this);e=this.b&L.Aa.sb;this.j[d]=e;xa(this,"doNVRCommand(): write data "+y(e)+" to addr "+y(d));break;case L.Aa.Ja.ad:d=Od(this);e=this.j[d]; null==e&&(e=L.Aa.sb);this.b=e;xa(this,"doNVRCommand(): read data "+y(e)+" from addr "+y(d));break;case L.Aa.Ja.cd:this.b<<=1;this.R=this.b&L.Aa.sb+1;break;default:xa(this,"doNVRCommand(): unrecognized command "+Da(e))}}c&=~L.xa.Zb;this.R&&(c|=L.xa.Zb);c&=~L.xa.Tb;if(d=this.B){d=this.B;if(e=d.A)e=d.u,e=Cc(d.u)>=d.F+e.Fa*e.U/1E3*1.2731488;e&&(d.A=!1);d=!d.A}d&&(c|=L.xa.Tb);c&=~L.xa.ac;this.C&&this.C.ia&Pd&&(c|=L.xa.ac);this.D=c;v(this,a,null,b,"FLAGS",c);return c}; k.Pd=function(a,b,c){v(this,a,b,c,"BRIGHTNESS");this.W=b};k.Sd=function(a,b,c){v(this,a,b,c,"NVR.LATCH");this.L=b};k.Rd=function(a,b,c){v(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.w=this.w&-4|a;break;case 1:this.w=this.w&-13|a<<2;this.video&&(b=this.video,a=this.w,xa(b,"updateScrollOffset("+a+")"),b.sa!==a&&((b.sa=a)?Nc(b,!0):b.ya=!0));break;case 2:switch(a){case 0:this.O=~this.O;break;case 2:case 3:this.X=3-a}break;case 3:this.V=a}}; k.Qd=function(a,b,c){v(this,a,b,c,"DC011");b&L.Ka.$c?(b&=L.Ka.$b,this.I!=b&&(this.I=b,this.video&&(a=this.video,b=this.I==L.Ka.$b?50:60,xa(a,"updateRate("+b+")"),a.gb=b))):(b&=L.Ka.Qb,this.F!=b&&(this.F=b,this.video&&(a=this.F==L.Ka.Qb?132:80,b=this.video,xa(b,"updateDimensions("+a+","+(80>>0,g],t=Pa(r,l,a.dc);0>t&&r.splice(-(t+1),0,l)}p&&(h.a=p.replace(/''/g,'"'))}a.A.push({Hf:b,J:c,Gd:d,ra:e,cc:f})}delete this.ra}return!0};Sd.prototype.wa=function(){return!0}; function Td(a,b,c,d){if(d)a.aa("Unable to load system ROM (error "+d+": "+b+")");else{da(a.ab,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,g=e.data;if(f)a.b=f;else if(g)for(a.b=Array(4*g.length),d=c=0;c>8&255,a.b[d++]=g[c]>>16&255,a.b[d++]=g[c]>>24&255;else a.b=e;a.ra=e.symbols;if(!a.b.length){q("Empty ROM: "+b);return}if(1==a.b.length){q(a.b[0]);return}}catch(h){a.aa("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm, " ").replace(/ +$/,"").split(" "),a.b=Array(b.length),e=0;e>>f.g;0>>= f.g;0=m.pb&&a<=m.Db?d.j&(fe|ge)||(d.j|=ge,he(d,20,!0),De(d)):a>=m.pd&&a<=m.z&&d.j&ge&&(d.j&=~ge,he(d,20,!1),De(d));return!0},c.onpaste=function(a){a:{if(d.C&&d.C.Ra&&(a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(), a=a.clipboardData||window.clipboardData)){Ee(d.C,a.getData("Text"));a=!1;break a}a=!0}return a},!0;default:if(this.b.Ta&&void 0!==this.b.Ta[b])return this.P[e]=c,c.onclick=function(a,b){return function(c){c.preventDefault&&c.preventDefault();he(a,b,!0,!0)}}(this,this.b.Ta[b]),!0}}return!1};k.Ea=function(a,b,c,d){this.S=a;this.u=c;this.K=d;var e=this;this.L=Ic(this.u,function(){Fe(e)});this.W=vb(a,"ChipSet");this.C=vb(a,"SerialPort");Nb(b,this,this.b.xb);Rb(b,this,this.b.yb)}; k.ua=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};k.wa=function(a){return a?this.save():!0};k.reset=function(){this.g=[];this.j=0;this.b.INIT&&!this.restore(this.b.INIT)&&this.aa("reset error")};k.save=function(){var a=new Vc(this);switch(this.b.pa){case M.pa:a.set(0,[this.D,this.B,this.A,this.F,-1])}return a.data()}; k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.b.pa){case Ge.pa:return!0;case M.pa:return this.D=b[0],De(this,this.D&M.Ba.Vb),this.B=b[1],this.A=b[2],this.F=b[3],this.w=b[4],!0}return!1};function De(a,b){var c;null!=b?a.I=b:b=a.I;for(var d in a.b.bb)if(c="led-"+d,c=a.P[c]){var e=a.b.bb[d],f=!!(b&e);e&e-1&&(f=!(b&~e));c.style.backgroundColor=f?"#"+x(16711680,6):"#000000"}if(c=a.P["led-caps-lock"])c.style.backgroundColor=a.j&ge?"#"+x(65280,6):"#000000"} function ee(a,b,c){var d=!0,e=b.keyCode,f=2==b.location,g=0;switch(e){case 16:g=f?He:Ie;break;case 17:g=f?Je:Ke;break;case 18:g=f?Le:Me;break;case 91:g=f?Ne:Oe;break;case 20:g=ge}g&&(a.j=c?a.j|g:a.j&~g);var h;a:if(e=a.b.Pb[e]||e,a.b.Cb[e])h=e;else{for(h in a.b.Ta)if(a.b.Ta[h]===e)break a;h=null}h&&!b.metaKey&&(d=!1,a.j&(Pe|Qe)&&(13==h?(h=118,d=!0):8==h&&(h=46,d=!0),d&&(a.j=c?a.j|Qe:a.j&~Qe)),d=he(a,h,c),(!(h>=m.pb&&h<=m.Db)||a.j|Re)&&b.preventDefault&&b.preventDefault());return d} function he(a,b,c,d){var e;a:{for(e=0;ee?a.g.push({Lb:b,Ib:Date.now(),ub:d||!1}):(a.g[e].Ib=Date.now(),a.g[e].ub=d||!1),d&&Fe(a);else if(0<=e){if(!a.g[e].ub&&(d=a.g[e].Ib)&&Date.now()-dc||c>e)c=e}else{he(a,d,!1);b=0;continue}}b++}0<=c&&Jc(a.u,a.L,c)}k.Fd=function(a,b){var c=this.B;0<=this.w&&(this.w>3)*a.N,!zb(a.H,a.la,a.L,3)))return!1;a.L?(a.Ua=a.j.createImageData(b,c),a.eb=16/a.na|0,Ze(a,a.L>>1)):Ze(a,(a.O+1)*a.Z);a.D=document.createElement("canvas");a.D.width=b;a.D.height=c;a.va=a.D.getContext("2d");a.T={};a.X=1<=a.Ha?8:16,f=8>(7>4)*c)}return l}Ue.prototype.ua=function(){return!0};Ue.prototype.ca=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.Fa[b]=c,!0;switch(b){case "fullScreen":return this.P[b]=c,this.b&&this.b.Wa?c.onclick=function(){d.Wa()}:c.parentNode.removeChild(c),!0}return!1}; Ue.prototype.Wa=function(){var a=!1;if(this.b){if(this.b.Wa){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.M/this.I;b>c&&(a=Math.round(c/b*100)+"%")}this.Sa?(this.F.style.width=a,this.F.style.width=a,this.F.style.display="block",this.F.style.margin="auto"):(this.b.style.width=a,this.b.style.height="auto");this.b.style.backgroundColor="black";this.b.Wa();a=!0}this.V&&this.V.focus()}return a}; function Xe(a,b){!b&&a.b&&(a.Sa?a.F.style.width=a.F.style.height="":a.b.style.width=a.b.style.height="");xa(a,"notifyFullScreen("+b+")")}function Ze(a,b){a.cb=b;a.W=!1;if(void 0===a.A||a.A.length!=a.cb)a.A=Array(a.cb)}function kf(a,b,c,d,e){d=a.g?(b.height-c-1)*b.width+d:c+d*b.width;e&&a.Y==af&&(208<=c&&236>c?e=a.X+bf:28<=c&&72>c&&(e=a.X+cf));a=a.U[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 Nc(a,b){var c=!0;if(!b){a.oa&&(120==a.oa?a.fb&1?(Dd(a.u,2),c=!1):Dd(a.u,1):Dd(a.u,4));if(c&&a.W&&a.L){for(var d=a.H,e=a.L,f=!0,g=a.la>>>d.g;0>=1);;){var w=Eb(a.H,r++);if((w&lf)==lf){var u=Eb(a.H,r++),d=u&mf,c=(u&nf)<<8|Eb(a.H,r),c=c+(u&of? pf:qf);break}if(p>4)*w.ba,K,ia,ta,ma,La=w.fa,dc=w.ba;B?(K=A*u.fa,ia=e*u.ba,ta=u.fa,ma=u.ba):(K=A*u.La,ia=e*u.Ma,ta=u.La,ma=u.Ma);w.fa>u.fa&&(K*=2,ta*=2);w.ba>u.ba&&(t==jf&&(S+=u.ba),dc=u.ba);B?B.drawImage(w.canvas,ya,S,La,dc,K,ia,ta,ma):(K+=0,ia+=0,u.j.drawImage(w.canvas, ya,S,La,dc,K,ia,ta,ma))}h++}g++}e++}}a.W=!0;!b&&a.ya&&1==h&&(a.A[l]=-1,h=0);a.ya=!1;(h||b)&&a.va&&a.j.drawImage(a.D,0,a.sa,a.C,a.N-a.ba,0,0,a.zb,a.rd)}else{e=a.la;f=e+a.L;l=h=g=0;b=a.C;p=0;c=a.N;t=d=0;r=a.na;A=(1<>8|(u&255)<<8);h>B&A,kf(a,a.Ua,h++,l,ya),B+=r;h>p&&(p=h);l=d&&(d=l+1)}e+=2;g++;if(h>=a.C&&(h=0,l++,l>a.N))break}a.W=!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<=Ua().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||cb("aspect"));f&&.3<=f&&3.33>=f&&(gb("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");bb("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var g=e.getContext("2d"),d=new Ue(d,e,g,f,c);oa(d,c)}}); function rf(a){n.call(this,"SerialPort",a,0,8388608);this.T=+a.adapter;switch(this.T){case 0:this.U=0;this.X=2;break;default:q("Unrecognized serial adapter #"+this.T);return}this.g=this.j=null;this.V=a.tabSize;this.R=a.charBOL;this.w=0;this.N=!1;this.D=!0;var b=a.binding;if("console"==b)this.j="";else{var c;a=sf;b&&(void 0===c&&(c="Panel"),(c=la(c,this.id))&&(b=c.P[b])&&this.ca(null,a,b))}this.A="";this.b=this.Ra=this.I=null;this.exports={connect:this.ic,receiveData:this.Kb,receiveStatus:this.be}} ba(rf,n);k=rf.prototype; k.ca=function(a,b,c,d){var e=this;switch(b){case sf:return this.P[b]=this.g=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64");if(2==c.length){var d=Na(c[0]);if(d!=this.$a)return;c=Na(c[1]);if(this.b=ka(c)){var e=this.b.exports;if(e){var f=e.connect;f&&f.call(this.b,this.D);if(this.Ra=e.receiveData){this.D=a;this.I=e.receiveStatus;this.status(this.ab+"."+d+" connected to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; k.ua=function(a,b){if(!b)if(this.ic(this.D),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.wa=function(a){return a?this.save():!0};k.reset=function(){wf(this)};k.save=function(){var a=new Vc(this),b=0,c=[];c[b++]=this.F;c[b++]=this.M;c[b++]=this.O;c[b++]=this.ia;c[b++]=this.B;c[b++]=this.C;c[b]=this.L;a.set(0,c);return a.data()};k.restore=function(a){return wf(this,a[0])}; function wf(a,b){var c=0;b||(b=xf);a.F=b[c++];a.M=b[c++];a.O=b[c++];a.ia=b[c++];a.B=b[c++];a.C=b[c++];a.L=b[c];return!0}function yf(a,b){var c=a.L&b;b&15||(c>>=4);b=zf[c];c=((a.B&Af)>>2)+6;a.B&Bf&&c++;c+=((a.B&Cf)>>6)+1>>1;return 1E3/Math.round(b/c)}function tf(a,b){xa(a,"receiveByte("+Da(b)+"), status="+Da(a.ia));return a.N||a.ia&Df?!1:(a.M=b,a.ia|=Df,Dd(a.u,a.X),!0)} k.Kb=function(a){null!=a&&(this.A="number"!=typeof a?a:this.A+String.fromCharCode(a));this.A&&(tf(this,this.A.charCodeAt(0))&&(this.A=this.A.substr(1)),this.A&&this.u&&Jc(this.u,this.Y,yf(this,Ef)));return!0};k.be=function(a){this.ia&=~Ff;a&64&&(this.ia|=Ff)};function Ee(a,b){a.ia=a.ia|Pd|Gf;b&&a.Ra&&a.Ra.call(a.b,b)}k.zd=function(a,b){var c=this.M;v(this,a,null,b,"DATA",c);this.ia&=~Df;return c};k.yd=function(a,b){var c=this.ia;v(this,a,null,b,"STATUS",c);return c}; k.Jd=function(a,b,c){v(this,a,b,c,"DATA");this.O=b;this.ia&=~(Pd|Gf);xa(this,"transmitByte("+Da(b)+")");if(19==b)this.N=!0;else if(17==b)this.N=!1;else if(this.Ra&&this.Ra.call(this.b,b),this.g)if(8==b)this.g.value=this.g.value.slice(0,-1),0":String.fromCharCode(b);c=a.length;9==b?(b=this.V||8,c=b-this.w%b,this.V&&(a=Ka("",c))):13==b&&(this.w=c=0,a="\n");this.R&&!this.w&&c&&(a=String.fromCharCode(this.R)+a);this.g.value+=a;this.g.scrollTop= this.g.scrollHeight;this.w+=c}else if(null!=this.j){if(10==b||1024<=this.j.length)this.i(this.j),this.j="";10!=b&&(this.j+=String.fromCharCode(b))}this.u&&Jc(this.u,this.Z,yf(this,Hf))};k.Id=function(a,b,c){v(this,a,b,c,"CONTROL");this.F?(this.I&&(b^this.C)&(If|Jf)&&(a=0,this.D?(a|=b&If?32:0,a|=b&Jf?320:0):(a|=b&If?16:0,a|=b&Jf?1048576:0),this.I.call(this.b,a)),this.C=b,this.C&Kf&&(this.F=!1)):(this.B=b,this.F=!0)};k.Hd=function(a,b,c){v(this,a,b,c,"BAUDRATES");this.L=b}; var Af=12,Bf=16,Cf=192,Jf=2,If=32,Kf=64,Pd=1,Df=2,Gf=4,Ff=128,Ef=15,Hf=240,zf=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],xf=[!1,0,0,133,142,39,238],sf="buffer",uf={0:rf.prototype.zd,1:rf.prototype.yd},vf={0:rf.prototype.Jd,1:rf.prototype.Id,2:rf.prototype.Hd};hb(function(){for(var a=pa(document,"pc8080","serial"),b=0;bthis.b&&this.g.length&&(this.b=0);if(0>this.b||a!=this.g[this.b])this.g.splice(0,0,a),this.b=0;this.b--}else this.L?a="end":a=this.g[this.b+1];b=[];if(a){a=a.replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(Na(a.substring(d,f))),d=f+1}}return b}; function Mf(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 Nf(a,b,c){var d;if(b){b=Of(a,b);for(var e=0,f=!1,g=b,h=[],l=[],p=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1,w--;g=t+g;d>>=8}d=x(c,0,!0)+" "+c+". "+Ca(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.i((null!=b?b+": ":"")+d);return e} function Tf(a,b){if(b)return Rf(a,b,a.R[b]);var c=0;for(b in a.R)Rf(a,b,a.R[b]),c++;return 0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; function Uf(a){Lf.call(this,a);this.style=Vf;this.F=Wf();this.la=Wf();this.O=Wf();this.A=[];this.j=this.I=this.w=[];Xf(this);this.W=0;Yf(this);this.Z={};Zf(this,a.messages);this.ea=a.commands;var b=this;window?void 0===window.pc8080&&(window.pc8080=function(a){return zc(b,a)}):void 0===global.pc8080&&(global.pc8080=function(a){return zc(b,a)})}ba(Uf,Lf);k=Uf.prototype; k.Ea=function(a,b,c,d){this.H=b;this.u=c;this.S=a;(a=vc(a,"messages"))&&Zf(this,a);this.ga=$f;Md(this,64,function(a){a:{var b=d.H.b,c=a[0],e=a=0,l=b.length;if(c){a=ag(bg(d,c));if(-1===a){d.i("invalid address: "+c);break a}e=a>>>d.H.g;l=1}d.i("blockid physical blockaddr used size type");d.i("-------- --------- ---------- ------ ------ ----");for(var c=-1,p=0;l--;){var r=b[e];r.type==c?p++||d.i("..."):(c=r.type,p=Cb[c],r&&d.i(x(r.id)+" %"+x(e<>>e.g;f!=e.j?e.b[g].Ob(f,b&65535,d):(e.b[g++].nb(f,b&255,d),e.b[g&e.I].nb(0,b>>8&255,d+1));c&&dg(a,c);Ac(this.u,!0)}};function Wf(a){return{J:a,Da:!1}}function eg(a){return[a.J,a.Da]}function fg(a){return{J:a[0],Da:a[1]}} function bg(a,b,c){var d;c=(c?a.F:a.la).J;if(void 0!==b){d=b=Of(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=Ra(Gg,a.substr(b,1))));return c};function Ig(a,b){var c=0;a=a.Hb(b);if(void 0!==a)switch(b){case Jg:case Kg:case Lg:case Mg:case Ng:case Og:case Pg:case Qg:c=2;break;case Rg:case Sg:case Tg:case Ug:case Vg:case Wg:case Xg:c=4}return c?x(a,c):"??"} k.Hb=function(a){var b;if(0<=a){var c=this.u;switch(a){case Jg:b=c.g;break;case Kg:b=c.w;break;case Lg:b=c.A;break;case Rg:b=Wc(c);break;case Mg:b=c.B;break;case Ng:b=c.C;break;case Sg:b=jd(c);break;case Og:b=c.D;break;case Pg:b=c.F;break;case Tg:b=D(c);break;case Qg:b=F(c,D(c));break;case Ug:b=c.M;break;case Vg:b=c.j;break;case Wg:b=Uc(c);break;case Xg:b=Uc(c)&255|c.g<<8}}return b}; function Yg(a,b){b=Of(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=a.Gb(b,c+1),0<=e&&(b=b.substr(0,c)+Ig(a,e)+b.substr(c+1+Gg[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=Ba(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=bg(a,e))?(d=e+' "'+ig(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=bg(a,e))?(dg(d),d=e+ ' "'+ig(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}k.message=function(a,b){b&&(a+=" at "+hg(Wf(this.u.j).J));this.ha&1073741824?this.X.push(a):this.V&&a==this.V||(this.V=a,this.ha&-2147483648&&(this.da(),a+=" (cpu halted)"),this.i(a),this.u&&(a=this.u,Kc(a),a.va=0,Ac(a)))}; function za(a,b,c,d,e,f,g,h){h|=256;null!=f&&(a.ha&h)!=h||a.message(b.$a+"."+(null!=d?"outPort":"inPort")+"("+y(c)+","+(f?f:"unknown")+(null!=d?","+Da(d):"")+")"+(null!=g?": "+Da(g):"")+(null!=e?" at "+hg(e):""))} function Yf(a){var b;if(Ed(a)){if(!a.D||!a.D.length){a.D=Array(Zg);for(b=0;b>>d.g],!1)}a.I=["br"];if(a.w)for(b=1;b>>d.g],!0);a.w=["bw"];a.oa=0}k.Pa=function(a,b,c){var d=!0;c||eh(this,a,b,!1,!0);if(a!=this.j){var e=ag(b);if(-1===e)this.i("invalid address: "+hg(b.J)),d=!1;else{var f=this.H;f.b[e>>>f.g].Pa(e&f.j,a==this.w)}}d&&(a.push(b),c?b.Da=!0:(fh(this,a,a.length-1,"set"),Yf(this)));return d}; function eh(a,b,c,d,e){var f=!1;c=ag(c);for(var g=1;g>>d.g],b==a.w));h.Da||Yf(a);break}}return f}function gh(a,b){for(var c=1;c>24,4);break;case th:B=x(w.Bb(B,2),4);break;default:w="imm("+y(u)+")";break a}w.style==jh&&u&uh?B="["+B+"]":u&vh||(B=(w.style==Vf?"$":"0x")+B);w=B}else u&vh?(w=(t&wh)>>8, u=Gg[w],a.style==jh&&t&uh&&(w==Qg&&(u="HL"),u="["+u+"]"),w=u):u&xh&&(w=(f>>3&7).toString());if(!w||!w.length){h="INVALID";break}0b[0]?1:a[0]>>0;for(b=0;b>>0,h=f.Gd;if(e>=g&&e>8&255;case "C":d.A=f&255;break;case "D":d.B=f&255;break; case "DE":d.B=f>>8&255;case "E":d.C=f&255;break;case "H":d.D=f&255;break;case "HL":d.D=f>>8&255;case "L":d.F=f&255;break;case "SP":d.M=f&65535;break;case "PC":C(d,f);a.F=Wf(d.j);break;case "PS":Sc(d,f);break;case "PSW":Sc(d,f&255|d.N&-256);d.g=f>>8;break;case "CF":d.I=f?d.I|256:d.I&255;break;case "PF":f?od(d)||(d.L^=1):od(d)&&(d.L^=1);break;case "AF":d.O=f?~d.L&16|d.O&-17:d.L&16|d.O&-17;break;case "ZF":d.I=f?d.I&-256:d.I|255;break;case "SF":f?rd(d)||(d.L^=192):rd(d)&&(d.L^=192);break;case "IF":d.N= f?d.N|512:d.N&-513;break;default:a.i("unknown register: "+e);return}Ac(d);a.i("updated registers:")}a.i(Bh(a));c&&(a.F=Wf(d.j),ch(a,hg(a.F.J)))}}function Ih(a,b){b=Na(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.i(Yg(a,c[2])):Nf(a,b,!0)}function Jh(a,b,c){var d="t"!=b;c=Pf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);eb(c,function(){return va(a,!0)&&cg(a,e,d,!1)},function(){Ac(a.u);va(a,!1)})} function ch(a,b,c,d){if(b=bg(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=bg(a,c,!0);if(!d||d.Jh[0].indexOf("+"))){var p=h[0]+":";h[2]&&(p+=" "+h[2]);a.i(p)}h[3]&&(g=h[3],f=null);f=ih(a,b,g,f);a.i(f);a.F=b;e-=b.J-l;c++}}} k.wb=function(a,b,c){if(b)if(a){0>this.b&&this.g.length&&(this.b=0);if(0>this.b||a!=this.g[this.b])this.g.splice(0,0,a),this.b=0;this.b--}else this.L?a="end":a=this.g[this.b+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(Na(a.substring(d,f))),d=f+1}}return b}; function hh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.i(">> "+b):(a.L&&(a.i("ended assemble at "+hg(a.O.J)),a.F=a.O,a.L=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.V=null;if(ra(a)&&0p||"z"Xa.length&&(a.i("note: only "+Xa.length+" available"),Aa=Xa.length);Ma-=Aa;0>Ma&&(null==Xa[Xa.length-1].J?(Aa=Ma+Aa,Ma=0):Ma+=Xa.length);var le=[];"call"==ng&&(ic=1E5,le=["CALL"]);for(void 0!==mg&&a.i(Aa+" instructions earlier:");0< ic&&Ma!=a.T;){var qg=Xa[Ma++];if(null==qg.J)break;var jc=Wf(qg.J),ni=Aa--,rg=ih(a,jc,"history",ni);(!le.length||0<=rg.indexOf(le[0]))&&a.i(rg);jc.Fb&&(Ma+=jc.Fb,ic-=jc.Fb,Aa-=jc.Fb);Ma>=Xa.length&&(Ma=0);a.sa=Aa;pg++;ic--}}pg||(a.i("no "+og+"history available"),a.sa=void 0)}else{var Xc=bg(a,ma);if(Xc){var Yc=0;La&&("l"==La.charAt(0)&&(La=La.substr(1)||dc),Yc=Pf(a,La)>>>0,65536>4||1;oi--&&0<$c;){var ad=0,me=0,lc,ne="", sg="",ma=hg(Xc.J);for(lc=16;0bd?String.fromCharCode(bd):".";$c--}kc&&(kc+="\n");kc+=ma+" "+ne+(lc?"":" "+sg)}kc&&a.i(kc);a.la=Xc}}}}break;case "e":if("else"==f[0])break;var cd=1,tg=255,ug=a.Ga,vg=a.Sb;"ew"==f[0]&&(cd=2,tg=65535,ug=a.Bb,vg=a.vc);var wg=cd<<1,xg=f[1];if(null==xg)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a"); else{var dd=bg(a,xg);if(dd)for(var ed=2;edue;){for(var rb=null,ui=256;65536>oc.J>>>0;){zg.J=a.Bb(oc,2);if(null==oc.J||!ui--)break;for(var vi=a,gd=zg, Ag=null,pc=gd.J,Bg=pc,ve=1;6>=ve&&pc;ve++){if(2\nLicense: GPL version 3 or later ");for(b=0;bTh){if(Vh(d,this.F)){this.w=new Vc(this,"1.32.0",di);Vh(this.w)&&(ei(this,d),a=fi,gi(this.w));this.w.set(ai,Qa());hi(this.w);var e=this.b&&!this.C;if(a==bi||ha("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=$h(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Vh(d,g):("error"==f&&"no machine state"!= g?(this.aa("Error: "+g),"unable to verify user"==g&&(ab(ii,""),this.g=null)):this.i(f+": "+g),gi(d),Vh(d)?(c=$h(d),e=!0):c=!1))}e&&Yh(this,c?d:null)}else a==fi&&d.clear()}else Yh(this);delete this.F;delete this.I}e=ja(this.id);for(f=0;fa[1];a=a[2];this.W=!0;this.G.ja=!0;var d=this.P.power;d&&(d.textContent="Shutdown");this.u&&(ji(this,this.u,b,c,a),this.u.ib());this.N&&(ei(this,b),b.clear());!c&&this.w&&(this.w.clear(),delete this.w);this.j=0}; function ei(a,b){if(ha("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.g||"";b=b.toString();var d={app:"PC8080",ver:"1.32.0"};d.url=a.U;d.user=c;d.type="bug";d.data=b;Sa("http://www.pcjs.org/api/v1/report",d,!0)}} function Kh(a,b,c){var d,e="none";if(a.j)return null;a.j--;var f=new Vc(a,"1.32.0"),g=new Vc(a,"1.32.0",Zh),h=Qa();g.set(ai,h);f.set(ai,h);f.set(ki,"1.32.0");f.set(li,window?window.location.href:null);f.set(mi,Ua());a.u&&a.u.wa&&(c&&a.u.da(),d=a.u.wa(b,c),"object"===typeof d&&f.set(a.u.id,d),c&&(a.u.G.ja=!1,!1===d&&(e=null)));for(var h=ja(a.id),l=0;lf.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PC8080$2"), a=a.replace(/().*?(<\/xsl:variable>)/,"$1pc8080$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(r){f=null,a=r.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");Sa(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],p,r=/( [a-z]+=)(['"])(.*?)\2/g;p=r.exec(f);)l=0>l.indexOf(p[1])?l.replace(">",p[0]+">"):l.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);h[0]!=l&&(g=g.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,""); a=a.replace(d[0],g);Hi(a,b,c)}})}else c(a,null)} function Ii(a,b,c,d){function e(a){if(void 0===h){var b=g&&pa(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=Ia(a))}function f(a){e("Error: "+a);l&&(--Ei||mb(!0));l=!1}var g,h,l=!0;Ei++;ea[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var r=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=p:t.appendChild(document.createTextNode(p));r.appendChild(t)}c|| (c="/versions/pc8080/1.32.0/components.xsl");p=function(d,h){h?Fi(c,null,null,!1,e,function(d,l){l?(da(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--Ei||mb(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--Ei||mb(!0)):f("invalid machine element: "+ a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Fi(b,a,d,!0,e,p):Gi(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(A){f(A.message)}return l}window.embedPC8080=function(a,b,c,d){mb(!1);return Ii(a,b,c,d)};window.findMachineComponent=function(a,b){return la(b,a+".machine")};window.enableEvents=mb;window.sendEvent=ob;})();