(function(){/* http://pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/lib/keys.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/lib/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/lib/state.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/lib/embed.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/lib/component.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/lib/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 l;function aa(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]} for(var ca="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},da="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,ea=["Math","trunc"],fa=0;faa?-b:b};ja!=ia&&null!=ja&&ca(da,ha,{configurable:!0,writable:!0,value:ja}); var m={De:0,Ge:1,He:2,Ie:3,Je:4,Ke:5,Le:6,Me:7,Ne:8,Oe:9,Pe:10,Qe:11,Re:12,Se:13,Te:14,Ue:15,Ve:16,We:17,Xe:18,Ye:19,Ze:20,$e:21,af:22,bf:23,cf:24,df:25,ef: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,$a:65,Ub:66,Vb:67,Db:68,E:69,Yb:70,Zb:71,$b:72,ac:73,bc:74,cc:75,Fb:76,gc:77,hc:78,lc:79,mc:80,Q:81,nc:82,pc:83,qc:84,rc:85,tc:86,uc:87, wc:88,xc:89,ub:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,yc:97,vd:98,yd:99,d:100,e:101,Cd:102,Ed:103,Fd:104,Gd:105,Pd:106,k:107,Qd:108,Sd:109,n:110,Td:111,p:112,q:113,r:114,pe:115,t:116,re:117,se:118,te:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126,ff:127},ka={59:186,61:187,173:189,224:91}; function la(a,b){var c;if(a){b||(b=10);var d,e,f=0=b&&(e=a.match(/(-?[0-9]+)B([0-9]*)/))&& (a=e[1],d=35-((e[2]||35)&255));e=a;((f=b)&&10!=f?16==f?e.match(/^-?[0-9a-f]+$/i):8==f?e.match(/^-?[0-7]+$/):2==f&&e.match(/^-?[01]+$/):e.match(/^-?[0-9]+$/))&&!isNaN(g=parseInt(a,b))&&(d&&(0>g&&(g+=Math.pow(2,36)),g=0a&&-1a&&(a+=Math.pow(b,c)),a>=Math.pow(b,c)&&(c=Math.ceil(Math.log(a)/Math.log(b))));for(var g=e||-1;0=h?48:55),f=String.fromCharCode(h)+f;a=Math.trunc(a/b)}g--}return(void 0===d?"":d)+f}function n(a,b,c){b?9=b?4:4294967295>=b?8:9);return ma(a,16,b,c?"0x":"")}function na(a){return n(a,2,!0)} function q(a){return n(a,4,!0)}function oa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0"']/g,function(a){return va[a]})}function wa(a,b){return(a+" ").slice(0,b)} function xa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var va={"&":"&","<":"<",">":">",'"':""","'":"'"},Ca={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 Ea(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 Ga(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")&&0>b.indexOf("0o")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Pa=g.load;d.Ha=g.exec;if(e=g.bytes)d.la=e;else if(e=g.words)for(d.la=Array(2*e.length),f=c=0;c>8&255;else if(e=g.longs)for(d.la=Array(4*e.length),f=c=0;c>8&255,d.la[f++]=e[c]>>16&255,d.la[f++]=e[c]>>24&255;else(e=g.data)?d.Qf=e:d.la=g;d.la&&(d.la.length?1==d.la.length&&(r(d.la[0]),d=null):(r("Empty resource: "+a),d=null));d.ra=g.symbols}catch(h){r("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;ca?this.Gb=this.id:(this.bb=this.id.substr(0,a),this.Gb=this.id.substr(a+1));this.F={ready:!1,kb:!1,Hb:!1,Rf:!1,ja:!1,Qb:!1,error:!1};this.xb=null;this.F.error=!1;this.ha=c||0;this.K=this.w=this.I=this.R=null;gb.push(this)} function hb(a,b,c){ib[a]&&b&&(ib[a][b]=c)}function jb(){return Date.now()||+new Date}function Za(a,b,c){b||r((c?c+": ":"")+a)}function r(a){window&&window.alert(a)}function kb(a){var b=!1;window&&(b=window.confirm(a));return b}function lb(a,b){a.value+=b;b=a.value;8192d?c+=a+"\n":c=c.substr(0,d)+(a+ ".")+c.substr(d+a.length);8192>1)+2;10>this.g&&(this.g=10);15>2;this.j=this.u-1;this.L=this.N/this.u|0;this.H=this.L-1;this.A=[];this.B=[];this.D=this.G=!1;this.S=[];this.T=[];a=new z;Pb(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.nb+=h.J-e,h.J=e,!0;if(e>=h.J+h.nb){p=h.size-(e-k);p>f&&(p=f);h.nb=e-h.J+p;e=k+a.u;f-=p;g++;continue}}return Tb(Ub,e,f)}e=new z(e,p,a.u,d);Pb(e,a.K,h);a.b[g++]=e;e=k+a.u;f-=p}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Vb[d]+" at "+q(b)),!0):Tb(Wb,b,c)} function Xb(a,b){return a.b[(b&a.C)>>>a.g].mb(b&a.j,b)}function Yb(a,b){var c=b&a.j,d=(b&a.C)>>>a.g;return c!=a.j?a.b[d].Hc(c,b):a.b[d++].Xa(c,b)|a.b[d&a.H].Xa(0,b+1)<<8}function Zb(a,b){var c=b&a.j,d=(b&a.C)>>>a.g;return c!=a.j?a.b[d].Mb(c,b):a.b[d++].mb(c,b)|a.b[d&a.H].mb(0,b+1)<<8}function $b(a,b,c){a.b[(b&a.C)>>>a.g].ob(b&a.j,c&255,b)}function ac(a,b,c){var d=b&a.j,e=(b&a.C)>>>a.g;d!=a.j?a.b[e].Kc(d,c&65535,b):(a.b[e++].Za(d,c&255,b),a.b[e&a.H].Za(0,c>>8&255,b+1))} function bc(a){for(var b=0,c=[],d=0;d>>=f)&k;if(void 0!==g){if(g[0])g[0](b,k,d);a.K&&a.G!=g[1]&&jc(a.K,b,k)}else a.K&&(Hb(a.K,a,b,k,d),a.G&&jc(a.K,b,k));f+=h<<3;b+=h;e-=h}}function Tb(a,b,c){r("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Ub=1,Wb=2,kc;if(Ib){var lc=new ArrayBuffer(2);(new DataView(lc)).setUint16(0,256,!0);kc=256===(new Uint16Array(lc))[0]}else kc=!1;var vc=kc; function z(a,b,c,d){this.id=wc+=2;this.b=null;this.J=a;this.nb=b;this.size=c||0;this.type=d||xc;this.w=d==yc;Pb(this);this.Da=this.Dc=!1;if(c)if(Ib)this.R=new ArrayBuffer(c),this.j=new DataView(this.R,0,c),this.g=new Uint8Array(this.R,0,c),this.u=new Uint16Array(this.R,0,c>>1),this.b=new Int32Array(this.R,0,c>>2),zc(this,vc?Ac:Bc);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)};l.je=function(a){return this.b[a>>2]>>>((a&3)<<3)&255};l.ne=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};l.xe=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.Da=!0};l.he=function(a,b){if(this.K&&null!=this.J){var c=this.K;Ic(c,this.J+a,1,c.M)&&c.ea(!0)}return this.mb(a,b)};l.le=function(a,b){if(this.K&&null!=this.J){var c=this.K;Ic(c,this.J+a,2,c.M)&&c.ea(!0)}return this.Mb(a,b)}; l.ve=function(a,b,c){if(this.K&&null!=this.J){var d=this.K;Ic(d,this.J+a,1,d.B)&&d.ea(!0)}this.w?this.pb(0,b):this.ob(a,b,c)};l.ze=function(a,b,c){if(this.K&&null!=this.J){var d=this.K;Ic(d,this.J+a,2,d.B)&&d.ea(!0)}this.w?this.pb(0,b):this.Sb(a,b,c)};l.ge=function(a){return this.g[a]};l.ie=function(a){return this.g[a]};l.ke=function(a){return this.j.getUint16(a,!0)};l.me=function(a){return a&1?this.g[a]|this.g[a+1]<<8:this.u[a>>1]};l.ue=function(a,b){this.g[a]=b;this.Da=!0}; l.we=function(a,b){this.g[a]=b;this.Da=!0};l.ye=function(a,b){this.j.setUint16(a,b,!0);this.Da=!0};l.Ae=function(a,b){a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.u[a>>1]=b;this.Da=!0};var xc=0,yc=2,Vb=["NONE","RAM","ROM","VID","H/W"],wc=0,Dc=[],Cc=[z.prototype.je,z.prototype.xe,z.prototype.ne,z.prototype.Be],Gc=[z.prototype.he,z.prototype.ve,z.prototype.le,z.prototype.ze];if(Ib)var Bc=[z.prototype.ge,z.prototype.ue,z.prototype.ke,z.prototype.ye],Ac=[z.prototype.ie,z.prototype.we,z.prototype.me,z.prototype.Ae]; function Jc(a,b){t.call(this,"CPU",a,1);var c=a.multiplier||1;this.za=a.cycles||b;this.U=c;this.Sa=Math.round(this.za/1E4)/100;this.Z=this.Sa*this.U;this.F.ma=!1;this.F.Pb=!1;this.F.jb=a.autoStart;this.F.Bc=!1;this.F.Va=!1;this.wa=this.oa=0;this.ya=a.csStart;this.na=a.csInterval;this.sa=a.csStop;this.T=[];this.Bb=this.rb.bind(this);Cb(this)}aa(Jc,t);l=Jc.prototype; l.Fa=function(a,b,c,d){this.R=a;this.I=b;this.K=d;for(b=0;b=a.oa&&(a.oa+=a.na,c=!0);0<=a.sa&&a.sa<=Sc(a)&&(a.na=a.sa=-1,Nc(a),a.ea(),c=!0);c&&a.i(Sc(a)+" cycles: checksum="+n(a.wa))}} l.da=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.R)if(a=d.R,a.F.ja)a=!0;else{var b=null,c,h=qb(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.R&&a.R.Ya()}Uc(a,a.X);a.X=0;a.V=jb();a.ba=0;Vc(a);return d}function Xc(a,b){var c=a.T.length;a.T.push([-1,b]);return c}function Yc(a,b,c){0<=b&&ba.T[b][0]&&(c*=a.za*a.U/1E3,a.T[b][0]=c+Zc(a))}function Zc(a,b){var c=a.fa-=a.b;a.b=0;b&&(a.fa=0);return c} l.rb=function(a){if(Eb(this,!0)){if(!this.F.ma){Tc(this);this.R&&this.R.start(this.V,Sc(this));this.F.ma=!0;this.F.Pb=!0;this.W&&this.W.start();var b=this.P.run;b&&(b.textContent="Halt");this.R&&($c(this.R,!0),a&&this.R.Ya(!0))}this.Ua>=this.za&&Vc(this,!0);this.Ca=0;this.La=jb();this.ba&&(a=this.La-this.ba,a>this.hb&&(this.V+=a,this.V>this.La&&(this.V=this.La)));try{do{for(var c,d=this.F.Va?1:this.Ma,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.Cb(c);c=Zc(this,!0); this.Ca+=c;this.X+=c;Rc(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.ta-=c;if(0>=this.ta){this.ta+=this.Ma;++this.ib>=ad&&(this.R&&$c(this.R),this.ib=0);break}}while(this.F.ma)}catch(k){this.ea();Qc(this);this.R&&this.R.stop(jb(),Sc(this));Eb(this,!1);Ab(this,k.stack||k.message);return}c=setTimeout;d=this.Bb;this.ba=jb();e=this.hb;this.Ca&&(e=Math.round(e*this.Ca/this.Ma));e-=this.ba-this.La;if(f=this.ba-this.V)this.Y=Math.round(this.X/ (10*f))/100,864E5<=f&&(this.ka=0,Tc(this));if(0>e||this.Ye&&(this.V-=e),e=0;this.Ua+=this.Ca;this.ba+=e;c(d,e)}else Qc(this),this.R&&this.R.stop(jb(),Sc(this))};l.Cb=function(){return 0};l.ea=function(a){Db(this,!0);Zc(this);Uc(this,this.X);this.X=0;if(this.F.ma){this.F.ma=!1;this.W&&this.W.stop();var b=this.P.run;b&&(b.textContent="Run")}this.F.complete=a};function Qc(a,b){if(a.R){for(var c=a.R,d=0;d>8&255;a.A=b&255}function yd(a){return a.B<<8|a.C}function zd(a,b){a.B=b>>8&255;a.C=b&255}function D(a){return a.D<<8|a.G} function Ad(a,b){a.D=b>>8&255;a.G=b&255}function A(a,b){a.j=b&65535}function Bd(a){return a.H&256?1:0}function Cd(a,b){a.H=a.H&255|b}function Dd(a){return Jb[a.L&255]?4:0}function Ed(a){return(a.L^a.O)&16?16:0}function Fd(a){return a.H&255?0:64}function Gd(a){return a.L&128?128:0}function ud(a){return a.N&-214|Gd(a)|Fd(a)|Ed(a)|Dd(a)|Bd(a)}function sd(a,b){a.H=a.L=a.O=0;b&1&&(a.H|=256);b&4||(a.L|=1);b&16&&(a.O|=16);b&64||(a.H|=255);b&128&&(a.L^=192);a.N=a.N&-726|b&512|2} function Hd(a,b){a.O=a.g^b;return a.L=(a.H=a.g+b)&255}function Id(a,b){a.O=a.g^b;return a.L=(a.H=a.g+b+(a.H&256?1:0))&255}function Jd(a,b){a.H=a.L=a.O=a.g&b;(a.g|b)&8&&(a.O^=16);return a.H}function Kd(a,b){a.O=b^255;b=a.L=b+255&255;a.H=a.H&-256|b;return b}function Ld(a,b){a.O=b;b=a.L=b+1&255;a.H=a.H&-256|b;return b}function Md(a,b){return a.L=a.H=a.O=a.g|b}function Nd(a,b){b^=255;a.O=a.g^b;return a.L=(a.H=a.g+b+1^256)&255} function Od(a,b){b^=255;a.O=a.g^b;return a.L=(a.H=a.g+b+(a.H&256?0:1)^256)&255}function Pd(a,b){return a.L=a.H=a.O=a.g^b}function E(a,b){a=a.I;return a.b[(b&a.C)>>>a.g].Xa(b&a.j,b)}function Qd(a,b,c){a=a.I;a.b[(b&a.C)>>>a.g].Za(b&a.j,c&255,b)}function F(a){var b=E(a,a.j);A(a,a.j+1);return b}function G(a){var b=Yb(a.I,a.j);A(a,a.j+2);return b}function Rd(a){var b=Yb(a.I,a.M);a.M=a.M+2&65535;return b}function H(a,b){a.M=a.M-2&65535;ac(a.I,a.M,b)} function Sd(a){if(a.b&&a.S&255&&a.N&512){for(var b=0;8>b&&!(a.S&1<b?255:1<>8;Cd(this,a&256);this.b-=4},Wd,function(){var a;Ad(this,a=D(this)+wd(this));Cd(this,a>>8&256);this.b-=10},function(){this.g=E(this,wd(this));this.b-=7},function(){xd(this,wd(this)-1);this.b-= 5},function(){this.A=Ld(this,this.A);this.b-=5},function(){this.A=Kd(this,this.A);this.b-=5},function(){this.A=F(this);this.b-=7},function(){var a=this.g<<8&256;this.g=(a|this.g)>>1;Cd(this,a);this.b-=4},Wd,function(){zd(this,G(this));this.b-=10},function(){Qd(this,yd(this),this.g);this.b-=7},function(){zd(this,yd(this)+1);this.b-=5},function(){this.B=Ld(this,this.B);this.b-=5},function(){this.B=Kd(this,this.B);this.b-=5},function(){this.B=F(this);this.b-=7},function(){var a=this.g<<1;this.g=a&255| Bd(this);Cd(this,a&256);this.b-=4},Wd,function(){var a;Ad(this,a=D(this)+yd(this));Cd(this,a>>8&256);this.b-=10},function(){this.g=E(this,yd(this));this.b-=7},function(){zd(this,yd(this)-1);this.b-=5},function(){this.C=Ld(this,this.C);this.b-=5},function(){this.C=Kd(this,this.C);this.b-=5},function(){this.C=F(this);this.b-=7},function(){var a=this.g<<8;this.g=(Bd(this)<<8|this.g)>>1;Cd(this,a&256);this.b-=4},Wd,function(){Ad(this,G(this));this.b-=10},function(){var a=G(this);ac(this.I,a,D(this)); this.b-=16},function(){Ad(this,D(this)+1);this.b-=5},function(){this.D=Ld(this,this.D);this.b-=5},function(){this.D=Kd(this,this.D);this.b-=5},function(){this.D=F(this);this.b-=7},function(){var a=0,b=Bd(this);if(Ed(this)||9<(this.g&15))a|=6;if(b||154<=this.g)a|=96,b=1;this.g=Hd(this,a);Cd(this,b?256:0);this.b-=4},Wd,function(){var a;Ad(this,a=D(this)+D(this));Cd(this,a>>8&256);this.b-=10},function(){var a;a=G(this);a=Yb(this.I,a);Ad(this,a);this.b-=16},function(){Ad(this,D(this)-1);this.b-=5},function(){this.G= Ld(this,this.G);this.b-=5},function(){this.G=Kd(this,this.G);this.b-=5},function(){this.G=F(this);this.b-=7},function(){this.g=~this.g&255;this.b-=4},Wd,function(){this.M=G(this)&65535;this.b-=10},function(){Qd(this,G(this),this.g);this.b-=13},function(){this.M=this.M+1&65535;this.b-=5},function(){var a=D(this);Qd(this,a,Ld(this,E(this,a)));this.b-=10},function(){var a=D(this);Qd(this,a,Kd(this,E(this,a)));this.b-=10},function(){Qd(this,D(this),F(this));this.b-=10},function(){this.H|=256;this.b-= 4},Wd,function(){var a;Ad(this,a=D(this)+this.M);Cd(this,a>>8&256);this.b-=10},function(){this.g=E(this,G(this));this.b-=13},function(){this.M=this.M-1&65535;this.b-=5},function(){this.g=Ld(this,this.g);this.b-=5},function(){this.g=Kd(this,this.g);this.b-=5},function(){this.g=F(this);this.b-=7},function(){Cd(this,Bd(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.u=this.A;this.b-=5},function(){this.u=this.B;this.b-=5},function(){this.u=this.C;this.b-=5},function(){this.u=this.D;this.b-= 5},function(){this.u=this.G;this.b-=5},function(){this.u=E(this,D(this));this.b-=7},function(){this.u=this.g;this.b-=5},function(){this.A=this.u;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.G;this.b-=5},function(){this.A=E(this,D(this));this.b-=7},function(){this.A=this.g;this.b-=5},function(){this.B=this.u;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.G;this.b-=5},function(){this.B=E(this,D(this));this.b-=7},function(){this.B=this.g;this.b-=5},function(){this.C=this.u;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.G;this.b-=5},function(){this.C=E(this,D(this));this.b-=7},function(){this.C=this.g;this.b-=5},function(){this.D=this.u;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.G;this.b-=5},function(){this.D=E(this,D(this));this.b-=7},function(){this.D=this.g;this.b-=5},function(){this.G=this.u;this.b-=5},function(){this.G=this.A;this.b-=5},function(){this.G=this.B;this.b-=5},function(){this.G=this.C;this.b-=5},function(){this.G=this.D;this.b-=5},function(){this.b-=5},function(){this.G=E(this,D(this));this.b-=7},function(){this.G=this.g; this.b-=5},function(){Qd(this,D(this),this.u);this.b-=7},function(){Qd(this,D(this),this.A);this.b-=7},function(){Qd(this,D(this),this.B);this.b-=7},function(){Qd(this,D(this),this.C);this.b-=7},function(){Qd(this,D(this),this.D);this.b-=7},function(){Qd(this,D(this),this.G);this.b-=7},function(){var a=this.j-1;if(this.Ka.length)for(var b=0;b>8;this.b-=10},function(){var a=G(this);Gd(this)||A(this,a);this.b-=10},function(){this.N&=-513;this.b-=4},function(){var a=G(this);Gd(this)||(H(this,this.j),A(this,a),this.b-=6);this.b-=11},function(){H(this,ud(this)&255|this.g<<8);this.b-=11},function(){this.g=Md(this,F(this));this.b-=7},function(){H(this,this.j);A(this,48);this.b-=11},function(){Gd(this)&& (A(this,Rd(this)),this.b-=6);this.b-=5},function(){this.M=D(this)&65535;this.b-=5},function(){var a=G(this);Gd(this)&&A(this,a);this.b-=10},function(){this.N|=512;this.b-=4;Sd(this)},function(){var a=G(this);Gd(this)&&(H(this,this.j),A(this,a),this.b-=6);this.b-=11},Zd,function(){Nd(this,F(this));this.b-=7},function(){H(this,this.j);A(this,56);this.b-=11}]; function $d(a){t.call(this,"ChipSet",a,32768);var b=a.model;b&&!ae[b]&&Za("Unrecognized ChipSet model: "+b);this.g=ae[b]||{};a.sound&&(this.U=null,window&&(this.U=window.AudioContext||window.webkitAudioContext),this.U&&new this.U);Cb(this)}aa($d,t);l=$d.prototype;l.da=function(){return!1}; l.Fa=function(a,b,c,d){this.I=b;this.w=c;this.K=d;this.R=a;this.B=Mb(a,"Keyboard");this.C=Mb(a,"SerialPort");this.video=Mb(a,"Video");dc(b,this,this.g.zb);hc(b,this,this.g.Ab);if(d){var e=this;be(d,16384,function(){for(var a="",b=0;b>8-this.T&255;x(this,a,null,b,"SHIFT.RESULT",c,!0);return c};l.Xd=function(a,b,c){x(this,a,b,c,"SHIFT.COUNT",null,!0);this.T=b};l.Zd=function(a,b,c){x(this,a,b,c,"SOUND1",null,!0);this.Y=b};l.Yd=function(a,b,c){x(this,a,b,c,"SHIFT.DATA",null,!0);this.N=b<<8|this.N>>8}; l.$d=function(a,b,c){x(this,a,b,c,"SOUND2",null,!0);this.Z=b};l.ae=function(a,b,c){x(this,a,b,c,"WATCHDOG",null,!0)};function de(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} l.Nd=function(a,b){var c=this.D,c=c&~J.xa.jc;if((Sc(this.w)&64)<<1&&(c|=J.xa.jc,c!=this.D)){var d,e;d=this.L&1;e=this.L>>1&7;switch(e){case J.Aa.Ia.od:break;case J.Aa.Ia.Lc:this.M=this.M<<1|d;break;case J.Aa.Ia.Rc:d=de(this);this.j[d]=J.Aa.tb;Gb(this,"doNVRCommand(): erase data at addr "+q(d));break;case J.Aa.Ia.Mc:this.b=this.b<<1|d;break;case J.Aa.Ia.sd:d=de(this);e=this.b&J.Aa.tb;this.j[d]=e;Gb(this,"doNVRCommand(): write data "+q(e)+" to addr "+q(d));break;case J.Aa.Ia.md:d=de(this);e=this.j[d]; null==e&&(e=J.Aa.tb);this.b=e;Gb(this,"doNVRCommand(): read data "+q(e)+" from addr "+q(d));break;case J.Aa.Ia.nd:this.b<<=1;this.S=this.b&J.Aa.tb+1;break;default:Gb(this,"doNVRCommand(): unrecognized command "+na(e))}}c&=~J.xa.kc;this.S&&(c|=J.xa.kc);c&=~J.xa.dc;if(d=this.B){d=this.B;if(e=d.A)e=d.w,e=Sc(d.w)>=d.G+e.za*e.U/1E3*1.2731488;e&&(d.A=!1);d=!d.A}d&&(c|=J.xa.dc);c&=~J.xa.sc;this.C&&this.C.ia&ee&&(c|=J.xa.sc);this.D=c;x(this,a,null,b,"FLAGS",c);return c}; l.be=function(a,b,c){x(this,a,b,c,"BRIGHTNESS");this.W=b};l.ee=function(a,b,c){x(this,a,b,c,"NVR.LATCH");this.L=b};l.de=function(a,b,c){x(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.u=this.u&-4|a;break;case 1:this.u=this.u&-13|a<<2;this.video&&(b=this.video,a=this.u,Gb(b,"updateScrollOffset("+a+")"),b.sa!==a&&((b.sa=a)?bd(b,!0):b.wa=!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}}; l.ce=function(a,b,c){x(this,a,b,c,"DC011");b&J.Ja.ld?(b&=J.Ja.oc,this.H!=b&&(this.H=b,this.video&&(a=this.video,b=this.H==J.Ja.oc?50:60,Gb(a,"updateRate("+b+")"),a.hb=b))):(b&=J.Ja.Wb,this.G!=b&&(this.G=b,this.video&&(a=this.G==J.Ja.Wb?132:80,b=this.video,Gb(b,"updateDimensions("+a+","+(80>>0,g],v=Ea(u,k,a.Ac);0>v&&u.splice(-(v+1),0,k)}p&&(h.a=p.replace(/''/g,'"'))}a.C.push({Sf:b,J:c,Rd:d,ra:e,zc:f})}delete this.ra}return!0};he.prototype.ua=function(){return!0}; function ie(a,b,c,d){if(d)a.aa("Unable to load system ROM (error "+d+": "+b+")");else{hb(a.bb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,g=e.longs||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){r("Empty ROM: "+b);return}if(1==a.b.length){r(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.$a&&a<=m.ub?d.g&(Re|Se)||(d.g|=Se,Oe(d,20,!0),Te(d)):a>=m.yc&&a<=m.z&&d.g&Se&&(d.g&=~Se,Oe(d,20,!1),Te(d));return!0}),c.onpaste=function(a){a:{if(d.C&&d.C.Qa&&(a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),a=a.clipboardData||window.clipboardData)){Ue(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(d){d.preventDefault&&d.preventDefault();d=!0;var e=0;17==b?e=Ve:20==b&&(e=Se);if(e){c.style.fontWeight="normal";if(d=!(a.g&e))c.style.fontWeight="bold";We(a,b,d)}Oe(a,b,d,!e);a.R&&a.R.Ya()}}(this,this.b.Ta[b]),!0}}return!1};l.Fa=function(a,b,c,d){this.R=a;this.w=c;this.K=d;var e=this;this.L=Xc(this.w,function(){Xe(e)});this.W=Mb(a,"ChipSet");this.C=Mb(a,"SerialPort");dc(b,this,this.b.zb);hc(b,this,this.b.Ab)}; l.va=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};l.ua=function(a){return a?this.save():!0};l.reset=function(){this.j=[];this.g=0;this.b.INIT&&!this.restore(this.b.INIT)&&this.aa("reset error")};l.save=function(){var a=new vd(this);switch(this.b.pa){case K.pa:a.set(0,[this.D,this.B,this.A,this.G,-1])}return a.data()}; l.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.b.pa){case Ye.pa:return!0;case K.pa:return this.D=b[0],Te(this,this.D&K.Ba.ec),this.B=b[1],this.A=b[2],this.G=b[3],this.u=b[4],!0}return!1};function Te(a,b){var c;null!=b?a.H=b:b=a.H;for(var d in a.b.cb)if(c="led-"+d,c=a.P[c]){var e=a.b.cb[d],f=!!(b&e);e&e-1&&(f=!(b&~e));c.style.backgroundColor=f?"#"+n(16711680,6):"#000000"}if(c=a.P["led-caps-lock"])c.style.backgroundColor=a.g&Se?"#"+n(65280,6):"#000000"} function We(a,b,c,d){var e=0;switch(b){case 16:e=d?Ze:$e;break;case 17:e=d?af:Ve;break;case 18:e=d?bf:cf;break;case 91:e=d?df:ef;break;case 20:e=Se,c=!(a.g&e)}e&&(a.g=c?a.g|e:a.g&~e);return c} function Qe(a,b,c){var d=!0,e=b.keyCode,e=ka[e]||e;c=We(a,e,c,2==b.location);var f;a:if(e=a.b.Tb[e]||e,a.b.Ra[e])f=e;else{for(f in a.b.Ta)if(a.b.Ta[f]===e)break a;f=null}f&&!b.metaKey&&(d=!1,a.g&(ff|gf)&&(13==f?(f=118,d=!0):8==f&&(f=46,d=!0),d&&(a.g=c?a.g|gf:a.g&~gf)),d=Oe(a,f,c),(!(f>=m.$a&&f<=m.ub)||a.g|hf)&&b.preventDefault&&b.preventDefault());return d} function Pe(a,b,c){var d=!0;if(c){var e=b.keyCode,f=a.b.Ra[e],g;if(g=f){a:{for(var h in a.b.qb)if(a.b.qb[h]==f){f=+h;break a}f=0}g=!f}g&&(d=Oe(a,e,c,!0),b.preventDefault&&b.preventDefault())}return d} function Oe(a,b,c,d){var e;a:{for(e=0;ee?a.j.push({Ob:b,Lb:Date.now(),wb:d||!1}):(a.j[e].Lb=Date.now(),a.j[e].wb=d||!1),d&&Xe(a);else if(0<=e){if(!a.j[e].wb&&(d=a.j[e].Lb)&&Date.now()-dc||c>e)c=e}else{Oe(a,d,!1);b=0;continue}}b++}0<=c&&Yc(a.w,a.L,c)}l.Od=function(a,b){var c=this.B;0<=this.u&&(this.u"]]= 229,N[m["<"]]=230,N[m.hc]=231,N[m.Ub]=232,N[m.wc]=233,N[m["?"]]=245,N[m.gc]=246,N[m.tc]=248,N[m.Vb]=249,N[m.ub]=250,N),Tb:{},cb:{},Ta:{"caps-lock":20,ctrl:17,esc:27,tab:9,"num-comma":116,"break":117,"line-feed":118,"no-scroll":119,setup:120},Nc:{qa:130,INIT:127},Ba:{qa:130,bd:1,ad:2,$c:4,Zc:8,cd:16,fc:32,ec:63,pd:64,Ee:128,INIT:0},Yc:127};K.cb={l4:K.Ba.bd,l3:K.Ba.ad,l2:K.Ba.$c,l1:K.Ba.Zc,locked:K.Ba.cd,local:K.Ba.fc,online:~K.Ba.fc,"caps-lock":Se};var Ne={SI1978:Ye,VT100:K}; K.INIT=[[K.Ba.INIT,K.Nc.INIT,!1,0,-1]];K.zb={130:Me.prototype.Od};K.Ab={130:Me.prototype.fe};Va(function(){for(var a=nb(document,"pc8080","keyboard"),b=0;b>3)*a.N,!Sb(a.I,a.ka,a.L,3)))return!1;a.L?(a.Ua=a.j.createImageData(b,c),a.fb=16/a.na|0,qf(a,a.L>>1)):qf(a,(a.O+1)*a.Z);a.D=document.createElement("canvas");a.D.width=b;a.D.height=c;a.ta=a.D.getContext("2d");a.T={};a.X=1<=a.Ca?8:16,f=8>(7>4)*c)}return k}l.va=function(a,b){return b||!a||this.restore(a)?!0:!1};l.ua=function(a){return!a||this.save()};l.save=function(){var a=new vd(this);a.set(0,[]);return a.data()};l.restore=function(){return!0}; l.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.H;b>c&&(a=Math.round(c/b*100)+"%")}this.Sa?(this.G.style.width=a,this.G.style.width=a,this.G.style.display="block",this.G.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 of(a,b){!b&&a.b&&(a.Sa?a.G.style.width=a.G.style.height="":a.b.style.width=a.b.style.height="");Gb(a,"notifyFullScreen("+b+")")}function qf(a,b){a.eb=b;a.W=!1;if(void 0===a.A||a.A.length!=a.eb)a.A=Array(a.eb)}function Bf(a,b,c,d,e){d=a.g?(b.height-c-1)*b.width+d:c+d*b.width;e&&a.Y==sf&&(208<=c&&236>c?e=a.X+tf:28<=c&&72>c&&(e=a.X+uf));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 bd(a,b){var c=!0;if(!b){a.oa&&(120==a.oa?a.gb&1?(Td(a.w,2),c=!1):Td(a.w,1):Td(a.w,4));if(c&&a.W&&a.L){for(var d=a.I,e=a.L,f=!0,g=a.ka>>>d.g;0>=1);;){var y=Xb(a.I,u++);if((y&Cf)==Cf){var w=Xb(a.I,u++),d=w&Df,c=(w&Ef)<<8|Xb(a.I,u),c=c+(w&Ff? Gf:Hf);break}if(p>4)*y.ca,L,za,sa,Aa,ta=y.ga,Ba=y.ca;C?(L=B*w.ga,za=e*w.ca,sa=w.ga,Aa=w.ca):(L=B*w.Ka,za=e*w.La,sa=w.Ka,Aa=w.La);y.ga>w.ga&&(L*=2,sa*=2);y.ca>w.ca&&(v==Af&&(T+=w.ca),Ba=w.ca);C?C.drawImage(y.canvas,ya,T,ta,Ba,L,za,sa,Aa):(L+=0,za+=0,w.j.drawImage(y.canvas, ya,T,ta,Ba,L,za,sa,Aa))}h++}g++}e++}}a.W=!0;!b&&a.wa&&1==h&&(a.A[k]=-1,h=0);a.wa=!1;(h||b)&&a.ta&&a.j.drawImage(a.D,0,a.sa,a.C,a.N-a.ca,0,0,a.Bb,a.ud)}else{e=a.ka;f=e+a.L;k=h=g=0;b=a.C;p=0;c=a.N;v=d=0;u=a.na;B=(1<>8|(w&255)<<8);h>C&B,Bf(a,a.Ua,h++,k,ya),C+=u;h>p&&(p=h);k=d&&(d=k+1)}e+=2;g++;if(h>=a.C&&(h=0,k++,k>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<=Ja().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&&(Ua("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");Pa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"),f.style.fontSize="16px");c.appendChild(f);var g=e.getContext("2d"),d=new lf(d,e,g,f,c);mb(d,c)}}); function If(a){t.call(this,"SerialPort",a,8388608);this.T=+a.adapter;switch(this.T){case 0:this.U=0;this.X=2;break;default:r("Unrecognized serial adapter #"+this.T);return}this.g=this.j=null;this.V=a.tabSize;this.S=a.charBOL;this.u=0;this.N=!1;this.D=!0;var b=a.binding;if("console"==b)this.j="";else{var c;a=Jf;b&&(void 0===c&&(c="Panel"),(c=sb(c,this.id))&&(b=c.P[b])&&this.da(null,a,b))}this.A="";this.b=this.Qa=this.H=null;this.exports={connect:this.Fc,receiveData:this.Nb,receiveStatus:this.oe}} aa(If,t);l=If.prototype;l.da=function(a,b,c,d){var e=this;switch(b){case Jf: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=xa(c[0]);if(d!=this.Gb)return;c=xa(c[1]);if(this.b=rb(c)){var e=this.b.exports;if(e){var f=e.connect;f&&f.call(this.b,this.D);if(this.Qa=e.receiveData){this.D=a;this.H=e.receiveStatus;this.status("Connected "+this.bb+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; l.va=function(a,b){if(!b)if(this.Fc(this.D),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};l.ua=function(a){return a?this.save():!0};l.reset=function(){Nf(this)};l.save=function(){var a=new vd(this),b=0,c=[];c[b++]=this.G;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()};l.restore=function(a){return Nf(this,a[0])}; function Nf(a,b){var c=0;b||(b=Of);a.G=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 Pf(a,b){var c=a.L&b;b&15||(c>>=4);b=Qf[c];c=((a.B&Rf)>>2)+6;a.B&Sf&&c++;c+=((a.B&Tf)>>6)+1>>1;return 1E3/Math.round(b/c)}function Kf(a,b){Gb(a,"receiveByte("+na(b)+"), status="+na(a.ia));return a.N||a.ia&Uf?!1:(a.M=b,a.ia|=Uf,Td(a.w,a.X),!0)} l.Nb=function(a){null!=a&&(this.A="number"!=typeof a?a:this.A+String.fromCharCode(a));this.A&&(Kf(this,this.A.charCodeAt(0))&&(this.A=this.A.substr(1)),this.A&&this.w&&Yc(this.w,this.Y,Pf(this,Vf)));return!0};l.oe=function(a){this.ia&=~Wf;a&64&&(this.ia|=Wf)};function Ue(a,b){a.ia=a.ia|ee|Xf;b&&a.Qa&&a.Qa.call(a.b,b)}l.Id=function(a,b){var c=this.M;x(this,a,null,b,"DATA",c);this.ia&=~Uf;return c};l.Hd=function(a,b){var c=this.ia;x(this,a,null,b,"STATUS",c);return c}; l.Wd=function(a,b,c){x(this,a,b,c,"DATA");this.O=b;this.ia&=~(ee|Xf);Gb(this,"transmitByte("+na(b)+")");if(19==b)this.N=!0;else if(17==b)this.N=!1;else if(this.Qa&&this.Qa.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.u%b,this.V&&(a=wa("",c))):13==b&&(this.u=c=0,a="\n");this.S&&!this.u&&c&&(a=String.fromCharCode(this.S)+a);this.g.value+=a;this.g.scrollTop= this.g.scrollHeight;this.u+=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.w&&Yc(this.w,this.Z,Pf(this,Yf))};l.Vd=function(a,b,c){x(this,a,b,c,"CONTROL");this.G?(this.H&&(b^this.C)&(Zf|$f)&&(a=0,this.D?(a|=b&Zf?32:0,a|=b&$f?320:0):(a|=b&Zf?16:0,a|=b&$f?1048576:0),this.H.call(this.b,a)),this.C=b,this.C&ag&&(this.G=!1)):(this.B=b,this.G=!0)};l.Ud=function(a,b,c){x(this,a,b,c,"BAUDRATES");this.L=b}; var Rf=12,Sf=16,Tf=192,$f=2,Zf=32,ag=64,ee=1,Uf=2,Xf=4,Wf=128,Vf=15,Yf=240,Qf=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],Of=[!1,0,0,133,142,39,238],Jf="buffer",Lf={0:If.prototype.Id,1:If.prototype.Hd},Mf={0:If.prototype.Wd,1:If.prototype.Vd,2:If.prototype.Ud};Va(function(){for(var a=nb(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.N?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(xa(a.substring(d,f))),d=f+1}}return b}; function cg(a,b,c){var d=a;b=b||32;if(c)if(32==b)d=a>>>0;else if(32>b)d=a&(1<a||a>=b)d=a%b,0>d&&(d+=b)}else 32>=b?d=a<<32-b>>32-b:(b=Math.pow(2,b-1),a>=b?(d=a%b,(a/b|0)&1&&(d-=b)):a<-b&&(d=a%b,((-a-1)/b|0)&1?d&&(d+=b):d||(d-=b)));a!=d&&(a=d);return a} function dg(a,b,c){for(c=void 0===c?-1:c;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e,f=a.pop();e=a.pop();switch(d){case "*":e*=f;break;case "/":if(!f)return!1;e=Math.trunc(e/f);break;case "^/":if(!f)return!1;e%=f;break;case "+":e+=f;break;case "-":e-=f;break;case "<<":e<<=f;break;case ">>":e>>=f;break;case ">>>":e>>>=f;break;case "<":e=e":e=e>f?1:0;break;case ">=":e=e>=f?1:0;break;case "==":e=e==f?1:0;break;case "!=":e=e!=f?1:0;break;case "&":e&= f;break;case "!":case "|":e|=f;break;case "^!":e|=f;break;case "&&":e=e&&f?1:0;break;case "||":e=e||f?1:0;break;case ",,":e=cg(e,18,!0)*Math.pow(2,18)+cg(f,18,!0);break;case "_":case "^_":"^_"==d&&(f=35-(f&255));f&&(e=cg(e,0,!0),e=0=|>>>|>>|>|<=|<<|<|-|\+|\^\/|\/|\*|,,| )/);d=eg(a,b,0,b.length,a.u,c);void 0!==d&&e&&mg(a,null,d)}return d} function ng(a,b){var c,d=a.U[0],e=a.U[1];c="("==d||"{"==d||"["==d?"\\":"";for(var f="["==d?"\\":"",f=new RegExp(c+d+"([^"+f+d+f+e+"]+)"+c+e);c=b.match(f);){var g=lg(a,c[1]);if(void 0===g)return;b=b.replace(d+c[1]+e,null!=g?kg(a,g):"undefined")}if(a.fa.length)for(d=a.fa[0],e=a.fa[1],c="("==d||"{"==d||"["==d?"\\":"",f="["==d?"\\":"",f=new RegExp(c+d+"([^"+f+d+f+e+"]+)"+c+e);c=b.match(f);)b=b.replace("["+c[1]+"]","unimplemented");for(;d=b.match(/\$([a-z]+)/i);){e=null;switch(d[1].toLowerCase()){case "ops":e= a.S-a.ba}if(null==e)break;b=b.replace(d[0],e.toString())}return b}function gg(a,b){for(;b;){switch(b&3){case 1:a=-cg(a);break;case 2:a|=-1;break;case 3:for(var c=35;0<=c&&!(a&Math.pow(2,c));)c--;a=35-c}b>>>=2}return a} function fg(a,b,c,d,e){e=void 0===e?0:e;var f,g=Array.isArray(d)?d:void 0;if(null!=b){f=a.Jb(b);if(0<=f)f=a.Kb(f);else if(f=b,a.A[f]?f=a.A[f].value:(f=f.substr(0,6),f=a.A[f]&&a.A[f].value),null!=f){var h=a.A[b]&&a.A[b].qe;h&&(g?g.push(h):(g=lg(a,h,d),void 0!==g?f+=g:(d||a.i("undefined "+(c||"value")+": "+b+" ("+h+")"),f=void 0)))}else f=la(b,1c&&(d+=" '"+String.fromCharCode(c)+"'"));a.i((null!=b?b+": ":"")+d);return e}function og(a,b){var c=0;if(a.A){if(b)return mg(a,b,a.A[b]&&a.A[b].value);b=Object.keys(a.A);b.sort();for(var d=0;d=a?8:262143>=a?18:36);b=ma(b,2,a,"",e);break;case 8:(a=0=a?6:16777215>=a?8:12);b=ma(b,8,a,e?"0o":"");break;case 10:(e=0=Math.abs(b)?5:11;b=ma(b,10,e);break;default:b=n(b,0>2:0,!!e)}0>c?c=b.replace(/^0+([0-9A-F]+)$/i,"$1"):c=b;return c} var ig={"||":5,"&&":6,"!":7,"|":7,"^!":8,"&":9,"!=":10,"==":10,">=":11,">":11,"<=":11,"<":11,">>>":12,">>":12,"<<":12,"-":13,"+":13,"^/":14,"/":14,"*":14,_:19,"^_":19,"{":20,"}":20},hg={",,":1,"||":5,"&&":6,"!=":10,"==":10,">=":11,">":11,"<=":11,"<":11,">>>":12,">>":12,"<<":12,"-":13,"+":13,"^/":14,"/":14,"*":14,"!":15,"|":15,"^!":15,"&":15,_:19,"^_":19,"{":20,"}":20}; function pg(a){bg.call(this,a);this.style=qg;this.L=rg();this.sa=rg();this.T=rg();this.C=[];this.j=this.M=this.B=[];sg(this);this.X=0;tg(this);this.ka={};ug(this,a.messages);this.na=a.commands;var b=this;window?void 0===window.pc8080&&(window.pc8080=function(a){return Pc(b,a)}):void 0===global.pc8080&&(global.pc8080=function(a){return Pc(b,a)})}aa(pg,bg);l=pg.prototype; l.Fa=function(a,b,c,d){this.I=b;this.w=c;this.R=a;(a=Lc(a,"messages"))&&ug(this,a);this.oa=vg;be(this,64,function(a){a:{var b=d.I.b,c=a[0],e=a=0,k=b.length;if(c){a=wg(xg(d,c));if(-1===a){d.i("invalid address: "+c);break a}e=a>>>d.I.g;k=1}d.i("blockid physical blockaddr used size type");d.i("-------- --------- ---------- ------ ------ ----");for(var c=-1,p=0;k--;){var u=b[e];u.type==c?p++||d.i("..."):(c=u.type,p=Vb[c],u&&d.i(n(u.id)+" %"+n(e<>>e.g;f!=e.j?e.b[g].Sb(f,b&65535,d):(e.b[g++].ob(f,b&255,d),e.b[g&e.H].ob(0,b>>8&255,d+1));c&&Xg(a,c);Qc(this.w,!0)}};function rg(a){return{J:a,Ea:!1}}function Zg(a){return[a.J,a.Ea]}function $g(a){return{J:a[0],Ea:a[1]}} function xg(a,b,c){var d;c=(c?a.L:a.sa).J;if(void 0!==b){d=b=ng(a,b)||b;var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=Ga(dh,a.substr(b,1))));return c};function eh(a,b){var c=0;a=a.Kb(b);if(void 0!==a)switch(b){case fh:case gh:case hh:case ih:case jh:case kh:case lh:case mh:c=2;break;case nh:case oh:case ph:case qh:case rh:case sh:case th:c=4}return c?n(a,c):"??"} l.Kb=function(a){var b;if(0<=a){var c=this.w;switch(a){case fh:b=c.g;break;case gh:b=c.u;break;case hh:b=c.A;break;case nh:b=wd(c);break;case ih:b=c.B;break;case jh:b=c.C;break;case oh:b=yd(c);break;case kh:b=c.D;break;case lh:b=c.G;break;case ph:b=D(c);break;case mh:b=E(c,D(c));break;case qh:b=c.M;break;case rh:b=c.j;break;case sh:b=ud(c);break;case th:b=ud(c)&255|c.g<<8}}return b}; function uh(a,b){b=ng(a,b)||b;for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=a.Jb(b,c+1),0<=e&&(b=b.substr(0,c)+eh(a,e)+b.substr(c+1+dh[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=la(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=xg(a,e))?(d=e+' "'+ch(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=xg(a,e))?(Xg(d),d= e+' "'+ch(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}l.message=function(a,b){b&&(a+=" at "+bh(rg(this.w.j).J));this.ha&1073741824?this.Z.push(a):this.Y&&a==this.Y||(this.Y=a,this.ha&-2147483648&&(this.ea(),a+=" (cpu halted)"),this.i(a),this.w&&(a=this.w,Zc(a),a.ta=0,Qc(a)))}; function Hb(a,b,c,d,e,f,g,h){h|=256;null!=f&&(a.ha&h)!=h||a.message(b.Gb+"."+(null!=d?"outPort":"inPort")+"("+q(c)+","+(f?f:"unknown")+(null!=d?","+na(d):"")+")"+(null!=g?": "+na(g):"")+(null!=e?" at "+bh(e):""))} function tg(a){var b;if(Ud(a)){if(!a.H||!a.H.length){a.H=Array(vh);for(b=0;b>>d.g],!1)}a.M=["br"];if(a.B)for(b=1;b>>d.g],!0);a.B=["bw"];a.ta=0}l.Oa=function(a,b,c){var d=!0;c||Bh(this,a,b,!1,!0);if(a!=this.j){var e=wg(b);if(-1===e)this.i("invalid address: "+bh(b.J)),d=!1;else{var f=this.I;f.b[e>>>f.g].Oa(e&f.j,a==this.B)}}d&&(a.push(b),c?b.Ea=!0:(Ch(this,a,a.length-1,"set"),tg(this)));return d}; function Bh(a,b,c,d,e){var f=!1;c=wg(c);for(var g=1;g>>d.g],b==a.B));h.Ea||tg(a);break}}return f}function Dh(a,b){for(var c=1;c>24,4);break;case Qh:C=n(y.Eb(C,2),4);break;default:y="imm("+q(w)+")";break a}y.style==Gh&&w&Rh?C="["+C+"]":w&Sh||(C=(y.style==qg?"$":"0x")+C);y=C}else w&Sh?(y=(v&Th)>>8, w=dh[y],a.style==Gh&&v&Rh&&(y==mh&&(w="HL"),w="["+w+"]"),y=w):w&Uh&&(y=(f>>3&7).toString());if(!y||!y.length){h="INVALID";break}0b[0]?1:a[0]>>0;for(b=0;b>>0,h=f.Rd;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.G=f&255;break;case "SP":d.M=f&65535;break;case "PC":A(d,f);a.L=rg(d.j);break;case "PS":sd(d,f);break;case "PSW":sd(d,f&255|d.N&-256);d.g=f>>8;break;case "CF":d.H=f?d.H|256:d.H&255;break;case "PF":f?Dd(d)||(d.L^=1):Dd(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.H=f?d.H&-256:d.H|255;break;case "SF":f?Gd(d)||(d.L^=192):Gd(d)&&(d.L^=192);break;case "IF":d.N= f?d.N|512:d.N&-513;break;default:a.i("unknown register: "+e);return}Qc(d);a.i("updated registers:")}a.i(Yh(a));c&&(a.L=rg(d.j),zh(a,bh(a.L.J)))}}function ei(a,b){b=xa(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.i(uh(a,c[2])):lg(a,b,!1)}function fi(a,b,c){var d="t"!=b;c=fg(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Sa(c,function(){return Eb(a,!0)&&yg(a,e,d,!1)},function(){Qc(a.w);Eb(a,!1)})} function zh(a,b,c,d){if(b=xg(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=xg(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=Fh(a,b,g,f);a.i(f);a.L=b;e-=b.J-k;c++}}} l.yb=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.N?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(xa(a.substring(d,f))),d=f+1}}return b}; function Eh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.i(">> "+b):(a.N&&(a.i("ended assemble at "+bh(a.T.J)),a.L=a.T,a.N=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.Y=null;if(Bb(a)&&0p||"z"bb.length&&(a.i("note: only "+bb.length+" available"),Da=bb.length);Oa-=Da;0>Oa&&(null==bb[bb.length-1].J?(Da=Oa+Da,Oa=0):Oa+=bb.length);var ue= [];"call"==Eg&&(mc=1E5,ue=["CALL"]);for(void 0!==Dg&&a.i(Da+" instructions earlier:");0=bb.length&&(Oa=0);a.wa=Da;Gg++;mc--}}Gg||(a.i("no "+Fg+"history available"),a.wa=void 0)}else{var dd=xg(a,ta);if(dd){var ed=0;Ba&&("l"==Ba.charAt(0)&&(Ba=Ba.substr(1)||Ki),ed=fg(a,Ba)>>>0,65536>4||1;Mi--&&0id?String.fromCharCode(id):".";gd--}oc&&(oc+="\n");oc+=ta+" "+we+(pc?"":" "+Jg)}oc&&a.i(oc);a.sa=dd}}}}break;case "e":if("else"==f[0])break;var jd=1,Kg=255,Lg=a.Ga,Mg=a.Xb;"ew"==f[0]&&(jd=2,Kg=65535,Lg=a.Eb,Mg=a.Qc);var Ng=jd<<1,Og=f[1];if(null==Og)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 kd=xg(a,Og);if(kd)for(var ld=2;ldDe;){for(var wb=null,Si=256;65536>sc.J>>>0;){Qg.J= a.Eb(sc,2);if(null==sc.J||!Si--)break;for(var Ti=a,nd=Qg,Rg=null,tc=nd.J,Sg=tc,Ee=1;6>=Ee&&tc;Ee++){if(2\nLicense: GPL version 3 or later ");for(b=0;bpi){if(ri(d,this.H)){this.u=new vd(this,"1.35.2",Ai);ri(this.u)&&(Bi(this,d),a=Ci,Di(this.u));this.u.set(xi,Fa());Ei(this.u);var e=this.b&&!this.D;if(a==yi||kb("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=wi(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?ri(d,g):("error"==f&&"no machine state"!= g?(this.aa("Error: "+g),"unable to verify user"==g&&(Na(Fi,""),this.g=null)):this.i(f+": "+g),Di(d),ri(d)?(c=wi(d),e=!0):c=!1))}e&&ui(this,c?d:null)}else a==Ci&&d.clear()}else ui(this);delete this.H;delete this.L}e=qb(this.id);for(f=0;fa[1];a=a[2];this.V=!0;this.F.ja=!0;var d=this.P.power;d&&(d.textContent="Shutdown");this.w&&(Gi(this,this.w,b,c,a),this.w.jb());this.O&&(Bi(this,b),b.clear());!c&&this.u&&(this.u.clear(),delete this.u);this.j=0}; function Bi(a,b){if(kb("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.35.2"};d.url=a.W;d.user=c;d.type="bug";d.data=b;Ha("http://www.pcjs.org/api/v1/report",d,!0)}} function gi(a,b,c){var d,e="none";if(a.j)return null;a.j--;var f=new vd(a,"1.35.2"),g=new vd(a,"1.35.2",vi),h=Fa();g.set(xi,h);f.set(xi,h);f.set(Hi,"1.35.2");f.set(Ii,window?window.location.href:null);f.set(Ji,Ja());a.w&&a.w.ua&&(c&&a.w.ea(),d=a.w.ua(b,c),"object"===typeof d&&f.set(a.w.id,d),c&&(a.w.F.ja=!1,!1===d&&(e=null)));for(var h=qb(a.id),k=0;kf.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(u){f=null,a=u.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");Ha(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 k=h[0],p,u=/( [a-z]+=)(['"])(.*?)\2/gi;p=u.exec(f);)k=0>k.toLowerCase().indexOf(p[1].toLowerCase())?k.replace(">",p[0]+">"):k.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+ "> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,"");a=a.replace(d[0],g);ej(a,b,c)}})}else c(a,null)} function fj(a,b,c,d){function e(a){if(void 0===h){var b=g&&nb(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ua(a))}function f(a){e("Error: "+a);k&&(--bj||$a(!0));k=!1}var g,h,k=!0;bj++;ib[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var u=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=p:v.appendChild(document.createTextNode(p));u.appendChild(v)}c|| (c="/versions/pc8080/1.35.2/components.xsl");p=function(d,h){h?cj(c,null,null,!1,e,function(d,k){k?(hb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--bj||$a(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(k),(k=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--bj||$a(!0)):f("invalid machine element: "+ a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?cj(b,a,d,!0,e,p):dj(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(B){f(B.message)}return k}window.embedPC8080=function(a,b,c,d){$a(!1);return fj(a,b,c,d)};window.findMachineComponent=function(a,b){return sb(b,a+".machine")}; window.processMachineScript=function(a,b){var c=!1;a+=".machine";if("string"==typeof b&&!ub[a]){for(var c=!0,d=ub,e=a,f=b.length,g=[],h=[],k="",p=null,u=0;u