From 762ef22545721405a88875894c4aed16a3312d1a Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Mon, 15 Aug 2016 14:19:06 -0700 Subject: [PATCH] Added TEST control to exercise the VT100's 8251A UART (um, excuse me, the PUSART -- an awful acronym) --- .../pc8080/machine/vt100/debugger/machine.xml | 4 +- modules/pc8080/lib/serialport.js | 286 +++++++++---- modules/pcx86/lib/keyboard.js | 4 +- versions/pc8080/1.23.3/pc8080-dbg.js | 391 +++++++++--------- versions/pc8080/1.23.3/pc8080.js | 241 +++++------ 5 files changed, 533 insertions(+), 393 deletions(-) diff --git a/devices/pc8080/machine/vt100/debugger/machine.xml b/devices/pc8080/machine/vt100/debugger/machine.xml index 274cc208b..1230b8774 100644 --- a/devices/pc8080/machine/vt100/debugger/machine.xml +++ b/devices/pc8080/machine/vt100/debugger/machine.xml @@ -27,7 +27,9 @@ SET-UP - + + TEST + diff --git a/modules/pc8080/lib/serialport.js b/modules/pc8080/lib/serialport.js index 8ab191cb7..6741b8407 100644 --- a/modules/pc8080/lib/serialport.js +++ b/modules/pc8080/lib/serialport.js @@ -136,6 +136,90 @@ function SerialPort(parmsSerial) { Component.subclass(SerialPort); +SerialPort.UART8251 = { + /* + * Format of MODE byte written to CONTROL port 0x1 + */ + MODE: { + BAUD_FACTOR: 0x03, // 00=SYNC, 01=1x, 10=16x, 11=64x + DATA_BITS: 0x0C, // 00=5, 01=6, 10=7, 11=8 + PARITY_ENABLE: 0x10, + EVEN_PARITY: 0x20, + STOP_BITS: 0xC0, // 00=invalid, 01=1, 10=1.5, 11=2 + INIT: 0x8E // 16x baudrate, 8 data bits, no parity, 1.5 stop bits + }, + /* + * Format of COMMAND byte written to CONTROL port 0x1 + */ + COMMAND: { + XMIT_ENABLE: 0x01, + DTR: 0x02, // Data Terminal Ready + RECV_ENABLE: 0x04, + SEND_BREAK: 0x08, + ERROR_RESET: 0x10, + RTS: 0x20, // Request To Send + INTERNAL_RESET: 0x40, + HUNT_MODE: 0x80, + INIT: 0x27 // XMIT_ENABLE | DTR | RECV_ENABLE | RTS + }, + /* + * Format of STATUS byte read from CONTROL port 0x1 + */ + STATUS: { + XMIT_READY: 0x01, + RECV_FULL: 0x02, + XMIT_EMPTY: 0x04, + PARITY_ERROR: 0x08, + OVERRUN_ERROR: 0x10, + FRAMING_ERROR: 0x20, + BREAK_DETECT: 0x40, + DSR: 0x80, // Data Set Ready + INIT: 0x85 // XMIT_READY | XMIT_EMPTY | DSR + }, + /* + * Format of BAUDRATE byte written to port 0x2 + * + * Each nibble is an index (0x0-0xF) into a set internal CPU clock divisors that yield the following baud rates: + * + * Index Divisor Baud Rate + * ----- ------- --------- + * 0x0 3456 50 + * 0x1 2304 75 + * 0x2 1571 110 + * 0x3 1285 134.5 + * 0x4 1152 150 + * 0x5 864 200 + * 0x6 576 300 + * 0x7 288 600 + * 0x8 144 1200 + * 0x9 96 1800 + * 0xA 86 2000 + * 0xB 72 2400 + * 0xC 48 3600 + * 0xD 36 4800 + * 0xE 18 9600 (default) + * 0xF 9 19200 + * + * TODO: I'm not really sure at this point which nibble is for the XMIT rate and which is for the RECV + * rate; I just made a random guess. + */ + BAUDRATE: { + XMIT_RATE: 0x0F, + RECV_RATE: 0xF0, + INIT: 0xEE // default to 9600 (0xE) for both XMIT and RECV + } +}; + +SerialPort.UART8251.INIT = [ + false, + 0, + 0, + SerialPort.UART8251.STATUS.INIT, + SerialPort.UART8251.MODE.INIT, + SerialPort.UART8251.COMMAND.INIT, + SerialPort.UART8251.BAUDRATE.INIT +]; + /* * Internal name used for the I/O buffer control, if any, that we bind to the SerialPort. * @@ -188,7 +272,7 @@ SerialPort.prototype.setBinding = function(sHTMLType, sBinding, control, sValue) if (keyCode === 0x08 || event.ctrlKey && keyCode >= 0x41 && keyCode <= 0x5A) { if (event.preventDefault) event.preventDefault(); if (keyCode > 0x40) keyCode -= 0x40; - // serial.sendRBR([keyCode]); + serial.sendByte(keyCode); } return true; }; @@ -218,10 +302,22 @@ SerialPort.prototype.setBinding = function(sHTMLType, sBinding, control, sValue) * so that the soft keyboard will activate, but it shouldn't hurt to remove the attribute for all browsers. */ control.removeAttribute("readonly"); - return true; default: + if (sValue) { + /* + * Instead of just having a dedicated "test" control, we now treat any unrecognized control with + * a "value" attribute as a test control. The only caveat is that such controls must have binding IDs + * that do not conflict with predefined controls (which, of course, is the only way you can get here). + */ + this.bindings[sBinding] = control; + control.onclick = function onClickTest(event) { + serial.sendByte(sValue.charCodeAt(0)); + return true; + }; + return true; + } break; } return false; @@ -330,11 +426,15 @@ SerialPort.prototype.initState = function(data) { var i = 0; if (data === undefined) { - data = [0, 0, 0]; + data = SerialPort.UART8251.INIT; } - this.bData = data[i++]; - this.bCommand = data[i++]; - this.bBaudRate = data[i++]; + this.fReady = data[i++]; + this.bDataIn = data[i++]; + this.bDataOut = data[i++]; + this.bStatus = data[i++]; + this.bMode = data[i++]; + this.bCommand = data[i++]; + this.bBaudRate = data[i]; return true; }; @@ -348,82 +448,32 @@ SerialPort.prototype.saveRegisters = function() { var i = 0; var data = []; - data[i++] = this.bData; + data[i++] = this.fReady; + data[i++] = this.bDataIn; + data[i++] = this.bDataOut; + data[i++] = this.bStatus; + data[i++] = this.bMode; data[i++] = this.bCommand; - data[i++] = this.bBaudRate; + data[i] = this.bBaudRate; return data; }; /** - * inData(port, addrFrom) + * sendByte(b) * * @this {SerialPort} - * @param {number} port (0x0) - * @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port) - * @return {number} simulated port value + * @param {number} b + * @return {boolean} */ -SerialPort.prototype.inData = function(port, addrFrom) +SerialPort.prototype.sendByte = function(b) { - var b = this.bData; - this.printMessageIO(port, null, addrFrom, "DATA", b); - return b; -}; - -/** - * inCommand(port, addrFrom) - * - * @this {SerialPort} - * @param {number} port (0x1) - * @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port) - * @return {number} simulated port value - */ -SerialPort.prototype.inCommand = function(port, addrFrom) -{ - var b = this.bCommand; - this.printMessageIO(port, null, addrFrom, "COMMAND", b); - return b; -}; - -/** - * outData(port, bOut, addrFrom) - * - * @this {SerialPort} - * @param {number} port (0x0) - * @param {number} bOut - * @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port) - */ -SerialPort.prototype.outData = function(port, bOut, addrFrom) -{ - this.printMessageIO(port, bOut, addrFrom, "DATA"); - this.bData = bOut; -}; - -/** - * outCommand(port, bOut, addrFrom) - * - * @this {SerialPort} - * @param {number} port (0x1) - * @param {number} bOut - * @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port) - */ -SerialPort.prototype.outCommand = function(port, bOut, addrFrom) -{ - this.printMessageIO(port, bOut, addrFrom, "COMMAND"); - this.bCommand = bOut; -}; - -/** - * outBaudRate(port, bOut, addrFrom) - * - * @this {SerialPort} - * @param {number} port (0x2) - * @param {number} bOut - * @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port) - */ -SerialPort.prototype.outBaudRate = function(port, bOut, addrFrom) -{ - this.printMessageIO(port, bOut, addrFrom, "BAUDRATE"); - this.bBaudRate = bOut; + if (!(this.bStatus & SerialPort.UART8251.STATUS.RECV_FULL)) { + this.bDataIn = b; + this.bStatus |= SerialPort.UART8251.STATUS.RECV_FULL; + this.cpu.requestINTR(this.nIRQ); + return true; + } + return false; }; /** @@ -474,12 +524,98 @@ SerialPort.prototype.echoByte = function(b) return false; }; +/** + * inData(port, addrFrom) + * + * @this {SerialPort} + * @param {number} port (0x0) + * @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port) + * @return {number} simulated port value + */ +SerialPort.prototype.inData = function(port, addrFrom) +{ + var b = this.bDataIn; + this.printMessageIO(port, null, addrFrom, "DATA", b); + this.bStatus &= ~SerialPort.UART8251.STATUS.RECV_FULL; + return b; +}; + +/** + * inControl(port, addrFrom) + * + * @this {SerialPort} + * @param {number} port (0x1) + * @param {number} [addrFrom] (not defined whenever the Debugger tries to read the specified port) + * @return {number} simulated port value + */ +SerialPort.prototype.inControl = function(port, addrFrom) +{ + var b = this.bStatus; + this.printMessageIO(port, null, addrFrom, "STATUS", b); + return b; +}; + +/** + * outData(port, bOut, addrFrom) + * + * @this {SerialPort} + * @param {number} port (0x0) + * @param {number} bOut + * @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port) + */ +SerialPort.prototype.outData = function(port, bOut, addrFrom) +{ + this.printMessageIO(port, bOut, addrFrom, "DATA"); + this.bDataOut = bOut; +}; + +/** + * outControl(port, bOut, addrFrom) + * + * Writes to the CONTROL port (0x1) are either MODE or COMMAND bytes. If the device has just + * been powered or reset, it is in a "not ready" state and is waiting for a MODE byte. Once it + * has received that initial byte, the device is marked "ready", and all further bytes are + * interpreted as COMMAND bytes (until/unless a COMMAND byte with the INTERNAL_RESET bit is set). + * + * @this {SerialPort} + * @param {number} port (0x1) + * @param {number} bOut + * @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port) + */ +SerialPort.prototype.outControl = function(port, bOut, addrFrom) +{ + this.printMessageIO(port, bOut, addrFrom, "CONTROL"); + if (!this.fReady) { + this.bMode = bOut; + this.fReady = true; + } else { + this.bCommand = bOut; + if (this.bCommand & SerialPort.UART8251.COMMAND.INTERNAL_RESET) { + this.fReady = false; + } + } +}; + +/** + * outBaudRate(port, bOut, addrFrom) + * + * @this {SerialPort} + * @param {number} port (0x2) + * @param {number} bOut + * @param {number} [addrFrom] (not defined whenever the Debugger tries to write the specified port) + */ +SerialPort.prototype.outBaudRate = function(port, bOut, addrFrom) +{ + this.printMessageIO(port, bOut, addrFrom, "BAUDRATE"); + this.bBaudRate = bOut; +}; + /* * Port input notification table */ SerialPort.aPortInput = { 0x0: SerialPort.prototype.inData, - 0x1: SerialPort.prototype.inCommand + 0x1: SerialPort.prototype.inControl }; @@ -488,7 +624,7 @@ SerialPort.aPortInput = { */ SerialPort.aPortOutput = { 0x0: SerialPort.prototype.outData, - 0x1: SerialPort.prototype.outCommand, + 0x1: SerialPort.prototype.outControl, 0x2: SerialPort.prototype.outBaudRate }; diff --git a/modules/pcx86/lib/keyboard.js b/modules/pcx86/lib/keyboard.js index c28b1a5c6..3f5fcba46 100644 --- a/modules/pcx86/lib/keyboard.js +++ b/modules/pcx86/lib/keyboard.js @@ -1254,8 +1254,8 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue) else if (sValue) { /* * Instead of just having a dedicated "test" control, we now treat any unrecognized control with - * a data value as a test control. The only caveat is that such controls must have binding IDs that - * do not conflict with predefined controls (which, of course, is the only way you can get here). + * a "value" attribute as a test control. The only caveat is that such controls must have binding IDs + * that do not conflict with predefined controls (which, of course, is the only way you can get here). */ this.bindings[id] = control; control.onclick = function onClickTest(event) { diff --git a/versions/pc8080/1.23.3/pc8080-dbg.js b/versions/pc8080/1.23.3/pc8080-dbg.js index 346627f6d..3ba0d0c72 100644 --- a/versions/pc8080/1.23.3/pc8080-dbg.js +++ b/versions/pc8080/1.23.3/pc8080-dbg.js @@ -7,237 +7,238 @@ function oa(a,b,c,d){var e=0,f=null,h=null;if("object"==typeof resources&&(f=res typeof b){var k="",l;for(l in b)b.hasOwnProperty(l)&&(k&&(k+="&"),k+=l+"="+encodeURIComponent(b[l]));k=k.replace(/%20/g,"+");g.open("POST",a,!!c);g.setRequestHeader("Content-type","application/x-www-form-urlencoded");g.send(k)}else g.open("GET",a,!!c),"bytes"==b&&g.overrideMimeType("text/plain; charset=x-user-defined"),g.send();c||(f=g.responseText,200!=g.status&&(e=g.status||-1),d&&d(a,f,e),h=[f,e]);return h}function pa(){return"http://"+(window?window.location.host:"www.pcjs.org")} function qa(){return window?window.navigator.userAgent:""}function u(a){window&&window.alert(a)}function ra(a){var b=!1;window&&(b=window.confirm(a));return b}var sa=null;function ta(){if(null==sa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}sa=a}return sa} function ua(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function va(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function wa(a){if(window){var b=qa();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 xa(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.Ga=1<>2;this.w=this.Ga-1;this.M=this.O/this.Ga|0;this.K=this.M-1;this.A=[];this.u=[];this.I=this.G=!1;this.Y=[];this.aa=[];a=new E;tb(a,this.H);this.W=Array(this.M);for(b=0;b>>a.na;0f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.F)return g.Ib+=g.F-e,g.F=e,!0;if(e>=g.F+g.Ib){l=g.size-(e-k);l>f&&(l=f);g.Ib=e-g.F+l;e=k+a.Ga;f-=l;h++;continue}}return vb(1,e,f)}e=new E(e,l,a.Ga,d);tb(e,a.H,g);a.W[h++]=e;e=k+a.Ga;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+wb[d]+" at "+t(b)),!0):vb(2,b,c)}m.Z=function(a){return this.W[(a&this.C)>>>this.na].sb(a&this.w,a)}; -function xb(a,b){return a.W[(b&a.C)>>>a.na].Hb(b&a.w,b)}m.Qa=function(a){var b=a&this.w,c=(a&this.C)>>>this.na;return b!=this.w?this.W[c].Gc(b,a):this.W[c++].sb(b,a)|this.W[c&this.K].sb(0,a+1)<<8};function yb(a,b){var c=b&a.w,d=(b&a.C)>>>a.na;return c!=a.w?a.W[d].bc(c,b):a.W[d++].Hb(c,b)|a.W[d&a.K].Hb(0,b+1)<<8}m.ra=function(a,b){this.W[(a&this.C)>>>this.na].vb(a&this.w,b&255,a)};function zb(a,b,c){a.W[(b&a.C)>>>a.na].Jb(b&a.w,c&255,b)} -m.Tb=function(a,b){var c=a&this.w,d=(a&this.C)>>>this.na;c!=this.w?this.W[d].Ic(c,b&65535,a):(this.W[d++].vb(c,b&255,a),this.W[d&this.K].vb(0,b>>8&255,a+1))};function Ab(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 Bb(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]?u("Input port "+t(k)+" already registered"):f.A[k]=[g,!1]}} +function sb(a,b,c){x.call(this,"Bus",a,sb);this.b=b;this.H=c;this.J=a.busWidth||16;this.N=Math.pow(2,this.J);this.C=this.N-1|0;this.pa=16>=this.J?10:20>=this.J?12:24>=this.J?14:15;this.Ga=1<>2;this.w=this.Ga-1;this.M=this.N/this.Ga|0;this.K=this.M-1;this.A=[];this.u=[];this.I=this.G=!1;this.Y=[];this.aa=[];a=new E;tb(a,this.H);this.W=Array(this.M);for(b=0;b>>a.pa;0f&&(l=f);if(g&&g.size){if(g.type==d){if(e+f<=g.F)return g.Hb+=g.F-e,g.F=e,!0;if(e>=g.F+g.Hb){l=g.size-(e-k);l>f&&(l=f);g.Hb=e-g.F+l;e=k+a.Ga;f-=l;h++;continue}}return vb(1,e,f)}e=new E(e,l,a.Ga,d);tb(e,a.H,g);a.W[h++]=e;e=k+a.Ga;f-=l}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+wb[d]+" at "+t(b)),!0):vb(2,b,c)}m.Z=function(a){return this.W[(a&this.C)>>>this.pa].rb(a&this.w,a)}; +function xb(a,b){return a.W[(b&a.C)>>>a.pa].Gb(b&a.w,b)}m.Sa=function(a){var b=a&this.w,c=(a&this.C)>>>this.pa;return b!=this.w?this.W[c].Hc(b,a):this.W[c++].rb(b,a)|this.W[c&this.K].rb(0,a+1)<<8};function yb(a,b){var c=b&a.w,d=(b&a.C)>>>a.pa;return c!=a.w?a.W[d].bc(c,b):a.W[d++].Gb(c,b)|a.W[d&a.K].Gb(0,b+1)<<8}m.ra=function(a,b){this.W[(a&this.C)>>>this.pa].ub(a&this.w,b&255,a)};function zb(a,b,c){a.W[(b&a.C)>>>a.pa].Ib(b&a.w,c&255,b)} +m.Tb=function(a,b){var c=a&this.w,d=(a&this.C)>>>this.pa;c!=this.w?this.W[d].Jc(c,b&65535,a):(this.W[d++].ub(c,b&255,a),this.W[d&this.K].ub(0,b>>8&255,a+1))};function Ab(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 Bb(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]?u("Input port "+t(k)+" already registered"):f.A[k]=[g,!1]}} function Cb(a,b,c){for(var d=1,e=0,f=0;0>>=f)&k;if(void 0!==h){if(h[0])h[0](b,k,d);a.H&&a.G!=h[1]&&Hb(a.H,b,k)}else a.H&&(eb(a.H,a,b,k,d),a.G&&Hb(a.H,b,k));f+=g<<3;b+=g;e-=g}} function vb(a,b,c){u("Memory block error ("+a+": "+n(b)+","+n(c)+")");return!1}var Ib;if(nb){var Jb=new ArrayBuffer(2);(new DataView(Jb)).setUint16(0,256,!0);Ib=256===(new Uint16Array(Jb))[0]}else Ib=!1;var Sb=Ib; -function E(a,b,c,d){this.id=Tb+=2;this.b=null;this.F=a;this.Ib=b;this.size=c||0;this.type=d||Ub;this.L=d==Vb;tb(this);this.La=this.qc=!1;if(c)if(nb)this.I=new ArrayBuffer(c),this.G=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),Wb(this,Sb?Xb:Yb);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},da:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ia: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.La=!0},Y:function(a,b){if(this.H&&null!=this.F){var c=this.H;cc(c,this.F+a,1,c.Y)&&c.ma(!0)}return this.Hb(a,b)},fa:function(a,b){if(this.H&&null!=this.F){var c=this.H;cc(c,this.F+a,2,c.Y)&&c.ma(!0)}return this.bc(a,b)},va:function(a,b,c){if(this.H&&null!=this.F){var d=this.H;cc(d,this.F+a,1,d.G)&&d.ma(!0)}this.L?this.C(a,b,c):this.Jb(a,b,c)},Ca:function(a, -b,c){if(this.H&&null!=this.F){var d=this.H;cc(d,this.F+a,2,d.G)&&d.ma(!0)}this.L?this.C(a,b,c):this.dc(a,b,c)},P:function(a){return this.w[a]},aa:function(a){return this.w[a]},ea:function(a){return this.G.getUint16(a,!0)},ga:function(a){return a&1?this.w[a]|this.w[a+1]<<8:this.K[a>>1]},oa:function(a,b){this.w[a]=b;this.La=!0},wa:function(a,b){this.w[a]=b;this.La=!0},za:function(a,b){this.G.setUint16(a,b,!0);this.La=!0},Da:function(a,b){a&1?(this.w[a]=b,this.w[a+1]=b>>8):this.K[a>>1]=b;this.La=!0}}; -function tb(a,b,c){a.H=b;a.A=a.u=0;c&&((a.A=c.A)&&bc(a,ac,!1),(a.u=c.u)&&$b(a,ac,!1))}function dc(a,b){b?0===--a.u&&(a.vb=a.L?a.C:a.Jb,a.Ic=a.L?a.J:a.dc):0===--a.A&&(a.sb=a.Hb,a.Gc=a.bc)}function $b(a,b,c){c&&a.u||(a.vb=!a.L&&b[2]||a.C,a.Ic=!a.L&&b[3]||a.J);if(c||void 0===c)a.Jb=b[2]||a.C,a.dc=b[3]||a.J}function bc(a,b,c){c&&a.A||(a.sb=b[0]||a.M,a.Gc=b[1]||a.O);if(c||void 0===c)a.Hb=b[0]||a.M,a.bc=b[1]||a.O}function Wb(a,b){b||(b=ec);bc(a,b,void 0);$b(a,b,void 0)} -var ec=[],Zb=[E.prototype.da,E.prototype.ia,E.prototype.ya,E.prototype.cb],ac=[E.prototype.Y,E.prototype.fa,E.prototype.va,E.prototype.Ca];if(nb)var Yb=[E.prototype.P,E.prototype.ea,E.prototype.oa,E.prototype.za],Xb=[E.prototype.aa,E.prototype.ga,E.prototype.wa,E.prototype.Da]; -function fc(a,b){x.call(this,"CPU",a,fc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.rb=c;this.i.Qb=0;this.i.ab=d;this.i.Yb=Math.round(this.i.rb/1E4)/100;this.i.Za=this.i.Yb*this.i.ab;this.D.xa=!1;this.D.Xb=!1;this.D.pc=a.autoStart;this.D.rc=!1;this.D.jb=!1;this.i.Bb=this.i.ob=0;this.i.Cb=a.csStart;this.i.nb=a.csInterval;this.i.pb=a.csStop;this.aa=this.bb.bind(this);D(this)}Za(fc);var gc=["power","reset"];m=fc.prototype; -m.Na=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<=Ac(a)&&(a.i.nb=a.i.pb=-1,jc(a),a.ma(),c=!0);c&&a.g(Ac(a)+" cycles: checksum="+n(a.i.Bb))}} -m.la=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.L[b]=c;a=!0;break;case "run":this.L[b]=c;c.onclick=function(){var a;if(a=d.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.Ya/a.i.Za?b=1:d=!0;a.i.ab=b;b=a.i.Yb*a.i.ab;if(a.i.Za!=b){a.i.Za=b;b=a.i.Za.toFixed(2)+"Mhz";var e=a.L.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.A&&a.A.ub()}Cc(a,a.G);a.G=0;a.i.mb=la();a.i.$a=0;Dc(a);return d} -m.bb=function(a){if(hb(this,!0)){if(!this.D.xa){Bc(this);this.A&&this.A.start(this.i.mb,Ac(this));this.D.xa=!0;this.D.Xb=!0;this.I&&this.I.start();var b=this.L.run;b&&(b.textContent="Halt");this.A&&(this.A.Ia(!0),a&&this.A.ub(!0))}this.i.ac>=this.i.rb&&Dc(this,!0);this.i.Fb=0;this.i.Pb=la();this.i.$a&&(a=this.i.Pb-this.i.$a,a>this.i.zc&&(this.i.mb+=a,this.i.mb>this.i.Pb&&(this.i.mb=this.i.Pb)));try{do{this.tb(this.D.jb?1:this.i.Bd);var c=this.C-this.b;this.G+=c;this.i.Fb+=c;Cc(this,0,!0);nc(this, -c);this.i.Eb-=c;0>=this.i.Eb&&(this.i.Eb+=this.i.Bc,this.A&&Ec(this.A,this.i.Qb++),this.i.Qb>this.M&&(this.i.Qb=0));this.i.Db-=c;0>=this.i.Db&&(this.i.Db+=this.i.Ac,this.A&&this.A.Ia());this.i.qb-=c;if(0>=this.i.qb){this.i.qb+=this.i.$b;break}}while(this.D.xa)}catch(e){this.ma();lc(this);this.A&&this.A.stop(la(),Ac(this));hb(this,!1);kb(this,e.stack||e.message);return}c=setTimeout;a=this.aa;this.i.$a=la();b=this.i.zc;this.i.Fb&&(b=Math.round(b*this.i.Fb/this.i.$b));var b=b-(this.i.$a-this.i.Pb),d= -this.i.$a-this.i.mb;d&&(this.i.Ya=Math.round(this.G/(10*d))/100,864E5<=d&&(this.J=0,Bc(this)));if(0>b||this.i.Ya>1),this.b=new Int32Array(this.I,0,c>>2),Wb(this,Sb?Xb:Yb);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)},da: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.Ma=!0},Y:function(a,b){if(this.H&&null!=this.F){var c=this.H;cc(c,this.F+a,1,c.Y)&&c.ma(!0)}return this.Gb(a,b)},fa:function(a,b){if(this.H&&null!=this.F){var c=this.H;cc(c,this.F+a,2,c.Y)&&c.ma(!0)}return this.bc(a,b)},va:function(a,b,c){if(this.H&&null!=this.F){var d=this.H;cc(d,this.F+a,1,d.G)&&d.ma(!0)}this.L?this.C(a,b,c):this.Ib(a,b,c)},Ca:function(a, +b,c){if(this.H&&null!=this.F){var d=this.H;cc(d,this.F+a,2,d.G)&&d.ma(!0)}this.L?this.C(a,b,c):this.dc(a,b,c)},O:function(a){return this.w[a]},aa:function(a){return this.w[a]},ea:function(a){return this.G.getUint16(a,!0)},ga:function(a){return a&1?this.w[a]|this.w[a+1]<<8:this.K[a>>1]},na:function(a,b){this.w[a]=b;this.Ma=!0},wa:function(a,b){this.w[a]=b;this.Ma=!0},za:function(a,b){this.G.setUint16(a,b,!0);this.Ma=!0},Da:function(a,b){a&1?(this.w[a]=b,this.w[a+1]=b>>8):this.K[a>>1]=b;this.Ma=!0}}; +function tb(a,b,c){a.H=b;a.A=a.u=0;c&&((a.A=c.A)&&bc(a,ac,!1),(a.u=c.u)&&$b(a,ac,!1))}function dc(a,b){b?0===--a.u&&(a.ub=a.L?a.C:a.Ib,a.Jc=a.L?a.J:a.dc):0===--a.A&&(a.rb=a.Gb,a.Hc=a.bc)}function $b(a,b,c){c&&a.u||(a.ub=!a.L&&b[2]||a.C,a.Jc=!a.L&&b[3]||a.J);if(c||void 0===c)a.Ib=b[2]||a.C,a.dc=b[3]||a.J}function bc(a,b,c){c&&a.A||(a.rb=b[0]||a.M,a.Hc=b[1]||a.N);if(c||void 0===c)a.Gb=b[0]||a.M,a.bc=b[1]||a.N}function Wb(a,b){b||(b=ec);bc(a,b,void 0);$b(a,b,void 0)} +var ec=[],Zb=[E.prototype.da,E.prototype.ha,E.prototype.ya,E.prototype.Qa],ac=[E.prototype.Y,E.prototype.fa,E.prototype.va,E.prototype.Ca];if(nb)var Yb=[E.prototype.O,E.prototype.ea,E.prototype.na,E.prototype.za],Xb=[E.prototype.aa,E.prototype.ga,E.prototype.wa,E.prototype.Da]; +function fc(a,b){x.call(this,"CPU",a,fc,1);var c=a.cycles||b,d=a.multiplier||1;this.i={};this.i.qb=c;this.i.Qb=0;this.i.cb=d;this.i.Yb=Math.round(this.i.qb/1E4)/100;this.i.ab=this.i.Yb*this.i.cb;this.D.xa=!1;this.D.Xb=!1;this.D.pc=a.autoStart;this.D.rc=!1;this.D.jb=!1;this.i.Ab=this.i.nb=0;this.i.Bb=a.csStart;this.i.mb=a.csInterval;this.i.ob=a.csStop;this.aa=this.eb.bind(this);D(this)}Za(fc);var gc=["power","reset"];m=fc.prototype; +m.Oa=function(a,b,c,d){this.A=a;this.w=b;this.H=d;for(b=0;b=a.i.nb&&(a.i.nb+=a.i.mb,c=!0);0<=a.i.ob&&a.i.ob<=Ac(a)&&(a.i.mb=a.i.ob=-1,jc(a),a.ma(),c=!0);c&&a.g(Ac(a)+" cycles: checksum="+n(a.i.Ab))}} +m.la=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.L[b]=c;a=!0;break;case "run":this.L[b]=c;c.onclick=function(){var a;if(a=d.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.Yb*a.i.cb;if(a.i.ab!=b){a.i.ab=b;b=a.i.ab.toFixed(2)+"Mhz";var e=a.L.setSpeed;e&&(e.textContent=b);a.g("target speed: "+b)}c&&a.A&&a.A.tb()}Cc(a,a.G);a.G=0;a.i.lb=la();a.i.bb=0;Dc(a);return d} +m.eb=function(a){if(hb(this,!0)){if(!this.D.xa){Bc(this);this.A&&this.A.start(this.i.lb,Ac(this));this.D.xa=!0;this.D.Xb=!0;this.I&&this.I.start();var b=this.L.run;b&&(b.textContent="Halt");this.A&&(this.A.Ia(!0),a&&this.A.tb(!0))}this.i.ac>=this.i.qb&&Dc(this,!0);this.i.Eb=0;this.i.Pb=la();this.i.bb&&(a=this.i.Pb-this.i.bb,a>this.i.zc&&(this.i.lb+=a,this.i.lb>this.i.Pb&&(this.i.lb=this.i.Pb)));try{do{this.sb(this.D.jb?1:this.i.Cd);var c=this.C-this.b;this.G+=c;this.i.Eb+=c;Cc(this,0,!0);nc(this, +c);this.i.Db-=c;0>=this.i.Db&&(this.i.Db+=this.i.Bc,this.A&&Ec(this.A,this.i.Qb++),this.i.Qb>this.M&&(this.i.Qb=0));this.i.Cb-=c;0>=this.i.Cb&&(this.i.Cb+=this.i.Ac,this.A&&this.A.Ia());this.i.pb-=c;if(0>=this.i.pb){this.i.pb+=this.i.$b;break}}while(this.D.xa)}catch(e){this.ma();lc(this);this.A&&this.A.stop(la(),Ac(this));hb(this,!1);kb(this,e.stack||e.message);return}c=setTimeout;a=this.aa;this.i.bb=la();b=this.i.zc;this.i.Eb&&(b=Math.round(b*this.i.Eb/this.i.$b));var b=b-(this.i.bb-this.i.Pb),d= +this.i.bb-this.i.lb;d&&(this.i.$a=Math.round(this.G/(10*d))/100,864E5<=d&&(this.J=0,Bc(this)));if(0>b||this.i.$a>8&255;a.S=b&255}function Oc(a){return a.T<<8|a.U}function Pc(a,b){a.T=b>>8&255;a.U=b&255}function K(a){return a.V<<8|a.X} -function Qc(a,b){a.V=b>>8&255;a.X=b&255}function F(a,b){a.N=b&65535}function Rc(a){return a.ba&256?1:0}function Sc(a,b){a.ba=a.ba&255|b}function Tc(a){return ob[a.ca&255]?4:0}function Uc(a){return(a.ca^a.ua)&16?16:0}function Vc(a){return a.ba&255?0:64}function Wc(a){return a.ca&128?128:0}function Lc(a){return a.ta&-214|Wc(a)|Vc(a)|Uc(a)|Tc(a)|Rc(a)}function Jc(a,b){a.ba=a.ca=a.ua=0;b&1&&(a.ba|=256);b&4||(a.ca|=1);b&16&&(a.ua|=16);b&64||(a.ba|=255);b&128&&(a.ca^=192);a.ta=a.ta&-726|b&512|2} +function Qc(a,b){a.V=b>>8&255;a.X=b&255}function F(a,b){a.P=b&65535}function Rc(a){return a.ba&256?1:0}function Sc(a,b){a.ba=a.ba&255|b}function Tc(a){return ob[a.ca&255]?4:0}function Uc(a){return(a.ca^a.ua)&16?16:0}function Vc(a){return a.ba&255?0:64}function Wc(a){return a.ca&128?128:0}function Lc(a){return a.ta&-214|Wc(a)|Vc(a)|Uc(a)|Tc(a)|Rc(a)}function Jc(a,b){a.ba=a.ca=a.ua=0;b&1&&(a.ba|=256);b&4||(a.ca|=1);b&16&&(a.ua|=16);b&64||(a.ba|=255);b&128&&(a.ca^=192);a.ta=a.ta&-726|b&512|2} function Xc(a,b){a.ua=a.j^b;return a.ca=(a.ba=a.j+b)&255}function Yc(a,b){a.ua=a.j^b;return a.ca=(a.ba=a.j+b+(a.ba&256?1:0))&255}function Zc(a,b){a.ba=a.ca=a.ua=a.j&b;(a.j|b)&8&&(a.ua^=16);return a.ba}function $c(a,b){a.ua=b^255;b=a.ca=b+255&255;a.ba=a.ba&-256|b;return b}function ad(a,b){a.ua=b;b=a.ca=b+1&255;a.ba=a.ba&-256|b;return b}function bd(a,b){return a.ca=a.ba=a.ua=a.j|b}function L(a,b){b^=255;a.ua=a.j^b;return a.ca=(a.ba=a.j+b+1^256)&255} -function cd(a,b){b^=255;a.ua=a.j^b;return a.ca=(a.ba=a.j+b+(a.ba&256?0:1)^256)&255}function dd(a,b){return a.ca=a.ba=a.ua=a.j^b}m.Z=function(a){return this.w.Z(a)};m.ra=function(a,b){this.w.ra(a,b)};function M(a){var b=a.Z(a.N);F(a,a.N+1);return b}function N(a){var b=a.w.Qa(a.N);F(a,a.N+2);return b}function P(a){var b=a.w.Qa(a.ka);a.ka=a.ka+2&65535;return b}function Q(a,b){a.ka=a.ka-2&65535;a.w.Tb(a.ka,b)}function ed(a,b){a.u=a.u&-8|b|8} +function cd(a,b){b^=255;a.ua=a.j^b;return a.ca=(a.ba=a.j+b+(a.ba&256?0:1)^256)&255}function dd(a,b){return a.ca=a.ba=a.ua=a.j^b}m.Z=function(a){return this.w.Z(a)};m.ra=function(a,b){this.w.ra(a,b)};function M(a){var b=a.Z(a.P);F(a,a.P+1);return b}function N(a){var b=a.w.Sa(a.P);F(a,a.P+2);return b}function P(a){var b=a.w.Sa(a.ka);a.ka=a.ka+2&65535;return b}function Q(a,b){a.ka=a.ka-2&65535;a.w.Tb(a.ka,b)}function ed(a,b){a.u=a.u&-8|b|8} function S(a,b,c,d){d=d||2;a.L[b]&&(void 0===c&&(kb(a,"Value for "+b+" is invalid"),a.ma()),c=!a.D.xa||a.D.rc?n(c,d):"--------".substr(0,d),a.L[b].textContent!=c&&(a.L[b].textContent=c))} -m.Ia=function(a){this.Y&&(a||!this.D.xa||this.D.rc)&&(S(this,"A",this.j),S(this,"B",this.R),S(this,"C",this.S),S(this,"BC",Mc(this),4),S(this,"D",this.T),S(this,"E",this.U),S(this,"DE",Oc(this),4),S(this,"H",this.V),S(this,"L",this.X),S(this,"HL",K(this),4),S(this,"SP",this.ka,4),S(this,"PC",this.N,4),a=Lc(this),S(this,"PS",a,4),S(this,"IF",a&512?1:0,1),S(this,"SF",a&128?1:0,1),S(this,"ZF",a&64?1:0,1),S(this,"AF",a&16?1:0,1),S(this,"PF",a&4?1:0,1),S(this,"CF",a&1?1:0,1));if(a=this.L.speed)a.textContent= -this.D.xa&&this.i.Ya?this.i.Ya.toFixed(2)+"Mhz":"Stopped"};m.tb=function(a){this.D.Nb=!0;var b=this.D.rd=this.H&&yd(this.H),c=a?this.D.Xb?0:1:-1;this.D.Xb=!1;this.C=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.O[d].call(this)}if(this.u&16){this.b=0;break}}if(b){if(zd(this.H,this.N,c)){this.ma();break}c=1}this.O[M(this)].call(this)}while(0>8;Sc(this,a&256);this.b-=4},Ad,function(){var a;Qc(this,a=K(this)+Mc(this));Sc(this,a>>8&256);this.b-=10},function(){this.j=this.Z(Mc(this));this.b-=7},function(){Nc(this,Mc(this)-1);this.b-= 5},function(){this.S=ad(this,this.S);this.b-=5},function(){this.S=$c(this,this.S);this.b-=5},function(){this.S=M(this);this.b-=7},function(){var a=this.j<<8&256;this.j=(a|this.j)>>1;Sc(this,a);this.b-=4},Ad,function(){Pc(this,N(this));this.b-=10},function(){this.ra(Oc(this),this.j);this.b-=7},function(){Pc(this,Oc(this)+1);this.b-=5},function(){this.T=ad(this,this.T);this.b-=5},function(){this.T=$c(this,this.T);this.b-=5},function(){this.T=M(this);this.b-=7},function(){var a=this.j<<1;this.j=a&255| Rc(this);Sc(this,a&256);this.b-=4},Ad,function(){var a;Qc(this,a=K(this)+Oc(this));Sc(this,a>>8&256);this.b-=10},function(){this.j=this.Z(Oc(this));this.b-=7},function(){Pc(this,Oc(this)-1);this.b-=5},function(){this.U=ad(this,this.U);this.b-=5},function(){this.U=$c(this,this.U);this.b-=5},function(){this.U=M(this);this.b-=7},function(){var a=this.j<<8;this.j=(Rc(this)<<8|this.j)>>1;Sc(this,a&256);this.b-=4},Ad,function(){Qc(this,N(this));this.b-=10},function(){var a=N(this);this.w.Tb(a,K(this)); -this.b-=16},function(){Qc(this,K(this)+1);this.b-=5},function(){this.V=ad(this,this.V);this.b-=5},function(){this.V=$c(this,this.V);this.b-=5},function(){this.V=M(this);this.b-=7},function(){var a=0,b=Rc(this);if(Uc(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=Xc(this,a);Sc(this,b?256:0);this.b-=4},Ad,function(){var a;Qc(this,a=K(this)+K(this));Sc(this,a>>8&256);this.b-=10},function(){var a;a=N(this);a=this.w.Qa(a);Qc(this,a);this.b-=16},function(){Qc(this,K(this)-1);this.b-=5},function(){this.X= +this.b-=16},function(){Qc(this,K(this)+1);this.b-=5},function(){this.V=ad(this,this.V);this.b-=5},function(){this.V=$c(this,this.V);this.b-=5},function(){this.V=M(this);this.b-=7},function(){var a=0,b=Rc(this);if(Uc(this)||9<(this.j&15))a|=6;if(b||154<=this.j)a|=96,b=1;this.j=Xc(this,a);Sc(this,b?256:0);this.b-=4},Ad,function(){var a;Qc(this,a=K(this)+K(this));Sc(this,a>>8&256);this.b-=10},function(){var a;a=N(this);a=this.w.Sa(a);Qc(this,a);this.b-=16},function(){Qc(this,K(this)-1);this.b-=5},function(){this.X= ad(this,this.X);this.b-=5},function(){this.X=$c(this,this.X);this.b-=5},function(){this.X=M(this);this.b-=7},function(){this.j=~this.j&255;this.b-=4},Ad,function(){this.ka=N(this)&65535;this.b-=10},function(){this.ra(N(this),this.j);this.b-=13},function(){this.ka=this.ka+1&65535;this.b-=5},function(){var a=K(this);this.ra(a,ad(this,this.Z(a)));this.b-=10},function(){var a=K(this);this.ra(a,$c(this,this.Z(a)));this.b-=10},function(){this.ra(K(this),M(this));this.b-=10},function(){this.ba|=256;this.b-= 4},Ad,function(){var a;Qc(this,a=K(this)+this.ka);Sc(this,a>>8&256);this.b-=10},function(){this.j=this.Z(N(this));this.b-=13},function(){this.ka=this.ka-1&65535;this.b-=5},function(){this.j=ad(this,this.j);this.b-=5},function(){this.j=$c(this,this.j);this.b-=5},function(){this.j=M(this);this.b-=7},function(){Sc(this,Rc(this)?0:256);this.b-=4},function(){this.b-=5},function(){this.R=this.S;this.b-=5},function(){this.R=this.T;this.b-=5},function(){this.R=this.U;this.b-=5},function(){this.R=this.V;this.b-= 5},function(){this.R=this.X;this.b-=5},function(){this.R=this.Z(K(this));this.b-=7},function(){this.R=this.j;this.b-=5},function(){this.S=this.R;this.b-=5},function(){this.b-=5},function(){this.S=this.T;this.b-=5},function(){this.S=this.U;this.b-=5},function(){this.S=this.V;this.b-=5},function(){this.S=this.X;this.b-=5},function(){this.S=this.Z(K(this));this.b-=7},function(){this.S=this.j;this.b-=5},function(){this.T=this.R;this.b-=5},function(){this.T=this.S;this.b-=5},function(){this.b-=5},function(){this.T= this.U;this.b-=5},function(){this.T=this.V;this.b-=5},function(){this.T=this.X;this.b-=5},function(){this.T=this.Z(K(this));this.b-=7},function(){this.T=this.j;this.b-=5},function(){this.U=this.R;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.X;this.b-=5},function(){this.U=this.Z(K(this));this.b-=7},function(){this.U=this.j;this.b-=5},function(){this.V=this.R;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.X;this.b-=5},function(){this.V=this.Z(K(this));this.b-=7},function(){this.V=this.j;this.b-=5},function(){this.X=this.R;this.b-=5},function(){this.X=this.S;this.b-=5},function(){this.X=this.T;this.b-=5},function(){this.X=this.U;this.b-=5},function(){this.X=this.V;this.b-=5},function(){this.b-=5},function(){this.X=this.Z(K(this));this.b-=7},function(){this.X=this.j; -this.b-=5},function(){this.ra(K(this),this.R);this.b-=7},function(){this.ra(K(this),this.S);this.b-=7},function(){this.ra(K(this),this.T);this.b-=7},function(){this.ra(K(this),this.U);this.b-=7},function(){this.ra(K(this),this.V);this.b-=7},function(){this.ra(K(this),this.X);this.b-=7},function(){var a=this.N-1;if(this.K.length)for(var b=0;b>8;this.b-=10},function(){var a=N(this);Wc(this)||F(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=N(this);Wc(this)||(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Lc(this)&255|this.j<<8);this.b-=11},function(){this.j=bd(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,48);this.b-=11},function(){Wc(this)&&(F(this,P(this)), -this.b-=6);this.b-=5},function(){this.ka=K(this)&65535;this.b-=5},function(){var a=N(this);Wc(this)&&F(this,a);this.b-=10},function(){this.ta|=512;this.b-=4},function(){var a=N(this);Wc(this)&&(Q(this,this.N),F(this,a),this.b-=6);this.b-=11},Dd,function(){L(this,M(this));this.b-=7},function(){Q(this,this.N);F(this,56);this.b-=11}]; -function T(a){x.call(this,"ChipSet",a,T,32768);var b=a.model;b&&!Ed[b]&&Ka("Unrecognized ChipSet model: "+b);this.C=Ed[b]||{};a.sound&&(this.ia=null,window&&(this.ia=window.AudioContext||window.webkitAudioContext),this.ia&&new this.ia);D(this)}Za(T); -var U={Aa:1978.1,md:{Ba:0,$d:1,de:16,ke:32,te:64,se:128,wb:14},Ua:{Ba:1,Nc:1,fd:2,bd:4,cd:16,dd:32,ed:64,wb:8},nd:{Ba:2,Zd:3,Be:4,ae:8,oe:16,pe:32,qe:64,be:128,wb:0},xe:{Ba:3},ve:{Ba:2,le:7},ze:{Ba:3,Ce:1,ye:2,re:4,ie:8,ce:16,Wd:32},we:{Ba:4},Ae:{Ba:5,ee:1,fe:2,ge:4,he:8,De:16}},V={Aa:100,Oa:{Ba:66,Ee:1,jc:2,ad:4,ne:8,me:16,lc:32,kc:64,gc:128},Mc:{Ba:66,INIT:0},Sa:{Ba:194,Yd:0,fc:16,gd:32,mc:48,Rc:0,Sc:32},Kb:{Ba:162,ue:0,Uc:0,Qc:0,Tc:0,Pc:0},Ja:{je:{Ba:98},Ra:{Kc:0,Jc:1,jd:2,od:4,Oc:5,hd:6,kd:7}, -Lb:16383}},Ed={SI1978:U,VT100:V};T.prototype.la=function(){return!1};T.prototype.Na=function(a,b,c,d){this.w=b;this.b=c;this.H=d;this.A=a;this.M=qb(a,"Keyboard");this.video=qb(a,"Video");Bb(b,this,this.C.Rb);Fb(b,this,this.C.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.md.wb,U.Ua.wb,U.nd.wb,0,0,0,0]]; -V.INIT=[[V.Mc.INIT,V.Oa.jc|V.Oa.ad],[V.Sa.Rc,V.Sa.Sc],[V.Kb.Uc,V.Kb.Qc,V.Kb.Tc,V.Kb.Pc],[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.C.INIT&&!this.restore(this.C.INIT)&&this.ha("reset error")};m.save=function(){var a=new G(this);switch(this.C.Aa){case U.Aa:H(a,0,[this.Ca,this.I,this.Da,this.da,this.ga,this.ya,this.za]);break;case V.Aa:H(a,0,[this.oa,this.J]),H(a,1,[this.O,this.P]),H(a,2,[this.G,this.ea,this.wa,this.va]),H(a,3,[this.aa,this.u,this.Y,this.fa,this.K])}return a.data()}; -m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.C.Aa){case U.Aa:return this.Ca=b[0],this.I=b[1],this.Da=b[2],this.da=b[3],this.ga=b[4],this.ya=b[5],this.za=b[6],!0;case V.Aa:return this.oa=b[0],this.J=b[1],b=a[1],this.O=b[0],this.P=b[1],b=a[2],this.G=b[0],this.ea=b[1],this.wa=b[2],this.va=b[3],b=a[3],this.aa=b[0],this.u=b[1],this.Y=b[2],this.fa=b[3],this.K=b[4],!0}return!1};m.start=function(){};m.stop=function(){};m.vd=function(a,b){var c=this.Ca;C(this,a,null,b,"STATUS0",c,!0);return c}; -m.wd=function(a,b){var c=this.I;C(this,a,null,b,"STATUS1",c,!0);return c};m.xd=function(a,b){var c=this.Da;C(this,a,null,b,"STATUS2",c,!0);return c};m.ud=function(a,b){var c=this.da>>8-this.ga&255;C(this,a,null,b,"SHIFT.RESULT",c,!0);return c};m.Fd=function(a,b,c){C(this,a,b,c,"SHIFT.COUNT",null,!0);this.ga=b};m.Hd=function(a,b,c){C(this,a,b,c,"SOUND1",null,!0);this.ya=b};m.Gd=function(a,b,c){C(this,a,b,c,"SHIFT.DATA",null,!0);this.da=b<<8|this.da>>8}; -m.Id=function(a,b,c){C(this,a,b,c,"SOUND2",null,!0);this.za=b};m.Jd=function(a,b,c){C(this,a,b,c,"WATCHDOG",null,!0)};function Fd(a){var b=0,c=0,d=~a.aa;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.yd=function(a,b){var c=this.J,c=c&~V.Oa.kc;if((Ac(this.b)&64)<<1&&(c|=V.Oa.kc,c!=this.J)){var d,e;d=this.Y&1;e=this.Y>>1&7;switch(e){case V.Ja.Ra.kd:break;case V.Ja.Ra.Jc:this.aa=this.aa<<1|d;break;case V.Ja.Ra.Oc:d=Fd(this);this.K[d]=V.Ja.Lb;fb(this,"doNVRCommand(): erase data at addr "+t(d));break;case V.Ja.Ra.Kc:this.u=this.u<<1|d;break;case V.Ja.Ra.od:d=Fd(this);e=this.u&V.Ja.Lb;this.K[d]=e;fb(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case V.Ja.Ra.hd:d=Fd(this);e=this.K[d]; -null==e&&(e=V.Ja.Lb);this.u=e;fb(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case V.Ja.Ra.jd:this.u<<=1;this.fa=this.u&V.Ja.Lb+1;break;default:fb(this,"doNVRCommand(): unrecognized command 0x"+n(e,2))}}c&=~V.Oa.lc;this.fa&&(c|=V.Oa.lc);c&=~V.Oa.gc;this.M&&(c|=V.Oa.gc);this.J=c;C(this,a,null,b,"FLAGS.BUFFER",c);return c};m.Kd=function(a,b,c){C(this,a,b,c,"BRIGHTNESS");this.oa=b};m.Nd=function(a,b,c){C(this,a,b,c,"NVR.LATCH");this.Y=b}; -m.Md=function(a,b,c){C(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.G=this.G&-4|a;break;case 1:this.G=this.G&-13|a<<2;break;case 2:switch(a){case 0:this.ea=~this.ea;break;case 2:case 3:this.wa=3-a}break;case 3:this.va=a}}; -m.Ld=function(a,b,c){C(this,a,b,c,"DC011");b&V.Sa.gd?(b&=V.Sa.mc,this.P!=b&&(this.P=b,this.video&&(a=this.video,b=this.P==V.Sa.mc?50:60,a.g("updateRate("+b+")"),a.Ab=b))):(b&=V.Sa.fc,this.O!=b&&(this.O=b,this.video&&(a=this.O==V.Sa.fc?132:80,this.video.g("updateDimensions("+a+","+(80>>0,h],q=ka(p,k,a.Wa);0>q&&p.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.J.push({Fe:b,F:c,Ad:d,Pa:e,nc:f})}delete this.Pa}return!0};Gd.prototype.Ha=function(){return!0}; -function Hd(a,b,c,d){if(d)a.ha("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.Vb,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.Pa=e.symbols;if(!a.A.length){u("Empty ROM: "+b);return}if(1==a.A.length){u(a.A[0]);return}}catch(g){a.ha("ROM data error: "+g.message);return}else for(b=c.replace(/\n/gm, -" ").replace(/ +$/,"").split(" "),a.A=Array(b.length),e=0;e>>f.na;0>>=f.na;0>8;this.b-=10},function(){var a=N(this);Wc(this)||F(this,a);this.b-=10},function(){this.ta&=-513;this.b-=4},function(){var a=N(this);Wc(this)||(Q(this,this.P),F(this,a),this.b-=6);this.b-=11},function(){Q(this,Lc(this)&255|this.j<<8);this.b-=11},function(){this.j=bd(this,M(this));this.b-=7},function(){Q(this,this.P);F(this,48);this.b-=11},function(){Wc(this)&&(F(this,P(this)), +this.b-=6);this.b-=5},function(){this.ka=K(this)&65535;this.b-=5},function(){var a=N(this);Wc(this)&&F(this,a);this.b-=10},function(){this.ta|=512;this.b-=4},function(){var a=N(this);Wc(this)&&(Q(this,this.P),F(this,a),this.b-=6);this.b-=11},Dd,function(){L(this,M(this));this.b-=7},function(){Q(this,this.P);F(this,56);this.b-=11}]; +function T(a){x.call(this,"ChipSet",a,T,32768);var b=a.model;b&&!Ed[b]&&Ka("Unrecognized ChipSet model: "+b);this.C=Ed[b]||{};a.sound&&(this.ha=null,window&&(this.ha=window.AudioContext||window.webkitAudioContext),this.ha&&new this.ha);D(this)}Za(T); +var U={Aa:1978.1,nd:{Ba:0,$d:1,de:16,ke:32,te:64,se:128,vb:14},Wa:{Ba:1,Oc:1,gd:2,cd:4,dd:16,ed:32,fd:64,vb:8},od:{Ba:2,Zd:3,Be:4,ae:8,oe:16,pe:32,qe:64,be:128,vb:0},xe:{Ba:3},ve:{Ba:2,le:7},ze:{Ba:3,Ce:1,ye:2,re:4,ie:8,ce:16,Wd:32},we:{Ba:4},Ae:{Ba:5,ee:1,fe:2,ge:4,he:8,De:16}},V={Aa:100,Pa:{Ba:66,Ee:1,jc:2,bd:4,ne:8,me:16,lc:32,kc:64,gc:128},Nc:{Ba:66,INIT:0},Ua:{Ba:194,Yd:0,fc:16,hd:32,mc:48,Sc:0,Tc:32},Jb:{Ba:162,ue:0,Vc:0,Rc:0,Uc:0,Qc:0},Ja:{je:{Ba:98},Ta:{Lc:0,Kc:1,kd:2,pd:4,Pc:5,jd:6,ld:7}, +Kb:16383}},Ed={SI1978:U,VT100:V};T.prototype.la=function(){return!1};T.prototype.Oa=function(a,b,c,d){this.w=b;this.b=c;this.H=d;this.A=a;this.M=qb(a,"Keyboard");this.video=qb(a,"Video");Bb(b,this,this.C.Rb);Fb(b,this,this.C.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.nd.vb,U.Wa.vb,U.od.vb,0,0,0,0]]; +V.INIT=[[V.Nc.INIT,V.Pa.jc|V.Pa.bd],[V.Ua.Sc,V.Ua.Tc],[V.Jb.Vc,V.Jb.Rc,V.Jb.Uc,V.Jb.Qc],[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.C.INIT&&!this.restore(this.C.INIT)&&this.ia("reset error")};m.save=function(){var a=new G(this);switch(this.C.Aa){case U.Aa:H(a,0,[this.Ca,this.I,this.Da,this.da,this.ga,this.ya,this.za]);break;case V.Aa:H(a,0,[this.na,this.J]),H(a,1,[this.N,this.O]),H(a,2,[this.G,this.ea,this.wa,this.va]),H(a,3,[this.aa,this.u,this.Y,this.fa,this.K])}return a.data()}; +m.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.C.Aa){case U.Aa:return this.Ca=b[0],this.I=b[1],this.Da=b[2],this.da=b[3],this.ga=b[4],this.ya=b[5],this.za=b[6],!0;case V.Aa:return this.na=b[0],this.J=b[1],b=a[1],this.N=b[0],this.O=b[1],b=a[2],this.G=b[0],this.ea=b[1],this.wa=b[2],this.va=b[3],b=a[3],this.aa=b[0],this.u=b[1],this.Y=b[2],this.fa=b[3],this.K=b[4],!0}return!1};m.start=function(){};m.stop=function(){};m.wd=function(a,b){var c=this.Ca;C(this,a,null,b,"STATUS0",c,!0);return c}; +m.xd=function(a,b){var c=this.I;C(this,a,null,b,"STATUS1",c,!0);return c};m.yd=function(a,b){var c=this.Da;C(this,a,null,b,"STATUS2",c,!0);return c};m.vd=function(a,b){var c=this.da>>8-this.ga&255;C(this,a,null,b,"SHIFT.RESULT",c,!0);return c};m.Gd=function(a,b,c){C(this,a,b,c,"SHIFT.COUNT",null,!0);this.ga=b};m.Id=function(a,b,c){C(this,a,b,c,"SOUND1",null,!0);this.ya=b};m.Hd=function(a,b,c){C(this,a,b,c,"SHIFT.DATA",null,!0);this.da=b<<8|this.da>>8}; +m.Jd=function(a,b,c){C(this,a,b,c,"SOUND2",null,!0);this.za=b};m.Kd=function(a,b,c){C(this,a,b,c,"WATCHDOG",null,!0)};function Fd(a){var b=0,c=0,d=~a.aa;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.zd=function(a,b){var c=this.J,c=c&~V.Pa.kc;if((Ac(this.b)&64)<<1&&(c|=V.Pa.kc,c!=this.J)){var d,e;d=this.Y&1;e=this.Y>>1&7;switch(e){case V.Ja.Ta.ld:break;case V.Ja.Ta.Kc:this.aa=this.aa<<1|d;break;case V.Ja.Ta.Pc:d=Fd(this);this.K[d]=V.Ja.Kb;fb(this,"doNVRCommand(): erase data at addr "+t(d));break;case V.Ja.Ta.Lc:this.u=this.u<<1|d;break;case V.Ja.Ta.pd:d=Fd(this);e=this.u&V.Ja.Kb;this.K[d]=e;fb(this,"doNVRCommand(): write data "+t(e)+" to addr "+t(d));break;case V.Ja.Ta.jd:d=Fd(this);e=this.K[d]; +null==e&&(e=V.Ja.Kb);this.u=e;fb(this,"doNVRCommand(): read data "+t(e)+" from addr "+t(d));break;case V.Ja.Ta.kd:this.u<<=1;this.fa=this.u&V.Ja.Kb+1;break;default:fb(this,"doNVRCommand(): unrecognized command 0x"+n(e,2))}}c&=~V.Pa.lc;this.fa&&(c|=V.Pa.lc);c&=~V.Pa.gc;this.M&&(c|=V.Pa.gc);this.J=c;C(this,a,null,b,"FLAGS.BUFFER",c);return c};m.Ld=function(a,b,c){C(this,a,b,c,"BRIGHTNESS");this.na=b};m.Od=function(a,b,c){C(this,a,b,c,"NVR.LATCH");this.Y=b}; +m.Nd=function(a,b,c){C(this,a,b,c,"DC012");a=b&3;switch(b>>2&3){case 0:this.G=this.G&-4|a;break;case 1:this.G=this.G&-13|a<<2;break;case 2:switch(a){case 0:this.ea=~this.ea;break;case 2:case 3:this.wa=3-a}break;case 3:this.va=a}}; +m.Md=function(a,b,c){C(this,a,b,c,"DC011");b&V.Ua.hd?(b&=V.Ua.mc,this.O!=b&&(this.O=b,this.video&&(a=this.video,b=this.O==V.Ua.mc?50:60,fb(a,"updateRate("+b+")"),a.zb=b))):(b&=V.Ua.fc,this.N!=b&&(this.N=b,this.video&&(a=this.N==V.Ua.fc?132:80,b=this.video,fb(b,"updateDimensions("+a+","+(80>>0,h],q=ka(p,k,a.Xa);0>q&&p.splice(-(q+1),0,k)}l&&(g.a=l.replace(/''/g,'"'))}a.J.push({Fe:b,F:c,Bd:d,Ra:e,nc:f})}delete this.Ra}return!0};Id.prototype.Ha=function(){return!0}; +function Jd(a,b,c,d){if(d)a.ia("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.Vb,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){u("Empty ROM: "+b);return}if(1==a.A.length){u(a.A[0]);return}}catch(g){a.ia("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({cc:b,Zb:Date.now(),Mb:!1}):(a.u[d].Zb=Date.now(),a.u[d].Mb=!1);else if(0<=d){if(!a.u[d].Mb){var e=a.u[d].Zb;if(e&&100>Date.now()-e)return a.u[d].Mb=!0,Td(a),!0}a.u.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=U.Ua.bd;break;case "2p":d=U.Ua.fd;break;case "coin":d=U.Ua.Nc;break;case "left":d=U.Ua.dd;break;case "right":d=U.Ua.ed;break;case "fire":d=U.Ua.cd}d&&(a=a.I,b=d,a.I&=~b,c&&(a.I|=b))}return!0} -function Td(a){for(var b=0,c=-1;bc||c>e)c=e}else{Rd(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Td(a)},c)}m.zd=function(a,b){var c=this.G;0<=this.C&&(this.C>3)*this.da;if(this.Sd||ub(this.w,this.va,this.Wa,3))1>1)),this.O=document.createElement("canvas"),this.O.width=b,this.O.height=c,this.fb=this.O.getContext("2d"),this.ia={},this.za=1<=a.Pd?8:16,f=8>(7d?a.u.push({cc:b,Zb:Date.now(),Mb:!1}):(a.u[d].Zb=Date.now(),a.u[d].Mb=!1);else if(0<=d){if(!a.u[d].Mb){var e=a.u[d].Zb;if(e&&100>Date.now()-e)return a.u[d].Mb=!0,Vd(a),!0}a.u.splice(d,1)}if(a.I){d=0;switch(b){case "1p":d=U.Wa.cd;break;case "2p":d=U.Wa.gd;break;case "coin":d=U.Wa.Oc;break;case "left":d=U.Wa.ed;break;case "right":d=U.Wa.fd;break;case "fire":d=U.Wa.dd}d&&(a=a.I,b=d,a.I&=~b,c&&(a.I|=b))}return!0} +function Vd(a){for(var b=0,c=-1;bc||c>e)c=e}else{Td(a,d,!1);b=0;continue}}b++}0<=c&&setTimeout(function(){Vd(a)},c)}m.Ad=function(a,b){var c=this.G;0<=this.C&&(this.C>3)*a.ea,!ub(a.w,a.ya,a.aa,3)))return!1;a.aa?(a.Dc=a.I.createImageData(b,c),a.Gc=16/a.Za|0,ae(a,a.aa>>1)):ae(a,(a.fa+1)*a.ha);a.N=document.createElement("canvas");a.N.width=b;a.N.height=c;a.fb=a.N.getContext("2d");a.va={};a.Da=1<=a.uc?8:16,f=8>(7>4)*c)}return k} -Ud.prototype.Ea=function(){if(2==this.ea){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.va,c=-1,d=-1,e,f=-(60==this.Ab?2:5);f>8&15|16;zb(this.w,b++,e);zb(this.w,b++, -c&255);if(g)break}if(h)for(c=0,e=1;ec&&(a=Math.round(c/b*100)+"%")}this.xc?(this.P.style.width=a,this.P.style.width=a,this.P.style.display="block",this.P.style.margin="auto"):(this.u.style.width=a,this.u.style.height="auto");this.u.style.backgroundColor="black";this.u.hb();a=!0}this.ya&&this.ya.focus()}return a}; -function Xd(a,b){!b&&a.u&&(a.xc?a.P.style.width=a.P.style.height="":a.u.style.width=a.u.style.height="");fb(a,"notifyFullScreen("+b+")",!0)}function Zd(a,b){a.Dc=b;a.wa=!1;if(void 0===a.J||a.J.length!=a.Dc)a.J=Array(a.Dc)}function be(a,b,c,d,e){d=a.C?(b.height-c-1)*b.width+d:c+d*b.width;e&&1==a.ea&&(208<=c&&236>c?e=a.za+0:28<=c&&72>c&&(e=a.za+1));a=a.oa[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 ce(a){for(var b=a.va,c=-1,d=0,e=60==a.Ab?2:5,f=0,h=0;d>=1);;){var q=xb(a.w,k++);if(127==(q&127)){var r=xb(a.w,k++),c=r&96,b=(r&15)<<8|xb(a.w,k),b=b+(r&16?8192:16384);break}if(g>4)*q.ja,w=void 0,J=void 0,A=void 0, -R=void 0,Aa=q.qa,Z=q.ja;z?(w=p*r.qa,J=d*r.ja,A=r.qa,R=r.ja):(w=p*r.uc,J=d*r.vc,A=r.uc,R=r.vc);q.qa>r.qa&&(w*=2,A*=2);q.ja>r.ja&&(0==l&&(v+=r.ja),Z=r.ja);z?z.drawImage(q.canvas,I,v,Aa,Z,w,J,A,R):(w+=0,J+=0,r.I.drawImage(q.canvas,I,v,Aa,Z,w,J,A,R))}h++}f++}d++}}a.wa=!0;h&&a.fb&&a.I.drawImage(a.O,0,0,a.K,a.da-a.ja,0,0,a.Qd,a.Rd)} +Wd.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.zb?2:5);f>8&15|16;zb(this.w,b++,e);zb(this.w,b++, +c&255);if(g)break}if(h)for(c=0,e=1;ec&&(a=Math.round(c/b*100)+"%")}this.Cc?(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.hb();a=!0}this.Ca&&this.Ca.focus()}return a}; +function Zd(a,b){!b&&a.u&&(a.Cc?a.O.style.width=a.O.style.height="":a.u.style.width=a.u.style.height="");fb(a,"notifyFullScreen("+b+")")}function ae(a,b){a.Ec=b;a.za=!1;if(void 0===a.J||a.J.length!=a.Ec)a.J=Array(a.Ec)}function ce(a,b,c,d,e){d=a.C?(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 de(a){for(var b=a.ya,c=-1,d=0,e=60==a.zb?2:5,f=0,h=0;d>=1);;){var q=xb(a.w,k++);if(127==(q&127)){var r=xb(a.w,k++),c=r&96,b=(r&15)<<8|xb(a.w,k),b=b+(r&16?8192:16384);break}if(g>4)*q.ja,w=void 0,J=void 0,A=void 0, +R=void 0,Ba=q.oa,Z=q.ja;z?(w=p*r.oa,J=d*r.ja,A=r.oa,R=r.ja):(w=p*r.vc,J=d*r.wc,A=r.vc,R=r.wc);q.oa>r.oa&&(w*=2,A*=2);q.ja>r.ja&&(0==l&&(v+=r.ja),Z=r.ja);z?z.drawImage(q.canvas,I,v,Ba,Z,w,J,A,R):(w+=0,J+=0,r.I.drawImage(q.canvas,I,v,Ba,Z,w,J,A,R))}h++}f++}d++}}a.za=!0;h&&a.fb&&a.I.drawImage(a.N,0,0,a.K,a.ea-a.ja,0,0,a.Qd,a.Rd)} Ia(function(){for(var a=B(document,"pc8080","video"),b=0;bMissing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=qa().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height= -(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||Ra.aspect);f&&.3<=f&&3.33>=f&&(Ha("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");wa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Ud(d,e,h,f,c);db(d,c)}}); -function de(a){this.G=+a.adapter;switch(this.G){case 0:this.J=0;break;default:u("Unrecognized serial adapter #"+this.G);return}x.call(this,"SerialPort",a,de,8388608);var b=a.binding;if("console"!=b){var c;a=ee;b&&(void 0===c&&(c="Panel"),(c=cb(c,this.id))&&(b=c.L[b])&&this.la(null,a,b))}}Za(de);var ee="buffer";m=de.prototype; -m.la=function(a,b,c){switch(b){case ee:return this.L[b]=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;(8===b||a.ctrlKey&&65<=b&&90>=b)&&a.preventDefault&&a.preventDefault();return!0},c.onkeypress=function(a){a=a||window.event;a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};m.Na=function(a,b,c,d){this.w=b;this.b=c;this.H=d;this.I=qb(a,"ChipSet");Bb(b,this,fe,this.J);Fb(b,this,ge,this.J);D(this)}; -m.Ea=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};m.Ha=function(a){return a?this.save():!0};m.reset=function(){he(this)};m.save=function(){var a=new G(this),b=0,c=[];c[b++]=this.u;c[b++]=this.A;c[b++]=this.C;H(a,0,c);return a.data()};m.restore=function(a){return he(this,a[0])};function he(a,b){var c=0;void 0===b&&(b=[0,0,0]);a.u=b[c++];a.A=b[c++];a.C=b[c++];return!0}m.td=function(a,b){var c=this.u;C(this,a,null,b,"DATA",c);return c}; -m.sd=function(a,b){var c=this.A;C(this,a,null,b,"COMMAND",c);return c};m.Ed=function(a,b,c){C(this,a,b,c,"DATA");this.u=b};m.Dd=function(a,b,c){C(this,a,b,c,"COMMAND");this.A=b};m.Cd=function(a,b,c){C(this,a,b,c,"BAUDRATE");this.C=b};var fe={0:de.prototype.td,1:de.prototype.sd},ge={0:de.prototype.Ed,1:de.prototype.Dd,2:de.prototype.Cd};Ia(function(){for(var a=B(document,"pc8080","serial"),b=0;b=f&&(Ha("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");wa("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var h=e.getContext("2d"),d=new Wd(d,e,h,f,c);db(d,c)}}); +function ee(a){this.M=+a.adapter;switch(this.M){case 0:this.N=0;this.O=2;break;default:u("Unrecognized serial adapter #"+this.M);return}x.call(this,"SerialPort",a,ee,8388608);var b=a.binding;if("console"!=b){var c;a=fe;b&&(void 0===c&&(c="Panel"),(c=cb(c,this.id))&&(b=c.L[b])&&this.la(null,a,b))}}Za(ee);var ge=[!1,0,0,133,142,39,238],fe="buffer";m=ee.prototype; +m.la=function(a,b,c,d){var e=this;switch(b){case fe:return this.L[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>>d.w.na;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var p=b[g];p.type==c?l++||d.g("..."):(c=p.type,l=wb[c],p&&d.g(n(p.id)+" %"+n(g<>>d.w.pa;k=1}d.g("blockid physical blockaddr used size type");d.g("-------- --------- ---------- ------ ------ ----");for(var c=-1,l=0;k--;){var p=b[g];p.type==c?l++||d.g("..."):(c=p.type,l=wb[c],p&&d.g(n(p.id)+" %"+n(g<>>e.na;f!=e.w?e.W[h].dc(f,b&65535,d):(e.W[h++].Jb(f,b&255,d),e.W[h&e.K].Jb(0,b>>8&255,d+1));c&&we(a,c);lc(this.b,!0)}};function X(a){return{F:a,Ma:!1}}function xe(a){return[a.F,a.Ma]}function ye(a){return{F:a[0],Ma:a[1]}} -function ve(a,b,c){var d;c=(c?a.P:a.eb).F;if(void 0!==b){d=b=ze(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=na(qe,a.substr(b,1))));return c}function Fe(a,b){var c=0,d=Ge(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 Ge(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.R;break;case 1:c=d.S;break;case 8:c=Mc(d);break;case 2:c=d.T;break;case 3:c=d.U;break;case 9:c=Oc(d);break;case 4:c=d.V;break;case 5:c=d.X;break;case 10:c=K(d);break;case 6:c=d.Z(K(d));break;case 11:c=d.ka;break;case 12:c=d.N;break;case 13:c=Lc(d);break;case 14:c=Lc(d)&255|d.j<<8}}return c} -function He(a,b){b=ze(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=Ee(b,c+1),0<=e&&(b=b.substr(0,c)+Fe(a,e)+b.substr(c+1+qe[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=ba(e,16),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=ve(a,e))?(d=e+' "'+De(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=ve(a,e))?(we(d),d=e+' "'+ -De(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.N).F));if(this.pa&1073741824)this.ya.push(a);else if(!this.wa||a!=this.wa)if(this.wa=a,this.pa&-2147483648&&(this.ma(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.qb=0;c.C-=c.b;c.b=0;lc(c)}}; -function eb(a,b,c,d,e,f,h,g){g|=256;null!=f&&(a.pa&g)!=g||a.message(b.cb+"."+(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 le(a){var b;if(yd(a)){if(!a.O||!a.O.length){a.O=Array(1E3);for(b=0;b>>d.na],!1)}a.Y=["br"];if(void 0!==a.G)for(b=1;b>>d.na],!0);a.G=["bw"];a.fb=0}m.Xa=function(a,b,c){var d=!0;c||Me(this,a,b,!1,!0);if(a!=this.u){var e=ue(b);if(-1===e)this.g("invalid address: "+Y(b.F)),d=!1;else{var f=this.w;f.W[e>>>f.na].Xa(e&f.w,a==this.G)}}d&&(a.push(b),c?b.Ma=!0:(lf(this,a,a.length-1,"set"),le(this)));return d}; -function Me(a,b,c,d,e){var f=!1;c=ue(c);for(var h=1;h>>d.na],b==a.G));g.Ma||le(a);break}}return f}function mf(a,b){for(var c=1;c>24,4);break;case 3:w=n(z.Qa(I,2),4);break;default:z="imm("+t(v)+")";break a}8086==z.style&&v&64?w="["+w+"]":v&16||(w=(z.style==je?"$":"0x")+w);z=w}else v& -16?(z=(q&3840)>>8,v=qe[z],8086==a.style&&q&64&&(6==z&&(v="HL"),v="["+v+"]"),z=v):v&128&&(z=(f>>3&7).toString());if(!z||!z.length){g="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; -function tf(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; +m.la=function(a,b,c){var d=this;switch(b){case "debugInput":return this.na=this.L[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",kc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?d.I>>e.pa;f!=e.w?e.W[h].dc(f,b&65535,d):(e.W[h++].Ib(f,b&255,d),e.W[h&e.K].Ib(0,b>>8&255,d+1));c&&ze(a,c);lc(this.b,!0)}};function X(a){return{F:a,Na:!1}}function Ae(a){return[a.F,a.Na]}function Be(a){return{F:a[0],Na:a[1]}} +function ye(a,b,c){var d;c=(c?a.O:a.Za).F;if(void 0!==b){d=b=Ce(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=na(te,a.substr(b,1))));return c}function Ie(a,b){var c=0,d=Je(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 Je(a,b){var c;if(0<=b){var d=a.b;switch(b){case 7:c=d.j;break;case 0:c=d.R;break;case 1:c=d.S;break;case 8:c=Mc(d);break;case 2:c=d.T;break;case 3:c=d.U;break;case 9:c=Oc(d);break;case 4:c=d.V;break;case 5:c=d.X;break;case 10:c=K(d);break;case 6:c=d.Z(K(d));break;case 11:c=d.ka;break;case 12:c=d.P;break;case 13:c=Lc(d);break;case 14:c=Lc(d)&255|d.j<<8}}return c} +function Ke(a,b){b=Ce(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=He(b,c+1),0<=e&&(b=b.substr(0,c)+Ie(a,e)+b.substr(c+1+te[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=ba(e,16),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=ye(a,e))?(d=e+' "'+Ge(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=ye(a,e))?(ze(d),d=e+' "'+ +Ge(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.P).F));if(this.qa&1073741824)this.ya.push(a);else if(!this.wa||a!=this.wa)if(this.wa=a,this.qa&-2147483648&&(this.ma(),a+=" (cpu halted)"),this.g(a),this.b){var c=this.b;c.i.pb=0;c.C-=c.b;c.b=0;lc(c)}}; +function eb(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 oe(a){var b;if(yd(a)){if(!a.N||!a.N.length){a.N=Array(1E3);for(b=0;b>>d.pa],!1)}a.Y=["br"];if(void 0!==a.G)for(b=1;b>>d.pa],!0);a.G=["bw"];a.fb=0}m.Ya=function(a,b,c){var d=!0;c||Pe(this,a,b,!1,!0);if(a!=this.u){var e=xe(b);if(-1===e)this.g("invalid address: "+Y(b.F)),d=!1;else{var f=this.w;f.W[e>>>f.pa].Ya(e&f.w,a==this.G)}}d&&(a.push(b),c?b.Na=!0:(of(this,a,a.length-1,"set"),oe(this)));return d}; +function Pe(a,b,c,d,e){var f=!1;c=xe(c);for(var h=1;h>>d.pa],b==a.G));g.Na||oe(a);break}}return f}function pf(a,b){for(var c=1;c>24,4);break;case 3:w=n(z.Sa(I,2),4);break;default:z="imm("+t(v)+")";break a}8086==z.style&&v&64?w="["+w+"]":v&16||(w=(z.style==me?"$":"0x")+w);z=w}else v& +16?(z=(q&3840)>>8,v=te[z],8086==a.style&&q&64&&(6==z&&(v="HL"),v="["+v+"]"),z=v):v&128&&(z=(f>>3&7).toString());if(!z||!z.length){g="INVALID";break}0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; +function wf(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 Ae(a,b,c){var d;if(b){b=ze(a,b);for(var e=0,f=!1,h=b,g=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=p+"b"+h;d>>=8}d="0x"+n(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function wf(a,b){if(b)return vf(a,b,a.ga[b]);var c=0;for(b in a.ga)vf(a,b,a.ga[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Ad;if(e>=h&&e>8&255;case "C":d.S=g&255;break;case "D":d.T= -g&255;break;case "DE":d.T=g>>8&255;case "E":d.U=g&255;break;case "H":d.V=g&255;break;case "HL":d.V=g>>8&255;case "L":d.X=g&255;break;case "SP":d.ka=g&65535;break;case "PC":F(d,g);a.P=X(d.N);break;case "PS":Jc(d,g);break;case "PSW":Jc(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?Tc(d)||(d.ca^=1):Tc(d)&&(d.ca^=1);break;case "AF":d.ua=g?~d.ca&16|d.ua&-17:d.ca&16|d.ua&-17;break;case "ZF":d.ba=g?d.ba&-256:d.ba|255;break;case "SF":g?Wc(d)||(d.ca^=192):Wc(d)&&(d.ca^= -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}lc(d);a.g("updated registers:")}a.g(rf(a));c&&(a.P=X(d.N),Ke(a,Y(a.P.F)))}}function Df(a,b){b=ja(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(He(a,c[2])):Ae(a,b,!0)}function Ef(a,b,c){var d="t"!=b;c=uf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);xa(c,function(){return hb(a,!0)&&a.tb(e,d,!1)},function(){lc(a.b);hb(a,!1)})} -function Ke(a,b,c,d){if(b=ve(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=ve(a,c,!0);if(!d||d.Fg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=of(a,b,h,f);a.g(f);a.P=b;e-=b.F-k;c++}}} -function Ce(a,b,c,d){if(c)if(b){0>a.I&&a.C.length&&(a.I=0);if(0>a.I||b!=a.C[a.I])a.C.splice(0,0,b),a.I=0;a.I--}else a.fa?b="end":b=a.C[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(ja(b.substring(c,f))),c=f+1}}return a} -function nf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.fa&&(a.g("ended assemble at "+Y(a.ea.F)),a.P=a.ea,a.fa=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.wa=null;if(jb(a)&&0l||"z"Da.length&&(a.g("note: only "+Da.length+" available"),fa=Da.length);aa-=fa;0>aa&&(null==Da[Da.length-1].F?(fa=aa+fa,aa=0):aa+=Da.length);var hd=[];"call"== -Se&&(mb=1E5,hd=["CALL"]);for(void 0!==Re&&a.g(fa+" instructions earlier:");0=Da.length&&(aa=0);a.gb=fa;Ue++;mb--}}Ue||(a.g("no "+Te+"history available"),a.gb=void 0)}else{var oc=ve(a,Z);if(oc){var pc=0;Va&&("l"==Va.charAt(0)&&(Va=Va.substr(1)||Zf),pc=uf(a,Va)>>>0,65536>4||1;ag--&&0tc?String.fromCharCode(tc):".";rc--}Wa&&(Wa+="\n");Wa+=Z+" "+Mb+(0==Lb?" "+jd:"")}Wa&&a.g(Wa);a.eb=oc}}}}break;case "e":if("else"==f[0])break;var uc=1,Xe=255,Ye=a.Z,Ze=a.ra;"ew"==f[0]&&(uc=2,Xe=65535,Ye=a.Qa,Ze=a.Tb);var $e=uc<<1,af=f[1];if(null==af)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=ve(a,af);if(vc)for(var wc=2;wcqd;){for(var Xa=null,gg=256;65536>Pb.F>>>0;){cf.F= -a.Qa(Pb,2);if(null==Pb.F||!gg--)break;for(var hg=a,yc=cf,df=null,Qb=yc.F,ef=Qb,rd=1;6>=rd&&Qb;rd++){if(2\nLicense: GPL version 3 or later ");for(b=0;bOf){if(Kf(d,this.P)){this.G=new G(this,"1.23.3","failsafe");Kf(this.G)&&(Tf(this,d),a=2,Hf(this.G));H(this.G,"timestamp",ma());If(this.G);var e=this.A&&!this.K;if(1==a||ra("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Jf(d)){var f=Lf(d,"code"),h=Lf(d,"data");f&&("ok"==f?Kf(d,h):("error"==f&& -"no machine state"!=h?(this.ha("Error: "+h),"unable to verify user"==h&&(va("user",""),this.u=null)):this.g(f+": "+h),Hf(d),Kf(d)?(c=Jf(d),e=!0):c=!1))}e&&Sf(this,c?d:null)}else 2==a&&d.clear()}else Sf(this);delete this.P;delete this.Y}e=bb(this.id);for(f=0;fa[1];a=a[2];this.oa=!0;this.D.sa=!0;var d=this.L.power;d&&(d.textContent="Shutdown");this.b&&(Uf(this,this.b,b,c,a),mc(this.b));this.ea&&(Tf(this,b),b.clear());!c&&this.G&&(this.G.clear(),delete this.G);this.C=0}; -function Tf(a,b){if(ra("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.ia;e.user=c;e.type="bug";e.data=d;oa("http://www.pcjs.org/api/v1/report",e,!0)}} -function Ff(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new G(a,"1.23.3"),h=new G(a,"1.23.3","validate"),g=ma();H(h,"timestamp",g);H(f,"timestamp",g);H(f,"version","1.23.3");H(f,"url",window?window.location.href:null);H(f,"browser",qa());a.b&&a.b.Ha&&(c&&a.b.ma(),d=a.b.Ha(b,c),"object"===typeof d&&H(f,a.b.id,d),c&&(a.b.D.sa=!1,!1===d&&(e=null)));for(var g=bb(a.id),k=0;k=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;h=p+"b"+h;d>>=8}d="0x"+n(c)+" "+c+". ("+h+")"}a.g((null!=b?b+": ":"")+d);return e}function zf(a,b){if(b)return yf(a,b,a.ga[b]);var c=0;for(b in a.ga)yf(a,b,a.ga[b]),c++;return 0b[0]?1:a[0]>>0;for(b=0;b>>0,g=f.Bd;if(e>=h&&e>8&255;case "C":d.S=g&255;break;case "D":d.T= +g&255;break;case "DE":d.T=g>>8&255;case "E":d.U=g&255;break;case "H":d.V=g&255;break;case "HL":d.V=g>>8&255;case "L":d.X=g&255;break;case "SP":d.ka=g&65535;break;case "PC":F(d,g);a.O=X(d.P);break;case "PS":Jc(d,g);break;case "PSW":Jc(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?Tc(d)||(d.ca^=1):Tc(d)&&(d.ca^=1);break;case "AF":d.ua=g?~d.ca&16|d.ua&-17:d.ca&16|d.ua&-17;break;case "ZF":d.ba=g?d.ba&-256:d.ba|255;break;case "SF":g?Wc(d)||(d.ca^=192):Wc(d)&&(d.ca^= +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}lc(d);a.g("updated registers:")}a.g(uf(a));c&&(a.O=X(d.P),Ne(a,Y(a.O.F)))}}function Gf(a,b){b=ja(b);var c=b.match(/^(['"])(.*?)\1$/);c?a.g(Ke(a,c[2])):De(a,b,!0)}function Hf(a,b,c){var d="t"!=b;c=xf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);xa(c,function(){return hb(a,!0)&&a.sb(e,d,!1)},function(){lc(a.b);hb(a,!1)})} +function Ne(a,b,c,d){if(b=ye(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=ye(a,c,!0);if(!d||d.Fg[0].indexOf("+"))){var l=g[0]+":";g[2]&&(l+=" "+g[2]);a.g(l)}g[3]&&(h=g[3],f=null);f=rf(a,b,h,f);a.g(f);a.O=b;e-=b.F-k;c++}}} +function Fe(a,b,c,d){if(c)if(b){0>a.I&&a.C.length&&(a.I=0);if(0>a.I||b!=a.C[a.I])a.C.splice(0,0,b),a.I=0;a.I--}else a.fa?b="end":b=a.C[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(ja(b.substring(c,f))),c=f+1}}return a} +function qf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.g(">> "+b):(a.fa&&(a.g("ended assemble at "+Y(a.ea.F)),a.O=a.ea,a.fa=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.wa=null;if(jb(a)&&0l||"z"Ea.length&&(a.g("note: only "+Ea.length+" available"),fa=Ea.length);aa-=fa;0>aa&&(null==Ea[Ea.length-1].F?(fa=aa+fa,aa=0):aa+=Ea.length);var hd=[];"call"== +Ve&&(mb=1E5,hd=["CALL"]);for(void 0!==Ue&&a.g(fa+" instructions earlier:");0=Ea.length&&(aa=0);a.gb=fa;Xe++;mb--}}Xe||(a.g("no "+We+"history available"),a.gb=void 0)}else{var oc=ye(a,Z);if(oc){var pc=0;Wa&&("l"==Wa.charAt(0)&&(Wa=Wa.substr(1)||bg),pc=xf(a,Wa)>>>0,65536>4||1;dg--&&0tc?String.fromCharCode(tc):".";rc--}Xa&&(Xa+="\n");Xa+=Z+" "+Mb+(0==Lb?" "+jd:"")}Xa&&a.g(Xa);a.Za=oc}}}}break;case "e":if("else"==f[0])break;var uc=1,$e=255,af=a.Z,bf=a.ra;"ew"==f[0]&&(uc=2,$e=65535,af=a.Sa,bf=a.Tb);var cf=uc<<1,df=f[1];if(null==df)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=ye(a,df);if(vc)for(var wc=2;wcqd;){for(var Ya=null,jg=256;65536>Pb.F>>>0;){ff.F= +a.Sa(Pb,2);if(null==Pb.F||!jg--)break;for(var kg=a,yc=ff,gf=null,Qb=yc.F,hf=Qb,rd=1;6>=rd&&Qb;rd++){if(2\nLicense: GPL version 3 or later ");for(b=0;bRf){if(Nf(d,this.O)){this.G=new G(this,"1.23.3","failsafe");Nf(this.G)&&(Wf(this,d),a=2,Kf(this.G));H(this.G,"timestamp",ma());Lf(this.G);var e=this.A&&!this.K;if(1==a||ra("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=Mf(d)){var f=Of(d,"code"),h=Of(d,"data");f&&("ok"==f?Nf(d,h):("error"==f&& +"no machine state"!=h?(this.ia("Error: "+h),"unable to verify user"==h&&(va("user",""),this.u=null)):this.g(f+": "+h),Kf(d),Nf(d)?(c=Mf(d),e=!0):c=!1))}e&&Vf(this,c?d:null)}else 2==a&&d.clear()}else Vf(this);delete this.O;delete this.Y}e=bb(this.id);for(f=0;fa[1];a=a[2];this.na=!0;this.D.sa=!0;var d=this.L.power;d&&(d.textContent="Shutdown");this.b&&(Xf(this,this.b,b,c,a),mc(this.b));this.ea&&(Wf(this,b),b.clear());!c&&this.G&&(this.G.clear(),delete this.G);this.C=0}; +function Wf(a,b){if(ra("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;oa("http://www.pcjs.org/api/v1/report",e,!0)}} +function If(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new G(a,"1.23.3"),h=new G(a,"1.23.3","validate"),g=ma();H(h,"timestamp",g);H(f,"timestamp",g);H(f,"version","1.23.3");H(f,"url",window?window.location.href:null);H(f,"browser",qa());a.b&&a.b.Ha&&(c&&a.b.ma(),d=a.b.Ha(b,c),"object"===typeof d&&H(f,a.b.id,d),c&&(a.b.D.sa=!1,!1===d&&(e=null)));for(var g=bb(a.id),k=0;k>>f.na;0>8|(w&255)<<8);p>J&I;be(d,d.Cc,p++,q,R);J+=v}p>r&&(r=p);q=h&&(h=q+1)}g+=2;l++;if(p>=d.K&&(p=0,q++,q>d.da))break}d.wa=!0;eg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pc8080$2")); -g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){g=null,a=q.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");oa(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],l,p=/( [a-z]+=)(['"])(.*?)\2/g;l=p.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],h);ng(a,b,c)}})}else c(a,null)} -function og(a,b,c,d){function e(a){if(void 0===g){var b=h&&B(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ha(a))}function f(a){e("Error: "+a);k&&(--Xf||La(!0));k=!1}var h,g,k=!0;Xf++;$a[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));p.appendChild(q)}c|| -(c="/versions/pc8080/1.23.3/components.xsl");l=function(d,g){g?Yf(c,null,null,!1,e,function(d,k){if(k)if(ab(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--Xf||La(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--Xf||La(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?Yf(b,a,d,!0,e,l):mg(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(r){f(r.message)}return k}window.embedPC8080=function(a,b,c,d){La(!1);return og(a,b,c,d)};window.enableEvents=La;window.sendEvent=Ma; -function pg(a,b,c,d){if(!c&&b){d.push(b);a=$a[d[0]];b=null;for(var e in a)if(ea(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?oa(b,null,!0,function(a,b){qg(b,d)}):qg(null,d)}else u("Error ("+c+") requesting "+a)} -function qg(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 p=g[l],q=da(l);if("xml"==q){for(q=/[ \t]*]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=q.exec(g[l]);){var r=d[2];r&&(g[r]||(p=p.replace(d[0],"")))}d=l=ca(l)}else"xsl"==q&&(e=l=ca(l));k[l]=p}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, +m.la=function(a,b,c){var d=this;switch(b){case "power":return this.L[b]=c,c.onclick=function(){d.C||(d.D.sa?If(d,!1,!0):Uf(d,d.Fb))},!0;case "reset":return this.L[b]=c,c.onclick=function(){if(d.D.sa&&!d.C)if(d.A&&!d.N){var a=ra("Click OK to save changes to this PC8080 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");If(d,a,!0);!a&&d.da?window&&window.location.reload():d.Fb(Rf)}else d.reset(),d.b&&mc(d.b)},!0;case "save":if(ea(pa(),"pcjs.org")){c.parentNode.removeChild(c); +break}this.L[b]=c;c.onclick=function(){var a=Sf(d,!0);if(a){var b=!!(d.A&&!d.N||d.da),c=If(d,b);b?Yf(d,a,c):d.ia("Resume disabled, machine state not saved")}};return!0}return!1}; +function Sf(a,b){var c=a.u;c||(c=ua("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c&&((c=Zf(a,c))||a.ia("The user ID is invalid."))):b&&a.ia("Browser local storage is not available"));return c} +function Zf(a,b){a.u=null;var c=oa(pa()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(va("user",c.data),a.u=c.data)}catch(e){u(e.message+" ("+d+")")}return a.u}function Tf(a){var b=null;a.u&&(b=pa()+"/api/v1/user?req=load&user="+a.u+"&state="+Jf(a,"1.23.3"));return b} +function Yf(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Jf(a,"1.23.3");d.data=c;b=oa(pa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0>>f.pa;0>8|(w&255)<<8);p>J&I;ce(d,d.Dc,p++,q,R);J+=v}p>r&&(r=p);q=h&&(h=q+1)}g+=2;l++;if(p>=d.K&&(p=0,q++,q>d.ea))break}d.za=!0;eg.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(g=window.location.pathname+g);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(g?' url="'+g+'"':""))}e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1pc8080$2")); +g=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(g=new window.ActiveXObject("Microsoft.XMLDOM"),g.async=!1,g.loadXML(a)):g=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){g=null,a=q.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");oa(e,null,!0,function(f,h,g){if(g||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+g+")");else{if(f=d[3])if(g=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=g[0],l,p=/( [a-z]+=)(['"])(.*?)\2/g;l=p.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[0]);g[0]!=k&&(h=h.replace(g[0],k))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],h);qg(a,b,c)}})}else c(a,null)} +function rg(a,b,c,d){function e(a){if(void 0===g){var b=h&&B(h,"machine-warning");g=b&&b[0]||h}g&&(g.innerHTML=ha(a))}function f(a){e("Error: "+a);k&&(--$f||La(!0));k=!1}var h,g,k=!0;$f++;$a[a]={};try{if(h=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));p.appendChild(q)}c|| +(c="/versions/pc8080/1.23.3/components.xsl");l=function(d,g){g?ag(c,null,null,!1,e,function(d,k){if(k)if(ab(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=g.transformNode(k);l?(h.outerHTML=l,--$f||La(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(g,document))?h.parentNode?(h.parentNode.replaceChild(l,h),--$f||La(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?ag(b,a,d,!0,e,l):pg(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(r){f(r.message)}return k}window.embedPC8080=function(a,b,c,d){La(!1);return rg(a,b,c,d)};window.enableEvents=La;window.sendEvent=Ma; +function sg(a,b,c,d){if(!c&&b){d.push(b);a=$a[d[0]];b=null;for(var e in a)if(ea(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?oa(b,null,!0,function(a,b){tg(b,d)}):tg(null,d)}else u("Error ("+c+") requesting "+a)} +function tg(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 p=g[l],q=da(l);if("xml"==q){for(q=/[ \t]*]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=q.exec(g[l]);){var r=d[2];r&&(g[r]||(p=p.replace(d[0],"")))}d=l=ca(l)}else"xsl"==q&&(e=l=ca(l));k[l]=p}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=wa("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+='