From 804eb6f9c0d6a127c980e6b98a36dbc85446eb25 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Tue, 16 Aug 2016 11:34:11 -0700 Subject: [PATCH] Dual VT100 bi-directional communication is now limping along --- devices/pc8080/machine/vt100/README.md | 5 +- .../pc8080/machine/vt100/debugger/README.md | 4 +- .../pc8080/machine/vt100/debugger/machine.xml | 2 +- devices/pc8080/machine/vt100/dual/README.md | 21 + devices/pc8080/machine/vt100/machine.xml | 2 +- modules/pc8080/lib/serialport.js | 81 +++- versions/pc8080/1.23.3/pc8080-dbg.js | 379 +++++++++--------- versions/pc8080/1.23.3/pc8080.js | 322 +++++++-------- 8 files changed, 449 insertions(+), 367 deletions(-) create mode 100644 devices/pc8080/machine/vt100/dual/README.md diff --git a/devices/pc8080/machine/vt100/README.md b/devices/pc8080/machine/vt100/README.md index 64e69f0985..082be948c2 100644 --- a/devices/pc8080/machine/vt100/README.md +++ b/devices/pc8080/machine/vt100/README.md @@ -3,9 +3,8 @@ layout: page title: DEC VT100 Terminal permalink: /devices/pc8080/machine/vt100/ machines: - - type: pc8080 - id: vt100 - debugger: true + - id: vt100 + type: pc8080 --- DEC VT100 Terminal diff --git a/devices/pc8080/machine/vt100/debugger/README.md b/devices/pc8080/machine/vt100/debugger/README.md index b1a15b4c70..ec8efda2fe 100644 --- a/devices/pc8080/machine/vt100/debugger/README.md +++ b/devices/pc8080/machine/vt100/debugger/README.md @@ -3,8 +3,8 @@ layout: page title: DEC VT100 Terminal with Debugger permalink: /devices/pc8080/machine/vt100/debugger/ machines: - - type: pc8080 - id: vt100 + - id: vt100 + type: pc8080 debugger: true --- diff --git a/devices/pc8080/machine/vt100/debugger/machine.xml b/devices/pc8080/machine/vt100/debugger/machine.xml index 115dc3920e..3a2f8364f3 100644 --- a/devices/pc8080/machine/vt100/debugger/machine.xml +++ b/devices/pc8080/machine/vt100/debugger/machine.xml @@ -27,7 +27,7 @@ SET-UP - + TEST RECEIVER diff --git a/devices/pc8080/machine/vt100/dual/README.md b/devices/pc8080/machine/vt100/dual/README.md new file mode 100644 index 0000000000..92ba32442d --- /dev/null +++ b/devices/pc8080/machine/vt100/dual/README.md @@ -0,0 +1,21 @@ +--- +layout: page +title: Dual VT100 Terminals +permalink: /devices/pc8080/machine/vt100/dual/ +machines: + - id: vt100a + type: pc8080 + config: /devices/pc8080/machine/vt100/machine.xml + connection: serialPort=vt100b.serialPort + - id: vt100b + type: pc8080 + config: /devices/pc8080/machine/vt100/machine.xml + connection: serialPort=vt100a.serialPort +--- + +Dual VT100 Terminals +-------------------- + +{% include machine.html id="vt100a" %} + +{% include machine.html id="vt100b" %} diff --git a/devices/pc8080/machine/vt100/machine.xml b/devices/pc8080/machine/vt100/machine.xml index 378bca98e2..c9df17c00b 100644 --- a/devices/pc8080/machine/vt100/machine.xml +++ b/devices/pc8080/machine/vt100/machine.xml @@ -27,7 +27,7 @@ SET-UP - + TEST RECEIVER diff --git a/modules/pc8080/lib/serialport.js b/modules/pc8080/lib/serialport.js index 716a5e6490..4e8e6d7204 100644 --- a/modules/pc8080/lib/serialport.js +++ b/modules/pc8080/lib/serialport.js @@ -85,7 +85,7 @@ function SerialPort(parmsSerial) { this.consoleOutput = null; /** - * controlIOBuffer is a DOM element, if any, bound to the port (currently used for output only; see echoByte()). + * controlIOBuffer is a DOM element bound to the port (currently used for output only; see transmitByte()). * * @type {Object} */ @@ -93,7 +93,7 @@ function SerialPort(parmsSerial) { /* * If controlIOBuffer is being used AND 'tabSize' is set, then we make an attempt to monitor the characters - * being echoed via echoByte(), maintain a logical column position, and convert any tabs into the appropriate + * being echoed via transmitByte(), maintain a logical column position, and convert any tabs into the appropriate * number of spaces. * * charBOL, if nonzero, is a character to automatically output at the beginning of every line. This probably @@ -123,6 +123,18 @@ function SerialPort(parmsSerial) { serial.receiveData(); } }(this); + + /* + * No connection until initBus() invokes initConnection(). + */ + this.connection = this.sendByte = null; + + /* + * Export all functions required by initConnection(); currently, this is the bare minimum, with no flow control. + */ + this['exports'] = { + 'receiveByte': this.receiveByte + }; } /* @@ -130,7 +142,7 @@ function SerialPort(parmsSerial) { * property {number} iAdapter * property {number} portBase * property {number} nIRQ - * property {Object} controlIOBuffer is a DOM element, if any, bound to the port (for rudimentary output; see echoByte()) + * property {Object} controlIOBuffer is a DOM element bound to the port (for rudimentary output; see transmitByte()) * * NOTE: This class declaration started as a way of informing the code inspector of the controlIOBuffer property, * which remained undefined until a setBinding() call set it later, but I've since decided that explicitly @@ -359,9 +371,47 @@ SerialPort.prototype.initBus = function(cmp, bus, cpu, dbg) this.chipset = /** @type {ChipSet} */ (cmp.getMachineComponent("ChipSet")); bus.addPortInputTable(this, SerialPort.aPortInput, this.portBase); bus.addPortOutputTable(this, SerialPort.aPortOutput, this.portBase); + this.initConnection(); this.setReady(); }; +/** + * initConnection() + * + * If a machine 'connection' parameter exists of the form "=.", + * and "" matches our idComponent, then look for a component with id ".". + * + * If the target component is found, then verify that it has exported functions with the following names: + * + * receiveByte(b): called by us when we have a byte to transmit; aliased internally to sendByte(b) + * + * For now, we're not going to worry about communication in the other direction, because when the target component + * performs its own initConnection(), it will find our receiveByte(b) function, at which point communication in both + * directions should be established. + * + * @this {SerialPort} + */ +SerialPort.prototype.initConnection = function() +{ + var sConnection = this.cmp.getMachineParm("connection"); + if (sConnection) { + var asParts = sConnection.split('='); + if (asParts.length == 2) { + var sSourceID = str.trim(asParts[0]); + var sTargetID = str.trim(asParts[1]); + if (sSourceID == this.idComponent) { + this.connection = Component.getComponentByID(sTargetID); + if (this.connection) { + var exports = this.connection['exports']; + if (exports) { + this.sendByte = exports['receiveByte']; + } + } + } + } + } +}; + /** * powerUp(data, fRepower) * @@ -545,14 +595,22 @@ SerialPort.prototype.receiveData = function() }; /** - * echoByte(b) + * transmitByte(b) * * @this {SerialPort} * @param {number} b - * @return {boolean} true if echoed, false if not + * @return {boolean} true if transmitted, false if not */ -SerialPort.prototype.echoByte = function(b) +SerialPort.prototype.transmitByte = function(b) { + var fTransmitted = false; + + if (this.sendByte) { + if (this.sendByte.call(this.connection, b)) { + fTransmitted = true; + } + } + if (this.controlIOBuffer) { if (b == 0x0D) { this.iLogicalCol = 0; @@ -577,9 +635,9 @@ SerialPort.prototype.echoByte = function(b) this.controlIOBuffer.scrollTop = this.controlIOBuffer.scrollHeight; this.iLogicalCol += nChars; } - return true; + fTransmitted = true; } - if (this.consoleOutput != null) { + else if (this.consoleOutput != null) { if (b == 0x0A || this.consoleOutput.length >= 1024) { this.println(this.consoleOutput); this.consoleOutput = ""; @@ -587,9 +645,10 @@ SerialPort.prototype.echoByte = function(b) if (b != 0x0A) { this.consoleOutput += String.fromCharCode(b); } - return true; + fTransmitted = true; } - return false; + + return fTransmitted; }; /** @@ -649,7 +708,7 @@ SerialPort.prototype.outData = function(port, bOut, addrFrom) this.printMessageIO(port, bOut, addrFrom, "DATA"); this.bDataOut = bOut; this.bStatus &= ~(SerialPort.UART8251.STATUS.XMIT_READY | SerialPort.UART8251.STATUS.XMIT_EMPTY); - if (this.echoByte(bOut)) { + if (this.transmitByte(bOut)) { this.bStatus |= (SerialPort.UART8251.STATUS.XMIT_READY | SerialPort.UART8251.STATUS.XMIT_EMPTY); } }; diff --git a/versions/pc8080/1.23.3/pc8080-dbg.js b/versions/pc8080/1.23.3/pc8080-dbg.js index 0f9ced2b54..1eae66cb9e 100644 --- a/versions/pc8080/1.23.3/pc8080-dbg.js +++ b/versions/pc8080/1.23.3/pc8080-dbg.js @@ -9,137 +9,138 @@ function sa(){return window?window.navigator.userAgent:""}function v(a){window&& function wa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function xa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function ya(a){if(window){var b=sa();return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function za(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0=this.J?10:20>=this.J?12:24>=this.J?14:15;this.Ha=1<>2;this.w=this.Ha-1;this.L=this.N/this.Ha|0;this.K=this.L-1;this.A=[];this.u=[];this.I=this.F=!1;this.P=[];this.Z=[];a=new F;vb(a,this.H);this.X=Array(this.L);for(b=0;b>>a.pa;0f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.G)return g.Hb+=g.G-e,g.G=e,!0;if(e>=g.G+g.Hb){l=g.size-(e-k);l>f&&(l=f);g.Hb=e-g.G+l;e=k+a.Ha;f-=l;h++;continue}}return xb(1,e,f)}e=new F(e,l,a.Ha,d);vb(e,a.H,g);a.X[h++]=e;e=k+a.Ha;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+yb[d]+" at "+t(b)),!0):xb(2,b,c)}m.aa=function(a){return this.X[(a&this.B)>>>this.pa].sb(a&this.w,a)}; -function zb(a,b){return a.X[(b&a.B)>>>a.pa].Gb(b&a.w,b)}m.Sa=function(a){var b=a&this.w,c=(a&this.B)>>>this.pa;return b!=this.w?this.X[c].Kc(b,a):this.X[c++].sb(b,a)|this.X[c&this.K].sb(0,a+1)<<8};function Ab(a,b){var c=b&a.w,d=(b&a.B)>>>a.pa;return c!=a.w?a.X[d].dc(c,b):a.X[d++].Gb(c,b)|a.X[d&a.K].Gb(0,b+1)<<8}m.ra=function(a,b){this.X[(a&this.B)>>>this.pa].ub(a&this.w,b&255,a)};function Bb(a,b,c){a.X[(b&a.B)>>>a.pa].Ib(b&a.w,c&255,b)} -m.Tb=function(a,b){var c=a&this.w,d=(a&this.B)>>>this.pa;c!=this.w?this.X[d].Mc(c,b&65535,a):(this.X[d++].ub(c,b&255,a),this.X[d&this.K].ub(0,b>>8&255,a+1))};function Cb(a,b){if(void 0===b)return a.I=!a.I,a.I;void 0===a.A[b]&&(a.A[b]=[null,!1]);a.A[b][1]=!a.A[b][1];return a.A[b][1]}function Db(a,b,c,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.A[k]?v("Input port "+t(k)+" already registered"):f.A[k]=[g,!1]}} -function Eb(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.H&&a.F!=h[1]&&Jb(a.H,b,k)}else a.H&&(gb(a.H,a,b,k,d),a.F&&Jb(a.H,b,k));f+=g<<3;b+=g;e-=g}} -function xb(a,b,c){v("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Sb;if(pb){var Tb=new ArrayBuffer(2);(new DataView(Tb)).setUint16(0,256,!0);Sb=256===(new Uint16Array(Tb))[0]}else Sb=!1;var Ub=Sb; -function F(a,b,c,d){this.id=Vb+=2;this.b=null;this.G=a;this.Hb=b;this.size=c||0;this.type=d||Wb;this.A=d==Xb;vb(this);this.Oa=this.tc=!1;if(c)if(pb)this.I=new ArrayBuffer(c),this.F=new DataView(this.I,0,c),this.w=new Uint8Array(this.I,0,c),this.K=new Uint16Array(this.I,0,c>>1),this.b=new Int32Array(this.I,0,c>>2),Yb(this,Ub?Zb:$b);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},ha: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.Oa=!0},P:function(a,b){if(this.H&&null!=this.G){var c=this.H;ec(c,this.G+a,1,c.P)&&c.na(!0)}return this.Gb(a,b)},ea:function(a,b){if(this.H&&null!=this.G){var c=this.H;ec(c,this.G+a,2,c.P)&&c.na(!0)}return this.dc(a,b)},va:function(a,b,c){if(this.H&&null!=this.G){var d=this.H;ec(d,this.G+a,1,d.F)&&d.na(!0)}this.A?this.B(a,b,c):this.Ib(a,b,c)},Ca:function(a, -b,c){if(this.H&&null!=this.G){var d=this.H;ec(d,this.G+a,2,d.F)&&d.na(!0)}this.A?this.B(a,b,c):this.fc(a,b,c)},O:function(a){return this.w[a]},Z:function(a){return this.w[a]},da:function(a){return this.F.getUint16(a,!0)},ga:function(a){return a&1?this.w[a]|this.w[a+1]<<8:this.K[a>>1]},ia:function(a,b){this.w[a]=b;this.Oa=!0},wa:function(a,b){this.w[a]=b;this.Oa=!0},za:function(a,b){this.F.setUint16(a,b,!0);this.Oa=!0},Da:function(a,b){a&1?(this.w[a]=b,this.w[a+1]=b>>8):this.K[a>>1]=b;this.Oa=!0}}; -function vb(a,b,c){a.H=b;a.M=a.u=0;c&&((a.M=c.M)&&dc(a,cc,!1),(a.u=c.u)&&bc(a,cc,!1))}function fc(a,b){b?0===--a.u&&(a.ub=a.A?a.B:a.Ib,a.Mc=a.A?a.J:a.fc):0===--a.M&&(a.sb=a.Gb,a.Kc=a.dc)}function bc(a,b,c){c&&a.u||(a.ub=!a.A&&b[2]||a.B,a.Mc=!a.A&&b[3]||a.J);if(c||void 0===c)a.Ib=b[2]||a.B,a.fc=b[3]||a.J}function dc(a,b,c){c&&a.M||(a.sb=b[0]||a.L,a.Kc=b[1]||a.N);if(c||void 0===c)a.Gb=b[0]||a.L,a.dc=b[1]||a.N}function Yb(a,b){b||(b=gc);dc(a,b,void 0);bc(a,b,void 0)} -var gc=[],ac=[F.prototype.ca,F.prototype.ha,F.prototype.ya,F.prototype.Fa],cc=[F.prototype.P,F.prototype.ea,F.prototype.va,F.prototype.Ca];if(pb)var $b=[F.prototype.O,F.prototype.da,F.prototype.ia,F.prototype.za],Zb=[F.prototype.Z,F.prototype.ga,F.prototype.wa,F.prototype.Da]; -function hc(a,b){w.call(this,"CPU",a,hc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.rb=c;this.i.Qb=0;this.i.cb=d;this.i.$b=Math.round(this.i.rb/1E4)/100;this.i.ab=this.i.$b*this.i.cb;this.D.xa=!1;this.D.Wb=!1;this.D.sc=a.autoStart;this.D.uc=!1;this.D.kb=!1;this.i.Ab=this.i.ob=0;this.i.Bb=a.csStart;this.i.nb=a.csInterval;this.i.pb=a.csStop;this.Z=this.eb.bind(this);E(this)}Za(hc);var ic=["power","reset"];m=hc.prototype; -m.Qa=function(a,b,c,d){this.A=a;this.w=b;this.H=d;for(b=0;b=a.i.ob&&(a.i.ob+=a.i.nb,c=!0);0<=a.i.pb&&a.i.pb<=Cc(a)&&(a.i.nb=a.i.pb=-1,lc(a),a.na(),c=!0);c&&a.g(Cc(a)+" cycles: checksum="+n(a.i.Ab))}} -m.ma=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.M[b]=c;a=!0;break;case "run":this.M[b]=c;c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.D.sa)a=!0;else{var b=null,c,g=bb(a.id);for(c=0;cc&&(c=2);var d=1;b&&1a.i.$a/a.i.ab?b=1:d=!0;a.i.cb=b;b=a.i.$b*a.i.cb;if(a.i.ab!=b){a.i.ab=b;b=a.i.ab.toFixed(2)+"Mhz";var e=a.M.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.A&&a.A.fb()}Ec(a,a.F);a.F=0;a.i.mb=na();a.i.bb=0;Fc(a);return d} -m.eb=function(a){if(jb(this,!0)){if(!this.D.xa){Dc(this);this.A&&this.A.start(this.i.mb,Cc(this));this.D.xa=!0;this.D.Wb=!0;this.I&&this.I.start();var b=this.M.run;b&&(b.textContent="Halt");this.A&&(this.A.Ja(!0),a&&this.A.fb(!0))}this.i.cc>=this.i.rb&&Fc(this,!0);this.i.Eb=0;this.i.Pb=na();this.i.bb&&(a=this.i.Pb-this.i.bb,a>this.i.Bc&&(this.i.mb+=a,this.i.mb>this.i.Pb&&(this.i.mb=this.i.Pb)));try{do{this.tb(this.D.kb?1:this.i.Fd);var c=this.B-this.b;this.F+=c;this.i.Eb+=c;Ec(this,0,!0);Bc(this, -c);this.i.Db-=c;0>=this.i.Db&&(this.i.Db+=this.i.Dc,this.A&&Gc(this.A,this.i.Qb++),this.i.Qb>this.L&&(this.i.Qb=0));this.i.Cb-=c;0>=this.i.Cb&&(this.i.Cb+=this.i.Cc,this.A&&this.A.Ja());this.i.qb-=c;if(0>=this.i.qb){this.i.qb+=this.i.bc;break}}while(this.D.xa)}catch(e){this.na();nc(this);this.A&&this.A.stop(na(),Cc(this));jb(this,!1);ob(this,e.stack||e.message);return}c=setTimeout;a=this.Z;this.i.bb=na();b=this.i.Bc;this.i.Eb&&(b=Math.round(b*this.i.Eb/this.i.bc));var b=b-(this.i.bb-this.i.Pb),d= -this.i.bb-this.i.mb;d&&(this.i.$a=Math.round(this.F/(10*d))/100,864E5<=d&&(this.J=0,Dc(this)));if(0>b||this.i.$a>8&255;a.T=b&255}function Qc(a){return a.U<<8|a.V}function Rc(a,b){a.U=b>>8&255;a.V=b&255}function J(a){return a.W<<8|a.Y} -function Sc(a,b){a.W=b>>8&255;a.Y=b&255}function G(a,b){a.R=b&65535}function Tc(a){return a.ba&256?1:0}function Uc(a,b){a.ba=a.ba&255|b}function Vc(a){return qb[a.fa&255]?4:0}function Wc(a){return(a.fa^a.ua)&16?16:0}function Xc(a){return a.ba&255?0:64}function Yc(a){return a.fa&128?128:0}function Nc(a){return a.ta&-214|Yc(a)|Xc(a)|Wc(a)|Vc(a)|Tc(a)}function Lc(a,b){a.ba=a.fa=a.ua=0;b&1&&(a.ba|=256);b&4||(a.fa|=1);b&16&&(a.ua|=16);b&64||(a.ba|=255);b&128&&(a.fa^=192);a.ta=a.ta&-726|b&512|2} -function Zc(a,b){a.ua=a.j^b;return a.fa=(a.ba=a.j+b)&255}function $c(a,b){a.ua=a.j^b;return a.fa=(a.ba=a.j+b+(a.ba&256?1:0))&255}function ad(a,b){a.ba=a.fa=a.ua=a.j&b;(a.j|b)&8&&(a.ua^=16);return a.ba}function bd(a,b){a.ua=b^255;b=a.fa=b+255&255;a.ba=a.ba&-256|b;return b}function cd(a,b){a.ua=b;b=a.fa=b+1&255;a.ba=a.ba&-256|b;return b}function dd(a,b){return a.fa=a.ba=a.ua=a.j|b}function L(a,b){b^=255;a.ua=a.j^b;return a.fa=(a.ba=a.j+b+1^256)&255} -function ed(a,b){b^=255;a.ua=a.j^b;return a.fa=(a.ba=a.j+b+(a.ba&256?0:1)^256)&255}function fd(a,b){return a.fa=a.ba=a.ua=a.j^b}m.aa=function(a){return this.w.aa(a)};m.ra=function(a,b){this.w.ra(a,b)};function M(a){var b=a.aa(a.R);G(a,a.R+1);return b}function N(a){var b=a.w.Sa(a.R);G(a,a.R+2);return b}function P(a){var b=a.w.Sa(a.la);a.la=a.la+2&65535;return b}function Q(a,b){a.la=a.la-2&65535;a.w.Tb(a.la,b)}function zd(a,b){a.u=a.u&-8|b|8} -function S(a,b,c,d){d=d||2;a.M[b]&&(void 0===c&&(ob(a,"Value for "+b+" is invalid"),a.na()),c=!a.D.xa||a.D.uc?n(c,d):"--------".substr(0,d),a.M[b].textContent!=c&&(a.M[b].textContent=c))} -m.Ja=function(a){this.P&&(a||!this.D.xa||this.D.uc)&&(S(this,"A",this.j),S(this,"B",this.S),S(this,"C",this.T),S(this,"BC",Oc(this),4),S(this,"D",this.U),S(this,"E",this.V),S(this,"DE",Qc(this),4),S(this,"H",this.W),S(this,"L",this.Y),S(this,"HL",J(this),4),S(this,"SP",this.la,4),S(this,"PC",this.R,4),a=Nc(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.M.speed)a.textContent= -this.D.xa&&this.i.$a?this.i.$a.toFixed(2)+"Mhz":"Stopped"};m.tb=function(a){this.D.Nb=!0;var b=this.D.vd=this.H&&Ad(this.H),c=a?this.D.Wb?0:1:-1;this.D.Wb=!1;this.B=this.b=a;do{if(this.u){if(a&&this.u&8&&this.ta&512){var d=199|(this.u&7)<<3;this.u&=-17;this.u&=-16;this.ta&=-513;this.N[d].call(this)}if(this.u&16){this.b=0;break}}if(b){if(Bd(this.H,this.R,c)){this.na();break}c=1}this.N[M(this)].call(this)}while(0>8;Uc(this,a&256);this.b-=4},Cd,function(){var a;Sc(this,a=J(this)+Oc(this));Uc(this,a>>8&256);this.b-=10},function(){this.j=this.aa(Oc(this));this.b-=7},function(){Pc(this,Oc(this)-1);this.b-= -5},function(){this.T=cd(this,this.T);this.b-=5},function(){this.T=bd(this,this.T);this.b-=5},function(){this.T=M(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;Uc(this,a);this.b-=4},Cd,function(){Rc(this,N(this));this.b-=10},function(){this.ra(Qc(this),this.j);this.b-=7},function(){Rc(this,Qc(this)+1);this.b-=5},function(){this.U=cd(this,this.U);this.b-=5},function(){this.U=bd(this,this.U);this.b-=5},function(){this.U=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255| -Tc(this);Uc(this,a&256);this.b-=4},Cd,function(){var a;Sc(this,a=J(this)+Qc(this));Uc(this,a>>8&256);this.b-=10},function(){this.j=this.aa(Qc(this));this.b-=7},function(){Rc(this,Qc(this)-1);this.b-=5},function(){this.V=cd(this,this.V);this.b-=5},function(){this.V=bd(this,this.V);this.b-=5},function(){this.V=M(this);this.b-=7},function(){var a=this.j<<8;this.j=(Tc(this)<<8|this.j)>>1;Uc(this,a&256);this.b-=4},Cd,function(){Sc(this,N(this));this.b-=10},function(){var a=N(this);this.w.Tb(a,J(this)); -this.b-=16},function(){Sc(this,J(this)+1);this.b-=5},function(){this.W=cd(this,this.W);this.b-=5},function(){this.W=bd(this,this.W);this.b-=5},function(){this.W=M(this);this.b-=7},function(){var a=0,b=Tc(this);if(Wc(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=Zc(this,a);Uc(this,b?256:0);this.b-=4},Cd,function(){var a;Sc(this,a=J(this)+J(this));Uc(this,a>>8&256);this.b-=10},function(){var a;a=N(this);a=this.w.Sa(a);Sc(this,a);this.b-=16},function(){Sc(this,J(this)-1);this.b-=5},function(){this.Y= -cd(this,this.Y);this.b-=5},function(){this.Y=bd(this,this.Y);this.b-=5},function(){this.Y=M(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},Cd,function(){this.la=N(this)&65535;this.b-=10},function(){this.ra(N(this),this.j);this.b-=13},function(){this.la=this.la+1&65535;this.b-=5},function(){var a=J(this);this.ra(a,cd(this,this.aa(a)));this.b-=10},function(){var a=J(this);this.ra(a,bd(this,this.aa(a)));this.b-=10},function(){this.ra(J(this),M(this));this.b-=10},function(){this.ba|=256;this.b-= -4},Cd,function(){var a;Sc(this,a=J(this)+this.la);Uc(this,a>>8&256);this.b-=10},function(){this.j=this.aa(N(this));this.b-=13},function(){this.la=this.la-1&65535;this.b-=5},function(){this.j=cd(this,this.j);this.b-=5},function(){this.j=bd(this,this.j);this.b-=5},function(){this.j=M(this);this.b-=7},function(){Uc(this,Tc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.S=this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.W; -this.b-=5},function(){this.S=this.Y;this.b-=5},function(){this.S=this.aa(J(this));this.b-=7},function(){this.S=this.j;this.b-=5},function(){this.T=this.S;this.b-=5},function(){this.b-=5},function(){this.T=this.U;this.b-=5},function(){this.T=this.V;this.b-=5},function(){this.T=this.W;this.b-=5},function(){this.T=this.Y;this.b-=5},function(){this.T=this.aa(J(this));this.b-=7},function(){this.T=this.j;this.b-=5},function(){this.U=this.S;this.b-=5},function(){this.U=this.T;this.b-=5},function(){this.b-= -5},function(){this.U=this.V;this.b-=5},function(){this.U=this.W;this.b-=5},function(){this.U=this.Y;this.b-=5},function(){this.U=this.aa(J(this));this.b-=7},function(){this.U=this.j;this.b-=5},function(){this.V=this.S;this.b-=5},function(){this.V=this.T;this.b-=5},function(){this.V=this.U;this.b-=5},function(){this.b-=5},function(){this.V=this.W;this.b-=5},function(){this.V=this.Y;this.b-=5},function(){this.V=this.aa(J(this));this.b-=7},function(){this.V=this.j;this.b-=5},function(){this.W=this.S; -this.b-=5},function(){this.W=this.T;this.b-=5},function(){this.W=this.U;this.b-=5},function(){this.W=this.V;this.b-=5},function(){this.b-=5},function(){this.W=this.Y;this.b-=5},function(){this.W=this.aa(J(this));this.b-=7},function(){this.W=this.j;this.b-=5},function(){this.Y=this.S;this.b-=5},function(){this.Y=this.T;this.b-=5},function(){this.Y=this.U;this.b-=5},function(){this.Y=this.V;this.b-=5},function(){this.Y=this.W;this.b-=5},function(){this.b-=5},function(){this.Y=this.aa(J(this));this.b-= -7},function(){this.Y=this.j;this.b-=5},function(){this.ra(J(this),this.S);this.b-=7},function(){this.ra(J(this),this.T);this.b-=7},function(){this.ra(J(this),this.U);this.b-=7},function(){this.ra(J(this),this.V);this.b-=7},function(){this.ra(J(this),this.W);this.b-=7},function(){this.ra(J(this),this.Y);this.b-=7},function(){var a=this.R-1;if(this.K.length)for(var b=0;b>8;this.b-=10},function(){var a=N(this);Yc(this)||G(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=N(this);Yc(this)||(Q(this,this.R),G(this,a),this.b-=6);this.b-=11},function(){Q(this,Nc(this)&255|this.j<<8);this.b-=11},function(){this.j=dd(this,M(this));this.b-=7},function(){Q(this,this.R);G(this,48);this.b-=11},function(){Yc(this)&&(G(this, -P(this)),this.b-=6);this.b-=5},function(){this.la=J(this)&65535;this.b-=5},function(){var a=N(this);Yc(this)&&G(this,a);this.b-=10},function(){this.ta|=512;this.b-=4},function(){var a=N(this);Yc(this)&&(Q(this,this.R),G(this,a),this.b-=6);this.b-=11},Fd,function(){L(this,M(this));this.b-=7},function(){Q(this,this.R);G(this,56);this.b-=11}]; -function T(a){w.call(this,"ChipSet",a,T,32768);var b=a.model;b&&!Gd[b]&&La("Unrecognized ChipSet model: "+b);this.B=Gd[b]||{};a.sound&&(this.ha=null,window&&(this.ha=window.AudioContext||window.webkitAudioContext),this.ha&&new this.ha);E(this)}Za(T); -var U={Aa:1978.1,qd:{Ba:0,ce:1,ge:16,ne:32,we:64,ve:128,vb:14},Wa:{Ba:1,Rc:1,kd:2,fd:4,gd:16,hd:32,jd:64,vb:8},rd:{Ba:2,be:3,Ee:4,de:8,re:16,se:32,te:64,ee:128,vb:0},Ae:{Ba:3},ye:{Ba:2,oe:7},Ce:{Ba:3,Fe:1,Be:2,ue:4,le:8,fe:16,Zd:32},ze:{Ba:4},De:{Ba:5,he:1,ie:2,je:4,ke:8,Ge:16}},V={Aa:100,Ka:{Ba:66,pc:1,lc:2,ed:4,qe:8,pe:16,nc:32,mc:64,ic:128},Qc:{Ba:66,INIT:0},Ua:{Ba:194,ae:0,hc:16,ld:32,oc:48,Vc:0,Wc:32},Jb:{Ba:162,xe:0,Yc:0,Uc:0,Xc:0,Tc:0},La:{me:{Ba:98},Ta:{Oc:0,Nc:1,nd:2,sd:4,Sc:5,md:6,od:7}, -Kb:16383}},Gd={SI1978:U,VT100:V};T.prototype.ma=function(){return!1};T.prototype.Qa=function(a,b,c,d){this.w=b;this.b=c;this.H=d;this.A=a;this.J=sb(a,"Keyboard");this.Fa=sb(a,"SerialPort");this.video=sb(a,"Video");Db(b,this,this.B.Rb);Hb(b,this,this.B.Sb)};T.prototype.Ea=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};T.prototype.Ia=function(a){return a?this.save():!0};U.INIT=[[U.qd.vb,U.Wa.vb,U.rd.vb,0,0,0,0]]; -V.INIT=[[V.Qc.INIT,V.Ka.lc|V.Ka.ed],[V.Ua.Vc,V.Ua.Wc],[V.Jb.Yc,V.Jb.Uc,V.Jb.Xc,V.Jb.Tc],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11856,11824,11840,11808,11776,12E3,12E3,11857,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]]; -m=T.prototype;m.reset=function(){this.B.INIT&&!this.restore(this.B.INIT)&&this.ja("reset error")};m.save=function(){var a=new H(this);switch(this.B.Aa){case U.Aa:I(a,0,[this.Ca,this.F,this.Da,this.ca,this.ga,this.ya,this.za]);break;case V.Aa:I(a,0,[this.ia,this.K]),I(a,1,[this.N,this.O]),I(a,2,[this.I,this.da,this.wa,this.va]),I(a,3,[this.Z,this.u,this.P,this.ea,this.L])}return a.data()}; -m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.B.Aa){case U.Aa:return this.Ca=b[0],this.F=b[1],this.Da=b[2],this.ca=b[3],this.ga=b[4],this.ya=b[5],this.za=b[6],!0;case V.Aa:return this.ia=b[0],this.K=b[1],b=a[1],this.N=b[0],this.O=b[1],b=a[2],this.I=b[0],this.da=b[1],this.wa=b[2],this.va=b[3],b=a[3],this.Z=b[0],this.u=b[1],this.P=b[2],this.ea=b[3],this.L=b[4],!0}return!1};m.start=function(){};m.stop=function(){};m.zd=function(a,b){var c=this.Ca;D(this,a,null,b,"STATUS0",c,!0);return c}; -m.Ad=function(a,b){var c=this.F;D(this,a,null,b,"STATUS1",c,!0);return c};m.Bd=function(a,b){var c=this.Da;D(this,a,null,b,"STATUS2",c,!0);return c};m.yd=function(a,b){var c=this.ca>>8-this.ga&255;D(this,a,null,b,"SHIFT.RESULT",c,!0);return c};m.Jd=function(a,b,c){D(this,a,b,c,"SHIFT.COUNT",null,!0);this.ga=b};m.Ld=function(a,b,c){D(this,a,b,c,"SOUND1",null,!0);this.ya=b};m.Kd=function(a,b,c){D(this,a,b,c,"SHIFT.DATA",null,!0);this.ca=b<<8|this.ca>>8}; -m.Md=function(a,b,c){D(this,a,b,c,"SOUND2",null,!0);this.za=b};m.Nd=function(a,b,c){D(this,a,b,c,"WATCHDOG",null,!0)};function Hd(a){var b=0,c=0,d=~a.Z;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.Cd=function(a,b){var c=this.K,c=c&~V.Ka.mc;if((Cc(this.b)&64)<<1&&(c|=V.Ka.mc,c!=this.K)){var d,e;d=this.P&1;e=this.P>>1&7;switch(e){case V.La.Ta.od:break;case V.La.Ta.Nc:this.Z=this.Z<<1|d;break;case V.La.Ta.Sc:d=Hd(this);this.L[d]=V.La.Kb;hb(this,"doNVRCommand(): erase data at addr "+t(d));break;case V.La.Ta.Oc:this.u=this.u<<1|d;break;case V.La.Ta.sd:d=Hd(this);e=this.u&V.La.Kb;this.L[d]=e;hb(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case V.La.Ta.md:d=Hd(this);e=this.L[d]; -null==e&&(e=V.La.Kb);this.u=e;hb(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case V.La.Ta.nd:this.u<<=1;this.ea=this.u&V.La.Kb+1;break;default:hb(this,"doNVRCommand(): unrecognized command 0x"+n(e,2))}}c&=~V.Ka.nc;this.ea&&(c|=V.Ka.nc);c&=~V.Ka.ic;this.J&&this.J.Zb()&&(c|=V.Ka.ic);c&=~V.Ka.pc;this.Fa&&this.Fa.Zb()&&(c|=V.Ka.pc);this.K=c;D(this,a,null,b,"FLAGS",c);return c};m.Od=function(a,b,c){D(this,a,b,c,"BRIGHTNESS");this.ia=b}; -m.Rd=function(a,b,c){D(this,a,b,c,"NVR.LATCH");this.P=b};m.Qd=function(a,b,c){D(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.I=this.I&-4|a;break;case 1:this.I=this.I&-13|a<<2;this.video&&(b=this.video,a=this.I,hb(b,"updateScrollOffset("+a+")"),b.gb!==a&&(b.gb=a,Id(b,-1)));break;case 2:switch(a){case 0:this.da=~this.da;break;case 2:case 3:this.wa=3-a}break;case 3:this.va=a}}; -m.Pd=function(a,b,c){D(this,a,b,c,"DC011");b&V.Ua.ld?(b&=V.Ua.oc,this.O!=b&&(this.O=b,this.video&&(a=this.video,b=this.O==V.Ua.oc?50:60,hb(a,"updateRate("+b+")"),a.Yb=b))):(b&=V.Ua.hc,this.N!=b&&(this.N=b,this.video&&(a=this.N==V.Ua.hc?132:80,b=this.video,hb(b,"updateDimensions("+a+","+(80>>0,h],p=ma(q,k,a.Xa);0>p&&q.splice(-(p+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.J.push({He:b,G:c,Ed:d,Ra:e,qc:f})}delete this.Ra}return!0};Ld.prototype.Ia=function(){return!0}; -function Md(a,b,c,d){if(d)a.ja("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.Xb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.A=f;else if(h)for(a.A=Array(4*h.length),d=c=0;c>8&255,a.A[d++]=h[c]>>16&255,a.A[d++]=h[c]>>24&255;else a.A=e;a.Ra=e.symbols;if(!a.A.length){v("Empty ROM: "+b);return}if(1==a.A.length){v(a.A[0]);return}}catch(g){a.ja("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, -" ").replace(/ +$/,"").split(" "),a.A=Array(b.length),e=0;e>>f.pa;0>>=f.pa;0=this.J?10:20>=this.J?12:24>=this.J?14:15;this.Ga=1<>2;this.w=this.Ga-1;this.L=this.N/this.Ga|0;this.K=this.L-1;this.A=[];this.u=[];this.I=this.F=!1;this.P=[];this.X=[];a=new F;wb(a,this.H);this.Y=Array(this.L);for(b=0;b>>a.pa;0f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.G)return g.Ib+=g.G-e,g.G=e,!0;if(e>=g.G+g.Ib){l=g.size-(e-k);l>f&&(l=f);g.Ib=e-g.G+l;e=k+a.Ga;f-=l;h++;continue}}return yb(1,e,f)}e=new F(e,l,a.Ga,d);wb(e,a.H,g);a.Y[h++]=e;e=k+a.Ga;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+zb[d]+" at "+t(b)),!0):yb(2,b,c)}m.aa=function(a){return this.Y[(a&this.B)>>>this.pa].tb(a&this.w,a)}; +function Ab(a,b){return a.Y[(b&a.B)>>>a.pa].Hb(b&a.w,b)}m.Sa=function(a){var b=a&this.w,c=(a&this.B)>>>this.pa;return b!=this.w?this.Y[c].Lc(b,a):this.Y[c++].tb(b,a)|this.Y[c&this.K].tb(0,a+1)<<8};function Bb(a,b){var c=b&a.w,d=(b&a.B)>>>a.pa;return c!=a.w?a.Y[d].ec(c,b):a.Y[d++].Hb(c,b)|a.Y[d&a.K].Hb(0,b+1)<<8}m.ta=function(a,b){this.Y[(a&this.B)>>>this.pa].vb(a&this.w,b&255,a)};function Cb(a,b,c){a.Y[(b&a.B)>>>a.pa].Jb(b&a.w,c&255,b)} +m.Ub=function(a,b){var c=a&this.w,d=(a&this.B)>>>this.pa;c!=this.w?this.Y[d].Nc(c,b&65535,a):(this.Y[d++].vb(c,b&255,a),this.Y[d&this.K].vb(0,b>>8&255,a+1))};function Db(a,b){if(void 0===b)return a.I=!a.I,a.I;void 0===a.A[b]&&(a.A[b]=[null,!1]);a.A[b][1]=!a.A[b][1];return a.A[b][1]}function Eb(a,b,c,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.A[k]?v("Input port "+t(k)+" already registered"):f.A[k]=[g,!1]}} +function Fb(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.H&&a.F!=h[1]&&Sb(a.H,b,k)}else a.H&&(hb(a.H,a,b,k,d),a.F&&Sb(a.H,b,k));f+=g<<3;b+=g;e-=g}} +function yb(a,b,c){v("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Tb;if(qb){var Ub=new ArrayBuffer(2);(new DataView(Ub)).setUint16(0,256,!0);Tb=256===(new Uint16Array(Ub))[0]}else Tb=!1;var Vb=Tb; +function F(a,b,c,d){this.id=Wb+=2;this.b=null;this.G=a;this.Ib=b;this.size=c||0;this.type=d||Xb;this.A=d==Yb;wb(this);this.Oa=this.uc=!1;if(c)if(qb)this.I=new ArrayBuffer(c),this.F=new DataView(this.I,0,c),this.w=new Uint8Array(this.I,0,c),this.K=new Uint16Array(this.I,0,c>>1),this.b=new Int32Array(this.I,0,c>>2),Zb(this,Vb?$b:ac);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},ha: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.Oa=!0},P:function(a,b){if(this.H&&null!=this.G){var c=this.H;fc(c,this.G+a,1,c.P)&&c.na(!0)}return this.Hb(a,b)},ea:function(a,b){if(this.H&&null!=this.G){var c=this.H;fc(c,this.G+a,2,c.P)&&c.na(!0)}return this.ec(a,b)},qa:function(a,b,c){if(this.H&&null!=this.G){var d=this.H;fc(d,this.G+a,1,d.F)&&d.na(!0)}this.A?this.B(a,b,c):this.Jb(a,b,c)},Xa:function(a, +b,c){if(this.H&&null!=this.G){var d=this.H;fc(d,this.G+a,2,d.F)&&d.na(!0)}this.A?this.B(a,b,c):this.gc(a,b,c)},O:function(a){return this.w[a]},X:function(a){return this.w[a]},da:function(a){return this.F.getUint16(a,!0)},ga:function(a){return a&1?this.w[a]|this.w[a+1]<<8:this.K[a>>1]},ia:function(a,b){this.w[a]=b;this.Oa=!0},ra:function(a,b){this.w[a]=b;this.Oa=!0},za:function(a,b){this.F.setUint16(a,b,!0);this.Oa=!0},Ca:function(a,b){a&1?(this.w[a]=b,this.w[a+1]=b>>8):this.K[a>>1]=b;this.Oa=!0}}; +function wb(a,b,c){a.H=b;a.M=a.u=0;c&&((a.M=c.M)&&ec(a,dc,!1),(a.u=c.u)&&cc(a,dc,!1))}function gc(a,b){b?0===--a.u&&(a.vb=a.A?a.B:a.Jb,a.Nc=a.A?a.J:a.gc):0===--a.M&&(a.tb=a.Hb,a.Lc=a.ec)}function cc(a,b,c){c&&a.u||(a.vb=!a.A&&b[2]||a.B,a.Nc=!a.A&&b[3]||a.J);if(c||void 0===c)a.Jb=b[2]||a.B,a.gc=b[3]||a.J}function ec(a,b,c){c&&a.M||(a.tb=b[0]||a.L,a.Lc=b[1]||a.N);if(c||void 0===c)a.Hb=b[0]||a.L,a.ec=b[1]||a.N}function Zb(a,b){b||(b=hc);ec(a,b,void 0);cc(a,b,void 0)} +var hc=[],bc=[F.prototype.ca,F.prototype.ha,F.prototype.ya,F.prototype.Da],dc=[F.prototype.P,F.prototype.ea,F.prototype.qa,F.prototype.Xa];if(qb)var ac=[F.prototype.O,F.prototype.da,F.prototype.ia,F.prototype.za],$b=[F.prototype.X,F.prototype.ga,F.prototype.ra,F.prototype.Ca]; +function ic(a,b){w.call(this,"CPU",a,ic,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.sb=c;this.i.Qb=0;this.i.eb=d;this.i.ac=Math.round(this.i.sb/1E4)/100;this.i.bb=this.i.ac*this.i.eb;this.D.xa=!1;this.D.Xb=!1;this.D.tc=a.autoStart;this.D.vc=!1;this.D.lb=!1;this.i.Bb=this.i.pb=0;this.i.Cb=a.csStart;this.i.ob=a.csInterval;this.i.qb=a.csStop;this.X=this.fb.bind(this);E(this)}Xa(ic);var jc=["power","reset"];m=ic.prototype; +m.Qa=function(a,b,c,d){this.A=a;this.w=b;this.H=d;for(b=0;b=a.i.pb&&(a.i.pb+=a.i.ob,c=!0);0<=a.i.qb&&a.i.qb<=Dc(a)&&(a.i.ob=a.i.qb=-1,mc(a),a.na(),c=!0);c&&a.g(Dc(a)+" cycles: checksum="+n(a.i.Bb))}} +m.ma=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.M[b]=c;a=!0;break;case "run":this.M[b]=c;c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.D.ua)a=!0;else{var b=null,c,g=bb(a.id);for(c=0;cc&&(c=2);var d=1;b&&1a.i.ab/a.i.bb?b=1:d=!0;a.i.eb=b;b=a.i.ac*a.i.eb;if(a.i.bb!=b){a.i.bb=b;b=a.i.bb.toFixed(2)+"Mhz";var e=a.M.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.A&&a.A.gb()}Fc(a,a.F);a.F=0;a.i.nb=na();a.i.cb=0;Gc(a);return d} +m.fb=function(a){if(kb(this,!0)){if(!this.D.xa){Ec(this);this.A&&this.A.start(this.i.nb,Dc(this));this.D.xa=!0;this.D.Xb=!0;this.I&&this.I.start();var b=this.M.run;b&&(b.textContent="Halt");this.A&&(this.A.Ia(!0),a&&this.A.gb(!0))}this.i.dc>=this.i.sb&&Gc(this,!0);this.i.Fb=0;this.i.Pb=na();this.i.cb&&(a=this.i.Pb-this.i.cb,a>this.i.Cc&&(this.i.nb+=a,this.i.nb>this.i.Pb&&(this.i.nb=this.i.Pb)));try{do{this.ub(this.D.lb?1:this.i.Gd);var c=this.B-this.b;this.F+=c;this.i.Fb+=c;Fc(this,0,!0);Cc(this, +c);this.i.Eb-=c;0>=this.i.Eb&&(this.i.Eb+=this.i.Ec,this.A&&Hc(this.A,this.i.Qb++),this.i.Qb>this.L&&(this.i.Qb=0));this.i.Db-=c;0>=this.i.Db&&(this.i.Db+=this.i.Dc,this.A&&this.A.Ia());this.i.rb-=c;if(0>=this.i.rb){this.i.rb+=this.i.cc;break}}while(this.D.xa)}catch(e){this.na();Ac(this);this.A&&this.A.stop(na(),Dc(this));kb(this,!1);nb(this,e.stack||e.message);return}c=setTimeout;a=this.X;this.i.cb=na();b=this.i.Cc;this.i.Fb&&(b=Math.round(b*this.i.Fb/this.i.cc));var b=b-(this.i.cb-this.i.Pb),d= +this.i.cb-this.i.nb;d&&(this.i.ab=Math.round(this.F/(10*d))/100,864E5<=d&&(this.J=0,Ec(this)));if(0>b||this.i.ab>8&255;a.T=b&255}function Rc(a){return a.U<<8|a.V}function Sc(a,b){a.U=b>>8&255;a.V=b&255}function J(a){return a.W<<8|a.Z} +function Tc(a,b){a.W=b>>8&255;a.Z=b&255}function G(a,b){a.R=b&65535}function Uc(a){return a.ba&256?1:0}function Vc(a,b){a.ba=a.ba&255|b}function Wc(a){return rb[a.fa&255]?4:0}function Xc(a){return(a.fa^a.wa)&16?16:0}function Yc(a){return a.ba&255?0:64}function Zc(a){return a.fa&128?128:0}function Oc(a){return a.va&-214|Zc(a)|Yc(a)|Xc(a)|Wc(a)|Uc(a)}function Mc(a,b){a.ba=a.fa=a.wa=0;b&1&&(a.ba|=256);b&4||(a.fa|=1);b&16&&(a.wa|=16);b&64||(a.ba|=255);b&128&&(a.fa^=192);a.va=a.va&-726|b&512|2} +function $c(a,b){a.wa=a.j^b;return a.fa=(a.ba=a.j+b)&255}function ad(a,b){a.wa=a.j^b;return a.fa=(a.ba=a.j+b+(a.ba&256?1:0))&255}function bd(a,b){a.ba=a.fa=a.wa=a.j&b;(a.j|b)&8&&(a.wa^=16);return a.ba}function cd(a,b){a.wa=b^255;b=a.fa=b+255&255;a.ba=a.ba&-256|b;return b}function dd(a,b){a.wa=b;b=a.fa=b+1&255;a.ba=a.ba&-256|b;return b}function ed(a,b){return a.fa=a.ba=a.wa=a.j|b}function L(a,b){b^=255;a.wa=a.j^b;return a.fa=(a.ba=a.j+b+1^256)&255} +function yd(a,b){b^=255;a.wa=a.j^b;return a.fa=(a.ba=a.j+b+(a.ba&256?0:1)^256)&255}function zd(a,b){return a.fa=a.ba=a.wa=a.j^b}m.aa=function(a){return this.w.aa(a)};m.ta=function(a,b){this.w.ta(a,b)};function M(a){var b=a.aa(a.R);G(a,a.R+1);return b}function N(a){var b=a.w.Sa(a.R);G(a,a.R+2);return b}function P(a){var b=a.w.Sa(a.la);a.la=a.la+2&65535;return b}function Q(a,b){a.la=a.la-2&65535;a.w.Ub(a.la,b)}function Ad(a,b){a.u=a.u&-8|b|8} +function S(a,b,c,d){d=d||2;a.M[b]&&(void 0===c&&(nb(a,"Value for "+b+" is invalid"),a.na()),c=!a.D.xa||a.D.vc?n(c,d):"--------".substr(0,d),a.M[b].textContent!=c&&(a.M[b].textContent=c))} +m.Ia=function(a){this.P&&(a||!this.D.xa||this.D.vc)&&(S(this,"A",this.j),S(this,"B",this.S),S(this,"C",this.T),S(this,"BC",Pc(this),4),S(this,"D",this.U),S(this,"E",this.V),S(this,"DE",Rc(this),4),S(this,"H",this.W),S(this,"L",this.Z),S(this,"HL",J(this),4),S(this,"SP",this.la,4),S(this,"PC",this.R,4),a=Oc(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.M.speed)a.textContent= +this.D.xa&&this.i.ab?this.i.ab.toFixed(2)+"Mhz":"Stopped"};m.ub=function(a){this.D.Nb=!0;var b=this.D.wd=this.H&&Bd(this.H),c=a?this.D.Xb?0:1:-1;this.D.Xb=!1;this.B=this.b=a;do{if(this.u){if(a&&this.u&8&&this.va&512){var d=199|(this.u&7)<<3;this.u&=-17;this.u&=-16;this.va&=-513;this.N[d].call(this)}if(this.u&16){this.b=0;break}}if(b){if(Cd(this.H,this.R,c)){this.na();break}c=1}this.N[M(this)].call(this)}while(0>8;Vc(this,a&256);this.b-=4},Dd,function(){var a;Tc(this,a=J(this)+Pc(this));Vc(this,a>>8&256);this.b-=10},function(){this.j=this.aa(Pc(this));this.b-=7},function(){Qc(this,Pc(this)-1);this.b-= +5},function(){this.T=dd(this,this.T);this.b-=5},function(){this.T=cd(this,this.T);this.b-=5},function(){this.T=M(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;Vc(this,a);this.b-=4},Dd,function(){Sc(this,N(this));this.b-=10},function(){this.ta(Rc(this),this.j);this.b-=7},function(){Sc(this,Rc(this)+1);this.b-=5},function(){this.U=dd(this,this.U);this.b-=5},function(){this.U=cd(this,this.U);this.b-=5},function(){this.U=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255| +Uc(this);Vc(this,a&256);this.b-=4},Dd,function(){var a;Tc(this,a=J(this)+Rc(this));Vc(this,a>>8&256);this.b-=10},function(){this.j=this.aa(Rc(this));this.b-=7},function(){Sc(this,Rc(this)-1);this.b-=5},function(){this.V=dd(this,this.V);this.b-=5},function(){this.V=cd(this,this.V);this.b-=5},function(){this.V=M(this);this.b-=7},function(){var a=this.j<<8;this.j=(Uc(this)<<8|this.j)>>1;Vc(this,a&256);this.b-=4},Dd,function(){Tc(this,N(this));this.b-=10},function(){var a=N(this);this.w.Ub(a,J(this)); +this.b-=16},function(){Tc(this,J(this)+1);this.b-=5},function(){this.W=dd(this,this.W);this.b-=5},function(){this.W=cd(this,this.W);this.b-=5},function(){this.W=M(this);this.b-=7},function(){var a=0,b=Uc(this);if(Xc(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=$c(this,a);Vc(this,b?256:0);this.b-=4},Dd,function(){var a;Tc(this,a=J(this)+J(this));Vc(this,a>>8&256);this.b-=10},function(){var a;a=N(this);a=this.w.Sa(a);Tc(this,a);this.b-=16},function(){Tc(this,J(this)-1);this.b-=5},function(){this.Z= +dd(this,this.Z);this.b-=5},function(){this.Z=cd(this,this.Z);this.b-=5},function(){this.Z=M(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},Dd,function(){this.la=N(this)&65535;this.b-=10},function(){this.ta(N(this),this.j);this.b-=13},function(){this.la=this.la+1&65535;this.b-=5},function(){var a=J(this);this.ta(a,dd(this,this.aa(a)));this.b-=10},function(){var a=J(this);this.ta(a,cd(this,this.aa(a)));this.b-=10},function(){this.ta(J(this),M(this));this.b-=10},function(){this.ba|=256;this.b-= +4},Dd,function(){var a;Tc(this,a=J(this)+this.la);Vc(this,a>>8&256);this.b-=10},function(){this.j=this.aa(N(this));this.b-=13},function(){this.la=this.la-1&65535;this.b-=5},function(){this.j=dd(this,this.j);this.b-=5},function(){this.j=cd(this,this.j);this.b-=5},function(){this.j=M(this);this.b-=7},function(){Vc(this,Uc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.S=this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.W; +this.b-=5},function(){this.S=this.Z;this.b-=5},function(){this.S=this.aa(J(this));this.b-=7},function(){this.S=this.j;this.b-=5},function(){this.T=this.S;this.b-=5},function(){this.b-=5},function(){this.T=this.U;this.b-=5},function(){this.T=this.V;this.b-=5},function(){this.T=this.W;this.b-=5},function(){this.T=this.Z;this.b-=5},function(){this.T=this.aa(J(this));this.b-=7},function(){this.T=this.j;this.b-=5},function(){this.U=this.S;this.b-=5},function(){this.U=this.T;this.b-=5},function(){this.b-= +5},function(){this.U=this.V;this.b-=5},function(){this.U=this.W;this.b-=5},function(){this.U=this.Z;this.b-=5},function(){this.U=this.aa(J(this));this.b-=7},function(){this.U=this.j;this.b-=5},function(){this.V=this.S;this.b-=5},function(){this.V=this.T;this.b-=5},function(){this.V=this.U;this.b-=5},function(){this.b-=5},function(){this.V=this.W;this.b-=5},function(){this.V=this.Z;this.b-=5},function(){this.V=this.aa(J(this));this.b-=7},function(){this.V=this.j;this.b-=5},function(){this.W=this.S; +this.b-=5},function(){this.W=this.T;this.b-=5},function(){this.W=this.U;this.b-=5},function(){this.W=this.V;this.b-=5},function(){this.b-=5},function(){this.W=this.Z;this.b-=5},function(){this.W=this.aa(J(this));this.b-=7},function(){this.W=this.j;this.b-=5},function(){this.Z=this.S;this.b-=5},function(){this.Z=this.T;this.b-=5},function(){this.Z=this.U;this.b-=5},function(){this.Z=this.V;this.b-=5},function(){this.Z=this.W;this.b-=5},function(){this.b-=5},function(){this.Z=this.aa(J(this));this.b-= +7},function(){this.Z=this.j;this.b-=5},function(){this.ta(J(this),this.S);this.b-=7},function(){this.ta(J(this),this.T);this.b-=7},function(){this.ta(J(this),this.U);this.b-=7},function(){this.ta(J(this),this.V);this.b-=7},function(){this.ta(J(this),this.W);this.b-=7},function(){this.ta(J(this),this.Z);this.b-=7},function(){var a=this.R-1;if(this.K.length)for(var b=0;b>8;this.b-=10},function(){var a=N(this);Zc(this)||G(this,a);this.b-=10},function(){this.va&=-513;this.b-=4},function(){var a=N(this);Zc(this)||(Q(this,this.R),G(this,a),this.b-=6);this.b-=11},function(){Q(this,Oc(this)&255|this.j<<8);this.b-=11},function(){this.j=ed(this,M(this));this.b-=7},function(){Q(this,this.R);G(this,48);this.b-=11},function(){Zc(this)&&(G(this, +P(this)),this.b-=6);this.b-=5},function(){this.la=J(this)&65535;this.b-=5},function(){var a=N(this);Zc(this)&&G(this,a);this.b-=10},function(){this.va|=512;this.b-=4},function(){var a=N(this);Zc(this)&&(Q(this,this.R),G(this,a),this.b-=6);this.b-=11},Gd,function(){L(this,M(this));this.b-=7},function(){Q(this,this.R);G(this,56);this.b-=11}]; +function T(a){w.call(this,"ChipSet",a,T,32768);var b=a.model;b&&!Hd[b]&&La("Unrecognized ChipSet model: "+b);this.B=Hd[b]||{};a.sound&&(this.ha=null,window&&(this.ha=window.AudioContext||window.webkitAudioContext),this.ha&&new this.ha);E(this)}Xa(T); +var U={Aa:1978.1,rd:{Ba:0,de:1,he:16,oe:32,xe:64,we:128,wb:14},Wa:{Ba:1,Sc:1,ld:2,gd:4,hd:16,jd:32,kd:64,wb:8},sd:{Ba:2,ce:3,Fe:4,ee:8,se:16,te:32,ue:64,fe:128,wb:0},Be:{Ba:3},ze:{Ba:2,pe:7},De:{Ba:3,Ge:1,Ce:2,ve:4,me:8,ge:16,$d:32},Ae:{Ba:4},Ee:{Ba:5,ie:1,je:2,ke:4,le:8,He:16}},V={Aa:100,Ja:{Ba:66,qc:1,mc:2,fd:4,re:8,qe:16,oc:32,nc:64,jc:128},Rc:{Ba:66,INIT:0},Ua:{Ba:194,be:0,ic:16,md:32,pc:48,Wc:0,Xc:32},Kb:{Ba:162,ye:0,Zc:0,Vc:0,Yc:0,Uc:0},Ka:{ne:{Ba:98},Ta:{Pc:0,Oc:1,od:2,td:4,Tc:5,nd:6,pd:7}, +Lb:16383}},Hd={SI1978:U,VT100:V};T.prototype.ma=function(){return!1};T.prototype.Qa=function(a,b,c,d){this.w=b;this.b=c;this.H=d;this.A=a;this.J=tb(a,"Keyboard");this.Na=tb(a,"SerialPort");this.video=tb(a,"Video");Eb(b,this,this.B.Rb);Ib(b,this,this.B.Sb)};T.prototype.Ea=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};T.prototype.Ha=function(a){return a?this.save():!0};U.INIT=[[U.rd.wb,U.Wa.wb,U.sd.wb,0,0,0,0]]; +V.INIT=[[V.Rc.INIT,V.Ja.mc|V.Ja.fd],[V.Ua.Wc,V.Ua.Xc],[V.Kb.Zc,V.Kb.Vc,V.Kb.Yc,V.Kb.Uc],[0,0,0,0,[11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11904,11776,11784,11918,11776,11856,11824,11840,11808,11776,12E3,12E3,11857,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]]; +m=T.prototype;m.reset=function(){this.B.INIT&&!this.restore(this.B.INIT)&&this.ja("reset error")};m.save=function(){var a=new H(this);switch(this.B.Aa){case U.Aa:I(a,0,[this.Ca,this.F,this.Da,this.ca,this.ga,this.ya,this.za]);break;case V.Aa:I(a,0,[this.ia,this.K]),I(a,1,[this.N,this.O]),I(a,2,[this.I,this.da,this.ra,this.qa]),I(a,3,[this.X,this.u,this.P,this.ea,this.L])}return a.data()}; +m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.B.Aa){case U.Aa:return this.Ca=b[0],this.F=b[1],this.Da=b[2],this.ca=b[3],this.ga=b[4],this.ya=b[5],this.za=b[6],!0;case V.Aa:return this.ia=b[0],this.K=b[1],b=a[1],this.N=b[0],this.O=b[1],b=a[2],this.I=b[0],this.da=b[1],this.ra=b[2],this.qa=b[3],b=a[3],this.X=b[0],this.u=b[1],this.P=b[2],this.ea=b[3],this.L=b[4],!0}return!1};m.start=function(){};m.stop=function(){};m.Ad=function(a,b){var c=this.Ca;D(this,a,null,b,"STATUS0",c,!0);return c}; +m.Bd=function(a,b){var c=this.F;D(this,a,null,b,"STATUS1",c,!0);return c};m.Cd=function(a,b){var c=this.Da;D(this,a,null,b,"STATUS2",c,!0);return c};m.zd=function(a,b){var c=this.ca>>8-this.ga&255;D(this,a,null,b,"SHIFT.RESULT",c,!0);return c};m.Kd=function(a,b,c){D(this,a,b,c,"SHIFT.COUNT",null,!0);this.ga=b};m.Md=function(a,b,c){D(this,a,b,c,"SOUND1",null,!0);this.ya=b};m.Ld=function(a,b,c){D(this,a,b,c,"SHIFT.DATA",null,!0);this.ca=b<<8|this.ca>>8}; +m.Nd=function(a,b,c){D(this,a,b,c,"SOUND2",null,!0);this.za=b};m.Od=function(a,b,c){D(this,a,b,c,"WATCHDOG",null,!0)};function Id(a){var b=0,c=0,d=~a.X;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.Dd=function(a,b){var c=this.K,c=c&~V.Ja.nc;if((Dc(this.b)&64)<<1&&(c|=V.Ja.nc,c!=this.K)){var d,e;d=this.P&1;e=this.P>>1&7;switch(e){case V.Ka.Ta.pd:break;case V.Ka.Ta.Oc:this.X=this.X<<1|d;break;case V.Ka.Ta.Tc:d=Id(this);this.L[d]=V.Ka.Lb;ib(this,"doNVRCommand(): erase data at addr "+t(d));break;case V.Ka.Ta.Pc:this.u=this.u<<1|d;break;case V.Ka.Ta.td:d=Id(this);e=this.u&V.Ka.Lb;this.L[d]=e;ib(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case V.Ka.Ta.nd:d=Id(this);e=this.L[d]; +null==e&&(e=V.Ka.Lb);this.u=e;ib(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case V.Ka.Ta.od:this.u<<=1;this.ea=this.u&V.Ka.Lb+1;break;default:ib(this,"doNVRCommand(): unrecognized command 0x"+n(e,2))}}c&=~V.Ja.oc;this.ea&&(c|=V.Ja.oc);c&=~V.Ja.jc;this.J&&this.J.$b()&&(c|=V.Ja.jc);c&=~V.Ja.qc;this.Na&&this.Na.$b()&&(c|=V.Ja.qc);this.K=c;D(this,a,null,b,"FLAGS",c);return c};m.Pd=function(a,b,c){D(this,a,b,c,"BRIGHTNESS");this.ia=b}; +m.Sd=function(a,b,c){D(this,a,b,c,"NVR.LATCH");this.P=b};m.Rd=function(a,b,c){D(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.I=this.I&-4|a;break;case 1:this.I=this.I&-13|a<<2;this.video&&(b=this.video,a=this.I,ib(b,"updateScrollOffset("+a+")"),b.hb!==a&&(b.hb=a,Jd(b,-1)));break;case 2:switch(a){case 0:this.da=~this.da;break;case 2:case 3:this.ra=3-a}break;case 3:this.qa=a}}; +m.Qd=function(a,b,c){D(this,a,b,c,"DC011");b&V.Ua.md?(b&=V.Ua.pc,this.O!=b&&(this.O=b,this.video&&(a=this.video,b=this.O==V.Ua.pc?50:60,ib(a,"updateRate("+b+")"),a.Zb=b))):(b&=V.Ua.ic,this.N!=b&&(this.N=b,this.video&&(a=this.N==V.Ua.ic?132:80,b=this.video,ib(b,"updateDimensions("+a+","+(80>>0,h],p=ma(q,k,a.Ya);0>p&&q.splice(-(p+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.J.push({Ie:b,G:c,Fd:d,Ra:e,rc:f})}delete this.Ra}return!0};Md.prototype.Ha=function(){return!0}; +function Nd(a,b,c,d){if(d)a.ja("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.Yb,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,h=e.data;if(f)a.A=f;else if(h)for(a.A=Array(4*h.length),d=c=0;c>8&255,a.A[d++]=h[c]>>16&255,a.A[d++]=h[c]>>24&255;else a.A=e;a.Ra=e.symbols;if(!a.A.length){v("Empty ROM: "+b);return}if(1==a.A.length){v(a.A[0]);return}}catch(g){a.ja("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, +" ").replace(/ +$/,"").split(" "),a.A=Array(b.length),e=0;e>>f.pa;0>>=f.pa;0d?a.u.push({ec:b,ac:Date.now(),Mb:!1}):(a.u[d].ac=Date.now(),a.u[d].Mb=!1);else if(0<=d){if(!a.u[d].Mb){var e=a.u[d].ac;if(e&&100>Date.now()-e)return a.u[d].Mb=!0,Yd(a),!0}a.u.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=U.Wa.fd;break;case "2p":d=U.Wa.kd;break;case "coin":d=U.Wa.Rc;break;case "left":d=U.Wa.hd;break;case "right":d=U.Wa.jd;break;case "fire":d=U.Wa.gd}d&&(a=a.I,b=d,a.F&=~b,c&&(a.F|=b))}return!0} -function Yd(a){for(var b=0,c=-1;bc||c>e)c=e}else{Wd(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Yd(a)},c)}m.Zb=function(){return!0};m.Dd=function(a,b){var c=this.F;0<=this.B&&(this.B>3)*a.da,!wb(a.w,a.ya,a.Z,3)))return!1;a.Z?(a.Gc=a.I.createImageData(b,c),a.Jc=16/a.Za|0,de(a,a.Z>>1)):de(a,(a.ea+1)*a.ha);a.N=document.createElement("canvas");a.N.width=b;a.N.height=c;a.hb=a.N.getContext("2d");a.va={};a.Da=1<=a.xc?8:16,f=8>(7d?a.u.push({fc:b,bc:Date.now(),Mb:!1}):(a.u[d].bc=Date.now(),a.u[d].Mb=!1);else if(0<=d){if(!a.u[d].Mb){var e=a.u[d].bc;if(e&&100>Date.now()-e)return a.u[d].Mb=!0,Zd(a),!0}a.u.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=U.Wa.gd;break;case "2p":d=U.Wa.ld;break;case "coin":d=U.Wa.Sc;break;case "left":d=U.Wa.jd;break;case "right":d=U.Wa.kd;break;case "fire":d=U.Wa.hd}d&&(a=a.I,b=d,a.F&=~b,c&&(a.F|=b))}return!0} +function Zd(a){for(var b=0,c=-1;bc||c>e)c=e}else{Xd(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Zd(a)},c)}m.$b=function(){return!0};m.Ed=function(a,b){var c=this.F;0<=this.B&&(this.B>3)*a.da,!xb(a.w,a.ya,a.X,3)))return!1;a.X?(a.Hc=a.I.createImageData(b,c),a.Kc=16/a.$a|0,ee(a,a.X>>1)):ee(a,(a.ea+1)*a.ha);a.N=document.createElement("canvas");a.N.width=b;a.N.height=c;a.ib=a.N.getContext("2d");a.qa={};a.Da=1<=a.yc?8:16,f=8>(7>4)*c)}return k} -Zd.prototype.Ea=function(){if(2==this.ga){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.Yb?2:5);f>8&15|16;Bb(this.w,b++,e);Bb(this.w,b++, -c&255);if(g)break}if(h)for(c=0,e=1;ec&&(a=Math.round(c/b*100)+"%")}this.Fc?(this.O.style.width=a,this.O.style.width=a,this.O.style.display="block",this.O.style.margin="auto"):(this.u.style.width=a,this.u.style.height="auto");this.u.style.backgroundColor="black";this.u.ib();a=!0}this.Ca&&this.Ca.focus()}return a}; -function be(a,b){!b&&a.u&&(a.Fc?a.O.style.width=a.O.style.height="":a.u.style.width=a.u.style.height="");hb(a,"notifyFullScreen("+b+")")}function de(a,b){a.Ic=b;a.za=!1;if(void 0===a.K||a.K.length!=a.Ic)a.K=Array(a.Ic)}function fe(a,b,c,d,e){d=a.B?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.ga&&(208<=c&&236>c?e=a.Da+0:28<=c&&72>c&&(e=a.Da+1));a=a.wa[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 ge(a,b){for(var c=a.ya,d=-1,e=0,f=60==a.Yb?2:5,h=0,g=0;e>=1);;){var r=zb(a.w,l++);if(127==(r&127)){var u=zb(a.w,l++),d=u&96,c=(u&15)<<8|zb(a.w,l),c=c+(u&16?8192:16384);break}if(k>4)*r.ka,K=void 0,C=void 0,R=void 0, -ia=void 0,ca=r.oa,ja=r.ka;x?(K=p*u.oa,C=e*u.ka,R=u.oa,ia=u.ka):(K=p*u.yc,C=e*u.zc,R=u.yc,ia=u.zc);r.oa>u.oa&&(K*=2,R*=2);r.ka>u.ka&&(0==q&&(z+=u.ka),ja=u.ka);x?x.drawImage(r.canvas,A,z,ca,ja,K,C,R,ia):(K+=0,C+=0,u.I.drawImage(r.canvas,A,z,ca,ja,K,C,R,ia))}g++}h++}e++}}a.za=!0;(g||b)&&a.hb&&a.I.drawImage(a.N,0,a.gb,a.L,a.da-a.ka,0,0,a.Td,a.Ud)} -function Id(a,b){var c=!0,d=!0;if(0<=b){d=!1;a.zb&&(120==a.zb?b&1?(zd(a.b,2),c=!1):zd(a.b,1):zd(a.b,4));var e;if(e=c&&a.za&&a.Z){e=a.w;for(var f=a.Z,h=!0,g=a.ya>>>e.pa;0>8|(x&255)<<8);k>z&u;fe(a,a.Gc,k++,l,K);z+=r}k>q&&(q=k);l=e&&(e=l+1)}f+=2;g++;if(k>=a.L&&(k=0,l++,l>a.da))break}a.za=!0;c>8&15|16;Cb(this.w,b++,e);Cb(this.w,b++, +c&255);if(g)break}if(h)for(c=0,e=1;ec&&(a=Math.round(c/b*100)+"%")}this.Gc?(this.O.style.width=a,this.O.style.width=a,this.O.style.display="block",this.O.style.margin="auto"):(this.u.style.width=a,this.u.style.height="auto");this.u.style.backgroundColor="black";this.u.jb();a=!0}this.Ca&&this.Ca.focus()}return a}; +function ce(a,b){!b&&a.u&&(a.Gc?a.O.style.width=a.O.style.height="":a.u.style.width=a.u.style.height="");ib(a,"notifyFullScreen("+b+")")}function ee(a,b){a.Jc=b;a.za=!1;if(void 0===a.K||a.K.length!=a.Jc)a.K=Array(a.Jc)}function ge(a,b,c,d,e){d=a.B?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.ga&&(208<=c&&236>c?e=a.Da+0:28<=c&&72>c&&(e=a.Da+1));a=a.ra[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 he(a,b){for(var c=a.ya,d=-1,e=0,f=60==a.Zb?2:5,h=0,g=0;e>=1);;){var r=Ab(a.w,l++);if(127==(r&127)){var u=Ab(a.w,l++),d=u&96,c=(u&15)<<8|Ab(a.w,l),c=c+(u&16?8192:16384);break}if(k>4)*r.ka,K=void 0,C=void 0,R=void 0, +ia=void 0,ca=r.oa,ja=r.ka;x?(K=p*u.oa,C=e*u.ka,R=u.oa,ia=u.ka):(K=p*u.zc,C=e*u.Ac,R=u.zc,ia=u.Ac);r.oa>u.oa&&(K*=2,R*=2);r.ka>u.ka&&(0==q&&(z+=u.ka),ja=u.ka);x?x.drawImage(r.canvas,A,z,ca,ja,K,C,R,ia):(K+=0,C+=0,u.I.drawImage(r.canvas,A,z,ca,ja,K,C,R,ia))}g++}h++}e++}}a.za=!0;(g||b)&&a.ib&&a.I.drawImage(a.N,0,a.hb,a.L,a.da-a.ka,0,0,a.Ud,a.Vd)} +function Jd(a,b){var c=!0,d=!0;if(0<=b){d=!1;a.Ab&&(120==a.Ab?b&1?(Ad(a.b,2),c=!1):Ad(a.b,1):Ad(a.b,4));var e;if(e=c&&a.za&&a.X){e=a.w;for(var f=a.X,h=!0,g=a.ya>>>e.pa;0>8|(x&255)<<8);k>z&u;ge(a,a.Hc,k++,l,K);z+=r}k>q&&(q=k);l=e&&(e=l+1)}f+=2;g++;if(k>=a.L&&(k=0,l++,l>a.da))break}a.za=!0;cMissing <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<=sa().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height= -(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Sa.aspect);f&&.3<=f&&3.33>=f&&(Ia("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");ya("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Zd(d,e,h,f,c);fb(d,c)}}); -function he(a){this.da=+a.adapter;switch(this.da){case 0:this.ea=0;this.ia=2;break;default:v("Unrecognized serial adapter #"+this.da);return}this.B=this.F=null;this.ga=a.tabSize;this.ca=a.charBOL;this.J=0;w.call(this,"SerialPort",a,he,8388608);a=a.binding;"console"==a?this.F="":db(this,a);this.ha=function(a){return function(){ie(a)}}(this)}Za(he);var je=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],ke=[!1,0,0,133,142,39,238],eb="buffer";m=he.prototype; -m.ma=function(a,b,c,d){var e=this;switch(b){case eb:return this.M[b]=this.B=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>2)+6;a.K&16&&c++;c+=((a.K&192)>>6)+1>>1;setTimeout(a.ha,1E3/Math.round(b/c))}}m.Zb=function(){return!!(this.u&1)}; -m.xd=function(a,b){var c=this.P;D(this,a,null,b,"DATA",c);this.u&=-3;return c};m.wd=function(a,b){var c=this.u;D(this,a,null,b,"STATUS",c);return c}; -m.Id=function(a,b,c){D(this,a,b,c,"DATA");this.Z=b;this.u&=-6;if(this.B)13==b?this.J=0:8==b?(this.B.value=this.B.value.slice(0,-1),0=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");ya("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new $d(d,e,h,f,c);gb(d,c)}}); +function ie(a){this.ga=+a.adapter;switch(this.ga){case 0:this.ha=0;this.ra=2;break;default:v("Unrecognized serial adapter #"+this.ga);return}this.B=this.F=null;this.ia=a.tabSize;this.ea=a.charBOL;this.J=0;w.call(this,"SerialPort",a,ie,8388608);a=a.binding;"console"==a?this.F="":eb(this,a);this.qa=function(a){return function(){je(a)}}(this);this.N=this.ca=null;this.exports={receiveByte:this.Tb}}Xa(ie); +var ke=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],le=[!1,0,0,133,142,39,238],fb="buffer";m=ie.prototype; +m.ma=function(a,b,c,d){var e=this;switch(b){case fb:return this.M[b]=this.B=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>2)+6;a.K&16&&c++;c+=((a.K&192)>>6)+1>>1;setTimeout(a.qa,1E3/Math.round(b/c))}}m.$b=function(){return!!(this.u&1)};m.yd=function(a,b){var c=this.X;D(this,a,null,b,"DATA",c);this.u&=-3;return c};m.xd=function(a,b){var c=this.u;D(this,a,null,b,"STATUS",c);return c}; +m.Jd=function(a,b,c){D(this,a,b,c,"DATA");this.da=b;this.u&=-6;a=!1;this.ca&&this.ca.call(this.N,b)&&(a=!0);if(this.B)13==b?this.J=0:8==b?(this.B.value=this.B.value.slice(0,-1),0>>d.w.pa;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var q=b[g];q.type==c?l++||d.g("..."):(c=q.type,l=yb[c],q&&d.g(n(q.id)+" %"+n(g<>>e.pa;f!=e.w?e.X[h].fc(f,b&65535,d):(e.X[h++].Ib(f,b&255,d),e.X[h&e.K].Ib(0,b>>8&255,d+1));c&&De(a,c);nc(this.b,!0)}};function X(a){return{G:a,Pa:!1}}function Ee(a){return[a.G,a.Pa]}function Fe(a){return{G:a[0],Pa:a[1]}} -function Ce(a,b,c){var d;c=(c?a.O:a.Za).G;if(void 0!==b){d=b=Ge(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c>>d.w.pa;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var q=b[g];q.type==c?l++||d.g("..."):(c=q.type,l=zb[c],q&&d.g(n(q.id)+" %"+n(g<>>e.pa;f!=e.w?e.Y[h].gc(f,b&65535,d):(e.Y[h++].Jb(f,b&255,d),e.Y[h&e.K].Jb(0,b>>8&255,d+1));c&&De(a,c);Ac(this.b,!0)}};function X(a){return{G:a,Pa:!1}}function Ee(a){return[a.G,a.Pa]}function Fe(a){return{G:a[0],Pa:a[1]}} +function Ce(a,b,c){var d;c=(c?a.O:a.$a).G;if(void 0!==b){d=b=Ge(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=pa(xe,a.substr(b,1))));return c}function Me(a,b){var c=0,d=Ne(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?n(d,c):"??"} -function Ne(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.S;break;case 1:c=d.T;break;case 8:c=Oc(d);break;case 2:c=d.U;break;case 3:c=d.V;break;case 9:c=Qc(d);break;case 4:c=d.W;break;case 5:c=d.Y;break;case 10:c=J(d);break;case 6:c=d.aa(J(d));break;case 11:c=d.la;break;case 12:c=d.R;break;case 13:c=Nc(d);break;case 14:c=Nc(d)&255|d.j<<8}}return c} +function Ne(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.S;break;case 1:c=d.T;break;case 8:c=Pc(d);break;case 2:c=d.U;break;case 3:c=d.V;break;case 9:c=Rc(d);break;case 4:c=d.W;break;case 5:c=d.Z;break;case 10:c=J(d);break;case 6:c=d.aa(J(d));break;case 11:c=d.la;break;case 12:c=d.R;break;case 13:c=Oc(d);break;case 14:c=Oc(d)&255|d.j<<8}}return c} function Oe(a,b){b=Ge(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Le(b,c+1),0<=e&&(b=b.substr(0,c)+Me(a,e)+b.substr(c+1+xe[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=Ce(a,e))?(d=e+' "'+Ke(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=Ce(a,e))?(De(d),d=e+' "'+ -Ke(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}m.message=function(a,b){b&&(a+=" at "+Y(X(this.b.R).G));if(this.qa&1073741824)this.ya.push(a);else if(!this.wa||a!=this.wa)if(this.wa=a,this.qa&-2147483648&&(this.na(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.qb=0;c.B-=c.b;c.b=0;nc(c)}}; -function gb(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.qa&g)!=g||a.message(b.Lb+"."+(null!=d?"outPort":"inPort")+"("+t(c)+","+(f?f:"unknown")+(null!=d?",0x"+n(d,2):"")+")"+(null!=h?": 0x"+n(h,2):"")+(null!=e?" at "+Y(e):""))} -function se(a){var b;if(Ad(a)){if(!a.N||!a.N.length){a.N=Array(1E3);for(b=0;b>>d.pa],!1)}a.P=["br"];if(void 0!==a.F)for(b=1;b>>d.pa],!0);a.F=["bw"];a.gb=0}m.Ya=function(a,b,c){var d=!0;c||rf(this,a,b,!1,!0);if(a!=this.u){var e=Be(b);if(-1===e)this.g("invalid address: "+Y(b.G)),d=!1;else{var f=this.w;f.X[e>>>f.pa].Ya(e&f.w,a==this.F)}}d&&(a.push(b),c?b.Pa=!0:(sf(this,a,a.length-1,"set"),se(this)));return d}; -function rf(a,b,c,d,e){var f=!1;c=Be(c);for(var h=1;h>>d.pa],b==a.F));g.Pa||se(a);break}}return f}function tf(a,b){for(var c=1;c>24,4);break;case 3:A=n(u.Sa(z,2),4);break;default:u="imm("+t(x)+")";break a}8086==u.style&&x&64?A="["+A+"]":x&16||(A=(u.style==qe?"$":"0x")+A);u=A}else x& -16?(u=(p&3840)>>8,x=xe[u],8086==a.style&&p&64&&(6==u&&(x="HL"),x="["+x+"]"),u=x):x&128&&(u=(f>>3&7).toString());if(!u||!u.length){g="INVALID";break}0>>d.pa],!1)}a.P=["br"];if(void 0!==a.F)for(b=1;b>>d.pa],!0);a.F=["bw"];a.hb=0}m.Za=function(a,b,c){var d=!0;c||rf(this,a,b,!1,!0);if(a!=this.u){var e=Be(b);if(-1===e)this.g("invalid address: "+Y(b.G)),d=!1;else{var f=this.w;f.Y[e>>>f.pa].Za(e&f.w,a==this.F)}}d&&(a.push(b),c?b.Pa=!0:(sf(this,a,a.length-1,"set"),se(this)));return d}; +function rf(a,b,c,d,e){var f=!1;c=Be(c);for(var h=1;h>>d.pa],b==a.F));g.Pa||se(a);break}}return f}function tf(a,b){for(var c=1;c>24,4);break;case 3:A=n(u.Sa(z,2),4);break;default:u="imm("+t(x)+")";break a}8086==u.style&&x&64?A="["+A+"]":x&16||(A=(u.style==qe?"$":"0x")+A);u=A}else x& +16?(u=(p&3840)>>8,x=xe[u],8086==a.style&&p&64&&(6==u&&(x="HL"),x="["+x+"]"),u=x):x&128&&(u=(f>>3&7).toString());if(!u||!u.length){g="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; function Af(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 He(a,b,c){var d;if(b){b=Ge(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=q+"b"+h;d>>=8}d="0x"+n(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Df(a,b){if(b)return Cf(a,b,a.ga[b]);var c=0;for(b in a.ga)Cf(a,b,a.ga[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Ed;if(e>=h&&e>=1;h=q+"b"+h;d>>=8}d="0x"+n(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function Df(a,b){if(b)return Cf(a,b,a.ga[b]);var c=0;for(b in a.ga)Cf(a,b,a.ga[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Fd;if(e>=h&&e>8&255;case "C":d.T=g&255;break;case "D":d.U= -g&255;break;case "DE":d.U=g>>8&255;case "E":d.V=g&255;break;case "H":d.W=g&255;break;case "HL":d.W=g>>8&255;case "L":d.Y=g&255;break;case "SP":d.la=g&65535;break;case "PC":G(d,g);a.O=X(d.R);break;case "PS":Lc(d,g);break;case "PSW":Lc(d,g&255|d.ta&-256);d.j=g>>8;break;case "CF":d.ba=g?d.ba|256:d.ba&255;break;case "PF":g?Vc(d)||(d.fa^=1):Vc(d)&&(d.fa^=1);break;case "AF":d.ua=g?~d.fa&16|d.ua&-17:d.fa&16|d.ua&-17;break;case "ZF":d.ba=g?d.ba&-256:d.ba|255;break;case "SF":g?Yc(d)||(d.fa^=192):Yc(d)&&(d.fa^= -192);break;case "IF":d.ta=g?d.ta|512:d.ta&-513;break;default:a.g("unknown register: "+e);return}if(!h){a.g("invalid value: "+f);return}nc(d);a.g("updated registers:")}a.g(yf(a));c&&(a.O=X(d.R),Re(a,Y(a.O.G)))}}function Kf(a,b){b=la(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Oe(a,c[2])):He(a,b,!0)}function Lf(a,b,c){var d="t"!=b;c=Bf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);za(c,function(){return jb(a,!0)&&a.tb(e,d,!1)},function(){nc(a.b);jb(a,!1)})} -function Re(a,b,c,d){if(b=Ce(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=Ce(a,c,!0);if(!d||d.Gg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=vf(a,b,h,f);a.g(f);a.O=b;e-=b.G-k;c++}}} +g&255;break;case "DE":d.U=g>>8&255;case "E":d.V=g&255;break;case "H":d.W=g&255;break;case "HL":d.W=g>>8&255;case "L":d.Z=g&255;break;case "SP":d.la=g&65535;break;case "PC":G(d,g);a.O=X(d.R);break;case "PS":Mc(d,g);break;case "PSW":Mc(d,g&255|d.va&-256);d.j=g>>8;break;case "CF":d.ba=g?d.ba|256:d.ba&255;break;case "PF":g?Wc(d)||(d.fa^=1):Wc(d)&&(d.fa^=1);break;case "AF":d.wa=g?~d.fa&16|d.wa&-17:d.fa&16|d.wa&-17;break;case "ZF":d.ba=g?d.ba&-256:d.ba|255;break;case "SF":g?Zc(d)||(d.fa^=192):Zc(d)&&(d.fa^= +192);break;case "IF":d.va=g?d.va|512:d.va&-513;break;default:a.g("unknown register: "+e);return}if(!h){a.g("invalid value: "+f);return}Ac(d);a.g("updated registers:")}a.g(yf(a));c&&(a.O=X(d.R),Re(a,Y(a.O.G)))}}function Kf(a,b){b=la(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Oe(a,c[2])):He(a,b,!0)}function Lf(a,b,c){var d="t"!=b;c=Bf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);za(c,function(){return kb(a,!0)&&a.ub(e,d,!1)},function(){Ac(a.b);kb(a,!1)})} +function Re(a,b,c,d){if(b=Ce(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=Ce(a,c,!0);if(!d||d.Gg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=vf(a,b,h,f);a.g(f);a.O=b;e-=b.G-k;c++}}} function Je(a,b,c,d){if(c)if(b){0>a.I&&a.B.length&&(a.I=0);if(0>a.I||b!=a.B[a.I])a.B.splice(0,0,b),a.I=0;a.I--}else a.ea?b="end":b=a.B[a.I+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(la(b.substring(c,f))),c=f+1}}return a} -function uf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.ea&&(a.g("ended assemble at "+Y(a.da.G)),a.O=a.da,a.ea=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.wa=null;if(lb(a)&&0l||"z"Fa.length&&(a.g("note: only "+Fa.length+" available"),fa=Fa.length);Z-=fa;0>Z&&(null==Fa[Fa.length-1].G?(fa=Z+fa,Z=0):Z+=Fa.length);var id= -[];"call"==Xe&&(nb=1E5,id=["CALL"]);for(void 0!==We&&a.g(fa+" instructions earlier:");0=Fa.length&&(Z=0);a.hb=fa;Ze++;nb--}}Ze||(a.g("no "+Ye+"history available"),a.hb=void 0)}else{var oc=Ce(a,ca);if(oc){var pc=0;ja&&("l"==ja.charAt(0)&&(ja=ja.substr(1)||fg),pc=Bf(a,ja)>>>0,65536>4||1;hg--&&0tc?String.fromCharCode(tc):".";rc--}Xa&&(Xa+="\n");Xa+=ca+" "+Mb+(0==Lb?" "+kd:"")}Xa&&a.g(Xa);a.Za=oc}}}}break;case "e":if("else"==f[0])break;var uc=1,bf=255,cf=a.aa,df=a.ra;"ew"==f[0]&&(uc=2,bf=65535,cf=a.Sa,df=a.Tb);var ef=uc<<1,ff=f[1];if(null==ff)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 vc=Ce(a,ff);if(vc)for(var wc=2;wcrd;){for(var Ya=null,ng=256;65536>Pb.G>>>0;){hf.G= -a.Sa(Pb,2);if(null==Pb.G||!ng--)break;for(var og=a,yc=hf,jf=null,Qb=yc.G,kf=Qb,sd=1;6>=sd&&Qb;sd++){if(2> "+b):(a.ea&&(a.g("ended assemble at "+Y(a.da.G)),a.O=a.da,a.ea=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ra=null;if(mb(a)&&0l||"z"Fa.length&&(a.g("note: only "+Fa.length+" available"),fa=Fa.length);Z-=fa;0>Z&&(null==Fa[Fa.length-1].G?(fa=Z+fa,Z=0):Z+=Fa.length);var hd= +[];"call"==Xe&&(pb=1E5,hd=["CALL"]);for(void 0!==We&&a.g(fa+" instructions earlier:");0=Fa.length&&(Z=0);a.ib=fa;Ze++;pb--}}Ze||(a.g("no "+Ye+"history available"),a.ib=void 0)}else{var oc=Ce(a,ca);if(oc){var pc=0;ja&&("l"==ja.charAt(0)&&(ja=ja.substr(1)||fg),pc=Bf(a,ja)>>>0,65536>4||1;hg--&&0tc?String.fromCharCode(tc):".";rc--}Ya&&(Ya+="\n");Ya+=ca+" "+Mb+(0==Lb?" "+jd:"")}Ya&&a.g(Ya);a.$a=oc}}}}break;case "e":if("else"==f[0])break;var uc=1,bf=255,cf=a.aa,df=a.ta;"ew"==f[0]&&(uc=2,bf=65535,cf=a.Sa,df=a.Ub);var ef=uc<<1,ff=f[1];if(null==ff)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 vc=Ce(a,ff);if(vc)for(var wc=2;wcqd;){for(var Za=null,ng=256;65536>Pb.G>>>0;){hf.G= +a.Sa(Pb,2);if(null==Pb.G||!ng--)break;for(var og=a,yc=hf,jf=null,Qb=yc.G,kf=Qb,rd=1;6>=rd&&Qb;rd++){if(2\nLicense: GPL version 3 or later ");for(b=0;b\nLicense: GPL version 3 or later ");for(b=0;bVf){if(Rf(d,this.O)){this.F=new H(this,"1.23.3","failsafe");Rf(this.F)&&($f(this,d),a=2,Of(this.F));I(this.F,"timestamp",oa());Pf(this.F);var e=this.A&&!this.K;if(1==a||ta("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Qf(d)){var f=Sf(d,"code"),h=Sf(d,"data");f&&("ok"==f?Rf(d,h):("error"==f&& -"no machine state"!=h?(this.ja("Error: "+h),"unable to verify user"==h&&(xa("user",""),this.u=null)):this.g(f+": "+h),Of(d),Rf(d)?(c=Qf(d),e=!0):c=!1))}e&&Zf(this,c?d:null)}else 2==a&&d.clear()}else Zf(this);delete this.O;delete this.P}e=bb(this.id);for(f=0;fa[1];a=a[2];this.ia=!0;this.D.sa=!0;var d=this.M.power;d&&(d.textContent="Shutdown");this.b&&(ag(this,this.b,b,c,a),Ac(this.b));this.da&&($f(this,b),b.clear());!c&&this.F&&(this.F.clear(),delete this.F);this.B=0}; +m.Gb=function(a){void 0===a&&(a=this.A||(this.O?1:Vf));if(!this.B){this.B++;var b=!1,c=!1;this.da=!1;var d=this.P||new H(this,"1.23.3");if(-1==a)b=!0;else if(a>Vf){if(Rf(d,this.O)){this.F=new H(this,"1.23.3","failsafe");Rf(this.F)&&($f(this,d),a=2,Of(this.F));I(this.F,"timestamp",oa());Pf(this.F);var e=this.A&&!this.K;if(1==a||ta("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Qf(d)){var f=Sf(d,"code"),h=Sf(d,"data");f&&("ok"==f?Rf(d,h):("error"==f&& +"no machine state"!=h?(this.ja("Error: "+h),"unable to verify user"==h&&(xa("user",""),this.u=null)):this.g(f+": "+h),Of(d),Rf(d)?(c=Qf(d),e=!0):c=!1))}e&&Zf(this,c?d:null)}else 2==a&&d.clear()}else Zf(this);delete this.O;delete this.P}e=bb(this.id);for(f=0;fa[1];a=a[2];this.ia=!0;this.D.ua=!0;var d=this.M.power;d&&(d.textContent="Shutdown");this.b&&(ag(this,this.b,b,c,a),Bc(this.b));this.da&&($f(this,b),b.clear());!c&&this.F&&(this.F.clear(),delete this.F);this.B=0}; function $f(a,b){if(ta("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.u||"",d=b.toString(),e={app:"PC8080",ver:"1.23.3"};e.url=a.ha;e.user=c;e.type="bug";e.data=d;qa("http://www.pcjs.org/api/v1/report",e,!0)}} -function Mf(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new H(a,"1.23.3"),h=new H(a,"1.23.3","validate"),g=oa();I(h,"timestamp",g);I(f,"timestamp",g);I(f,"version","1.23.3");I(f,"url",window?window.location.href:null);I(f,"browser",sa());a.b&&a.b.Ia&&(c&&a.b.na(),d=a.b.Ia(b,c),"object"===typeof d&&I(f,a.b.id,d),c&&(a.b.D.sa=!1,!1===d&&(e=null)));for(var g=bb(a.id),k=0;kg.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+"...");qa(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,q=/( [a-z]+=)(['"])(.*?)\2/g;l=q.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]*/, @@ -243,4 +244,4 @@ function wg(a,b,c,d){if(!c&&b){d.push(b);a=$a[d[0]];b=null;for(var e in a)if(ea( function xg(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 q=g[l],p=da(l);if("xml"==p){for(p=/[ \t]*]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=p.exec(g[l]);){var r=d[2];r&&(g[r]||(q=q.replace(d[0],"")))}d=l=ba(l)}else"xsl"==p&&(e=l=ba(l));k[l]=q}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=ya("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+='