diff --git a/devices/pc8080/machine/vt100/debugger/machine-right.xml b/devices/pc8080/machine/vt100/debugger/machine-right.xml index da0516814..d531d7fd1 100644 --- a/devices/pc8080/machine/vt100/debugger/machine-right.xml +++ b/devices/pc8080/machine/vt100/debugger/machine-right.xml @@ -2,7 +2,7 @@ VT100 Terminal - + diff --git a/devices/pc8080/machine/vt100/debugger/machine.xml b/devices/pc8080/machine/vt100/debugger/machine.xml index 4afc0c4cf..f9c7c2590 100644 --- a/devices/pc8080/machine/vt100/debugger/machine.xml +++ b/devices/pc8080/machine/vt100/debugger/machine.xml @@ -2,7 +2,7 @@ VT100 Terminal - + diff --git a/devices/pc8080/machine/vt100/machine-right.xml b/devices/pc8080/machine/vt100/machine-right.xml index 400ea5dac..de6b4b084 100644 --- a/devices/pc8080/machine/vt100/machine-right.xml +++ b/devices/pc8080/machine/vt100/machine-right.xml @@ -2,8 +2,7 @@ VT100 Terminal - - + diff --git a/devices/pc8080/machine/vt100/machine.xml b/devices/pc8080/machine/vt100/machine.xml index d146d8406..2e0329328 100644 --- a/devices/pc8080/machine/vt100/machine.xml +++ b/devices/pc8080/machine/vt100/machine.xml @@ -2,8 +2,7 @@ VT100 Terminal - - + diff --git a/devices/pdp11/machine/1170/panel/debugger/cpuexer/README.md b/devices/pdp11/machine/1170/panel/debugger/cpuexer/README.md index d17bf0be3..7543bdd34 100644 --- a/devices/pdp11/machine/1170/panel/debugger/cpuexer/README.md +++ b/devices/pdp11/machine/1170/panel/debugger/cpuexer/README.md @@ -6,7 +6,6 @@ machines: - id: test1170 type: pdp11 debugger: true - autoStart: true --- This machine runs the [11/70 CPU Instruction Exerciser](/apps/pdp11/tapes/diags/#md-11-1170-cpu-exerciser): MAINDEC-11-DEQKC-B1-PB. diff --git a/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md b/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md index dd4bade4a..72e413ca9 100644 --- a/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md +++ b/devices/pdp11/machine/1170/panel/debugger/xxdp/README.md @@ -17,11 +17,11 @@ commands: select rl11 listDrives RL0; select rl11 listDisks "XXDP+ Diagnostics"; click rl11 loadDisk; - click rl11 bootDisk + click rl11 bootDisk; --- -This machine is ready to boot [XXDP+ Diagnostics](/disks/dec/rl02k/xxdp/) ("BOOT RL0") and run -diagnostics (e.g., "R EKBEE1"): +This machine is ready to boot [XXDP+ Diagnostics](/disks/dec/rl02k/xxdp/) ("BOOT RL0") and run diagnostics +(e.g., "R EKBEE1"): - [EKBAD0: 11/70 CPU DIAGNOSTIC (PART 1)](/disks/dec/rl02k/xxdp/ekbad0/) - [EKBBF0: 11/70 CPU DIAGNOSTIC (PART 2)](/disks/dec/rl02k/xxdp/ekbbf0/) diff --git a/devices/pdp11/machine/1170/vt100/README.md b/devices/pdp11/machine/1170/vt100/README.md index 515aea2ed..4836a9797 100644 --- a/devices/pdp11/machine/1170/vt100/README.md +++ b/devices/pdp11/machine/1170/vt100/README.md @@ -13,8 +13,10 @@ machines: connection: serialPort->test1170.dl11 --- -{% include machine.html id="test1170" %} +This VT100 Terminal is connected to the PDP-11/70 below. + +Machine configurations with the [PCjs Debugger](debugger/) are also available. {% include machine.html id="vt100" %} -This PDP-11/70 is also available with our built-in [Debugger](debugger/). +{% include machine.html id="test1170" %} diff --git a/devices/pdp11/machine/1170/vt100/debugger/README.md b/devices/pdp11/machine/1170/vt100/debugger/README.md index 42a98712e..397443bf6 100644 --- a/devices/pdp11/machine/1170/vt100/debugger/README.md +++ b/devices/pdp11/machine/1170/vt100/debugger/README.md @@ -15,6 +15,10 @@ machines: connection: serialPort->test1170.dl11 --- -{% include machine.html id="test1170" %} +This VT100 Terminal is connected to the PDP-11/70 below. + +Both machines include a Debugger. Machine configurations [without Debuggers](../) are also available. {% include machine.html id="vt100" %} + +{% include machine.html id="test1170" %} diff --git a/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml b/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml index 7bb9395d8..022a412b8 100644 --- a/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml +++ b/devices/pdp11/machine/1170/vt100/debugger/machine-left.xml @@ -2,7 +2,7 @@ PDP-11/70 with 256Kb, Front Panel, and Debugger - + diff --git a/devices/pdp11/machine/1170/vt100/machine-left.xml b/devices/pdp11/machine/1170/vt100/machine-left.xml index 193a6af6c..a166a58f1 100644 --- a/devices/pdp11/machine/1170/vt100/machine-left.xml +++ b/devices/pdp11/machine/1170/vt100/machine-left.xml @@ -2,7 +2,7 @@ PDP-11/70 with 256Kb and Front Panel - + diff --git a/docs/pcx86/examples/pcx86-dbg.js b/docs/pcx86/examples/pcx86-dbg.js index 53c9b5b90..7b04db0a2 100644 --- a/docs/pcx86/examples/pcx86-dbg.js +++ b/docs/pcx86/examples/pcx86-dbg.js @@ -601,7 +601,7 @@ function uo(a){a.N&&a.C&&(a.Df&16&&!(a.Yb&64)?jg(a.N,a.C):ig(a.N,a.C))}var ro={0 function vo(a){this.Ca=a.adapter;switch(this.Ca){case 1:this.va=1016;this.ia=4;break;case 2:this.va=760;this.ia=3;break;default:w("Unrecognized serial adapter #"+this.Ca);return}this.V=this.W=null;this.Ga=a.tabSize;this.Ea=a.charBOL;this.ea=0;this.Ja=wo|xo;this.pa=!0;db.call(this,"SerialPort",a,vo,8388608);a=a.binding;"console"==a?this.W="":ob(this,a,yo);this.L=this.ua=this.Cc=null;this.exports={connect:this.zj,receiveData:this.hg,receiveStatus:this.ll}}gb(vo);var yo="buffer",wo=16,xo=32;l=vo.prototype; l.bj=function(a,b,c){var d=null;a!=this.xd||this.L||(this.L=b,this.Cc=c,this.pa=!1,d=this);return d};l.Pb=function(a,b,c){var d=this;switch(b){case yo:return this.qa[b]=this.V=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64");if(2==c.length){var d=qa(c[0]);if(d!=this.xd)return;c=qa(c[1]);if(this.L=lb(c)){var e=this.L.exports;if(e){var f=e.connect;f&&f.call(this.L,this.pa);if(this.ua=e.receiveData){this.pa=a;this.Cc=e.receiveStatus;this.status(this.ce+"."+d+" connected to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; +l.zj=function(a){if(!this.L){var b=Vc(this.X,"connection");if(b){var c=b.split("->");if(2==c.length){var d=qa(c[0]);if(d!=this.xd)return;c=qa(c[1]);if(this.L=lb(c)){var e=this.L.exports;if(e){var f=e.connect;f&&f.call(this.L,this.pa);if(this.ua=e.receiveData){this.pa=a;this.Cc=e.receiveStatus;this.status("Connected "+this.ce+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; l.hc=function(a,b){if(!b)if(this.zj(this.pa),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};l.gc=function(a){return a?this.save():!0};l.reset=function(){Bo(this)};l.save=function(){var a=new nf(this),b=0,c=[];c[b++]=this.ya;c[b++]=this.Da;c[b++]=this.fa;c[b++]=this.ka;c[b++]=this.U;c[b++]=this.C;c[b++]=this.ra;c[b++]=this.B;c[b++]=this.A;c[b]=this.aa;a.set(0,c);return a.data()};l.restore=function(a){return Bo(this,a[0])}; function Bo(a,b){var c=0;b||(b=[0,0,384,0,1,0,0,96,a.Ja,[]]);a.ya=b[c++];a.Da=b[c++];a.fa=b[c++];a.ka=b[c++];a.U=b[c++];a.C=b[c++];a.ra=b[c++];a.B=b[c++];a.A=b[c++];a.aa=b[c];return!0}l.hg=function(a){if("number"==typeof a)this.aa.push(a);else if("string"==typeof a)for(var b=0;b>8:this.ka;x(this,a,null,b,this.C&128?"DLM":"IER",c);return c};l.rm=function(a,b){var c=this.U;x(this,a,null,b,"IIR",c);return c};l.sm=function(a,b){var c=this.C;x(this,a,null,b,"LCR",c);return c};l.um=function(a,b){var c=this.ra;x(this,a,null,b,"MCR",c);return c}; @@ -654,7 +654,7 @@ l.Pb=function(a,b,c){var d=this;switch(b){case "listDisks":this.qa[b]=c;if(this. void 0===b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}};return!0;case "descDisk":case "listDrives":return this.qa[b]=c,c.onchange=function(){var a=ea(c.value,10);null!=a&&xp(d,a)},!0;case "loadDisk":return this.qa[b]=c,c.onclick=function(){var a=d.qa.listDisks;a&&yp(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDisk":if(!this.ia){c.parentNode.removeChild(c);break}this.qa[b]=c;c.onclick=function(){var a=d.qa.listDrives;a&&a.options&&d.A&&((a= d.A[ea(a.value,10)||0])?(a=a.za)?(a=Qa(tp(a),"octet-stream",!0,a.Ug.replace(".json",".img")),w(a)):d.Na("No diskette loaded in drive."):d.Na("No diskette drive selected."))};return!0;case "mountDisk":if(this.ia)return this.qa[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;yp(d,ja(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; l.Jc=function(a,b,c,d){this.ga=b;this.F=c;this.ha=d;this.X=a;this.N=Gb(a,"ChipSet");if((this.U=Vc(this.X,"autoMount")||this.U)&&"string"==typeof this.U)try{this.U=eval("("+this.U+")")}catch(e){w("FDC auto-mount error: "+e.message+" ("+this.U+")"),this.U=null}zp(this);nc(b,this,Ap);rc(b,this,Bp);Cp(this,"None","",!0);this.ia&&Cp(this,"Local Disk","?");Cp(this,"Remote Disk","??");Dp(this)||ub(this)}; -l.hc=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.X.lh){this.B=[];for(a=0;ak.za.restore(g)&&(A=!1),A&&void 0!==k.eb&&(k.pb=k.za.seek(k.be,k.kb,k.xb+k.sg)));A||(e=!1);null!=a.pa&& diff --git a/docs/pcx86/examples/pcx86.js b/docs/pcx86/examples/pcx86.js index 9bfd2ee60..8bbd80e10 100644 --- a/docs/pcx86/examples/pcx86.js +++ b/docs/pcx86/examples/pcx86.js @@ -562,7 +562,7 @@ l.gm=function(a,b){this.Me=b;Ml(this)};function Ml(a){a.S&&a.D&&(a.Me&16&&!(a.Db function Nl(a){this.oa=a.adapter;switch(this.oa){case 1:this.ka=1016;this.W=4;break;case 2:this.ka=760;this.W=3;break;default:r("Unrecognized serial adapter #"+this.oa);return}this.G=this.I=null;this.ra=a.tabSize;this.qa=a.charBOL;this.R=0;this.sa=Ol|Pl;this.Z=!0;Ma.call(this,"SerialPort",a,Nl);a=a.binding;"console"==a?this.I="":Xa(this,a,Ql);this.D=this.ga=this.Rc=null;this.exports={connect:this.wi,receiveData:this.jf,receiveStatus:this.$j}}Pa(Nl);var Ql="buffer",Ol=16,Pl=32;l=Nl.prototype; l.fi=function(a,b,c){var d=null;a!=this.Td||this.D||(this.D=b,this.Rc=c,this.Z=!1,d=this);return d};l.zb=function(a,b,c){var d=this;switch(b){case Ql:return this.la[b]=this.G=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64");if(2==c.length){var d=la(c[0]);if(d!=this.Td)return;c=la(c[1]);if(this.D=Ua(c)){var e=this.D.exports;if(e){var f=e.connect;f&&f.call(this.D,this.Z);if(this.ga=e.receiveData){this.Z=a;this.Rc=e.receiveStatus;this.status(this.Fe+"."+d+" connected to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; +l.wi=function(a){if(!this.D){var b=kc(this.ba,"connection");if(b){var c=b.split("->");if(2==c.length){var d=la(c[0]);if(d!=this.Td)return;c=la(c[1]);if(this.D=Ua(c)){var e=this.D.exports;if(e){var f=e.connect;f&&f.call(this.D,this.Z);if(this.ga=e.receiveData){this.Z=a;this.Rc=e.receiveStatus;this.status("Connected "+this.Fe+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; l.Ub=function(a,b){if(!b)if(this.wi(this.Z),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};l.Tb=function(a){return a?this.save():!0};l.reset=function(){Tl(this)};l.save=function(){var a=new ae(this),b=0,c=[];c[b++]=this.ma;c[b++]=this.pa;c[b++]=this.P;c[b++]=this.Y;c[b++]=this.H;c[b++]=this.L;c[b++]=this.da;c[b++]=this.C;c[b++]=this.B;c[b]=this.K;a.set(0,c);return a.data()};l.restore=function(a){return Tl(this,a[0])}; function Tl(a,b){var c=0;b||(b=[0,0,384,0,1,0,0,96,a.sa,[]]);a.ma=b[c++];a.pa=b[c++];a.P=b[c++];a.Y=b[c++];a.H=b[c++];a.L=b[c++];a.da=b[c++];a.C=b[c++];a.B=b[c++];a.K=b[c];return!0}l.jf=function(a){if("number"==typeof a)this.K.push(a);else if("string"==typeof a)for(var b=0;b>8:this.Y};l.cl=function(){return this.H};l.dl=function(){return this.L};l.fl=function(){return this.da};l.el=function(){return this.C};l.kl=function(){var a=this.B;this.B&=-4;return a}; @@ -603,7 +603,7 @@ l.zb=function(a,b,c){var d=this;switch(b){case "listDisks":this.la[b]=c;if(this. b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}};return!0;case "descDisk":case "listDrives":return this.la[b]=c,c.onchange=function(){var a=ea(c.value,10);null!=a&&vm(d,a)},!0;case "loadDisk":return this.la[b]=c,c.onclick=function(){var a=d.la.listDisks;a&&wm(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDisk":if(!this.Y){c.parentNode.removeChild(c);break}this.la[b]=c;c.onclick=function(){var a=d.la.listDrives;a&&a.options&&d.B&&((a=d.B[ea(a.value, 10)||0])?(a=a.ua)?(a=Ca(rm(a),"octet-stream",!0,a.th.replace(".json",".img")),r(a)):d.Ba("No diskette loaded in drive."):d.Ba("No diskette drive selected."))};return!0;case "mountDisk":if(this.Y)return this.la[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;wm(d,ga(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; l.pc=function(a,b,c,d){this.ia=b;this.A=c;this.Ia=d;this.ba=a;this.S=jb(a,"ChipSet");if((this.K=kc(this.ba,"autoMount")||this.K)&&"string"==typeof this.K)try{this.K=eval("("+this.K+")")}catch(e){r("FDC auto-mount error: "+e.message+" ("+this.K+")"),this.K=null}xm(this);Pb(b,this,ym);Rb(b,this,zm);Am(this,"None","",!0);this.Y&&Am(this,"Local Disk","?");Am(this,"Remote Disk","??");Bm(this)||t(this)}; -l.Ub=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.ba.pg){this.C=[];for(a=0;ak.ua.restore(g)&&(z=!1),z&&void 0!==k.Ua&&(k.Wa=k.ua.seek(k.Id,k.Ya,k.mb+k.yf)));z||(e=!1);null!=a.da&&1>=d&& diff --git a/modules/markout/lib/markout.js b/modules/markout/lib/markout.js index 241a96bdb..6f0db504f 100644 --- a/modules/markout/lib/markout.js +++ b/modules/markout/lib/markout.js @@ -534,7 +534,7 @@ MarkOut.prototype.convertMD = function(sIndent) * command lines, followed by the second command name, followed by one or more command lines, and so on. */ for (var iCommand = 1; iCommand < aCommands.length; iCommand += 2) { - this.aCommandDefs[aCommands[iCommand]] = aCommands[iCommand+1].trim().replace(/\n[ \t]*/g, "").replace(/"/g, """); + this.aCommandDefs[aCommands[iCommand]] = aCommands[iCommand+1].replace(/\n[ \t]*/g, " ").trim().replace(/"/g, """); } } diff --git a/modules/pc8080/lib/bus.js b/modules/pc8080/lib/bus.js index 0bcf8af2b..15c93095b 100644 --- a/modules/pc8080/lib/bus.js +++ b/modules/pc8080/lib/bus.js @@ -72,7 +72,7 @@ class Bus8080 extends Component { */ constructor(parmsBus, cpu, dbg) { - super("Bus", parmsBus, Bus8080); + super("Bus", parmsBus); this.cpu = cpu; this.dbg = dbg; diff --git a/modules/pc8080/lib/chipset.js b/modules/pc8080/lib/chipset.js index 8e7d5a53e..0c0f8924d 100644 --- a/modules/pc8080/lib/chipset.js +++ b/modules/pc8080/lib/chipset.js @@ -60,7 +60,7 @@ class ChipSet8080 extends Component { */ constructor(parmsChipSet) { - super("ChipSet", parmsChipSet, ChipSet8080, Messages8080.CHIPSET); + super("ChipSet", parmsChipSet, Messages8080.CHIPSET); var model = parmsChipSet['model']; diff --git a/modules/pc8080/lib/computer.js b/modules/pc8080/lib/computer.js index 7f1295fd9..50c938be8 100644 --- a/modules/pc8080/lib/computer.js +++ b/modules/pc8080/lib/computer.js @@ -112,7 +112,7 @@ class Computer8080 extends Component { */ constructor(parmsComputer, parmsMachine, fSuspended) { - super("Computer", parmsComputer, Computer8080, Messages8080.COMPUTER); + super("Computer", parmsComputer, Messages8080.COMPUTER); this.flags.powered = false; diff --git a/modules/pc8080/lib/cpu.js b/modules/pc8080/lib/cpu.js index 039375687..95d4207be 100644 --- a/modules/pc8080/lib/cpu.js +++ b/modules/pc8080/lib/cpu.js @@ -76,7 +76,7 @@ class CPU8080 extends Component { */ constructor(parmsCPU, nCyclesDefault) { - super("CPU", parmsCPU, CPU8080, Messages8080.CPU); + super("CPU", parmsCPU, Messages8080.CPU); var nCycles = parmsCPU['cycles'] || nCyclesDefault; diff --git a/modules/pc8080/lib/keyboard.js b/modules/pc8080/lib/keyboard.js index c880dd38b..351eef25d 100644 --- a/modules/pc8080/lib/keyboard.js +++ b/modules/pc8080/lib/keyboard.js @@ -59,7 +59,7 @@ class Keyboard8080 extends Component { */ constructor(parmsKbd) { - super("Keyboard", parmsKbd, Keyboard8080, Messages8080.KEYBOARD); + super("Keyboard", parmsKbd, Messages8080.KEYBOARD); var model = parmsKbd['model']; diff --git a/modules/pc8080/lib/panel.js b/modules/pc8080/lib/panel.js index f62a8dbfd..3fa920e53 100644 --- a/modules/pc8080/lib/panel.js +++ b/modules/pc8080/lib/panel.js @@ -55,7 +55,7 @@ class Panel8080 extends Component { */ constructor(parmsPanel) { - super("Panel", parmsPanel, Panel8080); + super("Panel", parmsPanel); } /** diff --git a/modules/pc8080/lib/ram.js b/modules/pc8080/lib/ram.js index 2b14e1687..7bbaa0b66 100644 --- a/modules/pc8080/lib/ram.js +++ b/modules/pc8080/lib/ram.js @@ -66,7 +66,7 @@ class RAM8080 extends Component { */ constructor(parmsRAM) { - super("RAM", parmsRAM, RAM8080); + super("RAM", parmsRAM); this.abInit = null; this.aSymbols = null; diff --git a/modules/pc8080/lib/rom.js b/modules/pc8080/lib/rom.js index b56e6b3dd..56cf1146f 100644 --- a/modules/pc8080/lib/rom.js +++ b/modules/pc8080/lib/rom.js @@ -66,7 +66,7 @@ class ROM8080 extends Component { */ constructor(parmsROM) { - super("ROM", parmsROM, ROM8080); + super("ROM", parmsROM); this.abROM = null; this.addrROM = parmsROM['addr']; diff --git a/modules/pc8080/lib/serial.js b/modules/pc8080/lib/serial.js index ca8df8056..e57c1b678 100644 --- a/modules/pc8080/lib/serial.js +++ b/modules/pc8080/lib/serial.js @@ -69,7 +69,7 @@ class SerialPort8080 extends Component { */ constructor(parmsSerial) { - super("SerialPort", parmsSerial, SerialPort8080, Messages8080.SERIAL); + super("SerialPort", parmsSerial, Messages8080.SERIAL); this.iAdapter = +parmsSerial['adapter']; @@ -397,7 +397,7 @@ class SerialPort8080 extends Component { if (this.sendData) { this.fNullModem = fNullModem; this.updateStatus = exports['receiveStatus']; - this.status(this.idMachine + '.' + sSourceID + " connected to " + sTargetID); + this.status("Connected " + this.idMachine + '.' + sSourceID + " to " + sTargetID); return; } } diff --git a/modules/pc8080/lib/video.js b/modules/pc8080/lib/video.js index 861699000..ab40d268c 100644 --- a/modules/pc8080/lib/video.js +++ b/modules/pc8080/lib/video.js @@ -101,7 +101,7 @@ class Video8080 extends Component { */ constructor(parmsVideo, canvas, context, textarea, container) { - super("Video", parmsVideo, Video8080, Messages8080.VIDEO); + super("Video", parmsVideo, Messages8080.VIDEO); var video = this; this.fGecko = Web.isUserAgent("Gecko/"); @@ -355,6 +355,48 @@ class Video8080 extends Component { return true; } + /** + * setBinding(sHTMLType, sBinding, control, sValue) + * + * @this {Video8080} + * @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas") + * @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "refresh") + * @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement) + * @param {string} [sValue] optional data value + * @return {boolean} true if binding was successful, false if unrecognized binding request + */ + setBinding(sHTMLType, sBinding, control, sValue) + { + var video = this; + + /* + * TODO: A more general-purpose binding mechanism would be nice someday.... + */ + if (sHTMLType == "led" || sHTMLType == "rled") { + this.ledBindings[sBinding] = control; + return true; + } + + switch (sBinding) { + case "fullScreen": + this.bindings[sBinding] = control; + if (this.container && this.container.doFullScreen) { + control.onclick = function onClickFullScreen() { + if (DEBUG) video.printMessage("fullScreen()"); + video.doFullScreen(); + }; + } else { + if (DEBUG) this.log("FullScreen API not available"); + control.parentNode.removeChild(/** @type {Node} */ (control)); + } + return true; + + default: + break; + } + return false; + } + /** * initBus(cmp, bus, cpu, dbg) * @@ -581,6 +623,11 @@ class Video8080 extends Component { */ powerUp(data, fRepower) { + if (!fRepower) { + if (data) { + if (!this.restore(data)) return false; + } + } /* * Because the VT100 frame buffer can be located anywhere in RAM (above 0x2000), we must defer this * test code until the powerUp() notification handler is called, when all RAM has (hopefully) been allocated. @@ -653,45 +700,45 @@ class Video8080 extends Component { } /** - * setBinding(sHTMLType, sBinding, control, sValue) + * powerDown(fSave, fShutdown) * * @this {Video8080} - * @param {string|null} sHTMLType is the type of the HTML control (eg, "button", "list", "text", "submit", "textarea", "canvas") - * @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "refresh") - * @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement) - * @param {string} [sValue] optional data value - * @return {boolean} true if binding was successful, false if unrecognized binding request + * @param {boolean} [fSave] + * @param {boolean} [fShutdown] + * @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure */ - setBinding(sHTMLType, sBinding, control, sValue) + powerDown(fSave, fShutdown) { - var video = this; + return !fSave || this.save(); + } - /* - * TODO: A more general-purpose binding mechanism would be nice someday.... - */ - if (sHTMLType == "led" || sHTMLType == "rled") { - this.ledBindings[sBinding] = control; - return true; - } + /** + * save() + * + * This implements save support for the Video8080 component. + * + * @this {Video8080} + * @return {Object|null} + */ + save() + { + var state = new State(this); + state.set(0, []); + return state.data(); + } - switch (sBinding) { - case "fullScreen": - this.bindings[sBinding] = control; - if (this.container && this.container.doFullScreen) { - control.onclick = function onClickFullScreen() { - if (DEBUG) video.printMessage("fullScreen()"); - video.doFullScreen(); - }; - } else { - if (DEBUG) this.log("FullScreen API not available"); - control.parentNode.removeChild(/** @type {Node} */ (control)); - } - return true; - - default: - break; - } - return false; + /** + * restore(data) + * + * This implements restore support for the Video8080 component. + * + * @this {Video8080} + * @param {Object} data + * @return {boolean} true if restore successful, false if not + */ + restore(data) + { + return true; } /** diff --git a/modules/pcx86/lib/fdc.js b/modules/pcx86/lib/fdc.js index 911de007d..11a3ad200 100644 --- a/modules/pcx86/lib/fdc.js +++ b/modules/pcx86/lib/fdc.js @@ -684,7 +684,7 @@ FDC.prototype.initBus = function(cmp, bus, cpu, dbg) FDC.prototype.powerUp = function(data, fRepower) { if (!fRepower) { - if (!data || !this.restore) { + if (!data) { this.reset(); if (this.cmp.fReload) { /* @@ -798,7 +798,7 @@ FDC.prototype.initController = function(data) var i = 0, iDrive; var fSuccess = true; - if (data === undefined) { + if (!data) { data = [0, 0, FDC.REG_STATUS.RQM, new Array(9), 0, 0, 0, []]; } @@ -1140,6 +1140,7 @@ FDC.prototype.saveDrives = function() * saveDrive(drive) * * @this {FDC} + * @param {Object} drive * @return {Array} */ FDC.prototype.saveDrive = function(drive) diff --git a/modules/pcx86/lib/hdc.js b/modules/pcx86/lib/hdc.js index e9aea46d5..3a5d63c5c 100644 --- a/modules/pcx86/lib/hdc.js +++ b/modules/pcx86/lib/hdc.js @@ -668,7 +668,7 @@ HDC.prototype.initBus = function(cmp, bus, cpu, dbg) HDC.prototype.powerUp = function(data, fRepower) { if (!fRepower) { - if (!data || !this.restore) { + if (!data) { this.initController(); if (this.cmp.fReload) { /* diff --git a/modules/pcx86/lib/serial.js b/modules/pcx86/lib/serial.js index 3c3accf01..532390013 100644 --- a/modules/pcx86/lib/serial.js +++ b/modules/pcx86/lib/serial.js @@ -507,7 +507,7 @@ SerialPort.prototype.initConnection = function(fNullModem) if (this.sendData) { this.fNullModem = fNullModem; this.updateStatus = exports['receiveStatus']; - this.status(this.idMachine + '.' + sSourceID + " connected to " + sTargetID); + this.status("Connected " + this.idMachine + '.' + sSourceID + " to " + sTargetID); return; } } diff --git a/modules/pdp11/bin/pdp11 b/modules/pdp11/bin/pdp11 index f490412e0..f4a2ef054 100644 --- a/modules/pdp11/bin/pdp11 +++ b/modules/pdp11/bin/pdp11 @@ -83,7 +83,7 @@ var aComponents = []; var asComponentsIgnore = ["embed", "save"]; /* - * A few of the components are subclasses of other classes (eg, "cpustate" is a subclass of "cpu"). + * A few of the components are subclasses of other classes (eg, "cpustate" subclasses "cpu"). * In those situations, we "hoist" the subclass constructor into the corresponding superclass, * because it is the name of the superclass that we rely on during machine initialization. */ @@ -91,7 +91,7 @@ var aSubClasses = { "pdp11/lib/cpustate": "pdp11/lib/cpu", "pdp11/lib/debugger": "shared/es6/debugger" }; - + /** * loadComponents(asFiles) * diff --git a/modules/pdp11/lib/bus.js b/modules/pdp11/lib/bus.js index 768f2a949..04b8bb59d 100644 --- a/modules/pdp11/lib/bus.js +++ b/modules/pdp11/lib/bus.js @@ -5,9 +5,9 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. + * It has been adapted from the JavaScript PDP 11/70 Emulator written by Paul Nankervis + * (paulnank@hotmail.com) at . This code may be used + * freely provided the original authors are acknowledged in any modified source code. * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 @@ -54,7 +54,7 @@ if (NODE) { * count: BitField, * btmod: BitField, * type: BitField - * }} BlockInfoPDP11 + * }} */ var BlockInfoPDP11 = Usr.defineBitFields({num:20, count:8, btmod:1, type:3}); @@ -69,7 +69,7 @@ var BlockInfoPDP11 = Usr.defineBitFields({num:20, count:8, btmod:1, type:3}); * cbTotal: number, * cBlocks: number, * aBlocks: Array. - * }} BusInfoPDP11 + * }} */ var BusInfoPDP11; @@ -95,7 +95,7 @@ class BusPDP11 extends Component { */ constructor(parmsBus, cpu, dbg) { - super("Bus", parmsBus, BusPDP11, MessagesPDP11.BUS); + super("Bus", parmsBus, MessagesPDP11.BUS); this.cpu = cpu; this.dbg = dbg; @@ -456,7 +456,7 @@ class BusPDP11 extends Component { } if (sizeLeft <= 0) { - this.status((size >> 10) + "Kb " + MemoryPDP11.TYPE_NAMES[type] + " at " + Str.toOct(addr)); + this.status("Added " + (size >> 10) + "Kb " + MemoryPDP11.TYPE_NAMES[type] + " at " + Str.toOct(addr)); return true; } diff --git a/modules/pdp11/lib/computer.js b/modules/pdp11/lib/computer.js index 5b812aac4..c5de07d37 100644 --- a/modules/pdp11/lib/computer.js +++ b/modules/pdp11/lib/computer.js @@ -5,10 +5,6 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. - * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. @@ -108,7 +104,7 @@ class ComputerPDP11 extends Component { */ constructor(parmsComputer, parmsMachine, fSuspended) { - super("Computer", parmsComputer, ComputerPDP11, MessagesPDP11.COMPUTER); + super("Computer", parmsComputer, MessagesPDP11.COMPUTER); this.flags.powered = false; @@ -186,7 +182,7 @@ class ComputerPDP11 extends Component { this.println(PDP11.APPNAME + " v" + PDP11.APPVERSION + "\n" + COPYRIGHT + "\n" + LICENSE); - this.println("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis "); + this.println("Portions adapted from the PDP-11/70 Emulator by Paul Nankervis "); if (DEBUG && this.messageEnabled()) this.printMessage("TYPEDARRAYS: " + TYPEDARRAYS); @@ -731,7 +727,7 @@ class ComputerPDP11 extends Component { * TODO: Do we not care about the return value here? (ie, is checking fRestoreError sufficient)? */ this.powerRestore(this.cpu, stateComputer, fRepower, fRestore); - this.updateDisplays(); + this.updateDisplays(-2); this.cpu.autoStart(); } @@ -853,7 +849,10 @@ class ComputerPDP11 extends Component { * after they're no longer ready. */ if (this.cpu && this.cpu.powerDown) { - if (fShutdown) this.cpu.stopCPU(); + if (fShutdown) { + if (fSave) this.cpu.flags.autoStart = this.cpu.flags.running; + this.cpu.stopCPU(); + } data = this.cpu.powerDown(fSave, fShutdown); if (typeof data === "object") stateComputer.set(this.cpu.id, data); if (fShutdown) { diff --git a/modules/pdp11/lib/cpu.js b/modules/pdp11/lib/cpu.js index 64cd360ec..4ece95c03 100644 --- a/modules/pdp11/lib/cpu.js +++ b/modules/pdp11/lib/cpu.js @@ -5,10 +5,6 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. - * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. @@ -97,7 +93,7 @@ class CPUPDP11 extends Component { */ constructor(parmsCPU, nCyclesDefault) { - super("CPU", parmsCPU, CPUPDP11, MessagesPDP11.CPU); + super("CPU", parmsCPU, MessagesPDP11.CPU); var nCycles = +parmsCPU['cycles'] || nCyclesDefault; @@ -120,8 +116,7 @@ class CPUPDP11 extends Component { /* * We add a number of flags to the set initialized by Component */ - this.flags.running = false; - this.flags.starting = false; + this.flags.running = this.flags.starting = false; this.flags.autoStart = parmsCPU['autoStart']; if (typeof this.flags.autoStart == "string") this.flags.autoStart = (this.flags.autoStart == "true"); @@ -267,7 +262,7 @@ class CPUPDP11 extends Component { * However, we don't actually need to check all that; it's always safe use println(), regardless whether * a Control Panel with a "print" control is present or not. */ - this.println("No debugger detected"); + this.status("No debugger detected"); } if (!this.flags.autoStart) { this.println("CPU will not be auto-started " + (this.panel? "(click Run to start)" : "(type 'go' to start)")); @@ -996,6 +991,37 @@ class CPUPDP11 extends Component { return nCycles; } + /** + * saveTimers() + * + * @this {CPUPDP11} + * @return {Array.} + */ + saveTimers() + { + var aTimerCycles = []; + for (var i = 0; i < this.aTimers.length; i++) { + var timer = this.aTimers[i]; + aTimerCycles.push(timer[0]); + } + return aTimerCycles; + } + + /** + * restoreTimers(aTimerCycles) + * + * @this {CPUPDP11} + * @param {Array.} aTimerCycles + */ + restoreTimers(aTimerCycles) + { + this.assert(aTimerCycles.length === this.aTimers.length); + for (var i = 0; i < this.aTimers.length && i < aTimerCycles.length; i++) { + var timer = this.aTimers[i]; + timer[0] = aTimerCycles[i]; + } + } + /** * updateTimers(nCycles) * diff --git a/modules/pdp11/lib/cpuops.js b/modules/pdp11/lib/cpuops.js index 9066a4146..a1cfcdf12 100644 --- a/modules/pdp11/lib/cpuops.js +++ b/modules/pdp11/lib/cpuops.js @@ -5,9 +5,9 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. + * It has been adapted from the JavaScript PDP 11/70 Emulator written by Paul Nankervis + * (paulnank@hotmail.com) at . This code may be used + * freely provided the original authors are acknowledged in any modified source code. * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 @@ -490,6 +490,33 @@ PDP11.opADCB = function(opCode) /** * opADD(opCode) * + * From the PDP-11/20 Processor HandBook (1971), p. 61: + * + * Add src,dst (06SSDD) + * + * Operation: + * (dst) = (src) + (dst) + * + * Condition Codes: + * N: set if result < 0; cleared otherwise + * Z: set if result = 0; cleared otherwise + * V: set if there was arithmetic overflow as a result of the operation, that is both operands + * were of the same sign and the result was of the opposite sign; cleared otherwise + * C: set if there was a carry from the most significant bit of the result; cleared otherwise + * + * Description: + * Adds the source operand to the destination operand and stores the result at the destination address. + * The original contents of the destination are lost. The contents of the source are not affected. + * Two's complement addition is performed. + * + * Examples: + * Add to register: ADD 20,R0 + * Add to memory: ADD R1,XXX + * Add register to register: ADD R1,R2 + * Add memory to memory: ADD @#17750,XXX + * + * XXX is a programmer-defined mnemonic for a memory location. + * * @this {CPUStatePDP11} * @param {number} opCode */ @@ -1101,7 +1128,7 @@ PDP11.opDIV = function(opCode) this.regsGen[reg] = this.regsGen[reg | 1] = 1; // etc } } - this.nStepCycles -= (52 + 1); // 52 is the mean of the shortest and longest times + this.nStepCycles -= (52 + 1); // 52 is the average of the shortest and longest times } }; @@ -1325,6 +1352,7 @@ PDP11.opMFPI = function(opCode) */ PDP11.opMFPS = function(opCode) { + //noinspection JSUnresolvedFunction PDP11.opUndefined.call(this, opCode); }; @@ -1347,6 +1375,7 @@ PDP11.opMFPS = function(opCode) */ PDP11.opMFPT = function(opCode) { + //noinspection JSUnresolvedFunction PDP11.opUndefined.call(this, opCode); }; @@ -1442,6 +1471,7 @@ PDP11.opMTPI = function(opCode) */ PDP11.opMTPS = function(opCode) { + //noinspection JSUnresolvedFunction PDP11.opUndefined.call(this, opCode); }; @@ -1539,8 +1569,20 @@ PDP11.opRESET = function(opCode) * that the last CNSW.writeWord(177570) was for 000101, not 166667. So I'm guessing that the RESET * instruction is supposed to propagate R0 to the console's DISPLAY register. * - * This is similar to what we do for the HALT instruction on the PDP-11/20. None of these Console features - * seem to be very well documented (assuming they exist). + * This is similar to what we do for the HALT instruction (but only if this.model == PDP11.MODEL_1120). + * These Console features do not seem to be very well documented, assuming they exist. + * + * UPDATE: This behavior appears to be confirmed by remarks in the PDP-11/20 Processor Handbook (1971), + * p. 141: + * + * HALT - displays processor register R0 when bus control is transferred to console during a HALT + * instruction. + * + * RESET - displays register R0 for during [duration?] of RESET (70 msec). + * + * I haven't found similar remarks in the PDP-11/70 Processor Handbooks, so I'm not sure if that's an + * oversight or if 11/70 panels are slightly different in this regard. It's also not clear what they meant + * by "for duration of RESET". Is something supposed to happen to the DATA lights after the RESET is done? */ this.panel.setData(this.regsGen[0], true); } @@ -1786,6 +1828,35 @@ PDP11.opSPL = function(opCode) /** * opSUB(opCode) * + * From the PDP-11/20 Processor HandBook (1971), p. 62: + * + * Subtract src,dst (16SSDD) + * + * Operation: + * (dst) = (dst) - (src) [in detail, (dst) + ~(src) + 1 (dst)] + * + * Condition Codes: + * N: set if result < 0; cleared otherwise + * Z: set if result = 0; cleared otherwise + * V: set if there was arithmetic overflow as a result of the operation, that is if operands were of + * opposite signs and the sign of the source was the same as the sign of the result; cleared otherwise + * C: cleared if there was a carry from the most significant bit of the result; set otherwise + * + * Description: + * Subtracts the source operand from the destination operand and leaves the result at the destination address. + * The orignial [sic] contents of the destination are lost. The contents of the source are not affected. + * In double-precision arithmetic the C-bit, when set, indicates a "borrow". + * + * Example: + * SUB R1,R2 + * + * BEFORE AFTER + * (R1) = 011111 (R2) = 012345 + * (R1) = 011111 (R2) = 001234 + * + * NZVC NZVC + * 1111 0001 + * * @this {CPUStatePDP11} * @param {number} opCode */ diff --git a/modules/pdp11/lib/cpustate.js b/modules/pdp11/lib/cpustate.js index 0c9fd85f0..2eb6e4599 100644 --- a/modules/pdp11/lib/cpustate.js +++ b/modules/pdp11/lib/cpustate.js @@ -5,9 +5,9 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. + * It has been adapted from the JavaScript PDP 11/70 Emulator written by Paul Nankervis + * (paulnank@hotmail.com) at . This code may be used + * freely provided the original authors are acknowledged in any modified source code. * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 @@ -74,7 +74,7 @@ if (NODE) { * priority: number, * message: number, * next: (IRQ|null) - * }} IRQ + * }} */ var IRQ; @@ -117,25 +117,22 @@ class CPUStatePDP11 extends CPUPDP11 { * These properties will be initialized by initCPU() */ this.flagC = this.flagV = this.flagZ = this.flagN = 0; - this.regPSW = 0; - this.regsGen = this.regsAlt = this.regsAltStack = []; - this.pswMode = 0; - this.mapMMR3 = []; - this.mmuPDR = this.mmuPAR = this.regsUniMap = this.regsControl = []; - this.regMBR = 0; - this.opFlags = 0; - this.srcMode = this.srcReg = 0; - this.dstMode = this.dstReg = this.dstAddr = 0; + this.regPSW = this.pswMode = 0; this.pswTrap = 0; + this.regsGen = this.regsAlt = this.regsAltStack = []; + this.regsPAR = this.regsPDR = this.regsUniMap = this.regsControl = []; + this.opFlags = 0; /* * These properties will be initialized by initMMU() */ this.regMMR0 = this.regMMR1 = this.regMMR2 = this.regMMR3 = 0; - this.regErr = this.regPIR = this.regSLR = 0; + this.regErr = this.regMBR = this.regPIR = this.regSLR = 0; this.mmuEnable = this.mmuLastMode = this.mmuLastPage = this.mmuMask = 0; this.addrLast = this.opLast = this.addrInvalid = 0; + this.mapMMR3 = [4,2,0,1]; // map from mode to MMR3 I/D bit + /* * Initialize processor operation to match the requested model. * @@ -167,6 +164,7 @@ class CPUStatePDP11 extends CPUPDP11 { } this.nDisableTraps = 0; + this.trapVector = this.trapReason = 0; /** @type {IRQ|null} */ this.irqNext = null; // the head of the active IRQ list, in priority order @@ -174,8 +172,6 @@ class CPUStatePDP11 extends CPUPDP11 { /** @type {Array.} */ this.aIRQs = []; // list of all IRQs, active or not (to be used for auto-configuration) - this.flags.complete = false; - this.getByte = this.getByteDirect = this.getByteChecked; this.getWord = this.getWordDirect = this.getWordChecked; this.setByte = this.setByteDirect = this.setByteChecked; @@ -187,7 +183,10 @@ class CPUStatePDP11 extends CPUPDP11 { this.readWord = this.readWordFromVirtual; this.writeWord = this.writeWordToVirtual; - this.trapVector = this.trapReason = 0; + this.srcMode = this.srcReg = 0; + this.dstMode = this.dstReg = this.dstAddr = 0; + + this.flags.complete = false; } /** @@ -271,36 +270,37 @@ class CPUStatePDP11 extends CPUPDP11 { this.flagZ = f; // PSW Z bit (TODO: Why do we clear instead of set Z, like other flags?) this.flagN = 0x8000; // PSW N bit this.regPSW = 0x000f; // PSW other bits (TODO: What's the point of setting the flag bits here, too?) + this.regsGen = [ // General R0-R7 0, 0, 0, 0, 0, 0, 0, this.addrReset, -1, -2, -3, -4, -5, -6, -7, -8 ]; - this.regsAlt = [ // Alternate R0-R5 0, 0, 0, 0, 0, 0 ]; this.regsAltStack = [ // Alternate R6 stack pointers (KERNEL, SUPER, UNUSED, USER) 0, 0, 0, 0 ]; - this.pswMode = 0; // current memory management mode (see PDP11.MODE.KERNEL | SUPER | UNUSED | USER) - this.mapMMR3 = [4,2,0,1]; // map from mode to MMR3 I/D bit - this.mmuPDR = [ // memory management PDR registers by mode - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // KERNEL (8 KIPDR regs followed by 8 KDPDR regs) - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // SUPER (8 SIPDR regs followed by 8 SDPDR regs) - [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f], // mode 2 (not used) - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // USER (8 UIPDR regs followed by 8 UDPDR regs) - ]; - this.mmuPAR = [ // memory management PAR registers by mode + this.regsPAR = [ // memory management PAR registers by mode [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // KERNEL (8 KIPAR regs followed by 8 KDPAR regs) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // SUPER (8 SIPDR regs followed by 8 SDPDR regs) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // mode 2 (not used) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // USER (8 UIPDR regs followed by 8 UDPDR regs) ]; + this.regsPDR = [ // memory management PDR registers by mode + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // KERNEL (8 KIPDR regs followed by 8 KDPDR regs) + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // SUPER (8 SIPDR regs followed by 8 SDPDR regs) + [f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f], // mode 2 (not used) + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // USER (8 UIPDR regs followed by 8 UDPDR regs) + ]; this.regsUniMap = [ // 32 UNIBUS map registers 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 ]; this.regsControl = [ // various control registers (177740-177756) we don't really care about 0, 0, 0, 0, 0, 0, 0, 0 ]; + + this.pswMode = 0; // current memory management mode (see PDP11.MODE.KERNEL | SUPER | UNUSED | USER) + this.pswTrap = -1; this.regMBR = 0; /* @@ -317,8 +317,6 @@ class CPUStatePDP11 extends CPUPDP11 { this.srcMode = this.srcReg = 0; this.dstMode = this.dstReg = this.dstAddr = 0; - this.pswTrap = -1; - this.initMMU(); } @@ -358,7 +356,7 @@ class CPUStatePDP11 extends CPUPDP11 { /* * This stores the PC in the lower 16 bits, and any auto-incs or auto-decs from the last opcode in the * upper 16 bits; the lower 16 bits are used to update MMR2, and the upper 16 bits are used to update MMR1. - * The upper bits are automatically zeroed at the start of every operation when PC is copied to opLast. + * The upper bits are automatically zeroed at the start of every operation when the PC is copied to opLast. */ this.opLast = 0; @@ -579,10 +577,11 @@ class CPUStatePDP11 extends CPUPDP11 { { this.addrReset = addr; - this.resetCPU(); this.setPC(addr); this.setPSW(0); + this.resetCPU(); + if (fStart) { /* * TODO: Review. I'm zeroing R2-R5 in the fStart case (ie, for boot code) simply because that's what I @@ -591,20 +590,28 @@ class CPUStatePDP11 extends CPUPDP11 { for (var i = 2; i <= 5; i++) { this.regsGen[i] = 0; } - if (!this.isRunning()) this.startCPU(); + if (!this.flags.powered) { + this.flags.autoStart = true; + } + else if (!this.flags.running) { + this.startCPU(); + } } else { - if (this.dbg) { + if (this.dbg && this.flags.powered) { /* * TODO: Review the decision to always stop the CPU if the Debugger is loaded. Note that - * when stopCPU() stops a running CPU, the Debugger gets notified, so again, no need to notify it here. + * when stopCPU() stops a running CPU, the Debugger gets notified, so no need to notify it again. * * TODO: There are more serious problems to deal with if another component is slamming a new PC down - * the CPU's throat (presumably while also dropping some new code into RAM) while the CPU was still running; - * we should probably force a complete reset if the CPU is running, but for now, it's up to the user - * to hit the reset button themselves. + * the CPU's throat (presumably while also dropping some new code into RAM) while the CPU is running; + * we should probably force a complete reset, but for now, it's up to the user to hit the reset button + * themselves. */ - if (!this.stopCPU()) this.dbg.updateStatus(); + if (!this.stopCPU()) { + this.dbg.updateStatus(); + this.cmp.updateDisplays(-1); + } } else if (fStart === false) { this.stopCPU(); @@ -639,30 +646,27 @@ class CPUStatePDP11 extends CPUPDP11 { this.regsGen, this.regsAlt, this.regsAltStack, + this.regsPAR, + this.regsPDR, this.regsUniMap, this.regsControl, this.regErr, this.regMBR, this.regPIR, this.regSLR, - this.pswTrap, - this.pswMode, - this.opFlags, - this.regMMR0, - this.regMMR1, - this.regMMR2, - this.regMMR3, this.mmuLastMode, this.mmuLastPage, - this.mmuPDR, - this.mmuPAR, - this.mmuEnable, - this.mmuMask, this.addrLast, - this.opLast + this.opFlags, + this.opLast, + this.pswTrap, + this.trapReason, + this.trapVector ]); - state.set(1, [this.getPSW()]); - state.set(2, [this.nTotalCycles, this.getSpeed()]); + state.set(1, [this.getPSW(),this.getMMR0(),this.getMMR1(),this.getMMR2(),this.getMMR3()]); + state.set(2, [this.nTotalCycles, this.getSpeed(), this.flags.autoStart]); + state.set(3, this.saveIRQs()); + state.set(4, this.saveTimers()); return state.data(); } @@ -675,45 +679,46 @@ class CPUStatePDP11 extends CPUPDP11 { */ restore(data) { - var a; /* - * ES6 ALERT: Gotta love these destructuring assignments, which make it easy to perform the inverse + * ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse * of what save() does when it collects a bunch of object properties into an array. */ [ this.regsGen, this.regsAlt, this.regsAltStack, + this.regsPAR, + this.regsPDR, this.regsUniMap, this.regsControl, this.regErr, this.regMBR, this.regPIR, this.regSLR, - this.pswTrap, - this.pswMode, - this.opFlags, - this.regMMR0, - this.regMMR1, - this.regMMR2, - this.regMMR3, this.mmuLastMode, this.mmuLastPage, - this.mmuPDR, - this.mmuPAR, - this.mmuEnable, - this.mmuMask, this.addrLast, - this.opLast + this.opFlags, + this.opLast, + this.pswTrap, + this.trapReason, + this.trapVector ] = data[0]; - a = data[1]; + var a = data[1]; this.setPSW(a[0]); + this.setMMR0(a[1]); + this.regMMR1 = a[2]; + this.regMMR2 = a[3]; + this.setMMR3(a[4]); a = data[2]; this.nTotalCycles = a[0]; this.setSpeed(a[1]); + this.flags.autoStart = a[2]; + this.restoreIRQs(data[3]); + this.restoreTimers(data[4]); return true; } @@ -985,8 +990,7 @@ class CPUStatePDP11 extends CPUPDP11 { */ addIRQ(vector, priority, message) { - var irq = {vector: vector, priority: priority, message: message || 0, next: null}; - irq.name = PDP11.VECTORS[vector]; + var irq = {vector: vector, priority: priority, message: message || 0, name: PDP11.VECTORS[vector], next: null}; this.aIRQs.push(irq); return irq; } @@ -1087,6 +1091,22 @@ class CPUStatePDP11 extends CPUPDP11 { } } + /** + * findIRQ(vector) + * + * @this {CPUStatePDP11} + * @param {number} vector + * @return {IRQ|null} + */ + findIRQ(vector) + { + for (var i = 0; i < this.aIRQs.length; i++) { + var irq = this.aIRQs[i]; + if (irq.vector === vector) return irq; + } + return null; + } + /** * checkIRQs(priority) * @@ -1109,6 +1129,41 @@ class CPUStatePDP11 extends CPUPDP11 { this.irqNext = null; } + /** + * saveIRQs() + * + * @this {CPUStatePDP11} + * @return {Array.} + */ + saveIRQs() + { + var aIRQVectors = []; + var irq = this.irqNext; + while (irq) { + aIRQVectors.push(irq.vector); + irq = irq.next; + } + return aIRQVectors; + } + + /** + * restoreIRQs(aIRQVectors) + * + * @this {CPUStatePDP11} + * @param {Array.} aIRQVectors + */ + restoreIRQs(aIRQVectors) + { + for (var i = aIRQVectors.length - 1; i >= 0; i--) { + var irq = this.findIRQ(aIRQVectors[i]); + this.assert(irq != null); + if (irq) { + irq.next = this.irqNext; + this.irqNext = irq; + } + } + } + /** * checkInterrupts() * @@ -1615,8 +1670,8 @@ class CPUStatePDP11 extends CPUPDP11 { * These next properties (in conjunction with setting PDP11.OPFLAG.TRAP_LAST) are purely an aid for the Debugger; * see getTrapStatus(). */ - this.trapVector = vector; this.trapReason = reason; + this.trapVector = vector; if (reason == PDP11.REASON.PANIC) { this.stopCPU(); @@ -1757,9 +1812,9 @@ class CPUStatePDP11 extends CPUPDP11 { var page = addr >> 13; if (page > 7) mode |= 1; if (!(this.regMMR3 & this.mapMMR3[this.pswMode])) page &= 7; - var pdr = this.mmuPDR[this.pswMode][page]; + var pdr = this.regsPDR[this.pswMode][page]; var off = addr & 0x1fff; - var paf = (this.mmuPAR[this.pswMode][page] << 6); + var paf = (this.regsPAR[this.pswMode][page] << 6); addrPhysical = (paf + off) & this.mmuMask; if (addrPhysical >= BusPDP11.UNIBUS_22BIT) addrPhysical = this.mapUnibus(addrPhysical); a.push(addrPhysical); // a[0] @@ -1838,8 +1893,8 @@ class CPUStatePDP11 extends CPUPDP11 { page = addrVirtual >> 13; if (!(this.regMMR3 & this.mapMMR3[this.pswMode])) page &= 7; - pdr = this.mmuPDR[this.pswMode][page]; - addr = ((this.mmuPAR[this.pswMode][page] << 6) + (addrVirtual & 0x1fff)) & this.mmuMask; + pdr = this.regsPDR[this.pswMode][page]; + addr = ((this.regsPAR[this.pswMode][page] << 6) + (addrVirtual & 0x1fff)) & this.mmuMask; if (addr >= BusPDP11.UNIBUS_22BIT) addr = this.mapUnibus(addr); @@ -1928,7 +1983,7 @@ class CPUStatePDP11 extends CPUPDP11 { /* * Aborts and traps: log FIRST trap and MOST RECENT abort */ - this.mmuPDR[this.pswMode][page] = pdr; + this.regsPDR[this.pswMode][page] = pdr; if (addr != ((BusPDP11.IOPAGE_22BIT | PDP11.UNIBUS.MMR0) & this.mmuMask) || this.pswMode) { this.mmuLastMode = this.pswMode; this.mmuLastPage = page; @@ -2818,6 +2873,7 @@ class CPUStatePDP11 extends CPUPDP11 { fnFlags.call(this, data << 8); } else { var addr = this.getAddr(mode, reg, PDP11.ACCESS.WRITE_BYTE); + //noinspection JSUnresolvedFunction fnFlags.call(this, (data = data < 0? (this.regsGen[-data-1] & 0xff) : data) << 8); this.setByte(addr, data); if (addr & 1) this.nStepCycles--; @@ -2843,9 +2899,11 @@ class CPUStatePDP11 extends CPUPDP11 { if (!mode) { this.regsGen[reg] = (data = data < 0? this.regsGen[-data-1] : data); + //noinspection JSUnresolvedFunction fnFlags.call(this, data); } else { var addr = this.getAddr(mode, reg, PDP11.ACCESS.WRITE_WORD); + //noinspection JSUnresolvedFunction fnFlags.call(this, (data = data < 0? this.regsGen[-data-1] : data)); this.setWord(addr, data); } @@ -2974,7 +3032,7 @@ class CPUStatePDP11 extends CPUPDP11 { } while (this.nStepCycles > 0); - return (this.flags.complete? this.nBurstCycles - this.nStepCycles : (this.flags.complete === undefined? 0 : -1)); + return (this.flags.complete? this.nBurstCycles - this.nStepCycles : (this.flags.complete === false? -1 : 0)); } /** diff --git a/modules/pdp11/lib/debugger.js b/modules/pdp11/lib/debugger.js index 63412c2a5..891cea6f6 100644 --- a/modules/pdp11/lib/debugger.js +++ b/modules/pdp11/lib/debugger.js @@ -5,10 +5,6 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. - * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. @@ -63,7 +59,7 @@ if (NODE) { * nBase:(number|undefined), * sCmd:(string|undefined), * aCmds:(Array.|undefined) - * }} DbgAddrPDP11 + * }} */ var DbgAddrPDP11; @@ -1270,8 +1266,8 @@ class DebuggerPDP11 extends Debugger { // this.println(data? "resuming" : "powering up"); - if (data && this.restore) { - if (!this.restore(data)) return false; + if (data) { + return this.restore(data); } } return true; @@ -1593,7 +1589,7 @@ class DebuggerPDP11 extends Debugger { checkMemoryRead(addr, nb) { if (this.checkBreakpoint(addr, nb || 1, this.aBreakRead)) { - this.stopCPU(true); + this.stopCPU(false); return true; } return false; @@ -1618,7 +1614,7 @@ class DebuggerPDP11 extends Debugger { checkMemoryWrite(addr, nb) { if (this.checkBreakpoint(addr, nb || 1, this.aBreakWrite)) { - this.stopCPU(true); + this.stopCPU(false); return true; } return false; @@ -1662,6 +1658,7 @@ class DebuggerPDP11 extends Debugger { * requires reading memory that triggers more memory reads, which triggers more breakpoint checks. */ this.nSuppressBreaks = 0; + this.nBreakInstructions = 0; } /** @@ -2706,25 +2703,16 @@ class DebuggerPDP11 extends Debugger { * * As the "help" output below indicates, the following breakpoint commands are supported: * - * bp [a] set exec breakpoint on linear addr [a] - * br [a] set read breakpoint on linear addr [a] - * bw [a] set write breakpoint on linear addr [a] - * bc [a] clear breakpoint on linear addr [a] (use "*" for all breakpoints) - * bl list breakpoints + * bp # set exec breakpoint + * br # set read breakpoint + * bw # set write breakpoint + * bc # clear breakpoint (* to clear all) + * bl list all breakpoints + * bn [#] break after # instruction(s) * - * to which we have recently added the following I/O breakpoint commands: - * - * bi [p] toggle input breakpoint on port [p] (use "*" for all input ports) - * bo [p] toggle output breakpoint on port [p] (use "*" for all output ports) - * - * These two new commands operate as toggles so that if "*" is used to trap all input (or output), - * you can also use these commands to NOT trap specific ports. - * - * bn [n] break after [n] instructions - * - * TODO: Update the "bl" command to include any/all I/O breakpoints, and the "bc" command to - * clear them. Because "bi" and "bo" commands are piggy-backing on Bus functions, those breakpoints - * are currently outside the realm of what the "bl" and "bc" commands are aware of. + * The "bn" command, like the "dh" command and all other commands that use an instruction count, + * assumes a decimal value, regardless of the current base. Use "bn" without an argument to display + * the break count, and use "bn 0" to clear the break count. * * @this {DebuggerPDP11} * @param {string} sCmd @@ -2735,10 +2723,10 @@ class DebuggerPDP11 extends Debugger { { if (sAddr == '?') { this.println("breakpoint commands:"); - this.println("\tbp [#]\tset exec breakpoint at addr #"); - this.println("\tbr [#]\tset read breakpoint at addr #"); - this.println("\tbw [#]\tset write breakpoint at addr #"); - this.println("\tbc [#]\tclear breakpoint at addr #"); + this.println("\tbp #\tset exec breakpoint"); + this.println("\tbr #\tset read breakpoint"); + this.println("\tbw #\tset write breakpoint"); + this.println("\tbc #\tclear breakpoint (* to clear all)"); this.println("\tbl\tlist all breakpoints"); this.println("\tbn [#]\tbreak after # instruction(s)"); return; @@ -2755,8 +2743,9 @@ class DebuggerPDP11 extends Debugger { } if (sParm == 'n') { - this.nBreakInstructions = this.parseValue(sAddr); - this.println("break after " + this.nBreakInstructions + " instruction(s)"); + var n = +sAddr || 0; + if (sAddr) this.nBreakInstructions = n; + this.println("break after " + n + " instruction(s)"); return; } diff --git a/modules/pdp11/lib/defines.js b/modules/pdp11/lib/defines.js index bb4a5358e..e6e6c45a9 100644 --- a/modules/pdp11/lib/defines.js +++ b/modules/pdp11/lib/defines.js @@ -5,9 +5,9 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. + * It has been adapted from the JavaScript PDP 11/70 Emulator written by Paul Nankervis + * (paulnank@hotmail.com) at . This code may be used + * freely provided the original authors are acknowledged in any modified source code. * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 @@ -690,6 +690,7 @@ var PDP11 = { RK11: { // RK11 Disk Controller PRI: 5, VEC: 0o220, + DRIVES: 8, // maximum of 8 drives RKDS: { // 177400: Drive Status Register SC: 0x000F, // (000017) Sector Counter SCESA: 0x0010, // (000020) Sector Counter Equals Sector Address @@ -770,6 +771,7 @@ var PDP11 = { RL11: { // RL11 Disk Controller PRI: 5, VEC: 0o160, + DRIVES: 4, // maximum of 4 drives RLCS: { // 174400: Control Status Register DRDY: 0x0001, // Drive Ready (R/O) FUNC: 0x000E, // Function Code (F2,F1,F0) (R/W) @@ -874,6 +876,9 @@ var PDP11 = { } }; +PDP11.RK11.RK05 = [203, 2, 12, 512, PDP11.RK11.RKDS.RK05 | PDP11.RK11.RKDS.SOK | PDP11.RK11.RKDS.RRDY]; +PDP11.RL11.RL02K = [512, 2, 40, 256, PDP11.RL11.RLMP.GS_ST.LOCKON | PDP11.RL11.RLMP.GS_BH | PDP11.RL11.RLMP.GS_HO]; + PDP11.ACCESS.READ_WORD = PDP11.ACCESS.WORD | PDP11.ACCESS.READ; // formerly READ_MODE (2) PDP11.ACCESS.READ_BYTE = PDP11.ACCESS.BYTE | PDP11.ACCESS.READ; // formerly READ_MODE (2) | BYTE_MODE (1) PDP11.ACCESS.WRITE_WORD = PDP11.ACCESS.WORD | PDP11.ACCESS.WRITE; // formerly WRITE_MODE (4) diff --git a/modules/pdp11/lib/device.js b/modules/pdp11/lib/device.js index 55e6f0480..5307d8c86 100644 --- a/modules/pdp11/lib/device.js +++ b/modules/pdp11/lib/device.js @@ -5,9 +5,9 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. + * It has been adapted from the JavaScript PDP 11/70 Emulator written by Paul Nankervis + * (paulnank@hotmail.com) at . This code may be used + * freely provided the original authors are acknowledged in any modified source code. * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 @@ -36,6 +36,7 @@ if (NODE) { var Str = require("../../shared/es6/strlib"); var Web = require("../../shared/es6/weblib"); var Component = require("../../shared/es6/component"); + var State = require("../../shared/es6/state"); var PDP11 = require("./defines"); var BusPDP11 = require("./bus"); var MemoryPDP11 = require("./memory"); @@ -59,10 +60,10 @@ class DevicePDP11 extends Component { */ constructor(parmsDevice) { - super("Device", parmsDevice, DevicePDP11, MessagesPDP11.DEVICE); + super("Device", parmsDevice, MessagesPDP11.DEVICE); this.kw11 = { // KW11 registers - csr: 0, + lks: PDP11.KW11.LKS.MON, timer: -1 // initBus() will initialize this timer ID }; } @@ -111,18 +112,18 @@ class DevicePDP11 extends Component { { if (DEBUGGER) { var cpu = this.cpu; - this.dumpRegs("KIPDR", cpu.mmuPDR[0], 0, asArgs[0]); - this.dumpRegs("KDPDR", cpu.mmuPDR[0], 8, asArgs[0]); - this.dumpRegs("KIPAR", cpu.mmuPAR[0], 0, asArgs[0]); - this.dumpRegs("KDPAR", cpu.mmuPAR[0], 8, asArgs[0], true); - this.dumpRegs("SIPDR", cpu.mmuPDR[1], 0, asArgs[0]); - this.dumpRegs("SDPDR", cpu.mmuPDR[1], 8, asArgs[0]); - this.dumpRegs("SIPAR", cpu.mmuPAR[1], 0, asArgs[0]); - this.dumpRegs("SDPAR", cpu.mmuPAR[1], 8, asArgs[0], true); - this.dumpRegs("UIPDR", cpu.mmuPDR[3], 0, asArgs[0]); - this.dumpRegs("UDPDR", cpu.mmuPDR[3], 8, asArgs[0]); - this.dumpRegs("UIPAR", cpu.mmuPAR[3], 0, asArgs[0]); - this.dumpRegs("UDPAR", cpu.mmuPAR[3], 8, asArgs[0], true); + this.dumpRegs("KIPDR", cpu.regsPDR[0], 0, asArgs[0]); + this.dumpRegs("KDPDR", cpu.regsPDR[0], 8, asArgs[0]); + this.dumpRegs("KIPAR", cpu.regsPAR[0], 0, asArgs[0]); + this.dumpRegs("KDPAR", cpu.regsPAR[0], 8, asArgs[0], true); + this.dumpRegs("SIPDR", cpu.regsPDR[1], 0, asArgs[0]); + this.dumpRegs("SDPDR", cpu.regsPDR[1], 8, asArgs[0]); + this.dumpRegs("SIPAR", cpu.regsPAR[1], 0, asArgs[0]); + this.dumpRegs("SDPAR", cpu.regsPAR[1], 8, asArgs[0], true); + this.dumpRegs("UIPDR", cpu.regsPDR[3], 0, asArgs[0]); + this.dumpRegs("UDPDR", cpu.regsPDR[3], 8, asArgs[0]); + this.dumpRegs("UIPAR", cpu.regsPAR[3], 0, asArgs[0]); + this.dumpRegs("UDPAR", cpu.regsPAR[3], 8, asArgs[0], true); if (cpu.regMMR3 & PDP11.MMR3.UNIBUS_MAP) { this.dumpRegs("UNIMAP", cpu.regsUniMap, -1, asArgs[0]); } @@ -167,6 +168,39 @@ class DevicePDP11 extends Component { } } + /** + * powerUp(data, fRepower) + * + * @this {DevicePDP11} + * @param {Object|null} data + * @param {boolean} [fRepower] + * @return {boolean} true if successful, false if failure + */ + powerUp(data, fRepower) + { + if (!fRepower) { + if (!data) { + this.reset(); + } else { + if (!this.restore(data)) return false; + } + } + return true; + } + + /** + * powerDown(fSave, fShutdown) + * + * @this {DevicePDP11} + * @param {boolean} [fSave] + * @param {boolean} [fShutdown] + * @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure + */ + powerDown(fSave, fShutdown) + { + return fSave? this.save() : true; + } + /** * reset() * @@ -178,6 +212,45 @@ class DevicePDP11 extends Component { this.cpu.setTimer(this.kw11.timer, 1000/60, true); } + /** + * save() + * + * This implements save support for the DevicePDP11 component. + * + * @this {DevicePDP11} + * @return {Object} + */ + save() + { + var state = new State(this); + state.set(0, [ + this.kw11.lks + ]); + return state.data(); + } + + /** + * restore(data) + * + * This implements restore support for the DevicePDP11 component. + * + * @this {DevicePDP11} + * @param {Object} data + * @return {boolean} true if successful, false if failure + */ + restore(data) + { + /* + * ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse + * of what save() does when it collects a bunch of object properties into an array. + */ + [ + this.kw11.lks + ] = data[0]; + + return true; + } + /** * interruptKW11() * @@ -350,7 +423,7 @@ class DevicePDP11 extends Component { readSIPDR(addr) { var reg = (addr >> 1) & 7; - return this.cpu.mmuPDR[1][reg]; + return this.cpu.regsPDR[1][reg]; } /** @@ -363,7 +436,7 @@ class DevicePDP11 extends Component { writeSIPDR(data, addr) { var reg = (addr >> 1) & 7; - this.cpu.mmuPDR[1][reg] = data & 0xff0f; + this.cpu.regsPDR[1][reg] = data & 0xff0f; } /** @@ -376,7 +449,7 @@ class DevicePDP11 extends Component { readSDPDR(addr) { var reg = ((addr >> 1) & 7) + 8; - return this.cpu.mmuPDR[1][reg]; + return this.cpu.regsPDR[1][reg]; } /** @@ -389,7 +462,7 @@ class DevicePDP11 extends Component { writeSDPDR(data, addr) { var reg = ((addr >> 1) & 7) + 8; - this.cpu.mmuPDR[1][reg] = data & 0xff0f; + this.cpu.regsPDR[1][reg] = data & 0xff0f; } /** @@ -402,7 +475,7 @@ class DevicePDP11 extends Component { readSIPAR(addr) { var reg = (addr >> 1) & 7; - return this.cpu.mmuPAR[1][reg]; + return this.cpu.regsPAR[1][reg]; } /** @@ -415,8 +488,8 @@ class DevicePDP11 extends Component { writeSIPAR(data, addr) { var reg = (addr >> 1) & 7; - this.cpu.mmuPAR[1][reg] = data; - this.cpu.mmuPDR[1][reg] &= 0xff0f; + this.cpu.regsPAR[1][reg] = data; + this.cpu.regsPDR[1][reg] &= 0xff0f; } @@ -430,7 +503,7 @@ class DevicePDP11 extends Component { readSDPAR(addr) { var reg = ((addr >> 1) & 7) + 8; - return this.cpu.mmuPAR[1][reg]; + return this.cpu.regsPAR[1][reg]; } /** @@ -443,8 +516,8 @@ class DevicePDP11 extends Component { writeSDPAR(data, addr) { var reg = ((addr >> 1) & 7) + 8; - this.cpu.mmuPAR[1][reg] = data; - this.cpu.mmuPDR[1][reg] &= 0xff0f; + this.cpu.regsPAR[1][reg] = data; + this.cpu.regsPDR[1][reg] &= 0xff0f; } /** @@ -457,7 +530,7 @@ class DevicePDP11 extends Component { readKIPDR(addr) { var reg = (addr >> 1) & 7; - return this.cpu.mmuPDR[0][reg]; + return this.cpu.regsPDR[0][reg]; } /** @@ -470,7 +543,7 @@ class DevicePDP11 extends Component { writeKIPDR(data, addr) { var reg = (addr >> 1) & 7; - this.cpu.mmuPDR[0][reg] = data & 0xff0f; + this.cpu.regsPDR[0][reg] = data & 0xff0f; } /** @@ -483,7 +556,7 @@ class DevicePDP11 extends Component { readKDPDR(addr) { var reg = ((addr >> 1) & 7) + 8; - return this.cpu.mmuPDR[0][reg]; + return this.cpu.regsPDR[0][reg]; } /** @@ -496,7 +569,7 @@ class DevicePDP11 extends Component { writeKDPDR(data, addr) { var reg = ((addr >> 1) & 7) + 8; - this.cpu.mmuPDR[0][reg] = data & 0xff0f; + this.cpu.regsPDR[0][reg] = data & 0xff0f; } /** @@ -509,7 +582,7 @@ class DevicePDP11 extends Component { readKIPAR(addr) { var reg = (addr >> 1) & 7; - return this.cpu.mmuPAR[0][reg]; + return this.cpu.regsPAR[0][reg]; } /** @@ -522,8 +595,8 @@ class DevicePDP11 extends Component { writeKIPAR(data, addr) { var reg = (addr >> 1) & 7; - this.cpu.mmuPAR[0][reg] = data; - this.cpu.mmuPDR[0][reg] &= 0xff0f; + this.cpu.regsPAR[0][reg] = data; + this.cpu.regsPDR[0][reg] &= 0xff0f; } @@ -537,7 +610,7 @@ class DevicePDP11 extends Component { readKDPAR(addr) { var reg = ((addr >> 1) & 7) + 8; - return this.cpu.mmuPAR[0][reg]; + return this.cpu.regsPAR[0][reg]; } /** @@ -550,8 +623,8 @@ class DevicePDP11 extends Component { writeKDPAR(data, addr) { var reg = ((addr >> 1) & 7) + 8; - this.cpu.mmuPAR[0][reg] = data; - this.cpu.mmuPDR[0][reg] &= 0xff0f; + this.cpu.regsPAR[0][reg] = data; + this.cpu.regsPDR[0][reg] &= 0xff0f; } /** @@ -564,7 +637,7 @@ class DevicePDP11 extends Component { readUIPDR(addr) { var reg = (addr >> 1) & 7; - return this.cpu.mmuPDR[3][reg]; + return this.cpu.regsPDR[3][reg]; } /** @@ -577,7 +650,7 @@ class DevicePDP11 extends Component { writeUIPDR(data, addr) { var reg = (addr >> 1) & 7; - this.cpu.mmuPDR[3][reg] = data & 0xff0f; + this.cpu.regsPDR[3][reg] = data & 0xff0f; } /** @@ -590,7 +663,7 @@ class DevicePDP11 extends Component { readUDPDR(addr) { var reg = ((addr >> 1) & 7) + 8; - return this.cpu.mmuPDR[3][reg]; + return this.cpu.regsPDR[3][reg]; } /** @@ -603,7 +676,7 @@ class DevicePDP11 extends Component { writeUDPDR(data, addr) { var reg = ((addr >> 1) & 7) + 8; - this.cpu.mmuPDR[3][reg] = data & 0xff0f; + this.cpu.regsPDR[3][reg] = data & 0xff0f; } /** @@ -616,7 +689,7 @@ class DevicePDP11 extends Component { readUIPAR(addr) { var reg = (addr >> 1) & 7; - return this.cpu.mmuPAR[3][reg]; + return this.cpu.regsPAR[3][reg]; } /** @@ -629,8 +702,8 @@ class DevicePDP11 extends Component { writeUIPAR(data, addr) { var reg = (addr >> 1) & 7; - this.cpu.mmuPAR[3][reg] = data; - this.cpu.mmuPDR[3][reg] &= 0xff0f; + this.cpu.regsPAR[3][reg] = data; + this.cpu.regsPDR[3][reg] &= 0xff0f; } @@ -644,7 +717,7 @@ class DevicePDP11 extends Component { readUDPAR(addr) { var reg = ((addr >> 1) & 7) + 8; - return this.cpu.mmuPAR[3][reg]; + return this.cpu.regsPAR[3][reg]; } /** @@ -657,8 +730,8 @@ class DevicePDP11 extends Component { writeUDPAR(data, addr) { var reg = ((addr >> 1) & 7) + 8; - this.cpu.mmuPAR[3][reg] = data; - this.cpu.mmuPDR[3][reg] &= 0xff0f; + this.cpu.regsPAR[3][reg] = data; + this.cpu.regsPDR[3][reg] &= 0xff0f; } /** diff --git a/modules/pdp11/lib/disk.js b/modules/pdp11/lib/disk.js index a54759875..39724d101 100644 --- a/modules/pdp11/lib/disk.js +++ b/modules/pdp11/lib/disk.js @@ -103,13 +103,13 @@ class DiskPDP11 extends Component { * This means, for example, that all references to "track[iSector].data" must actually appear as * "track[iSector]['data']". * - * @param {RK11|RL11} controller + * @param {DriveController|RK11|RL11} controller * @param {Object} drive * @param {string} mode */ constructor(controller, drive, mode) { - super("Disk", {'id': controller.idMachine + ".disk" + Str.toHex(++DiskPDP11.nDisks, 4)}, DiskPDP11, MessagesPDP11.DISK); + super("Disk", {'id': controller.idMachine + ".disk" + Str.toHex(++DiskPDP11.nDisks, 4)}, MessagesPDP11.DISK); /* * Route all non-Debugger messages (eg, notice() and println() calls) through @@ -371,6 +371,7 @@ class DiskPDP11 extends Component { } if (this.fnNotify) { + //noinspection JSUnresolvedFunction this.fnNotify.call(this.controller, this.drive, disk, this.sDiskName, this.sDiskPath); this.fnNotify = null; } @@ -590,6 +591,7 @@ class DiskPDP11 extends Component { } if (this.fnNotify) { + //noinspection JSUnresolvedFunction this.fnNotify.call(this.controllerNotify, this.drive, disk, this.sDiskName, this.sDiskPath); this.fnNotify = null; } diff --git a/modules/pdp11/lib/drive.js b/modules/pdp11/lib/drive.js new file mode 100644 index 000000000..fee5e1edc --- /dev/null +++ b/modules/pdp11/lib/drive.js @@ -0,0 +1,1274 @@ +/** + * @fileoverview Implements a generic disk drive controller + * @author Jeff Parsons + * @copyright © Jeff Parsons 2012-2017 + * + * This file is part of PCjs, a computer emulation software project at . + * + * PCjs is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * PCjs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with PCjs. If not, + * see . + * + * You are required to include the above copyright notice in every modified copy of this work + * and to display that copyright notice when the software starts running; see COPYRIGHT in + * . + * + * Some PCjs files also attempt to load external resource files, such as character-image files, + * ROM files, and disk image files. Those external resource files are not considered part of PCjs + * for purposes of the GNU General Public License, and the author does not claim any copyright + * as to their contents. + */ + +"use strict"; + +if (NODE) { + var Str = require("../../shared/es6/strlib"); + var Web = require("../../shared/es6/weblib"); + var DiskAPI = require("../../shared/es6/diskapi"); + var Component = require("../../shared/es6/component"); + var State = require("../../shared/es6/state"); + var PDP11 = require("./defines"); + var MessagesPDP11 = require("./messages"); + var DiskPDP11 = require("./disk"); +} + +/** + * @typedef {{ + * PRI: number, + * VEC: number, + * DRIVES: number + * }} + */ +var Config; + +/** + * Since the Closure Compiler treats ES6 classes as @struct rather than @dict by default, + * it deters us from defining named properties on our components; eg: + * + * this['exports'] = {...} + * + * results in an error: + * + * Cannot do '[]' access on a struct + * + * So, in order to define 'exports', we must override the @struct assumption by annotating + * the class as @unrestricted (or @dict). Note that this must be done both here and in the + * Component class, because otherwise the Compiler won't allow us to *reference* the named + * property either. + * + * TODO: Consider marking ALL our classes unrestricted, because otherwise it forces us to + * define every single property the class uses in its constructor, which results in a fair + * bit of redundant initialization, since many properties aren't (and don't need to be) fully + * initialized until the appropriate init(), reset(), restore(), etc. function is called. + * + * The upside, however, may be that since the structure of the class is completely defined by + * the constructor, JavaScript engines may be able to optimize and run more efficiently. + * + * @unrestricted + */ +class DriveController extends Component { + /** + * DriveController(type, parms, bitsMessage, configDC, configDrive, configIO) + * + * The DriveController component has the following component-specific (parms) properties: + * + * autoMount: one or more JSON-encoded objects, each containing 'name' and 'path' properties + * + * @param {string} type + * @param {Object} parms + * @param {number} bitsMessage + * @param {Config} configDC + * @param {Array} configDrive + * @param {Object} configIO + */ + constructor(type, parms, bitsMessage, configDC, configDrive, configIO) + { + super(type, parms, bitsMessage); + + /* + * We preliminarily parse and record any 'autoMount' object now, but we no longer process it + * until initBus(), because the Computer's getMachineParm() service may have an override for us. + */ + this.configMount = this.parseConfig(parms['autoMount']); + this.cAutoMount = 0; + + this.configDC = configDC; + this.configDrive = configDrive; + this.configIO = configIO; + + this.nDrives = configDC.DRIVES; + this.aDrives = new Array(this.nDrives); + this.fLocalDisks = (!Web.isMobile() && window && 'FileReader' in window); + this.sDiskSource = DriveController.SOURCE.NONE; + + /* + * The following array keeps track of every disk image we've ever mounted. Each entry in the + * array is another array whose elements are: + * + * [0]: name of disk + * [1]: path of disk + * [2]: array of deltas, uninitialized until the disk is unmounted and/or all state is saved + * + * See functions addDiskHistory() and updateDiskHistory(). + */ + this.aDiskHistory = []; + + this.irq = null; + + this['exports'] = { + 'selectDrive': this.selectDrive + }; + } + + /** + * parseConfig(config) + * + * @this {DriveController} + * @param {*} config + * @return {*} + */ + parseConfig(config) + { + if (config && typeof config == "string") { + try { + /* + * The most likely source of any exception will be right here, where we're parsing + * this JSON-encoded data. + */ + config = eval("(" + config + ")"); + } catch (e) { + Component.error(this.type + " auto-mount error: " + e.message + " (" + config + ")"); + config = null; + } + } + return config || {}; + } + + /** + * setBinding(sType, sBinding, control, sValue) + * + * @this {DriveController} + * @param {string|null} sType is the type of the HTML control (eg, "button", "list", "text", etc) + * @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "listDisks") + * @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement) + * @param {string} [sValue] optional data value + * @return {boolean} true if binding was successful, false if unrecognized binding request + */ + setBinding(sType, sBinding, control, sValue) + { + var dc = this; + + switch (sBinding) { + + case "listDisks": + this.bindings[sBinding] = control; + + control.onchange = function onChangeListDisks(event) { + var controlDesc = dc.bindings["descDisk"]; + var controlOption = control.options && control.options[control.selectedIndex]; + if (controlDesc && controlOption) { + var dataValue = {}; + var sValue = controlOption.getAttribute("data-value"); + if (sValue) { + try { + dataValue = eval("(" + sValue + ")"); + } catch (e) { + Component.error(dc.type + " option error: " + e.message); + } + } + var sHTML = dataValue['desc']; + if (sHTML === undefined) sHTML = ""; + var sHRef = dataValue['href']; + if (sHRef !== undefined) sHTML = "" + sHTML + ""; + controlDesc.innerHTML = sHTML; + } + }; + return true; + + case "descDisk": + case "listDrives": + this.bindings[sBinding] = control; + /* + * I tried going with onclick instead of onchange, so that if you wanted to confirm what's + * loaded in a particular drive, you could click the drive control without having to change it. + * However, that doesn't seem to work for all browsers, so I've reverted to onchange. + */ + control.onchange = function onChangeListDrives(event) { + var iDrive = Str.parseInt(control.value, 10); + if (iDrive != null) dc.displayDisk(iDrive); + }; + return true; + + case "loadDisk": + this.bindings[sBinding] = control; + + control.onclick = function onClickLoadDrive(event) { + var controlDisks = dc.bindings["listDisks"]; + if (controlDisks && controlDisks.options) { + var sDiskName = controlDisks.options[controlDisks.selectedIndex].text; + var sDiskPath = controlDisks.value; + dc.loadSelectedDrive(sDiskName, sDiskPath); + } + }; + return true; + + case "bootDisk": + this.bindings[sBinding] = control; + + control.onclick = function onClickBootDisk(event) { + dc.bootSelectedDisk(); + }; + return true; + + case "saveDisk": + /* + * Yes, technically, this feature does not require "Local disk support" (which is really a reference + * to FileReader support), but since fLocalDisks is also false for all mobile devices, and since there + * is an "orthogonality" to disabling both features in tandem, let's just let it slide, OK? + */ + if (!this.fLocalDisks) { + if (DEBUG) this.log("Local disk support not available"); + /* + * We could also simply hide the control; eg: + * + * control.style.display = "none"; + * + * but removing the control altogether seems better. + */ + control.parentNode.removeChild(/** @type {Node} */ (control)); + return false; + } + + this.bindings[sBinding] = control; + + control.onclick = function onClickSaveDrive(event) { + var controlDrives = dc.bindings["listDrives"]; + if (controlDrives && controlDrives.options && dc.aDrives) { + var iDriveSelected = Str.parseInt(controlDrives.value, 10) || 0; + var drive = dc.aDrives[iDriveSelected]; + if (drive) { + /* + * Note the similarity (and hence factoring opportunity) between this code and the HDC's "saveHD*" binding. + */ + var disk = drive.disk; + if (disk) { + if (DEBUG) dc.println("saving disk " + disk.sDiskPath + "..."); + var sAlert = Web.downloadFile(disk.encodeAsBase64(), "octet-stream", true, disk.sDiskFile.replace(".json", ".img")); + Component.alertUser(sAlert); + } else { + dc.notice("No disk loaded in drive."); + } + } else { + dc.notice("No disk drive selected."); + } + } + }; + return true; + + case "mountDisk": + if (!this.fLocalDisks) { + if (DEBUG) this.log("Local disk support not available"); + /* + * We could also simply hide the control; eg: + * + * control.style.display = "none"; + * + * but removing the control altogether seems better. + */ + control.parentNode.removeChild(/** @type {Node} */ (control)); + return false; + } + + this.bindings[sBinding] = control; + + /* + * Enable "Mount" button only if a file is actually selected + */ + control.addEventListener('change', function() { + var fieldset = control.children[0]; + var files = fieldset.children[0].files; + var submit = fieldset.children[1]; + submit.disabled = !files.length; + }); + + control.onsubmit = function(event) { + var file = event.currentTarget[1].files[0]; + if (file) { + var sDiskPath = file.name; + var sDiskName = Str.getBaseName(sDiskPath, true); + dc.loadSelectedDrive(sDiskName, sDiskPath, file); + } + /* + * Prevent reloading of web page after form submission + */ + return false; + }; + return true; + + default: + break; + } + return false; + } + + /** + * initBus(cmp, bus, cpu, dbg) + * + * @this {DriveController} + * @param {ComputerPDP11} cmp + * @param {BusPDP11} bus + * @param {CPUStatePDP11} cpu + * @param {DebuggerPDP11} dbg + */ + initBus(cmp, bus, cpu, dbg) + { + this.cmp = cmp; + this.bus = bus; + this.cpu = cpu; + this.dbg = dbg; + + var configMount = this.parseConfig(this.cmp.getMachineParm('autoMount')); + + /* + * Add only drives from the machine-wide autoMount configuration that match drives managed by this component. + */ + if (configMount) { + for (var sDrive in configMount) { + if (sDrive.substr(0, 2) != this.type.substr(0, 2)) continue; + this.configMount[sDrive] = configMount[sDrive]; + } + } + + /* + * If we didn't need auto-mount support, we could defer controller and drive initialization until we received + * a powerUp() notification, at which point reset() would call initController(), or restore() would restore the + * controller. + */ + this.reset(); + + this.irq = this.cpu.addIRQ(this.configDC.VEC, this.configDC.PRI, this.bitsMessage); + + bus.addIOTable(this, this.configIO); + bus.addResetHandler(this.reset.bind(this)); + + this.addDisk("None", DriveController.SOURCE.NONE, true); + if (this.fLocalDisks) this.addDisk("Local Disk", DriveController.SOURCE.LOCAL); + this.addDisk("Remote Disk", DriveController.SOURCE.REMOTE); + + if (!this.autoMount()) this.setReady(); + } + + /** + * getDriveName(iDrive) + * + * Form a drive name using the two-letter controller type prefix and the drive number. + * + * @this {DriveController} + * @param {number} iDrive + * @return {string} + */ + getDriveName(iDrive) + { + return this.type.substr(0, 2) + iDrive; + } + + /** + * getDriveNumber(sDrive) + * + * @this {DriveController} + * @param {string} sDrive + * @return {number} (0-3, or -1 if error) + */ + getDriveNumber(sDrive) + { + var iDrive = -1; + if (sDrive) { + iDrive = sDrive.charCodeAt(sDrive.length - 1) - 0x30; + if (iDrive < 0 || iDrive > 9) iDrive = -1; + } + return iDrive; + } + + /** + * powerUp(data, fRepower) + * + * @this {DriveController} + * @param {Object|null} data + * @param {boolean} [fRepower] + * @return {boolean} true if successful, false if failure + */ + powerUp(data, fRepower) + { + if (!fRepower) { + if (!data) { + this.reset(); + if (this.cmp.fReload) { + /* + * If the computer's fReload flag is set, we're required to toss all currently + * loaded disks and remount all disks specified in the auto-mount configuration. + */ + this.unloadAllDrives(true); + this.autoMount(true); + } + } else { + if (!this.restore(data)) return false; + } + /* + * Populate the HTML controls to match the actual (well, um, specified) number of floppy drives. + */ + var controlDrives; + if ((controlDrives = this.bindings['listDrives'])) { + while (controlDrives.firstChild) { + controlDrives.removeChild(controlDrives.firstChild); + } + controlDrives.value = ""; + for (var iDrive = 0; iDrive < this.nDrives; iDrive++) { + var controlOption = document.createElement("option"); + controlOption.value = iDrive; + controlOption.text = this.getDriveName(iDrive); + controlDrives.appendChild(controlOption); + } + if (this.nDrives > 0) { + controlDrives.value = "0"; + this.displayDisk(0); + } + } + } + return true; + } + + /** + * powerDown(fSave, fShutdown) + * + * @this {DriveController} + * @param {boolean} [fSave] + * @param {boolean} [fShutdown] + * @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure + */ + powerDown(fSave, fShutdown) + { + return fSave? this.save() : true; + } + + /** + * reset() + * + * @this {DriveController} + */ + reset() + { + this.initController(); + this.initDrives(); + } + + /** + * save() + * + * This implements save support for the DriveController component. + * + * @this {DriveController} + * @return {Object} + */ + save() + { + var state = new State(this); + state.set(0, this.saveController()); + state.set(1, this.saveHistory()); + state.set(2, this.saveDrives()); + return state.data(); + } + + /** + * restore(data) + * + * This implements restore support for the DriveController component. + * + * @this {DriveController} + * @param {Object} data + * @return {boolean} true if successful, false if failure + */ + restore(data) + { + var fSuccess = true; + if (!this.initController(data[0])) fSuccess = false; + if (!this.initHistory(data[1])) fSuccess = false; + if (!this.initDrives(data[2])) fSuccess = false; + return fSuccess; + } + + /** + * initController(aRegs) + * + * Placeholder for subclasses. + * + * @this {DriveController} + * @param {Array} [aRegs] + * @return {boolean} true if successful, false if failure + */ + initController(aRegs) + { + return true; + } + + /** + * saveController() + * + * Placeholder for subclasses. + * + * @this {DriveController} + * @return {Array} + */ + saveController() + { + return []; + } + + /** + * initDrive(drive, iDrive, configDrive, configDisk) + * + * @this {DriveController} + * @param {Object} drive + * @param {number} iDrive + * @param {Array} configDrive + * @param {Array} [configDisk] + * @return {boolean} true if successful, false if failure + */ + initDrive(drive, iDrive, configDrive, configDisk) + { + var i = 0; + var fSuccess = true; + + drive.iDrive = iDrive; + drive.name = this.idComponent; + drive.fBusy = drive.fLocal = false; + drive.fRemovable = true; + + /* + * NOTE: We initialize the following drive properties to their MAXIMUMs; disks may have + * these or SMALLER values (subject to the limits of what the controller supports, of course). + */ + drive.nCylinders = configDrive[0]; + drive.nHeads = configDrive[1]; + drive.nSectors = configDrive[2]; + drive.cbSector = configDrive[3]; + drive.status = configDrive[4]; + + /* + * The next group of properties are set by various controller command sequences. + */ + drive.bHead = 0; + drive.bCylinder = 0; + drive.bSector = 1; + drive.bSectorEnd = drive.nSectors; // aka EOT + drive.nBytes = drive.cbSector; + + /* + * The next group of properties are managed by worker functions (eg, doRead()) to maintain state across DMA requests. + */ + drive.ibSector = 0; + drive.sector = null; + + if (!drive.disk) { + drive.sDiskPath = ""; // ensure this is initialized to a default that displayDisk() can deal with + } + + if (configDisk) { + var fLocal = configDisk[0]; + var sDiskName = configDisk[1]; + var sDiskPath = configDisk[2]; + /* + * If we're restoring a local disk image, then the entire disk contents should be captured in aDiskHistory, + * so all we have to do is mount a blank disk and let disk.restore() do the rest; ie, there's nothing to + * "load" (it's a purely synchronous operation). + * + * Otherwise, we must call loadDrive(); in the common case, loadDrive() will have already "auto-mounted" + * the disk, so it will return true, and then we restore any deltas to the current image. + * + * However, if loadDrive() returns false, then it has initiated the load for a *different* disk image, + * so we must mark ourselves as "not ready" again, and add another "wait for ready" test in Computer before + * finally powering the CPU. + */ + if (fLocal) { + this.mountDrive(iDrive, sDiskName, sDiskPath); + } + else if (this.loadDrive(iDrive, sDiskName, sDiskPath, true)) { + if (drive.disk) { + if (sDiskPath) { + this.addDiskHistory(sDiskName, sDiskPath, drive.disk); + } else { + if (MAXDEBUG) Component.warning("Disk '" + (drive.disk.sDiskName || sDiskName) + "' not recorded properly in drive " + iDrive); + } + } + } else { + this.setReady(false); + } + } + return fSuccess; + } + + /** + * initDrives(aConfigDisks) + * + * @this {DriveController} + * @param {Array} [aConfigDisks] + * @return {boolean} true if successful, false if failure + */ + initDrives(aConfigDisks) + { + var fSuccess = true; + for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { + var drive = this.aDrives[iDrive]; + if (drive === undefined) { + drive = this.aDrives[iDrive] = {}; + } + var configDisk = aConfigDisks && aConfigDisks[iDrive]; + if (!this.initDrive(drive, iDrive, this.configDrive, configDisk)) { + fSuccess = false; + } + } + return fSuccess; + } + + /** + * saveDrive(drive) + * + * @this {DriveController} + * @param {Object} drive + * @return {Array} + */ + saveDrive(drive) + { + return [ + drive.fLocal, + drive.sDiskName, + drive.sDiskPath + ] + } + + /** + * saveDrives() + * + * @this {DriveController} + * @return {Array} + */ + saveDrives() + { + var data = []; + for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { + data.push(this.saveDrive(this.aDrives[iDrive])); + } + return data; + } + + /** + * initHistory(aHistory) + * + * @this {DriveController} + * @param {Array} [aHistory] + * @return {boolean} true if successful, false if failure + */ + initHistory(aHistory) + { + /* + * Initialize the disk history (if available) before initializing the drives, so that any disk deltas can be + * applied to disk images that are already loaded. + */ + if (aHistory) this.aDiskHistory = aHistory; + + return true; + } + + /** + * saveHistory() + * + * This returns an array of entries, one for each disk image we've ever mounted, including any deltas; ie: + * + * [name, path, deltas] + * + * aDiskHistory contains exactly that, except that deltas may not be up-to-date for any currently mounted + * disk image(s), so we call updateHistory() for all those disks, and then aDiskHistory is ready to be saved. + * + * @this {DriveController} + * @return {Array} + */ + saveHistory() + { + for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { + var drive = this.aDrives[iDrive]; + if (drive.disk) { + this.updateDiskHistory(drive.sDiskName, drive.sDiskPath, drive.disk); + } + } + return this.aDiskHistory; + } + + /** + * autoMount(fRemount) + * + * @this {DriveController} + * @param {boolean} [fRemount] is true if we're remounting all auto-mounted disks + * @return {boolean} true if one or more disk images are being auto-mounted, false if none + */ + autoMount(fRemount) + { + if (!fRemount) this.cAutoMount = 0; + for (var sDrive in this.configMount) { + var configDrive = this.configMount[sDrive]; + var sDiskPath = configDrive['path'] || ""; + var sDiskName = configDrive['name'] || this.findDisk(sDiskPath); + if (sDiskPath && sDiskName) { + var iDrive = this.getDriveNumber(sDrive); + if (iDrive >= 0 && iDrive < this.aDrives.length) { + if (!this.loadDrive(iDrive, sDiskName, sDiskPath, true) && fRemount) { + this.setReady(false); + } + continue; + } + } + this.notice("Incorrect auto-mount settings for drive " + sDrive + " (" + JSON.stringify(configDrive) + ")"); + } + return !!this.cAutoMount; + } + + /** + * loadSelectedDrive(sDiskName, sDiskPath, file) + * + * @this {DriveController} + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {File} [file] is set if there's an associated File object + */ + loadSelectedDrive(sDiskName, sDiskPath, file) + { + var controlDrives = this.bindings["listDrives"]; + var iDrive = controlDrives && Str.parseInt(controlDrives.value, 10); + + if (iDrive === undefined || iDrive < 0 || iDrive >= this.aDrives.length) { + this.notice("Unable to load the selected drive"); + return; + } + + if (!sDiskPath) { + this.unloadDrive(iDrive); + return; + } + + if (sDiskPath == DriveController.SOURCE.LOCAL) { + this.notice('Use "Choose File" and "Mount" to select and load a local disk.'); + return; + } + + /* + * If the special DriveController.SOURCE.REMOTE path is selected, then we want to prompt the user for a URL. + * Oh, and make sure we pass an empty string as the 2nd parameter to prompt(), so that IE won't display + * "undefined" -- because after all, undefined and "undefined" are EXACTLY the same thing, right? + * + * TODO: This is literally all I've done to support remote disk images. There's probably more + * I should do, like dynamically updating "listDisks" to include new entries, and adding new entries + * to the save/restore data. + */ + if (sDiskPath == DriveController.SOURCE.REMOTE) { + sDiskPath = window.prompt("Enter the URL of a remote disk image.", "") || ""; + if (!sDiskPath) return; + sDiskName = Str.getBaseName(sDiskPath); + this.status("Attempting to load " + sDiskPath + " as \"" + sDiskName + "\""); + this.sDiskSource = DriveController.SOURCE.REMOTE; + } + else { + this.sDiskSource = sDiskPath; + } + + this.loadDrive(iDrive, sDiskName, sDiskPath, false, file); + } + + /** + * bootSelectedDisk() + * + * @this {DriveController} + */ + bootSelectedDisk() + { + var drive; + var controlDrives = this.bindings["listDrives"]; + var iDrive = controlDrives && Str.parseInt(controlDrives.value, 10); + + if (iDrive == null || iDrive < 0 || iDrive >= this.aDrives.length || !(drive = this.aDrives[iDrive])) { + this.notice("Unable to boot the selected drive"); + return; + } + if (!drive.disk) { + this.notice("Load a disk into the drive first"); + return; + } + /* + * NOTE: We're calling setReset() BEFORE reading the boot code in order to eliminate any side-effects + * of the previous state of either the controller OR the CPU; for example, we don't want any previous MMU + * or UNIBUS Map registers affecting the simulated readData() call. Also, some boot code (eg, RSTS/E) + * expects the controller to be in a READY state; since setReset() triggers a call to our reset() handler, + * a READY state is assured, and the readData() call shouldn't do anything to change that. + */ + this.cpu.setReset(0, true); + var err = this.readData(drive, 0, 0, 0, 512, 0x0000, 2); + if (err) { + this.notice("Unable to read the boot sector (" + err + ")"); + } + } + + /** + * mountDrive(iDrive, sDiskName, sDiskPath) + * + * @this {DriveController} + * @param {number} iDrive + * @param {string} sDiskName + * @param {string} sDiskPath + */ + mountDrive(iDrive, sDiskName, sDiskPath) + { + var drive = this.aDrives[iDrive]; + this.unloadDrive(iDrive, true); + drive.fLocal = true; + var disk = new DiskPDP11(this, drive, DiskAPI.MODE.PRELOAD); + this.finishLoadDrive(drive, disk, sDiskName, sDiskPath, true); + } + + /** + * loadDrive(iDrive, sDiskName, sDiskPath, fAutoMount, file) + * + * NOTE: If sDiskPath is already loaded, nothing needs to be done. + * + * @this {DriveController} + * @param {number} iDrive + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {boolean} [fAutoMount] + * @param {File} [file] is set if there's an associated File object + * @return {number} 1 if disk loaded, 0 if queued up (or busy), -1 if already loaded + */ + loadDrive(iDrive, sDiskName, sDiskPath, fAutoMount, file) + { + var nResult = -1; + var drive = this.aDrives[iDrive]; + + if (drive.sDiskPath.toLowerCase() != sDiskPath.toLowerCase()) { + + nResult++; + this.unloadDrive(iDrive, true); + + if (drive.fBusy) { + this.notice(this.type + " busy"); + } + else { + // this.status("disk queued: " + sDiskName); + drive.fBusy = true; + if (fAutoMount) { + drive.fAutoMount = true; + this.cAutoMount++; + if (this.messageEnabled()) this.printMessage("auto-loading disk: " + sDiskName); + } + drive.fLocal = !!file; + var disk = new DiskPDP11(this, drive, DiskAPI.MODE.PRELOAD); + if (disk.load(sDiskName, sDiskPath, file, this.finishLoadDrive)) { + nResult++; + } + } + } + return nResult; + } + + /** + * finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) + * + * The disk parameter is set if the disk was successfully loaded, null if not. + * + * @this {DriveController} + * @param {Object} drive + * @param {DiskPDP11} disk + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {boolean} [fAutoMount] + */ + finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) + { + drive.fBusy = false; + + if (disk) { + /* + * TODO: While this is a perfectly reasonable thing to do, one wonders if the Disk object shouldn't + * have done this itself, since we passed our Drive object to it (it already knows the drive's limits). + */ + if (disk.nCylinders > drive.nCylinders || disk.nHeads > drive.nHeads /* || disk.nSectors > drive.nSectors */) { + this.notice("Disk \"" + sDiskName + "\" too large for drive " + this.getDriveName(drive.iDrive)); + disk = null; + } + } + + if (disk) { + drive.disk = disk; + drive.sDiskName = sDiskName; + drive.sDiskPath = sDiskPath; + + /* + * Adding local disk image names to the disk list seems like a nice idea, but it's too confusing, + * because then it looks like the "Mount" button should be able to (re)load them, and that can NEVER + * happen, for security reasons; local disk images can ONLY be loaded via the "Mount" button after + * the user has selected them via the "Choose File" button. + * + * this.addDisk(sDiskName, sDiskPath); + * + * So we're going to take a different approach: when displayDisk() is asked to display the name + * of a local disk image, it will map all such disks to "Local Disk", and any attempt to "Mount" such + * a disk, will essentially result in a "Disk not found" error. + */ + this.addDiskHistory(sDiskName, sDiskPath, disk); + + /* + * With the addition of notify(), users are now "alerted" whenever a disk has finished loading; + * notify() is selective about its output, using print() if a print window is open, alert() otherwise. + */ + this.notice("Loaded disk \"" + sDiskName + "\" in drive " + this.getDriveName(drive.iDrive), drive.fAutoMount || fAutoMount); + + /* + * Since you usually want the Computer to have focus again after loading a new disk, let's try automatically + * updating the focus after a successful load. + */ + if (this.cmp) this.cmp.setFocus(); + } + else { + drive.fLocal = false; + } + + if (drive.fAutoMount) { + drive.fAutoMount = false; + if (!--this.cAutoMount) this.setReady(); + } + + this.displayDisk(drive.iDrive); + } + + /** + * addDisk(sName, sPath, fTop) + * + * @this {DriveController} + * @param {string} sName + * @param {string} sPath + * @param {boolean} [fTop] (default is bottom) + */ + addDisk(sName, sPath, fTop) + { + var controlDisks = this.bindings["listDisks"]; + if (controlDisks && controlDisks.options) { + for (var i = 0; i < controlDisks.options.length; i++) { + if (controlDisks.options[i].value == sPath) return; + } + var controlOption = document.createElement("option"); + controlOption.text = sName; + controlOption.value = sPath; + if (fTop && controlDisks.childNodes[0]) { + controlDisks.insertBefore(controlOption, controlDisks.childNodes[0]); + } else { + controlDisks.appendChild(controlOption); + } + } + } + + /** + * findDisk(sPath) + * + * This is used to deal with mount requests (eg, autoMount) that supply a path without a name; + * if we can find the path in the "listDisks" control, then we return the associated disk name. + * + * @this {DriveController} + * @param {string} sPath + * @return {string|null} + */ + findDisk(sPath) + { + var controlDisks = this.bindings["listDisks"]; + if (controlDisks && controlDisks.options) { + for (var i = 0; i < controlDisks.options.length; i++) { + var control = controlDisks.options[i]; + if (control.value == sPath) return control.text; + } + } + return Str.getBaseName(sPath, true); + } + + /** + * displayDisk(iDrive, fUpdateDrive) + * + * This ensures that the selected disk matches the drive's sDiskPath property, and if fUpdateDrive is set, + * it also ensures that the selected drive matches the specified drive number. + * + * @this {DriveController} + * @param {number} iDrive (unvalidated) + * @param {boolean} [fUpdateDrive] is true to update the drive list to match the specified drive (eg, the auto-mount case) + * @return {boolean} true if successful, false if not + */ + displayDisk(iDrive, fUpdateDrive) + { + /* + * First things first: validate iDrive. + */ + var fSuccess = false; + if (iDrive >= 0 && iDrive < this.aDrives.length) { + var drive = this.aDrives[iDrive]; + var controlDisks = this.bindings["listDisks"]; + var controlDrives = this.bindings["listDrives"]; + /* + * Next, make sure controls for both drives and disks exist. + */ + if (controlDisks && controlDrives && controlDisks.options && controlDrives.options) { + /* + * Next, update the drive if the caller has requested it. + */ + var i; + if (fUpdateDrive) { + this.assert(iDrive == drive.iDrive); + for (i = 0; i < controlDrives.options.length; i++) { + if (Str.parseInt(controlDrives.options[i].value, 10) == drive.iDrive) { + if (controlDrives.selectedIndex != i) { + controlDrives.selectedIndex = i; + } + fSuccess = true; + break; + } + } + } + /* + * Next, make sure the drive whose disk we're updating is the currently selected drive. + */ + var iDriveSelected = Str.parseInt(controlDrives.value, 10); + var sTargetPath = (drive.fLocal? DriveController.SOURCE.LOCAL : drive.sDiskPath); + if (!isNaN(iDriveSelected) && iDriveSelected == iDrive) { + for (i = 0; i < controlDisks.options.length; i++) { + if (controlDisks.options[i].value == sTargetPath) { + if (controlDisks.selectedIndex != i) { + controlDisks.selectedIndex = i; + } + fSuccess = true; + break; + } + } + if (i == controlDisks.options.length) controlDisks.selectedIndex = 0; + } + } + } + return fSuccess; + } + + /** + * selectDrive(sDrive) + * + * Used to programmatically select a drive by name. + * + * @this {DriveController} + * @param {number} sDrive + * @return {boolean} true if successful, false if not + */ + selectDrive(sDrive) + { + var controlDrives = this.bindings["listDrives"]; + if (controlDrives && controlDrives.options) { + var nDrives = controlDrives.options.length; + for (var i = 0; i < nDrives; i++) { + if (controlDrives.options[i].innerHTML == sDrive) { + var iDrive = Str.parseInt(controlDrives.options[i].value, 10); + if (iDrive >= 0) { + return this.displayDisk(iDrive, true); + } + } + } + } + return false; + } + + /** + * unloadDrive(iDrive, fLoading) + * + * @this {DriveController} + * @param {number} iDrive + * @param {boolean} [fLoading] + */ + unloadDrive(iDrive, fLoading) + { + var drive = this.aDrives[iDrive]; + + if (drive.disk || fLoading === false) { + + /* + * Before we toss the disk's information, capture any deltas that may have occurred. + */ + this.updateDiskHistory(drive.sDiskName, drive.sDiskPath, drive.disk); + + drive.sDiskName = ""; + drive.sDiskPath = ""; + drive.disk = null; + drive.fLocal = false; + + if (!fLoading) { + this.notice("Drive " + this.getDriveName(iDrive) + " unloaded", fLoading); + this.sDiskSource = DriveController.SOURCE.NONE; + this.displayDisk(iDrive); + } + } + } + + /** + * unloadAllDrives(fDiscard) + * + * @this {DriveController} + * @param {boolean} fDiscard to discard all disk history before unloading + */ + unloadAllDrives(fDiscard) + { + if (fDiscard) this.aDiskHistory = []; + + for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { + this.unloadDrive(iDrive, true); + } + } + + /** + * addDiskHistory(sDiskName, sDiskPath, disk) + * + * @this {DriveController} + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {DiskPDP11} disk containing corresponding disk image + */ + addDiskHistory(sDiskName, sDiskPath, disk) + { + var i; + this.assert(!!sDiskPath); + for (i = 0; i < this.aDiskHistory.length; i++) { + if (this.aDiskHistory[i][1] == sDiskPath) { + var nChanges = disk.restore(this.aDiskHistory[i][2]); + if (DEBUG && this.messageEnabled()) { + this.printMessage("disk '" + sDiskName + "' restored from history (" + nChanges + " changes)"); + } + return; + } + } + if (DEBUG && this.messageEnabled()) { + this.printMessage("disk '" + sDiskName + "' added to history (nothing to restore)"); + } + this.aDiskHistory[i] = [sDiskName, sDiskPath, []]; + } + + /** + * removeDiskHistory(sDiskName, sDiskPath) + * + * @this {DriveController} + * @param {string} sDiskName + * @param {string} sDiskPath + */ + removeDiskHistory(sDiskName, sDiskPath) + { + var i; + for (i = 0; i < this.aDiskHistory.length; i++) { + if (this.aDiskHistory[i][1] == sDiskPath) { + this.aDiskHistory.splice(i, 1); + if (DEBUG && this.messageEnabled()) { + this.printMessage("disk '" + sDiskName + "' removed from history"); + } + return; + } + } + if (DEBUG && this.messageEnabled()) { + this.printMessage("unable to remove disk '" + sDiskName + "' from history (" + sDiskPath + ")"); + } + } + + /** + * updateDiskHistory(sDiskName, sDiskPath, disk) + * + * @this {DriveController} + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {DiskPDP11} disk containing corresponding disk image, with possible deltas + */ + updateDiskHistory(sDiskName, sDiskPath, disk) + { + var i; + for (i = 0; i < this.aDiskHistory.length; i++) { + if (this.aDiskHistory[i][1] == sDiskPath) { + this.aDiskHistory[i][2] = disk.save(); + if (DEBUG && this.messageEnabled()) { + this.printMessage("disk '" + sDiskName + "' updated in history"); + } + return; + } + } + /* + * I used to report this as an error (at least in the DEBUG release), but it's no longer really + * an error, because if we're trying to re-mount a clean copy of a disk, we toss its history, then + * unload, and then reload/remount. And since unloadDrive's normal behavior is to call updateDiskHistory() + * before unloading, the fact that the disk is no longer listed here can't be treated as an error. + */ + if (DEBUG && this.messageEnabled()) { + this.printMessage("unable to update disk '" + sDiskName + "' in history (" + sDiskPath + ")"); + } + } + + /** + * readData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) + * + * Placeholder for subclasses. + * + * @this {DriveController} + * @param {Object} drive + * @param {number} iCylinder + * @param {number} iHead + * @param {number} iSector + * @param {number} nWords + * @param {number} addr + * @param {number} inc (normally 2, unless inhibited, in which case it's 0) + * @param {boolean} [fCheck] + * @param {function(...)} [done] + * @return {boolean|number} true if complete, false if queued (or if no done() is supplied, the error code, if any) + */ + readData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) + { + return false; + } + + /** + * writeData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) + * + * Placeholder for subclasses. + * + * @this {DriveController} + * @param {Object} drive + * @param {number} iCylinder + * @param {number} iHead + * @param {number} iSector + * @param {number} nWords + * @param {number} addr + * @param {number} inc (normally 2, unless inhibited, in which case it's 0) + * @param {boolean} [fCheck] + * @param {function(...)} [done] + * @return {boolean|number} true if complete, false if queued (or if no done() is supplied, the error code, if any) + */ + writeData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) + { + return false; + } +} + +/* + * There's nothing super special about these values, except that NONE should be falsey and the others should not. + */ +DriveController.SOURCE = { + NONE: "", + LOCAL: "?", + REMOTE: "??" +}; + +if (NODE) module.exports = DriveController; diff --git a/modules/pdp11/lib/keyboard.js b/modules/pdp11/lib/keyboard.js index 889aecc8e..26707d6ef 100644 --- a/modules/pdp11/lib/keyboard.js +++ b/modules/pdp11/lib/keyboard.js @@ -5,10 +5,6 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. - * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. @@ -47,7 +43,7 @@ class KeyboardPDP11 extends Component { */ constructor(parmsKbd) { - super("Keyboard", parmsKbd, KeyboardPDP11, MessagesPDP11.KEYBOARD); + super("Keyboard", parmsKbd, MessagesPDP11.KEYBOARD); this.setReady(); } diff --git a/modules/pdp11/lib/memory.js b/modules/pdp11/lib/memory.js index 1b520d14d..a2cd5a235 100644 --- a/modules/pdp11/lib/memory.js +++ b/modules/pdp11/lib/memory.js @@ -5,10 +5,6 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. - * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. diff --git a/modules/pdp11/lib/messages.js b/modules/pdp11/lib/messages.js index ec2ed2761..f4ca592f9 100644 --- a/modules/pdp11/lib/messages.js +++ b/modules/pdp11/lib/messages.js @@ -5,10 +5,6 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. - * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. diff --git a/modules/pdp11/lib/nodebugger.js b/modules/pdp11/lib/nodebugger.js index 64f6be7e8..e4c83aa08 100644 --- a/modules/pdp11/lib/nodebugger.js +++ b/modules/pdp11/lib/nodebugger.js @@ -5,10 +5,6 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. - * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. diff --git a/modules/pdp11/lib/panel.js b/modules/pdp11/lib/panel.js index 8133c1b37..252024006 100644 --- a/modules/pdp11/lib/panel.js +++ b/modules/pdp11/lib/panel.js @@ -5,9 +5,9 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. + * It has been adapted from the JavaScript PDP 11/70 Emulator written by Paul Nankervis + * (paulnank@hotmail.com) at . This code may be used + * freely provided the original authors are acknowledged in any modified source code. * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 @@ -36,6 +36,7 @@ if (NODE) { var Str = require("../../shared/es6/strlib"); var Web = require("../../shared/es6/weblib"); var Component = require("../../shared/es6/component"); + var State = require("../../shared/es6/state"); var PDP11 = require("./defines"); var BusPDP11 = require("./bus"); var MessagesPDP11 = require("./messages"); @@ -52,7 +53,7 @@ class PanelPDP11 extends Component { */ constructor(parmsPanel, fBindings) { - super("Panel", parmsPanel, PanelPDP11, MessagesPDP11.PANEL); + super("Panel", parmsPanel, MessagesPDP11.PANEL); /* * If there are any live registers, LEDs, etc, to display, this will provide a count. @@ -80,6 +81,7 @@ class PanelPDP11 extends Component { this.regDisplay = 0; this.regSwitches = 0; this.regAddr = this.regData = 0; + this.ledAddr = this.ledData = -1; /* * The panel hardware has the following additional (supported) state; note that there are several @@ -232,20 +234,22 @@ class PanelPDP11 extends Component { } /** - * reset() + * reset(fPowerUp) * * NOTE: Since we've registered our handler with the Bus component, we will be called twice whenever * the entire machine is reset: once when the Computer's reset() handler calls the Bus's reset() handler, * and again when the Computer's reset() handler calls us directly. Multiple resets should be harmless. * * @this {PanelPDP11} + * @param {boolean} [fPowerUp] */ - reset() + reset(fPowerUp) { /* * Simulate a call to our stop() handler, to update the panel's ADDRESS register with the current PC. */ this.stop(); + if (fPowerUp) this.setDR(0); } /** @@ -396,10 +400,11 @@ class PanelPDP11 extends Component { */ if (this.fBindings) PanelPDP11.init(); - /* - * TODO: Until we implement a restore() function, all we can do is reset() - */ - this.reset(); + if (!data) { + this.reset(true); + } else { + if (!this.restore(data)) return false; + } } return true; } @@ -414,6 +419,45 @@ class PanelPDP11 extends Component { */ powerDown(fSave, fShutdown) { + return fSave? this.save() : true; + } + + /** + * save() + * + * This implements save support for the PanelPDP11 component. + * + * @this {PanelPDP11} + * @return {Object} + */ + save() + { + var state = new State(this); + state.set(0, [ + this.getAR(), + this.getDR(), + this.getSR() + ]); + return state.data(); + } + + /** + * restore(data) + * + * This implements restore support for the PanelPDP11 component. + * + * @this {PanelPDP11} + * @param {Object} data + * @return {boolean} true if successful, false if failure + */ + restore(data) + { + var a = data[0]; + if (a) { + this.setAR(a[0]); + this.setDR(a[1]); + this.setSR(a[2]); + } return true; } @@ -490,12 +534,9 @@ class PanelPDP11 extends Component { displayValue(sLabel, nValue, cch) { if (this.bindings[sLabel]) { - if (nValue === undefined) { - this.setError("Value for " + sLabel + " is invalid"); - this.cpu.stopCPU(); - } var sVal; var nBase = this.dbg && this.dbg.nBase || 8; + nValue = nValue || 0; if (!this.cpu.isRunning() || this.fDisplayLiveRegs) { sVal = nBase == 8? Str.toOct(nValue, cch) : Str.toHex(nValue, cch); } else { @@ -865,7 +906,10 @@ class PanelPDP11 extends Component { updateAddr(value) { this.regAddr = value & this.bus.nBusMask; - this.updateLEDArray("A", this.regAddr, 22); + if (this.ledAddr !== this.regAddr) { + this.ledAddr = this.regAddr; + this.updateLEDArray("A", this.ledAddr, 22); + } return this.regAddr; } @@ -879,7 +923,10 @@ class PanelPDP11 extends Component { updateData(value) { this.regData = value & 0xffff; - this.updateLEDArray("D", this.regData, 16); + if (this.ledData !== this.regData) { + this.ledData = this.regData; + this.updateLEDArray("D", this.ledData, 16); + } return this.regData; } @@ -996,7 +1043,7 @@ class PanelPDP11 extends Component { * Called by the Computer component at intervals to update registers, LEDs, etc. * * @this {PanelPDP11} - * @param {number} [nUpdate] (< 0 for forced, > 0 for periodic, 0 otherwise) + * @param {number} [nUpdate] (-2 for power on, -1 for forced, > 0 for periodic, 0 or undefined otherwise) */ updateDisplay(nUpdate) { @@ -1032,7 +1079,13 @@ class PanelPDP11 extends Component { * TODO: There is currently no mechanism for selecting regData over regDisplay; * we are acting as if the DATASEL switch setting is locked to "DISPLAY REGISTER". */ - this.updateAddr(nUpdate > 0 && fRunning && !fWaiting? this.cpu.getLastAddr() : this.regAddr); + if (nUpdate < -1) { + this.regAddr = this.cpu.regsGen[7]; + } else if (nUpdate > 0 && fRunning && !fWaiting) { + this.regAddr = this.cpu.getLastAddr(); + } + + this.updateAddr(this.regAddr); this.updateData(this.regDisplay); var bits = this.cpu.getMMUState(); diff --git a/modules/pdp11/lib/pc11.js b/modules/pdp11/lib/pc11.js index a5b19c8d9..bba5feeb9 100644 --- a/modules/pdp11/lib/pc11.js +++ b/modules/pdp11/lib/pc11.js @@ -64,7 +64,7 @@ class PC11 extends Component { */ constructor(parms) { - super("PC11", parms, PC11); + super("PC11", parms); this.sDevice = "PTR"; // TODO: Make the device name configurable @@ -306,7 +306,7 @@ class PC11 extends Component { powerUp(data, fRepower) { if (!fRepower) { - if (!data || !this.restore) { + if (!data) { this.reset(); } else { if (!this.restore(data)) return false; diff --git a/modules/pdp11/lib/ram.js b/modules/pdp11/lib/ram.js index af57b002b..bf0d29c89 100644 --- a/modules/pdp11/lib/ram.js +++ b/modules/pdp11/lib/ram.js @@ -5,10 +5,6 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. - * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. @@ -66,7 +62,7 @@ class RAMPDP11 extends Component { */ constructor(parmsRAM) { - super("RAM", parmsRAM, RAMPDP11); + super("RAM", parmsRAM); this.abInit = null; this.aSymbols = null; @@ -141,12 +137,14 @@ class RAMPDP11 extends Component { */ delete this.aSymbols; } - /* - * The Computer powers up the CPU last, at which point CPUState state is restored, - * which includes the Bus state, and since we use the Bus to allocate all our memory, - * memory contents are already restored for us, so we don't need the usual restore - * logic. - */ + if (!fRepower) { + /* + * Since we use the Bus to allocate all our memory, memory contents are already restored for us, + * so we don't save any state, and therefore no state should be restored. Just do a reset(). + */ + this.assert(!data); + this.reset(); + } return true; } diff --git a/modules/pdp11/lib/rk11.js b/modules/pdp11/lib/rk11.js index 46bcb9252..dc91e6579 100644 --- a/modules/pdp11/lib/rk11.js +++ b/modules/pdp11/lib/rk11.js @@ -5,6 +5,10 @@ * * This file is part of PCjs, a computer emulation software project at . * + * It has been adapted from the JavaScript PDP 11/70 Emulator written by Paul Nankervis + * (paulnank@hotmail.com) at . This code may be used + * freely provided the original authors are acknowledged in any modified source code. + * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. @@ -30,16 +34,12 @@ if (NODE) { var Str = require("../../shared/es6/strlib"); - var Web = require("../../shared/es6/weblib"); - var DiskAPI = require("../../shared/es6/diskapi"); - var Component = require("../../shared/es6/component"); - var State = require("../../shared/es6/state"); var PDP11 = require("./defines"); var MessagesPDP11 = require("./messages"); - var DiskPDP11 = require("./disk"); + var DriveController = require("./drive"); } -class RK11 extends Component { +class RK11 extends DriveController { /** * RK11(parms) * @@ -58,884 +58,65 @@ class RK11 extends Component { */ constructor(parms) { - super("RK11", parms, RK11, MessagesPDP11.RK11); + super("RK11", parms, MessagesPDP11.RK11, PDP11.RK11, PDP11.RK11.RK05, RK11.UNIBUS_IOTABLE); /* - * We preliminarily parse and record any 'autoMount' object now, but we no longer process it - * until initBus(), because the Computer's getMachineParm() service may have an override for us. - */ - this.configMount = this.parseConfig(parms['autoMount']); - this.cAutoMount = 0; - - /* - * The RK11 has three Drive Select bits, representing up to eight drives. - */ - this.nDrives = 8; - this.aDrives = new Array(this.nDrives); - this.fLocalDisks = (!Web.isMobile() && window && 'FileReader' in window); - this.sDiskSource = RK11.SOURCE.NONE; - - this.irq = null; - - /* - * Define all the properties to be initialized by initController() + * Define all the registers required for this controller. + * + * TODO: Determine what we should really be doing with the RKDB register. */ this.regRKDS = this.regRKER = this.regRKCS = this.regRKWC = this.regRKBA = this.regRKDA = this.regRKDB = 0; } /** - * parseConfig(config) + * initController(aRegs) * * @this {RK11} - * @param {*} config - * @return {*} - */ - parseConfig(config) - { - if (config && typeof config == "string") { - try { - /* - * The most likely source of any exception will be right here, where we're parsing - * this JSON-encoded data. - */ - config = eval("(" + config + ")"); - } catch (e) { - Component.error(this.type + " auto-mount error: " + e.message + " (" + config + ")"); - config = null; - } - } - return config || {}; - } - - /** - * setBinding(sType, sBinding, control, sValue) - * - * @this {RK11} - * @param {string|null} sType is the type of the HTML control (eg, "button", "list", "text", etc) - * @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "listDisks") - * @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement) - * @param {string} [sValue] optional data value - * @return {boolean} true if binding was successful, false if unrecognized binding request - */ - setBinding(sType, sBinding, control, sValue) - { - var rk11 = this; - - switch (sBinding) { - - case "listDisks": - this.bindings[sBinding] = control; - - control.onchange = function onChangeListDisks(event) { - var controlDesc = rk11.bindings["descDisk"]; - var controlOption = control.options && control.options[control.selectedIndex]; - if (controlDesc && controlOption) { - var dataValue = {}; - var sValue = controlOption.getAttribute("data-value"); - if (sValue) { - try { - dataValue = eval("(" + sValue + ")"); - } catch (e) { - Component.error("RK11 option error: " + e.message); - } - } - var sHTML = dataValue['desc']; - if (sHTML === undefined) sHTML = ""; - var sHRef = dataValue['href']; - if (sHRef !== undefined) sHTML = "" + sHTML + ""; - controlDesc.innerHTML = sHTML; - } - }; - return true; - - case "descDisk": - case "listDrives": - this.bindings[sBinding] = control; - /* - * I tried going with onclick instead of onchange, so that if you wanted to confirm what's - * loaded in a particular drive, you could click the drive control without having to change it. - * However, that doesn't seem to work for all browsers, so I've reverted to onchange. - */ - control.onchange = function onChangeListDrives(event) { - var iDrive = Str.parseInt(control.value, 10); - if (iDrive != null) rk11.displayDisk(iDrive); - }; - return true; - - case "loadDisk": - this.bindings[sBinding] = control; - - control.onclick = function onClickLoadDrive(event) { - var controlDisks = rk11.bindings["listDisks"]; - if (controlDisks && controlDisks.options) { - var sDiskName = controlDisks.options[controlDisks.selectedIndex].text; - var sDiskPath = controlDisks.value; - rk11.loadSelectedDrive(sDiskName, sDiskPath); - } - }; - return true; - - case "bootDisk": - this.bindings[sBinding] = control; - - control.onclick = function onClickBootDisk(event) { - rk11.bootSelectedDisk(); - }; - return true; - - case "saveDisk": - /* - * Yes, technically, this feature does not require "Local disk support" (which is really a reference - * to FileReader support), but since fLocalDisks is also false for all mobile devices, and since there - * is an "orthogonality" to disabling both features in tandem, let's just let it slide, OK? - */ - if (!this.fLocalDisks) { - if (DEBUG) this.log("Local disk support not available"); - /* - * We could also simply hide the control; eg: - * - * control.style.display = "none"; - * - * but removing the control altogether seems better. - */ - control.parentNode.removeChild(/** @type {Node} */ (control)); - return false; - } - - this.bindings[sBinding] = control; - - control.onclick = function onClickSaveDrive(event) { - var controlDrives = rk11.bindings["listDrives"]; - if (controlDrives && controlDrives.options && rk11.aDrives) { - var iDriveSelected = Str.parseInt(controlDrives.value, 10) || 0; - var drive = rk11.aDrives[iDriveSelected]; - if (drive) { - /* - * Note the similarity (and hence factoring opportunity) between this code and the HDC's "saveHD*" binding. - */ - var disk = drive.disk; - if (disk) { - if (DEBUG) rk11.println("saving disk " + disk.sDiskPath + "..."); - var sAlert = Web.downloadFile(disk.encodeAsBase64(), "octet-stream", true, disk.sDiskFile.replace(".json", ".img")); - Component.alertUser(sAlert); - } else { - rk11.notice("No disk loaded in drive."); - } - } else { - rk11.notice("No disk drive selected."); - } - } - }; - return true; - - case "mountDisk": - if (!this.fLocalDisks) { - if (DEBUG) this.log("Local disk support not available"); - /* - * We could also simply hide the control; eg: - * - * control.style.display = "none"; - * - * but removing the control altogether seems better. - */ - control.parentNode.removeChild(/** @type {Node} */ (control)); - return false; - } - - this.bindings[sBinding] = control; - - /* - * Enable "Mount" button only if a file is actually selected - */ - control.addEventListener('change', function() { - var fieldset = control.children[0]; - var files = fieldset.children[0].files; - var submit = fieldset.children[1]; - submit.disabled = !files.length; - }); - - control.onsubmit = function(event) { - var file = event.currentTarget[1].files[0]; - if (file) { - var sDiskPath = file.name; - var sDiskName = Str.getBaseName(sDiskPath, true); - rk11.loadSelectedDrive(sDiskName, sDiskPath, file); - } - /* - * Prevent reloading of web page after form submission - */ - return false; - }; - return true; - - default: - break; - } - return false; - } - - /** - * initBus(cmp, bus, cpu, dbg) - * - * @this {RK11} - * @param {ComputerPDP11} cmp - * @param {BusPDP11} bus - * @param {CPUStatePDP11} cpu - * @param {DebuggerPDP11} dbg - */ - initBus(cmp, bus, cpu, dbg) - { - this.cmp = cmp; - this.bus = bus; - this.cpu = cpu; - this.dbg = dbg; - - var configMount = this.parseConfig(this.cmp.getMachineParm('autoMount')); - - /* - * Add only drives from the machine-wide autoMount configuration that match drives managed by this component. - */ - if (configMount) { - for (var sDrive in configMount) { - if (sDrive.substr(0, 2) != this.type.substr(0, 2)) continue; - this.configMount[sDrive] = configMount[sDrive]; - } - } - - /* - * If we didn't need auto-mount support, we could defer controller initialization until we received - * a powerUp() notification, at which point reset() would call initController(), or restore() would restore - * the controller; in that case, all we'd need to do here is call setReady(). - */ - this.initController(); - - this.irq = this.cpu.addIRQ(RK11.VEC, RK11.PRI, MessagesPDP11.RK11); - - bus.addIOTable(this, RK11.UNIBUS_IOTABLE); - bus.addResetHandler(this.reset.bind(this)); - - this.addDisk("None", RK11.SOURCE.NONE, true); - if (this.fLocalDisks) this.addDisk("Local Disk", RK11.SOURCE.LOCAL); - this.addDisk("Remote Disk", RK11.SOURCE.REMOTE); - - if (!this.autoMount()) this.setReady(); - } - - /** - * getDriveName(iDrive) - * - * @this {RK11} - * @param {number} iDrive - * @return {string} - */ - getDriveName(iDrive) - { - return "RK" + iDrive; - } - - /** - * getDriveNumber(sDrive) - * - * @this {RK11} - * @param {string} sDrive - * @return {number} (0-3, or -1 if error) - */ - getDriveNumber(sDrive) - { - var iDrive = -1; - if (sDrive) { - iDrive = sDrive.charCodeAt(sDrive.length - 1) - 0x30; - if (iDrive < 0 || iDrive > 9) iDrive = -1; - } - return iDrive; - } - - /** - * powerUp(data, fRepower) - * - * @this {RK11} - * @param {Object|null} data - * @param {boolean} [fRepower] + * @param {Array} [aRegs] * @return {boolean} true if successful, false if failure */ - powerUp(data, fRepower) + initController(aRegs) { - if (!fRepower) { - if (!data || !this.restore) { - this.reset(); - if (this.cmp.fReload) { - /* - * If the computer's fReload flag is set, we're required to toss all currently - * loaded disks and remount all disks specified in the auto-mount configuration. - */ - this.unloadAllDrives(true); - this.autoMount(true); - } - } else { - if (!this.restore(data)) return false; - } - /* - * Populate the HTML controls to match the actual (well, um, specified) number of floppy drives. - */ - var controlDrives; - if ((controlDrives = this.bindings['listDrives'])) { - while (controlDrives.firstChild) { - controlDrives.removeChild(controlDrives.firstChild); - } - controlDrives.value = ""; - for (var iDrive = 0; iDrive < this.nDrives; iDrive++) { - var controlOption = document.createElement("option"); - controlOption.value = iDrive; - controlOption.text = this.getDriveName(iDrive); - controlDrives.appendChild(controlOption); - } - if (this.nDrives > 0) { - controlDrives.value = "0"; - this.displayDisk(0); - } - } + if (!aRegs) { + aRegs = [(RK11.RKDS.RK05 | RK11.RKDS.SOK | RK11.RKDS.RRDY), 0, (RK11.RKCS.CRDY), 0, 0, 0, 0]; } + + /* + * ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse + * of what saveController() does when it collects a bunch of object properties into an array. + */ + [ + this.regRKDS, + this.regRKER, + this.regRKCS, + this.regRKWC, + this.regRKBA, + this.regRKDA, + this.regRKDB + ] = aRegs; + return true; } - /** - * powerDown(fSave, fShutdown) - * - * @this {RK11} - * @param {boolean} [fSave] - * @param {boolean} [fShutdown] - * @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure - */ - powerDown(fSave, fShutdown) - { - return fSave? this.save() : true; - } - - /** - * reset() - * - * @this {RK11} - */ - reset() - { - this.initController(); - } - - /** - * save() - * - * This implements save support for the RK11 component. - * - * @this {RK11} - * @return {Object} - */ - save() - { - var state = new State(this); - // state.set(0, this.saveController()); - return state.data(); - } - - /** - * restore(data) - * - * This implements restore support for the RK11 component. - * - * @this {RK11} - * @param {Object} data - * @return {boolean} true if successful, false if failure - */ - restore(data) - { - return this.initController(data[0]); - } - /** * saveController() * + * Basically, the inverse of initController(). + * * @this {RK11} * @return {Array} */ saveController() { - return []; - } - - /** - * autoMount(fRemount) - * - * @this {RK11} - * @param {boolean} [fRemount] is true if we're remounting all auto-mounted disks - * @return {boolean} true if one or more disk images are being auto-mounted, false if none - */ - autoMount(fRemount) - { - if (!fRemount) this.cAutoMount = 0; - for (var sDrive in this.configMount) { - var configDrive = this.configMount[sDrive]; - var sDiskPath = configDrive['path'] || ""; - var sDiskName = configDrive['name'] || this.findDisk(sDiskPath); - if (sDiskPath && sDiskName) { - var iDrive = this.getDriveNumber(sDrive); - if (iDrive >= 0 && iDrive < this.aDrives.length) { - if (!this.loadDrive(iDrive, sDiskName, sDiskPath, true) && fRemount) { - this.setReady(false); - } - continue; - } - } - this.notice("Incorrect auto-mount settings for drive " + sDrive + " (" + JSON.stringify(configDrive) + ")"); - } - return !!this.cAutoMount; - } - - /** - * loadSelectedDrive(sDiskName, sDiskPath, file) - * - * @this {RK11} - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {File} [file] is set if there's an associated File object - */ - loadSelectedDrive(sDiskName, sDiskPath, file) - { - var controlDrives = this.bindings["listDrives"]; - var iDrive = controlDrives && Str.parseInt(controlDrives.value, 10); - - if (iDrive === undefined || iDrive < 0 || iDrive >= this.aDrives.length) { - this.notice("Unable to load the selected drive"); - return; - } - - if (!sDiskPath) { - this.unloadDrive(iDrive); - return; - } - - if (sDiskPath == RK11.SOURCE.LOCAL) { - this.notice('Use "Choose File" and "Mount" to select and load a local disk.'); - return; - } - - /* - * If the special RK11.SOURCE.REMOTE path is selected, then we want to prompt the user for a URL. - * Oh, and make sure we pass an empty string as the 2nd parameter to prompt(), so that IE won't display - * "undefined" -- because after all, undefined and "undefined" are EXACTLY the same thing, right? - * - * TODO: This is literally all I've done to support remote disk images. There's probably more - * I should do, like dynamically updating "listDisks" to include new entries, and adding new entries - * to the save/restore data. - */ - if (sDiskPath == RK11.SOURCE.REMOTE) { - sDiskPath = window.prompt("Enter the URL of a remote disk image.", "") || ""; - if (!sDiskPath) return; - sDiskName = Str.getBaseName(sDiskPath); - this.status("Attempting to load " + sDiskPath + " as \"" + sDiskName + "\""); - this.sDiskSource = RK11.SOURCE.REMOTE; - } - else { - this.sDiskSource = sDiskPath; - } - - this.loadDrive(iDrive, sDiskName, sDiskPath, false, file); - } - - /** - * bootSelectedDisk() - * - * @this {RK11} - */ - bootSelectedDisk() - { - var drive; - var controlDrives = this.bindings["listDrives"]; - var iDrive = controlDrives && Str.parseInt(controlDrives.value, 10); - - if (iDrive == null || iDrive < 0 || iDrive >= this.aDrives.length || !(drive = this.aDrives[iDrive])) { - this.notice("Unable to boot the selected drive"); - return; - } - if (!drive.disk) { - this.notice("Load a disk into the drive first"); - return; - } - /* - * NOTE: We're calling setReset() BEFORE reading the boot code in order to eliminate any side-effects - * of the previous state of either the controller OR the CPU; for example, we don't want any previous MMU - * or UNIBUS Map registers affecting the simulated readData() call. Also, some boot code (eg, RSTS/E) - * expects the controller to be in a READY state; since setReset() triggers a call to our reset() handler, - * a READY state is assured, and the readData() call shouldn't do anything to change that. - */ - this.cpu.setReset(0, true); - var err = this.readData(drive, 0, 0, 0, 512, 0x0000, 2); - if (err) { - this.notice("Unable to read the boot sector (" + err + ")"); - } - } - - /** - * loadDrive(iDrive, sDiskName, sDiskPath, fAutoMount, file) - * - * NOTE: If sDiskPath is already loaded, nothing needs to be done. - * - * @this {RK11} - * @param {number} iDrive - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {boolean} [fAutoMount] - * @param {File} [file] is set if there's an associated File object - * @return {number} 1 if disk loaded, 0 if queued up (or busy), -1 if already loaded - */ - loadDrive(iDrive, sDiskName, sDiskPath, fAutoMount, file) - { - var nResult = -1; - var drive = this.aDrives[iDrive]; - - if (drive.sDiskPath.toLowerCase() != sDiskPath.toLowerCase()) { - - nResult++; - this.unloadDrive(iDrive, true); - - if (drive.fBusy) { - this.notice("RK11 busy"); - } - else { - // this.status("disk queued: " + sDiskName); - drive.fBusy = true; - if (fAutoMount) { - drive.fAutoMount = true; - this.cAutoMount++; - if (this.messageEnabled()) this.printMessage("auto-loading disk: " + sDiskName); - } - drive.fLocal = !!file; - var disk = new DiskPDP11(this, drive, DiskAPI.MODE.PRELOAD); - if (disk.load(sDiskName, sDiskPath, file, this.finishLoadDrive)) { - nResult++; - } - } - } - return nResult; - } - - /** - * finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) - * - * The disk parameter is set if the disk was successfully loaded, null if not. - * - * @this {RK11} - * @param {Object} drive - * @param {DiskPDP11} disk - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {boolean} [fAutoMount] - */ - finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) - { - var aDiskInfo; - - drive.fBusy = false; - - if (disk) { - /* - * TODO: While this is a perfectly reasonable thing to do, one wonders if the Disk object shouldn't - * have done this itself, since we passed our Drive object to it (it already knows the drive's limits). - */ - if (disk.nCylinders > drive.nCylinders || disk.nHeads > drive.nHeads /* || disk.nSectors > drive.nSectors */) { - this.notice("Disk \"" + sDiskName + "\" too large for drive " + this.getDriveName(drive.iDrive)); - disk = null; - } - } - - if (disk) { - drive.disk = disk; - drive.sDiskName = sDiskName; - drive.sDiskPath = sDiskPath; - - /* - * Adding local disk image names to the disk list seems like a nice idea, but it's too confusing, - * because then it looks like the "Mount" button should be able to (re)load them, and that can NEVER - * happen, for security reasons; local disk images can ONLY be loaded via the "Mount" button after - * the user has selected them via the "Choose File" button. - * - * this.addDisk(sDiskName, sDiskPath); - * - * So we're going to take a different approach: when displayDisk() is asked to display the name - * of a local disk image, it will map all such disks to "Local Disk", and any attempt to "Mount" such - * a disk, will essentially result in a "Disk not found" error. - */ - // this.addDiskHistory(sDiskName, sDiskPath, disk); - - /* - * For a local disk (ie, one loaded via mountDrive()), the disk.restore() performed by addDiskHistory() - * may have altered the disk geometry, so refresh the disk info. - */ - // aDiskInfo = disk.info(); - - /* - * Clearly, a successful mount implies a disk change, and I suppose that, technically, an *unsuccessful* - * mount should imply the same, but what would the real-world analog be? Inserting a piece of cardboard - * instead of an actual disk? In any case, if we can do the user a favor by pretending (as far as the - * disk change line is concerned) that an unsuccessful mount never happened, let's do it. - * - * Successful unmounts are a different story, however; those *do* trigger a change. See unloadDrive(). - */ - // this.regInput |= FDC.REG_INPUT.DISK_CHANGE; - - /* - * With the addition of notify(), users are now "alerted" whenever a disk has finished loading; - * notify() is selective about its output, using print() if a print window is open, alert() otherwise. - */ - this.notice("Loaded disk \"" + sDiskName + "\" in drive " + this.getDriveName(drive.iDrive), drive.fAutoMount || fAutoMount); - - /* - * Since you usually want the Computer to have focus again after loading a new disk, let's try automatically - * updating the focus after a successful load. - */ - if (this.cmp) this.cmp.setFocus(); - } - else { - drive.fLocal = false; - } - - if (drive.fAutoMount) { - drive.fAutoMount = false; - if (!--this.cAutoMount) this.setReady(); - } - - this.displayDisk(drive.iDrive); - } - - /** - * addDisk(sName, sPath, fTop) - * - * @this {RK11} - * @param {string} sName - * @param {string} sPath - * @param {boolean} [fTop] (default is bottom) - */ - addDisk(sName, sPath, fTop) - { - var controlDisks = this.bindings["listDisks"]; - if (controlDisks && controlDisks.options) { - for (var i = 0; i < controlDisks.options.length; i++) { - if (controlDisks.options[i].value == sPath) return; - } - var controlOption = document.createElement("option"); - controlOption.text = sName; - controlOption.value = sPath; - if (fTop && controlDisks.childNodes[0]) { - controlDisks.insertBefore(controlOption, controlDisks.childNodes[0]); - } else { - controlDisks.appendChild(controlOption); - } - } - } - - /** - * findDisk(sPath) - * - * This is used to deal with mount requests (eg, autoMount) that supply a path without a name; - * if we can find the path in the "listDisks" control, then we return the associated disk name. - * - * @this {RK11} - * @param {string} sPath - * @return {string|null} - */ - findDisk(sPath) - { - var controlDisks = this.bindings["listDisks"]; - if (controlDisks && controlDisks.options) { - for (var i = 0; i < controlDisks.options.length; i++) { - var control = controlDisks.options[i]; - if (control.value == sPath) return control.text; - } - } - return Str.getBaseName(sPath, true); - } - - /** - * displayDisk(iDrive, fUpdateDrive) - * - * @this {RK11} - * @param {number} iDrive (unvalidated) - * @param {boolean} [fUpdateDrive] is true to update the drive list to match the specified drive (eg, the auto-mount case) - */ - displayDisk(iDrive, fUpdateDrive) - { - /* - * First things first: validate iDrive. - */ - if (iDrive >= 0 && iDrive < this.aDrives.length) { - var drive = this.aDrives[iDrive]; - var controlDisks = this.bindings["listDisks"]; - var controlDrives = this.bindings["listDrives"]; - /* - * Next, make sure controls for both drives and disks exist. - */ - if (controlDisks && controlDrives && controlDisks.options && controlDrives.options) { - /* - * Next, make sure the drive whose disk we're updating is the currently selected drive. - */ - var i; - var iDriveSelected = Str.parseInt(controlDrives.value, 10); - var sTargetPath = (drive.fLocal? RK11.SOURCE.LOCAL : drive.sDiskPath); - if (!isNaN(iDriveSelected) && iDriveSelected == iDrive) { - for (i = 0; i < controlDisks.options.length; i++) { - if (controlDisks.options[i].value == sTargetPath) { - if (controlDisks.selectedIndex != i) { - controlDisks.selectedIndex = i; - } - break; - } - } - if (i == controlDisks.options.length) controlDisks.selectedIndex = 0; - } - if (fUpdateDrive) { - for (i = 0; i < controlDrives.options.length; i++) { - if (Str.parseInt(controlDrives.options[i].value, 10) == drive.iDrive) { - if (controlDrives.selectedIndex != i) { - controlDrives.selectedIndex = i; - } - break; - } - } - } - } - } - } - - /** - * unloadDrive(iDrive, fLoading) - * - * @this {RK11} - * @param {number} iDrive - * @param {boolean} [fLoading] - */ - unloadDrive(iDrive, fLoading) - { - var drive = this.aDrives[iDrive]; - - if (drive.disk || fLoading === false) { - - /* - * Before we toss the disk's information, capture any deltas that may have occurred. - */ - // this.updateDiskHistory(drive.sDiskName, drive.sDiskPath, drive.disk); - - drive.sDiskName = ""; - drive.sDiskPath = ""; - drive.disk = null; - drive.fLocal = false; - - // this.regInput |= FDC.REG_INPUT.DISK_CHANGE; - - if (!fLoading) { - this.notice("Drive " + this.getDriveName(iDrive) + " unloaded", fLoading); - this.sDiskSource = RK11.SOURCE.NONE; - this.displayDisk(iDrive); - } - } - } - - /** - * unloadAllDrives(fDiscard) - * - * @this {RK11} - * @param {boolean} fDiscard to discard all disk history before unloading - */ - unloadAllDrives(fDiscard) - { - // if (fDiscard) this.aDiskHistory = []; - - for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { - this.unloadDrive(iDrive, true); - } - } - - /** - * initController(data) - * - * @this {RK11} - * @param {Array} [data] - * @return {boolean} true if successful, false if failure - */ - initController(data) - { - var i = 0; - if (!data) data = []; - this.regRKDS = data[i++] || (RK11.RKDS.RK05 | RK11.RKDS.SOK | RK11.RKDS.RRDY); - this.regRKER = data[i++] || 0; - this.regRKCS = data[i++] || (RK11.RKCS.CRDY); - this.regRKWC = data[i++] || 0; - this.regRKBA = data[i++] || 0; - this.regRKDA = data[i++] || 0; - this.regRKDB = data[i] || 0; // TODO: Determine if there's anything we should be doing to the RKDB register - - var fSuccess = true; - for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { - var drive = this.aDrives[iDrive]; - if (drive === undefined) { - drive = this.aDrives[iDrive] = {}; - } - if (!this.initDrive(drive, iDrive)) { - fSuccess = false; - } - } - return fSuccess; - } - - /** - * initDrive(drive, iDrive, data) - * - * TODO: Consider a separate Drive class that any drive controller can use, since there's a lot of commonality - * between the drive objects created by disk controllers. This will clean up overall drive management and allow - * us to factor out some common Drive methods. - * - * @this {RK11} - * @param {Object} drive - * @param {number} iDrive - * @param {Array|undefined} [data] - * @return {boolean} true if successful, false if failure - */ - initDrive(drive, iDrive, data) - { - var i = 0; - var fSuccess = true; - - drive.iDrive = iDrive; - drive.name = this.idComponent; - drive.fBusy = drive.fLocal = false; - - /* - * NOTE: We initialize the following drive properties to their MAXIMUMs; disks may have - * these or SMALLER values (subject to the limits of what the controller supports, of course). - */ - drive.nCylinders = 203; - drive.nHeads = 2; - drive.nSectors = 12; - drive.cbSector = 512; - drive.fRemovable = true; - - /* - * The next group of properties are set by various controller command sequences. - */ - drive.bHead = 0; - drive.bCylinder = 0; - drive.bSector = 1; - drive.bSectorEnd = drive.nSectors; // aka EOT - drive.nBytes = drive.cbSector; - - /* - * The next group of properties are managed by worker functions (eg, doRead()) to maintain state across DMA requests. - */ - drive.ibSector = 0; - drive.sector = null; - - if (!drive.disk) drive.sDiskPath = ""; // ensure this is initialized to a default that displayDisk() can deal with - - drive.status = RK11.RKDS.RK05 | RK11.RKDS.SOK | RK11.RKDS.RRDY; - - return fSuccess; + return [ + this.regRKDS, + this.regRKER, + this.regRKCS, + this.regRKWC, + this.regRKBA, + this.regRKDA, + this.regRKDB + ]; } /** @@ -1417,20 +598,9 @@ class RK11 extends Component { } } -/* - * There's nothing super special about these values, except that NONE should be falsey and the others should not. - */ -RK11.SOURCE = { - NONE: "", - LOCAL: "?", - REMOTE: "??" -}; - /* * Alias RK11 definitions as class constants */ -RK11.PRI = PDP11.RK11.PRI; -RK11.VEC = PDP11.RK11.VEC; RK11.RKDS = PDP11.RK11.RKDS; // 177400: Drive Status Register RK11.RKER = PDP11.RK11.RKER; // 177402: Error Register RK11.RKCS = PDP11.RK11.RKCS; // 177404: Control Status Register diff --git a/modules/pdp11/lib/rl11.js b/modules/pdp11/lib/rl11.js index 65fc5024f..e5a6fb853 100644 --- a/modules/pdp11/lib/rl11.js +++ b/modules/pdp11/lib/rl11.js @@ -5,6 +5,10 @@ * * This file is part of PCjs, a computer emulation software project at . * + * It has been adapted from the JavaScript PDP 11/70 Emulator written by Paul Nankervis + * (paulnank@hotmail.com) at . This code may be used + * freely provided the original authors are acknowledged in any modified source code. + * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. @@ -30,41 +34,12 @@ if (NODE) { var Str = require("../../shared/es6/strlib"); - var Web = require("../../shared/es6/weblib"); - var DiskAPI = require("../../shared/es6/diskapi"); - var Component = require("../../shared/es6/component"); - var State = require("../../shared/es6/state"); var PDP11 = require("./defines"); var MessagesPDP11 = require("./messages"); - var DiskPDP11 = require("./disk"); + var DriveController = require("./drive"); } -/** - * Since the Closure Compiler treats ES6 classes as @struct rather than @dict by default, - * it deters us from defining named properties on our components; eg: - * - * this['exports'] = {...} - * - * results in an error: - * - * Cannot do '[]' access on a struct - * - * So, in order to define 'exports', we must override the @struct assumption by annotating - * the class as @unrestricted (or @dict). Note that this must be done both here and in the - * Component class, because otherwise the Compiler won't allow us to *reference* the named - * property either. - * - * TODO: Consider marking ALL our classes unrestricted, because otherwise it forces us to - * define every single property the class uses in its constructor, which results in a fair - * bit of redundant initialization, since many properties aren't (and don't need to be) fully - * initialized until the appropriate init(), reset(), restore(), etc. function is called. - * - * The upside, however, may be that since the structure of the class is completely defined by - * the constructor, JavaScript engines may be able to optimize and run more efficiently. - * - * @unrestricted - */ -class RL11 extends Component { +class RL11 extends DriveController { /** * RL11(parms) * @@ -85,926 +60,61 @@ class RL11 extends Component { */ constructor(parms) { - super("RL11", parms, RL11, MessagesPDP11.RL11); + super("RL11", parms, MessagesPDP11.RL11, PDP11.RL11, PDP11.RL11.RL02K, RL11.UNIBUS_IOTABLE); /* - * We preliminarily parse and record any 'autoMount' object now, but we no longer process it - * until initBus(), because the Computer's getMachineParm() service may have an override for us. - */ - this.configMount = this.parseConfig(parms['autoMount']); - this.cAutoMount = 0; - - /* - * The RL11 has two Drive Select bits, representing up to four drives. - */ - this.nDrives = 4; - this.aDrives = new Array(this.nDrives); - this.fLocalDisks = (!Web.isMobile() && window && 'FileReader' in window); - this.sDiskSource = RL11.SOURCE.NONE; - - this.irq = null; - - /* - * Define all the properties to be initialized by initController() + * Define all the registers required for this controller. */ this.regRLCS = this.regRLBA = this.regRLDA = this.tmpRLDA = this.regRLMP = this.regRLBE = 0; - - this['exports'] = { - 'selectDrive': this.selectDrive - }; } /** - * parseConfig(config) + * initController(aRegs) * * @this {RL11} - * @param {*} config - * @return {*} - */ - parseConfig(config) - { - if (config && typeof config == "string") { - try { - /* - * The most likely source of any exception will be right here, where we're parsing - * this JSON-encoded data. - */ - config = eval("(" + config + ")"); - } catch (e) { - Component.error(this.type + " auto-mount error: " + e.message + " (" + config + ")"); - config = null; - } - } - return config || {}; - } - - /** - * setBinding(sType, sBinding, control, sValue) - * - * @this {RL11} - * @param {string|null} sType is the type of the HTML control (eg, "button", "list", "text", etc) - * @param {string} sBinding is the value of the 'binding' parameter stored in the HTML control's "data-value" attribute (eg, "listDisks") - * @param {Object} control is the HTML control DOM object (eg, HTMLButtonElement) - * @param {string} [sValue] optional data value - * @return {boolean} true if binding was successful, false if unrecognized binding request - */ - setBinding(sType, sBinding, control, sValue) - { - var rl11 = this; - - switch (sBinding) { - - case "listDisks": - this.bindings[sBinding] = control; - - control.onchange = function onChangeListDisks(event) { - var controlDesc = rl11.bindings["descDisk"]; - var controlOption = control.options && control.options[control.selectedIndex]; - if (controlDesc && controlOption) { - var dataValue = {}; - var sValue = controlOption.getAttribute("data-value"); - if (sValue) { - try { - dataValue = eval("(" + sValue + ")"); - } catch (e) { - Component.error("RL11 option error: " + e.message); - } - } - var sHTML = dataValue['desc']; - if (sHTML === undefined) sHTML = ""; - var sHRef = dataValue['href']; - if (sHRef !== undefined) sHTML = "" + sHTML + ""; - controlDesc.innerHTML = sHTML; - } - }; - return true; - - case "descDisk": - case "listDrives": - this.bindings[sBinding] = control; - /* - * I tried going with onclick instead of onchange, so that if you wanted to confirm what's - * loaded in a particular drive, you could click the drive control without having to change it. - * However, that doesn't seem to work for all browsers, so I've reverted to onchange. - */ - control.onchange = function onChangeListDrives(event) { - var iDrive = Str.parseInt(control.value, 10); - if (iDrive != null) rl11.displayDisk(iDrive); - }; - return true; - - case "loadDisk": - this.bindings[sBinding] = control; - - control.onclick = function onClickLoadDrive(event) { - var controlDisks = rl11.bindings["listDisks"]; - if (controlDisks && controlDisks.options) { - var sDiskName = controlDisks.options[controlDisks.selectedIndex].text; - var sDiskPath = controlDisks.value; - rl11.loadSelectedDrive(sDiskName, sDiskPath); - } - }; - return true; - - case "bootDisk": - this.bindings[sBinding] = control; - - control.onclick = function onClickBootDisk(event) { - rl11.bootSelectedDisk(); - }; - return true; - - case "saveDisk": - /* - * Yes, technically, this feature does not require "Local disk support" (which is really a reference - * to FileReader support), but since fLocalDisks is also false for all mobile devices, and since there - * is an "orthogonality" to disabling both features in tandem, let's just let it slide, OK? - */ - if (!this.fLocalDisks) { - if (DEBUG) this.log("Local disk support not available"); - /* - * We could also simply hide the control; eg: - * - * control.style.display = "none"; - * - * but removing the control altogether seems better. - */ - control.parentNode.removeChild(/** @type {Node} */ (control)); - return false; - } - - this.bindings[sBinding] = control; - - control.onclick = function onClickSaveDrive(event) { - var controlDrives = rl11.bindings["listDrives"]; - if (controlDrives && controlDrives.options && rl11.aDrives) { - var iDriveSelected = Str.parseInt(controlDrives.value, 10) || 0; - var drive = rl11.aDrives[iDriveSelected]; - if (drive) { - /* - * Note the similarity (and hence factoring opportunity) between this code and the HDC's "saveHD*" binding. - */ - var disk = drive.disk; - if (disk) { - if (DEBUG) rl11.println("saving disk " + disk.sDiskPath + "..."); - var sAlert = Web.downloadFile(disk.encodeAsBase64(), "octet-stream", true, disk.sDiskFile.replace(".json", ".img")); - Component.alertUser(sAlert); - } else { - rl11.notice("No disk loaded in drive."); - } - } else { - rl11.notice("No disk drive selected."); - } - } - }; - return true; - - case "mountDisk": - if (!this.fLocalDisks) { - if (DEBUG) this.log("Local disk support not available"); - /* - * We could also simply hide the control; eg: - * - * control.style.display = "none"; - * - * but removing the control altogether seems better. - */ - control.parentNode.removeChild(/** @type {Node} */ (control)); - return false; - } - - this.bindings[sBinding] = control; - - /* - * Enable "Mount" button only if a file is actually selected - */ - control.addEventListener('change', function() { - var fieldset = control.children[0]; - var files = fieldset.children[0].files; - var submit = fieldset.children[1]; - submit.disabled = !files.length; - }); - - control.onsubmit = function(event) { - var file = event.currentTarget[1].files[0]; - if (file) { - var sDiskPath = file.name; - var sDiskName = Str.getBaseName(sDiskPath, true); - rl11.loadSelectedDrive(sDiskName, sDiskPath, file); - } - /* - * Prevent reloading of web page after form submission - */ - return false; - }; - return true; - - default: - break; - } - return false; - } - - /** - * initBus(cmp, bus, cpu, dbg) - * - * @this {RL11} - * @param {ComputerPDP11} cmp - * @param {BusPDP11} bus - * @param {CPUStatePDP11} cpu - * @param {DebuggerPDP11} dbg - */ - initBus(cmp, bus, cpu, dbg) - { - this.cmp = cmp; - this.bus = bus; - this.cpu = cpu; - this.dbg = dbg; - - var configMount = this.parseConfig(this.cmp.getMachineParm('autoMount')); - - /* - * Add only drives from the machine-wide autoMount configuration that match drives managed by this component. - */ - if (configMount) { - for (var sDrive in configMount) { - if (sDrive.substr(0, 2) != this.type.substr(0, 2)) continue; - this.configMount[sDrive] = configMount[sDrive]; - } - } - - /* - * If we didn't need auto-mount support, we could defer controller initialization until we received - * a powerUp() notification, at which point reset() would call initController(), or restore() would restore - * the controller; in that case, all we'd need to do here is call setReady(). - */ - this.initController(); - - this.irq = this.cpu.addIRQ(RL11.VEC, RL11.PRI, MessagesPDP11.RL11); - - bus.addIOTable(this, RL11.UNIBUS_IOTABLE); - bus.addResetHandler(this.reset.bind(this)); - - this.addDisk("None", RL11.SOURCE.NONE, true); - if (this.fLocalDisks) this.addDisk("Local Disk", RL11.SOURCE.LOCAL); - this.addDisk("Remote Disk", RL11.SOURCE.REMOTE); - - if (!this.autoMount()) this.setReady(); - } - - /** - * getDriveName(iDrive) - * - * @this {RL11} - * @param {number} iDrive - * @return {string} - */ - getDriveName(iDrive) - { - return "RL" + iDrive; - } - - /** - * getDriveNumber(sDrive) - * - * @this {RL11} - * @param {string} sDrive - * @return {number} (0-3, or -1 if error) - */ - getDriveNumber(sDrive) - { - var iDrive = -1; - if (sDrive) { - iDrive = sDrive.charCodeAt(sDrive.length - 1) - 0x30; - if (iDrive < 0 || iDrive > 9) iDrive = -1; - } - return iDrive; - } - - /** - * powerUp(data, fRepower) - * - * @this {RL11} - * @param {Object|null} data - * @param {boolean} [fRepower] + * @param {Array} [aRegs] * @return {boolean} true if successful, false if failure */ - powerUp(data, fRepower) + initController(aRegs) { - if (!fRepower) { - if (!data || !this.restore) { - this.reset(); - if (this.cmp.fReload) { - /* - * If the computer's fReload flag is set, we're required to toss all currently - * loaded disks and remount all disks specified in the auto-mount configuration. - */ - this.unloadAllDrives(true); - this.autoMount(true); - } - } else { - if (!this.restore(data)) return false; - } - /* - * Populate the HTML controls to match the actual (well, um, specified) number of floppy drives. - */ - var controlDrives; - if ((controlDrives = this.bindings['listDrives'])) { - while (controlDrives.firstChild) { - controlDrives.removeChild(controlDrives.firstChild); - } - controlDrives.value = ""; - for (var iDrive = 0; iDrive < this.nDrives; iDrive++) { - var controlOption = document.createElement("option"); - controlOption.value = iDrive; - controlOption.text = this.getDriveName(iDrive); - controlDrives.appendChild(controlOption); - } - if (this.nDrives > 0) { - controlDrives.value = "0"; - this.displayDisk(0); - } - } + if (!aRegs) { + aRegs = [(RL11.RLCS.DRDY | RL11.RLCS.CRDY), 0, 0, 0, 0, 0]; } + + /* + * ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse + * of what saveController() does when it collects a bunch of object properties into an array. + */ + [ + this.regRLCS, + this.regRLBA, + this.regRLDA, + this.tmpRLDA, + this.regRLMP, + this.regRLBE + ] = aRegs; + return true; } - /** - * powerDown(fSave, fShutdown) - * - * @this {RL11} - * @param {boolean} [fSave] - * @param {boolean} [fShutdown] - * @return {Object|boolean} component state if fSave; otherwise, true if successful, false if failure - */ - powerDown(fSave, fShutdown) - { - return fSave? this.save() : true; - } - - /** - * reset() - * - * @this {RL11} - */ - reset() - { - this.initController(); - } - - /** - * save() - * - * This implements save support for the RL11 component. - * - * @this {RL11} - * @return {Object} - */ - save() - { - var state = new State(this); - // state.set(0, this.saveController()); - return state.data(); - } - - /** - * restore(data) - * - * This implements restore support for the RL11 component. - * - * @this {RL11} - * @param {Object} data - * @return {boolean} true if successful, false if failure - */ - restore(data) - { - return this.initController(data[0]); - } - /** * saveController() * + * Basically, the inverse of initController(). + * * @this {RL11} * @return {Array} */ saveController() { - return []; - } - - /** - * autoMount(fRemount) - * - * @this {RL11} - * @param {boolean} [fRemount] is true if we're remounting all auto-mounted disks - * @return {boolean} true if one or more disk images are being auto-mounted, false if none - */ - autoMount(fRemount) - { - if (!fRemount) this.cAutoMount = 0; - for (var sDrive in this.configMount) { - var configDrive = this.configMount[sDrive]; - var sDiskPath = configDrive['path'] || ""; - var sDiskName = configDrive['name'] || this.findDisk(sDiskPath); - if (sDiskPath && sDiskName) { - var iDrive = this.getDriveNumber(sDrive); - if (iDrive >= 0 && iDrive < this.aDrives.length) { - if (!this.loadDrive(iDrive, sDiskName, sDiskPath, true) && fRemount) { - this.setReady(false); - } - continue; - } - } - this.notice("Incorrect auto-mount settings for drive " + sDrive + " (" + JSON.stringify(configDrive) + ")"); - } - return !!this.cAutoMount; - } - - /** - * loadSelectedDrive(sDiskName, sDiskPath, file) - * - * @this {RL11} - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {File} [file] is set if there's an associated File object - */ - loadSelectedDrive(sDiskName, sDiskPath, file) - { - var controlDrives = this.bindings["listDrives"]; - var iDrive = controlDrives && Str.parseInt(controlDrives.value, 10); - - if (iDrive === undefined || iDrive < 0 || iDrive >= this.aDrives.length) { - this.notice("Unable to load the selected drive"); - return; - } - - if (!sDiskPath) { - this.unloadDrive(iDrive); - return; - } - - if (sDiskPath == RL11.SOURCE.LOCAL) { - this.notice('Use "Choose File" and "Mount" to select and load a local disk.'); - return; - } - - /* - * If the special RL11.SOURCE.REMOTE path is selected, then we want to prompt the user for a URL. - * Oh, and make sure we pass an empty string as the 2nd parameter to prompt(), so that IE won't display - * "undefined" -- because after all, undefined and "undefined" are EXACTLY the same thing, right? - * - * TODO: This is literally all I've done to support remote disk images. There's probably more - * I should do, like dynamically updating "listDisks" to include new entries, and adding new entries - * to the save/restore data. - */ - if (sDiskPath == RL11.SOURCE.REMOTE) { - sDiskPath = window.prompt("Enter the URL of a remote disk image.", "") || ""; - if (!sDiskPath) return; - sDiskName = Str.getBaseName(sDiskPath); - this.status("Attempting to load " + sDiskPath + " as \"" + sDiskName + "\""); - this.sDiskSource = RL11.SOURCE.REMOTE; - } - else { - this.sDiskSource = sDiskPath; - } - - this.loadDrive(iDrive, sDiskName, sDiskPath, false, file); - } - - /** - * bootSelectedDisk() - * - * @this {RL11} - */ - bootSelectedDisk() - { - var drive; - var controlDrives = this.bindings["listDrives"]; - var iDrive = controlDrives && Str.parseInt(controlDrives.value, 10); - - if (iDrive == null || iDrive < 0 || iDrive >= this.aDrives.length || !(drive = this.aDrives[iDrive])) { - this.notice("Unable to boot the selected drive"); - return; - } - if (!drive.disk) { - this.notice("Load a disk into the drive first"); - return; - } - /* - * NOTE: We're calling setReset() BEFORE reading the boot code in order to eliminate any side-effects - * of the previous state of either the controller OR the CPU; for example, we don't want any previous MMU - * or UNIBUS Map registers affecting the simulated readData() call. Also, some boot code (eg, RSTS/E) - * expects the controller to be in a READY state; since setReset() triggers a call to our reset() handler, - * a READY state is assured, and the readData() call shouldn't do anything to change that. - */ - this.cpu.setReset(0, true); - var err = this.readData(drive, 0, 0, 0, 512, 0x0000); - if (err) { - this.notice("Unable to read the boot sector (" + err + ")"); - } - } - - /** - * loadDrive(iDrive, sDiskName, sDiskPath, fAutoMount, file) - * - * NOTE: If sDiskPath is already loaded, nothing needs to be done. - * - * @this {RL11} - * @param {number} iDrive - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {boolean} [fAutoMount] - * @param {File} [file] is set if there's an associated File object - * @return {number} 1 if disk loaded, 0 if queued up (or busy), -1 if already loaded - */ - loadDrive(iDrive, sDiskName, sDiskPath, fAutoMount, file) - { - var nResult = -1; - var drive = this.aDrives[iDrive]; - - if (drive.sDiskPath.toLowerCase() != sDiskPath.toLowerCase()) { - - nResult++; - this.unloadDrive(iDrive, true); - - if (drive.fBusy) { - this.notice("RL11 busy"); - } - else { - // this.status("disk queued: " + sDiskName); - drive.fBusy = true; - if (fAutoMount) { - drive.fAutoMount = true; - this.cAutoMount++; - if (this.messageEnabled()) this.printMessage("auto-loading disk: " + sDiskName); - } - drive.fLocal = !!file; - var disk = new DiskPDP11(this, drive, DiskAPI.MODE.PRELOAD); - if (disk.load(sDiskName, sDiskPath, file, this.finishLoadDrive)) { - nResult++; - } - } - } - return nResult; - } - - /** - * finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) - * - * The disk parameter is set if the disk was successfully loaded, null if not. - * - * @this {RL11} - * @param {Object} drive - * @param {DiskPDP11} disk - * @param {string} sDiskName - * @param {string} sDiskPath - * @param {boolean} [fAutoMount] - */ - finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) - { - drive.fBusy = false; - - if (disk) { - /* - * TODO: While this is a perfectly reasonable thing to do, one wonders if the Disk object shouldn't - * have done this itself, since we passed our Drive object to it (it already knows the drive's limits). - */ - if (disk.nCylinders > drive.nCylinders || disk.nHeads > drive.nHeads /* || disk.nSectors > drive.nSectors */) { - this.notice("Disk \"" + sDiskName + "\" too large for drive " + this.getDriveName(drive.iDrive)); - disk = null; - } - } - - if (disk) { - drive.disk = disk; - drive.sDiskName = sDiskName; - drive.sDiskPath = sDiskPath; - - /* - * Adding local disk image names to the disk list seems like a nice idea, but it's too confusing, - * because then it looks like the "Mount" button should be able to (re)load them, and that can NEVER - * happen, for security reasons; local disk images can ONLY be loaded via the "Mount" button after - * the user has selected them via the "Choose File" button. - * - * this.addDisk(sDiskName, sDiskPath); - * - * So we're going to take a different approach: when displayDisk() is asked to display the name - * of a local disk image, it will map all such disks to "Local Disk", and any attempt to "Mount" such - * a disk, will essentially result in a "Disk not found" error. - */ - // this.addDiskHistory(sDiskName, sDiskPath, disk); - - /* - * For a local disk (ie, one loaded via mountDrive()), the disk.restore() performed by addDiskHistory() - * may have altered the disk geometry, so refresh the disk info. - */ - // aDiskInfo = disk.info(); - - /* - * Clearly, a successful mount implies a disk change, and I suppose that, technically, an *unsuccessful* - * mount should imply the same, but what would the real-world analog be? Inserting a piece of cardboard - * instead of an actual disk? In any case, if we can do the user a favor by pretending (as far as the - * disk change line is concerned) that an unsuccessful mount never happened, let's do it. - * - * Successful unmounts are a different story, however; those *do* trigger a change. See unloadDrive(). - */ - // this.regInput |= FDC.REG_INPUT.DISK_CHANGE; - - /* - * With the addition of notify(), users are now "alerted" whenever a disk has finished loading; - * notify() is selective about its output, using print() if a print window is open, alert() otherwise. - */ - this.notice("Loaded disk \"" + sDiskName + "\" in drive " + this.getDriveName(drive.iDrive), drive.fAutoMount || fAutoMount); - - /* - * Since you usually want the Computer to have focus again after loading a new disk, let's try automatically - * updating the focus after a successful load. - */ - if (this.cmp) this.cmp.setFocus(); - } - else { - drive.fLocal = false; - } - - if (drive.fAutoMount) { - drive.fAutoMount = false; - if (!--this.cAutoMount) this.setReady(); - } - - this.displayDisk(drive.iDrive); - } - - /** - * addDisk(sName, sPath, fTop) - * - * @this {RL11} - * @param {string} sName - * @param {string} sPath - * @param {boolean} [fTop] (default is bottom) - */ - addDisk(sName, sPath, fTop) - { - var controlDisks = this.bindings["listDisks"]; - if (controlDisks && controlDisks.options) { - for (var i = 0; i < controlDisks.options.length; i++) { - if (controlDisks.options[i].value == sPath) return; - } - var controlOption = document.createElement("option"); - controlOption.text = sName; - controlOption.value = sPath; - if (fTop && controlDisks.childNodes[0]) { - controlDisks.insertBefore(controlOption, controlDisks.childNodes[0]); - } else { - controlDisks.appendChild(controlOption); - } - } - } - - /** - * findDisk(sPath) - * - * This is used to deal with mount requests (eg, autoMount) that supply a path without a name; - * if we can find the path in the "listDisks" control, then we return the associated disk name. - * - * @this {RL11} - * @param {string} sPath - * @return {string|null} - */ - findDisk(sPath) - { - var controlDisks = this.bindings["listDisks"]; - if (controlDisks && controlDisks.options) { - for (var i = 0; i < controlDisks.options.length; i++) { - var control = controlDisks.options[i]; - if (control.value == sPath) return control.text; - } - } - return Str.getBaseName(sPath, true); - } - - /** - * displayDisk(iDrive, fUpdateDrive) - * - * This ensures that the selected disk matches the drive's sDiskPath property, and if fUpdateDrive is set, - * it also ensures that the selected drive matches the specified drive number. - * - * @this {RL11} - * @param {number} iDrive - * @param {boolean} [fUpdateDrive] is true to update the drive list to match the specified drive (eg, the auto-mount case) - * @return {boolean} true if successful, false if not - */ - displayDisk(iDrive, fUpdateDrive) - { - /* - * First things first: validate iDrive. - */ - var fSuccess = false; - if (iDrive >= 0 && iDrive < this.aDrives.length) { - var drive = this.aDrives[iDrive]; - var controlDisks = this.bindings["listDisks"]; - var controlDrives = this.bindings["listDrives"]; - /* - * Next, make sure controls for both drives and disks exist. - */ - if (controlDisks && controlDrives && controlDisks.options && controlDrives.options) { - /* - * Next, update the drive if the caller has requested it. - */ - var i; - if (fUpdateDrive) { - this.assert(iDrive == drive.iDrive); - for (i = 0; i < controlDrives.options.length; i++) { - if (Str.parseInt(controlDrives.options[i].value, 10) == drive.iDrive) { - if (controlDrives.selectedIndex != i) { - controlDrives.selectedIndex = i; - } - fSuccess = true; - break; - } - } - } - /* - * Next, make sure the drive whose disk we're updating is the currently selected drive. - */ - var iDriveSelected = Str.parseInt(controlDrives.value, 10); - var sTargetPath = (drive.fLocal? RL11.SOURCE.LOCAL : drive.sDiskPath); - if (!isNaN(iDriveSelected) && iDriveSelected == iDrive) { - for (i = 0; i < controlDisks.options.length; i++) { - if (controlDisks.options[i].value == sTargetPath) { - if (controlDisks.selectedIndex != i) { - controlDisks.selectedIndex = i; - } - fSuccess = true; - break; - } - } - if (i == controlDisks.options.length) controlDisks.selectedIndex = 0; - } - } - } - return fSuccess; - } - - /** - * selectDrive(sDrive) - * - * Used to programmatically select a drive by name. - * - * @this {RL11} - * @param {number} sDrive - * @return {boolean} true if successful, false if not - */ - selectDrive(sDrive) - { - var controlDrives = this.bindings["listDrives"]; - if (controlDrives && controlDrives.options) { - var nDrives = controlDrives.options.length; - for (var i = 0; i < nDrives; i++) { - if (controlDrives.options[i].innerHTML == sDrive) { - var iDrive = Str.parseInt(controlDrives.options[i].value, 10); - if (iDrive >= 0) { - return this.displayDisk(iDrive, true); - } - } - } - } - return false; - } - - /** - * unloadDrive(iDrive, fLoading) - * - * @this {RL11} - * @param {number} iDrive - * @param {boolean} [fLoading] - */ - unloadDrive(iDrive, fLoading) - { - var drive = this.aDrives[iDrive]; - - if (drive.disk || fLoading === false) { - - /* - * Before we toss the disk's information, capture any deltas that may have occurred. - */ - // this.updateDiskHistory(drive.sDiskName, drive.sDiskPath, drive.disk); - - drive.sDiskName = ""; - drive.sDiskPath = ""; - drive.disk = null; - drive.fLocal = false; - - // this.regInput |= FDC.REG_INPUT.DISK_CHANGE; - - if (!fLoading) { - this.notice("Drive " + this.getDriveName(iDrive) + " unloaded", fLoading); - this.sDiskSource = RL11.SOURCE.NONE; - this.displayDisk(iDrive); - } - } - } - - /** - * unloadAllDrives(fDiscard) - * - * @this {RL11} - * @param {boolean} fDiscard to discard all disk history before unloading - */ - unloadAllDrives(fDiscard) - { - // if (fDiscard) this.aDiskHistory = []; - - for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { - this.unloadDrive(iDrive, true); - } - } - - /** - * initController(data) - * - * @this {RL11} - * @param {Array} [data] - * @return {boolean} true if successful, false if failure - */ - initController(data) - { - var i = 0; - if (!data) data = []; - this.regRLCS = data[i++] || (RL11.RLCS.DRDY | RL11.RLCS.CRDY); - this.regRLBA = data[i++] || 0; - this.regRLDA = data[i++] || 0; - this.tmpRLDA = data[i++] || 0; - this.regRLMP = data[i++] || 0; - this.regRLBE = data[i] || 0; - - var fSuccess = true; - for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { - var drive = this.aDrives[iDrive]; - if (drive === undefined) { - drive = this.aDrives[iDrive] = {}; - } - if (!this.initDrive(drive, iDrive)) { - fSuccess = false; - } - } - return fSuccess; - } - - /** - * initDrive(drive, iDrive, data) - * - * TODO: Consider a separate Drive class that any drive controller can use, since there's a lot of commonality - * between the drive objects created by disk controllers. This will clean up overall drive management and allow - * us to factor out some common Drive methods. - * - * @this {RL11} - * @param {Object} drive - * @param {number} iDrive - * @param {Array|undefined} [data] - * @return {boolean} true if successful, false if failure - */ - initDrive(drive, iDrive, data) - { - var i = 0; - var fSuccess = true; - - drive.iDrive = iDrive; - drive.name = this.idComponent; - drive.fBusy = drive.fLocal = false; - - /* - * NOTE: We initialize the following drive properties to their MAXIMUMs; disks may have - * these or SMALLER values (subject to the limits of what the controller supports, of course). - */ - drive.nCylinders = 512; - drive.nHeads = 2; - drive.nSectors = 40; - drive.cbSector = 256; - drive.fRemovable = true; - - /* - * The next group of properties are set by various controller command sequences. - */ - drive.bHead = 0; - drive.bCylinder = 0; - drive.bSector = 1; - drive.bSectorEnd = drive.nSectors; // aka EOT - drive.nBytes = drive.cbSector; - - /* - * The next group of properties are managed by worker functions (eg, doRead()) to maintain state across DMA requests. - */ - drive.ibSector = 0; - drive.sector = null; - - if (!drive.disk) drive.sDiskPath = ""; // ensure this is initialized to a default that displayDisk() can deal with - - /* - * Default drive status bits returned via the controller's Get Status command via the RLMP register - */ - drive.status = RL11.RLMP.GS_ST.LOCKON | RL11.RLMP.GS_BH | RL11.RLMP.GS_HO; - - return fSuccess; + return [ + this.regRLCS, + this.regRLBA, + this.regRLDA, + this.tmpRLDA, + this.regRLMP, + this.regRLBE + ]; } /** @@ -1087,7 +197,7 @@ class RL11 extends Component { if (this.messageEnabled()) this.printMessage(this.type + ": " + sFunc + "(" + iCylinder + ":" + iHead + ":" + iSector + ") " + Str.toOct(addr) + "--" + Str.toOct(addr + (nWords << 1)), true, true); - fInterrupt = fnReadWrite.call(this, drive, iCylinder, iHead, iSector, nWords, addr, this.doneReadWrite.bind(this)); + fInterrupt = fnReadWrite.call(this, drive, iCylinder, iHead, iSector, nWords, addr, 2, false, this.doneReadWrite.bind(this)); break; default: @@ -1101,7 +211,7 @@ class RL11 extends Component { } /** - * readData(drive, iCylinder, iHead, iSector, nWords, addr, done) + * readData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) * * @this {RL11} * @param {Object} drive @@ -1110,10 +220,12 @@ class RL11 extends Component { * @param {number} iSector * @param {number} nWords * @param {number} addr + * @param {number} inc (normally 2, unless inhibited, in which case it's 0) + * @param {boolean} [fCheck] * @param {function(...)} [done] * @return {boolean|number} true if complete, false if queued (or if no done() is supplied, the error code, if any) */ - readData(drive, iCylinder, iHead, iSector, nWords, addr, done) + readData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) { var err = 0; var checksum = 0; @@ -1184,7 +296,7 @@ class RL11 extends Component { } /** - * writeData(drive, iCylinder, iHead, iSector, nWords, addr, done) + * writeData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) * * @this {RL11} * @param {Object} drive @@ -1193,10 +305,12 @@ class RL11 extends Component { * @param {number} iSector * @param {number} nWords * @param {number} addr + * @param {number} inc (normally 2, unless inhibited, in which case it's 0) + * @param {boolean} [fCheck] * @param {function(...)} [done] * @return {boolean|number} true if complete, false if queued (or if no done() is supplied, the error code, if any) */ - writeData(drive, iCylinder, iHead, iSector, nWords, addr, done) + writeData(drive, iCylinder, iHead, iSector, nWords, addr, inc, fCheck, done) { var err = 0; var checksum = 0; @@ -1421,20 +535,9 @@ class RL11 extends Component { } } -/* - * There's nothing super special about these values, except that NONE should be falsey and the others should not. - */ -RL11.SOURCE = { - NONE: "", - LOCAL: "?", - REMOTE: "??" -}; - /* * Alias RL11 definitions as class constants */ -RL11.PRI = PDP11.RL11.PRI; -RL11.VEC = PDP11.RL11.VEC; RL11.RLCS = PDP11.RL11.RLCS; // 174400: Control Status Register RL11.RLBA = PDP11.RL11.RLBA; // 174402: Bus Address Register RL11.RLDA = PDP11.RL11.RLDA; // 174404: Disk Address Register diff --git a/modules/pdp11/lib/rom.js b/modules/pdp11/lib/rom.js index 0b7646120..09dc55ca5 100644 --- a/modules/pdp11/lib/rom.js +++ b/modules/pdp11/lib/rom.js @@ -5,10 +5,6 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. - * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. @@ -64,7 +60,7 @@ class ROMPDP11 extends Component { */ constructor(parmsROM) { - super("ROM", parmsROM, ROMPDP11, MessagesPDP11.ROM); + super("ROM", parmsROM, MessagesPDP11.ROM); this.abInit = null; this.aSymbols = null; @@ -268,14 +264,12 @@ class ROMPDP11 extends Component { */ addROM(addr) { - this.status(this.sizeROM + "-byte ROM at " + Str.toOct(addr)); - if (addr >= BusPDP11.IOPAGE_16BIT && addr < BusPDP11.IOPAGE_16BIT + BusPDP11.IOPAGE_LENGTH) { /* * This code has been added as a work-around to effectively allow us to install small ROMs into portions * of the IOPAGE address space, by installing I/O handlers for the entire range that return the corresponding * bytes of the current ROM image on reads, and ignore any writes (which I'm only assuming is how a typical - * ROM "device" deals with writes; if we remove the write handler, then writes will fault). + * ROM "device" deals with writes; we could remove the write handler, but then writes would fault). * * TODO: It would be more efficient if we parsed ROM data as words rather than bytes, and then installed * only word handlers instead of only byte handlers. It was done this way purely for historical reasons (ie, @@ -286,6 +280,7 @@ class ROMPDP11 extends Component { [addr]: [ROMPDP11.prototype.readROMByte, ROMPDP11.prototype.writeROMByte, null, null, null, this.sizeROM >> 1] }; if (this.bus.addIOTable(this, IOTable)) { + this.status("Added " + this.sizeROM + "-byte ROM at " + Str.toOct(addr)); this.fRetainROM = true; return true; } diff --git a/modules/pdp11/lib/serial.js b/modules/pdp11/lib/serial.js index 06f44ebe9..0db11f202 100644 --- a/modules/pdp11/lib/serial.js +++ b/modules/pdp11/lib/serial.js @@ -5,9 +5,9 @@ * * This file is part of PCjs, a computer emulation software project at . * - * It has been adapted from the JavaScript PDP 11/70 Emulator v1.4 written by Paul Nankervis - * (paulnank@hotmail.com) as of September 2016 at . This code - * may be used freely provided the original authors are acknowledged in any modified source code. + * It has been adapted from the JavaScript PDP 11/70 Emulator written by Paul Nankervis + * (paulnank@hotmail.com) at . This code may be used + * freely provided the original authors are acknowledged in any modified source code. * * PCjs is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 @@ -100,7 +100,7 @@ class SerialPortPDP11 extends Component { */ constructor(parmsSerial) { - super("SerialPort", parmsSerial, SerialPortPDP11, MessagesPDP11.SERIAL); + super("SerialPort", parmsSerial, MessagesPDP11.SERIAL); this.iAdapter = +parmsSerial['adapter']; this.nBaudReceive = +parmsSerial['baudReceive'] || PDP11.DL11.RCSR.BAUD; @@ -389,7 +389,7 @@ class SerialPortPDP11 extends Component { if (this.sendData) { this.fNullModem = fNullModem; this.updateStatus = exports['receiveStatus']; - this.status(this.idMachine + '.' + sSourceID + " connected to " + sTargetID); + this.status("Connected " + this.idMachine + '.' + sSourceID + " to " + sTargetID); return; } } @@ -423,7 +423,7 @@ class SerialPortPDP11 extends Component { */ this.initConnection(this.fNullModem); - if (!data || !this.restore) { + if (!data) { this.reset(); } else { if (!this.restore(data)) return false; @@ -485,30 +485,48 @@ class SerialPortPDP11 extends Component { } /** - * initState(data) + * initState(a) * * @this {SerialPortPDP11} - * @param {Array} [data] + * @param {Array} [a] * @return {boolean} true if successful, false if failure */ - initState(data) + initState(a) { - this.regRBUF = 0; - this.regRCSR = PDP11.DL11.RCSR.CTS; // TODO: I didn't use to set this initially; is this wise? - this.regXCSR = PDP11.DL11.XCSR.READY; - this.abReceive = []; + if (!a) { + a = [0, PDP11.DL11.RCSR.CTS, PDP11.DL11.XCSR.READY, this.abReceive]; + } + + /* + * ES6 ALERT: A handy destructuring assignment, which makes it easy to perform the inverse + * of what saveRegisters() does when it collects a bunch of object properties into an array. + */ + [ + this.regRBUF, + this.regRCSR, + this.regXCSR, + this.abReceive + ] = a; + return true; } /** * saveRegisters() * + * Basically, the inverse of initState(). + * * @this {SerialPortPDP11} * @return {Array} */ saveRegisters() { - return []; + return [ + this.regRBUF, + this.regRCSR, + this.regXCSR, + this.abReceive + ]; } /** diff --git a/modules/shared/es6/component.js b/modules/shared/es6/component.js index d98e423de..58bafd9ff 100644 --- a/modules/shared/es6/component.js +++ b/modules/shared/es6/component.js @@ -76,7 +76,7 @@ */ class Component { /** - * Component(type, parms, constructor, bitsMessage) + * Component(type, parms, bitsMessage) * * A Component object requires: * @@ -88,14 +88,13 @@ class Component { * name: component name (default is ""; if blank, toString() will use the type name only) * comment: component comment string (default is undefined) * - * Subclasses that use Component.subclass() to extend Component will likely have additional (parms) properties. + * Component subclasses will usually have additional (parms) properties. * * @param {string} type * @param {Object} [parms] - * @param {Object} [constructor] * @param {number} [bitsMessage] selects message(s) that the component wants to enable (default is 0) */ - constructor(type, parms, constructor, bitsMessage) + constructor(type, parms, bitsMessage) { this.type = type; @@ -153,8 +152,8 @@ class Component { /* * TODO: Consider adding another parameter to the Component() constructor that allows components to tell * us if they support single or multiple instances per machine. For example, there can be multiple SerialPort - * components per machine, but only one CPU component (well, OK, an FPU is also supported, but that's considered - * a different component). + * components per machine, but only one CPU component (some machines also support an FPU, but that component + * is considered separate from the CPU). * * It's not critical, but it would help catch machine configuration errors; for example, a machine that mistakenly * includes two CPU components may, aside from wasting memory, end up with odd side-effects, like unresponsive diff --git a/modules/shared/es6/debugger.js b/modules/shared/es6/debugger.js index ddad4d44f..ef74a9ad3 100644 --- a/modules/shared/es6/debugger.js +++ b/modules/shared/es6/debugger.js @@ -48,7 +48,7 @@ if (NODE) { * fTemporary:(boolean|undefined), * sCmd:(string|undefined), * aCmds:(Array.|undefined) - * }} DbgAddr + * }} */ var DbgAddr; @@ -94,7 +94,7 @@ class Debugger extends Component { constructor(parmsDbg) { if (DEBUGGER) { - super("Debugger", parmsDbg, Debugger); + super("Debugger", parmsDbg); /* * Default base used to display all values; modified with the "s base" command. diff --git a/package.json b/package.json index 4b0f4aa24..e9f0d1555 100644 --- a/package.json +++ b/package.json @@ -200,6 +200,7 @@ "./modules/pdp11/lib/serial.js", "./modules/pdp11/lib/pc11.js", "./modules/pdp11/lib/disk.js", + "./modules/pdp11/lib/drive.js", "./modules/pdp11/lib/rk11.js", "./modules/pdp11/lib/rl11.js", "./modules/shared/es6/debugger.js", diff --git a/versions/pc8080/1.32.2/pc8080-dbg.js b/versions/pc8080/1.32.2/pc8080-dbg.js index ed250fac8..e84fabf75 100644 --- a/versions/pc8080/1.32.2/pc8080-dbg.js +++ b/versions/pc8080/1.32.2/pc8080-dbg.js @@ -32,14 +32,14 @@ var k;function ba(a,b){function c(){}c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a;for(var d in b)if(Object.defineProperties){var e=Object.getOwnPropertyDescriptor(b,d);e&&Object.defineProperty(a,d,e)}else a[d]=b[d]} var m={le:0,oe:1,pe:2,qe:3,re:4,se:5,te:6,ue:7,ve:8,we:9,xe:10,ye:11,ze:12,Ae:13,Be:14,Ce:15,De:16,Ee:17,Fe:18,Ge:19,He:20,Ie:21,Je:22,Ke:23,Le:24,Me:25,Ne:26," ":32,"!":33,'"':34,"#":35,$:36,"%":37,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,",":44,"-":45,".":46,"/":47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,";":59,"<":60,"=":61,">":62,"?":63,"@":64,pb:65,rc:66,tc:67,Rb:68,E:69,xc:70,yc:71,zc:72,Ac:73,Hc:74,Ic:75,Ub:76,Pc:77,Qc:78,Sc:79,Tc:80,Q:81,Zc:82,bd:83,hd:84,jd:85,kd:86,ld:87, nd:88,od:89,Db:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,pd:97,wf:98,xf:99,d:100,e:101,yf:102,zf:103,Af:104,Bf:105,Cf:106,k:107,Df:108,Ef:109,n:110,Ff:111,p:112,q:113,r:114,Gf:115,t:116,If:117,Jf:118,Kf:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126,Oe:127}; -function n(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.bc=b.comment;this.wd=b;this.exports={};this.P=this.bindings={};a=this.id.indexOf(".");0>a?this.$a=this.id:(this.ab=this.id.substr(0,a),this.$a=this.id.substr(a+1));this.G={ready:!1,jb:!1,Eb:!1,ja:!1,error:!1};this.vb=null;this.G.error=!1;this.ha=d||0;this.K=this.u=this.H=this.S=this.ta=null;ca.push(this)}function da(a,b,c){ea[a]&&b&&(ea[a][b]=c)}function fa(){return Date.now()||+new Date} +function n(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.bc=b.comment;this.wd=b;this.exports={};this.P=this.bindings={};a=this.id.indexOf(".");0>a?this.$a=this.id:(this.ab=this.id.substr(0,a),this.$a=this.id.substr(a+1));this.G={ready:!1,jb:!1,Eb:!1,ja:!1,error:!1};this.vb=null;this.G.error=!1;this.ha=c||0;this.K=this.u=this.H=this.S=this.ta=null;ca.push(this)}function da(a,b,c){ea[a]&&b&&(ea[a][b]=c)}function fa(){return Date.now()||+new Date} function ga(a,b,c){b||q((c?c+": ":"")+a)}function q(a){window&&window.alert(a)}function ha(a){var b=!1;window&&(b=window.confirm(a));return b}function ja(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>1)+2;10>this.g&&(this.g=10);15>2;this.j=this.w-1;this.L=this.N/this.w|0;this.I=this.L-1;this.A=[];this.B=[];this.D=this.F=!1;this.R=[];this.T=[];a=new z;yb(a,this.K);this.b=Array(this.L);for(b=0;b>>a.g;0f&&(p=f);if(h&&h.size){if(h.type==d){if(e+f<=h.J)return h.mb+=h.J-e,h.J=e,!0;if(e>=h.J+h.mb){p=h.size-(e-l);p>f&&(p=f);h.mb=e-h.J+p;e=l+a.w;f-=p;g++;continue}}return Ab(Bb,e,f)}e=new z(e,p,a.w,d);yb(e,a.K,h);a.b[g++]=e;e=l+a.w;f-=p}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Cb[d]+" at "+y(b)),!0):Ab(Db,b,c)} +xb.prototype.va=function(a,b){b||this.reset();return!0};function zb(a,b,c,d){for(var e=b,f=c,g=e>>>a.g;0f&&(p=f);if(h&&h.size){if(h.type==d){if(e+f<=h.J)return h.mb+=h.J-e,h.J=e,!0;if(e>=h.J+h.mb){p=h.size-(e-l);p>f&&(p=f);h.mb=e-h.J+p;e=l+a.w;f-=p;g++;continue}}return Ab(Bb,e,f)}e=new z(e,p,a.w,d);yb(e,a.K,h);a.b[g++]=e;e=l+a.w;f-=p}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Cb[d]+" at "+y(b)),!0):Ab(Db,b,c)} function Eb(a,b){return a.b[(b&a.C)>>>a.g].lb(b&a.j,b)}function Fb(a,b){var c=b&a.j,d=(b&a.C)>>>a.g;return c!=a.j?a.b[d].kc(c,b):a.b[d++].Xa(c,b)|a.b[d&a.I].Xa(0,b+1)<<8}function Gb(a,b){var c=b&a.j,d=(b&a.C)>>>a.g;return c!=a.j?a.b[d].Jb(c,b):a.b[d++].lb(c,b)|a.b[d&a.I].lb(0,b+1)<<8}function Hb(a,b,c){a.b[(b&a.C)>>>a.g].nb(b&a.j,c&255,b)}function Ib(a,b,c){var d=b&a.j,e=(b&a.C)>>>a.g;d!=a.j?a.b[e].nc(d,c&65535,b):(a.b[e++].Ya(d,c&255,b),a.b[e&a.I].Ya(0,c>>8&255,b+1))} -function Jb(a){for(var b=0,c=[],d=0;d>>=f)&l;if(void 0!==g){if(g[0])g[0](b,l,d);a.K&&a.F!=g[1]&&Tb(a.K,b,l)}else a.K&&(za(a.K,a,b,l,d),a.F&&Tb(a.K,b,l));f+=h<<3;b+=h;e-=h}}function Ab(a,b,c){q("Memory block error ("+a+": "+x(b)+","+x(c)+")");return!1}var Bb=1,Db=2,Ub;if(qb){var Vb=new ArrayBuffer(2);(new DataView(Vb)).setUint16(0,256,!0);Ub=256===(new Uint16Array(Vb))[0]}else Ub=!1;var Wb=Ub; -function z(a,b,c,d){this.id=Xb+=2;this.b=null;this.J=a;this.mb=b;this.size=c||0;this.type=d||Yb;this.u=d==Zb;yb(this);this.Ca=this.gc=!1;if(c)if(qb)this.j=new ArrayBuffer(c),this.w=new DataView(this.j,0,c),this.g=new Uint8Array(this.j,0,c),this.A=new Uint16Array(this.j,0,c>>1),this.b=new Int32Array(this.j,0,c>>2),$b(this,Wb?ac:bc);else{this.b=Array(c>>2);for(a=0;a>1),this.b=new Int32Array(this.j,0,c>>2),$b(this,Wb?ac:bc);else{this.b=Array(c>>2);for(a=0;a>2),b=0;b>8,c)};k.Xd=function(a){return this.b[a>>2]>>>((a&3)<<3)&255};k.ae=function(a){var b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8};k.fe=function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<>8);this.Ca=!0};k.Vd=function(a,b){if(this.K&&null!=this.J){var c=this.K;sc(c,this.J+a,1,c.I)&&c.da(!0)}return this.lb(a,b)};k.Zd=function(a,b){if(this.K&&null!=this.J){var c=this.K;sc(c,this.J+a,2,c.I)&&c.da(!0)}return this.Jb(a,b)}; k.de=function(a,b,c){if(this.K&&null!=this.J){var d=this.K;sc(d,this.J+a,1,d.w)&&d.da(!0)}this.u?this.ob(0,b):this.nb(a,b,c)};k.he=function(a,b,c){if(this.K&&null!=this.J){var d=this.K;sc(d,this.J+a,2,d.w)&&d.da(!0)}this.u?this.ob(0,b):this.Ob(a,b,c)};k.Ud=function(a){return this.g[a]};k.Wd=function(a){return this.g[a]};k.Yd=function(a){return this.w.getUint16(a,!0)};k.$d=function(a){return a&1?this.g[a]|this.g[a+1]<<8:this.A[a>>1]};k.ce=function(a,b){this.g[a]=b;this.Ca=!0}; -k.ee=function(a,b){this.g[a]=b;this.Ca=!0};k.ge=function(a,b){this.w.setUint16(a,b,!0);this.Ca=!0};k.ie=function(a,b){a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.A[a>>1]=b;this.Ca=!0};var Yb=0,Zb=2,Cb=["NONE","RAM","ROM","VID","H/W"],Xb=0,ec=[],cc=[z.prototype.Xd,z.prototype.fe,z.prototype.ae,z.prototype.je],hc=[z.prototype.Vd,z.prototype.de,z.prototype.Zd,z.prototype.he];if(qb)var bc=[z.prototype.Ud,z.prototype.ce,z.prototype.Yd,z.prototype.ge],ac=[z.prototype.Wd,z.prototype.ee,z.prototype.$d,z.prototype.ie]; -function tc(a,b){n.call(this,"CPU",a,0,1);var c=a.multiplier||1;this.Fa=a.cycles||b;this.U=c;this.Sa=Math.round(this.Fa/1E4)/100;this.Z=this.Sa*this.U;this.G.ka=!1;this.G.Mb=!1;this.G.ib=a.autoStart;this.G.ec=!1;this.G.Va=!1;this.ya=this.oa=0;this.za=a.csStart;this.na=a.csInterval;this.sa=a.csStop;this.T=[];this.zb=this.qb.bind(this);sa(this)}ba(tc,n);k=tc.prototype; +k.ee=function(a,b){this.g[a]=b;this.Ca=!0};k.ge=function(a,b){this.w.setUint16(a,b,!0);this.Ca=!0};k.ie=function(a,b){a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.A[a>>1]=b;this.Ca=!0};var Yb=0,Zb=2,Cb=["NONE","RAM","ROM","VID","H/W"],Xb=0,ec=[],dc=[z.prototype.Xd,z.prototype.fe,z.prototype.ae,z.prototype.je],qc=[z.prototype.Vd,z.prototype.de,z.prototype.Zd,z.prototype.he];if(qb)var bc=[z.prototype.Ud,z.prototype.ce,z.prototype.Yd,z.prototype.ge],ac=[z.prototype.Wd,z.prototype.ee,z.prototype.$d,z.prototype.ie]; +function tc(a,b){n.call(this,"CPU",a,1);var c=a.multiplier||1;this.Fa=a.cycles||b;this.U=c;this.Sa=Math.round(this.Fa/1E4)/100;this.Z=this.Sa*this.U;this.G.ka=!1;this.G.Mb=!1;this.G.ib=a.autoStart;this.G.ec=!1;this.G.Va=!1;this.ya=this.oa=0;this.za=a.csStart;this.na=a.csInterval;this.sa=a.csStop;this.T=[];this.zb=this.qb.bind(this);sa(this)}ba(tc,n);k=tc.prototype; k.Ea=function(a,b,c,d){this.S=a;this.H=b;this.K=d;for(b=0;b=a.oa&&(a.oa+=a.na,c=!0);0<=a.sa&&a.sa<=Cc(a)&&(a.na=a.sa=-1,xc(a),a.da(),c=!0);c&&a.i(Cc(a)+" cycles: checksum="+x(a.ya))}} k.ca=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.P[b]=c;a=!0;break;case "run":this.P[b]=c;c.onclick=function(){var a;if(a=d.S)if(a=d.S,a.G.ja)a=!0;else{var b=null,c,h=ja(a.id);for(c=0;ca.Y/a.Z?b=1:d=!0;a.U=b;b=a.Sa*a.U;if(a.Z!=b){a.Z=b;b=a.Z.toFixed(2)+"Mhz";var e=a.P.setSpeed;e&&(e.textContent=b);a.i("target speed: "+b)}c&&a.S&&Hc(a.S)}Ec(a,a.X);a.X=0;a.V=fa();a.ea=0;Fc(a);return d}function Ic(a,b){var c=a.T.length;a.T.push([-1,b]);return c}function Jc(a,b,c){0<=b&&ba.T[b][0]&&(c*=a.Fa*a.U/1E3,a.T[b][0]=c+Kc(a))}function Kc(a,b){var c=a.ga-=a.b;a.b=0;b&&(a.ga=0);return c} k.qb=function(a){if(va(this,!0)){if(!this.G.ka){Dc(this);this.S&&this.S.start(this.V,Cc(this));this.G.ka=!0;this.G.Mb=!0;this.W&&this.W.start();var b=this.P.run;b&&(b.textContent="Halt");this.S&&(Lc(this.S,!0),a&&Hc(this.S,!0))}this.Ua>=this.Fa&&Fc(this,!0);this.Ha=0;this.Ma=fa();this.ea&&(a=this.Ma-this.ea,a>this.gb&&(this.V+=a,this.V>this.Ma&&(this.V=this.Ma)));try{do{for(var c,d=this.G.Va?1:this.Na,e=this.T.length-1;0<=e;e--){var f=this.T[e];0>f[0]||d>f[0]&&(d=f[0])}c=d;this.Ab(c);c=Kc(this,!0); -this.Ha+=c;this.X+=c;Bc(this,c);a=c;for(var g=this.T.length-1;0<=g;g--){var h=this.T[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.va-=c;if(0>=this.va){this.va+=this.Na;++this.hb>=Mc&&(this.S&&Lc(this.S),this.hb=0);break}}while(this.G.ka)}catch(l){this.da();Ac(this);this.S&&this.S.stop(fa(),Cc(this));va(this,!1);qa(this,l.stack||l.message);return}c=setTimeout;d=this.zb;this.ea=fa();e=this.gb;this.Ha&&(e=Math.round(e*this.Ha/this.Na));e-=this.ea-this.Ma;if(f=this.ea-this.V)this.Y=Math.round(this.X/ +this.Ha+=c;this.X+=c;Bc(this,c);a=c;for(var g=this.T.length-1;0<=g;g--){var h=this.T[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.wa-=c;if(0>=this.wa){this.wa+=this.Na;++this.hb>=Mc&&(this.S&&Lc(this.S),this.hb=0);break}}while(this.G.ka)}catch(l){this.da();Ac(this);this.S&&this.S.stop(fa(),Cc(this));va(this,!1);qa(this,l.stack||l.message);return}c=setTimeout;d=this.zb;this.ea=fa();e=this.gb;this.Ha&&(e=Math.round(e*this.Ha/this.Na));e-=this.ea-this.Ma;if(f=this.ea-this.V)this.Y=Math.round(this.X/ (10*f))/100,864E5<=f&&(this.la=0,Dc(this));if(0>e||this.Ye&&(this.V-=e),e=0;this.Ua+=this.Ha;this.ea+=e;c(d,e)}else Ac(this),this.S&&this.S.stop(fa(),Cc(this))};k.Ab=function(){return 0};k.da=function(a){ua(this,!0);Kc(this);Ec(this,this.X);this.X=0;if(this.G.ka){this.G.ka=!1;this.W&&this.W.stop();var b=this.P.run;b&&(b.textContent="Run")}this.G.complete=a};function Ac(a,b){if(a.S){for(var c=a.S,d=0;d>8&255;a.A=b&255}function jd(a){return a.B<<8|a.C}function kd(a,b){a.B=b>>8&255;a.C=b&255}function D(a){return a.D<<8|a.F} +k.ca=function(a,b,c){switch(b){case "A":case "B":case "C":case "BC":case "D":case "E":case "DE":case "H":case "L":case "HL":case "SP":case "PC":case "PS":case "IF":case "SF":case "ZF":case "AF":case "PF":case "CF":this.P[b]=c;this.fb++;a=!0;break;default:a=tc.prototype.ca.call(this,a,b,c)}return a};function hd(a){return a.w<<8|a.A}function id(a,b){a.w=b>>8&255;a.A=b&255}function jd(a){return a.B<<8|a.C}function kd(a,b){a.B=b>>8&255;a.C=b&255}function D(a){return a.D<<8|a.F} function ld(a,b){a.D=b>>8&255;a.F=b&255}function C(a,b){a.j=b&65535}function md(a){return a.I&256?1:0}function nd(a,b){a.I=a.I&255|b}function od(a){return sb[a.L&255]?4:0}function pd(a){return(a.L^a.O)&16?16:0}function qd(a){return a.I&255?0:64}function rd(a){return a.L&128?128:0}function Uc(a){return a.N&-214|rd(a)|qd(a)|pd(a)|od(a)|md(a)}function Sc(a,b){a.I=a.L=a.O=0;b&1&&(a.I|=256);b&4||(a.L|=1);b&16&&(a.O|=16);b&64||(a.I|=255);b&128&&(a.L^=192);a.N=a.N&-726|b&512|2} function sd(a,b){a.O=a.g^b;return a.L=(a.I=a.g+b)&255}function td(a,b){a.O=a.g^b;return a.L=(a.I=a.g+b+(a.I&256?1:0))&255}function ud(a,b){a.I=a.L=a.O=a.g&b;(a.g|b)&8&&(a.O^=16);return a.I}function vd(a,b){a.O=b^255;b=a.L=b+255&255;a.I=a.I&-256|b;return b}function wd(a,b){a.O=b;b=a.L=b+1&255;a.I=a.I&-256|b;return b}function xd(a,b){return a.L=a.I=a.O=a.g|b}function E(a,b){b^=255;a.O=a.g^b;return a.L=(a.I=a.g+b+1^256)&255} function yd(a,b){b^=255;a.O=a.g^b;return a.L=(a.I=a.g+b+(a.I&256?0:1)^256)&255}function zd(a,b){return a.L=a.I=a.O=a.g^b}function F(a,b){a=a.H;return a.b[(b&a.C)>>>a.g].Xa(b&a.j,b)}function Ad(a,b,c){a=a.H;a.b[(b&a.C)>>>a.g].Ya(b&a.j,c&255,b)}function G(a){var b=F(a,a.j);C(a,a.j+1);return b}function H(a){var b=Fb(a.H,a.j);C(a,a.j+2);return b}function Bd(a){var b=Fb(a.H,a.M);a.M=a.M+2&65535;return b}function I(a,b){a.M=a.M-2&65535;Ib(a.H,a.M,b)} function Cd(a){if(a.b&&a.R&255&&a.N&512){for(var b=0;8>b&&!(a.R&1<b?255:1<>8;nd(this,a&256);this.b-=4},Gd,function(){var a;ld(this,a=D(this)+Wc(this));nd(this,a>>8&256);this.b-=10},function(){this.g=F(this,Wc(this));this.b-=7},function(){id(this,Wc(this)-1);this.b-= +var Pc=[Gd,function(){id(this,H(this));this.b-=10},function(){Ad(this,hd(this),this.g);this.b-=7},function(){id(this,hd(this)+1);this.b-=5},function(){this.w=wd(this,this.w);this.b-=5},function(){this.w=vd(this,this.w);this.b-=5},function(){this.w=G(this);this.b-=7},function(){var a=this.g<<1;this.g=a&255|a>>8;nd(this,a&256);this.b-=4},Gd,function(){var a;ld(this,a=D(this)+hd(this));nd(this,a>>8&256);this.b-=10},function(){this.g=F(this,hd(this));this.b-=7},function(){id(this,hd(this)-1);this.b-= 5},function(){this.A=wd(this,this.A);this.b-=5},function(){this.A=vd(this,this.A);this.b-=5},function(){this.A=G(this);this.b-=7},function(){var a=this.g<<8&256;this.g=(a|this.g)>>1;nd(this,a);this.b-=4},Gd,function(){kd(this,H(this));this.b-=10},function(){Ad(this,jd(this),this.g);this.b-=7},function(){kd(this,jd(this)+1);this.b-=5},function(){this.B=wd(this,this.B);this.b-=5},function(){this.B=vd(this,this.B);this.b-=5},function(){this.B=G(this);this.b-=7},function(){var a=this.g<<1;this.g=a&255| md(this);nd(this,a&256);this.b-=4},Gd,function(){var a;ld(this,a=D(this)+jd(this));nd(this,a>>8&256);this.b-=10},function(){this.g=F(this,jd(this));this.b-=7},function(){kd(this,jd(this)-1);this.b-=5},function(){this.C=wd(this,this.C);this.b-=5},function(){this.C=vd(this,this.C);this.b-=5},function(){this.C=G(this);this.b-=7},function(){var a=this.g<<8;this.g=(md(this)<<8|this.g)>>1;nd(this,a&256);this.b-=4},Gd,function(){ld(this,H(this));this.b-=10},function(){var a=H(this);Ib(this.H,a,D(this)); this.b-=16},function(){ld(this,D(this)+1);this.b-=5},function(){this.D=wd(this,this.D);this.b-=5},function(){this.D=vd(this,this.D);this.b-=5},function(){this.D=G(this);this.b-=7},function(){var a=0,b=md(this);if(pd(this)||9<(this.g&15))a|=6;if(b||154<=this.g)a|=96,b=1;this.g=sd(this,a);nd(this,b?256:0);this.b-=4},Gd,function(){var a;ld(this,a=D(this)+D(this));nd(this,a>>8&256);this.b-=10},function(){var a;a=H(this);a=Fb(this.H,a);ld(this,a);this.b-=16},function(){ld(this,D(this)-1);this.b-=5},function(){this.F= @@ -111,15 +111,15 @@ F(this,D(this)));this.b-=7},function(){this.g=td(this,this.g);this.b-=4},functio this.A);this.b-=4},function(){this.g=yd(this,this.B);this.b-=4},function(){this.g=yd(this,this.C);this.b-=4},function(){this.g=yd(this,this.D);this.b-=4},function(){this.g=yd(this,this.F);this.b-=4},function(){this.g=yd(this,F(this,D(this)));this.b-=7},function(){this.g=yd(this,this.g);this.b-=4},function(){this.g=ud(this,this.w);this.b-=4},function(){this.g=ud(this,this.A);this.b-=4},function(){this.g=ud(this,this.B);this.b-=4},function(){this.g=ud(this,this.C);this.b-=4},function(){this.g=ud(this, this.D);this.b-=4},function(){this.g=ud(this,this.F);this.b-=4},function(){this.g=ud(this,F(this,D(this)));this.b-=7},function(){this.g=ud(this,this.g);this.b-=4},function(){this.g=zd(this,this.w);this.b-=4},function(){this.g=zd(this,this.A);this.b-=4},function(){this.g=zd(this,this.B);this.b-=4},function(){this.g=zd(this,this.C);this.b-=4},function(){this.g=zd(this,this.D);this.b-=4},function(){this.g=zd(this,this.F);this.b-=4},function(){this.g=zd(this,F(this,D(this)));this.b-=7},function(){this.g= zd(this,this.g);this.b-=4},function(){this.g=xd(this,this.w);this.b-=4},function(){this.g=xd(this,this.A);this.b-=4},function(){this.g=xd(this,this.B);this.b-=4},function(){this.g=xd(this,this.C);this.b-=4},function(){this.g=xd(this,this.D);this.b-=4},function(){this.g=xd(this,this.F);this.b-=4},function(){this.g=xd(this,F(this,D(this)));this.b-=7},function(){this.g=xd(this,this.g);this.b-=4},function(){E(this,this.w);this.b-=4},function(){E(this,this.A);this.b-=4},function(){E(this,this.B);this.b-= -4},function(){E(this,this.C);this.b-=4},function(){E(this,this.D);this.b-=4},function(){E(this,this.F);this.b-=4},function(){E(this,F(this,D(this)));this.b-=7},function(){E(this,this.g);this.b-=4},function(){qd(this)||(C(this,Bd(this)),this.b-=6);this.b-=5},function(){id(this,Bd(this));this.b-=10},function(){var a=H(this);qd(this)||C(this,a);this.b-=10},Hd,function(){var a=H(this);qd(this)||(I(this,this.j),C(this,a),this.b-=6);this.b-=11},function(){I(this,Wc(this));this.b-=11},function(){this.g= +4},function(){E(this,this.C);this.b-=4},function(){E(this,this.D);this.b-=4},function(){E(this,this.F);this.b-=4},function(){E(this,F(this,D(this)));this.b-=7},function(){E(this,this.g);this.b-=4},function(){qd(this)||(C(this,Bd(this)),this.b-=6);this.b-=5},function(){id(this,Bd(this));this.b-=10},function(){var a=H(this);qd(this)||C(this,a);this.b-=10},Hd,function(){var a=H(this);qd(this)||(I(this,this.j),C(this,a),this.b-=6);this.b-=11},function(){I(this,hd(this));this.b-=11},function(){this.g= sd(this,G(this));this.b-=7},function(){I(this,this.j);C(this,0);this.b-=11},function(){qd(this)&&(C(this,Bd(this)),this.b-=6);this.b-=5},Id,function(){var a=H(this);qd(this)&&C(this,a);this.b-=10},Hd,function(){var a=H(this);qd(this)&&(I(this,this.j),C(this,a),this.b-=6);this.b-=11},Jd,function(){this.g=td(this,G(this));this.b-=7},function(){I(this,this.j);C(this,8);this.b-=11},function(){md(this)||(C(this,Bd(this)),this.b-=6);this.b-=5},function(){kd(this,Bd(this));this.b-=10},function(){var a=H(this); md(this)||C(this,a);this.b-=10},function(){var a=G(this);Sb(this.H,a,this.g,this.j+-2&65535);this.b-=10},function(){var a=H(this);md(this)||(I(this,this.j),C(this,a),this.b-=6);this.b-=11},function(){I(this,jd(this));this.b-=11},function(){this.g=E(this,G(this));this.b-=7},function(){I(this,this.j);C(this,16);this.b-=11},function(){md(this)&&(C(this,Bd(this)),this.b-=6);this.b-=5},Id,function(){var a=H(this);md(this)&&C(this,a);this.b-=10},function(){var a=G(this);this.g=Ob(this.H,a,this.j+-2&65535)& 255;this.b-=10},function(){var a=H(this);md(this)&&(I(this,this.j),C(this,a),this.b-=6);this.b-=11},Jd,function(){this.g=yd(this,G(this));this.b-=7},function(){I(this,this.j);C(this,24);this.b-=11},function(){od(this)||(C(this,Bd(this)),this.b-=6);this.b-=5},function(){ld(this,Bd(this));this.b-=10},function(){var a=H(this);od(this)||C(this,a);this.b-=10},function(){var a=Bd(this);I(this,D(this));ld(this,a);this.b-=18},function(){var a=H(this);od(this)||(I(this,this.j),C(this,a),this.b-=6);this.b-= 11},function(){I(this,D(this));this.b-=11},function(){this.g=ud(this,G(this));this.b-=7},function(){I(this,this.j);C(this,32);this.b-=11},function(){od(this)&&(C(this,Bd(this)),this.b-=6);this.b-=5},function(){C(this,D(this));this.b-=5},function(){var a=H(this);od(this)&&C(this,a);this.b-=10},function(){var a=D(this);ld(this,jd(this));kd(this,a);this.b-=5},function(){var a=H(this);od(this)&&(I(this,this.j),C(this,a),this.b-=6);this.b-=11},Jd,function(){this.g=zd(this,G(this));this.b-=7},function(){I(this, this.j);C(this,40);this.b-=11},function(){rd(this)||(C(this,Bd(this)),this.b-=6);this.b-=5},function(){var a=Bd(this);Sc(this,a&255|this.N&-256);this.g=a>>8;this.b-=10},function(){var a=H(this);rd(this)||C(this,a);this.b-=10},function(){this.N&=-513;this.b-=4},function(){var a=H(this);rd(this)||(I(this,this.j),C(this,a),this.b-=6);this.b-=11},function(){I(this,Uc(this)&255|this.g<<8);this.b-=11},function(){this.g=xd(this,G(this));this.b-=7},function(){I(this,this.j);C(this,48);this.b-=11},function(){rd(this)&& (C(this,Bd(this)),this.b-=6);this.b-=5},function(){this.M=D(this)&65535;this.b-=5},function(){var a=H(this);rd(this)&&C(this,a);this.b-=10},function(){this.N|=512;this.b-=4;Cd(this)},function(){var a=H(this);rd(this)&&(I(this,this.j),C(this,a),this.b-=6);this.b-=11},Jd,function(){E(this,G(this));this.b-=7},function(){I(this,this.j);C(this,56);this.b-=11}]; -function Kd(a){n.call(this,"ChipSet",a,0,32768);var b=a.model;b&&!Ld[b]&&ga("Unrecognized ChipSet model: "+b);this.g=Ld[b]||{};a.sound&&(this.U=null,window&&(this.U=window.AudioContext||window.webkitAudioContext),this.U&&new this.U);sa(this)}ba(Kd,n);k=Kd.prototype;k.ca=function(){return!1}; -k.Ea=function(a,b,c,d){this.H=b;this.u=c;this.K=d;this.S=a;this.B=vb(a,"Keyboard");this.C=vb(a,"SerialPort");this.video=vb(a,"Video");Nb(b,this,this.g.xb);Rb(b,this,this.g.yb);if(d){var e=this;Md(d,16384,function(){for(var a="",b=0;b>8-this.T&255;v(this,a,null,b,"SHIFT.RESULT",c,!0);return c};k.Kd=function(a,b,c){v(this,a,b,c,"SHIFT.COUNT",null,!0);this.T=b};k.Md=function(a,b,c){v(this,a,b,c,"SOUND1",null,!0);this.Y=b};k.Ld=function(a,b,c){v(this,a,b,c,"SHIFT.DATA",null,!0);this.N=b<<8|this.N>>8}; @@ -134,19 +134,19 @@ L.INIT=[[L.sc.INIT,L.xa.Xb|L.xa.Rc],[L.Ka.Dc,L.Ka.Ec],[L.rb.Gc,L.rb.Cc,L.rb.Fc,L [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,11808,11984,11856,11776,11808,11776,12E3,12E3,11881,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]]];Nd.xb={0:Kd.prototype.Bd,1:Kd.prototype.Cd,2:Kd.prototype.Dd,3:Kd.prototype.Ad}; Nd.yb={2:Kd.prototype.Kd,3:Kd.prototype.Md,4:Kd.prototype.Ld,5:Kd.prototype.Nd,6:Kd.prototype.Od};L.xb={66:Kd.prototype.Ed};L.yb={66:Kd.prototype.Pd,98:Kd.prototype.Sd,162:Kd.prototype.Rd,194:Kd.prototype.Qd};hb(function(){for(var a=pa(document,"pc8080","chipset"),b=0;b>>0,g],t=Pa(r,l,a.dc);0>t&&r.splice(-(t+1),0,l)}p&&(h.a=p.replace(/''/g,'"'))}a.A.push({Hf:b,J:c,Gd:d,ra:e,cc:f})}delete this.ra}return!0};Sd.prototype.wa=function(){return!0}; +Sd.prototype.va=function(){if(this.ra){if(this.K){var a=this.K,b=this.id,c=this.A,d=this.g,e=this.ra,f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var l=h.o,p=h.a;if(void 0!==l){var r=f,l=[l>>>0,g],t=Pa(r,l,a.dc);0>t&&r.splice(-(t+1),0,l)}p&&(h.a=p.replace(/''/g,'"'))}a.A.push({Hf:b,J:c,Gd:d,ra:e,cc:f})}delete this.ra}return!0};Sd.prototype.ua=function(){return!0}; function Td(a,b,c,d){if(d)a.aa("Unable to load system ROM (error "+d+": "+b+")");else{da(a.ab,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,g=e.data;if(f)a.b=f;else if(g)for(a.b=Array(4*g.length),d=c=0;c>8&255,a.b[d++]=g[c]>>16&255,a.b[d++]=g[c]>>24&255;else a.b=e;a.ra=e.symbols;if(!a.b.length){q("Empty ROM: "+b);return}if(1==a.b.length){q(a.b[0]);return}}catch(h){a.aa("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm, " ").replace(/ +$/,"").split(" "),a.b=Array(b.length),e=0;e>>f.g;0>>= f.g;0=m.pb&&a<=m.Db?d.j&(fe|ge)||(d.j|=ge,he(d,20,!0),De(d)):a>=m.pd&&a<=m.z&&d.j&ge&&(d.j&=~ge,he(d,20,!1),De(d));return!0},c.onpaste=function(a){a:{if(d.C&&d.C.Ra&&(a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(), a=a.clipboardData||window.clipboardData)){Ee(d.C,a.getData("Text"));a=!1;break a}a=!0}return a},!0;default:if(this.b.Ta&&void 0!==this.b.Ta[b])return this.P[e]=c,c.onclick=function(a,b){return function(c){c.preventDefault&&c.preventDefault();he(a,b,!0,!0)}}(this,this.b.Ta[b]),!0}}return!1};k.Ea=function(a,b,c,d){this.S=a;this.u=c;this.K=d;var e=this;this.L=Ic(this.u,function(){Fe(e)});this.W=vb(a,"ChipSet");this.C=vb(a,"SerialPort");Nb(b,this,this.b.xb);Rb(b,this,this.b.yb)}; -k.ua=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};k.wa=function(a){return a?this.save():!0};k.reset=function(){this.g=[];this.j=0;this.b.INIT&&!this.restore(this.b.INIT)&&this.aa("reset error")};k.save=function(){var a=new Vc(this);switch(this.b.pa){case M.pa:a.set(0,[this.D,this.B,this.A,this.F,-1])}return a.data()}; +k.va=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};k.ua=function(a){return a?this.save():!0};k.reset=function(){this.g=[];this.j=0;this.b.INIT&&!this.restore(this.b.INIT)&&this.aa("reset error")};k.save=function(){var a=new Vc(this);switch(this.b.pa){case M.pa:a.set(0,[this.D,this.B,this.A,this.F,-1])}return a.data()}; k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.b.pa){case Ge.pa:return!0;case M.pa:return this.D=b[0],De(this,this.D&M.Ba.Vb),this.B=b[1],this.A=b[2],this.F=b[3],this.w=b[4],!0}return!1};function De(a,b){var c;null!=b?a.I=b:b=a.I;for(var d in a.b.bb)if(c="led-"+d,c=a.P[c]){var e=a.b.bb[d],f=!!(b&e);e&e-1&&(f=!(b&~e));c.style.backgroundColor=f?"#"+x(16711680,6):"#000000"}if(c=a.P["led-caps-lock"])c.style.backgroundColor=a.j&ge?"#"+x(65280,6):"#000000"} function ee(a,b,c){var d=!0,e=b.keyCode,f=2==b.location,g=0;switch(e){case 16:g=f?He:Ie;break;case 17:g=f?Je:Ke;break;case 18:g=f?Le:Me;break;case 91:g=f?Ne:Oe;break;case 20:g=ge}g&&(a.j=c?a.j|g:a.j&~g);var h;a:if(e=a.b.Pb[e]||e,a.b.Cb[e])h=e;else{for(h in a.b.Ta)if(a.b.Ta[h]===e)break a;h=null}h&&!b.metaKey&&(d=!1,a.j&(Pe|Qe)&&(13==h?(h=118,d=!0):8==h&&(h=46,d=!0),d&&(a.j=c?a.j|Qe:a.j&~Qe)),d=he(a,h,c),(!(h>=m.pb&&h<=m.Db)||a.j|Re)&&b.preventDefault&&b.preventDefault());return d} function he(a,b,c,d){var e;a:{for(e=0;ee?a.g.push({Lb:b,Ib:Date.now(),ub:d||!1}):(a.g[e].Ib=Date.now(),a.g[e].ub=d||!1),d&&Fe(a);else if(0<=e){if(!a.g[e].ub&&(d=a.g[e].Ib)&&Date.now()-d>3)*a.N,!zb(a.H,a.la,a.L,3)))return!1;a.L?(a.Ua=a.j.createImageData(b,c),a.eb=16/a.na|0,Ze(a,a.L>>1)):Ze(a,(a.O+1)*a.Z);a.D=document.createElement("canvas");a.D.width=b;a.D.height=c;a.va=a.D.getContext("2d");a.T={};a.X=1<>3)*a.N,!zb(a.H,a.la,a.L,3)))return!1;a.L?(a.Ua=a.j.createImageData(b,c),a.eb=16/a.na|0,Ze(a,a.L>>1)):Ze(a,(a.O+1)*a.Z);a.D=document.createElement("canvas");a.D.width=b;a.D.height=c;a.wa=a.D.getContext("2d");a.T={};a.X=1<=a.Ha?8:16,f=8>(7>4)*c)}return l}Ue.prototype.ua=function(){return!0};Ue.prototype.ca=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.Fa[b]=c,!0;switch(b){case "fullScreen":return this.P[b]=c,this.b&&this.b.Wa?c.onclick=function(){d.Wa()}:c.parentNode.removeChild(c),!0}return!1}; -Ue.prototype.Wa=function(){var a=!1;if(this.b){if(this.b.Wa){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.M/this.I;b>c&&(a=Math.round(c/b*100)+"%")}this.Sa?(this.F.style.width=a,this.F.style.width=a,this.F.style.display="block",this.F.style.margin="auto"):(this.b.style.width=a,this.b.style.height="auto");this.b.style.backgroundColor="black";this.b.Wa();a=!0}this.V&&this.V.focus()}return a}; +(r&15)*b,(r>>4)*c)}return l}k.va=function(a,b){return b||!a||this.restore(a)?!0:!1};k.ua=function(a){return!a||this.save()};k.save=function(){var a=new Vc(this);a.set(0,[]);return a.data()};k.restore=function(){return!0}; +k.Wa=function(){var a=!1;if(this.b){if(this.b.Wa){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.M/this.I;b>c&&(a=Math.round(c/b*100)+"%")}this.Sa?(this.F.style.width=a,this.F.style.width=a,this.F.style.display="block",this.F.style.margin="auto"):(this.b.style.width=a,this.b.style.height="auto");this.b.style.backgroundColor="black";this.b.Wa();a=!0}this.V&&this.V.focus()}return a}; function Xe(a,b){!b&&a.b&&(a.Sa?a.F.style.width=a.F.style.height="":a.b.style.width=a.b.style.height="");xa(a,"notifyFullScreen("+b+")")}function Ze(a,b){a.cb=b;a.W=!1;if(void 0===a.A||a.A.length!=a.cb)a.A=Array(a.cb)}function kf(a,b,c,d,e){d=a.g?(b.height-c-1)*b.width+d:c+d*b.width;e&&a.Y==af&&(208<=c&&236>c?e=a.X+bf:28<=c&&72>c&&(e=a.X+cf));a=a.U[e];d*=a.length;b.data[d]=a[0];b.data[d+1]=a[1];b.data[d+2]=a[2];b.data[d+3]=a[3]} function Nc(a,b){var c=!0;if(!b){a.oa&&(120==a.oa?a.fb&1?(Dd(a.u,2),c=!1):Dd(a.u,1):Dd(a.u,4));if(c&&a.W&&a.L){for(var d=a.H,e=a.L,f=!0,g=a.la>>>d.g;0>=1);;){var w=Eb(a.H,r++);if((w&lf)==lf){var u=Eb(a.H,r++),d=u&mf,c=(u&nf)<<8|Eb(a.H,r),c=c+(u&of? -pf:qf);break}if(p>4)*w.ba,K,ia,ta,ma,La=w.fa,dc=w.ba;B?(K=A*u.fa,ia=e*u.ba,ta=u.fa,ma=u.ba):(K=A*u.La,ia=e*u.Ma,ta=u.La,ma=u.Ma);w.fa>u.fa&&(K*=2,ta*=2);w.ba>u.ba&&(t==jf&&(S+=u.ba),dc=u.ba);B?B.drawImage(w.canvas,ya,S,La,dc,K,ia,ta,ma):(K+=0,ia+=0,u.j.drawImage(w.canvas, -ya,S,La,dc,K,ia,ta,ma))}h++}g++}e++}}a.W=!0;!b&&a.ya&&1==h&&(a.A[l]=-1,h=0);a.ya=!1;(h||b)&&a.va&&a.j.drawImage(a.D,0,a.sa,a.C,a.N-a.ba,0,0,a.zb,a.rd)}else{e=a.la;f=e+a.L;l=h=g=0;b=a.C;p=0;c=a.N;t=d=0;r=a.na;A=(1<>8|(u&255)<<8);h>B&A,kf(a,a.Ua,h++,l,ya),B+=r;h>p&&(p=h);l=d&&(d=l+1)}e+=2;g++;if(h>=a.C&&(h=0,l++,l>a.N))break}a.W=!0;b>4)*w.ba,K,ia,ta,ma,La=w.fa,cc=w.ba;B?(K=A*u.fa,ia=e*u.ba,ta=u.fa,ma=u.ba):(K=A*u.La,ia=e*u.Ma,ta=u.La,ma=u.Ma);w.fa>u.fa&&(K*=2,ta*=2);w.ba>u.ba&&(t==jf&&(S+=u.ba),cc=u.ba);B?B.drawImage(w.canvas,ya,S,La,cc,K,ia,ta,ma):(K+=0,ia+=0,u.j.drawImage(w.canvas, +ya,S,La,cc,K,ia,ta,ma))}h++}g++}e++}}a.W=!0;!b&&a.ya&&1==h&&(a.A[l]=-1,h=0);a.ya=!1;(h||b)&&a.wa&&a.j.drawImage(a.D,0,a.sa,a.C,a.N-a.ba,0,0,a.zb,a.rd)}else{e=a.la;f=e+a.L;l=h=g=0;b=a.C;p=0;c=a.N;t=d=0;r=a.na;A=(1<>8|(u&255)<<8);h>B&A,kf(a,a.Ua,h++,l,ya),B+=r;h>p&&(p=h);l=d&&(d=l+1)}e+=2;g++;if(h>=a.C&&(h=0,l++,l>a.N))break}a.W=!0;bMissing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=Ua().indexOf("MSIE")&&(c.onresize=function(a,b,c,d){return function(){b.style.height= (a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());var f=+(d.aspect||cb("aspect"));f&&.3<=f&&3.33>=f&&(gb("onresize",function(a,b,c){return function(){b.style.height=(a.clientWidth/c|0)+"px"}}(c,e,f)),window.onresize());c.appendChild(e);f=document.createElement("textarea");bb("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var g=e.getContext("2d"),d=new Ue(d,e,g,f,c);oa(d,c)}}); -function rf(a){n.call(this,"SerialPort",a,0,8388608);this.T=+a.adapter;switch(this.T){case 0:this.U=0;this.X=2;break;default:q("Unrecognized serial adapter #"+this.T);return}this.g=this.j=null;this.V=a.tabSize;this.R=a.charBOL;this.w=0;this.N=!1;this.D=!0;var b=a.binding;if("console"==b)this.j="";else{var c;a=sf;b&&(void 0===c&&(c="Panel"),(c=la(c,this.id))&&(b=c.P[b])&&this.ca(null,a,b))}this.A="";this.b=this.Ra=this.I=null;this.exports={connect:this.ic,receiveData:this.Kb,receiveStatus:this.be}} +function rf(a){n.call(this,"SerialPort",a,8388608);this.T=+a.adapter;switch(this.T){case 0:this.U=0;this.X=2;break;default:q("Unrecognized serial adapter #"+this.T);return}this.g=this.j=null;this.V=a.tabSize;this.R=a.charBOL;this.w=0;this.N=!1;this.D=!0;var b=a.binding;if("console"==b)this.j="";else{var c;a=sf;b&&(void 0===c&&(c="Panel"),(c=la(c,this.id))&&(b=c.P[b])&&this.ca(null,a,b))}this.A="";this.b=this.Ra=this.I=null;this.exports={connect:this.ic,receiveData:this.Kb,receiveStatus:this.be}} ba(rf,n);k=rf.prototype; k.ca=function(a,b,c,d){var e=this;switch(b){case sf:return this.P[b]=this.g=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64");if(2==c.length){var d=Na(c[0]);if(d!=this.$a)return;c=Na(c[1]);if(this.b=ka(c)){var e=this.b.exports;if(e){var f=e.connect;f&&f.call(this.b,this.D);if(this.Ra=e.receiveData){this.D=a;this.I=e.receiveStatus;this.status(this.ab+"."+d+" connected to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; -k.ua=function(a,b){if(!b)if(this.ic(this.D),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.wa=function(a){return a?this.save():!0};k.reset=function(){wf(this)};k.save=function(){var a=new Vc(this),b=0,c=[];c[b++]=this.F;c[b++]=this.M;c[b++]=this.O;c[b++]=this.ia;c[b++]=this.B;c[b++]=this.C;c[b]=this.L;a.set(0,c);return a.data()};k.restore=function(a){return wf(this,a[0])}; +k.ic=function(a){if(!this.b){var b=vc(this.S,"connection");if(b){var c=b.split("->");if(2==c.length){var d=Na(c[0]);if(d!=this.$a)return;c=Na(c[1]);if(this.b=ka(c)){var e=this.b.exports;if(e){var f=e.connect;f&&f.call(this.b,this.D);if(this.Ra=e.receiveData){this.D=a;this.I=e.receiveStatus;this.status("Connected "+this.ab+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; +k.va=function(a,b){if(!b)if(this.ic(this.D),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.ua=function(a){return a?this.save():!0};k.reset=function(){wf(this)};k.save=function(){var a=new Vc(this),b=0,c=[];c[b++]=this.F;c[b++]=this.M;c[b++]=this.O;c[b++]=this.ia;c[b++]=this.B;c[b++]=this.C;c[b]=this.L;a.set(0,c);return a.data()};k.restore=function(a){return wf(this,a[0])}; function wf(a,b){var c=0;b||(b=xf);a.F=b[c++];a.M=b[c++];a.O=b[c++];a.ia=b[c++];a.B=b[c++];a.C=b[c++];a.L=b[c];return!0}function yf(a,b){var c=a.L&b;b&15||(c>>=4);b=zf[c];c=((a.B&Af)>>2)+6;a.B&Bf&&c++;c+=((a.B&Cf)>>6)+1>>1;return 1E3/Math.round(b/c)}function tf(a,b){xa(a,"receiveByte("+Da(b)+"), status="+Da(a.ia));return a.N||a.ia&Df?!1:(a.M=b,a.ia|=Df,Dd(a.u,a.X),!0)} k.Kb=function(a){null!=a&&(this.A="number"!=typeof a?a:this.A+String.fromCharCode(a));this.A&&(tf(this,this.A.charCodeAt(0))&&(this.A=this.A.substr(1)),this.A&&this.u&&Jc(this.u,this.Y,yf(this,Ef)));return!0};k.be=function(a){this.ia&=~Ff;a&64&&(this.ia|=Ff)};function Ee(a,b){a.ia=a.ia|Pd|Gf;b&&a.Ra&&a.Ra.call(a.b,b)}k.zd=function(a,b){var c=this.M;v(this,a,null,b,"DATA",c);this.ia&=~Df;return c};k.yd=function(a,b){var c=this.ia;v(this,a,null,b,"STATUS",c);return c}; k.Jd=function(a,b,c){v(this,a,b,c,"DATA");this.O=b;this.ia&=~(Pd|Gf);xa(this,"transmitByte("+Da(b)+")");if(19==b)this.N=!0;else if(17==b)this.N=!1;else if(this.Ra&&this.Ra.call(this.b,b),this.g)if(8==b)this.g.value=this.g.value.slice(0,-1),0":String.fromCharCode(b);c=a.length;9==b?(b=this.V||8,c=b-this.w%b,this.V&&(a=Ka("",c))):13==b&&(this.w=c=0,a="\n");this.R&&!this.w&&c&&(a=String.fromCharCode(this.R)+a);this.g.value+=a;this.g.scrollTop= @@ -202,15 +203,15 @@ k.vc=function(a,b,c){var d=ag(a);if(-1!==d){var e=this.H,f=d&e.j,g=(d&e.C)>>>e.g function bg(a,b,c){var d;c=(c?a.F:a.la).J;if(void 0!==b){d=b=Of(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;cc&&(c=Ra(Gg,a.substr(b,1))));return c};function Ig(a,b){var c=0;a=a.Hb(b);if(void 0!==a)switch(b){case Jg:case Kg:case Lg:case Mg:case Ng:case Og:case Pg:case Qg:c=2;break;case Rg:case Sg:case Tg:case Ug:case Vg:case Wg:case Xg:c=4}return c?x(a,c):"??"} -k.Hb=function(a){var b;if(0<=a){var c=this.u;switch(a){case Jg:b=c.g;break;case Kg:b=c.w;break;case Lg:b=c.A;break;case Rg:b=Wc(c);break;case Mg:b=c.B;break;case Ng:b=c.C;break;case Sg:b=jd(c);break;case Og:b=c.D;break;case Pg:b=c.F;break;case Tg:b=D(c);break;case Qg:b=F(c,D(c));break;case Ug:b=c.M;break;case Vg:b=c.j;break;case Wg:b=Uc(c);break;case Xg:b=Uc(c)&255|c.g<<8}}return b}; +k.Hb=function(a){var b;if(0<=a){var c=this.u;switch(a){case Jg:b=c.g;break;case Kg:b=c.w;break;case Lg:b=c.A;break;case Rg:b=hd(c);break;case Mg:b=c.B;break;case Ng:b=c.C;break;case Sg:b=jd(c);break;case Og:b=c.D;break;case Pg:b=c.F;break;case Tg:b=D(c);break;case Qg:b=F(c,D(c));break;case Ug:b=c.M;break;case Vg:b=c.j;break;case Wg:b=Uc(c);break;case Xg:b=Uc(c)&255|c.g<<8}}return b}; function Yg(a,b){b=Of(a,b);for(var c=0,d,e;0<=(c=b.indexOf("@",c));)e=a.Gb(b,c+1),0<=e&&(b=b.substr(0,c)+Ig(a,e)+b.substr(c+1+Gg[e].length)),c++;for(c=0;0<=(c=b.indexOf("#",c));)e=b.substr(c+1,2),d=Ba(e,16),null!=d&&32<=d&&128>d?(d=e+" '"+String.fromCharCode(d)+"'",b=b.replace("#"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("$",c));)e=b.substr(c+1,9),(d=bg(a,e))?(d=e+' "'+ig(a,d)+'"',b=b.replace("$"+e,d),c+=d.length):c++;for(c=0;0<=(c=b.indexOf("^",c));)e=b.substr(c+1,9),(d=bg(a,e))?(dg(d),d=e+ -' "'+ig(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}k.message=function(a,b){b&&(a+=" at "+hg(Wf(this.u.j).J));this.ha&1073741824?this.X.push(a):this.V&&a==this.V||(this.V=a,this.ha&-2147483648&&(this.da(),a+=" (cpu halted)"),this.i(a),this.u&&(a=this.u,Kc(a),a.va=0,Ac(a)))}; +' "'+ig(a,d,11)+'"',b=b.replace("^"+e,d),c+=d.length):c++;return b}k.message=function(a,b){b&&(a+=" at "+hg(Wf(this.u.j).J));this.ha&1073741824?this.X.push(a):this.V&&a==this.V||(this.V=a,this.ha&-2147483648&&(this.da(),a+=" (cpu halted)"),this.i(a),this.u&&(a=this.u,Kc(a),a.wa=0,Ac(a)))}; function za(a,b,c,d,e,f,g,h){h|=256;null!=f&&(a.ha&h)!=h||a.message(b.$a+"."+(null!=d?"outPort":"inPort")+"("+y(c)+","+(f?f:"unknown")+(null!=d?","+Da(d):"")+")"+(null!=g?": "+Da(g):"")+(null!=e?" at "+hg(e):""))} function Yf(a){var b;if(Ed(a)){if(!a.D||!a.D.length){a.D=Array(Zg);for(b=0;b>>d.g],!1)}a.I=["br"];if(a.w)for(b=1;b>>d.g],!0);a.w=["bw"];a.oa=0}k.Pa=function(a,b,c){var d=!0;c||eh(this,a,b,!1,!0);if(a!=this.j){var e=ag(b);if(-1===e)this.i("invalid address: "+hg(b.J)),d=!1;else{var f=this.H;f.b[e>>>f.g].Pa(e&f.j,a==this.w)}}d&&(a.push(b),c?b.Da=!0:(fh(this,a,a.length-1,"set"),Yf(this)));return d}; function eh(a,b,c,d,e){var f=!1;c=ag(c);for(var g=1;g>>d.g],b==a.w));h.Da||Yf(a);break}}return f}function gh(a,b){for(var c=1;cthis.b&&this.g.length&&(this.b=0);if(0>this.b| function hh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.i(">> "+b):(a.L&&(a.i("ended assemble at "+hg(a.O.J)),a.F=a.O,a.L=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.V=null;if(ra(a)&&0p||"z"Xa.length&&(a.i("note: only "+Xa.length+" available"),Aa=Xa.length);Ma-=Aa;0>Ma&&(null==Xa[Xa.length-1].J?(Aa=Ma+Aa,Ma=0):Ma+=Xa.length);var le=[];"call"==ng&&(ic=1E5,le=["CALL"]);for(void 0!==mg&&a.i(Aa+" instructions earlier:");0< -ic&&Ma!=a.T;){var qg=Xa[Ma++];if(null==qg.J)break;var jc=Wf(qg.J),ni=Aa--,rg=ih(a,jc,"history",ni);(!le.length||0<=rg.indexOf(le[0]))&&a.i(rg);jc.Fb&&(Ma+=jc.Fb,ic-=jc.Fb,Aa-=jc.Fb);Ma>=Xa.length&&(Ma=0);a.sa=Aa;pg++;ic--}}pg||(a.i("no "+og+"history available"),a.sa=void 0)}else{var Xc=bg(a,ma);if(Xc){var Yc=0;La&&("l"==La.charAt(0)&&(La=La.substr(1)||dc),Yc=Pf(a,La)>>>0,65536>4||1;oi--&&0<$c;){var ad=0,me=0,lc,ne="", -sg="",ma=hg(Xc.J);for(lc=16;0bd?String.fromCharCode(bd):".";$c--}kc&&(kc+="\n");kc+=ma+" "+ne+(lc?"":" "+sg)}kc&&a.i(kc);a.la=Xc}}}}break;case "e":if("else"==f[0])break;var cd=1,tg=255,ug=a.Ga,vg=a.Sb;"ew"==f[0]&&(cd=2,tg=65535,ug=a.Bb,vg=a.vc);var wg=cd<<1,xg=f[1];if(null==xg)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a"); -else{var dd=bg(a,xg);if(dd)for(var ed=2;edue;){for(var rb=null,ui=256;65536>oc.J>>>0;){zg.J=a.Bb(oc,2);if(null==oc.J||!ui--)break;for(var vi=a,gd=zg, -Ag=null,pc=gd.J,Bg=pc,ve=1;6>=ve&&pc;ve++){if(2Xa.length&&(a.i("note: only "+Xa.length+" available"),Aa=Xa.length);Ma-=Aa;0>Ma&&(null==Xa[Xa.length-1].J?(Aa=Ma+Aa,Ma=0):Ma+=Xa.length);var le=[];"call"==ng&&(hc=1E5,le=["CALL"]);for(void 0!==mg&&a.i(Aa+" instructions earlier:");0< +hc&&Ma!=a.T;){var qg=Xa[Ma++];if(null==qg.J)break;var ic=Wf(qg.J),ni=Aa--,rg=ih(a,ic,"history",ni);(!le.length||0<=rg.indexOf(le[0]))&&a.i(rg);ic.Fb&&(Ma+=ic.Fb,hc-=ic.Fb,Aa-=ic.Fb);Ma>=Xa.length&&(Ma=0);a.sa=Aa;pg++;hc--}}pg||(a.i("no "+og+"history available"),a.sa=void 0)}else{var Wc=bg(a,ma);if(Wc){var Xc=0;La&&("l"==La.charAt(0)&&(La=La.substr(1)||cc),Xc=Pf(a,La)>>>0,65536>4||1;oi--&&0ad?String.fromCharCode(ad):".";Zc--}jc&&(jc+="\n");jc+=ma+" "+ne+(kc?"":" "+sg)}jc&&a.i(jc);a.la=Wc}}}}break;case "e":if("else"==f[0])break;var bd=1,tg=255,ug=a.Ga,vg=a.Sb;"ew"==f[0]&&(bd=2,tg=65535,ug=a.Bb,vg=a.vc);var wg=bd<<1,xg=f[1];if(null==xg)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a"); +else{var cd=bg(a,xg);if(cd)for(var dd=2;ddue;){for(var rb=null,ui=256;65536>nc.J>>>0;){zg.J=a.Bb(nc,2);if(null==nc.J||!ui--)break;for(var vi=a,fd=zg, +Ag=null,oc=fd.J,Bg=oc,ve=1;6>=ve&&oc;ve++){if(2\nLicense: GPL version 3 or later ");for(b=0;bTh){if(Vh(d,this.F)){this.w=new Vc(this,"1.32.2",di);Vh(this.w)&&(ei(this,d),a=fi,gi(this.w));this.w.set(ai,Qa());hi(this.w);var e=this.b&&!this.C;if(a==bi||ha("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=$h(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Vh(d,g):("error"==f&&"no machine state"!= g?(this.aa("Error: "+g),"unable to verify user"==g&&(ab(ii,""),this.g=null)):this.i(f+": "+g),gi(d),Vh(d)?(c=$h(d),e=!0):c=!1))}e&&Yh(this,c?d:null)}else a==fi&&d.clear()}else Yh(this);delete this.F;delete this.I}e=ja(this.id);for(f=0;fa[1];a=a[2];this.W=!0;this.G.ja=!0;var d=this.P.power;d&&(d.textContent="Shutdown");this.u&&(ji(this,this.u,b,c,a),this.u.ib());this.N&&(ei(this,b),b.clear());!c&&this.w&&(this.w.clear(),delete this.w);this.j=0}; function ei(a,b){if(ha("There may be a problem with your PC8080 machine.\n\nTo help us diagnose it, click OK to send this PC8080 machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PC8080",ver:"1.32.2"};d.url=a.U;d.user=c;d.type="bug";d.data=b;Sa("http://www.pcjs.org/api/v1/report",d,!0)}} -function Kh(a,b,c){var d,e="none";if(a.j)return null;a.j--;var f=new Vc(a,"1.32.2"),g=new Vc(a,"1.32.2",Zh),h=Qa();g.set(ai,h);f.set(ai,h);f.set(ki,"1.32.2");f.set(li,window?window.location.href:null);f.set(mi,Ua());a.u&&a.u.wa&&(c&&a.u.da(),d=a.u.wa(b,c),"object"===typeof d&&f.set(a.u.id,d),c&&(a.u.G.ja=!1,!1===d&&(e=null)));for(var h=ja(a.id),l=0;l>1)+2;10>this.b&&(this.b=10);15>2;this.f=this.c-1;this.h=this.v/this.c|0;this.o=this.h-1;this.j=[];this.l=[];this.B=[];this.C=[];a=new D;Va(a,this.J);this.a=Array(this.h);for(b=0;b>1)+2;10>this.b&&(this.b=10);15>2;this.f=this.c-1;this.h=this.v/this.c|0;this.o=this.h-1;this.j=[];this.l=[];this.B=[];this.C=[];a=new D;Va(a,this.J);this.a=Array(this.h);for(b=0;b>>a.b;0f&&(n=f);if(h&&h.size){if(h.type==d){if(e+f<=h.Pa)return h.fb+=h.Pa-e,h.Pa=e,!0;if(e>=h.Pa+h.fb){n=h.size-(e-l);n>f&&(n=f);h.fb=e-h.Pa+n;e=l+a.c;f-=n;g++;continue}}return Xa(Ya,e,f)}e=new D(e,n,a.c,d);Va(e,a.J,h);a.a[g++]=e;e=l+a.c;f-=n}return 0>=f?(a.status(Math.floor(c/1024)+"Kb "+Za[d]+" at "+B(b,4,!0)),!0):Xa($a,b,c)}function ab(a,b){return a.a[(b&a.g)>>>a.b].eb(b&a.f,b)} function bb(a,b){var c=b&a.f,d=(b&a.g)>>>a.b;return c!=a.f?a.a[d].td(c,b):a.a[d++].Sa(c,b)|a.a[d&a.o].Sa(0,b+1)<<8}function cb(a,b,c){a.a[(b&a.g)>>>a.b].Lb(b&a.f,c&255,b)}function db(a,b,c){var d=b&a.f,e=(b&a.g)>>>a.b;d!=a.f?a.a[e].Dd(d,c&65535,b):(a.a[e++].Ta(d,c&255,b),a.a[e&a.o].Ta(0,c>>8&255,b+1))} function eb(a){for(var b=0,c=[],d=0;d>1),this.a=new Int32Array(this.m,0,c>>2),ob(this,jb?pb:qb);else{this.a=Array(c>>2);for(a=0;a>1),this.a=new Int32Array(this.m,0,c>>2),ob(this,jb?pb:qb);else{this.a=Array(c>>2);for(a=0;a>2),b=0;b>8,c)};k.sd=function(a){return this.a[a>>2]>>>((a&3)<<3)&255}; k.xd=function(a){var b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8};k.Cd=function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<>8);this.ja=!0};k.qd=function(a,b){return this.eb(a,b)};k.vd=function(a,b){return this.Jb(a,b)};k.Ad=function(a,b,c){this.w||this.Lb(a,b,c)}; k.Fd=function(a,b,c){this.w||this.h(a,b,c)};k.pd=function(a){return this.b[a]};k.rd=function(a){return this.b[a]};k.ud=function(a){return this.u.getUint16(a,!0)};k.wd=function(a){return a&1?this.b[a]|this.b[a+1]<<8:this.g[a>>1]};k.zd=function(a,b){this.b[a]=b;this.ja=!0};k.Bd=function(a,b){this.b[a]=b;this.ja=!0};k.Ed=function(a,b){this.u.setUint16(a,b,!0);this.ja=!0};k.Gd=function(a,b){a&1?(this.b[a]=b,this.b[a+1]=b>>8):this.g[a>>1]=b;this.ja=!0}; -var lb=0,nb=2,Za=["NONE","RAM","ROM","VID","H/W"],kb=0,sb=[],rb=[D.prototype.sd,D.prototype.Cd,D.prototype.xd,D.prototype.Hd],vb=[D.prototype.qd,D.prototype.Ad,D.prototype.vd,D.prototype.Fd];if(Pa)var qb=[D.prototype.pd,D.prototype.zd,D.prototype.ud,D.prototype.Ed],pb=[D.prototype.rd,D.prototype.Bd,D.prototype.wd,D.prototype.Gd]; -function wb(a,b){q.call(this,"CPU",a);var c=a.multiplier||1;this.na=a.cycles||b;this.O=c;this.Da=Math.round(this.na/1E4)/100;this.X=this.Da*this.O;this.i.ka=!1;this.i.Kb=!1;this.i.Qa=a.autoStart;this.i.Bb=!1;this.i.Za=!1;this.wa=this.da=0;this.xa=a.csStart;this.ha=a.csInterval;this.la=a.csStop;this.H=[];this.jb=this.gb.bind(this);z(this)}m(wb,q);k=wb.prototype; -k.qa=function(a,b,c,d){this.F=a;this.u=b;this.J=d;for(b=0;ba.R/a.X&&(b=1);a.O=b;b=a.Da*a.O;if(a.X!=b){a.X=b;b=a.X.toFixed(2)+"Mhz";var d=a.w.setSpeed;d&&(d.textContent=b);a.aa("target speed: "+b)}c&&a.F&&Hb(a.F)}a.I+=a.P;a.P=0;a.L=da();a.V=0;Eb(a)}function Ib(a,b){var c=a.H.length;a.H.push([-1,b]);return c}function Jb(a,b,c){0<=b&&ba.H[b][0]&&(c*=a.na*a.O/1E3,a.H[b][0]=c+Kb(a))}function Kb(a,b){var c=a.ca-=a.a;a.a=0;b&&(a.ca=0);return c} +break;case "speed":this.w[b]=c;a=!0;break;case "setSpeed":this.w[b]=c,c.onclick=function(){Db(d,d.O<<1,!0)},c.textContent=this.X.toFixed(2)+"Mhz",a=!0}return a};function Eb(a,b){var c=1;b&&1a.R/a.X&&(b=1);a.O=b;b=a.Da*a.O;if(a.X!=b){a.X=b;b=a.X.toFixed(2)+"Mhz";var d=a.w.setSpeed;d&&(d.textContent=b);a.aa("target speed: "+b)}c&&a.F&&Hb(a.F)}a.I+=a.P;a.P=0;a.L=da();a.V=0;Eb(a)}function Ib(a,b){var c=a.H.length;a.H.push([-1,b]);return c}function Jb(a,b,c){0<=b&&ba.H[b][0]&&(c*=a.na*a.O/1E3,a.H[b][0]=c+Kb(a))}function Kb(a,b){var c=a.da-=a.a;a.a=0;b&&(a.da=0);return c} k.gb=function(a){if(la(this,!0)){if(!this.i.ka){Db(this);this.F&&this.F.start(this.L,Gb(this));this.i.ka=!0;this.i.Kb=!0;this.N&&this.N.start();var b=this.w.run;b&&(b.textContent="Halt");this.F&&(Lb(this.F,!0),a&&Hb(this.F,!0))}this.Fa>=this.na&&Eb(this,!0);this.oa=0;this.va=da();this.V&&(a=this.va-this.V,a>this.Na&&(this.L+=a,this.L>this.va&&(this.L=this.va)));try{do{for(var c,d=this.i.Za?1:this.ya,e=this.H.length-1;0<=e;e--){var f=this.H[e];0>f[0]||d>f[0]&&(d=f[0])}c=d;this.qb(c);c=Kb(this,!0); -this.oa+=c;this.P+=c;a=c;this.i.Za&&(b=!1,this.wa=this.wa+this.Eb()|0,this.da-=a,0>=this.da&&(this.da+=this.ha,b=!0),0<=this.la&&this.la<=Gb(this)&&(this.ha=this.la=-1,Ab(this),Cb(this),b=!0),b&&this.aa(Gb(this)+" cycles: checksum="+B(this.wa)));a=c;for(var g=this.H.length-1;0<=g;g--){var h=this.H[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.ma-=c;if(0>=this.ma){this.ma+=this.ya;++this.Oa>=Mb&&(this.F&&Lb(this.F),this.Oa=0);break}}while(this.i.ka)}catch(l){Cb(this);Bb(this);this.F&&this.F.stop(da(), +this.oa+=c;this.P+=c;a=c;this.i.Za&&(b=!1,this.wa=this.wa+this.Eb()|0,this.ea-=a,0>=this.ea&&(this.ea+=this.ha,b=!0),0<=this.la&&this.la<=Gb(this)&&(this.ha=this.la=-1,Ab(this),Cb(this),b=!0),b&&this.aa(Gb(this)+" cycles: checksum="+B(this.wa)));a=c;for(var g=this.H.length-1;0<=g;g--){var h=this.H[g];0>h[0]||(h[0]-=a,0>=h[0]&&(h[0]=-1,h[1]()))}this.ma-=c;if(0>=this.ma){this.ma+=this.ya;++this.Oa>=Mb&&(this.F&&Lb(this.F),this.Oa=0);break}}while(this.i.ka)}catch(l){Cb(this);Bb(this);this.F&&this.F.stop(da(), Gb(this));la(this,!1);c=l.stack||l.message;this.i.error=!0;this.G(c);return}c=setTimeout;d=this.jb;this.V=da();e=this.Na;this.oa&&(e=Math.round(e*this.oa/this.ya));e-=this.V-this.va;if(f=this.V-this.L)this.R=Math.round(this.P/(10*f))/100,864E5<=f&&(this.I=0,Db(this));if(0>e||this.Re&&(this.L-=e),e=0;this.Fa+=this.oa;this.V+=e;c(d,e)}else Bb(this),this.F&&this.F.stop(da(),Gb(this))};k.qb=function(){return 0}; function Cb(a){a.i.Ya&&(a.i.kb=!0);Kb(a);a.I+=a.P;a.P=0;if(a.i.ka){a.i.ka=!1;a.N&&a.N.stop();var b=a.w.run;b&&(b.textContent="Run")}a.i.complete=void 0}function Bb(a){if(a.F){for(var b=a.F,c=0;c>8&255;a.l=b&255}function F(a,b){a.s=b&65535}function J(a){return a.o&256?1:0}function $b(a,b){a.o=a.o&255|b}function ac(a){return Qa[a.v&255]?4:0}function Ub(a){return a.D&-214|(a.v&128?128:0)|(a.o&255?0:64)|((a.v^a.B)&16?16:0)|ac(a)|J(a)}function Sb(a,b){a.o=a.v=a.B=0;b&1&&(a.o|=256);b&4||(a.v|=1);b&16&&(a.B|=16);b&64||(a.o|=255);b&128&&(a.v^=192);a.D=a.D&-726|b&512|2}function bc(a,b){a.B=a.b^b;return a.v=(a.o=a.b+b)&255} function cc(a,b){a.B=a.b^b;return a.v=(a.o=a.b+b+(a.o&256?1:0))&255}function dc(a,b){a.o=a.v=a.B=a.b&b;(a.b|b)&8&&(a.B^=16);return a.o}function ec(a,b){a.B=b^255;b=a.v=b+255&255;a.o=a.o&-256|b;return b}function fc(a,b){a.B=b;b=a.v=b+1&255;a.o=a.o&-256|b;return b}function gc(a,b){return a.v=a.o=a.B=a.b|b}function L(a,b){b^=255;a.B=a.b^b;return a.v=(a.o=a.b+b+1^256)&255}function hc(a,b){b^=255;a.B=a.b^b;return a.v=(a.o=a.b+b+(a.o&256?0:1)^256)&255}function ic(a,b){return a.v=a.o=a.B=a.b^b} function M(a,b){a=a.u;return a.a[(b&a.g)>>>a.b].Sa(b&a.f,b)}function N(a,b,c){a=a.u;a.a[(b&a.g)>>>a.b].Ta(b&a.f,c&255,b)}function O(a){var b=M(a,a.s);F(a,a.s+1);return b}function P(a){var b=bb(a.u,a.s);F(a,a.s+2);return b}function Q(a){var b=bb(a.u,a.A);a.A=a.A+2&65535;return b}function R(a,b){a.A=a.A-2&65535;db(a.u,a.A,b)}function jc(a){if(a.a&&a.C&255&&a.D&512){for(var b=0;8>b&&!(a.C&1<b?255:1<>8;$b(this,a&256);this.a-=4},lc,function(){var a;I(this,a=H(this)+Vb(this));$b(this,a>>8&256);this.a-=10},function(){this.b=M(this,Vb(this));this.a-=7},function(){Xb(this,Vb(this)-1);this.a-=5}, function(){this.c=fc(this,this.c);this.a-=5},function(){this.c=ec(this,this.c);this.a-=5},function(){this.c=O(this);this.a-=7},function(){var a=this.b<<8&256;this.b=(a|this.b)>>1;$b(this,a);this.a-=4},lc,function(){Zb(this,P(this));this.a-=10},function(){N(this,Yb(this),this.b);this.a-=7},function(){Zb(this,Yb(this)+1);this.a-=5},function(){this.h=fc(this,this.h);this.a-=5},function(){this.h=ec(this,this.h);this.a-=5},function(){this.h=O(this);this.a-=7},function(){var a=this.b<<1;this.b=a&255|J(this); @@ -112,7 +112,7 @@ P(this);ac(this)||F(this,a);this.a-=10},function(){var a=Q(this);R(this,H(this)) I(this,Yb(this));Zb(this,a);this.a-=5},function(){var a=P(this);ac(this)&&(R(this,this.s),F(this,a),this.a-=6);this.a-=11},oc,function(){this.b=ic(this,O(this));this.a-=7},function(){R(this,this.s);F(this,40);this.a-=11},function(){this.v&128||(F(this,Q(this)),this.a-=6);this.a-=5},function(){var a=Q(this);Sb(this,a&255|this.D&-256);this.b=a>>8;this.a-=10},function(){var a=P(this);this.v&128||F(this,a);this.a-=10},function(){this.D&=-513;this.a-=4},function(){var a=P(this);this.v&128||(R(this,this.s), F(this,a),this.a-=6);this.a-=11},function(){R(this,Ub(this)&255|this.b<<8);this.a-=11},function(){this.b=gc(this,O(this));this.a-=7},function(){R(this,this.s);F(this,48);this.a-=11},function(){this.v&128&&(F(this,Q(this)),this.a-=6);this.a-=5},function(){this.A=H(this)&65535;this.a-=5},function(){var a=P(this);this.v&128&&F(this,a);this.a-=10},function(){this.D|=512;this.a-=4;jc(this)},function(){var a=P(this);this.v&128&&(R(this,this.s),F(this,a),this.a-=6);this.a-=11},oc,function(){L(this,O(this)); this.a-=7},function(){R(this,this.s);F(this,56);this.a-=11}];function U(a){q.call(this,"ChipSet",a);var b=a.model;b&&!pc[b]&&ea("Unrecognized ChipSet model: "+b);this.b=pc[b]||{};a.sound&&(this.I=null,window&&(this.I=window.AudioContext||window.webkitAudioContext),this.I&&new this.I);z(this)}m(U,q);k=U.prototype;k.S=function(){return!1}; -k.qa=function(a,b,c,d){this.u=b;this.m=c;this.J=d;this.F=a;this.h=C(a,"Keyboard");this.g=C(a,"SerialPort");this.video=C(a,"Video");fb(b,this,this.b.bb);gb(b,this,this.b.cb)};k.ba=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};k.fa=function(a){return a?this.save():!0};k.reset=function(){this.b.INIT&&!this.restore(this.b.INIT)&&this.G("reset error")}; +k.qa=function(a,b,c,d){this.u=b;this.m=c;this.J=d;this.F=a;this.h=C(a,"Keyboard");this.g=C(a,"SerialPort");this.video=C(a,"Video");fb(b,this,this.b.bb);gb(b,this,this.b.cb)};k.ca=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};k.ba=function(a){return a?this.save():!0};k.reset=function(){this.b.INIT&&!this.restore(this.b.INIT)&&this.G("reset error")}; k.save=function(){var a=new G(this);switch(this.b.Y){case V.Y:a.set(0,[this.V,this.f,this.X,this.B,this.H,this.P,this.R]);break;case W.Y:a.set(0,[this.N,this.s]),a.set(1,[this.l,this.o]),a.set(2,[this.c,this.C,this.O,this.L]),a.set(3,[this.A,this.a,this.v,this.D,this.j])}return a.data()}; k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.b.Y){case V.Y:return this.V=b[0],this.f=b[1],this.X=b[2],this.B=b[3],this.H=b[4],this.P=b[5],this.R=b[6],!0;case W.Y:return this.N=b[0],this.s=b[1],b=a[1],this.l=b[0],this.o=b[1],b=a[2],this.c=b[0],this.C=b[1],this.O=b[2],this.L=b[3],b=a[3],this.A=b[0],this.a=b[1],this.v=b[2],this.D=b[3],this.j=b[4],!0}return!1};k.start=function(){};k.stop=function(){};k.Xc=function(){return this.V};k.Yc=function(){return this.f};k.Zc=function(){return this.X}; k.Wc=function(){return this.B>>8-this.H&255};k.ed=function(a,b){this.H=b};k.gd=function(a,b){this.P=b};k.fd=function(a,b){this.B=b<<8|this.B>>8};k.hd=function(a,b){this.R=b};k.jd=function(){};function qc(a){var b=0,c=0,d=~a.A;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} @@ -124,43 +124,44 @@ var V={Y:1978.1,Fc:{Z:0,ne:1,re:16,ye:32,He:64,Ge:128,Ha:14},za:{Z:1,Vb:1,yc:2,u W.INIT=[[W.Tb.INIT,W.ga.qc|W.ga.rc],[W.ua.cc,W.ua.dc],[W.Va.fc,W.Va.bc,W.Va.ec,W.Va.ac],[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,11984,11888,11776,11808,11776,12E3,12E3,11901,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], [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,11808,11984,11856,11776,11808,11776,12E3,12E3,11881,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]]];V.bb={0:U.prototype.Xc,1:U.prototype.Yc,2:U.prototype.Zc,3:U.prototype.Wc}; V.cb={2:U.prototype.ed,3:U.prototype.gd,4:U.prototype.fd,5:U.prototype.hd,6:U.prototype.jd};W.bb={66:U.prototype.$c};W.cb={66:U.prototype.kd,98:U.prototype.nd,162:U.prototype.md,194:U.prototype.ld};Ha(function(){for(var a=y(document,"pc8080","chipset"),b=0;b>8&255,a.a[d++]=g[c]>>16&255,a.a[d++]=g[c]>>24&255;else a.a=e;a.sa=e.symbols;if(!a.a.length){u("Empty ROM: "+b);return}if(1==a.a.length){u(a.a[0]);return}}catch(h){a.G("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm, " ").replace(/ +$/,"").split(" "),a.a=Array(b.length),e=0;e>>f.b;0>>=f.b;0=p.Ua&&a<=p.ib?d.c&(Ic|Jc)||(d.c|=Jc,Kc(d,20,!0),Lc(d)):a>=p.Oc&&a<=p.z&&d.c&Jc&&(d.c&=~Jc,Kc(d,20,!1),Lc(d));return!0},c.onpaste=function(a){a:{if(d.g&&d.g.Ba&&(a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(), a=a.clipboardData||window.clipboardData)){Mc(d.g,a.getData("Text"));a=!1;break a}a=!0}return a},!0;default:if(this.a.Ea&&void 0!==this.a.Ea[b])return this.w[e]=c,c.onclick=function(a,b){return function(c){c.preventDefault&&c.preventDefault();Kc(a,b,!0,!0)}}(this,this.a.Ea[b]),!0}}return!1};k.qa=function(a,b,c,d){this.F=a;this.m=c;this.J=d;var e=this;this.v=Ib(this.m,function(){Nc(e)});this.N=C(a,"ChipSet");this.g=C(a,"SerialPort");fb(b,this,this.a.bb);gb(b,this,this.a.cb)}; -k.ba=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};k.fa=function(a){return a?this.save():!0};k.reset=function(){this.b=[];this.c=0;this.a.INIT&&!this.restore(this.a.INIT)&&this.G("reset error")};k.save=function(){var a=new G(this);switch(this.a.Y){case X.Y:a.set(0,[this.l,this.j,this.h,this.o,-1])}return a.data()}; -k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.a.Y){case Oc.Y:return!0;case X.Y:return this.l=b[0],Lc(this,this.l&X.ea.ub),this.j=b[1],this.h=b[2],this.o=b[3],this.f=b[4],!0}return!1};function Lc(a,b){var c;null!=b?a.s=b:b=a.s;for(var d in a.a.Ja)if(c="led-"+d,c=a.w[c]){var e=a.a.Ja[d],f=!!(b&e);e&e-1&&(f=!(b&~e));c.style.backgroundColor=f?"#"+B(16711680,6):"#000000"}if(c=a.w["led-caps-lock"])c.style.backgroundColor=a.c&Jc?"#"+B(65280,6):"#000000"} +k.ca=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};k.ba=function(a){return a?this.save():!0};k.reset=function(){this.b=[];this.c=0;this.a.INIT&&!this.restore(this.a.INIT)&&this.G("reset error")};k.save=function(){var a=new G(this);switch(this.a.Y){case X.Y:a.set(0,[this.l,this.j,this.h,this.o,-1])}return a.data()}; +k.restore=function(a){var b;if(a&&(b=a[0])&&b.length)switch(this.a.Y){case Oc.Y:return!0;case X.Y:return this.l=b[0],Lc(this,this.l&X.fa.ub),this.j=b[1],this.h=b[2],this.o=b[3],this.f=b[4],!0}return!1};function Lc(a,b){var c;null!=b?a.s=b:b=a.s;for(var d in a.a.Ja)if(c="led-"+d,c=a.w[c]){var e=a.a.Ja[d],f=!!(b&e);e&e-1&&(f=!(b&~e));c.style.backgroundColor=f?"#"+B(16711680,6):"#000000"}if(c=a.w["led-caps-lock"])c.style.backgroundColor=a.c&Jc?"#"+B(65280,6):"#000000"} function Hc(a,b,c){var d=!0,e=b.keyCode,f=2==b.location,g=0;switch(e){case 16:g=f?Pc:Qc;break;case 17:g=f?Rc:Sc;break;case 18:g=f?Tc:Uc;break;case 91:g=f?Wc:Xc;break;case 20:g=Jc}g&&(a.c=c?a.c|g:a.c&~g);var h;a:if(e=a.a.ob[e]||e,a.a.hb[e])h=e;else{for(h in a.a.Ea)if(a.a.Ea[h]===e)break a;h=null}h&&!b.metaKey&&(d=!1,a.c&(Yc|Zc)&&(13==h?(h=118,d=!0):8==h&&(h=46,d=!0),d&&(a.c=c?a.c|Zc:a.c&~Zc)),d=Kc(a,h,c),(!(h>=p.Ua&&h<=p.ib)||a.c|$c)&&b.preventDefault&&b.preventDefault());return d} function Kc(a,b,c,d){var e;a:{for(e=0;ee?a.b.push({nb:b,lb:Date.now(),$a:d||!1}):(a.b[e].lb=Date.now(),a.b[e].$a=d||!1),d&&Nc(a);else if(0<=e){if(!a.b[e].$a&&(d=a.b[e].lb)&&Date.now()-dc||c>e)c=e}else{Kc(a,d,!1);b=0;continue}}b++}0<=c&&Jb(a.m,a.v,c)}k.ad=function(){var a=this.j;0<=this.f&&(this.fc||c>e)c=e}else{Kc(a,d,!1);b=0;continue}}b++}0<=c&&Jb(a.m,a.v,c)}k.ad=function(){var a=this.j;0<=this.f&&(this.f>3)*a.B,!Wa(a.u,a.ca,a.v,3)))return!1;a.v?(a.Fa=a.c.createImageData(b,c),a.La=16/a.da|0,hd(a,a.v>>1)):hd(a,(a.C+1)*a.R);a.l=document.createElement("canvas");a.l.width=b;a.l.height=c;a.ma=a.l.getContext("2d");a.H={};a.O=1<>3)*a.B,!Wa(a.u,a.da,a.v,3)))return!1;a.v?(a.Fa=a.c.createImageData(b,c),a.La=16/a.ea|0,hd(a,a.v>>1)):hd(a,(a.C+1)*a.R);a.l=document.createElement("canvas");a.l.width=b;a.l.height=c;a.ma=a.l.getContext("2d");a.H={};a.O=1<=a.va?8:16,f=8>(7>4)*c)}return l}cd.prototype.ba=function(){return!0};cd.prototype.S=function(a,b,c){var d=this;if("led"==a||"rled"==a)return this.ra[b]=c,!0;switch(b){case "fullScreen":return this.w[b]=c,this.a&&this.a.Ga?c.onclick=function(){d.Ga()}:c.parentNode.removeChild(c),!0}return!1}; -cd.prototype.Ga=function(){var a=!1;if(this.a){if(this.a.Ga){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.A/this.s;b>c&&(a=Math.round(c/b*100)+"%")}this.Da?(this.o.style.width=a,this.o.style.width=a,this.o.style.display="block",this.o.style.margin="auto"):(this.a.style.width=a,this.a.style.height="auto");this.a.style.backgroundColor="black";this.a.Ga();a=!0}this.L&&this.L.focus()}return a}; +function od(a,b,c,d){var e=8>=a.va?8:16,f=8>(7>4)*c)}return l}k.ca=function(a,b){return b||!a||this.restore(a)?!0:!1};k.ba=function(a){return!a||this.save()};k.save=function(){var a=new G(this);a.set(0,[]);return a.data()};k.restore=function(){return!0}; +k.Ga=function(){var a=!1;if(this.a){if(this.a.Ga){a="100%";if(screen&&screen.width&&screen.height){var b=screen.width/screen.height,c=this.A/this.s;b>c&&(a=Math.round(c/b*100)+"%")}this.Da?(this.o.style.width=a,this.o.style.width=a,this.o.style.display="block",this.o.style.margin="auto"):(this.a.style.width=a,this.a.style.height="auto");this.a.style.backgroundColor="black";this.a.Ga();a=!0}this.L&&this.L.focus()}return a}; function fd(a,b){!b&&a.a&&(a.Da?a.o.style.width=a.o.style.height="":a.a.style.width=a.a.style.height="")}function hd(a,b){a.Ka=b;a.N=!1;if(void 0===a.g||a.g.length!=a.Ka)a.g=Array(a.Ka)}function sd(a,b,c,d,e){d=a.b?(b.height-c-1)*b.width+d:c+d*b.width;e&&a.P==jd&&(208<=c&&236>c?e=a.O+kd:28<=c&&72>c&&(e=a.O+ld));a=a.I[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 Nb(a,b){var c=!0;if(!b){a.ha&&(120==a.ha?a.Ma&1?(kc(a.m,2),c=!1):kc(a.m,1):kc(a.m,4));if(c&&a.N&&a.v){for(var d=a.u,e=a.v,f=!0,g=a.ca>>>d.b;0>=1);;){var x=ab(a.u,v++);if((x&td)==td){var t=ab(a.u,v++),d=t&ud,c=(t&vd)<<8|ab(a.u,v),c=c+(t&wd?xd: -yd);break}if(n>4)*x.K,ca,ta,Ua,mb,Vc=x.M,Wb=x.K;E?(ca=K*t.M,ta=e*t.K,Ua=t.M,mb=t.K):(ca=K*t.wa,ta=e*t.xa,Ua=t.wa,mb=t.xa);x.M>t.M&&(ca*=2,Ua*=2);x.K>t.K&&(A==rd&&(S+=t.K),Wb=t.K);E?E.drawImage(x.canvas,Y,S,Vc,Wb,ca,ta,Ua,mb):(ca+=0,ta+=0,t.c.drawImage(x.canvas,Y,S,Vc,Wb, -ca,ta,Ua,mb))}h++}g++}e++}}a.N=!0;!b&&a.na&&1==h&&(a.g[l]=-1,h=0);a.na=!1;(h||b)&&a.ma&&a.c.drawImage(a.l,0,a.la,a.j,a.B-a.K,0,0,a.jb,a.Ob)}else{e=a.ca;f=e+a.v;l=h=g=0;b=a.j;n=0;c=a.B;A=d=0;v=a.da;K=(1<>>t.b;t=x!=t.f?t.a[Y].Jb(x,E):t.a[Y++].eb(x,E)|t.a[Y&t.o].eb(0,E+1)<<8;if(a.N&&t===a.g[g])h+=a.La;else{a.g[g]=t;(E=A)&&(t=t>>8|(t&255)<<8);h>E&K,sd(a,a.Fa,h++,l,Y),E+=v;h>n&&(n=h);l=d&&(d=l+1)}e+= +function Nb(a,b){var c=!0;if(!b){a.ha&&(120==a.ha?a.Ma&1?(kc(a.m,2),c=!1):kc(a.m,1):kc(a.m,4));if(c&&a.N&&a.v){for(var d=a.u,e=a.v,f=!0,g=a.da>>>d.b;0>=1);;){var x=ab(a.u,v++);if((x&td)==td){var t=ab(a.u,v++),d=t&ud,c=(t&vd)<<8|ab(a.u,v),c=c+(t&wd?xd: +yd);break}if(n>4)*x.K,ca,ta,Ta,lb,Vc=x.M,Wb=x.K;E?(ca=K*t.M,ta=e*t.K,Ta=t.M,lb=t.K):(ca=K*t.wa,ta=e*t.xa,Ta=t.wa,lb=t.xa);x.M>t.M&&(ca*=2,Ta*=2);x.K>t.K&&(A==rd&&(T+=t.K),Wb=t.K);E?E.drawImage(x.canvas,Y,T,Vc,Wb,ca,ta,Ta,lb):(ca+=0,ta+=0,t.c.drawImage(x.canvas,Y,T,Vc,Wb, +ca,ta,Ta,lb))}h++}g++}e++}}a.N=!0;!b&&a.na&&1==h&&(a.g[l]=-1,h=0);a.na=!1;(h||b)&&a.ma&&a.c.drawImage(a.l,0,a.la,a.j,a.B-a.K,0,0,a.jb,a.Ob)}else{e=a.da;f=e+a.v;l=h=g=0;b=a.j;n=0;c=a.B;A=d=0;v=a.ea;K=(1<>>t.b;t=x!=t.f?t.a[Y].Jb(x,E):t.a[Y++].eb(x,E)|t.a[Y&t.o].eb(0,E+1)<<8;if(a.N&&t===a.g[g])h+=a.La;else{a.g[g]=t;(E=A)&&(t=t>>8|(t&255)<<8);h>E&K,sd(a,a.Fa,h++,l,Y),E+=v;h>n&&(n=h);l=d&&(d=l+1)}e+= 2;g++;if(h>=a.j&&(h=0,l++,l>a.B))break}a.N=!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<=(window?window.navigator.userAgent:"").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||Ea("aspect"));f&&.3<=f&&3.33>=f&&(Ga("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");Da("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var g=e.getContext("2d"),d=new cd(d,e,g,f,c);ja(d,c)}}); @@ -168,24 +169,24 @@ function zd(a){q.call(this,"SerialPort",a);this.H=+a.adapter;switch(this.H){case k=zd.prototype; k.S=function(a,b,c,d){var e=this;switch(b){case Ad:return this.w[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");if(2==c.length){var d=ua(c[0]);if(d!=this.Wa)return;c=ua(c[1]);if(this.a=ha(c)){var e=this.a.exports;if(e){var f=e.connect;f&&f.call(this.a,this.l);if(this.Ba=e.receiveData){this.l=a;this.s=e.receiveStatus;this.status(this.Ia+"."+d+" connected to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; -k.ba=function(a,b){if(!b)if(this.Fb(this.l),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.fa=function(a){return a?this.save():!0};k.reset=function(){Ed(this)};k.save=function(){var a=new G(this),b=0,c=[];c[b++]=this.o;c[b++]=this.A;c[b++]=this.C;c[b++]=this.T;c[b++]=this.h;c[b++]=this.j;c[b]=this.v;a.set(0,c);return a.data()};k.restore=function(a){return Ed(this,a[0])}; +k.Fb=function(a){if(!this.a){var b=yb(this.F,"connection");if(b){var c=b.split("->");if(2==c.length){var d=ua(c[0]);if(d!=this.Wa)return;c=ua(c[1]);if(this.a=ha(c)){var e=this.a.exports;if(e){var f=e.connect;f&&f.call(this.a,this.l);if(this.Ba=e.receiveData){this.l=a;this.s=e.receiveStatus;this.status("Connected "+this.Ia+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; +k.ca=function(a,b){if(!b)if(this.Fb(this.l),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.ba=function(a){return a?this.save():!0};k.reset=function(){Ed(this)};k.save=function(){var a=new G(this),b=0,c=[];c[b++]=this.o;c[b++]=this.A;c[b++]=this.C;c[b++]=this.T;c[b++]=this.h;c[b++]=this.j;c[b]=this.v;a.set(0,c);return a.data()};k.restore=function(a){return Ed(this,a[0])}; function Ed(a,b){var c=0;b||(b=Fd);a.o=b[c++];a.A=b[c++];a.C=b[c++];a.T=b[c++];a.h=b[c++];a.j=b[c++];a.v=b[c];return!0}function Gd(a,b){var c=a.v&b;b&15||(c>>=4);b=Hd[c];c=((a.h&Id)>>2)+6;a.h&Jd&&c++;c+=((a.h&Kd)>>6)+1>>1;return 1E3/Math.round(b/c)}function Bd(a,b){return a.B||a.T&Ld?!1:(a.A=b,a.T|=Ld,kc(a.m,a.O),!0)} k.mb=function(a){null!=a&&(this.g="number"!=typeof a?a:this.g+String.fromCharCode(a));this.g&&(Bd(this,this.g.charCodeAt(0))&&(this.g=this.g.substr(1)),this.g&&this.m&&Jb(this.m,this.P,Gd(this,Md)));return!0};k.yd=function(a){this.T&=~Nd;a&64&&(this.T|=Nd)};function Mc(a,b){a.T=a.T|rc|Od;b&&a.Ba&&a.Ba.call(a.a,b)}k.Vc=function(){var a=this.A;this.T&=~Ld;return a};k.Uc=function(){return this.T}; k.dd=function(a,b){this.C=b;this.T&=~(rc|Od);if(19==b)this.B=!0;else if(17==b)this.B=!1;else if(this.Ba&&this.Ba.call(this.a,b),this.b)if(8==b)this.b.value=this.b.value.slice(0,-1),0":String.fromCharCode(b);c=a.length;9==b?(b=this.L||8,c=b-this.f%b,this.L&&(a=" ".slice(0,c))):13==b&&(this.f=c=0,a="\n");this.D&&!this.f&&c&&(a=String.fromCharCode(this.D)+a);this.b.value+=a;this.b.scrollTop=this.b.scrollHeight; this.f+=c}else if(null!=this.c){if(10==b||1024<=this.c.length)this.aa(this.c),this.c="";10!=b&&(this.c+=String.fromCharCode(b))}this.m&&Jb(this.m,this.R,Gd(this,Pd))};k.cd=function(a,b){this.o?(this.s&&(b^this.j)&(Qd|Rd)&&(a=0,this.l?(a|=b&Qd?32:0,a|=b&Rd?320:0):(a|=b&Qd?16:0,a|=b&Rd?1048576:0),this.s.call(this.a,a)),this.j=b,this.j&Sd&&(this.o=!1)):(this.h=b,this.o=!0)};k.bd=function(a,b){this.v=b}; var Id=12,Jd=16,Kd=192,Rd=2,Qd=32,Sd=64,rc=1,Ld=2,Od=4,Nd=128,Md=15,Pd=240,Hd=[50,75,110,134.5,150,200,300,600,1200,1800,2E3,2400,3600,4800,9600,19200],Fd=[!1,0,0,133,142,39,238],Ad="buffer",Cd={0:zd.prototype.Vc,1:zd.prototype.Uc},Dd={0:zd.prototype.dd,1:zd.prototype.cd,2:zd.prototype.bd};Ha(function(){for(var a=y(document,"pc8080","serial"),b=0;b\nLicense: GPL version 3 or later ");for(b=0;bVd){if(Xd(d,this.o)){this.f=new G(this,"1.32.2",fe);Xd(this.f)&&(ge(this,d),a=he,ie(this.f));this.f.set(ce,wa());je(this.f);var e=this.a&&!this.j;if(a==de||fa("Click OK to restore the previous PC8080 machine state, or CANCEL to reset the machine.")){if(c=be(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Xd(d,g):("error"==f&&"no machine state"!= g?(this.G("Error: "+g),"unable to verify user"==g&&(Ca(ke,""),this.b=null)):this.aa(f+": "+g),ie(d),Xd(d)?(c=be(d),e=!0):c=!1))}e&&$d(this,c?d:null)}else a==he&&d.clear()}else $d(this);delete this.o;delete this.s}e=ga(this.id);for(f=0;fa[1];a=a[2];this.N=!0;this.i.U=!0;var d=this.w.power;d&&(d.textContent="Shutdown");this.m&&(le(this,this.m,b,c,a),this.m.Qa());this.B&&(ge(this,b),b.clear());!c&&this.f&&(this.f.clear(),delete this.f);this.c=0}; function ge(a,b){if(fa("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.b||"";b=b.toString();var d={app:"PC8080",ver:"1.32.2"};d.url=a.I;d.user=c;d.type="bug";d.data=b;xa("http://www.pcjs.org/api/v1/report",d,!0)}} -function me(a,b,c){var d,e="none";if(a.c)return null;a.c--;var f=new G(a,"1.32.2"),g=new G(a,"1.32.2",ae),h=wa();g.set(ce,h);f.set(ce,h);f.set(ne,"1.32.2");f.set(oe,window?window.location.href:null);f.set(pe,window?window.navigator.userAgent:"");a.m&&a.m.fa&&(c&&Cb(a.m),d=a.m.fa(b,c),"object"===typeof d&&f.set(a.m.id,d),c&&(a.m.i.U=!1,!1===d&&(e=null)));for(var h=ga(a.id),l=0;l=b)a.preventDefault&&a.preventDefault(),64");if(2==c.length){var d=qa(c[0]);if(d!=this.xd)return;c=qa(c[1]);if(this.L=lb(c)){var e=this.L.exports;if(e){var f=e.connect;f&&f.call(this.L,this.pa);if(this.ua=e.receiveData){this.pa=a;this.Cc=e.receiveStatus;this.status(this.ce+"."+d+" connected to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; +l.zj=function(a){if(!this.L){var b=Vc(this.X,"connection");if(b){var c=b.split("->");if(2==c.length){var d=qa(c[0]);if(d!=this.xd)return;c=qa(c[1]);if(this.L=lb(c)){var e=this.L.exports;if(e){var f=e.connect;f&&f.call(this.L,this.pa);if(this.ua=e.receiveData){this.pa=a;this.Cc=e.receiveStatus;this.status("Connected "+this.ce+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; l.hc=function(a,b){if(!b)if(this.zj(this.pa),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};l.gc=function(a){return a?this.save():!0};l.reset=function(){Bo(this)};l.save=function(){var a=new nf(this),b=0,c=[];c[b++]=this.ya;c[b++]=this.Da;c[b++]=this.fa;c[b++]=this.ka;c[b++]=this.U;c[b++]=this.C;c[b++]=this.ra;c[b++]=this.B;c[b++]=this.A;c[b]=this.aa;a.set(0,c);return a.data()};l.restore=function(a){return Bo(this,a[0])}; function Bo(a,b){var c=0;b||(b=[0,0,384,0,1,0,0,96,a.Ja,[]]);a.ya=b[c++];a.Da=b[c++];a.fa=b[c++];a.ka=b[c++];a.U=b[c++];a.C=b[c++];a.ra=b[c++];a.B=b[c++];a.A=b[c++];a.aa=b[c];return!0}l.hg=function(a){if("number"==typeof a)this.aa.push(a);else if("string"==typeof a)for(var b=0;b>8:this.ka;x(this,a,null,b,this.C&128?"DLM":"IER",c);return c};l.rm=function(a,b){var c=this.U;x(this,a,null,b,"IIR",c);return c};l.sm=function(a,b){var c=this.C;x(this,a,null,b,"LCR",c);return c};l.um=function(a,b){var c=this.ra;x(this,a,null,b,"MCR",c);return c}; @@ -654,7 +654,7 @@ l.Pb=function(a,b,c){var d=this;switch(b){case "listDisks":this.qa[b]=c;if(this. void 0===b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}};return!0;case "descDisk":case "listDrives":return this.qa[b]=c,c.onchange=function(){var a=ea(c.value,10);null!=a&&xp(d,a)},!0;case "loadDisk":return this.qa[b]=c,c.onclick=function(){var a=d.qa.listDisks;a&&yp(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDisk":if(!this.ia){c.parentNode.removeChild(c);break}this.qa[b]=c;c.onclick=function(){var a=d.qa.listDrives;a&&a.options&&d.A&&((a= d.A[ea(a.value,10)||0])?(a=a.za)?(a=Qa(tp(a),"octet-stream",!0,a.Ug.replace(".json",".img")),w(a)):d.Na("No diskette loaded in drive."):d.Na("No diskette drive selected."))};return!0;case "mountDisk":if(this.ia)return this.qa[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;yp(d,ja(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; l.Jc=function(a,b,c,d){this.ga=b;this.F=c;this.ha=d;this.X=a;this.N=Gb(a,"ChipSet");if((this.U=Vc(this.X,"autoMount")||this.U)&&"string"==typeof this.U)try{this.U=eval("("+this.U+")")}catch(e){w("FDC auto-mount error: "+e.message+" ("+this.U+")"),this.U=null}zp(this);nc(b,this,Ap);rc(b,this,Bp);Cp(this,"None","",!0);this.ia&&Cp(this,"Local Disk","?");Cp(this,"Remote Disk","??");Dp(this)||ub(this)}; -l.hc=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.X.lh){this.B=[];for(a=0;ak.za.restore(g)&&(A=!1),A&&void 0!==k.eb&&(k.pb=k.za.seek(k.be,k.kb,k.xb+k.sg)));A||(e=!1);null!=a.pa&& diff --git a/versions/pcx86/1.32.2/pcx86.js b/versions/pcx86/1.32.2/pcx86.js index 9bfd2ee60..8bbd80e10 100644 --- a/versions/pcx86/1.32.2/pcx86.js +++ b/versions/pcx86/1.32.2/pcx86.js @@ -562,7 +562,7 @@ l.gm=function(a,b){this.Me=b;Ml(this)};function Ml(a){a.S&&a.D&&(a.Me&16&&!(a.Db function Nl(a){this.oa=a.adapter;switch(this.oa){case 1:this.ka=1016;this.W=4;break;case 2:this.ka=760;this.W=3;break;default:r("Unrecognized serial adapter #"+this.oa);return}this.G=this.I=null;this.ra=a.tabSize;this.qa=a.charBOL;this.R=0;this.sa=Ol|Pl;this.Z=!0;Ma.call(this,"SerialPort",a,Nl);a=a.binding;"console"==a?this.I="":Xa(this,a,Ql);this.D=this.ga=this.Rc=null;this.exports={connect:this.wi,receiveData:this.jf,receiveStatus:this.$j}}Pa(Nl);var Ql="buffer",Ol=16,Pl=32;l=Nl.prototype; l.fi=function(a,b,c){var d=null;a!=this.Td||this.D||(this.D=b,this.Rc=c,this.Z=!1,d=this);return d};l.zb=function(a,b,c){var d=this;switch(b){case Ql:return this.la[b]=this.G=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64");if(2==c.length){var d=la(c[0]);if(d!=this.Td)return;c=la(c[1]);if(this.D=Ua(c)){var e=this.D.exports;if(e){var f=e.connect;f&&f.call(this.D,this.Z);if(this.ga=e.receiveData){this.Z=a;this.Rc=e.receiveStatus;this.status(this.Fe+"."+d+" connected to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; +l.wi=function(a){if(!this.D){var b=kc(this.ba,"connection");if(b){var c=b.split("->");if(2==c.length){var d=la(c[0]);if(d!=this.Td)return;c=la(c[1]);if(this.D=Ua(c)){var e=this.D.exports;if(e){var f=e.connect;f&&f.call(this.D,this.Z);if(this.ga=e.receiveData){this.Z=a;this.Rc=e.receiveStatus;this.status("Connected "+this.Fe+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; l.Ub=function(a,b){if(!b)if(this.wi(this.Z),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};l.Tb=function(a){return a?this.save():!0};l.reset=function(){Tl(this)};l.save=function(){var a=new ae(this),b=0,c=[];c[b++]=this.ma;c[b++]=this.pa;c[b++]=this.P;c[b++]=this.Y;c[b++]=this.H;c[b++]=this.L;c[b++]=this.da;c[b++]=this.C;c[b++]=this.B;c[b]=this.K;a.set(0,c);return a.data()};l.restore=function(a){return Tl(this,a[0])}; function Tl(a,b){var c=0;b||(b=[0,0,384,0,1,0,0,96,a.sa,[]]);a.ma=b[c++];a.pa=b[c++];a.P=b[c++];a.Y=b[c++];a.H=b[c++];a.L=b[c++];a.da=b[c++];a.C=b[c++];a.B=b[c++];a.K=b[c];return!0}l.jf=function(a){if("number"==typeof a)this.K.push(a);else if("string"==typeof a)for(var b=0;b>8:this.Y};l.cl=function(){return this.H};l.dl=function(){return this.L};l.fl=function(){return this.da};l.el=function(){return this.C};l.kl=function(){var a=this.B;this.B&=-4;return a}; @@ -603,7 +603,7 @@ l.zb=function(a,b,c){var d=this;switch(b){case "listDisks":this.la[b]=c;if(this. b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}};return!0;case "descDisk":case "listDrives":return this.la[b]=c,c.onchange=function(){var a=ea(c.value,10);null!=a&&vm(d,a)},!0;case "loadDisk":return this.la[b]=c,c.onclick=function(){var a=d.la.listDisks;a&&wm(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDisk":if(!this.Y){c.parentNode.removeChild(c);break}this.la[b]=c;c.onclick=function(){var a=d.la.listDrives;a&&a.options&&d.B&&((a=d.B[ea(a.value, 10)||0])?(a=a.ua)?(a=Ca(rm(a),"octet-stream",!0,a.th.replace(".json",".img")),r(a)):d.Ba("No diskette loaded in drive."):d.Ba("No diskette drive selected."))};return!0;case "mountDisk":if(this.Y)return this.la[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;wm(d,ga(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; l.pc=function(a,b,c,d){this.ia=b;this.A=c;this.Ia=d;this.ba=a;this.S=jb(a,"ChipSet");if((this.K=kc(this.ba,"autoMount")||this.K)&&"string"==typeof this.K)try{this.K=eval("("+this.K+")")}catch(e){r("FDC auto-mount error: "+e.message+" ("+this.K+")"),this.K=null}xm(this);Pb(b,this,ym);Rb(b,this,zm);Am(this,"None","",!0);this.Y&&Am(this,"Local Disk","?");Am(this,"Remote Disk","??");Bm(this)||t(this)}; -l.Ub=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.ba.pg){this.C=[];for(a=0;ak.ua.restore(g)&&(z=!1),z&&void 0!==k.Ua&&(k.Wa=k.ua.seek(k.Id,k.Ya,k.mb+k.yf)));z||(e=!1);null!=a.da&&1>=d&& diff --git a/versions/pdpjs/1.32.2/pdp11-dbg.js b/versions/pdpjs/1.32.2/pdp11-dbg.js index 09e3c30e3..12860f91b 100644 --- a/versions/pdpjs/1.32.2/pdp11-dbg.js +++ b/versions/pdpjs/1.32.2/pdp11-dbg.js @@ -15,6 +15,7 @@ http://pcjs.org/modules/pdp11/lib/keyboard.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/pc11.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/rk11.js (C) Jeff Parsons 2012-2017 + http://pcjs.org/modules/pdp11/lib/rl11.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/computer.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/state.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/embed.js (C) Jeff Parsons 2012-2017 @@ -28,347 +29,347 @@ http://pcjs.org/modules/pdp11/lib/cpuops.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/serial.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/disk.js (C) Jeff Parsons 2012-2017 - http://pcjs.org/modules/pdp11/lib/rl11.js (C) Jeff Parsons 2012-2017 + http://pcjs.org/modules/pdp11/lib/drive.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/debugger.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/debugger.js (C) Jeff Parsons 2012-2017 */ var h,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this;function ca(){ca=function(){};ba.Symbol||(ba.Symbol=da)}var ea=0;function da(a){return"jscomp_symbol_"+(a||"")+ea++} -function fa(){ca();var a=ba.Symbol.iterator;a||(a=ba.Symbol.iterator=ba.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ha(this)}});fa=function(){}}function ha(a){var b=0;return ia(function(){return b":62,"?":63,"@":64,Ic:65,qg:66,sg:67,Pg:68,E:69,Qg:70,Rg:71,Sg:72,Tg:73,Ug:74,Vg:75,Wg:76,Xg:77,Yg:78,Zg:79,$g:80,Q:81,ah:82,bh:83,dh:84,eh:85,fh:86,gh:87,hh:88,ih:89,Gd:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,jh:97,kh:98,lh:99,d:100,e:101,nh:102,oh:103,ph:104,qh:105,th:106,k:107,uh:108,vh:109,n:110,wh:111,p:112,q:113,r:114,xh:115,t:116,zh:117,Ah:118,Bh:119,x:120,y:121,z:122,"{":123, -"|":124,"}":125,"~":126,xd:127};function q(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Rc=b.comment;this.Fd=b;this.exports={};this.B=this.bindings={};a=this.id.indexOf(".");0>a?this.lb=this.id:(this.mb=this.id.substr(0,a),this.lb=this.id.substr(a+1));this.A={ready:!1,eb:!1,zc:!1,fa:!1,error:!1};this.dc=null;this.A.error=!1;this.ha=d||0;this.F=this.f=this.D=this.J=this.Pa=null;ta.push(this)}function ua(a,b,c){va[a]&&b&&(va[a][b]=c)} -function xa(){return Date.now()||+new Date}function v(a){window&&window.alert(a)}function ya(a){var b=!1;window&&(b=window.confirm(a));return b}function za(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b":62,"?":63,"@":64,nd:65,Fh:66,Ih:67,gi:68,E:69,mi:70,oi:71,Bi:72,Di:73,Ei:74,Fi:75,Gi:76,Ji:77,Li:78,Ni:79,Qi:80,Q:81,Si:82,Ui:83,bj:84,dj:85,fj:86,gj:87,kj:88,lj:89,Xe:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,mj:97,nj:98,qj:99,d:100,e:101,rj:102,sj:103,tj:104,uj:105,yj:106,k:107,zj:108,Aj:109,n:110,Bj:111,p:112,q:113,r:114,Cj:115,t:116,Fj:117,Gj:118,Hj:119,x:120,y:121,z:122,"{":123, +"|":124,"}":125,"~":126,oe:127};function q(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Cd=b.comment;this.Ue=b;this.exports={};this.H=this.bindings={};a=this.id.indexOf(".");0>a?this.Eb=this.id:(this.pb=this.id.substr(0,a),this.Eb=this.id.substr(a+1));this.A={ready:!1,jb:!1,$c:!1,Z:!1,error:!1};this.yc=null;this.A.error=!1;this.fa=c||0;this.F=this.f=this.C=this.K=this.Qa=null;ua.push(this)}function va(a,b,c){xa[a]&&b&&(xa[a][b]=c)} +function ya(){return Date.now()||+new Date}function v(a){window&&window.alert(a)}function za(a){var b=!1;window&&(b=window.confirm(a));return b}function Aa(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>=1,f--;return d}function H(a,b,c){var d="";b?11>=3;return(c?"0o":"")+d} -function Na(a){var b=2,c="";b?10=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function Oa(a){return I(a,4,!0)} -function Pa(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0"']/g,function(a){return Wa[a]})}function Xa(a,b){return(a+" ").slice(0,b)} -function Ya(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var Wa={"&":"&","<":"<",">":">",'"':""","'":"'"},Za={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"}; -function $a(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a>1,k;k=c(b,a[g]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} -function bb(a,b,c,d){c=void 0===c?!1:c;var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a, +function La(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0>=1,f--;return d}function E(a,b,c){var d="";b?11>=3;return(c?"0o":"")+d} +function Ra(a){var b=2,c="";b?10=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function Sa(a){return F(a,4,!0)} +function Ta(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0"']/g,function(a){return Xa[a]})}function Ya(a,b){return(a+" ").slice(0,b)} +function Za(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var Xa={"&":"&","<":"<",">":">",'"':""","'":"'"},$a={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"}; +function ab(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a>1,k;k=c(b,a[g]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} +function fb(a,b,c,d){c=void 0===c?!1:c;var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a, f,e))});if(b&&"object"==typeof b){var l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");k.open("POST",a,c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(l)}else k.open("GET",a,c),"bytes"==b&&k.overrideMimeType("text/plain; charset=x-user-defined"),k.send();c||(f=k.responseText,200!=k.status&&(e=k.status||-1),d&&d(a,f,e),g=[f,e]);return g} -function cb(a,b){var c,d={ca:null,ea:null,wa:null,va:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.wa=g.load;d.va=g.exec;if(e=g.bytes)d.ca=e;else if(e=g.words)for(d.ca=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.ca=Array(4*e.length),f=c=0;c>8&255,d.ca[f++]=e[c]>>16&255,d.ca[f++]=e[c]>>24&255;else d.ca=g;d.ea=g.symbols;d.ca.length?1==d.ca.length&&(v(d.ca[0]),d=null):(v("Empty resource: "+a),d=null)}catch(k){v("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;ca;a++)this.b["S"+a]=[0,0,!1,!1,this.Zd,a];this.F=this.f=this.D=this.J=null;A(this)}p(Sb,q);h=Sb.prototype;h.reset=function(){this.stop()}; -h.pa=function(a,b,c,d){if(this.J&&this.J.pa(a,b,c,d)||this.f&&this.f.pa(a,b,c,d)||this.F&&this.F.pa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.B[b]=c,this.v++,!0;default:return"led"==a||"rled"==a?(this.B[b]=c,this.g[b]=d?1:0,this.v++,!0):"switch"==a?(void 0===this.b[b]&&(this.b[b]=[d?1:0,d?1:0]),this.B[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a, -b){return function(){Ub(a,b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){Vb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){Ub(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){Vb(a,b)}}(this,b),!0):q.prototype.pa.call(this,a,b,c,d)}};h.ta=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.F=d;Wb(b,this,Xb);Yb(b,this.reset.bind(this));Zb(this);$b(this)};h.za=function(a,b){b||(this.I&&ac(),this.reset());return!0};h.ya=function(){return!0}; -function bc(a,b,c){if(a=a.B[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function Zb(a,b){for(var c in a.g)bc(a,c,null!=b?b:a.g[c])}function cc(a,b,c){if(a=a.B[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function $b(a){for(var b in a.b)cc(a,b,a.b[b][1])}function dc(a,b,c,d){a.B[b]&&(void 0===c&&(Da(a,"Value for "+b+" is invalid"),a.f.Z()),c=8==(a.F&&a.F.xa||8)?H(c,d):I(c,d),a.B[b].textContent!=c&&(a.B[b].textContent=c))} -function Ub(a,b){var c=a.b[b];cc(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);b!=ec&&(a.C=b==fc,a.G=b==gc)}function Vb(a,b){var c=a.b[b];c[2]&&c[3]&&(cc(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.Xd=function(a){a||this.f.A.U||(a=this.f,a.D.reset(),hc(a),this.b[ic]&&this.b[ic][1]&&jc(this.f))};h.Yd=function(){};h.Td=function(a){a||this.f.Z()}; -h.Rd=function(a){if(!a&&!this.f.A.U)if(this.b[ic]&&this.b[ic][1])jc(this.f);else{if((a=this.F)&&!Ka(a,!0))La(a,!0),kc(a,0,null),La(a,!1);else try{var b=this.f.bc(1);0=a.f.ba?8:16,c=65472<=a.ua&&a.ua<65472+b,b=c?1:2,c=c?15:a.D.I;a.b[ec]&&a.b[ec][1]||(b=-b);Fc(a,a.ua&~c|a.ua+b&c)} -function Fc(a,b){a.ua=b&a.D.I;b=a.ua;for(var c=0;22>c;c++)Hc(a,"A"+c,b&1<c;c++)Hc(a,"D"+c,b&1<c;c++)a.b["S"+c][1]=b&1<>2;this.i=this.j-1;this.H=this.M/this.j|0;this.T=this.H-1;this.Ma=[];this.ja=0;this.G=!1;this.N=[];this.Hd=[Nc,Oc,Pc,Qc];this.b=this.v=[];this.C=this.L=this.w=this.P=this.R=0;a=new L(this);Rc(a,this.F);this.b=Array(this.H);this.v=Array(this.H);for(b=0;b>>this.g;this.L=0;this.w=this.I;A(this)}p(Lc,q);function Uc(a,b){if(b!=a.L){for(var c=0;c>>a.g,a.v[a.R]=a.b[a.P])}}h=Lc.prototype;h.reset=function(){for(var a=0;a>>a.g;0g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.K)return l.Jb+=l.K-f,l.K=f,!0;if(f>=l.K+l.Jb){n=l.size-(f-m);n>g&&(n=g);l.Jb=f-l.K+n;f=m+a.j;g-=n;k++;continue}}return Wc(Xc,f,g)}f=new L(a,f,n,a.j,d,e);Rc(f,a.F,l);a.b[k++]=f;f=m+a.j;g-=n}return 0>=g?(a.status((c>>10)+"Kb "+Yc[d]+" at "+H(b)),!0):Wc(Zc,b,c)}h.Jc=function(a){return this.v[(a&this.w)>>>this.g].ub(a&this.i,a)}; -h.ac=function(a){var b=a&this.i,c=(a&this.w)>>>this.g;return Ob||b!=this.i?this.v[c].ka(b,a):this.v[c++].ub(b,a)|this.v[c&this.T].ub(0,a+1)<<8};h.Kc=function(a,b){this.v[(a&this.w)>>>this.g].wb(a&this.i,b,a)};h.Nb=function(a,b){var c=a&this.i,d=(a&this.w)>>>this.g;Ob||c!=this.i?this.v[d].xb(c,b,a):(this.v[d++].wb(c,b&255,a),this.v[d&this.T].wb(0,b>>8&255,a+1))};function $c(a,b){return a.b[(b&a.I)>>>a.g]} -function Dc(a,b){var c;a.G=!1;a.ja++;var d=b&a.i,e=$c(a,b);Ob||d!=a.i?c=e.C(d,b):c=e.j(d,b)|$c(a,b+1).j(0,b+1)<<8;a.ja--;return c}function ad(a,b,c){a.G=!1;a.ja++;$c(a,b).D(b&a.i,c&255,b);a.ja--}function qc(a,b,c){a.G=!1;a.ja++;var d=b&a.i,e=$c(a,b);Ob||d!=a.i?e.G(d,c&65535,b):(e.D(d,c&255,b),$c(a,b+1).D(0,c>>8&255,b+1));a.ja--} -function Vc(a){for(var b=0,c=[],d=0;da.f.ba)){var k=g[0]?g[0].bind(b):null,l=g[1]?g[1].bind(b):null,m=g[2]?g[2].bind(b):null,n=g[3]?g[3].bind(b):null;65472<=f&&65487>=f&&(!k&&m&&(k=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!l&&n&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));for(var r=g[4],u=g[5]||1,t=0;t>8:e[2](f)&255):f&1&&(e=d.Ma[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return this.f&&B(this.f,16|e[5])&&C(this.f,e[4]+".readByte("+O(this.f,b)+"): "+O(this.f,c),!0,!d.ja),c;d.La(b,16,3);c=255;this.f&&B(this.f,16)&&C(this.f,"warning: unconverted read access to byte @"+O(this.f,b)+": "+O(this.f,c),!0,!d.ja);return c} -function Oc(a,b,c){var d=!1,e=this.controller,f=e.Ma[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Ma[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d?this.f&&B(this.f,16|f[5])&&C(this.f,f[4]+".writeByte("+O(this.f,c)+","+O(this.f,b)+")",!0,!e.ja):(e.La(c,16,5),this.f&&B(this.f,16)&&C(this.f,"warning: unconverted write access to byte @"+O(this.f,c)+": "+O(this.f, -b),!0,!e.ja))}function Pc(a,b){var c=-1,d=this.controller;a=d.Ma[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return this.f&&B(this.f,16|a[5])&&C(this.f,a[4]+".readWord("+O(this.f,b)+"): "+O(this.f,c),!0,!d.ja),c;d.La(b,16,2);c=65535;this.f&&B(this.f,16)&&C(this.f,"warning: unconverted read access to word @"+O(this.f,b)+": "+O(this.f,c),!0,!d.ja);return c} -function Qc(a,b,c){var d=!1,e=this.controller;a=e.Ma[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d?this.f&&B(this.f,16|a[5])&&C(this.f,a[4]+".writeWord("+O(this.f,c)+","+O(this.f,b)+")",!0,!e.ja):(e.La(c,16,4),this.f&&B(this.f,16)&&C(this.f,"warning: unconverted write access to word @"+O(this.f,c)+": "+O(this.f,b),!0,!e.ja))}function P(a){q.call(this,"Device",a,0,256);this.b={mh:0,Gc:-1}}p(P,q);h=P.prototype; -h.ta=function(a,b,c,d){this.D=b;this.J=a;this.f=c;this.F=d;var e=this;this.b.Gc=gd(c,function(){e.b.Gb|=128;e.b.Gb&64&&hd(e.f,e.b.gb);e.J&&J(e.J,1);id(e.f,e.b.Gc,1E3/60)});this.b.gb=jd(c,64,6,524288);Wb(b,this,kd);Yb(b,this.reset.bind(this));d&&ld(d,64,function(a){var b=e.f;md(e,"KIPDR",b.C[0],0,a[0]);md(e,"KDPDR",b.C[0],8,a[0]);md(e,"KIPAR",b.M[0],0,a[0]);md(e,"KDPAR",b.M[0],8,a[0],!0);md(e,"SIPDR",b.C[1],0,a[0]);md(e,"SDPDR",b.C[1],8,a[0]);md(e,"SIPAR",b.M[1],0,a[0]);md(e,"SDPAR",b.M[1],8,a[0], -!0);md(e,"UIPDR",b.C[3],0,a[0]);md(e,"UDPDR",b.C[3],8,a[0]);md(e,"UIPAR",b.M[3],0,a[0]);md(e,"UDPAR",b.M[3],8,a[0],!0);b.T&32&&md(e,"UNIMAP",b.Ea,-1,a[0])});A(this)};function md(a,b,c,d,e,f){a=a.F;if(!(e&&0>b.indexOf(e.toUpperCase()))){e=8;var g="",k=!1,l=0,m=8;0>d&&(e=c.length,d=0,k=!0,l=3,m=4);for(var n=0;n>1&63;var b=this.f.Ea[a>>1];return a&1?b>>16:b&65535};h.hg=function(a,b){b=b>>1&63;var c=b>>1;this.f.Ea[c]=b&1?this.f.Ea[c]&65535|(a&63)<<16:this.f.Ea[c]&-65536|a&65534}; -h.Qe=function(a){return this.f.C[1][a>>1&7]};h.ag=function(a,b){this.f.C[1][b>>1&7]=a&65295};h.Oe=function(a){return this.f.C[1][(a>>1&7)+8]};h.Zf=function(a,b){this.f.C[1][(b>>1&7)+8]=a&65295};h.Pe=function(a){return this.f.M[1][a>>1&7]};h.$f=function(a,b){b=b>>1&7;this.f.M[1][b]=a;this.f.C[1][b]&=65295};h.Ne=function(a){return this.f.M[1][(a>>1&7)+8]};h.Yf=function(a,b){b=(b>>1&7)+8;this.f.M[1][b]=a;this.f.C[1][b]&=65295};h.je=function(a){return this.f.C[0][a>>1&7]}; -h.wf=function(a,b){this.f.C[0][b>>1&7]=a&65295};h.he=function(a){return this.f.C[0][(a>>1&7)+8]};h.uf=function(a,b){this.f.C[0][(b>>1&7)+8]=a&65295};h.ie=function(a){return this.f.M[0][a>>1&7]};h.vf=function(a,b){b=b>>1&7;this.f.M[0][b]=a;this.f.C[0][b]&=65295};h.ge=function(a){return this.f.M[0][(a>>1&7)+8]};h.tf=function(a,b){b=(b>>1&7)+8;this.f.M[0][b]=a;this.f.C[0][b]&=65295};h.We=function(a){return this.f.C[3][a>>1&7]};h.gg=function(a,b){this.f.C[3][b>>1&7]=a&65295}; -h.Ue=function(a){return this.f.C[3][(a>>1&7)+8]};h.eg=function(a,b){this.f.C[3][(b>>1&7)+8]=a&65295};h.Ve=function(a){return this.f.M[3][a>>1&7]};h.fg=function(a,b){b=b>>1&7;this.f.M[3][b]=a;this.f.C[3][b]&=65295};h.Te=function(a){return this.f.M[3][(a>>1&7)+8]};h.dg=function(a,b){b=(b>>1&7)+8;this.f.M[3][b]=a;this.f.C[3][b]&=65295};h.Hb=function(a){a&=7;return this.f.w&2048?this.f.na[a]:this.f.g[a]};h.Lb=function(a,b){b&=7;this.f.w&2048?this.f.na[b]=a:this.f.g[b]=a}; -h.ue=function(){return this.f.w&49152?this.f.V[0]:this.f.g[6]};h.Ff=function(a){this.f.w&49152?this.f.V[0]=a:this.f.g[6]=a};h.xe=function(){return this.f.g[7]};h.If=function(a){this.f.g[7]=a};h.Ib=function(a){a&=7;return this.f.w&2048?this.f.g[a]:this.f.na[a]};h.Mb=function(a,b){b&=7;this.f.w&2048?this.f.g[b]=a:this.f.na[b]=a};h.ve=function(){return 1==(this.f.w&49152)>>14?this.f.g[6]:this.f.V[1]};h.Gf=function(a){1==(this.f.w&49152)>>14?this.f.g[6]=a:this.f.V[1]=a}; -h.we=function(){return 3==(this.f.w&49152)>>14?this.f.g[6]:this.f.V[3]};h.Hf=function(a){3==(this.f.w&49152)>>14?this.f.g[6]=a:this.f.V[3]=a};h.fe=function(a){return this.f.Zb[a-65504>>1]};h.sf=function(a,b){this.f.Zb[b-65504>>1]=a};h.nd=function(a){return 65520==a?(bd(this.D)>>6)-1:0};h.sd=function(){};h.Se=function(){return 1};h.cg=function(){};h.ee=function(){return this.f.R};h.rf=function(){this.f.R=0};h.le=function(){return this.f.Yb};h.yf=function(a,b){b&1||(a&=255);this.f.Yb=a}; -h.qe=function(a,b){return b?0:this.f.Va};h.Bf=function(a){td(this.f,a)};h.Re=function(a,b){return b?0:this.f.sa&65280};h.bg=function(a){this.f.sa=a|255};h.te=function(){return ud(this.f)};h.Ef=function(a){vd(this.f,a)};h.rd=function(a,b){B(this)&&C(this,"writeIgnored("+H(b)+"): "+H(a),!0,!0)}; -var Q={},kd=(Q[61568]=[null,null,P.prototype.Xe,P.prototype.hg,"UNIMAP",64,1170],Q[62592]=[null,null,P.prototype.Qe,P.prototype.ag,"SIPDR",8,1145,64],Q[62608]=[null,null,P.prototype.Oe,P.prototype.Zf,"SDPDR",8,1145,64],Q[62624]=[null,null,P.prototype.Pe,P.prototype.$f,"SIPAR",8,1145,64],Q[62640]=[null,null,P.prototype.Ne,P.prototype.Yf,"SDPAR",8,1145,64],Q[62656]=[null,null,P.prototype.je,P.prototype.wf,"KIPDR",8,1140,64],Q[62672]=[null,null,P.prototype.he,P.prototype.uf,"KDPDR",8,1145,64],Q[62688]= -[null,null,P.prototype.ie,P.prototype.vf,"KIPAR",8,1140,64],Q[62704]=[null,null,P.prototype.ge,P.prototype.tf,"KDPAR",8,1145,64],Q[62798]=[null,null,P.prototype.pe,P.prototype.Af,"MMR3",1,1145,64],Q[65382]=[null,null,P.prototype.ke,P.prototype.xf,"LKS"],Q[65402]=[null,null,P.prototype.me,P.prototype.zf,"MMR0",1,1140,64],Q[65404]=[null,null,P.prototype.ne,P.prototype.rd,"MMR1",1,1145,64],Q[65406]=[null,null,P.prototype.oe,P.prototype.rd,"MMR2",1,1140,64],Q[65408]=[null,null,P.prototype.We,P.prototype.gg, -"UIPDR",8,1140,64],Q[65424]=[null,null,P.prototype.Ue,P.prototype.eg,"UDPDR",8,1145,64],Q[65440]=[null,null,P.prototype.Ve,P.prototype.fg,"UIPAR",8,1140,64],Q[65456]=[null,null,P.prototype.Te,P.prototype.dg,"UDPAR",8,1145,64],Q[65472]=[null,null,P.prototype.Hb,P.prototype.Lb,"R0SET0"],Q[65473]=[null,null,P.prototype.Hb,P.prototype.Lb,"R1SET0"],Q[65474]=[null,null,P.prototype.Hb,P.prototype.Lb,"R2SET0"],Q[65475]=[null,null,P.prototype.Hb,P.prototype.Lb,"R3SET0"],Q[65476]=[null,null,P.prototype.Hb, -P.prototype.Lb,"R4SET0"],Q[65477]=[null,null,P.prototype.Hb,P.prototype.Lb,"R5SET0"],Q[65478]=[null,null,P.prototype.ue,P.prototype.Ff,"R6KERNEL"],Q[65479]=[null,null,P.prototype.xe,P.prototype.If,"R7KERNEL"],Q[65480]=[null,null,P.prototype.Ib,P.prototype.Mb,"R0SET1",1,1145],Q[65481]=[null,null,P.prototype.Ib,P.prototype.Mb,"R1SET1",1,1145],Q[65482]=[null,null,P.prototype.Ib,P.prototype.Mb,"R2SET1",1,1145],Q[65483]=[null,null,P.prototype.Ib,P.prototype.Mb,"R3SET1",1,1145],Q[65484]=[null,null,P.prototype.Ib, -P.prototype.Mb,"R4SET1",1,1145],Q[65485]=[null,null,P.prototype.Ib,P.prototype.Mb,"R5SET1",1,1145],Q[65486]=[null,null,P.prototype.ve,P.prototype.Gf,"R6SUPER",1,1145],Q[65487]=[null,null,P.prototype.we,P.prototype.Hf,"R6USER",1,1145],Q[65504]=[null,null,P.prototype.fe,P.prototype.sf,"CTRL",8,1170],Q[65520]=[null,null,P.prototype.nd,P.prototype.sd,"LSIZE",1,1170],Q[65522]=[null,null,P.prototype.nd,P.prototype.sd,"HSIZE",1,1170],Q[65524]=[null,null,P.prototype.Se,P.prototype.cg,"SYSID",1,1170],Q[65526]= -[null,null,P.prototype.ee,P.prototype.rf,"ERR",1,1170],Q[65528]=[null,null,P.prototype.le,P.prototype.yf,"MBR",1,1170],Q[65530]=[null,null,P.prototype.qe,P.prototype.Bf,"PIR"],Q[65532]=[null,null,P.prototype.Re,P.prototype.bg,"SLR"],Q[65534]=[null,null,P.prototype.te,P.prototype.Ef,"PSW"],Q); -vb(function(){for(var a=y(document,x,"device"),b=0;b>1),this.b=new Int32Array(this.v,0,this.size>>2),Jd(this,Kd?Ld:Md);else{a=this.b=Array(this.size>>2);for(f=0;f>2),b=0;b>8,c)};h.ce=function(a){return this.b[a>>2]>>>((a&3)<<3)&255};h.cf=function(a,b){Nb&&a&1&&this.B.La(b,64,2);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}; -h.pf=function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<>8);this.Wa=!0};h.ae=function(a,b){this.f&&null!=this.K&&Td(this.f,this.K+a);return this.j(a,b)};h.Ze=function(a,b){this.f&&null!=this.K&&Td(this.f,this.K+a,2);return this.C(a,b)}; -h.mf=function(a,b,c){this.f&&null!=this.K&&Ud(this.f,this.K+a);this.J?this.Kb(0,b,c):this.D(a,b,c)};h.jg=function(a,b,c){this.f&&null!=this.K&&Ud(this.f,this.K+a,2);this.J?this.Kb(0,b,c):this.G(a,b,c)};h.$d=function(a){return this.g[a]};h.be=function(a,b){a=this.g[a];this.f&&B(this.f,32)&&C(this.f,"Memory.readByte("+O(this.f,b)+"): "+O(this.f,a),!0);return a};h.Ye=function(a,b){Nb&&a&1&&this.B.La(b,64,2);return this.w.getUint16(a,!0)}; -h.bf=function(a,b){Nb&&a&1&&this.B.La(b,64,2);a=!Ob&&a&1?this.g[a]|this.g[a+1]<<8:this.H[a>>1];this.f&&B(this.f,32)&&C(this.f,"Memory.readWord("+O(this.f,b)+"): "+O(this.f,a),!0);return a};h.lf=function(a,b){this.g[a]=b;this.Wa=!0};h.nf=function(a,b,c){this.g[a]=b;this.Wa=!0;this.f&&B(this.f,32)&&C(this.f,"Memory.writeByte("+O(this.f,c)+","+O(this.f,b)+")",!0)};h.ig=function(a,b,c){Nb&&a&1&&this.B.La(c,64,4);this.w.setUint16(a,b,!0);this.Wa=!0}; -h.kg=function(a,b,c){Nb&&a&1&&this.B.La(c,64,4);!Ob&&a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.H[a>>1]=b;this.Wa=!0;this.f&&B(this.f,32)&&C(this.f,"Memory.writeWord("+O(this.f,c)+","+O(this.f,b)+")",!0)};var Hd=0,cd=1,Id=2,Tc=4,Yc=["NONE","RAM","ROM","VID","H/W"],Gd=0,Od=[],Nd=[L.prototype.ce,L.prototype.pf,L.prototype.cf,L.prototype.lg],Rd=[L.prototype.ae,L.prototype.mf,L.prototype.Ze,L.prototype.jg]; -if(Db)var Md=[L.prototype.$d,L.prototype.lf,L.prototype.Ye,L.prototype.ig],Ld=[L.prototype.be,L.prototype.nf,L.prototype.bf,L.prototype.kg];var Vd;if(Db){var Wd=new ArrayBuffer(2);(new DataView(Wd)).setUint16(0,256,!0);Vd=256===(new Uint16Array(Wd))[0]}else Vd=!1;var Kd=Vd; -function Xd(a,b){q.call(this,"CPU",a,0,1);b=+a.cycles||b;var c=+a.multiplier||1;this.oc=0;this.lc=b;this.bb=c;this.vc=Math.round(this.lc/1E4)/100;this.ob=this.vc*this.bb;this.wc=this.Vb=this.rb=this.mc=0;this.A.U=!1;this.A.hc=!1;this.A.Ia=a.autoStart;"string"==typeof this.A.Ia&&(this.A.Ia="true"==this.A.Ia);this.A.zb=!1;this.Sb=this.Bb=0;this.Tb=+a.csStart;this.Ab=+a.csInterval;this.Cb=+a.csStop;this.Fa=[];this.Tc=this.gf.bind(this);this.cb=this.Ta=this.ab=this.b=this.ga=this.Sa=this.Rb=this.$a=this.Db= -this.xc=this.nb=0;this.ra=null;A(this)}p(Xd,q);h=Xd.prototype;h.ta=function(a,b,c,d){this.J=a;this.D=b;this.F=d;this.ra=a.i;for(a=0;a=a.Bb&&(a.Bb+=a.Ab,c=!0);0<=a.Cb&&a.Cb<=ee(a)&&(a.Ab=a.Cb=-1,ae(a),a.Z(),c=!0);c&&a.u(ee(a)+" cycles: checksum="+I(a.Sb))}} -h.pa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.B[b]=c,!0;case "run":return this.B[b]=c,c.onclick=function(){var a;if(a=d.J)if(a=d.J,a.A.fa)a=!0;else{var b=null,c,k=za(a.id);for(c=0;ca.nb/a.ob?b=1:d=!0;a.bb=b;b=a.vc*a.bb;if(a.ob!=b){a.ob=b;b=a.ob.toFixed(2)+"Mhz";var e=a.B.setSpeed;e&&(e.textContent=b);a.u("target speed: "+b)}c&&a.J&&ie(a.J)}mc(a,a.Ta);a.Ta=0;a.Sa=xa();a.$a=0;ge(a);return d}function gd(a,b){var c=a.Fa.length;a.Fa.push([-1,b]);return c}function id(a,b,c,d){0<=b&&ba.Fa[b][0])&&(c=a.lc*a.bb/1E3*c|0,a.A.U&&(c+=je(a)),a.Fa[b][0]=c)} -function ke(a,b){for(var c=a.Fa.length-1;0<=c;c--){var d=a.Fa[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function lc(a,b){for(var c=a.Fa.length-1;0<=c;c--){var d=a.Fa[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function je(a,b){var c=a.ab-=a.b;a.b=a.ga=0;b&&(a.ab=0);return c} -h.gf=function(){if(this.A.U){this.mc>=this.lc&&ge(this,!0);this.Db=0;this.Rb=xa();if(this.$a){var a=this.Rb-this.$a;a>this.wc&&(this.Sa+=a,this.Sa>this.Rb&&(this.Sa=this.Rb))}try{do{var b=ke(this,this.A.zb?1:this.Vb);try{this.bc(b)}catch(e){if("number"!=typeof e)throw e;}b=je(this,!0);this.Db+=b;this.Ta+=b;nc(this,b);lc(this,b);this.rb-=b;if(0>=this.rb){this.rb+=this.Vb;++this.xc>=le&&(this.J&&J(this.J,void 0),this.xc=0);break}}while(this.A.U)}catch(e){this.Z();this.J&&this.J.stop(xa(),ee(this)); -Da(this,e.stack||e.message);return}if(this.A.U){a=setTimeout;b=this.Tc;this.$a=xa();var c=this.wc;this.Db&&(c=Math.round(c*this.Db/this.Vb));var c=c-(this.$a-this.Rb),d=this.$a-this.Sa;d&&(this.nb=Math.round(this.Ta/(10*d))/100,864E5<=d&&(this.cb=0,fe(this)));if(0>c||this.nbc&&(this.Sa-=c),c=0;this.mc+=this.Db;this.$a+=c;a(b,c)}}}; -function jc(a,b){if(!Ea(a))if(a.A.U)a.u(a.toString()+" busy");else{fe(a);a.A.U=!0;a.A.hc=!0;var c=a.B.run;c&&(c.textContent="Halt");a.J&&(b&&ie(a.J,!0),a.J.start(a.Sa,ee(a)));a.F||a.status("Started");setTimeout(a.Tc,0)}}h.bc=function(){return 0};h.Z=function(a){var b=!1;if(this.A.U){je(this);mc(this,this.Ta);this.Ta=0;this.A.U=!1;if(b=this.B.run)b.textContent="Run";this.J&&this.J.stop(xa(),ee(this));b=!0;this.F||this.status("Stopped")}this.A.complete=a;return b};var he=30,le=15,Yd=["power","reset"]; -function me(a){var b=+a.model||1170;Xd.call(this,a,6666667);this.ba=b;this.Qc=+a.addrReset||0;this.w=this.G=this.H=this.L=this.I=0;this.g=this.na=this.V=[];this.N=0;this.uc=[];this.C=this.M=this.Ea=this.Zb=[];this.nc=this.Za=this.P=this.Pc=this.Ha=this.jb=this.pb=this.Da=this.R=this.Va=this.sa=this.S=this.Eb=this.Fb=this.T=this.Ua=this.v=this.j=this.jc=this.W=this.Y=this.i=this.Yb=0;this.Sc=255;1120>=this.ba?(this.Oc=ne.bind(this),this.yb=this.Ld,this.nc=8,this.Sc=-1,this.Xc=255,this.Uc=0):(this.Oc= -oe.bind(this),this.yb=this.Md,this.Xc=~(1792|(1140>=this.ba?2048:0))&65535,this.Uc=1140e.$b&&(e.$b=c,c+=4)}return Xd.prototype.za.call(this,a,b)}; -h.reset=function(){this.status("Model "+this.ba);this.A.U&&this.Z();this.G=65536;this.H=32768;this.L=65535;this.I=32768;this.w=15;this.g=[0,0,0,0,0,0,0,this.Qc,-1,-2,-3,-4,-5,-6,-7,-8];this.na=[0,0,0,0,0,0];this.V=[0,0,0,0];this.N=0;this.uc=[4,2,0,1];this.C=[[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],[65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.M=[[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Ea=[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];this.Zb=[0,0,0,0,0,0,0,0];this.v=this.j=this.jc=this.W=this.Y=this.i=this.Yb=0;this.Ua=-1;hc(this);$d(this);this.A.error=!1;Xd.prototype.reset.call(this)};function hc(a){a.S=0;a.Eb=0;a.Fb=0;a.T=0;a.R=0;a.Va=0;a.sa=255;a.Ha=0;a.jb=0;a.pb=0;a.Da=262143;a.Za=a.g[7];a.P=0;a.la=null;a.D&&(pe(a),a.Pc=bd(a.D))} -function pe(a){a.Ob=a.pc;a.Pb=a.qc;a.ic=a.rc;a.Qb=a.sc;a.Wb&&(a.Ob=a.fd,a.Pb=a.ld);a.Xb&&(a.ic=a.pd,a.Qb=a.qd);a.Ha?(a.Ga=65536,a.kb=a.T&16?4186112:253952,a.Ca=a.kd,a.ka=a.Wb?a.af:a.Ec,a.xb=a.Xb?a.ng:a.Hc,Uc(a.D,a.T&16?22:18)):(a.Ga=0,a.kb=57344,a.Ca=a.Od,a.ka=a.Wb?a.$e:a.od,a.xb=a.Xb?a.mg:a.td,Uc(a.D,16))}function od(a){var b=a.S;b&57344||(b=b&-3199|a.jb<<5|a.pb<<1);return b} -function pd(a,b){b&=-3073;if(a.S!=b){b&57344&&!(a.S&57344)&&(a.Eb=a.P>>16&65535,a.Fb=a.P&65535);a.S=b;a.jb=(b&96)>>5;a.pb=(b&30)>>1;var c=0;b&257&&(c=4,b&1&&(c|=2));a.Ha!=c&&(a.Ha=c,pe(a))}}function qd(a){a.S&57344||(a.Eb=a.P>>16&65535);a=a.Eb;a&65280&&(a=(a<<8|a>>8)&65535);return a}function rd(a){a.S&57344||(a.Fb=a.P&65535);return a.Fb}function sd(a,b){1170>a.ba&&(b&=-49);a.T!=b&&(a.T=b,a.Da=b&16?4194303:262143,pe(a))} -function qe(a,b,c){a.Qc=b;a.D.reset();hc(a);re(a,b);vd(a,0);if(c){for(b=2;5>=b;b++)a.g[b]=0;a.A.U||jc(a)}else a.F?a.Z()||be(a.F):!1===c&&a.Z();!a.A.U&&a.ra&&a.ra.stop()}h.gd=function(){return 0};h.save=function(){var a=new M(this);a.set(0,[this.g,this.na,this.V,this.Ea,this.Zb,this.R,this.Yb,this.Va,this.sa,this.Ua,this.N,this.i,this.S,this.Eb,this.Fb,this.T,this.jb,this.pb,this.C,this.M,this.Ha,this.Da,this.Za,this.P]);a.set(1,[ud(this)]);a.set(2,[this.cb,this.bb]);return a.data()}; -h.restore=function(a){var b;b=a[0];fa();ca();fa();var c=b[Symbol.iterator];b=c?c.call(b):ha(b);this.g=b.next().value;this.na=b.next().value;this.V=b.next().value;this.Ea=b.next().value;this.Zb=b.next().value;this.R=b.next().value;this.Yb=b.next().value;this.Va=b.next().value;this.sa=b.next().value;this.Ua=b.next().value;this.N=b.next().value;this.i=b.next().value;this.S=b.next().value;this.Eb=b.next().value;this.Fb=b.next().value;this.T=b.next().value;this.jb=b.next().value;this.pb=b.next().value; -this.C=b.next().value;this.M=b.next().value;this.Ha=b.next().value;this.Da=b.next().value;this.Za=b.next().value;this.P=b.next().value;b=a[1];vd(this,b[0]);b=a[2];this.cb=b[0];fe(this,b[1]);return!0};function se(a){return a.G&65536?1:0}function te(a){return a.H&32768?2:0}function ue(a){return a.L&65535?0:4}function ve(a){return a.I&32768?8:0}function we(a,b){var c=a.g[7];a.g[7]=c+b&65535;return c}function S(a,b,c){c&&(re(a,a.g[7]+(b<<24>>23)),a.b-=2);a.b-=3}function re(a,b){a.g[7]=b&65535} -function jd(a,b,c,d){c={$b:b,hb:c,message:d||0,next:null};c.name=Qb[b];a.tc.push(c);return c}function xe(a,b){var c=a.la;if(c==b)a.la=b.next;else for(;c;){var d=c.next;if(d==b){c.next=d.next;break}c=d}a.la&&(a.i|=1)}function hd(a,b){if(b){if(b!=a.la){var c=a.la;if(!c||c.hb<=b.hb)b.next=c,a.la=b;else{do{var d=c.next;if(!d||d.hb<=b.hb){b.next=d;c.next=b;break}c=d}while(c)}}a.i|=1;b.message&&B(a,b.message|8)&&C(a,"setIRQ(vector="+H(b.$b)+",priority="+b.hb+")",!0,!0)}} -function nd(a,b){b&&(xe(a,b),b.message&&B(a,b.message|8)&&C(a,"clearIRQ(vector="+H(b.$b)+",priority="+b.hb+")",!0,!0))}function ye(a){return a.i&64?(a.qa(168,64,-6),!0):a.i&32?(a.qa(4,32,-5),!0):a.i&16?(a.qa(12,16,-7),!0):!1}function ud(a){return a.w=a.w&63728|ve(a)|ue(a)|te(a)|se(a)} -function vd(a,b){b&=a.Xc;a.I=b<<12;a.L=~b&4;a.H=b<<14;a.G=b<<16;if((b^a.w)&a.Uc)for(var c=a.na.length;0<=--c;){var d=a.g[c];a.g[c]=a.na[c];a.na[c]=d}a.N=b>>14&3;c=a.w>>14&3;a.N!=c&&(a.V[c]=a.g[6],a.g[6]=a.V[a.N]);a.w=b;a.i&=-3;a.i|=a.la?2:1}function td(a,b){if(b&=65024){var c=b>>9;do b+=34;while(c>>=1);a.i|=1}a.Va=b}h.Ba=function(a){this.I=this.L=a;this.H=0};h.ib=function(a,b){this.I=this.L=this.G=a;this.H=b||0};function ze(a,b){a.I=a.L=a.G=b;a.H=a.I^a.G>>1} -function Ae(a,b,c,d){a.I=a.L=a.G=b;a.H=(c^d)&(d^b)}h.qa=function(a,b,c){if(!this.ma){0>this.Ua?this.Ua=ud(this):this.N||(c=-4);-4==c&&(this.i&256&&(c=-1),this.i|=256,this.R|=4,this.g[6]=a=4);if(-1!=c){this.P=a|4143316992;this.N=0;var d=this.ka(a|this.Ga),e=this.ka(a+2&65535|this.Ga);vd(this,e&-12289|this.Ua>>2&12288);Be(this,this.Ua);Be(this,this.g[7]);re(this,d)}this.b-=5;this.i&=~(b|19);this.i|=129;this.Ua=-1;this.Zc=a;this.Yc=c;-1==c&&this.Z();if(-4<=c)throw a;}}; -function Ce(a){var b=De(a),c=De(a);a.w&49152&&(c=c&-225|a.w&63712);re(a,b);vd(a,c);a.i&=-17}function Ee(a,b){var c=b>>13&31;31>c&&(b=a.T&32?a.Ea[c]+(b&8191)&4194303:b&-3932161);return b} -function Fe(a,b,c){var d=[];if(c){c=Ee(a,b);var e=b>>13&31;d.push(c);d.push(e);a.T&32&&(d.push(a.Ea[e]),d.push(b&8191))}else if(a.Ha){var e=a.N<<1,f=b>>13;7>13;a.T&a.uc[a.N]||(d&=7);e=a.C[a.N][d];f=(a.M[a.N][d]<<6)+(b&8191)&a.Da;3932160<=f&&(f=Ee(a,f));if(a.ma)return f;f>=a.Pc&&f>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&& -(g|=16384));a.C[a.N][d]=e;if(f!=(4194170&a.Da)||a.N)a.jb=a.N,a.pb=d;g&&(g&57344&&(0<=a.Ua&&(g|=128),a.S&57344||(g|=a.S&4096|a.jb<<5|a.pb<<1,pd(a,a.S&-61695|g&61694)),a.qa(168,64,-2)),a.S&61440||!(f<(4191360&a.Da)||f>(4194239&a.Da))||(a.S|=4096,a.S&512&&(a.i|=64)));return f}function De(a){var b=a.ka(a.g[6]|a.Ga);a.g[6]=a.g[6]+2&65535;return b}function Be(a,b){var c=a.g[6]-2&65535;a.g[6]=c;a.P=a.P&65535|(a.P&-65536)<<8|16121856;a.i&256||a.yb(4,-2,c);a.xb(c,b)} -function Ge(a,b,c,d){var e,f,g=d&8?0:a.Ga;switch(b){case 0:return a.qa(4,0,-3),0;case 1:return 6==c&&a.yb(d,0,a.g[6]),a.b-=3,7==c?a.g[c]:a.g[c]|g;case 2:f=2;e=a.g[c];6==c&&a.yb(d,f,e);7!=c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.g[c];7!=c&&(e|=g);e=a.ka(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.g[c]+f&65535;6==c&&a.yb(d,f,e);7!=c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.g[c]-2&65535;7!=c&&(e|=g);e=a.ka(e)|g;a.b-=8;break;case 6:return e=a.ka(we(a,2)),e=e+a.g[c]&65535,6==c&&a.yb(d, -0,e),a.b-=6,e|g;case 7:return e=a.ka(we(a,2)),e=e+a.g[c]&65535,e=a.ka(e|a.Ga),a.b-=10,e|g}a.g[c]=a.g[c]+f&65535;a.P=a.P&65535|(a.P&-65536)<<8|(f<<3&248|c)<<16;return e}h.Ld=function(a,b,c){!this.N&&0>=b&&c<=this.sa&&(this.i|=32)};h.Md=function(a,b,c){this.N||(65534<=c&&(c|=-65536),a&4&&c<=this.sa&&(c<=this.sa-32?this.qa(4,0,-4):(this.R|=8,this.i|=32)))};h.fd=function(a){this.F&&Td(this.F,a,1);return this.pc(a)};h.ld=function(a){this.F&&Td(this.F,a,2);return this.qc(a)}; -h.pd=function(a,b){this.F&&Ud(this.F,a,1);this.rc(a,b)};h.qd=function(a,b){this.F&&Ud(this.F,a,2);this.sc(a,b)};function Ec(a,b){a.ma++;b=a.D.ac(rc(a,b,2));a.ma--;return b}function He(a,b){(b?--a.Xb:--a.Wb)||pe(a)}h.Od=function(a,b,c){return Ge(this,a,b,c)};h.kd=function(a,b,c){return rc(this,Ge(this,a,b,c),c)};h.od=function(a){return this.D.ac(this.Za=a)};h.$e=function(a){this.F&&Td(this.F,a,2);return this.od(a)};h.Ec=function(a){return this.D.ac(this.Za=rc(this,a,2))}; -h.af=function(a){this.F&&Td(this.F,a,2);return this.Ec(a)};h.td=function(a,b){this.D.Nb(this.Za=a,b)};h.mg=function(a,b){this.F&&Ud(this.F,a,2);this.td(a,b)};h.Hc=function(a,b){this.D.Nb(this.Za=rc(this,a,4),b)};h.ng=function(a,b){this.F&&Ud(this.F,a,2);this.Hc(a,b)};function Ie(a,b,c){var d=a.j=b&7;(b=a.v=(b&56)>>3)?(d=Ge(a,b,d,2),c&65536||61440!==(a.w&61440)&&(d&=65535),a.N=a.w>>12&3,c=a.ka(d|c&a.Ga),a.N=a.w>>14&3):c=6!=d||(a.w>>2&12288)===(a.w&12288)?a.g[d]:a.V[a.w>>12&3];return c} -function Je(a,b,c,d){a.P=a.P&65535|1441792;var e=a.j=b&7;(b=a.v=(b&56)>>3)?(e=Ge(a,b,e,4),c&65536||(e&=65535),a.N=a.w>>12&3,e=rc(a,e|c&65536,4),a.N=a.w>>14&3,a.Qb(e,d)):6!=e||(a.w>>2&12288)===(a.w&12288)?a.g[e]=d:a.V[a.w>>12&3]=d}function Ke(a,b){b>>=6;var c=a.Y=b&7;return(b=a.W=(b&56)>>3)?a.Ob(a.Ca(b,c,3)):a.g[c+a.nc]&a.Sc}function Le(a,b){var c;b>>=6;var d=a.Y=b&7;(b=a.W=(b&56)>>3)?c=a.Pb(a.Ca(b,d,2)):c=a.g[d+a.nc];return c}function Me(a,b){var c=a.j=b&7;b=a.v=(b&56)>>3;return Ge(a,b,c,8)} -function hf(a,b){var c=a.j=b&7;return(b=a.v=(b&56)>>3)?a.Ob(a.Ca(b,c,3)):a.g[c]&255}function jf(a,b){var c,d=a.j=b&7;(b=a.v=(b&56)>>3)?c=a.Pb(a.Ca(b,d,2)):c=a.g[d];return c}function kf(a,b,c,d){var e=a.j=b&7;(b=a.v=(b&56)>>3)?(e=a.jc=a.Ca(b,e,7),c=0>c?a.g[-c-1]&255:c,a.ic(e,d.call(a,c,a.Ob(e))),e&1&&a.b--):(b=a.g[e],c=0>c?a.g[-c-1]&255:c,a.g[e]=b&65280|d.call(a,c,b&255))} -function T(a,b,c,d){var e=a.j=b&7;(b=a.v=(b&56)>>3)?(e=a.Ca(b,e,6),a.Qb(e,d.call(a,0>c?a.g[-c-1]:c,a.Pb(e)))):a.g[e]=d.call(a,0>c?a.g[-c-1]:c,a.g[e])}function lf(a,b,c,d,e){var f=a.j=b&7;(b=a.v=(b&56)>>3)?(d=a.Ca(b,f,5),e.call(a,(c=0>c?a.g[-c-1]&255:c)<<8),a.ic(d,c),d&1&&a.b--):(c?(c=0>c?a.g[-c-1]&255:c,a.g[f]=a.g[f]&~d|c<<24>>24&d):a.g[f]&=~d,e.call(a,c<<8))} -function mf(a,b,c,d){var e=a.j=b&7;(b=a.v=(b&56)>>3)?(e=a.Ca(b,e,4),d.call(a,c=0>c?a.g[-c-1]:c),a.Qb(e,c)):(a.g[e]=c=0>c?a.g[-c-1]:c,d.call(a,c))} -h.bc=function(a){this.A.complete=!0;var b=this.F?nf(this.F)?1:this.A.hc?-1:0:0,c=a?this.A.hc?0:1:-1;this.A.hc=!1;this.ab=this.b=a;this.i=this.i&-5|(b?4:0);do{if(this.i){if(this.i&4){if(of(this.F,this.g[7],c)){this.Z();break}++b||(this.i&=-5);c||c++}if(a=this.i&11)if(a=!1,this.i&2){var d=160,e=(this.Va&224)>>5,f=this.la&&this.la.hb>e?this.la:null;f&&(d=f.$b,e=f.hb);e>(this.w&224)>>5?(this.i&8&&(we(this,2),this.i&=-9),this.qa(d,0,-10),e=!0):e=!1;e&&(f&&xe(this,f),a=!0);this.la||this.Va||(this.i&=-3)}else this.i& -1&&this.i++;if(a){if(this.i&4&&of(this.F,this.g[7],c)){this.Z();break}if(0>c)break}if(this.i&112&&ye(this)){if(this.i&4&&of(this.F,this.g[7],c)){this.Z();break}if(0>c)break}}this.i=this.i&15|this.w&16;a=this.P=this.g[7];f=this.ka(a);this.g[7]=a+2&65535;this.Oc(f)}while(0>1|b<<16;ze(this,a);return a&65535}function uf(a,b){a=b&128|b>>1|b<<8;ze(this,a<<8);return a&255}function vf(a,b){a=b&~a;this.Ba(a);return a}function wf(a,b){a=b&~a;this.Ba(a<<8);return a} -function xf(a,b){a|=b;this.Ba(a);return a}function yf(a,b){a|=b;this.Ba(a<<8);return a}function zf(a,b){a=~b|65536;this.ib(a);return a&65535}function Af(a,b){a=~b|256;this.ib(a<<8);return a&255}function Bf(a,b){this.I=this.L=a=b-a;this.H=b&(b^a);return a&65535}function Cf(a,b){a=b-a;var c=a<<8;b<<=8;this.I=this.L=c;this.H=b&(b^c);return a&255}function Df(a,b){this.I=this.L=a=b+a;this.H=a&(b^a);return a&65535}function Ef(a,b){a=b+a;var c=a<<8;this.I=this.L=c;this.H=c&(b<<8^c);return a&255} -function Ff(a,b){a=-b;this.ib(a,a&b&32768);return a&65535}function Gf(a,b){a=-b;this.ib(a<<8,(a&b&128)<<8);return a&255}function Hf(a,b){a=b<<1|this.G>>16&1;ze(this,a);return a&65535}function If(a,b){a=b<<1|this.G>>16&1;ze(this,a<<8);return a&255}function Jf(a,b){a=(this.G&65536|b)>>1|b<<16;ze(this,a);return a&65535}function Kf(a,b){a=((this.G&65536)>>8|b)>>1|b<<8;ze(this,a<<8);return a&255}function Lf(a,b){var c=b-a;Ae(this,c,a,b);return c&65535} -function Mf(a,b){var c=b-a;Ae(this,c<<8,a<<8,b<<8);return c&255}function Nf(a,b){this.I=this.L=b&65280;this.H=this.G=0;return(b<<8|b>>8)&65535}function Of(a,b){a^=b;this.Ba(a);return a&65535}function Pf(a){T(this,a,Le(this,a),pf);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.W?5:3)+(7==this.j?2:0)} -function Qf(a){var b=jf(this,a);a=a>>6&7;var c=this.g[a];c&32768&&(c|=4294901760);this.G=this.H=0;b&=63;if(b&32)b=64-b,16>=b;else if(b)if(16>15&65535;d&&65535!==d&&(this.H=32768)}this.g[a]=c&65535;this.I=this.L=c;this.b-=(this.v?6:7)+b} -function Rf(a){var b=jf(this,a);a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.G=this.H=0;b&=63;if(b&32){b=64-b;32>b-1;this.G=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<>15,d<<=1,32>=32-b)&&4294967295!==(c|4294967295<>16&65535;this.g[a|1]=d&65535;this.I=d>>16;this.L=d>>16|d;this.b-=(this.v?6:7)+b}function Sf(a){S(this,a,!se(this))}function Tf(a){S(this,a,se(this))} -function Uf(a){T(this,a,Le(this,a),vf);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.W?5:3)+(7==this.j?2:0)}function Vf(a){kf(this,a,Ke(this,a),wf);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.W?5:3)+(7==this.j?2:0)}function Wf(a){T(this,a,Le(this,a),xf);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.W?5:3)+(7==this.j?2:0)}function Xf(a){kf(this,a,Ke(this,a),yf);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.W?5:3)+(7==this.j?2:0)} -function Yf(a){var b=Le(this,a);a=jf(this,a);this.Ba((0>b?this.g[-b-1]:b)&a);this.b-=this.v?4+(this.Y&&6<=this.j?1:0):(this.W?4:3)+(7==this.j?2:0)}function Zf(a){var b=Ke(this,a);a=hf(this,a);this.Ba(((0>b?this.g[-b-1]&255:b)&a)<<8);this.b-=this.v?4+(this.Y&&6<=this.j?1:0):(this.W?4:3)+(7==this.j?2:0)}function $f(a){S(this,a,ue(this))}function ag(a){S(this,a,!ve(this)==!te(this))}function bg(a){S(this,a,!ue(this)&&!ve(this)==!te(this))}function cg(a){S(this,a,!se(this)&&!ue(this))} -function dg(a){S(this,a,ue(this)||!ve(this)!=!te(this))}function eg(a){S(this,a,se(this)||ue(this))}function fg(a){S(this,a,!ve(this)!=!te(this))}function gg(a){S(this,a,ve(this))}function hg(a){S(this,a,!ue(this))}function ig(a){S(this,a,!ve(this))}function jg(){this.qa(12,0,-9)}function kg(a){S(this,a,!0)}function lg(a){S(this,a,!te(this))}function mg(a){S(this,a,te(this))}function ng(a){a&1&&(this.G=0);a&2&&(this.H=0);a&4&&(this.L=1);a&8&&(this.I=0);this.b-=5} -function og(a){var b=Le(this,a);a=jf(this,a);var c=(b=0>b?this.g[-b-1]:b)-a;Ae(this,c,a,b);this.b-=this.v?4+(this.Y&&6<=this.j?1:0):(this.W?4:3)+(7==this.j?2:0)}function pg(a){var b=Ke(this,a);a=hf(this,a);var c=(b=(0>b?this.g[-b-1]&255:b)<<8)-(a<<=8);Ae(this,c,a,b);this.b-=this.v?4+(this.Y&&6<=this.j?1:0):(this.W?4:3)+(7==this.j?2:0)} -function qg(a){var b=jf(this,a);if(b){a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.G=this.H=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.g[a]=d&65535,this.g[a|1]=c-d*b&65535,this.L=d>>16|d,this.I=d>>16):(this.H=32768,this.L=d>>15|d,this.I=c>>16,-1===b&&65534===this.g[a]&&(this.g[a]=this.g[a|1]=1));this.b-=53}else this.L=this.I=0,this.H=32768,this.G=65536,this.b-=7}function rg(){this.qa(24,0,-9);this.b-=20} -function sg(){this.w&49152?(this.R|=128,this.qa(4,0,-8)):(this.ra&&1120==this.ba&&this.ra.setData(this.g[0],!0),this.F?tg(this.F):this.Z());this.b-=7}function ug(){this.qa(16,0,-9);this.b-=20}var vg=[0,7,7,10,7,11,9,13];function wg(a){this.ga=this.b;re(this,Me(this,a));this.b=this.ga-vg[this.v]}var xg=[0,14,14,17,14,18,16,20];function yg(a){this.ga=this.b;var b=Me(this,a);a=a>>6&7;Be(this,this.g[a]);this.g[a]=this.g[7];re(this,b);this.b=this.ga-xg[this.v]} -var zg=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Ag(a){var b=Le(this,a);this.ga=this.b;mf(this,a,b,this.Ba);this.b=this.ga-zg[(this.W?8:0)+this.v]+(7!=this.j||this.v?0:2)}function Bg(a){var b=Ke(this,a);lf(this,a,b,65535,this.Ba);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.W?5:3)+(7==this.j?2:0)}var Cg=[7,13,13,17,14,18,17,21]; -function Dg(a){var b=jf(this,a);a=a>>6&7;b=(b<<16>>16)*(this.g[a]<<16>>16);this.g[a]=b>>16&65535;this.g[a|1]=b&65535;b|=0;this.I=b>>16;this.L=this.I|b;this.H=0;this.G=-32768>b||32767>6;if(this.g[b]=this.g[b]-1&65535)re(this,this.g[7]-((a&63)<<1)),this.b+=1;this.b-=6}function Kg(a){T(this,a,Le(this,a),Lf);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.W?5:3)+(7==this.j?2:0)}function Lg(a){T(this,a,0,Nf);this.b-=this.v?9:3+(7==this.j?2:0)}function Mg(){this.qa(28,0,-9)} -function Ng(){this.ra&&(this.ra.Fc(this.g[7],!0),this.ra.setData(this.g[0],!0));this.i|=8;we(this,-2);this.b-=3}function Og(a){T(this,a,this.g[(a>>6&7)+this.nc],Of);this.b-=this.v?9:3+(7==this.j?2:0)}function U(a){var b;if(b=this.F)b=this.F,B(b,1)?(C(b,"undefined opcode "+O(b,a),!0,!0),b=tg(b)):b=!1;b||this.qa(8,0,-9)}function ne(a){Pg[a>>12].call(this,a)}function Qg(a){Rg[a>>6&3].call(this,a)}function Sg(a){Tg[a>>6&3].call(this,a)}function Ug(a){Vg[a>>6&3].call(this,a)} -function Wg(a){Xg[a&15].call(this,a)}function Yg(a){Zg[a&15].call(this,a)}function $g(a){ah[a>>6&3].call(this,a)}function bh(a){ch[a>>6&3].call(this,a)}function dh(a){eh[a>>6&3].call(this,a)} -var Pg=[function(a){fh[a>>8&15].call(this,a)},Ag,og,Yf,Uf,Wf,Pf,U,function(a){gh[a>>8&15].call(this,a)},Bg,pg,Zf,Vf,Xf,Kg,U],fh=[function(a){hh[a>>4&15].call(this,a)},kg,hg,$f,ag,fg,bg,dg,yg,yg,Qg,Sg,Ug,U,U,U],Rg=[function(a){mf(this,a,0,this.ib);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){T(this,a,0,zf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){T(this,a,1,Df);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){T(this,a,1,Bf);this.b-=this.v?9:3+(7==this.j?2:0)}],Tg=[function(a){T(this,a,0,Ff); -this.b-=this.v?11:6},function(a){T(this,a,se(this)?1:0,pf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){T(this,a,se(this)?1:0,Lf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){a=jf(this,a);this.ib(a);this.b-=this.v?4:3+(7==this.j?2:0)}],Vg=[function(a){T(this,a,0,Jf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){T(this,a,0,Hf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){T(this,a,0,tf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){T(this,a,0,rf);this.b-=this.v?9:3+(7==this.j?2:0)}],hh= -[function(a){ih[a&15].call(this,a)},U,U,U,wg,wg,wg,wg,Gg,U,Wg,Yg,Lg,Lg,Lg,Lg],ih=[sg,Ng,Hg,jg,ug,Fg,U,U,U,U,U,U,U,U,U,U],Xg=[Eg,function(){this.G=0;this.b-=5},function(){this.H=0;this.b-=5},ng,function(){this.L=1;this.b-=5},ng,ng,ng,function(){this.I=0;this.b-=5},ng,ng,ng,ng,ng,ng,ng],Zg=[Eg,function(){this.G=65536;this.b-=5},function(){this.H=32768;this.b-=5},Ig,function(){this.L=0;this.b-=5},Ig,Ig,Ig,function(){this.I=32768;this.b-=5},Ig,Ig,Ig,Ig,Ig,Ig,Ig],gh=[ig,gg,cg,eg,lg,mg,Sf,Tf,rg,Mg,$g,bh, -dh,U,U,U],ah=[function(a){lf(this,a,0,255,this.ib);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){kf(this,a,0,Af);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){kf(this,a,1,Ef);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){kf(this,a,1,Cf);this.b-=this.v?9:3+(7==this.j?2:0)}],ch=[function(a){kf(this,a,0,Gf);this.b-=this.v?11:6},function(a){kf(this,a,se(this)?1:0,qf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){kf(this,a,se(this)?1:0,Mf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){a=hf(this, -a);this.ib(a<<8);this.b-=this.v?4:3+(7==this.j?2:0)}],eh=[function(a){kf(this,a,0,Kf);this.b-=this.v?9+(this.jc&1):3+(7==this.j?2:0)},function(a){kf(this,a,0,If);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){kf(this,a,0,uf);this.b-=this.v?9+(this.jc&1):3+(7==this.j?2:0)},function(a){kf(this,a,0,sf);this.b-=this.v?9:3+(7==this.j?2:0)}];function oe(a){jh[a>>12].call(this,a)} -var jh=[function(a){kh[a>>8&15].call(this,a)},Ag,og,Yf,Uf,Wf,Pf,function(a){lh[a>>8&15].call(this,a)},function(a){mh[a>>8&15].call(this,a)},Bg,pg,Zf,Vf,Xf,Kg,U],kh=[function(a){nh[a>>4&15].call(this,a)},kg,hg,$f,ag,fg,bg,dg,yg,yg,Qg,Sg,Ug,function(a){oh[a>>6&3].call(this,a)},U,U],oh=[function(a){a=this.g[7]+((a&63)<<1)&65535;var b=this.ka(a|this.Ga);re(this,this.g[5]);this.g[6]=a+2&65535;this.g[5]=b;this.b-=8},function(a){a=Ie(this,a,0);this.Ba(a);Be(this,a);this.b-=11},function(a){var b=De(this); -this.ga=this.b;this.Ba(b);Je(this,a,0,b);this.b=this.ga-Cg[this.v]},function(a){mf(this,a,ve(this)?65535:0,this.Ba);this.b-=this.v?9:3+(7==this.j?2:0)}],nh=[function(a){ph[a&15].call(this,a)},U,U,U,wg,wg,wg,wg,Gg,function(a){!(a&8)||1145>this.ba?U.call(this,a):(this.w&49152||(this.w=this.w&-225|(a&7)<<5,this.i|=1,this.i&=-3),this.b-=5)},Wg,Yg,Lg,Lg,Lg,Lg],ph=[sg,Ng,function(){Ce(this);this.i|=this.w&16;this.b-=13},jg,ug,Fg,Hg,function(a){U.call(this,a)},U,U,U,U,U,U,U,U],lh=[Dg,Dg,qg,qg,Qf,Qf,Rf,Rf, -Og,Og,U,U,U,U,Jg,Jg],mh=[ig,gg,cg,eg,lg,mg,Sf,Tf,rg,Mg,$g,bh,dh,function(a){1145>this.ba?U.call(this,a):qh[a>>6&3].call(this,a)},U,U],qh=[function(a){U.call(this,a)},function(a){a=Ie(this,a,65536);this.Ba(a);Be(this,a);this.b-=11},function(a){var b=De(this);this.ga=this.b;this.Ba(b);Je(this,a,65536,b);this.b=this.ga-Cg[this.v]},function(a){U.call(this,a)}]; -function rh(a){q.call(this,"ROM",a,0,128);this.ea=this.g=null;this.v=+a.addr;this.b=+a.size;this.w=!1;this.i=a.alias;"string"==typeof this.i&&(this.i=eval(this.i));this.j=a.file;this.C=Pa(this.j);if(this.j){a=this.j;var b=Qa(this.C);"json"!=b&&"hex"!=b&&(a=db()+"/api/v1/dump?file="+this.j+"&format=bytes&decimal=true");var c=this;bb(a,null,!0,function(a,b,f){f?(c.O("Unable to load ROM resource (error "+f+": "+a+")"),c.j=null):(ua(c.mb,a,b),(a=cb(a,b))?(c.g=a.ca,c.ea=a.ea):c.j=null);sh(c)})}}p(rh,q); -h=rh.prototype;h.ta=function(a,b,c,d){this.D=b;this.f=c;this.F=d;sh(this)};h.za=function(){this.ea&&(this.F&&th(this.F,this.id,this.v,this.b,this.ea),delete this.ea);return!0};h.ya=function(){return!0}; -function sh(a){if(!Ja(a)){if(a.j){if(!a.g||!a.D)return;a.b||(a.b=a.g.length);if(a.g.length!=a.b)Da(a,"ROM size ("+I(a.g.length,8,!0)+") does not match specified size ("+I(a.b,8,!0)+")");else{var b;a:{b=a.v;a.status(a.b+"-byte ROM at "+H(b));if(57344<=b&&b<57344+Mc){var c={};b=(c[b]=[rh.prototype.Me,rh.prototype.Xf,null,null,null,a.b>>1],c);if(Wb(a.D,a,b)){b=a.w=!0;break a}}else if(Sc(a.D,b,a.b,Id)){for(c=0;c>>f.g;0>>=f.g;0>>a.g;0=b.length){C(a,"invalid block at offset "+Oa(n),4096);break}for(var l=l+2,r=b[l++]&255|(b[l++]&255)<<8,u=b[l++]&255|(b[l++]&255)<<8,m=m+((r&255)+(r>>8)+(u&255)+(u>>8)),t=l,E=r-=6;0=b.length){C(a,"insufficient data for block at offset "+Oa(n),4096); -break}m+=b[l++]&255;if(m&255){C(a,"invalid checksum ("+I(m,2,!0)+") for block at offset "+Oa(n),4096);break}if(E)for(C(a,"loading "+Oa(E)+" bytes at "+Oa(u)+"-"+Oa(u+E),4096);E--;)ad(a.D,u++,b[t++]&255);else u&1?g=!0:null==d&&(d=u),null!=d&&C(a,"starting address: "+Oa(d),4096);k=!0}else l++;else l+=2}if(!k&&(null==c&&(c=e),null!=c)){for(e=0;e=sa.Ic&&c<=sa.Gd&&(b=c-(sa.Ic-sa.ud));b&&(a.preventDefault&&a.preventDefault(),d.ec(b));return!0},c.onkeypress=function(a){a=a||window.event;if(!a.metaKey){var b=a.which||a.keyCode;a.altKey&&b==sa.wd&&(b=sa.vd);d.ec(b);a.preventDefault&&a.preventDefault()}return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation(); -a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.ec(a.getData("Text"))},c.removeAttribute("readonly"),!0}return!1}; -h.ta=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.F=d;var e=this;this.R=jd(this.f,this.M?-1:48,4,262144);this.S=gd(this.f,function(){var a;a=-1;e.v.length&&(a=e.v.shift()&255,C(e,"receiveByte("+I(a,2,!0)+")"),e.L&&97<=a&&122>a&&(a-=32),id(e.f,e.S,1E3/Math.round(e.T/10)));0<=a&&(e.G=a,e.b&128?e.G|=49152:e.b|=128,e.b&64&&hd(c,e.R))});this.N=jd(this.f,this.M?-1:52,4,262144);this.Y=gd(this.f,function(){e.g|=128;e.g&64&&hd(c,e.N)});Wb(b,this,Ah,this.M?64832+8*(this.M-1)-65392:0);Yb(b,this.reset.bind(this)); -A(this)};h.md=function(a){if(!this.i){var b=Zd(this.J,"connection");if(b){var c=b.split("->");if(2==c.length){var d=Ya(c[0]);if(d!=this.lb)return;c=Ya(c[1]);if(this.i=Aa(c)){var e=this.i.exports;if(e){var f=e.connect;f&&f.call(this.i,this.I);if(this.H=e.receiveData){this.I=a;this.P=e.receiveStatus;this.status(this.mb+"."+d+" connected to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; -h.za=function(a,b){if(!b)if(this.md(this.I),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.ya=function(a){return a?this.save():!0};h.reset=function(){Bh(this)};h.save=function(){var a=new M(this);a.set(0,[]);return a.data()};h.restore=function(){return Bh(this)};function Bh(a){a.G=0;a.b=8192;a.g=128;a.v=[];return!0} -h.ec=function(a){if("number"==typeof a)this.v.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.W||8,c=a-this.C%a,this.W&&(b=Xa("",c)));this.V&&!this.C&&c&&(b=String.fromCharCode(this.V)+b);this.j.value+=b;this.j.scrollTop=this.j.scrollHeight;this.C+=c}}else if(null!=this.w){if(10== -a||1024<=this.w.length)this.u(this.w),this.w="";10!=a&&(this.w+=String.fromCharCode(a))}id(this.f,this.Y,1E3/Math.round(this.ba/10));this.g&=-129};var zh="buffer",Ch={},Ah=(Ch[65392]=[null,null,yh.prototype.ze,yh.prototype.Kf,"RCSR"],Ch[65394]=[null,null,yh.prototype.ye,yh.prototype.Jf,"RBUF"],Ch[65396]=[null,null,yh.prototype.ef,yh.prototype.pg,"XCSR"],Ch[65398]=[null,null,yh.prototype.df,yh.prototype.og,"XBUF"],Ch); -vb(function(){for(var a=y(document,x,"serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.B[b]=c,!0;case "readTape":e=Gh;case "loadTape":return e||(e=Hh),this.B[b]=c,c.onclick= -function(){var a=d.B.listTapes;a&&Ih(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.N){c.parentNode.removeChild(c);break}this.B[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Ih(d,Pa(b,!0),b,Hh,a)}return!1};return!0;case Jh:return this.B[b]=c,!0}return!1}; -h.ta=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.F=d;this.I=Kh(a);var e=this;if(a=Dh(this,Zd(this.J,"autoMount")))for(var f in a)"PTR"==f&&(this.M[f]=a[f]);this.H=jd(this.f,56,4,4096);this.R=gd(this.f,function(){1==(e.b&32769)&&!(e.b&128)&&e.Cc.indexOf("/api/v1/dump")&&(e=Qa(c),f="json"==e||"gz"==e?encodeURI(c):db()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!bb(f,null,!0,function(e,f,g){var k=0>g&&!!a.J&&!a.J.A.fa;g?a.O('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(ua(a.mb,e,f),(e=cb(e,f))&&Vh(a,b,c,d,e.ca,e.wa, -e.va));a.A.eb=!1;a.g&&(a.g--,a.g||A(a));Sh(a)})}function Nh(a,b,c,d){if((a=a.B.listTapes)&&a.options){for(var e=0;e>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.X);for(d=0;dc.indexOf("/api/v1/dump")&&(b=Qa(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):Ra(c,"/")&&(d="dir"),f=db()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.cc?"":e)+"&format=json"));return!!bb(f, -null,!0,function(b,c,d){ci(a,b,c,d)})} -function ci(a,b,c,d){var e=null,f=0>d&&!!a.J&&!a.J.A.fa;a.j=!1;if(d)a.controller.O('Unable to load disk "'+a.Na+'" (error '+d+": "+b+")",f);else{ua(a.controller.mb,b,c);try{if(0g&&0c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+ -c+")");if(k.length)if(1==k.length)v(k[0]);else{a.X=k.length;a.da=k[0].length;a.aa=k[0][0].length;var l=k[0][0][0];a.oa=l&&l.length||512;for(d=c=0;d>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var r=l.data;if(void 0===r){var u=l.bytes;if(void 0!==u&&u.length){for(var t=m<<2,E=u.length;E>2,e=Array(d),f=0;f>2,c=(d>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.j)return!1;if(b>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.Ja?f=a.Ra+a.Ja&&(a.Ja+=f-(a.Ra+a.Ja)+1):(a.Ra=f,a.Ja=1);d[f]=d[f]&~(255<g)break;e|=g<=this.b.length||l>=this.b[k].length||m>=this.b[k][l].length){c="sector (CHS="+k+":"+l+":"+m+") out of range ("+ -b+" changes applied)";b=-1;break}if(this.j){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.b[k][l][m]){for(l=k.data.length;lb&&-2!=b&&this.controller.O("Unable to restore disk '"+this.Na+": "+c);return b}; -h.toJSON=function(){var a;a=0;for(var b;b=ei(this,a++);)hi(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")}; -function hi(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}var Zh=0;function R(a){q.call(this,"RK11",a,0,65536);this.G=ii(this,a.autoMount);this.C=0;this.i=Array(8);this.H=!ob("Mobi")&&window&&"FileReader"in window;this.gb=null;this.L=this.g=this.b=this.w=this.v=this.j=this.I=0}p(R,q); -function ii(a,b){if(b&&"string"==typeof b)try{b=eval("("+b+")")}catch(c){v(a.type+" auto-mount error: "+c.message+" ("+b+")"),b=null}return b||{}}h=R.prototype; -h.pa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.B[b]=c,c.onchange=function(){var a=d.B.descDisk,b=c.options&&c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){v("RK11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.B[b]=c,c.onchange=function(){var a=G(c.value,10);null!=a&&ji(d, -a)},!0;case "loadDisk":return this.B[b]=c,c.onclick=function(){var a=d.B.listDisks;a&&a.options&&Di(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.B[b]=c,c.onclick=function(){var a,b=d.B.listDrives,b=b&&G(b.value,10);null==b||0>b||b>=d.i.length||!(a=d.i[b])?d.O("Unable to boot the selected drive"):a.ia?(qe(d.f,0,!0),(a=d.Vc(a,0,0,0,512,0,2))&&d.O("Unable to read the boot sector ("+a+")")):d.O("Load a disk into the drive first")},!0;case "saveDisk":if(!this.H){c.parentNode.removeChild(c); -break}this.B[b]=c;c.onclick=function(){var a=d.B.listDrives;a&&a.options&&d.i&&((a=d.i[G(a.value,10)||0])?(a=a.ia)?(a=rb(gi(a),a.gc.replace(".json",".img")),v(a)):d.O("No disk loaded in drive."):d.O("No disk drive selected."))};return!0;case "mountDisk":if(this.H)return this.B[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Di(d,Pa(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; -h.ta=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.F=d;if(a=ii(this,Zd(this.J,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.G[e]=a[e]);Fi(this);this.gb=jd(this.f,144,5,65536);Wb(b,this,Gi);Yb(b,this.reset.bind(this));Hi(this,"None",Ii,!0);this.H&&Hi(this,"Local Disk",Ji);Hi(this,"Remote Disk",Ki);Li(this)||A(this)}; -h.za=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.J.C){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RK"+b;a.appendChild(c)}a.value="0";ji(this,0)}}return!0};h.ya=function(a){return a?this.save():!0};h.reset=function(){Fi(this)};h.save=function(){return(new M(this)).data()}; -h.restore=function(a){return Fi(this,a[0])};function Li(a,b){b||(a.C=0);for(var c in a.G){var d=a.G[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.B.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.i.length)a.O("Unable to load the selected drive");else if(c)if(c==Ji)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Ki){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=Pa(c);a.status("Attempting to load "+c+' as "'+b+'"')}Ni(a,e,b,c,!1,d)}else Mi(a,e)} -function Ni(a,b,c,d,e,f){var g=-1,k=a.i[b];k.Aa.toLowerCase()!=d.toLowerCase()&&(g++,Mi(a,b,!0),k.tb?a.O("RK11 busy"):(k.tb=!0,e&&(k.sb=!0,a.C++,B(a)&&C(a,"auto-loading disk: "+c)),k.Xa=!!f,bi(new Yh(a,k,"preload"),c,d,f,a.Ad)&&g++));return g} -h.Ad=function(a,b,c,d,e){a.tb=!1;b&&(b.X>a.X||b.da>a.da)&&(this.O('Disk "'+c+'" too large for drive '+("RK"+a.fb)),b=null);b?(a.ia=b,a.Na=c,a.Aa=d,this.O('Loaded disk "'+c+'" in drive '+("RK"+a.fb),a.sb||e),this.J&&ie(this.J)):a.Xa=!1;a.sb&&(a.sb=!1,--this.C||A(this));ji(this,a.fb)}; -function Hi(a,b,c,d){if((a=a.B.listDisks)&&a.options){for(var e=0;e=a.X){m=64;break}n=a.seek(b,c,d+1);if(!n){m=4096;break}r=0;++d>=a.aa&&(d=0,++c>=a.da&&(c=0,++b))}var u,t;if(0>(u=a.read(n,r++))||0>(t=a.read(n,r++))){m=32;break}if(!k&&(qc(this.D,Ee(this.f,f),u|t<<8),fd(this.D))){m=1024;break}r>=a.oa&&(n=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; -h.Bd=function(a,b,c,d,e,f,g,k,l){var m=0;a=a.ia;var n=null,r;a||(m=128,e=0);for(;e;){var u=Dc(this.D,Ee(this.f,f));if(fd(this.D)){m=1024;break}if(!n){if(b>=a.X){m=64;break}n=a.seek(b,c,d+1,!0);if(!n){m=4096;break}r=0;++d>=a.aa&&(d=0,++c>=a.da&&(c=0,++b))}if(k){var t,E;if(0>(t=a.read(n,r++))||0>(E=a.read(n,r++))){m=32;break}if(u!=(t|E<<8)){m=1;break}}else if(!a.write(n,r++,u&255)||!a.write(n,r++,u>>8)){m=32;break}r>=a.oa&&(n=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; -h.zd=function(a,b,c,d,e,f){this.v=f&65535;this.b=this.b&-49|f>>12&48;this.w=65536-e&65535;this.j=this.j&-16|d&15;this.g|=a;Oi(this);return!0};function Oi(a){a.b&=-32769;a.g&&(a.g|=32768,a.b|=32768,a.g&32736&&(a.b|=16384),B(a)&&C(a,a.type+": ERROR: "+H(a.g)))}h.Ee=function(){return this.L};h.Pf=function(){};h.Fe=function(){return this.g};h.Qf=function(){};h.Be=function(){return this.b&61438}; -h.Mf=function(a){this.b=this.b&-3968|a&3967;if(this.b&1){a=!0;var b,c,d="",e=(this.j&57344)>>13,f=this.i[e],g,k,l,m,n,r;this.b&=-8321;this.g&=-4;switch(c=this.b&14){case 0:B(this)&&C(this,this.type+": CRESET("+e+")",!0);this.g=this.j=0;this.b=128;break;case 10:d="RCHK";case 4:d||(d="READ"),b=this.Vc;case 6:d||(d="WCHK");case 2:d||(d="WRITE");b||(b=this.Bd);g=(this.j&8160)>>5;k=(this.j&16)>>4;l=this.j&15;m=65536-this.w&65535;n=(this.b&48)<<12|this.v;r=this.b&2048?0:2;B(this)&&C(this,this.type+": "+ -d+"("+g+":"+k+":"+l+") "+H(n)+"--"+H(n+(m<<1)),!0,!0);if(g>=f.X){this.g|=64;break}if(l>=f.aa){this.g|=32;break}a=b.call(this,f,g,k,l,m,n,r,6<=c,this.zd.bind(this));break;case 8:g=(this.j&8160)>>5;B(this)&&C(this,this.type+": SEEK("+g+")",!0);g'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.B[b]=c,c.onchange=function(){var a=G(c.value,10);null!=a&&Ri(d, -a)},!0;case "loadDisk":return this.B[b]=c,c.onclick=function(){var a=d.B.listDisks;a&&a.options&&Si(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.B[b]=c,c.onclick=function(){var a,b=d.B.listDrives,b=b&&G(b.value,10);null==b||0>b||b>=d.g.length||!(a=d.g[b])?d.O("Unable to boot the selected drive"):a.ia?(qe(d.f,0,!0),(a=d.Wc(a,0,0,0,512,0))&&d.O("Unable to read the boot sector ("+a+")")):d.O("Load a disk into the drive first")},!0;case "saveDisk":if(!this.I){c.parentNode.removeChild(c); -break}this.B[b]=c;c.onclick=function(){var a=d.B.listDrives;a&&a.options&&d.g&&((a=d.g[G(a.value,10)||0])?(a=a.ia)?(a=rb(gi(a),a.gc.replace(".json",".img")),v(a)):d.O("No disk loaded in drive."):d.O("No disk drive selected."))};return!0;case "mountDisk":if(this.I)return this.B[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Si(d,Pa(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; -h.ta=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.F=d;if(a=Qi(this,Zd(this.J,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.H[e]=a[e]);Ti(this);this.gb=jd(this.f,112,5,131072);Wb(b,this,Ui);Yb(b,this.reset.bind(this));Vi(this,"None",Wi,!0);this.I&&Vi(this,"Local Disk",Xi);Vi(this,"Remote Disk",Yi);Zi(this)||A(this)}; -h.za=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.J.C){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Ri(this,0)}}return!0};h.ya=function(a){return a?this.save():!0};h.reset=function(){Ti(this)};h.save=function(){return(new M(this)).data()}; -h.restore=function(a){return Ti(this,a[0])};function Zi(a,b){b||(a.G=0);for(var c in a.H){var d=a.H[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.B.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.g.length)a.O("Unable to load the selected drive");else if(c)if(c==Xi)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Yi){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=Pa(c);a.status("Attempting to load "+c+' as "'+b+'"')}aj(a,e,b,c,!1,d)}else $i(a,e)} -function aj(a,b,c,d,e,f){var g=-1,k=a.g[b];k.Aa.toLowerCase()!=d.toLowerCase()&&(g++,$i(a,b,!0),k.tb?a.O("RL11 busy"):(k.tb=!0,e&&(k.sb=!0,a.G++,B(a)&&C(a,"auto-loading disk: "+c)),k.Xa=!!f,bi(new Yh(a,k,"preload"),c,d,f,a.Dd)&&g++));return g} -h.Dd=function(a,b,c,d,e){a.tb=!1;b&&(b.X>a.X||b.da>a.da)&&(this.O('Disk "'+c+'" too large for drive '+("RL"+a.fb)),b=null);b?(a.ia=b,a.Na=c,a.Aa=d,this.O('Loaded disk "'+c+'" in drive '+("RL"+a.fb),a.sb||e),this.J&&ie(this.J)):a.Xa=!1;a.sb&&(a.sb=!1,--this.G||A(this));Ri(this,a.fb)}; -function Vi(a,b,c,d){if((a=a.B.listDisks)&&a.options){for(var e=0;e(n=a.read(l,m++))||0>(r=a.read(l,m++))){k=5120;break}qc(this.D,Ee(this.f,f),n|r<<8);if(fd(this.D)){k=8192;break}f+=2;e--;if(m>=a.oa&&(l=null,++d>=a.aa&&(d=0,++c>=a.da&&(c=0,++b>=a.X)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; -h.Ed=function(a,b,c,d,e,f,g){var k=0;a=a.ia;var l=null,m;a||(k=5120,e=0);for(;e;){var n=Dc(this.D,Ee(this.f,f));if(fd(this.D)){k=8192;break}f+=2;e--;if(!l){l=a.seek(b,c,d+1,!0);if(!l){k=5120;break}m=0}if(!a.write(l,m++,n&255)||!a.write(l,m++,n>>8)){k=5120;break}if(m>=a.oa&&(l=null,++d>=a.aa&&(d=0,++c>=a.da&&(c=0,++b>=a.X)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; -h.Cd=function(a,b,c,d,e,f){this.C=f&65535;this.b=this.b&-49|f>>12&48;this.v=f>>16&63;this.j=this.i=b<<7|(c?64:0)|d&63;this.w=65536-e&65535;a&&(this.b=this.b|a|32768);return!0};h.Je=function(){return this.b&65535}; -h.Uf=function(a){this.b=this.b&-1023|a&1022;this.v=this.v&60|(a&48)>>4;if(!(this.b&128)){a=!0;var b,c="",d=this.g[(this.b&768)>>8],e=d.ia,f,g,k;this.b&=-2;switch(this.b&14){case 4:this.w&8&&(this.b&=63);this.w=d.status|this.j&64|(e&&512==e.X?128:0);break;case 6:1==(this.i&3)&&(b=this.i&65408,c=(this.i&16)<<2,this.j=this.i&4?this.j+b:this.j-b,this.i=this.j=this.j&65408|c);break;case 8:this.w=this.j;break;case 12:c="READ",b=this.Wc;case 10:c||(c="WRITE"),b||(b=this.Ed),f=this.i>>7,g=this.i&64?1:0,k= -this.i&63,!e||f>=e.X||k>=e.aa?this.b|=37888:(a=65536-this.w&65535,e=(this.v&63)<<16|this.C,B(this)&&C(this,this.type+": "+c+"("+f+":"+g+":"+k+") "+H(e)+"--"+H(e+(a<<1)),!0,!0),a=b.call(this,d,f,g,k,a,e,this.Cd.bind(this)))}a&&(this.b|=129,this.b&64&&hd(this.f,this.gb))}};h.He=function(){return this.C};h.Sf=function(a){this.C=a&65534};h.Ke=function(){return this.i};h.Vf=function(a){this.i=a};h.Le=function(){return this.w};h.Wf=function(a){this.w=a};h.Ie=function(){return this.v}; -h.Tf=function(a){this.v=a&63;this.b=this.b&-49|(this.v&3)<<4};var Wi="",Xi="?",Yi="??",bj={},Ui=(bj[63744]=[null,null,Fd.prototype.Je,Fd.prototype.Uf,"RLCS"],bj[63746]=[null,null,Fd.prototype.He,Fd.prototype.Sf,"RLBA"],bj[63748]=[null,null,Fd.prototype.Ke,Fd.prototype.Vf,"RLDA"],bj[63750]=[null,null,Fd.prototype.Le,Fd.prototype.Wf,"RLMP"],bj[63752]=[null,null,Fd.prototype.Ie,Fd.prototype.Tf,"RLBE"],bj); -function cj(a){q.call(this,"Debugger",a);this.xa=+a.base||16;this.ga=!1;this.w=0;this.P=!1;this.v=-1;this.j=[];this.T={}}p(cj,q);cj.prototype.hd=function(){return-1};cj.prototype.jd=function(){}; -function dj(a,b,c,d){if(c)if(b){0>a.v&&a.j.length&&(a.v=0);if(0>a.v||b!=a.j[a.v])a.j.splice(0,0,b),a.v=0;a.v--}else a.P?b="end":b=a.j[a.v+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(Ya(b.substring(c,f))),c=f+1}}return a} -function ej(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; +function gb(a,b){var c,d={ba:null,ea:null,xa:null,wa:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.xa=g.load;d.wa=g.exec;if(e=g.bytes)d.ba=e;else if(e=g.words)for(d.ba=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.ba=Array(4*e.length),f=c=0;c>8&255,d.ba[f++]=e[c]>>16&255,d.ba[f++]=e[c]>>24&255;else d.ba=g;d.ea=g.symbols;d.ba.length?1==d.ba.length&&(v(d.ba[0]),d=null):(v("Empty resource: "+a),d=null)}catch(k){v("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;ca;a++)this.b["S"+a]=[0,0,!1,!1,this.pf,a];this.F=this.f=this.C=this.K=null;y(this)}p(Rb,q);h=Rb.prototype; +h.reset=function(a){this.stop();a&&Zb(this,this.Ta=0)}; +h.ua=function(a,b,c,d){if(this.K&&this.K.ua(a,b,c,d)||this.f&&this.f.ua(a,b,c,d)||this.F&&this.F.ua(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.H[b]=c,this.v++,!0;default:return"led"==a||"rled"==a?(this.H[b]=c,this.i[b]=d?1:0,this.v++,!0):"switch"==a?(void 0===this.b[b]&&(this.b[b]=[d?1:0,d?1:0]),this.H[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a, +b){return function(){$b(a,b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){ac(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){$b(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){ac(a,b)}}(this,b),!0):q.prototype.ua.call(this,a,b,c,d)}};h.za=function(a,b,c,d){this.K=a;this.C=b;this.f=c;this.F=d;bc(b,this,cc);dc(b,this.reset.bind(this));ec(this);fc(this)}; +h.Ca=function(a,b){if(!b)if(this.M&&gc(),!a)this.reset(!0);else if(!this.restore(a))return!1;return!0};h.Ba=function(a){return a?this.save():!0};h.save=function(){var a=new G(this);a.set(0,[this.da,this.Ta,this.Ua]);return a.data()};h.restore=function(a){if(a=a[0])hc(this,this.da=a[0]),Zb(this,this.Ta=a[1]),ic(this,a[2]);return!0};function jc(a,b,c){if(a=a.H[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function ec(a,b){for(var c in a.i)jc(a,c,null!=b?b:a.i[c])} +function kc(a,b,c){if(a=a.H[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function fc(a){for(var b in a.b)kc(a,b,a.b[b][1])}function lc(a,b,c,d){if(a.H[b]){var e=a.F&&a.F.Aa||8;c=c||0;c=8==e?E(c,d):F(c,d);a.H[b].textContent!=c&&(a.H[b].textContent=c)}}function $b(a,b){var c=a.b[b];kc(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);b!=mc&&(a.G=b==nc,a.I=b==oc)} +function ac(a,b){var c=a.b[b];c[2]&&c[3]&&(kc(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.mf=function(a){a||this.f.A.T||(a=this.f,a.C.reset(),pc(a),this.b[qc]&&this.b[qc][1]&&rc(this.f))};h.nf=function(){};h.hf=function(a){a||this.f.aa()}; +h.ff=function(a){if(!a&&!this.f.A.T)if(this.b[qc]&&this.b[qc][1])rc(this.f);else{if((a=this.F)&&!Ja(a,!0))Ka(a,!0),sc(a,0,null),Ka(a,!1);else try{var b=this.f.pc(1);0=a.f.ia?8:16,c=65472<=a.da&&a.da<65472+b,b=c?1:2,c=c?15:a.C.I;a.b[mc]&&a.b[mc][1]||(b=-b);hc(a,a.da&~c|a.da+b&c)} +function hc(a,b){a.da=b&a.C.I;if(a.B!==a.da){a.B=a.da;b=a.B;for(var c=0;22>c;c++)Bc(a,"A"+c,b&1<c;c++)Bc(a,"D"+c,b&1<c;c++)a.b["S"+c][1]=b&1<>2;this.i=this.j-1;this.G=this.M/this.j|0;this.U=this.G-1;this.Na=[];this.la=0;this.D=!1;this.N=[];this.Ye=[Sc,Tc,Uc,Vc];this.b=this.v=[];this.B=this.L=this.w=this.O=this.P=0;a=new J(this);Wc(a,this.F);this.b=Array(this.G);this.v=Array(this.G);for(b=0;b>>this.g;this.L=0;this.w=this.I;y(this)}p(Qc,q);function Zc(a,b){if(b!=a.L){for(var c=0;c>>a.g,a.v[a.P]=a.b[a.O])}}h=Qc.prototype;h.reset=function(){for(var a=0;a>>a.g;0g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.J)return l.Ob+=l.J-f,l.J=f,!0;if(f>=l.J+l.Ob){n=l.size-(f-m);n>g&&(n=g);l.Ob=f-l.J+n;f=m+a.j;g-=n;k++;continue}}return ad(bd,f,g)}f=new J(a,f,n,a.j,d,e);Wc(f,a.F,l);a.b[k++]=f;f=m+a.j;g-=n}return 0>=g?(a.status("Added "+(c>>10)+"Kb "+cd[d]+" at "+E(b)),!0):ad(dd,b,c)}h.od=function(a){return this.v[(a&this.w)>>>this.g].xb(a&this.i,a)}; +h.oc=function(a){var b=a&this.i,c=(a&this.w)>>>this.g;return Lb||b!=this.i?this.v[c].na(b,a):this.v[c++].xb(b,a)|this.v[c&this.U].xb(0,a+1)<<8};h.pd=function(a,b){this.v[(a&this.w)>>>this.g].zb(a&this.i,b,a)};h.Sb=function(a,b){var c=a&this.i,d=(a&this.w)>>>this.g;Lb||c!=this.i?this.v[d].Ab(c,b,a):(this.v[d++].zb(c,b&255,a),this.v[d&this.U].zb(0,b>>8&255,a+1))};function ed(a,b){return a.b[(b&a.I)>>>a.g]} +function zc(a,b){var c;a.D=!1;a.la++;var d=b&a.i,e=ed(a,b);Lb||d!=a.i?c=e.B(d,b):c=e.K(d,b)|ed(a,b+1).K(0,b+1)<<8;a.la--;return c}function fd(a,b,c){a.D=!1;a.la++;ed(a,b).F(b&a.i,c&255,b);a.la--}function xc(a,b,c){a.D=!1;a.la++;var d=b&a.i,e=ed(a,b);Lb||d!=a.i?e.D(d,c&65535,b):(e.F(d,c&255,b),ed(a,b+1).F(0,c>>8&255,b+1));a.la--} +function $c(a){for(var b=0,c=[],d=0;da.f.ia)){var k=g[0]?g[0].bind(b):null,l=g[1]?g[1].bind(b):null,m=g[2]?g[2].bind(b):null,n=g[3]?g[3].bind(b):null;65472<=f&&65487>=f&&(!k&&m&&(k=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!l&&n&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));for(var r=g[4],u=g[5]||1,t=0;t>8:e[2](f)&255):f&1&&(e=d.Na[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return this.f&&A(this.f,16|e[5])&&D(this.f,e[4]+".readByte("+K(this.f,b)+"): "+K(this.f,c),!0,!d.la),c;d.La(b,16,3);c=255;this.f&&A(this.f,16)&&D(this.f,"warning: unconverted read access to byte @"+K(this.f,b)+": "+K(this.f,c),!0,!d.la);return c} +function Tc(a,b,c){var d=!1,e=this.controller,f=e.Na[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Na[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d?this.f&&A(this.f,16|f[5])&&D(this.f,f[4]+".writeByte("+K(this.f,c)+","+K(this.f,b)+")",!0,!e.la):(e.La(c,16,5),this.f&&A(this.f,16)&&D(this.f,"warning: unconverted write access to byte @"+K(this.f,c)+": "+K(this.f, +b),!0,!e.la))}function Uc(a,b){var c=-1,d=this.controller;a=d.Na[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return this.f&&A(this.f,16|a[5])&&D(this.f,a[4]+".readWord("+K(this.f,b)+"): "+K(this.f,c),!0,!d.la),c;d.La(b,16,2);c=65535;this.f&&A(this.f,16)&&D(this.f,"warning: unconverted read access to word @"+K(this.f,b)+": "+K(this.f,c),!0,!d.la);return c} +function Vc(a,b,c){var d=!1,e=this.controller;a=e.Na[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d?this.f&&A(this.f,16|a[5])&&D(this.f,a[4]+".writeWord("+K(this.f,c)+","+K(this.f,b)+")",!0,!e.la):(e.La(c,16,4),this.f&&A(this.f,16)&&D(this.f,"warning: unconverted write access to word @"+K(this.f,c)+": "+K(this.f,b),!0,!e.la))}function L(a){q.call(this,"Device",a,256);this.b={bb:128,ld:-1}}p(L,q);h=L.prototype; +h.za=function(a,b,c,d){this.C=b;this.K=a;this.f=c;this.F=d;var e=this;this.b.ld=ld(c,function(){e.b.bb|=128;e.b.bb&64&&md(e.f,e.b.Lb);e.K&&I(e.K,1);nd(e.f,e.b.ld,1E3/60)});this.b.Lb=od(c,64,6,524288);bc(b,this,pd);dc(b,this.reset.bind(this));d&&qd(d,64,function(a){var b=e.f;rd(e,"KIPDR",b.B[0],0,a[0]);rd(e,"KDPDR",b.B[0],8,a[0]);rd(e,"KIPAR",b.M[0],0,a[0]);rd(e,"KDPAR",b.M[0],8,a[0],!0);rd(e,"SIPDR",b.B[1],0,a[0]);rd(e,"SDPDR",b.B[1],8,a[0]);rd(e,"SIPAR",b.M[1],0,a[0]);rd(e,"SDPAR",b.M[1],8,a[0], +!0);rd(e,"UIPDR",b.B[3],0,a[0]);rd(e,"UDPDR",b.B[3],8,a[0]);rd(e,"UIPAR",b.M[3],0,a[0]);rd(e,"UDPAR",b.M[3],8,a[0],!0);b.V&32&&rd(e,"UNIMAP",b.Fa,-1,a[0])});y(this)};function rd(a,b,c,d,e,f){a=a.F;if(!(e&&0>b.indexOf(e.toUpperCase()))){e=8;var g="",k=!1,l=0,m=8;0>d&&(e=c.length,d=0,k=!0,l=3,m=4);for(var n=0;n>1&63;var b=this.f.Fa[a>>1];return a&1?b>>16:b&65535};h.wh=function(a,b){b=b>>1&63;var c=b>>1;this.f.Fa[c]=b&1?this.f.Fa[c]&65535|(a&63)<<16:this.f.Fa[c]&-65536|a&65534};h.gg=function(a){return this.f.B[1][a>>1&7]};h.ph=function(a,b){this.f.B[1][b>>1&7]=a&65295};h.eg=function(a){return this.f.B[1][(a>>1&7)+8]};h.nh=function(a,b){this.f.B[1][(b>>1&7)+8]=a&65295};h.fg=function(a){return this.f.M[1][a>>1&7]}; +h.oh=function(a,b){b=b>>1&7;this.f.M[1][b]=a;this.f.B[1][b]&=65295};h.dg=function(a){return this.f.M[1][(a>>1&7)+8]};h.mh=function(a,b){b=(b>>1&7)+8;this.f.M[1][b]=a;this.f.B[1][b]&=65295};h.Af=function(a){return this.f.B[0][a>>1&7]};h.Kg=function(a,b){this.f.B[0][b>>1&7]=a&65295};h.yf=function(a){return this.f.B[0][(a>>1&7)+8]};h.Ig=function(a,b){this.f.B[0][(b>>1&7)+8]=a&65295};h.zf=function(a){return this.f.M[0][a>>1&7]};h.Jg=function(a,b){b=b>>1&7;this.f.M[0][b]=a;this.f.B[0][b]&=65295}; +h.xf=function(a){return this.f.M[0][(a>>1&7)+8]};h.Hg=function(a,b){b=(b>>1&7)+8;this.f.M[0][b]=a;this.f.B[0][b]&=65295};h.mg=function(a){return this.f.B[3][a>>1&7]};h.vh=function(a,b){this.f.B[3][b>>1&7]=a&65295};h.kg=function(a){return this.f.B[3][(a>>1&7)+8]};h.th=function(a,b){this.f.B[3][(b>>1&7)+8]=a&65295};h.lg=function(a){return this.f.M[3][a>>1&7]};h.uh=function(a,b){b=b>>1&7;this.f.M[3][b]=a;this.f.B[3][b]&=65295};h.jg=function(a){return this.f.M[3][(a>>1&7)+8]}; +h.sh=function(a,b){b=(b>>1&7)+8;this.f.M[3][b]=a;this.f.B[3][b]&=65295};h.Mb=function(a){a&=7;return this.f.w&2048?this.f.pa[a]:this.f.g[a]};h.Qb=function(a,b){b&=7;this.f.w&2048?this.f.pa[b]=a:this.f.g[b]=a};h.Lf=function(){return this.f.w&49152?this.f.W[0]:this.f.g[6]};h.Tg=function(a){this.f.w&49152?this.f.W[0]=a:this.f.g[6]=a};h.Of=function(){return this.f.g[7]};h.Wg=function(a){this.f.g[7]=a};h.Nb=function(a){a&=7;return this.f.w&2048?this.f.g[a]:this.f.pa[a]}; +h.Rb=function(a,b){b&=7;this.f.w&2048?this.f.g[b]=a:this.f.pa[b]=a};h.Mf=function(){return 1==(this.f.w&49152)>>14?this.f.g[6]:this.f.W[1]};h.Ug=function(a){1==(this.f.w&49152)>>14?this.f.g[6]=a:this.f.W[1]=a};h.Nf=function(){return 3==(this.f.w&49152)>>14?this.f.g[6]:this.f.W[3]};h.Vg=function(a){3==(this.f.w&49152)>>14?this.f.g[6]=a:this.f.W[3]=a};h.wf=function(a){return this.f.lc[a-65504>>1]};h.Gg=function(a,b){this.f.lc[b-65504>>1]=a};h.de=function(a){return 65520==a?(gd(this.C)>>6)-1:0}; +h.ie=function(){};h.ig=function(){return 1};h.rh=function(){};h.vf=function(){return this.f.P};h.Fg=function(){this.f.P=0};h.Cf=function(){return this.f.ic};h.Mg=function(a,b){b&1||(a&=255);this.f.ic=a};h.Hf=function(a,b){return b?0:this.f.$a};h.Pg=function(a){zd(this.f,a)};h.hg=function(a,b){return b?0:this.f.va&65280};h.qh=function(a){this.f.va=a|255};h.Kf=function(){return Ad(this.f)};h.Sg=function(a){Bd(this.f,a)};h.he=function(a,b){A(this)&&D(this,"writeIgnored("+E(b)+"): "+E(a),!0,!0)}; +var N={},pd=(N[61568]=[null,null,L.prototype.ng,L.prototype.wh,"UNIMAP",64,1170],N[62592]=[null,null,L.prototype.gg,L.prototype.ph,"SIPDR",8,1145,64],N[62608]=[null,null,L.prototype.eg,L.prototype.nh,"SDPDR",8,1145,64],N[62624]=[null,null,L.prototype.fg,L.prototype.oh,"SIPAR",8,1145,64],N[62640]=[null,null,L.prototype.dg,L.prototype.mh,"SDPAR",8,1145,64],N[62656]=[null,null,L.prototype.Af,L.prototype.Kg,"KIPDR",8,1140,64],N[62672]=[null,null,L.prototype.yf,L.prototype.Ig,"KDPDR",8,1145,64],N[62688]= +[null,null,L.prototype.zf,L.prototype.Jg,"KIPAR",8,1140,64],N[62704]=[null,null,L.prototype.xf,L.prototype.Hg,"KDPAR",8,1145,64],N[62798]=[null,null,L.prototype.Gf,L.prototype.Og,"MMR3",1,1145,64],N[65382]=[null,null,L.prototype.Bf,L.prototype.Lg,"LKS"],N[65402]=[null,null,L.prototype.Df,L.prototype.Ng,"MMR0",1,1140,64],N[65404]=[null,null,L.prototype.Ef,L.prototype.he,"MMR1",1,1145,64],N[65406]=[null,null,L.prototype.Ff,L.prototype.he,"MMR2",1,1140,64],N[65408]=[null,null,L.prototype.mg,L.prototype.vh, +"UIPDR",8,1140,64],N[65424]=[null,null,L.prototype.kg,L.prototype.th,"UDPDR",8,1145,64],N[65440]=[null,null,L.prototype.lg,L.prototype.uh,"UIPAR",8,1140,64],N[65456]=[null,null,L.prototype.jg,L.prototype.sh,"UDPAR",8,1145,64],N[65472]=[null,null,L.prototype.Mb,L.prototype.Qb,"R0SET0"],N[65473]=[null,null,L.prototype.Mb,L.prototype.Qb,"R1SET0"],N[65474]=[null,null,L.prototype.Mb,L.prototype.Qb,"R2SET0"],N[65475]=[null,null,L.prototype.Mb,L.prototype.Qb,"R3SET0"],N[65476]=[null,null,L.prototype.Mb, +L.prototype.Qb,"R4SET0"],N[65477]=[null,null,L.prototype.Mb,L.prototype.Qb,"R5SET0"],N[65478]=[null,null,L.prototype.Lf,L.prototype.Tg,"R6KERNEL"],N[65479]=[null,null,L.prototype.Of,L.prototype.Wg,"R7KERNEL"],N[65480]=[null,null,L.prototype.Nb,L.prototype.Rb,"R0SET1",1,1145],N[65481]=[null,null,L.prototype.Nb,L.prototype.Rb,"R1SET1",1,1145],N[65482]=[null,null,L.prototype.Nb,L.prototype.Rb,"R2SET1",1,1145],N[65483]=[null,null,L.prototype.Nb,L.prototype.Rb,"R3SET1",1,1145],N[65484]=[null,null,L.prototype.Nb, +L.prototype.Rb,"R4SET1",1,1145],N[65485]=[null,null,L.prototype.Nb,L.prototype.Rb,"R5SET1",1,1145],N[65486]=[null,null,L.prototype.Mf,L.prototype.Ug,"R6SUPER",1,1145],N[65487]=[null,null,L.prototype.Nf,L.prototype.Vg,"R6USER",1,1145],N[65504]=[null,null,L.prototype.wf,L.prototype.Gg,"CTRL",8,1170],N[65520]=[null,null,L.prototype.de,L.prototype.ie,"LSIZE",1,1170],N[65522]=[null,null,L.prototype.de,L.prototype.ie,"HSIZE",1,1170],N[65524]=[null,null,L.prototype.ig,L.prototype.rh,"SYSID",1,1170],N[65526]= +[null,null,L.prototype.vf,L.prototype.Fg,"ERR",1,1170],N[65528]=[null,null,L.prototype.Cf,L.prototype.Mg,"MBR",1,1170],N[65530]=[null,null,L.prototype.Hf,L.prototype.Pg,"PIR"],N[65532]=[null,null,L.prototype.hg,L.prototype.qh,"SLR"],N[65534]=[null,null,L.prototype.Kf,L.prototype.Sg,"PSW"],N); +yb(function(){for(var a=x(document,w,"device"),b=0;b>1),this.b=new Int32Array(this.v,0,this.size>>2),Hd(this,Id?Jd:Kd);else{a=this.b=Array(this.size>>2);for(f=0;f>2),b=0;b>8,c)};h.tf=function(a){return this.b[a>>2]>>>((a&3)<<3)&255};h.tg=function(a,b){Kb&&a&1&&this.C.La(b,64,2);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}; +h.Dg=function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<>8);this.ab=!0};h.rf=function(a,b){this.f&&null!=this.J&&Zd(this.f,this.J+a);return this.K(a,b)};h.pg=function(a,b){this.f&&null!=this.J&&Zd(this.f,this.J+a,2);return this.B(a,b)}; +h.Bg=function(a,b,c){this.f&&null!=this.J&&$d(this.f,this.J+a);this.j?this.Pb(0,b,c):this.F(a,b,c)};h.yh=function(a,b,c){this.f&&null!=this.J&&$d(this.f,this.J+a,2);this.j?this.Pb(0,b,c):this.D(a,b,c)};h.qf=function(a){return this.g[a]};h.sf=function(a,b){a=this.g[a];this.f&&A(this.f,32)&&D(this.f,"Memory.readByte("+K(this.f,b)+"): "+K(this.f,a),!0);return a};h.og=function(a,b){Kb&&a&1&&this.C.La(b,64,2);return this.w.getUint16(a,!0)}; +h.sg=function(a,b){Kb&&a&1&&this.C.La(b,64,2);a=!Lb&&a&1?this.g[a]|this.g[a+1]<<8:this.G[a>>1];this.f&&A(this.f,32)&&D(this.f,"Memory.readWord("+K(this.f,b)+"): "+K(this.f,a),!0);return a};h.Ag=function(a,b){this.g[a]=b;this.ab=!0};h.Cg=function(a,b,c){this.g[a]=b;this.ab=!0;this.f&&A(this.f,32)&&D(this.f,"Memory.writeByte("+K(this.f,c)+","+K(this.f,b)+")",!0)};h.xh=function(a,b,c){Kb&&a&1&&this.C.La(c,64,4);this.w.setUint16(a,b,!0);this.ab=!0}; +h.zh=function(a,b,c){Kb&&a&1&&this.C.La(c,64,4);!Lb&&a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.G[a>>1]=b;this.ab=!0;this.f&&A(this.f,32)&&D(this.f,"Memory.writeWord("+K(this.f,c)+","+K(this.f,b)+")",!0)};var Fd=0,hd=1,Gd=2,Yc=4,cd=["NONE","RAM","ROM","VID","H/W"],Ed=0,Md=[],Ld=[J.prototype.tf,J.prototype.Dg,J.prototype.tg,J.prototype.Ah],Xd=[J.prototype.rf,J.prototype.Bg,J.prototype.pg,J.prototype.yh]; +if(Gb)var Kd=[J.prototype.qf,J.prototype.Ag,J.prototype.og,J.prototype.xh],Jd=[J.prototype.sf,J.prototype.Cg,J.prototype.sg,J.prototype.zh];var ae;if(Gb){var be=new ArrayBuffer(2);(new DataView(be)).setUint16(0,256,!0);ae=256===(new Uint16Array(be))[0]}else ae=!1;var Id=ae; +function ce(a,b){q.call(this,"CPU",a,1);b=+a.cycles||b;var c=+a.multiplier||1;this.Kc=0;this.Ic=b;this.hb=c;this.Sc=Math.round(this.Ic/1E4)/100;this.sb=this.Sc*this.hb;this.Tc=this.dc=this.vb=this.Jc=0;this.A.T=this.A.Dc=!1;this.A.qa=a.autoStart;"string"==typeof this.A.qa&&(this.A.qa="true"==this.A.qa);this.A.Fb=!1;this.bc=this.Ib=0;this.cc=+a.csStart;this.Gb=+a.csInterval;this.Jb=+a.csStop;this.ha=[];this.Id=this.xg.bind(this);this.ib=this.Ia=this.gb=this.b=this.ja=this.Ha=this.ac=this.fb=this.Kb= +this.Uc=this.rb=0;this.ta=null;y(this)}p(ce,q);h=ce.prototype;h.za=function(a,b,c,d){this.K=a;this.C=b;this.F=d;this.ta=a.i;for(a=0;a=a.Ib&&(a.Ib+=a.Gb,c=!0);0<=a.Jb&&a.Jb<=ke(a)&&(a.Gb=a.Jb=-1,ge(a),a.aa(),c=!0);c&&a.u(ke(a)+" cycles: checksum="+F(a.bc))}} +h.ua=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.H[b]=c,!0;case "run":return this.H[b]=c,c.onclick=function(){var a;if(a=d.K)if(a=d.K,a.A.Z)a=!0;else{var b=null,c,k=Aa(a.id);for(c=0;ca.rb/a.sb?b=1:d=!0;a.hb=b;b=a.Sc*a.hb;if(a.sb!=b){a.sb=b;b=a.sb.toFixed(2)+"Mhz";var e=a.H.setSpeed;e&&(e.textContent=b);a.u("target speed: "+b)}c&&a.K&&oe(a.K)}uc(a,a.Ia);a.Ia=0;a.Ha=ya();a.fb=0;me(a);return d}function ld(a,b){var c=a.ha.length;a.ha.push([-1,b]);return c}function nd(a,b,c,d){0<=b&&ba.ha[b][0])&&(c=a.Ic*a.hb/1E3*c|0,a.A.T&&(c+=pe(a)),a.ha[b][0]=c)} +function qe(a,b){for(var c=a.ha.length-1;0<=c;c--){var d=a.ha[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function re(a){for(var b=[],c=0;cd[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function pe(a,b){var c=a.gb-=a.b;a.b=a.ja=0;b&&(a.gb=0);return c} +h.xg=function(){if(this.A.T){this.Jc>=this.Ic&&me(this,!0);this.Kb=0;this.ac=ya();if(this.fb){var a=this.ac-this.fb;a>this.Tc&&(this.Ha+=a,this.Ha>this.ac&&(this.Ha=this.ac))}try{do{var b=qe(this,this.A.Fb?1:this.dc);try{this.pc(b)}catch(e){if("number"!=typeof e)throw e;}b=pe(this,!0);this.Kb+=b;this.Ia+=b;vc(this,b);tc(this,b);this.vb-=b;if(0>=this.vb){this.vb+=this.dc;++this.Uc>=se&&(this.K&&I(this.K,void 0),this.Uc=0);break}}while(this.A.T)}catch(e){this.aa();this.K&&this.K.stop(ya(),ke(this)); +Ga(this,e.stack||e.message);return}if(this.A.T){a=setTimeout;b=this.Id;this.fb=ya();var c=this.Tc;this.Kb&&(c=Math.round(c*this.Kb/this.dc));var c=c-(this.fb-this.ac),d=this.fb-this.Ha;d&&(this.rb=Math.round(this.Ia/(10*d))/100,864E5<=d&&(this.ib=0,le(this)));if(0>c||this.rbc&&(this.Ha-=c),c=0;this.Jc+=this.Kb;this.fb+=c;a(b,c)}}}; +function rc(a,b){if(!Ha(a))if(a.A.T)a.u(a.toString()+" busy");else{le(a);a.A.T=!0;a.A.Dc=!0;var c=a.H.run;c&&(c.textContent="Halt");a.K&&(b&&oe(a.K,!0),a.K.start(a.Ha,ke(a)));a.F||a.status("Started");setTimeout(a.Id,0)}}h.pc=function(){return 0};h.aa=function(a){var b=!1;if(this.A.T){pe(this);uc(this,this.Ia);this.Ia=0;this.A.T=!1;if(b=this.H.run)b.textContent="Run";this.K&&this.K.stop(ya(),ke(this));b=!0;this.F||this.status("Stopped")}this.A.complete=a;return b};var ne=30,se=15,de=["power","reset"]; +function te(a){var b=+a.model||1170;ce.call(this,a,6666667);this.ia=b;this.Bd=+a.addrReset||0;this.Za=this.w=this.N=this.D=this.G=this.L=this.I=0;this.g=this.pa=this.W=[];this.M=this.B=this.Fa=this.lc=[];this.cb=this.O=this.zd=this.tb=this.ub=this.mb=this.eb=this.P=this.ic=this.$a=this.va=this.U=this.jc=this.kc=this.V=this.i=0;this.Ed=[4,2,0,1];this.mc=0;this.Fd=255;1120>=this.ia?(this.yd=ue.bind(this),this.Db=this.af,this.mc=8,this.Fd=-1,this.Md=255,this.Ld=0):(this.yd=ve.bind(this),this.Db=this.bf, +this.Md=~(1792|(1140>=this.ia?2048:0))&65535,this.Ld=1140e.yb&&(e.yb=c,c+=4)}return ce.prototype.Ca.call(this,a,b)}; +h.reset=function(){this.status("Model "+this.ia);this.A.T&&this.aa();this.D=65536;this.G=32768;this.L=65535;this.I=32768;this.w=15;this.g=[0,0,0,0,0,0,0,this.Bd,-1,-2,-3,-4,-5,-6,-7,-8];this.pa=[0,0,0,0,0,0];this.W=[0,0,0,0];this.M=[[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.B=[[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],[65535,65535,65535,65535,65535,65535,65535,65535,65535, +65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Fa=[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];this.lc=[0,0,0,0,0,0,0,0];this.N=0;this.Za=-1;this.v=this.j=this.Hc=this.X=this.Y=this.i=this.ic=0;pc(this);fe(this);this.A.error=!1;ce.prototype.reset.call(this)};function pc(a){a.U=0;a.jc=0;a.kc=0;a.V=0;a.P=0;a.$a=0;a.va=255;a.tb=0;a.ub=0;a.mb=0;a.eb=262143;a.cb=a.g[7];a.O=0;a.R=null;a.C&&(we(a),a.zd=gd(a.C))} +function we(a){a.Xb=a.Lc;a.Yb=a.Mc;a.Ec=a.Nc;a.Zb=a.Qc;a.fc&&(a.Xb=a.Wd,a.Yb=a.ae);a.gc&&(a.Ec=a.fe,a.Zb=a.ge);a.tb?(a.Ga=65536,a.ob=a.V&16?4186112:253952,a.Ea=a.$d,a.na=a.fc?a.rg:a.gd,a.Ab=a.gc?a.Ch:a.md,Zc(a.C,a.V&16?22:18)):(a.Ga=0,a.ob=57344,a.Ea=a.df,a.na=a.fc?a.qg:a.ee,a.Ab=a.gc?a.Bh:a.je,Zc(a.C,16))}function td(a){var b=a.U;b&57344||(b=b&-3199|a.ub<<5|a.mb<<1);return b} +function ud(a,b){b&=-3073;if(a.U!=b){b&57344&&!(a.U&57344)&&(a.jc=a.O>>16&65535,a.kc=a.O&65535);a.U=b;a.ub=(b&96)>>5;a.mb=(b&30)>>1;var c=0;b&257&&(c=4,b&1&&(c|=2));a.tb!=c&&(a.tb=c,we(a))}}function wd(a){a.U&57344||(a.jc=a.O>>16&65535);a=a.jc;a&65280&&(a=(a<<8|a>>8)&65535);return a}function xd(a){a.U&57344||(a.kc=a.O&65535);return a.kc}function yd(a,b){1170>a.ia&&(b&=-49);a.V!=b&&(a.V=b,a.eb=b&16?4194303:262143,we(a))} +function xe(a,b,c){a.Bd=b;ye(a,b);Bd(a,0);a.C.reset();pc(a);if(c){for(b=2;5>=b;b++)a.g[b]=0;a.A.Z?a.A.T||rc(a):a.A.qa=!0}else a.F&&a.A.Z?a.aa()||(he(a.F),I(a.K,-1)):!1===c&&a.aa();!a.A.T&&a.ta&&a.ta.stop()}h.Xd=function(){return 0}; +h.save=function(){var a=new G(this);a.set(0,[this.g,this.pa,this.W,this.M,this.B,this.Fa,this.lc,this.P,this.ic,this.$a,this.va,this.ub,this.mb,this.cb,this.i,this.O,this.Za,this.nc,this.qc]);a.set(1,[Ad(this),td(this),wd(this),xd(this),this.V]);a.set(2,[this.ib,this.hb,this.A.qa]);a.set(3,ze(this));a.set(4,re(this));return a.data()}; +h.restore=function(a){var b=ja(a[0]);this.g=b.next().value;this.pa=b.next().value;this.W=b.next().value;this.M=b.next().value;this.B=b.next().value;this.Fa=b.next().value;this.lc=b.next().value;this.P=b.next().value;this.ic=b.next().value;this.$a=b.next().value;this.va=b.next().value;this.ub=b.next().value;this.mb=b.next().value;this.cb=b.next().value;this.i=b.next().value;this.O=b.next().value;this.Za=b.next().value;this.nc=b.next().value;this.qc=b.next().value;b=a[1];Bd(this,b[0]);ud(this,b[1]); +this.jc=b[2];this.kc=b[3];yd(this,b[4]);b=a[2];this.ib=b[0];le(this,b[1]);this.A.qa=b[2];for(var b=a[3],c=b.length-1;0<=c;c--){var d;a:{for(d=0;d>23)),a.b-=2);a.b-=3}function ye(a,b){a.g[7]=b&65535}function od(a,b,c,d){b={yb:b,kb:c,message:d||0,name:Pb[b],next:null};a.$b.push(b);return b}function Fe(a,b){var c=a.R;if(c==b)a.R=b.next;else for(;c;){var d=c.next;if(d==b){c.next=d.next;break}c=d}a.R&&(a.i|=1)} +function md(a,b){if(b){if(b!=a.R){var c=a.R;if(!c||c.kb<=b.kb)b.next=c,a.R=b;else{do{var d=c.next;if(!d||d.kb<=b.kb){b.next=d;c.next=b;break}c=d}while(c)}}a.i|=1;b.message&&A(a,b.message|8)&&D(a,"setIRQ(vector="+E(b.yb)+",priority="+b.kb+")",!0,!0)}}function sd(a,b){b&&(Fe(a,b),b.message&&A(a,b.message|8)&&D(a,"clearIRQ(vector="+E(b.yb)+",priority="+b.kb+")",!0,!0))}function ze(a){var b=[];for(a=a.R;a;)b.push(a.yb),a=a.next;return b} +function Ge(a){return a.i&64?(a.sa(168,64,-6),!0):a.i&32?(a.sa(4,32,-5),!0):a.i&16?(a.sa(12,16,-7),!0):!1}function Ad(a){return a.w=a.w&63728|De(a)|Ce(a)|Be(a)|Ae(a)}function Bd(a,b){b&=a.Md;a.I=b<<12;a.L=~b&4;a.G=b<<14;a.D=b<<16;if((b^a.w)&a.Ld)for(var c=a.pa.length;0<=--c;){var d=a.g[c];a.g[c]=a.pa[c];a.pa[c]=d}a.N=b>>14&3;c=a.w>>14&3;a.N!=c&&(a.W[c]=a.g[6],a.g[6]=a.W[a.N]);a.w=b;a.i&=-3;a.i|=a.R?2:1}function zd(a,b){if(b&=65024){var c=b>>9;do b+=34;while(c>>=1);a.i|=1}a.$a=b} +h.Da=function(a){this.I=this.L=a;this.G=0};h.lb=function(a,b){this.I=this.L=this.D=a;this.G=b||0};function He(a,b){a.I=a.L=a.D=b;a.G=a.I^a.D>>1}function Ie(a,b,c,d){a.I=a.L=a.D=b;a.G=(c^d)&(d^b)} +h.sa=function(a,b,c){if(!this.oa){0>this.Za?this.Za=Ad(this):this.N||(c=-4);-4==c&&(this.i&256&&(c=-1),this.i|=256,this.P|=4,this.g[6]=a=4);if(-1!=c){this.O=a|4143316992;this.N=0;var d=this.na(a|this.Ga),e=this.na(a+2&65535|this.Ga);Bd(this,e&-12289|this.Za>>2&12288);Je(this,this.Za);Je(this,this.g[7]);ye(this,d)}this.b-=5;this.i&=~(b|19);this.i|=129;this.Za=-1;this.nc=c;this.qc=a;-1==c&&this.aa();if(-4<=c)throw a;}}; +function Ke(a){var b=Le(a),c=Le(a);a.w&49152&&(c=c&-225|a.w&63712);ye(a,b);Bd(a,c);a.i&=-17}function Me(a,b){var c=b>>13&31;31>c&&(b=a.V&32?a.Fa[c]+(b&8191)&4194303:b&-3932161);return b} +function Ne(a,b,c){var d=[];if(c){c=Me(a,b);var e=b>>13&31;d.push(c);d.push(e);a.V&32&&(d.push(a.Fa[e]),d.push(b&8191))}else if(a.tb){var e=a.N<<1,f=b>>13;7>13;a.V&a.Ed[a.N]||(d&=7);e=a.B[a.N][d];f=(a.M[a.N][d]<<6)+(b&8191)&a.eb;3932160<=f&&(f=Me(a,f));if(a.oa)return f;f>=a.zd&&f>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&& +(g|=16384));a.B[a.N][d]=e;if(f!=(4194170&a.eb)||a.N)a.ub=a.N,a.mb=d;g&&(g&57344&&(0<=a.Za&&(g|=128),a.U&57344||(g|=a.U&4096|a.ub<<5|a.mb<<1,ud(a,a.U&-61695|g&61694)),a.sa(168,64,-2)),a.U&61440||!(f<(4191360&a.eb)||f>(4194239&a.eb))||(a.U|=4096,a.U&512&&(a.i|=64)));return f}function Le(a){var b=a.na(a.g[6]|a.Ga);a.g[6]=a.g[6]+2&65535;return b}function Je(a,b){var c=a.g[6]-2&65535;a.g[6]=c;a.O=a.O&65535|(a.O&-65536)<<8|16121856;a.i&256||a.Db(4,-2,c);a.Ab(c,b)} +function Oe(a,b,c,d){var e,f,g=d&8?0:a.Ga;switch(b){case 0:return a.sa(4,0,-3),0;case 1:return 6==c&&a.Db(d,0,a.g[6]),a.b-=3,7==c?a.g[c]:a.g[c]|g;case 2:f=2;e=a.g[c];6==c&&a.Db(d,f,e);7!=c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.g[c];7!=c&&(e|=g);e=a.na(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.g[c]+f&65535;6==c&&a.Db(d,f,e);7!=c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.g[c]-2&65535;7!=c&&(e|=g);e=a.na(e)|g;a.b-=8;break;case 6:return e=a.na(Ee(a,2)),e=e+a.g[c]&65535,6==c&&a.Db(d, +0,e),a.b-=6,e|g;case 7:return e=a.na(Ee(a,2)),e=e+a.g[c]&65535,e=a.na(e|a.Ga),a.b-=10,e|g}a.g[c]=a.g[c]+f&65535;a.O=a.O&65535|(a.O&-65536)<<8|(f<<3&248|c)<<16;return e}h.af=function(a,b,c){!this.N&&0>=b&&c<=this.va&&(this.i|=32)};h.bf=function(a,b,c){this.N||(65534<=c&&(c|=-65536),a&4&&c<=this.va&&(c<=this.va-32?this.sa(4,0,-4):(this.P|=8,this.i|=32)))};h.Wd=function(a){this.F&&Zd(this.F,a,1);return this.Lc(a)};h.ae=function(a){this.F&&Zd(this.F,a,2);return this.Mc(a)}; +h.fe=function(a,b){this.F&&$d(this.F,a,1);this.Nc(a,b)};h.ge=function(a,b){this.F&&$d(this.F,a,2);this.Qc(a,b)};function Ac(a,b){a.oa++;b=a.C.oc(yc(a,b,2));a.oa--;return b}function Pe(a,b){(b?--a.gc:--a.fc)||we(a)}h.df=function(a,b,c){return Oe(this,a,b,c)};h.$d=function(a,b,c){return yc(this,Oe(this,a,b,c),c)};h.ee=function(a){return this.C.oc(this.cb=a)};h.qg=function(a){this.F&&Zd(this.F,a,2);return this.ee(a)};h.gd=function(a){return this.C.oc(this.cb=yc(this,a,2))}; +h.rg=function(a){this.F&&Zd(this.F,a,2);return this.gd(a)};h.je=function(a,b){this.C.Sb(this.cb=a,b)};h.Bh=function(a,b){this.F&&$d(this.F,a,2);this.je(a,b)};h.md=function(a,b){this.C.Sb(this.cb=yc(this,a,4),b)};h.Ch=function(a,b){this.F&&$d(this.F,a,2);this.md(a,b)};function Qe(a,b,c){var d=a.j=b&7;(b=a.v=(b&56)>>3)?(d=Oe(a,b,d,2),c&65536||61440!==(a.w&61440)&&(d&=65535),a.N=a.w>>12&3,c=a.na(d|c&a.Ga),a.N=a.w>>14&3):c=6!=d||(a.w>>2&12288)===(a.w&12288)?a.g[d]:a.W[a.w>>12&3];return c} +function Re(a,b,c,d){a.O=a.O&65535|1441792;var e=a.j=b&7;(b=a.v=(b&56)>>3)?(e=Oe(a,b,e,4),c&65536||(e&=65535),a.N=a.w>>12&3,e=yc(a,e|c&65536,4),a.N=a.w>>14&3,a.Zb(e,d)):6!=e||(a.w>>2&12288)===(a.w&12288)?a.g[e]=d:a.W[a.w>>12&3]=d}function Se(a,b){b>>=6;var c=a.Y=b&7;return(b=a.X=(b&56)>>3)?a.Xb(a.Ea(b,c,3)):a.g[c+a.mc]&a.Fd}function Te(a,b){var c;b>>=6;var d=a.Y=b&7;(b=a.X=(b&56)>>3)?c=a.Yb(a.Ea(b,d,2)):c=a.g[d+a.mc];return c}function Ue(a,b){var c=a.j=b&7;b=a.v=(b&56)>>3;return Oe(a,b,c,8)} +function Ve(a,b){var c=a.j=b&7;return(b=a.v=(b&56)>>3)?a.Xb(a.Ea(b,c,3)):a.g[c]&255}function We(a,b){var c,d=a.j=b&7;(b=a.v=(b&56)>>3)?c=a.Yb(a.Ea(b,d,2)):c=a.g[d];return c}function Xe(a,b,c,d){var e=a.j=b&7;(b=a.v=(b&56)>>3)?(e=a.Hc=a.Ea(b,e,7),c=0>c?a.g[-c-1]&255:c,a.Ec(e,d.call(a,c,a.Xb(e))),e&1&&a.b--):(b=a.g[e],c=0>c?a.g[-c-1]&255:c,a.g[e]=b&65280|d.call(a,c,b&255))} +function R(a,b,c,d){var e=a.j=b&7;(b=a.v=(b&56)>>3)?(e=a.Ea(b,e,6),a.Zb(e,d.call(a,0>c?a.g[-c-1]:c,a.Yb(e)))):a.g[e]=d.call(a,0>c?a.g[-c-1]:c,a.g[e])}function tf(a,b,c,d,e){var f=a.j=b&7;(b=a.v=(b&56)>>3)?(d=a.Ea(b,f,5),e.call(a,(c=0>c?a.g[-c-1]&255:c)<<8),a.Ec(d,c),d&1&&a.b--):(c?(c=0>c?a.g[-c-1]&255:c,a.g[f]=a.g[f]&~d|c<<24>>24&d):a.g[f]&=~d,e.call(a,c<<8))} +function uf(a,b,c,d){var e=a.j=b&7;(b=a.v=(b&56)>>3)?(e=a.Ea(b,e,4),d.call(a,c=0>c?a.g[-c-1]:c),a.Zb(e,c)):(a.g[e]=c=0>c?a.g[-c-1]:c,d.call(a,c))} +h.pc=function(a){this.A.complete=!0;var b=this.F?vf(this.F)?1:this.A.Dc?-1:0:0,c=a?this.A.Dc?0:1:-1;this.A.Dc=!1;this.gb=this.b=a;this.i=this.i&-5|(b?4:0);do{if(this.i){if(this.i&4){if(wf(this.F,this.g[7],c)){this.aa();break}++b||(this.i&=-5);c||c++}if(a=this.i&11)if(a=!1,this.i&2){var d=160,e=(this.$a&224)>>5,f=this.R&&this.R.kb>e?this.R:null;f&&(d=f.yb,e=f.kb);e>(this.w&224)>>5?(this.i&8&&(Ee(this,2),this.i&=-9),this.sa(d,0,-10),e=!0):e=!1;e&&(f&&Fe(this,f),a=!0);this.R||this.$a||(this.i&=-3)}else this.i& +1&&this.i++;if(a){if(this.i&4&&wf(this.F,this.g[7],c)){this.aa();break}if(0>c)break}if(this.i&112&&Ge(this)){if(this.i&4&&wf(this.F,this.g[7],c)){this.aa();break}if(0>c)break}}this.i=this.i&15|this.w&16;a=this.O=this.g[7];f=this.na(a);this.g[7]=a+2&65535;this.yd(f)}while(0>1|b<<16;He(this,a);return a&65535}function Cf(a,b){a=b&128|b>>1|b<<8;He(this,a<<8);return a&255}function Df(a,b){a=b&~a;this.Da(a);return a}function Ef(a,b){a=b&~a;this.Da(a<<8);return a} +function Ff(a,b){a|=b;this.Da(a);return a}function Gf(a,b){a|=b;this.Da(a<<8);return a}function Hf(a,b){a=~b|65536;this.lb(a);return a&65535}function If(a,b){a=~b|256;this.lb(a<<8);return a&255}function Jf(a,b){this.I=this.L=a=b-a;this.G=b&(b^a);return a&65535}function Kf(a,b){a=b-a;var c=a<<8;b<<=8;this.I=this.L=c;this.G=b&(b^c);return a&255}function Lf(a,b){this.I=this.L=a=b+a;this.G=a&(b^a);return a&65535}function Mf(a,b){a=b+a;var c=a<<8;this.I=this.L=c;this.G=c&(b<<8^c);return a&255} +function Nf(a,b){a=-b;this.lb(a,a&b&32768);return a&65535}function Of(a,b){a=-b;this.lb(a<<8,(a&b&128)<<8);return a&255}function Pf(a,b){a=b<<1|this.D>>16&1;He(this,a);return a&65535}function Qf(a,b){a=b<<1|this.D>>16&1;He(this,a<<8);return a&255}function Rf(a,b){a=(this.D&65536|b)>>1|b<<16;He(this,a);return a&65535}function Sf(a,b){a=((this.D&65536)>>8|b)>>1|b<<8;He(this,a<<8);return a&255}function Tf(a,b){var c=b-a;Ie(this,c,a,b);return c&65535} +function Uf(a,b){var c=b-a;Ie(this,c<<8,a<<8,b<<8);return c&255}function Vf(a,b){this.I=this.L=b&65280;this.G=this.D=0;return(b<<8|b>>8)&65535}function Wf(a,b){a^=b;this.Da(a);return a&65535}function Xf(a){R(this,a,Te(this,a),xf);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)} +function Yf(a){var b=We(this,a);a=a>>6&7;var c=this.g[a];c&32768&&(c|=4294901760);this.D=this.G=0;b&=63;if(b&32)b=64-b,16>=b;else if(b)if(16>15&65535;d&&65535!==d&&(this.G=32768)}this.g[a]=c&65535;this.I=this.L=c;this.b-=(this.v?6:7)+b} +function Zf(a){var b=We(this,a);a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.D=this.G=0;b&=63;if(b&32){b=64-b;32>b-1;this.D=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<>15,d<<=1,32>=32-b)&&4294967295!==(c|4294967295<>16&65535;this.g[a|1]=d&65535;this.I=d>>16;this.L=d>>16|d;this.b-=(this.v?6:7)+b}function $f(a){P(this,a,!Ae(this))}function ag(a){P(this,a,Ae(this))} +function bg(a){R(this,a,Te(this,a),Df);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function cg(a){Xe(this,a,Se(this,a),Ef);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function dg(a){R(this,a,Te(this,a),Ff);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function eg(a){Xe(this,a,Se(this,a),Gf);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)} +function fg(a){var b=Te(this,a);a=We(this,a);this.Da((0>b?this.g[-b-1]:b)&a);this.b-=this.v?4+(this.Y&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)}function gg(a){var b=Se(this,a);a=Ve(this,a);this.Da(((0>b?this.g[-b-1]&255:b)&a)<<8);this.b-=this.v?4+(this.Y&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)}function hg(a){P(this,a,Ce(this))}function ig(a){P(this,a,!De(this)==!Be(this))}function jg(a){P(this,a,!Ce(this)&&!De(this)==!Be(this))}function kg(a){P(this,a,!Ae(this)&&!Ce(this))} +function lg(a){P(this,a,Ce(this)||!De(this)!=!Be(this))}function mg(a){P(this,a,Ae(this)||Ce(this))}function ng(a){P(this,a,!De(this)!=!Be(this))}function og(a){P(this,a,De(this))}function pg(a){P(this,a,!Ce(this))}function qg(a){P(this,a,!De(this))}function rg(){this.sa(12,0,-9)}function sg(a){P(this,a,!0)}function tg(a){P(this,a,!Be(this))}function ug(a){P(this,a,Be(this))}function vg(a){a&1&&(this.D=0);a&2&&(this.G=0);a&4&&(this.L=1);a&8&&(this.I=0);this.b-=5} +function wg(a){var b=Te(this,a);a=We(this,a);var c=(b=0>b?this.g[-b-1]:b)-a;Ie(this,c,a,b);this.b-=this.v?4+(this.Y&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)}function xg(a){var b=Se(this,a);a=Ve(this,a);var c=(b=(0>b?this.g[-b-1]&255:b)<<8)-(a<<=8);Ie(this,c,a,b);this.b-=this.v?4+(this.Y&&6<=this.j?1:0):(this.X?4:3)+(7==this.j?2:0)} +function yg(a){var b=We(this,a);if(b){a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.D=this.G=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.g[a]=d&65535,this.g[a|1]=c-d*b&65535,this.L=d>>16|d,this.I=d>>16):(this.G=32768,this.L=d>>15|d,this.I=c>>16,-1===b&&65534===this.g[a]&&(this.g[a]=this.g[a|1]=1));this.b-=53}else this.L=this.I=0,this.G=32768,this.D=65536,this.b-=7}function zg(){this.sa(24,0,-9);this.b-=20} +function Ag(){this.w&49152?(this.P|=128,this.sa(4,0,-8)):(this.ta&&1120==this.ia&&this.ta.setData(this.g[0],!0),this.F?Bg(this.F):this.aa());this.b-=7}function Cg(){this.sa(16,0,-9);this.b-=20}var Dg=[0,7,7,10,7,11,9,13];function Eg(a){this.ja=this.b;ye(this,Ue(this,a));this.b=this.ja-Dg[this.v]}var Fg=[0,14,14,17,14,18,16,20];function Gg(a){this.ja=this.b;var b=Ue(this,a);a=a>>6&7;Je(this,this.g[a]);this.g[a]=this.g[7];ye(this,b);this.b=this.ja-Fg[this.v]} +var Hg=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Ig(a){var b=Te(this,a);this.ja=this.b;uf(this,a,b,this.Da);this.b=this.ja-Hg[(this.X?8:0)+this.v]+(7!=this.j||this.v?0:2)}function Jg(a){var b=Se(this,a);tf(this,a,b,65535,this.Da);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}var Kg=[7,13,13,17,14,18,17,21]; +function Lg(a){var b=We(this,a);a=a>>6&7;b=(b<<16>>16)*(this.g[a]<<16>>16);this.g[a]=b>>16&65535;this.g[a|1]=b&65535;b|=0;this.I=b>>16;this.L=this.I|b;this.G=0;this.D=-32768>b||32767>6;if(this.g[b]=this.g[b]-1&65535)ye(this,this.g[7]-((a&63)<<1)),this.b+=1;this.b-=6}function Sg(a){R(this,a,Te(this,a),Tf);this.b-=this.v?9+(this.Y&&6<=this.j?1:0):(this.X?5:3)+(7==this.j?2:0)}function Tg(a){R(this,a,0,Vf);this.b-=this.v?9:3+(7==this.j?2:0)}function Ug(){this.sa(28,0,-9)} +function Vg(){this.ta&&(this.ta.kd(this.g[7],!0),this.ta.setData(this.g[0],!0));this.i|=8;Ee(this,-2);this.b-=3}function Wg(a){R(this,a,this.g[(a>>6&7)+this.mc],Wf);this.b-=this.v?9:3+(7==this.j?2:0)}function S(a){var b;if(b=this.F)b=this.F,A(b,1)?(D(b,"undefined opcode "+K(b,a),!0,!0),b=Bg(b)):b=!1;b||this.sa(8,0,-9)}function ue(a){Xg[a>>12].call(this,a)}function Yg(a){Zg[a>>6&3].call(this,a)}function $g(a){ah[a>>6&3].call(this,a)}function bh(a){ch[a>>6&3].call(this,a)} +function dh(a){eh[a&15].call(this,a)}function fh(a){gh[a&15].call(this,a)}function hh(a){ih[a>>6&3].call(this,a)}function jh(a){kh[a>>6&3].call(this,a)}function lh(a){mh[a>>6&3].call(this,a)} +var Xg=[function(a){nh[a>>8&15].call(this,a)},Ig,wg,fg,bg,dg,Xf,S,function(a){oh[a>>8&15].call(this,a)},Jg,xg,gg,cg,eg,Sg,S],nh=[function(a){ph[a>>4&15].call(this,a)},sg,pg,hg,ig,ng,jg,lg,Gg,Gg,Yg,$g,bh,S,S,S],Zg=[function(a){uf(this,a,0,this.lb);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){R(this,a,0,Hf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){R(this,a,1,Lf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){R(this,a,1,Jf);this.b-=this.v?9:3+(7==this.j?2:0)}],ah=[function(a){R(this,a,0,Nf); +this.b-=this.v?11:6},function(a){R(this,a,Ae(this)?1:0,xf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){R(this,a,Ae(this)?1:0,Tf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){a=We(this,a);this.lb(a);this.b-=this.v?4:3+(7==this.j?2:0)}],ch=[function(a){R(this,a,0,Rf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){R(this,a,0,Pf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){R(this,a,0,Bf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){R(this,a,0,zf);this.b-=this.v?9:3+(7==this.j?2:0)}],ph= +[function(a){qh[a&15].call(this,a)},S,S,S,Eg,Eg,Eg,Eg,Og,S,dh,fh,Tg,Tg,Tg,Tg],qh=[Ag,Vg,Pg,rg,Cg,Ng,S,S,S,S,S,S,S,S,S,S],eh=[Mg,function(){this.D=0;this.b-=5},function(){this.G=0;this.b-=5},vg,function(){this.L=1;this.b-=5},vg,vg,vg,function(){this.I=0;this.b-=5},vg,vg,vg,vg,vg,vg,vg],gh=[Mg,function(){this.D=65536;this.b-=5},function(){this.G=32768;this.b-=5},Qg,function(){this.L=0;this.b-=5},Qg,Qg,Qg,function(){this.I=32768;this.b-=5},Qg,Qg,Qg,Qg,Qg,Qg,Qg],oh=[qg,og,kg,mg,tg,ug,$f,ag,zg,Ug,hh,jh, +lh,S,S,S],ih=[function(a){tf(this,a,0,255,this.lb);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){Xe(this,a,0,If);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){Xe(this,a,1,Mf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){Xe(this,a,1,Kf);this.b-=this.v?9:3+(7==this.j?2:0)}],kh=[function(a){Xe(this,a,0,Of);this.b-=this.v?11:6},function(a){Xe(this,a,Ae(this)?1:0,yf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){Xe(this,a,Ae(this)?1:0,Uf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){a=Ve(this, +a);this.lb(a<<8);this.b-=this.v?4:3+(7==this.j?2:0)}],mh=[function(a){Xe(this,a,0,Sf);this.b-=this.v?9+(this.Hc&1):3+(7==this.j?2:0)},function(a){Xe(this,a,0,Qf);this.b-=this.v?9:3+(7==this.j?2:0)},function(a){Xe(this,a,0,Cf);this.b-=this.v?9+(this.Hc&1):3+(7==this.j?2:0)},function(a){Xe(this,a,0,Af);this.b-=this.v?9:3+(7==this.j?2:0)}];function ve(a){rh[a>>12].call(this,a)} +var rh=[function(a){sh[a>>8&15].call(this,a)},Ig,wg,fg,bg,dg,Xf,function(a){th[a>>8&15].call(this,a)},function(a){uh[a>>8&15].call(this,a)},Jg,xg,gg,cg,eg,Sg,S],sh=[function(a){vh[a>>4&15].call(this,a)},sg,pg,hg,ig,ng,jg,lg,Gg,Gg,Yg,$g,bh,function(a){wh[a>>6&3].call(this,a)},S,S],wh=[function(a){a=this.g[7]+((a&63)<<1)&65535;var b=this.na(a|this.Ga);ye(this,this.g[5]);this.g[6]=a+2&65535;this.g[5]=b;this.b-=8},function(a){a=Qe(this,a,0);this.Da(a);Je(this,a);this.b-=11},function(a){var b=Le(this); +this.ja=this.b;this.Da(b);Re(this,a,0,b);this.b=this.ja-Kg[this.v]},function(a){uf(this,a,De(this)?65535:0,this.Da);this.b-=this.v?9:3+(7==this.j?2:0)}],vh=[function(a){xh[a&15].call(this,a)},S,S,S,Eg,Eg,Eg,Eg,Og,function(a){!(a&8)||1145>this.ia?S.call(this,a):(this.w&49152||(this.w=this.w&-225|(a&7)<<5,this.i|=1,this.i&=-3),this.b-=5)},dh,fh,Tg,Tg,Tg,Tg],xh=[Ag,Vg,function(){Ke(this);this.i|=this.w&16;this.b-=13},rg,Cg,Ng,Pg,function(a){S.call(this,a)},S,S,S,S,S,S,S,S],th=[Lg,Lg,yg,yg,Yf,Yf,Zf,Zf, +Wg,Wg,S,S,S,S,Rg,Rg],uh=[qg,og,kg,mg,tg,ug,$f,ag,zg,Ug,hh,jh,lh,function(a){1145>this.ia?S.call(this,a):yh[a>>6&3].call(this,a)},S,S],yh=[function(a){S.call(this,a)},function(a){a=Qe(this,a,65536);this.Da(a);Je(this,a);this.b-=11},function(a){var b=Le(this);this.ja=this.b;this.Da(b);Re(this,a,65536,b);this.b=this.ja-Kg[this.v]},function(a){S.call(this,a)}]; +function zh(a){q.call(this,"ROM",a,128);this.ea=this.g=null;this.v=+a.addr;this.b=+a.size;this.w=!1;this.i=a.alias;"string"==typeof this.i&&(this.i=eval(this.i));this.j=a.file;this.B=Ta(this.j);if(this.j){a=this.j;var b=Ua(this.B);"json"!=b&&"hex"!=b&&(a=hb()+"/api/v1/dump?file="+this.j+"&format=bytes&decimal=true");var c=this;fb(a,null,!0,function(a,b,f){f?(c.S("Unable to load ROM resource (error "+f+": "+a+")"),c.j=null):(va(c.pb,a,b),(a=gb(a,b))?(c.g=a.ba,c.ea=a.ea):c.j=null);Ah(c)})}}p(zh,q); +h=zh.prototype;h.za=function(a,b,c,d){this.C=b;this.f=c;this.F=d;Ah(this)};h.Ca=function(){this.ea&&(this.F&&Bh(this.F,this.id,this.v,this.b,this.ea),delete this.ea);return!0};h.Ba=function(){return!0}; +function Ah(a){if(!Ia(a)){if(a.j){if(!a.g||!a.C)return;a.b||(a.b=a.g.length);if(a.g.length!=a.b)Ga(a,"ROM size ("+F(a.g.length,8,!0)+") does not match specified size ("+F(a.b,8,!0)+")");else{var b;a:{b=a.v;if(57344<=b&&b<57344+Rc){var c={},c=(c[b]=[zh.prototype.cg,zh.prototype.lh,null,null,null,a.b>>1],c);if(bc(a.C,a,c)){a.status("Added "+a.b+"-byte ROM at "+E(b));b=a.w=!0;break a}}else if(Xc(a.C,b,a.b,Gd)){for(c=0;c>>f.g;0>>=f.g;0>>a.g;0=b.length){D(a,"invalid block at offset "+Sa(n),4096);break}for(var l=l+2,r=b[l++]&255|(b[l++]&255)<<8,u=b[l++]&255|(b[l++]&255)<<8,m=m+((r&255)+(r>>8)+(u&255)+(u>>8)),t=l,C=r-=6;0=b.length){D(a,"insufficient data for block at offset "+Sa(n),4096); +break}m+=b[l++]&255;if(m&255){D(a,"invalid checksum ("+F(m,2,!0)+") for block at offset "+Sa(n),4096);break}if(C)for(D(a,"loading "+Sa(C)+" bytes at "+Sa(u)+"-"+Sa(u+C),4096);C--;)fd(a.C,u++,b[t++]&255);else u&1?g=!0:null==d&&(d=u),null!=d&&D(a,"starting address: "+Sa(d),4096);k=!0}else l++;else l+=2}if(!k&&(null==c&&(c=e),null!=c)){for(e=0;e=ta.nd&&c<=ta.Xe&&(b=c-(ta.nd-ta.le));b&&(a.preventDefault&&a.preventDefault(),d.Bc(b));return!0},c.onkeypress=function(a){a=a||window.event;if(!a.metaKey){var b=a.which||a.keyCode;a.altKey&&b==ta.ne&&(b=ta.me);d.Bc(b);a.preventDefault&&a.preventDefault()}return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation(); +a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.Bc(a.getData("Text"))},c.removeAttribute("readonly"),!0}return!1}; +h.za=function(a,b,c,d){this.K=a;this.C=b;this.f=c;this.F=d;var e=this;this.P=od(this.f,this.M?-1:48,4,262144);this.R=ld(this.f,function(){var a;a=-1;e.i.length&&(a=e.i.shift()&255,D(e,"receiveByte("+F(a,2,!0)+")"),e.L&&97<=a&&122>a&&(a-=32),nd(e.f,e.R,1E3/Math.round(e.U/10)));0<=a&&(e.D=a,e.b&128?e.D|=49152:e.b|=128,e.b&64&&md(c,e.P))});this.N=od(this.f,this.M?-1:52,4,262144);this.X=ld(this.f,function(){e.g|=128;e.g&64&&md(c,e.N)});bc(b,this,Ih,this.M?64832+8*(this.M-1)-65392:0);dc(b,this.reset.bind(this)); +y(this)};h.be=function(a){if(!this.j){var b=ee(this.K,"connection");if(b){var c=b.split("->");if(2==c.length){var d=Za(c[0]);if(d!=this.Eb)return;c=Za(c[1]);if(this.j=Ba(c)){var e=this.j.exports;if(e){var f=e.connect;f&&f.call(this.j,this.I);if(this.G=e.receiveData){this.I=a;this.O=e.receiveStatus;this.status("Connected "+this.pb+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; +h.Ca=function(a,b){if(!b)if(this.be(this.I),!a)this.reset();else if(!this.restore(a))return!1;return!0};h.Ba=function(a){return a?this.save():!0};h.reset=function(){Jh(this)};h.save=function(){var a=new G(this);a.set(0,[this.D,this.b,this.g,this.i]);return a.data()};h.restore=function(a){return Jh(this,a[0])};function Jh(a,b){b||(b=[0,8192,128,a.i]);b=ja(b);a.D=b.next().value;a.b=b.next().value;a.g=b.next().value;a.i=b.next().value;return!0} +h.Bc=function(a){if("number"==typeof a)this.i.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.W||8,c=a-this.B%a,this.W&&(b=Ya("",c)));this.V&&!this.B&&c&&(b=String.fromCharCode(this.V)+b);this.v.value+=b;this.v.scrollTop=this.v.scrollHeight;this.B+=c}}else if(null!=this.w){if(10== +a||1024<=this.w.length)this.u(this.w),this.w="";10!=a&&(this.w+=String.fromCharCode(a))}nd(this.f,this.X,1E3/Math.round(this.Y/10));this.g&=-129};var Hh="buffer",Kh={},Ih=(Kh[65392]=[null,null,Gh.prototype.Qf,Gh.prototype.Yg,"RCSR"],Kh[65394]=[null,null,Gh.prototype.Pf,Gh.prototype.Xg,"RBUF"],Kh[65396]=[null,null,Gh.prototype.vg,Gh.prototype.Eh,"XCSR"],Kh[65398]=[null,null,Gh.prototype.ug,Gh.prototype.Dh,"XBUF"],Kh); +yb(function(){for(var a=x(document,w,"serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.H[b]=c,!0;case "readTape":e=Oh;case "loadTape":return e||(e=Ph),this.H[b]=c,c.onclick= +function(){var a=d.H.listTapes;a&&Qh(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.N){c.parentNode.removeChild(c);break}this.H[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Qh(d,Ta(b,!0),b,Ph,a)}return!1};return!0;case Rh:return this.H[b]=c,!0}return!1}; +h.za=function(a,b,c,d){this.K=a;this.C=b;this.f=c;this.F=d;this.I=Sh(a);var e=this;if(a=Lh(this,ee(this.K,"autoMount")))for(var f in a)"PTR"==f&&(this.M[f]=a[f]);this.G=od(this.f,56,4,4096);this.P=ld(this.f,function(){1==(e.b&32769)&&!(e.b&128)&&e.Bc.indexOf("/api/v1/dump")&&(e=Ua(c),f="json"==e||"gz"==e?encodeURI(c):hb()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!fb(f,null,!0,function(e,f,g){var k=0>g&&!!a.K&&!a.K.A.Z;g?a.S('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(va(a.pb,e,f),(e=gb(e,f))&&ci(a,b,c,d,e.ba,e.xa, +e.wa));a.A.jb=!1;a.g&&(a.g--,a.g||y(a));$h(a)})}function Vh(a,b,c,d){if((a=a.H.listTapes)&&a.options){for(var e=0;e>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.ca);for(d=0;dc.indexOf("/api/v1/dump")&&(b=Ua(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):Va(c,"/")&&(d="dir"),f=hb()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.dd?"":e)+"&format=json"));return!!fb(f, +null,!0,function(b,c,d){ki(a,b,c,d)})} +function ki(a,b,c,d){var e=null,f=0>d&&!!a.K&&!a.K.A.Z;a.j=!1;if(d)a.controller.S('Unable to load disk "'+a.Va+'" (error '+d+": "+b+")",f);else{va(a.controller.pb,b,c);try{if(0g&&0c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+ +c+")");if(k.length)if(1==k.length)v(k[0]);else{a.ca=k.length;a.ma=k[0].length;a.ga=k[0][0].length;var l=k[0][0][0];a.ya=l&&l.length||512;for(d=c=0;d>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var r=l.data;if(void 0===r){var u=l.bytes;if(void 0!==u&&u.length){for(var t=m<<2,C=u.length;C>2,e=Array(d),f=0;f>2,c=(d>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.j)return!1;if(b>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.Ja?f=a.Sa+a.Ja&&(a.Ja+=f-(a.Sa+a.Ja)+1):(a.Sa=f,a.Ja=1);d[f]=d[f]&~(255<g)break;e|=g<=this.b.length||l>=this.b[k].length||m>=this.b[k][l].length){c="sector (CHS="+k+":"+l+":"+m+") out of range ("+ +b+" changes applied)";b=-1;break}if(this.j){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.b[k][l][m]){for(l=k.data.length;lb&&-2!=b&&this.controller.S("Unable to restore disk '"+this.Va+": "+c);return b}; +h.toJSON=function(){var a;a=0;for(var b;b=mi(this,a++);)oi(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")}; +function oi(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}var gi=0;function Ii(a,b,c,d,e,f){q.call(this,a,b,c);this.L=Ki(this,b.autoMount);this.G=0;this.O=d;this.P=e;this.R=f;this.N=d.rd;this.g=Array(this.N);this.M=!mb("Mobi")&&window&&"FileReader"in window;this.v=[];this.Lb=null;this.exports={selectDrive:this.yg}}p(Ii,q); +function Ki(a,b){if(b&&"string"==typeof b)try{b=eval("("+b+")")}catch(c){v(a.type+" auto-mount error: "+c.message+" ("+b+")"),b=null}return b||{}}h=Ii.prototype; +h.ua=function(a,b,c){var d=this;switch(b){case "listDisks":return this.H[b]=c,c.onchange=function(){var a=d.H.descDisk,b=c.options&&c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){v(d.type+" option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.H[b]=c,c.onchange=function(){var a=La(c.value,10);null!=a&& +Li(d,a)},!0;case "loadDisk":return this.H[b]=c,c.onclick=function(){var a=d.H.listDisks;a&&a.options&&Mi(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.H[b]=c,c.onclick=function(){var a,b=d.H.listDrives,b=b&&La(b.value,10);null==b||0>b||b>=d.g.length||!(a=d.g[b])?d.S("Unable to boot the selected drive"):a.ra?(xe(d.f,0,!0),(a=d.hc(a,0,0,0,512,0,2))&&d.S("Unable to read the boot sector ("+a+")")):d.S("Load a disk into the drive first")},!0;case "saveDisk":if(!this.M){c.parentNode.removeChild(c); +break}this.H[b]=c;c.onclick=function(){var a=d.H.listDrives;if(a&&a.options&&d.g)if(a=d.g[La(a.value,10)||0])if(a=a.ra){var b;b="";for(var c=0,k;k=mi(a,c++);)for(var l=0,m=k.length;lg||9e||e>=a.g.length)a.S("Unable to load the selected drive");else if(c)if(c==Pi)a.S('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Qi){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=Ta(c);a.status("Attempting to load "+c+' as "'+b+'"')}Wi(a,e,b,c,!1,d)}else Si(a,e)} +function Wi(a,b,c,d,e,f){var g=-1,k=a.g[b];k.Ma.toLowerCase()!=d.toLowerCase()&&(g++,Si(a,b,!0),k.cd?a.S(a.type+" busy"):(k.cd=!0,e&&(k.bd=!0,a.G++,A(a)&&D(a,"auto-loading disk: "+c)),k.Hb=!!f,ji(new fi(a,k,"preload"),c,d,f,a.Vd)&&g++));return g} +h.Vd=function(a,b,c,d,e){a.cd=!1;b&&(b.ca>a.ca||b.ma>a.ma)&&(this.S('Disk "'+c+'" too large for drive '+(this.type.substr(0,2)+a.zc)),b=null);b?(a.ra=b,a.Va=c,a.Ma=d,Xi(this,c,d,b),this.S('Loaded disk "'+c+'" in drive '+(this.type.substr(0,2)+a.zc),a.bd||e),this.K&&oe(this.K)):a.Hb=!1;a.bd&&(a.bd=!1,--this.G||y(this));Li(this,a.zc)}; +function Ni(a,b,c,d){if((a=a.H.listDisks)&&a.options){for(var e=0;e=a.ca){m=U.rc;break}n=a.seek(b,c,d+1);if(!n){m=U.Jd;break}r=0;++d>=a.ga&&(d=0,++c>=a.ma&&(c=0,++b))}var u,t;if(0>(u=a.read(n,r++))||0>(t=a.read(n,r++))){m=U.sc;break}if(!k&&(xc(this.C,Me(this.f,f),u|t<<8),kd(this.C))){m=U.Vb;break}r>=a.ya&&(n=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; +h.Fc=function(a,b,c,d,e,f,g,k,l){var m=0;a=a.ra;var n=null,r;a||(m=U.Ad,e=0);for(;e;){var u=zc(this.C,Me(this.f,f));if(kd(this.C)){m=U.Vb;break}if(!n){if(b>=a.ca){m=U.rc;break}n=a.seek(b,c,d+1,!0);if(!n){m=U.Jd;break}r=0;++d>=a.ga&&(d=0,++c>=a.ma&&(c=0,++b))}if(k){var t,C;if(0>(t=a.read(n,r++))||0>(C=a.read(n,r++))){m=U.sc;break}if(u!=(t|C<<8)){m=U.Od;break}}else if(!a.write(n,r++,u&255)||!a.write(n,r++,u>>8)){m=U.sc;break}r>=a.ya&&(n=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; +h.De=function(a,b,c,d,e,f){this.w=f&65535;this.b=this.b&~T.Cb|f>>16-T.ka.Cb&T.Cb;this.B=65536-e&65535;this.j=this.j&~aj.Xc|d&aj.Xc;this.i|=a;bj(this);return!0};function bj(a){a.b&=~T.Ub;a.i&&(a.i|=U.qe,a.b|=T.Ub,a.i&U.Oc&&(a.b|=T.Oc),A(a)&&D(a,a.type+": ERROR: "+E(a.i)))}h.Vf=function(){return this.I};h.dh=function(){};h.Wf=function(){return this.i};h.eh=function(){};h.Sf=function(){return this.b&T.Wc}; +h.$g=function(a){this.b=this.b&~T.qb|a&T.qb;if(this.b&T.vd){a=!0;var b,c,d="",e=(this.j&aj.nb)>>aj.ka.nb,f=this.g[e],g,k,l,m,n,r;this.b&=~(T.Xa|T.Yc);this.i&=~U.Oe;switch(c=this.b&T.Pa){case cj.ke:A(this)&&D(this,this.type+": CRESET("+e+")",!0);this.i=this.j=0;this.b=T.Xa;break;case cj.ze:d="RCHK";case cj.Be:d||(d="READ"),b=this.hc;case cj.Zc:d||(d="WCHK");case cj.We:d||(d="WRITE");b||(b=this.Fc);g=(this.j&aj.Tb)>>aj.ka.Tb;k=(this.j&aj.Pc)>>aj.ka.Pc;l=this.j&aj.Xc;m=65536-this.B&65535;n=(this.b&T.Cb)<< +16-T.ka.Cb|this.w;r=this.b&T.xe?0:2;A(this)&&D(this,this.type+": "+d+"("+g+":"+k+":"+l+") "+E(n)+"--"+E(n+(m<<1)),!0,!0);if(g>=f.ca){this.i|=U.rc;break}if(l>=f.ga){this.i|=U.sc;break}a=b.call(this,f,g,k,l,m,n,r,c>=cj.Zc,this.De.bind(this));break;case cj.xc:g=(this.j&aj.Tb)>>aj.ka.Tb;A(this)&&D(this,this.type+": SEEK("+g+")",!0);g(n=a.read(k,m++))||0>(r=a.read(k,m++))){g=fj.Ya;break}xc(this.C,Me(this.f,f),n|r<<8);if(kd(this.C)){g=fj.Vb;break}f+=2;e--;if(m>=a.ya&&(k=null,++d>=a.ga&&(d=0,++c>=a.ma&&(c=0,++b>=a.ca)))){g=fj.Ya;break}}return l?l(g,b,c,d,e,f):g}; +h.Fc=function(a,b,c,d,e,f,g,k,l){g=0;a=a.ra;k=null;var m;a||(g=fj.Ya,e=0);for(;e;){var n=zc(this.C,Me(this.f,f));if(kd(this.C)){g=fj.Vb;break}f+=2;e--;if(!k){k=a.seek(b,c,d+1,!0);if(!k){g=fj.Ya;break}m=0}if(!a.write(k,m++,n&255)||!a.write(k,m++,n>>8)){g=fj.Ya;break}if(m>=a.ya&&(k=null,++d>=a.ga&&(d=0,++c>=a.ma&&(c=0,++b>=a.ca)))){g=fj.Ya;break}}return l?l(g,b,c,d,e,f):g}; +h.Ie=function(a,b,c,d,e,f){this.D=f&65535;this.b=this.b&~V.Wa|f>>16-V.ka.Wa&V.Wa;this.w=f>>16&gj.Vc;this.j=this.i=b<>V.ka.Wa;if(!(this.b&V.Xa)){a=!0;var b,c="",d=this.g[(this.b&V.nb)>>V.ka.nb],e=d.ra,f,g,k;this.b&=~V.Bb;switch(this.b&V.Pa){case ij.Se:this.B&jj.wd&&(this.b&=V.Bb|V.Pa|V.Wa);this.B=d.status|this.j&hj.wc|(e&&512==e.ca?jj.ue:0);break;case ij.xc:(this.i&hj.te)==hj.Pe&&(b=this.i&hj.Wb,c=(this.i&hj.Re)<<2,this.j=this.i&hj.Qe?this.j+b:this.j-b,this.i=this.j=this.j&hj.Wb|c);break;case ij.Ce:this.B=this.j;break;case ij.Ae:c="READ",b=this.hc; +case ij.Ve:c||(c="WRITE"),b||(b=this.Fc),f=this.i>>hj.ka.Wb,g=this.i&hj.wc?1:0,k=this.i&hj.Hd,!e||f>=e.ca||k>=e.ga?this.b=this.b|fj.Ya|V.Ub:(a=65536-this.B&65535,e=(this.w&gj.Vc)<<16|this.D,A(this)&&D(this,this.type+": "+c+"("+f+":"+g+":"+k+") "+E(e)+"--"+E(e+(a<<1)),!0,!0),a=b.call(this,d,f,g,k,a,e,2,!1,this.Ie.bind(this)))}a&&(this.b=this.b|V.Bb|V.Xa,this.b&V.Rc&&md(this.f,this.Lb))}};h.Yf=function(){return this.D};h.gh=function(a){this.D=a&kj.qb};h.ag=function(){return this.i}; +h.jh=function(a){this.i=a};h.bg=function(){return this.B};h.kh=function(a){this.B=a};h.Zf=function(){return this.w};h.hh=function(a){this.w=a&gj.Vc;this.b=this.b&~V.Wa|(this.w&3)<a.v&&a.j.length&&(a.v=0);if(0>a.v||b!=a.j[a.v])a.j.splice(0,0,b),a.v=0;a.v--}else a.O?b="end":b=a.j[a.v+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(Za(b.substring(c,f))),c=f+1}}return a} +function oj(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 fj(a,b,c){var d;if(b){b=gj(a,b);for(var e=0,f=!1,g=b,k=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=8;d=I(c,0,!0)+" "+c+". "+H(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.u((null!=b?b+": ":"")+d);return e} -function kj(a,b){if(b)return jj(a,b,a.T[b]);var c=0;for(b in a.T)jj(a,b,a.T[b]),c++;return 0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; -function lj(a){cj.call(this,a);this.Da=!1;this.ga=!0;this.H=V();this.Ca=V();this.N=V();this.C=[];this.g=this.L=this.G=[];mj(this);this.R=this.ba=0;this.i=[];this.na=void 0;nj(this);this.F=this;this.la={};this.ha=this.cd=0;this.S=null;this.M=[];oj(this,a.messages);this.sa=a.commands;this.Ga=pj;this.W=[];this.I=0;this.Ha=this.ra=null;this.w=this.Fa=this.Ea=this.Y=this.ma=0;this.b=this.V=null;var b=this;window?void 0===window[x]&&(window[x]=function(a){return de(b,a)}):void 0===global[x]&&(global[x]= -function(a){return de(b,a)})}p(lj,cj);function qj(a){a=a&&a.K;null==a&&(a=-1);return a}function V(a,b,c){return{K:void 0===a?null:a,Ka:void 0===b?!1:b,Qa:!1,xa:c}}h=lj.prototype;h.Fc=function(a,b){a.K=b;a.Qa=!1;a.xa=void 0;return a};function rj(a){return[a.K,a.Ka,a.xa,a.Qa,a.fc]}function sj(a,b){var c=V(b[0],b[1],b[2]);c.Qa=b[3];b[4]&&(c.$c=dj(a,c.fc=b[4]));return c} -h.ta=function(a,b,c,d){this.D=b;this.J=a;this.f=c;this.b=a.i;(a=Zd(a,"messages"))&&oj(this,a);1140>this.f.ba&&(this.W=this.W.concat(tj));1145>this.f.ba&&(this.W=this.W.concat(uj));ld(this,16,function(a){a:{var b=d.D.b,c=a[0],e=a=0,l=b.length;if(c){a=qj(vj(d,c));if(-1===a){d.u("invalid address: "+c);break a}e=a>>>d.D.g;l=1}d.u("blockid physical blockaddr used size type");d.u("-------- --------- --------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.u("..."): -(c=n.type,m=Yc[c],n&&d.u(I(n.id,8)+" %"+I(e<d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;db||7a?"R"+a:6==a?"SP":"PC"} -h.jd=function(a){var b;if(0<=a)if(8>a)b=this.f.g[a];else if(16>a)b=this.f.na[a-8];else if(20>a)b=this.f.V[a-16];else{var c=this.f,d=this.b;switch(a){case Bj:b=ud(this.f);break;case Cj:b=c.Va;break;case Dj:b=c.R;break;case Ej:b=c.sa&65280;break;case Fj:b=od(c);break;case Gj:b=qd(c);break;case Hj:b=rd(c);break;case Ij:b=c.T;break;case Jj:d&&(b=d.ua);break;case Kj:d&&(b=d.vb);break;case Lj:d&&Ic(d)&&(b=d.Ya)}}return b}; -h.message=function(a,b){b&&(a+=" @"+yj(this,V(this.f.P&65535)));if(!this.S||a!=this.S)if(this.S=a,this.ha&1073741824)this.M.push(a);else{var c;if(this.ha&-2147483648&&this.f&&(c=this.f.A.U)||Ka(this,!0))this.Z(),c&&(a+=" (cpu halted)");this.u(a);this.f&&(a=this.f,je(a),a.rb=0,a.J&&J(a.J,void 0))}}; -function nj(a){var b;if(!nf(a))a.i&&a.i.length&&a.u("instruction history buffer freed"),a.R=0,a.i=[];else if(!a.i||!a.i.length){a.i=Array(Mj);for(b=0;b>8;a.u("trapped to "+O(a,c&255,1)+" ("+(0>d?Pb[-d]:O(a,d))+")")}a.H=V(a.f.g[7]);b&&1!=a.I?Qj(a):Rj(a)}}function Oj(a,b){var c;(c=!a.f||!Ja(a.f))||(c=a.f,c.A.fa?c=!0:(c.u(c.toString()+" not powered"),c=!1),c=!c);return c||a.f.A.U?(b||a.u("cpu busy or unavailable, command ignored"),!1):!Ea(a.f)}h.za=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0}; -h.ya=function(a,b){b&&this.u(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){nj(this);this.Y=0;this.S=null;this.w=0;this.H=V(this.f.g[7]);this.A.U=!1;Sj(this);a||be(this)};h.save=function(){var a=new M(this);a.set(0,rj(this.H));a.set(1,rj(this.N));a.set(2,[this.j,this.P,this.ha]);a.set(3,this.C);return a.data()}; -h.restore=function(a){var b=0;void 0!==a[2]&&(this.H=sj(this,a[b++]),this.N=sj(this,a[b++]),this.j=a[b][0],"string"==typeof this.j&&(this.j=[this.j]),this.P=a[b][1],this.ha|=a[b][2]);a[3]&&(this.C=a[3]);return!0};h.start=function(a,b){this.I||this.u("running");this.A.U=!0;this.Ea=a;this.Fa=b}; -h.stop=function(a,b){if(this.A.U){this.A.U=!1;this.w=b-this.Fa;if(!this.I){b="stopped";if(this.w){a-=this.Ea;var c=0d&&(d=Ec(a.f,b)),65535!=(d&65535)&&(a.Fc(a.i[a.R],b),++a.R==a.i.length&&(a.R=0)));return!1}function tg(a){var b=a.f;if(b.A.U)throw re(b,a.f.P&65535),a.Z(),-1;return!1}function Td(a,b,c){Tj(a,b,c||1,a.L)&&a.Z(!0)}function Ud(a,b,c){Tj(a,b,c||1,a.G)&&a.Z(!0)} -function mj(a){var b,c,d;a.g=["bp"];if(a.L)for(b=1;b>>c.g],!1)):He(a.f,!1);a.L=["br"];if(a.G)for(b=1;b>>c.g],!0)):He(a.f,!0);a.G=["bw"];a.ma=0} -h.qb=function(a,b,c){var d=!0;c||Uj(this,a,b,!1,!0);if(a!=this.g){var e=qj(b);if(-1===e)this.u("invalid address: "+yj(this,b)),d=!1;else{var f=a==this.G;65535>>g.g].qb(e&g.i,f)}else e=this.f,(f?e.Xb++:e.Wb++)||pe(e)}}d&&(a.push(b),c?b.Qa=!0:(Vj(this,a,a.length-1,"set"),nj(this)));return d}; -function Uj(a,b,c,d,e){var f=!1;c=qj(c);for(var g=1;g>>d.g],b)):He(a.f,b));k.Qa||nj(a);break}}return f}function Wj(a,b){for(var c=1;c>23)&65535,z=O(t,u);else if(D==ck)u=u.K-((f&63)<<1)&65535,z=O(t,u);else if(D==dk)z=O(t,f&7,1);else if(D==ek)z=O(t,f&63,1);else if(D==fk)z=O(t,f&255,1);else if(D=f&E,E&gk&&(D>>=6,E>>=6),E&Y){var E=null,F=D& -hk;switch(D&ik){case 0:z=Aj(F);break;case 8:z="@"+Aj(F);E=jk(t,t.f.g[F]);break;case 16:7>F?z="("+Aj(F)+")+":(D=t.Oa(u,2),z="#"+O(t,D,0,!0));break;case 24:7>F?z="@("+Aj(F)+")+":(D=t.Oa(u,2),z="@#"+O(t,D,0,!0),E=jk(t,D));break;case 32:z="-("+Aj(F)+")";break;case 40:z="@-("+Aj(F)+")";break;case 48:D=t.Oa(u,2);z=O(t,D,0,!0)+"("+Aj(F)+")";7==F&&(z=O(t,D=D+u.K&65535),E=jk(t,D));break;case 56:D=t.Oa(u,2),z="@"+O(t,D)+"("+Aj(F)+")",7==F&&(z="@"+O(t,D=D+u.K&65535),E=jk(t,Ec(t.f,D)))}E&&(z=[z,E])}t=z;if(!t|| -!t.length){k="INVALID";break}"string"!=typeof t&&(m=t[1],t=t[0]);0=a.f.kb&&b=c.C&&(b=c.Ma[b&ed])&&(a=b[4]);return a}function kk(a,b){switch(b){case "N":a=ve(a.f);break;case "Z":a=ue(a.f);break;case "V":a=te(a.f);break;case "C":a=se(a.f);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "} -function Z(a,b){var c="",d=a.f;if(8>b)c=Aj(b),c+="="+O(a,d.g[b]);else if(13>b)c="A"+(b-8)+"="+O(a,d.na[b-8]);else if(16<=b&&20>b)c="S"+(b-16)+"="+O(a,d.V[b-16]);else switch(b){case Bj:c="PS="+O(a,ud(d));break;case Cj:c="PI="+O(a,d.Va);break;case Dj:c="ER="+O(a,d.R);break;case Ej:c="SL="+O(a,d.sa&65280);break;case Fj:c="M0="+O(a,od(d));break;case Gj:c="M1="+O(a,qd(d));break;case Hj:c="M2="+O(a,rd(d));break;case Ij:c="M3="+O(a,d.T);break;case Jj:a.b&&(c="AR="+O(a,a.b.ua,3));break;case Kj:a.b&&(c="DR="+ -O(a,a.b.vb));break;case Lj:a.b&&Ic(a.b)&&(c="SR="+O(a,a.b.Ya,3))}c&&(c+=" ");return c}function lk(a,b){var c,d="";for(c=0;6>c;c++)d+=Z(a,c);d=d+"\n"+(Z(a,6)+Z(a,7));d+=Z(a,Bj)+Z(a,Cj)+Z(a,Ej);d+=kk(a,"T")+kk(a,"N")+kk(a,"Z")+kk(a,"V")+kk(a,"C");b&&(b=d,c=""+(Z(a,Fj)+Z(a,Gj)),c+=Z(a,Hj)+Z(a,Ij)+Z(a,Dj),c=c+"\n"+(Z(a,Lj)+Z(a,Jj)+Z(a,Kj)),d=b+("\n"+c));return d}h.dd=function(a,b){return a[0]>b[0]?1:a[0]>>0,g],r=$a(n,l,a.dd);0>r&&n.splice(-(r+1),0,l)}m&&(k.a=m.replace(/''/g,'"'))}a.C.push({yh:b,K:c,Qd:d,ea:e,ad:f})}function mk(a,b,c){var d=[],e=qj(b)>>>0;for(b=0;b>>0,k=f.Qd;if(e>=g&&eb)){e.g[b]= -g&65535;break}a.u("unknown register: "+f);return}J(a.J);a.u("updated registers:")}}a.u(lk(a,d));c&&(a.H=V(e.g[7]),Rj(a,yj(a,a.H)))}}function qk(a,b){b=Ya(b);var c=b.match(/^(['"])(.*?)\1$/);c?1k[0].indexOf("+"))){var m=k[0]+":";k[2]&&(m+=" "+k[2]);a.u(m)}k[3]&&(g=k[3],f=null);f=Yj(a,b,g,f);a.u(f);a.H=b;e-=b.K-l;c++}}} -function Xj(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.u(Pj+b):(a.P&&(a.u("ended assemble at "+yj(a,a.N)),a.H=a.N,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.S=null;if(Ja(a)&&0n||"z"Ga.length&&(a.u("note: only "+Ga.length+" available"),qa=Ga.length);wa-=qa;0>wa&&(null==Ga[Ga.length-1].K?(qa=wa+qa,wa=0):wa+=Ga.length);var Qe=[];"call"==oi&&(sc=1E5,Qe=["CALL"]);for(void 0!==ni&&a.u(qa+" instructions earlier:");0=Ga.length&&(wa=0);a.na=qa;qi++;sc--}}qi||(a.u("no "+pi+"history available"),a.na=void 0)}else{var ga=vj(a,Fa);if(ga)if("da"==Ta){var Re=ga.Ka||65535K.length?(2ib&&(ib=0);65536Ve?String.fromCharCode(Ve):"."),yd=yd>>8}kb&&(kb+="\n");kb=Se?kb+(lb+","):kb+(Fa+": "+lb+(xd?"":" "+Ue))}kb&&a.u(kb);a.Ca=ga;a.xa=Uk}}}}break;case "e":if("else"==g[0])break;var Lb,We,Xe,Ye,Ze=g[0],$e=g[1];"eb"==Ze? -(Lb=1,We=255,Xe=a.Mc,Ye=a.Nc):"e"==Ze||"ew"==Ze?(Lb=2,We=65535,Xe=a.Oa,Ye=a.yd):$e=null;if(null==$e)a.u("edit memory commands:"),a.u("\teb [a] [...] edit bytes at address a"),a.u("\tew [a] [...] edit words at address a");else{var zd=vj(a,$e);if(zd)for(var Ad=2;Adcf;){for(var mb=null,Yk=256;65536>yc.K>>>0;){df.K=a.Oa(yc,2);if(null==yc.K||!Yk--)break;if(!(df.K&1)){for(var Zk=a,Bd=df,vi=null,zc=Bd.K,wi=zc,ef=1;6>=ef&&zc;ef++){if(2> ";vb(function(){for(var a=y(document,x,"debugger"),b=0;b\nLicense: GPL version 3 or later ");this.u("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis ");for(b=0;byk){if(zk(d,this.I)){this.v=new M(this,"1.32.2",Ik);zk(this.v)&&(Jk(this,d),a=Kk,Lk(this.v));this.v.set(Fk,ab());Mk(this.v);var e=this.b&&!this.G;if(a==Gk||ya("Click OK to restore the previous "+Eb+" machine state, or CANCEL to reset the machine.")){if(c=Ek(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?zk(d,g):("error"==f&&"no machine state"!= -g?(this.O("Error: "+g),"unable to verify user"==g&&(nb(Nk,""),this.g=null)):this.u(f+": "+g),Lk(d),zk(d)?(c=Ek(d),e=!0):c=!1))}e&&Ck(this,c?d:null)}else a==Kk&&d.clear()}else Ck(this);delete this.I;delete this.w}e=za(this.id);for(f=0;fa[1];a=a[2];this.R=!0;this.A.fa=!0;var d=this.B.power;d&&(d.textContent="Shutdown");this.f&&(Ok(this,this.f,b,c,a),J(this),this.f.Ia());this.N&&(Jk(this,b),b.clear());!c&&this.v&&(this.v.clear(),delete this.v);this.j=0}; -function Jk(a,b){if(ya("There may be a problem with your "+Eb+" machine.\n\nTo help us diagnose it, click OK to send this "+Eb+" machine state to http://www.pcjs.org.")){var c=a.V;a=a.g||"";b=b.toString();var d={};d.app=Eb;d.ver="1.32.2";d.url=c;d.user=a;d.type="bug";d.data=b;bb("http://www.pcjs.org/api/v1/report",d,!0)}} -function sk(a,b,c){var d,e="none";if(a.j)return null;a.j--;var f=new M(a,"1.32.2"),g=new M(a,"1.32.2",Dk),k=ab();g.set(Fk,k);f.set(Fk,k);f.set(Pk,"1.32.2");f.set(Qk,window?window.location.href:null);f.set(Tk,window?window.navigator.userAgent:"");a.f&&a.f.ya&&(c&&a.f.Z(),d=a.f.ya(b,c),"object"===typeof d&&f.set(a.f.id,d),c&&(a.f.A.fa=!1,!1===d&&(e=null)));for(var k=za(a.id),l=0;l=d||30<=(c.oc+=d))&&(e.textContent=c.A.U?c.nb.toFixed(2)+"Mhz":"Stopped",c.oc=0)}if(a.i&&(a=a.i,b=b||0,a.v)){c=a.f.A.U;d=!!(a.f.i&8);if(0>=b||60<=(a.j+=b)){for(e=0;ef.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDPjs$2"), -a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){f=null,a=n.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");bb(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],g);jl(a,b,c)}})}else c(a,null)} -function kl(a,b,c,d){function e(a){if(void 0===k){var b=g&&y(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=Sa(a))}function f(a){e("Error: "+a);l&&(--gl||zb(!0));l=!1}var g,k,l=!0;gl++;va[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css";r.styleSheet?r.styleSheet.cssText=m:r.appendChild(document.createTextNode(m));n.appendChild(r)}c|| -(c="/versions/pdpjs/1.32.2/components.xsl");m=function(d,k){k?hl(c,null,null,!1,e,function(d,l){l?(ua(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--gl||zb(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--gl||zb(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?hl(b,a,d,!0,e,m):il(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(u){f(u.message)}return l}window.embedPDP11=function(a,b,c,d){zb(!1);return kl(a,b,c,d)};window.findMachineComponent=function(a,b){return Ba(b,a+".machine")};window.enableEvents=zb;window.sendEvent=Bb;})();//# sourceMappingURL=/tmp/pdpjs/1.32.2/pdp11-dbg.map +function pj(a,b,c){var d;if(b){b=qj(a,b);for(var e=0,f=!1,g=b,k=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=8;d=F(c,0,!0)+" "+c+". "+E(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.u((null!=b?b+": ":"")+d);return e} +function uj(a,b){if(b)return tj(a,b,a.U[b]);var c=0;for(b in a.U)tj(a,b,a.U[b]),c++;return 0=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9}; +function vj(a){mj.call(this,a);this.Ea=!1;this.ha=!0;this.G=W();this.va=W();this.N=W();this.B=[];this.g=this.L=this.D=[];wj(this);this.P=this.Y=0;this.i=[];this.oa=void 0;xj(this);this.F=this;this.ia={};this.fa=this.Sd=0;this.R=null;this.M=[];yj(this,a.messages);this.ta=a.commands;this.Ha=zj;this.W=[];this.I=0;this.Ia=this.pa=null;this.w=this.Ga=this.Fa=this.X=this.ja=0;this.b=this.V=null;var b=this;window?void 0===window[w]&&(window[w]=function(a){return je(b,a)}):void 0===global[w]&&(global[w]= +function(a){return je(b,a)})}p(vj,mj);function Aj(a){a=a&&a.J;null==a&&(a=-1);return a}function W(a,b,c){return{J:void 0===a?null:a,Ka:void 0===b?!1:b,Ra:!1,Aa:c}}h=vj.prototype;h.kd=function(a,b){a.J=b;a.Ra=!1;a.Aa=void 0;return a};function Bj(a){return[a.J,a.Ka,a.Aa,a.Ra,a.Cc]}function Cj(a,b){var c=W(b[0],b[1],b[2]);c.Ra=b[3];b[4]&&(c.Pd=nj(a,c.Cc=b[4]));return c} +h.za=function(a,b,c,d){this.C=b;this.K=a;this.f=c;this.b=a.i;(a=ee(a,"messages"))&&yj(this,a);1140>this.f.ia&&(this.W=this.W.concat(Dj));1145>this.f.ia&&(this.W=this.W.concat(Ej));qd(this,16,function(a){a:{var b=d.C.b,c=a[0],e=a=0,l=b.length;if(c){a=Aj(Fj(d,c));if(-1===a){d.u("invalid address: "+c);break a}e=a>>>d.C.g;l=1}d.u("blockid physical blockaddr used size type");d.u("-------- --------- --------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.u("..."): +(c=n.type,m=cd[c],n&&d.u(F(n.id,8)+" %"+F(e<d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;db||7a?"R"+a:6==a?"SP":"PC"} +h.Zd=function(a){var b;if(0<=a)if(8>a)b=this.f.g[a];else if(16>a)b=this.f.pa[a-8];else if(20>a)b=this.f.W[a-16];else{var c=this.f,d=this.b;switch(a){case Lj:b=Ad(this.f);break;case Mj:b=c.$a;break;case Nj:b=c.P;break;case Oj:b=c.va&65280;break;case Pj:b=td(c);break;case Qj:b=wd(c);break;case Rj:b=xd(c);break;case Sj:b=c.V;break;case Tj:d&&(b=d.da);break;case Uj:d&&(b=d.Ta);break;case Vj:d&&Nc(d)&&(b=d.Ua)}}return b}; +h.message=function(a,b){b&&(a+=" @"+Ij(this,W(this.f.O&65535)));if(!this.R||a!=this.R)if(this.R=a,this.fa&1073741824)this.M.push(a);else{var c;if(this.fa&-2147483648&&this.f&&(c=this.f.A.T)||Ja(this,!0))this.aa(),c&&(a+=" (cpu halted)");this.u(a);this.f&&(a=this.f,pe(a),a.vb=0,a.K&&I(a.K,void 0))}}; +function xj(a){var b;if(!vf(a))a.i&&a.i.length&&a.u("instruction history buffer freed"),a.P=0,a.i=[];else if(!a.i||!a.i.length){a.i=Array(Wj);for(b=0;b>8;a.u("trapped to "+K(a,c&255,1)+" ("+(0>d?Mb[-d]:K(a,d))+")")}a.G=W(a.f.g[7]);b&&1!=a.I?ak(a):bk(a)}}function Yj(a,b){var c;(c=!a.f||!Ia(a.f))||(c=a.f,c.A.Z?c=!0:(c.u(c.toString()+" not powered"),c=!1),c=!c);return c||a.f.A.T?(b||a.u("cpu busy or unavailable, command ignored"),!1):!Ha(a.f)}h.Ca=function(a,b){return!b&&(this.reset(!0),a)?this.restore(a):!0}; +h.Ba=function(a,b){b&&this.u(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){xj(this);this.X=0;this.R=null;this.w=0;this.G=W(this.f.g[7]);this.A.T=!1;ck(this);a||he(this)};h.save=function(){var a=new G(this);a.set(0,Bj(this.G));a.set(1,Bj(this.N));a.set(2,[this.j,this.O,this.fa]);a.set(3,this.B);return a.data()}; +h.restore=function(a){var b=0;void 0!==a[2]&&(this.G=Cj(this,a[b++]),this.N=Cj(this,a[b++]),this.j=a[b][0],"string"==typeof this.j&&(this.j=[this.j]),this.O=a[b][1],this.fa|=a[b][2]);a[3]&&(this.B=a[3]);return!0};h.start=function(a,b){this.I||this.u("running");this.A.T=!0;this.Fa=a;this.Ga=b}; +h.stop=function(a,b){if(this.A.T){this.A.T=!1;this.w=b-this.Ga;if(!this.I){b="stopped";if(this.w){a-=this.Fa;var c=0d&&(d=Ac(a.f,b)),65535!=(d&65535)&&(a.kd(a.i[a.P],b),++a.P==a.i.length&&(a.P=0)));return!1}function Bg(a){var b=a.f;if(b.A.T)throw ye(b,a.f.O&65535),a.aa(),-1;return!1}function Zd(a,b,c){dk(a,b,c||1,a.L)&&a.aa(!1)}function $d(a,b,c){dk(a,b,c||1,a.D)&&a.aa(!1)} +function wj(a){var b,c,d;a.g=["bp"];if(a.L)for(b=1;b>>c.g],!1)):Pe(a.f,!1);a.L=["br"];if(a.D)for(b=1;b>>c.g],!0)):Pe(a.f,!0);a.D=["bw"];a.ja=0;a.Y=0} +h.wb=function(a,b,c){var d=!0;c||ek(this,a,b,!1,!0);if(a!=this.g){var e=Aj(b);if(-1===e)this.u("invalid address: "+Ij(this,b)),d=!1;else{var f=a==this.D;65535>>g.g].wb(e&g.i,f)}else e=this.f,(f?e.gc++:e.fc++)||we(e)}}d&&(a.push(b),c?b.Ra=!0:(fk(this,a,a.length-1,"set"),xj(this)));return d}; +function ek(a,b,c,d,e){var f=!1;c=Aj(c);for(var g=1;g>>d.g],b)):Pe(a.f,b));k.Ra||xj(a);break}}return f}function gk(a,b){for(var c=1;c>23)&65535,z=K(t,u);else if(B==mk)u=u.J-((f&63)<<1)&65535,z=K(t,u);else if(B==nk)z=K(t,f&7,1);else if(B==ok)z=K(t,f&63,1);else if(B==pk)z=K(t,f&255,1);else if(B=f&C,C&qk&&(B>>=6,C>>=6),C&Y){var C=null,H=B& +rk;switch(B&sk){case 0:z=Kj(H);break;case 8:z="@"+Kj(H);C=tk(t,t.f.g[H]);break;case 16:7>H?z="("+Kj(H)+")+":(B=t.Oa(u,2),z="#"+K(t,B,0,!0));break;case 24:7>H?z="@("+Kj(H)+")+":(B=t.Oa(u,2),z="@#"+K(t,B,0,!0),C=tk(t,B));break;case 32:z="-("+Kj(H)+")";break;case 40:z="@-("+Kj(H)+")";break;case 48:B=t.Oa(u,2);z=K(t,B,0,!0)+"("+Kj(H)+")";7==H&&(z=K(t,B=B+u.J&65535),C=tk(t,B));break;case 56:B=t.Oa(u,2),z="@"+K(t,B)+"("+Kj(H)+")",7==H&&(z="@"+K(t,B=B+u.J&65535),C=tk(t,Ac(t.f,B)))}C&&(z=[z,C])}t=z;if(!t|| +!t.length){k="INVALID";break}"string"!=typeof t&&(m=t[1],t=t[0]);0=a.f.ob&&b=c.B&&(b=c.Na[b&jd])&&(a=b[4]);return a}function uk(a,b){switch(b){case "N":a=De(a.f);break;case "Z":a=Ce(a.f);break;case "V":a=Be(a.f);break;case "C":a=Ae(a.f);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "} +function Z(a,b){var c="",d=a.f;if(8>b)c=Kj(b),c+="="+K(a,d.g[b]);else if(13>b)c="A"+(b-8)+"="+K(a,d.pa[b-8]);else if(16<=b&&20>b)c="S"+(b-16)+"="+K(a,d.W[b-16]);else switch(b){case Lj:c="PS="+K(a,Ad(d));break;case Mj:c="PI="+K(a,d.$a);break;case Nj:c="ER="+K(a,d.P);break;case Oj:c="SL="+K(a,d.va&65280);break;case Pj:c="M0="+K(a,td(d));break;case Qj:c="M1="+K(a,wd(d));break;case Rj:c="M2="+K(a,xd(d));break;case Sj:c="M3="+K(a,d.V);break;case Tj:a.b&&(c="AR="+K(a,a.b.da,3));break;case Uj:a.b&&(c="DR="+ +K(a,a.b.Ta));break;case Vj:a.b&&Nc(a.b)&&(c="SR="+K(a,a.b.Ua,3))}c&&(c+=" ");return c}function vk(a,b){var c,d="";for(c=0;6>c;c++)d+=Z(a,c);d=d+"\n"+(Z(a,6)+Z(a,7));d+=Z(a,Lj)+Z(a,Mj)+Z(a,Oj);d+=uk(a,"T")+uk(a,"N")+uk(a,"Z")+uk(a,"V")+uk(a,"C");b&&(b=d,c=""+(Z(a,Pj)+Z(a,Qj)),c+=Z(a,Rj)+Z(a,Sj)+Z(a,Nj),c=c+"\n"+(Z(a,Vj)+Z(a,Tj)+Z(a,Uj)),d=b+("\n"+c));return d}h.Td=function(a,b){return a[0]>b[0]?1:a[0]>>0,g],r=ab(n,l,a.Td);0>r&&n.splice(-(r+1),0,l)}m&&(k.a=m.replace(/''/g,'"'))}a.B.push({Dj:b,J:c,ef:d,ea:e,Qd:f})}function wk(a,b,c){var d=[],e=Aj(b)>>>0;for(b=0;b>>0,k=f.ef;if(e>=g&&eb)){e.g[b]= +g&65535;break}a.u("unknown register: "+f);return}I(a.K);a.u("updated registers:")}}a.u(vk(a,d));c&&(a.G=W(e.g[7]),bk(a,Ij(a,a.G)))}}function Ak(a,b){b=Za(b);var c=b.match(/^(['"])(.*?)\1$/);c?1k[0].indexOf("+"))){var m=k[0]+":";k[2]&&(m+=" "+k[2]);a.u(m)}k[3]&&(g=k[3],f=null);f=ik(a,b,g,f);a.u(f);a.G=b;e-=b.J-l;c++}}} +function hk(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.u(Zj+b):(a.O&&(a.u("ended assemble at "+Ij(a,a.N)),a.G=a.N,a.O=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.R=null;if(Ia(a)&&0n||"z"Na.length&&(a.u("note: only "+Na.length+" available"),wa=Na.length);Ca-=wa;0>Ca&&(null==Na[Na.length-1].J?(wa=Ca+wa,Ca=0):Ca+=Na.length);var af=[];"call"==ti&&(Cc=1E5,af=["CALL"]);for(void 0!==si&&a.u(wa+" instructions earlier:");0=Na.length&&(Ca=0);a.oa=wa;vi++;Cc--}}vi||(a.u("no "+ui+"history available"),a.oa=void 0)}else{var ia=Fj(a,Ma);if(ia)if("da"==bb){var bf=ia.Ka||65535M.length?(2qb&&(qb=0);65536ff?String.fromCharCode(ff):"."),Qd=Qd>>8}sb&&(sb+="\n");sb=cf?sb+(tb+","):sb+(Ma+": "+tb+(Pd?"":" "+ef))}sb&&a.u(sb);a.va=ia;a.Aa=dl}}}}break;case "e":if("else"== +g[0])break;var Wb,gf,hf,jf,kf=g[0],lf=g[1];"eb"==kf?(Wb=1,gf=255,hf=a.sd,jf=a.td):"e"==kf||"ew"==kf?(Wb=2,gf=65535,hf=a.Oa,jf=a.se):lf=null;if(null==lf)a.u("edit memory commands:"),a.u("\teb [a] [...] edit bytes at address a"),a.u("\tew [a] [...] edit words at address a");else{var Rd=Fj(a,lf);if(Rd)for(var Sd=2;Sdof;){for(var ub=null,hl=256;65536>Ic.J>>>0;){pf.J=a.Oa(Ic,2);if(null==Ic.J||!hl--)break;if(!(pf.J&1)){for(var il=a,Td=pf,Ai=null,Jc=Td.J,Bi=Jc,qf=1;6>=qf&&Jc;qf++){if(2> ";yb(function(){for(var a=x(document,w,"debugger"),b=0;b\nLicense: GPL version 3 or later ");this.u("Portions adapted from the PDP-11/70 Emulator by Paul Nankervis ");for(b=0;bIk){if(Jk(d,this.G)){this.v=new G(this,"1.32.2",Sk);Jk(this.v)&&(Tk(this,d),a=Uk,Vk(this.v));this.v.set(Pk,eb());Wk(this.v);var e=this.b&&!this.B;if(a==Qk||za("Click OK to restore the previous "+Hb+" machine state, or CANCEL to reset the machine.")){if(c=Ok(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Jk(d,g):("error"==f&&"no machine state"!= +g?(this.S("Error: "+g),"unable to verify user"==g&&(lb(Xk,""),this.g=null)):this.u(f+": "+g),Vk(d),Jk(d)?(c=Ok(d),e=!0):c=!1))}e&&Mk(this,c?d:null)}else a==Uk&&d.clear()}else Mk(this);delete this.G;delete this.w}e=Aa(this.id);for(f=0;fa[1];a=a[2];this.P=!0;this.A.Z=!0;var d=this.H.power;d&&(d.textContent="Shutdown");this.f&&(Yk(this,this.f,b,c,a),I(this,-2),this.f.qa());this.N&&(Tk(this,b),b.clear());!c&&this.v&&(this.v.clear(),delete this.v);this.j=0}; +function Tk(a,b){if(za("There may be a problem with your "+Hb+" machine.\n\nTo help us diagnose it, click OK to send this "+Hb+" machine state to http://www.pcjs.org.")){var c=a.V;a=a.g||"";b=b.toString();var d={};d.app=Hb;d.ver="1.32.2";d.url=c;d.user=a;d.type="bug";d.data=b;fb("http://www.pcjs.org/api/v1/report",d,!0)}} +function Ck(a,b,c){var d,e="none";if(a.j)return null;a.j--;var f=new G(a,"1.32.2"),g=new G(a,"1.32.2",Nk),k=eb();g.set(Pk,k);f.set(Pk,k);f.set(Zk,"1.32.2");f.set($k,window?window.location.href:null);f.set(cl,window?window.navigator.userAgent:"");a.f&&a.f.Ba&&(c&&(b&&(a.f.A.qa=a.f.A.T),a.f.aa()),d=a.f.Ba(b,c),"object"===typeof d&&f.set(a.f.id,d),c&&(a.f.A.Z=!1,!1===d&&(e=null)));for(var k=Aa(a.id),l=0;l=d||30<=(c.Kc+=d))&&(e.textContent=c.A.T?c.rb.toFixed(2)+"Mhz":"Stopped",c.Kc=0)}if(a.i&&(a=a.i,b=b||0,a.v)){c=a.f.A.T;d=!!(a.f.i&8);if(0>=b||60<=(a.j+=b)){for(e=0;eb?a.da=a.f.g[7]:0f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDPjs$2"), +a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){f=null,a=n.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");fb(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],g);tl(a,b,c)}})}else c(a,null)} +function ul(a,b,c,d){function e(a){if(void 0===k){var b=g&&x(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=Wa(a))}function f(a){e("Error: "+a);l&&(--ql||Cb(!0));l=!1}var g,k,l=!0;ql++;xa[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css";r.styleSheet?r.styleSheet.cssText=m:r.appendChild(document.createTextNode(m));n.appendChild(r)}c|| +(c="/versions/pdpjs/1.32.2/components.xsl");m=function(d,k){k?rl(c,null,null,!1,e,function(d,l){l?(va(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--ql||Cb(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--ql||Cb(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?rl(b,a,d,!0,e,m):sl(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(u){f(u.message)}return l}window.embedPDP11=function(a,b,c,d){Cb(!1);return ul(a,b,c,d)};window.findMachineComponent=function(a,b){return Da(b,a+".machine")};window.enableEvents=Cb;window.sendEvent=Eb;})();//# sourceMappingURL=/tmp/pdpjs/1.32.2/pdp11-dbg.map diff --git a/versions/pdpjs/1.32.2/pdp11.js b/versions/pdpjs/1.32.2/pdp11.js index b7e114cbc..bd8436539 100644 --- a/versions/pdpjs/1.32.2/pdp11.js +++ b/versions/pdpjs/1.32.2/pdp11.js @@ -15,6 +15,7 @@ http://pcjs.org/modules/pdp11/lib/keyboard.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/pc11.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/rk11.js (C) Jeff Parsons 2012-2017 + http://pcjs.org/modules/pdp11/lib/rl11.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/computer.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/state.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/embed.js (C) Jeff Parsons 2012-2017 @@ -28,256 +29,256 @@ http://pcjs.org/modules/pdp11/lib/cpuops.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/serial.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/disk.js (C) Jeff Parsons 2012-2017 - http://pcjs.org/modules/pdp11/lib/rl11.js (C) Jeff Parsons 2012-2017 + http://pcjs.org/modules/pdp11/lib/drive.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/shared/es6/debugger.js (C) Jeff Parsons 2012-2017 http://pcjs.org/modules/pdp11/lib/debugger.js (C) Jeff Parsons 2012-2017 */ var h,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this;function ca(){ca=function(){};ba.Symbol||(ba.Symbol=da)}var ea=0;function da(a){return"jscomp_symbol_"+(a||"")+ea++} -function fa(){ca();var a=ba.Symbol.iterator;a||(a=ba.Symbol.iterator=ba.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ga(this)}});fa=function(){}}function ga(a){var b=0;return ha(function(){return b":62,"?":63,"@":64,hc:65,Gf:66,If:67,eg:68,E:69,fg:70,gg:71,hg:72,ig:73,jg:74,kg:75,lg:76,mg:77,ng:78,og:79,pg:80,Q:81,qg:82,rg:83,sg:84,tg:85,ug:86,vg:87,wg:88,xg:89,Uc:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,yg:97,zg:98,Ag:99,d:100,e:101,Cg:102,Dg:103,Eg:104,Fg:105,Ig:106,k:107,Jg:108,Kg:109,n:110,Lg:111,p:112,q:113,r:114,Mg:115,t:116,Ng:117,Og:118,Pg:119,x:120,y:121,z:122,"{":123, -"|":124,"}":125,"~":126,Jc:127};function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.mc=b.comment;this.Rc=b;this.exports={};this.j=this.bindings={};a=this.id.indexOf(".");0>a?this.La=this.id:(this.Ma=this.id.substr(0,a),this.La=this.id.substr(a+1));this.l={ready:!1,Ta:!1,Xb:!1,R:!1,error:!1};this.Bb=null;this.l.error=!1;this.Kc=d||0;this.D=this.c=this.u=this.A=this.ab=null;u.push(this)}function qa(a,b,c){ra[a]&&b&&(ra[a][b]=c)} -function sa(){return Date.now()||+new Date}function v(a){window&&window.alert(a)}function ta(a){var b=!1;window&&(b=window.confirm(a));return b}function y(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b":62,"?":63,"@":64,Nc:65,Ug:66,Xg:67,wh:68,E:69,Ch:70,Eh:71,Qh:72,Sh:73,Th:74,Uh:75,Vh:76,Yh:77,$h:78,bi:79,ei:80,Q:81,gi:82,ii:83,ri:84,ti:85,vi:86,wi:87,Ai:88,Bi:89,le:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Ci:97,Di:98,Gi:99,d:100,e:101,Hi:102,Ii:103,Ji:104,Ki:105,Oi:106,k:107,Pi:108,Qi:109,n:110,Ri:111,p:112,q:113,r:114,Si:115,t:116,Ui:117,Vi:118,Wi:119,x:120,y:121,z:122,"{":123, +"|":124,"}":125,"~":126,Dd:127};function q(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Zc=b.comment;this.he=b;this.exports={};this.m=this.bindings={};a=this.id.indexOf(".");0>a?this.$a=this.id:(this.Na=this.id.substr(0,a),this.$a=this.id.substr(a+1));this.j={ready:!1,Va:!1,Ac:!1,O:!1,error:!1};this.Ub=null;this.j.error=!1;this.Xc=c||0;this.F=this.c=this.u=this.A=this.gb=null;r.push(this)}function ta(a,b,c){ua[a]&&b&&(ua[a][b]=c)} +function va(){return Date.now()||+new Date}function u(a){window&&window.alert(a)}function wa(a){var b=!1;window&&(b=window.confirm(a));return b}function xa(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>=3;return""+c}function Aa(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d} -function F(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0"']/g,function(a){return Fa[a]})}function Ga(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} -var Fa={"&":"&","<":"<",">":">",'"':""","'":"'"},Ha={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"}; -function Ia(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} -function G(a,b,c,d){c=void 0===c?!1:c;var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a, +function Ca(a){var b=10,c;if(a){b||(b=10);var d=a.charAt(0),e=0>=3;return""+c}function Ea(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d} +function Fa(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0"']/g,function(a){return Ja[a]})}function Ka(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} +var Ja={"&":"&","<":"<",">":">",'"':""","'":"'"},Ma={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"}; +function Na(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} +function Oa(a,b,c,d){c=void 0===c?!1:c;var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a, f,e))});if(b&&"object"==typeof b){var l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");k.open("POST",a,c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(l)}else k.open("GET",a,c),"bytes"==b&&k.overrideMimeType("text/plain; charset=x-user-defined"),k.send();c||(f=k.responseText,200!=k.status&&(e=k.status||-1),d&&d(a,f,e),g=[f,e]);return g} -function Ja(a,b){var c,d={N:null,fa:null,Z:null,Y:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Z=g.load;d.Y=g.exec;if(e=g.bytes)d.N=e;else if(e=g.words)for(d.N=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.N=Array(4*e.length),f=c=0;c>8&255,d.N[f++]=e[c]>>16&255,d.N[f++]=e[c]>>24&255;else d.N=g;d.fa=g.symbols;d.N.length?1==d.N.length&&(v(d.N[0]),d=null):(v("Empty resource: "+a),d=null)}catch(k){v("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;ca;a++)this.a["S"+a]=[0,0,!1,!1,this.od,a];this.D=this.c=this.u=this.A=null;D(this)}n(gb,r);h=gb.prototype;h.reset=function(){this.stop()}; -h.ca=function(a,b,c,d){if(this.A&&this.A.ca(a,b,c,d)||this.c&&this.c.ca(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.j[b]=c,this.m++,!0;default:return"led"==a||"rled"==a?(this.j[b]=c,this.f[b]=d?1:0,this.m++,!0):"switch"==a?(void 0===this.a[b]&&(this.a[b]=[d?1:0,d?1:0]),this.j[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,b){return function(){ib(a, -b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){jb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){ib(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){jb(a,b)}}(this,b),!0):r.prototype.ca.call(this,a,b,c,d)}};h.aa=function(a,b,c,d){this.A=a;this.u=b;this.c=c;this.D=d;kb(b,this,lb);mb(b,this.reset.bind(this));nb(this);ob(this)};h.ha=function(a,b){b||(this.C&&pb(),this.reset());return!0};h.ga=function(){return!0}; -function qb(a,b,c){if(a=a.j[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function nb(a,b){for(var c in a.f)qb(a,c,null!=b?b:a.f[c])}function rb(a,b,c){if(a=a.j[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function ob(a){for(var b in a.a)rb(a,b,a.a[b][1])}function sb(a,b,c,d){a.j[b]&&(void 0===c&&(wa(a,"Value for "+b+" is invalid"),H(a.c)),c=8==(a.D&&a.D.h||8)?za(c,d):Aa(c,d),a.j[b].textContent!=c&&(a.j[b].textContent=c))} -function ib(a,b){var c=a.a[b];rb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);b!=tb&&(a.s=b==ub,a.v=b==vb)}function jb(a,b){var c=a.a[b];c[2]&&c[3]&&(rb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.md=function(a){a||this.c.l.P||(a=this.c,a.u.reset(),wb(a),this.a[xb]&&this.a[xb][1]&&yb(this.c))};h.nd=function(){};h.hd=function(a){a||H(this.c)}; -h.fd=function(a){if(!a&&!this.c.l.P)if(this.a[xb]&&this.a[xb][1])yb(this.c);else{a=this.D;var b;if(b=a)a.l.Ta&&(a.l.Xb=!0),b=!a.l.Ta;if(b)ya(a,!0),a.f(0,null),ya(a,!1);else try{var c=this.c.Qb(1);0a;a++)this.a["S"+a][1]=0&1<=a.c.pa?8:16,c=65472<=a.ja&&a.ja<65472+b,b=c?1:2,c=c?15:a.u.v;a.a[tb]&&a.a[tb][1]||(b=-b);Ib(a,a.ja&~c|a.ja+b&c)}function Ib(a,b){a.ja=b&a.u.v;b=a.ja;for(var c=0;22>c;c++)Kb(a,"A"+c,b&1<c;c++)Kb(a,"D"+c,b&1<>2;this.f=this.g-1;this.s=this.F/this.g|0;this.L=this.s-1;this.Ha=[];this.m=0;this.o=!1;this.G=[];this.Vc=[Ob,Pb,Qb,Rb];this.a=this.b=[];this.C=this.w=this.i=this.H=this.I=0;a=new I(this);Sb(a);this.a=Array(this.s);this.b=Array(this.s);for(b=0;b>>this.h;this.w=0;this.i=this.v;D(this)}n(Mb,r);function Vb(a,b){if(b!=a.w){for(var c=0;c>>a.h,a.b[a.I]=a.a[a.H])}}h=Mb.prototype;h.reset=function(){for(var a=0;a>>a.h;0g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.Sa)return l.vb+=l.Sa-f,l.Sa=f,!0;if(f>=l.Sa+l.vb){p=l.size-(f-m);p>g&&(p=g);l.vb=f-l.Sa+p;f=m+a.g;g-=p;k++;continue}}return Xb(Yb,f,g)}f=new I(a,f,p,a.g,d,e);Sb(f,l);a.a[k++]=f;f=m+a.g;g-=p}return 0>=g?(a.status((c>>10)+"Kb "+Zb[d]+" at "+za(b)),!0):Xb($b,b,c)}h.Ec=function(a){return this.b[(a&this.i)>>>this.h].hb(a&this.f,a)}; -h.xb=function(a){var b=a&this.f,c=(a&this.i)>>>this.h;return eb||b!=this.f?this.b[c].W(b,a):this.b[c++].hb(b,a)|this.b[c&this.L].hb(0,a+1)<<8};h.Fc=function(a,b){this.b[(a&this.i)>>>this.h].kb(a&this.f,b,a)};h.yb=function(a,b){var c=a&this.f,d=(a&this.i)>>>this.h;eb||c!=this.f?this.b[d].nb(c,b,a):(this.b[d++].kb(c,b&255,a),this.b[d&this.L].kb(0,b>>8&255,a+1))};function ac(a,b){return a.a[(b&a.v)>>>a.h]} -function Hb(a,b){var c;a.o=!1;a.m++;var d=b&a.f,e=ac(a,b);eb||d!=a.f?c=e.D(d,b):c=e.i(d,b)|ac(a,b+1).i(0,b+1)<<8;a.m--;return c}function bc(a,b,c){a.o=!1;a.m++;ac(a,b).j(b&a.f,c&255,b);a.m--}function Fb(a,b,c){a.o=!1;a.m++;var d=b&a.f,e=ac(a,b);eb||d!=a.f?e.m(d,c&65535,b):(e.j(d,c&255,b),ac(a,b+1).j(0,c>>8&255,b+1));a.m--} -function Wb(a){for(var b=0,c=[],d=0;da.c.pa)){var k=g[0]?g[0].bind(b):null,l=g[1]?g[1].bind(b):null,m=g[2]?g[2].bind(b):null,p=g[3]?g[3].bind(b):null;65472<=f&&65487>=f&&(!k&&m&&(k=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!l&&p&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));for(var t=g[4],x=g[5]||1,w=0;w>8:e[2](f)&255):f&1&&(e=d.Ha[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return c;K(d,b,16);return 255} -function Pb(a,b,c){var d=!1,e=this.controller,f=e.Ha[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Ha[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d||K(e,c,16)}function Qb(a,b){var c=-1,d=this.controller;a=d.Ha[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return c;K(d,b,16);return 65535} -function Rb(a,b,c){var d=!1,e=this.controller;a=e.Ha[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d||K(e,c,16)}function M(a){r.call(this,"Device",a,0,256);this.a={Bg:0,bc:-1}}n(M,r);h=M.prototype;h.aa=function(a,b,c,d){this.u=b;this.A=a;this.c=c;this.D=d;var e=this;this.a.bc=ic(c,function(){e.a.fb|=128;e.a.fb&64&&N(e.c,e.a.Ja);e.A&&Cb(e.A,1);jc(e.c,e.a.bc,1E3/60)});this.a.Ja=kc(c,64,6,524288);kb(b,this,lc);mb(b,this.reset.bind(this));D(this)}; -h.reset=function(){this.a.fb=128;jc(this.c,this.a.bc,1E3/60,!0)};h.Ad=function(){return this.a.fb};h.Me=function(a){this.a.fb=a&192;this.a.fb&64||(a=this.a.Ja)&&mc(this.c,a)};h.Cd=function(){var a=this.c,b=a.H;b&57344||(b=b&-3199|a.Oa<<5|a.Pa<<1);return b};h.Oe=function(a){nc(this.c,a&-129|this.c.H&128)};h.Dd=function(){var a=this.c;a.H&57344||(a.cb=a.F>>16&65535);a=a.cb;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Ed=function(){var a=this.c;a.H&57344||(a.eb=a.F&65535);return a.eb};h.Fd=function(){return this.c.la}; -h.Pe=function(a){var b=this.c;1170>b.pa&&(a&=-49);b.la!=a&&(b.la=a,b.Ba=a&16?4194303:262143,oc(b))};h.me=function(a){a=a>>1&63;var b=this.c.Ga[a>>1];return a&1?b>>16:b&65535};h.yf=function(a,b){b=b>>1&63;var c=b>>1;this.c.Ga[c]=b&1?this.c.Ga[c]&65535|(a&63)<<16:this.c.Ga[c]&-65536|a&65534};h.fe=function(a){return this.c.s[1][a>>1&7]};h.rf=function(a,b){this.c.s[1][b>>1&7]=a&65295};h.de=function(a){return this.c.s[1][(a>>1&7)+8]};h.pf=function(a,b){this.c.s[1][(b>>1&7)+8]=a&65295}; -h.ee=function(a){return this.c.I[1][a>>1&7]};h.qf=function(a,b){b=b>>1&7;this.c.I[1][b]=a;this.c.s[1][b]&=65295};h.ce=function(a){return this.c.I[1][(a>>1&7)+8]};h.nf=function(a,b){b=(b>>1&7)+8;this.c.I[1][b]=a;this.c.s[1][b]&=65295};h.zd=function(a){return this.c.s[0][a>>1&7]};h.Le=function(a,b){this.c.s[0][b>>1&7]=a&65295};h.xd=function(a){return this.c.s[0][(a>>1&7)+8]};h.Je=function(a,b){this.c.s[0][(b>>1&7)+8]=a&65295};h.yd=function(a){return this.c.I[0][a>>1&7]}; -h.Ke=function(a,b){b=b>>1&7;this.c.I[0][b]=a;this.c.s[0][b]&=65295};h.wd=function(a){return this.c.I[0][(a>>1&7)+8]};h.Ie=function(a,b){b=(b>>1&7)+8;this.c.I[0][b]=a;this.c.s[0][b]&=65295};h.le=function(a){return this.c.s[3][a>>1&7]};h.xf=function(a,b){this.c.s[3][b>>1&7]=a&65295};h.je=function(a){return this.c.s[3][(a>>1&7)+8]};h.vf=function(a,b){this.c.s[3][(b>>1&7)+8]=a&65295};h.ke=function(a){return this.c.I[3][a>>1&7]};h.wf=function(a,b){b=b>>1&7;this.c.I[3][b]=a;this.c.s[3][b]&=65295}; -h.ie=function(a){return this.c.I[3][(a>>1&7)+8]};h.uf=function(a,b){b=(b>>1&7)+8;this.c.I[3][b]=a;this.c.s[3][b]&=65295};h.ib=function(a){a&=7;return this.c.i&2048?this.c.qa[a]:this.c.b[a]};h.lb=function(a,b){b&=7;this.c.i&2048?this.c.qa[b]=a:this.c.b[b]=a};h.Kd=function(){return this.c.i&49152?this.c.X[0]:this.c.b[6]};h.Ue=function(a){this.c.i&49152?this.c.X[0]=a:this.c.b[6]=a};h.Nd=function(){return this.c.b[7]};h.Xe=function(a){this.c.b[7]=a}; -h.jb=function(a){a&=7;return this.c.i&2048?this.c.b[a]:this.c.qa[a]};h.mb=function(a,b){b&=7;this.c.i&2048?this.c.b[b]=a:this.c.qa[b]=a};h.Ld=function(){return 1==(this.c.i&49152)>>14?this.c.b[6]:this.c.X[1]};h.Ve=function(a){1==(this.c.i&49152)>>14?this.c.b[6]=a:this.c.X[1]=a};h.Md=function(){return 3==(this.c.i&49152)>>14?this.c.b[6]:this.c.X[3]};h.We=function(a){3==(this.c.i&49152)>>14?this.c.b[6]=a:this.c.X[3]=a};h.vd=function(a){return this.c.tb[a-65504>>1]}; -h.He=function(a,b){this.c.tb[b-65504>>1]=a};h.zc=function(a){return 65520==a?(cc(this.u)>>6)-1:0};h.Cc=function(){};h.he=function(){return 1};h.tf=function(){};h.ud=function(){return this.c.G};h.Ge=function(){this.c.G=0};h.Bd=function(){return this.c.sb};h.Ne=function(a,b){b&1||(a&=255);this.c.sb=a};h.Gd=function(a,b){return b?0:this.c.Ra};h.Qe=function(a){var b=this.c;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1);b.g|=1}b.Ra=a};h.ge=function(a,b){return b?0:this.c.Fa&65280}; -h.sf=function(a){this.c.Fa=a|255};h.Jd=function(){return pc(this.c)};h.Te=function(a){qc(this.c,a)};h.Bc=function(){}; -var O={},lc=(O[61568]=[null,null,M.prototype.me,M.prototype.yf,"UNIMAP",64,1170],O[62592]=[null,null,M.prototype.fe,M.prototype.rf,"SIPDR",8,1145,64],O[62608]=[null,null,M.prototype.de,M.prototype.pf,"SDPDR",8,1145,64],O[62624]=[null,null,M.prototype.ee,M.prototype.qf,"SIPAR",8,1145,64],O[62640]=[null,null,M.prototype.ce,M.prototype.nf,"SDPAR",8,1145,64],O[62656]=[null,null,M.prototype.zd,M.prototype.Le,"KIPDR",8,1140,64],O[62672]=[null,null,M.prototype.xd,M.prototype.Je,"KDPDR",8,1145,64],O[62688]= -[null,null,M.prototype.yd,M.prototype.Ke,"KIPAR",8,1140,64],O[62704]=[null,null,M.prototype.wd,M.prototype.Ie,"KDPAR",8,1145,64],O[62798]=[null,null,M.prototype.Fd,M.prototype.Pe,"MMR3",1,1145,64],O[65382]=[null,null,M.prototype.Ad,M.prototype.Me,"LKS"],O[65402]=[null,null,M.prototype.Cd,M.prototype.Oe,"MMR0",1,1140,64],O[65404]=[null,null,M.prototype.Dd,M.prototype.Bc,"MMR1",1,1145,64],O[65406]=[null,null,M.prototype.Ed,M.prototype.Bc,"MMR2",1,1140,64],O[65408]=[null,null,M.prototype.le,M.prototype.xf, -"UIPDR",8,1140,64],O[65424]=[null,null,M.prototype.je,M.prototype.vf,"UDPDR",8,1145,64],O[65440]=[null,null,M.prototype.ke,M.prototype.wf,"UIPAR",8,1140,64],O[65456]=[null,null,M.prototype.ie,M.prototype.uf,"UDPAR",8,1145,64],O[65472]=[null,null,M.prototype.ib,M.prototype.lb,"R0SET0"],O[65473]=[null,null,M.prototype.ib,M.prototype.lb,"R1SET0"],O[65474]=[null,null,M.prototype.ib,M.prototype.lb,"R2SET0"],O[65475]=[null,null,M.prototype.ib,M.prototype.lb,"R3SET0"],O[65476]=[null,null,M.prototype.ib, -M.prototype.lb,"R4SET0"],O[65477]=[null,null,M.prototype.ib,M.prototype.lb,"R5SET0"],O[65478]=[null,null,M.prototype.Kd,M.prototype.Ue,"R6KERNEL"],O[65479]=[null,null,M.prototype.Nd,M.prototype.Xe,"R7KERNEL"],O[65480]=[null,null,M.prototype.jb,M.prototype.mb,"R0SET1",1,1145],O[65481]=[null,null,M.prototype.jb,M.prototype.mb,"R1SET1",1,1145],O[65482]=[null,null,M.prototype.jb,M.prototype.mb,"R2SET1",1,1145],O[65483]=[null,null,M.prototype.jb,M.prototype.mb,"R3SET1",1,1145],O[65484]=[null,null,M.prototype.jb, -M.prototype.mb,"R4SET1",1,1145],O[65485]=[null,null,M.prototype.jb,M.prototype.mb,"R5SET1",1,1145],O[65486]=[null,null,M.prototype.Ld,M.prototype.Ve,"R6SUPER",1,1145],O[65487]=[null,null,M.prototype.Md,M.prototype.We,"R6USER",1,1145],O[65504]=[null,null,M.prototype.vd,M.prototype.He,"CTRL",8,1170],O[65520]=[null,null,M.prototype.zc,M.prototype.Cc,"LSIZE",1,1170],O[65522]=[null,null,M.prototype.zc,M.prototype.Cc,"HSIZE",1,1170],O[65524]=[null,null,M.prototype.he,M.prototype.tf,"SYSID",1,1170],O[65526]= -[null,null,M.prototype.ud,M.prototype.Ge,"ERR",1,1170],O[65528]=[null,null,M.prototype.Bd,M.prototype.Ne,"MBR",1,1170],O[65530]=[null,null,M.prototype.Gd,M.prototype.Qe,"PIR"],O[65532]=[null,null,M.prototype.ge,M.prototype.sf,"SLR"],O[65534]=[null,null,M.prototype.Jd,M.prototype.Te,"PSW"],O); -Ua(function(){for(var a=C(document,B,"device"),b=0;b>1),this.c=new Int32Array(this.f,0,this.size>>2),vc(this,wc?xc:yc);else{a=this.c=Array(this.size>>2);for(f=0;f>2),b=0;b>8,c)};h.sd=function(a){return this.c[a>>2]>>>((a&3)<<3)&255};h.re=function(a,b){db&&a&1&&K(this.b,b,64);b=a>>2;a=(a&3)<<3;var c=this.c[b]>>a;return 24>a?c&65535:c&255|(this.c[b+1]&255)<<8}; -h.Ee=function(a,b){var c=a>>2;a=(a&3)<<3;this.c[c]=this.c[c]&~(255<>2;a=(a&3)<<3;24>a?this.c[c]=this.c[c]&~(65535<>8);this.xa=!0};h.qd=function(a,b){return this.i(a,b)};h.oe=function(a,b){return this.D(a,b)};h.Ce=function(a,b,c){this.A?this.wb(0,0,c):this.j(a,b,c)};h.Af=function(a,b,c){this.A?this.wb(0,0,c):this.m(a,b,c)};h.pd=function(a){return this.a[a]}; -h.rd=function(a){return this.a[a]};h.ne=function(a,b){db&&a&1&&K(this.b,b,64);return this.u.getUint16(a,!0)};h.qe=function(a,b){db&&a&1&&K(this.b,b,64);return!eb&&a&1?this.a[a]|this.a[a+1]<<8:this.o[a>>1]};h.Be=function(a,b){this.a[a]=b;this.xa=!0};h.De=function(a,b){this.a[a]=b;this.xa=!0};h.zf=function(a,b,c){db&&a&1&&K(this.b,c,64);this.u.setUint16(a,b,!0);this.xa=!0};h.Bf=function(a,b,c){db&&a&1&&K(this.b,c,64);!eb&&a&1?(this.a[a]=b,this.a[a+1]=b>>8):this.o[a>>1]=b;this.xa=!0}; -var tc=0,dc=1,uc=2,Ub=4,Zb=["NONE","RAM","ROM","VID","H/W"],sc=0,Bc=[],Ac=[I.prototype.sd,I.prototype.Ee,I.prototype.re,I.prototype.Cf],Ec=[I.prototype.qd,I.prototype.Ce,I.prototype.oe,I.prototype.Af];if(bb)var yc=[I.prototype.pd,I.prototype.Be,I.prototype.ne,I.prototype.zf],xc=[I.prototype.rd,I.prototype.De,I.prototype.qe,I.prototype.Bf];var Fc;if(bb){var Gc=new ArrayBuffer(2);(new DataView(Gc)).setUint16(0,256,!0);Fc=256===(new Uint16Array(Gc))[0]}else Fc=!1;var wc=Fc; -function Hc(a,b){r.call(this,"CPU",a,0,1);b=+a.cycles||b;var c=+a.multiplier||1;this.ec=0;this.Lb=b;this.Qa=c;this.Tb=Math.round(this.Lb/1E4)/100;this.Wa=this.Tb*this.Qa;this.Ub=this.rb=this.Za=this.Mb=0;this.l.P=!1;this.l.ac=!1;this.l.ma=a.autoStart;"string"==typeof this.l.ma&&(this.l.ma="true"==this.l.ma);this.l.zb=!1;this.Jb=this.Ya=0;this.Kb=+a.csStart;this.pb=+a.csInterval;this.qb=+a.csStop;this.sa=[];this.pc=this.ve.bind(this);this.Ea=this.va=this.Da=this.a=this.S=this.ua=this.ob=this.Ca=this.$a= -this.Vb=this.Na=0;this.ka=null;D(this)}n(Hc,r);h=Hc.prototype;h.aa=function(a,b,c,d){this.A=a;this.u=b;this.D=d;this.ka=a.f;for(a=0;a=a.Ya&&(a.Ya+=a.pb,c=!0);0<=a.qb&&a.qb<=Mc(a)&&(a.pb=a.qb=-1,Lc(a),H(a),c=!0);c&&a.V(Mc(a)+" cycles: checksum="+Aa(a.Jb))}} -h.ca=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.j[b]=c,!0;case "run":return this.j[b]=c,c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.l.R)a=!0;else{var b=null,c,k=y(a.id);for(c=0;ca.Na/a.Wa&&(b=1);a.Qa=b;b=a.Tb*a.Qa;if(a.Wa!=b){a.Wa=b;b=a.Wa.toFixed(2)+"Mhz";var d=a.j.setSpeed;d&&(d.textContent=b);a.V("target speed: "+b)}c&&a.A&&Qc(a.A)}Ab(a,a.va);a.va=0;a.ua=sa();a.Ca=0;Oc(a)}function ic(a,b){var c=a.sa.length;a.sa.push([-1,b]);return c}function jc(a,b,c,d){0<=b&&ba.sa[b][0])&&(c=a.Lb*a.Qa/1E3*c|0,a.l.P&&(c+=Rc(a)),a.sa[b][0]=c)} -function zb(a,b){for(var c=a.sa.length-1;0<=c;c--){var d=a.sa[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Rc(a,b){var c=a.Da-=a.a;a.a=a.S=0;b&&(a.Da=0);return c} -h.ve=function(){if(this.l.P){this.Mb>=this.Lb&&Oc(this,!0);this.$a=0;this.ob=sa();if(this.Ca){var a=this.ob-this.Ca;a>this.Ub&&(this.ua+=a,this.ua>this.ob&&(this.ua=this.ob))}try{do{for(var b,c=this.l.zb?1:this.rb,d=this.sa.length-1;0<=d;d--){var e=this.sa[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.Qb(b)}catch(f){if("number"!=typeof f)throw f;}b=Rc(this,!0);this.$a+=b;this.va+=b;Bb(this,b);zb(this,b);this.Za-=b;if(0>=this.Za){this.Za+=this.rb;++this.Vb>=Sc&&(this.A&&Cb(this.A,void 0),this.Vb=0);break}}while(this.l.P)}catch(f){H(this); -this.A&&this.A.stop(sa(),Mc(this));wa(this,f.stack||f.message);return}if(this.l.P){a=setTimeout;b=this.pc;this.Ca=sa();c=this.Ub;this.$a&&(c=Math.round(c*this.$a/this.rb));c-=this.Ca-this.ob;if(d=this.Ca-this.ua)this.Na=Math.round(this.va/(10*d))/100,864E5<=d&&(this.Ea=0,Nc(this));if(0>c||this.Nac&&(this.ua-=c),c=0;this.Mb+=this.$a;this.Ca+=c;a(b,c)}}}; -function yb(a){var b;a.l.error?(a.V(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.l.P)a.V(a.toString()+" busy");else{Nc(a);a.l.P=!0;a.l.ac=!0;if(b=a.j.run)b.textContent="Halt";a.A&&a.A.start(a.ua,Mc(a));a.D||a.status("Started");setTimeout(a.pc,0)}}h.Qb=function(){return 0};function H(a){var b=!1;if(a.l.P){Rc(a);Ab(a,a.va);a.va=0;a.l.P=!1;if(b=a.j.run)b.textContent="Run";a.A&&a.A.stop(sa(),Mc(a));b=!0;a.D||a.status("Stopped")}a.l.complete=void 0;return b}var Pc=30,Sc=15,Ic=["power","reset"]; -function Tc(a){var b=+a.model||1170;Hc.call(this,a,6666667);this.pa=b;this.lc=+a.addrReset||0;this.i=this.v=this.m=this.o=this.w=0;this.b=this.qa=this.X=[];this.C=0;this.nc=[];this.s=this.I=this.Ga=this.tb=[];this.Nb=this.za=this.F=this.kc=this.Aa=this.Oa=this.Pa=this.Ba=this.G=this.Ra=this.Fa=this.H=this.cb=this.eb=this.la=this.wa=this.h=this.f=this.Gb=this.K=this.L=this.g=this.sb=0;this.oc=255;1120>=this.pa?(this.jc=Uc.bind(this),this.Xa=this.Zc,this.Nb=8,this.oc=-1,this.rc=255,this.qc=0):(this.jc= -Vc.bind(this),this.Xa=this.$c,this.rc=~(1792|(1140>=this.pa?2048:0))&65535,this.qc=1140e.cc&&(e.cc=c,c+=4)}return Hc.prototype.ha.call(this,a,b)}; -h.reset=function(){this.status("Model "+this.pa);this.l.P&&H(this);this.v=65536;this.m=32768;this.o=65535;this.w=32768;this.i=15;this.b=[0,0,0,0,0,0,0,this.lc,-1,-2,-3,-4,-5,-6,-7,-8];this.qa=[0,0,0,0,0,0];this.X=[0,0,0,0];this.C=0;this.nc=[4,2,0,1];this.s=[[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],[65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.I=[[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Ga=[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];this.tb=[0,0,0,0,0,0,0,0];this.h=this.f=this.Gb=this.K=this.L=this.g=this.sb=0;this.wa=-1;wb(this);Kc(this);this.l.error=!1;Hc.prototype.reset.call(this)};function wb(a){a.H=0;a.cb=0;a.eb=0;a.la=0;a.G=0;a.Ra=0;a.Fa=255;a.Aa=0;a.Oa=0;a.Pa=0;a.Ba=262143;a.za=a.b[7];a.F=0;a.ea=null;a.u&&(oc(a),a.kc=cc(a.u))} -function oc(a){a.Db=a.fc;a.Eb=a.gc;a.Ob=a.Pb;a.Fb=a.Rb;a.Aa?(a.ta=65536,a.Cb=a.la&16?4186112:253952,a.oa=a.xc,a.W=a.Ac,a.nb=a.Dc,Vb(a.u,a.la&16?22:18)):(a.ta=0,a.Cb=57344,a.oa=a.cd,a.W=a.pe,a.nb=a.Df,Vb(a.u,16))}function nc(a,b){b&=-3073;if(a.H!=b){b&57344&&!(a.H&57344)&&(a.cb=a.F>>16&65535,a.eb=a.F&65535);a.H=b;a.Oa=(b&96)>>5;a.Pa=(b&30)>>1;var c=0;b&257&&(c=4,b&1&&(c|=2));a.Aa!=c&&(a.Aa=c,oc(a))}} -function Wc(a,b,c){a.lc=b;a.u.reset();wb(a);R(a,b);qc(a,0);if(c){for(b=2;5>=b;b++)a.b[b]=0;a.l.P||yb(a)}else a.D?H(a)||a.D.g():!1===c&&H(a);!a.l.P&&a.ka&&a.ka.stop()}h.wc=function(){return 0};h.save=function(){var a=new J(this);a.set(0,[this.b,this.qa,this.X,this.Ga,this.tb,this.G,this.sb,this.Ra,this.Fa,this.wa,this.C,this.g,this.H,this.cb,this.eb,this.la,this.Oa,this.Pa,this.s,this.I,this.Aa,this.Ba,this.za,this.F]);a.set(1,[pc(this)]);a.set(2,[this.Ea,this.Qa]);return a.data()}; -h.restore=function(a){var b;b=a[0];fa();ca();fa();var c=b[Symbol.iterator];b=c?c.call(b):ga(b);this.b=b.next().value;this.qa=b.next().value;this.X=b.next().value;this.Ga=b.next().value;this.tb=b.next().value;this.G=b.next().value;this.sb=b.next().value;this.Ra=b.next().value;this.Fa=b.next().value;this.wa=b.next().value;this.C=b.next().value;this.g=b.next().value;this.H=b.next().value;this.cb=b.next().value;this.eb=b.next().value;this.la=b.next().value;this.Oa=b.next().value;this.Pa=b.next().value; -this.s=b.next().value;this.I=b.next().value;this.Aa=b.next().value;this.Ba=b.next().value;this.za=b.next().value;this.F=b.next().value;b=a[1];qc(this,b[0]);b=a[2];this.Ea=b[0];Nc(this,b[1]);return!0};function Xc(a){return a.v&65536?1:0}function Yc(a){return a.w&32768?8:0}function Zc(a,b){var c=a.b[7];a.b[7]=c+b&65535;return c}function S(a,b,c){c&&(R(a,a.b[7]+(b<<24>>23)),a.a-=2);a.a-=3}function R(a,b){a.b[7]=b&65535} -function kc(a,b,c,d){c={cc:b,gb:c,message:d||0,next:null};c.name=fb[b];a.Sb.push(c);return c}function mc(a,b){var c=a.ea;if(c==b)a.ea=b.next;else for(;c;){var d=c.next;if(d==b){c.next=d.next;break}c=d}a.ea&&(a.g|=1)}function N(a,b){if(b){if(b!=a.ea){var c=a.ea;if(!c||c.gb<=b.gb)b.next=c,a.ea=b;else{do{var d=c.next;if(!d||d.gb<=b.gb){b.next=d;c.next=b;break}c=d}while(c)}}a.g|=1}}function $c(a){return a.g&64?(L(a,168,64,-6),!0):a.g&32?(L(a,4,32,-5),!0):a.g&16?(L(a,12,16,-7),!0):!1} -function pc(a){return a.i=a.i&63728|Yc(a)|(a.o&65535?0:4)|(a.m&32768?2:0)|Xc(a)}function qc(a,b){b&=a.rc;a.w=b<<12;a.o=~b&4;a.m=b<<14;a.v=b<<16;if((b^a.i)&a.qc)for(var c=a.qa.length;0<=--c;){var d=a.b[c];a.b[c]=a.qa[c];a.qa[c]=d}a.C=b>>14&3;c=a.i>>14&3;a.C!=c&&(a.X[c]=a.b[6],a.b[6]=a.X[a.C]);a.i=b;a.g&=-3;a.g|=a.ea?2:1}h.da=function(a){this.w=this.o=a;this.m=0};h.Ka=function(a,b){this.w=this.o=this.v=a;this.m=b||0};function ad(a,b){a.w=a.o=a.v=b;a.m=a.w^a.v>>1} -function bd(a,b,c,d){a.w=a.o=a.v=b;a.m=(c^d)&(d^b)}function L(a,b,c,d){if(!a.bb){0>a.wa?a.wa=pc(a):a.C||(d=-4);-4==d&&(a.g&256&&(d=-1),a.g|=256,a.G|=4,a.b[6]=b=4);if(-1!=d){a.F=b|4143316992;a.C=0;var e=a.W(b|a.ta),f=a.W(b+2&65535|a.ta);qc(a,f&-12289|a.wa>>2&12288);cd(a,a.wa);cd(a,a.b[7]);R(a,e)}a.a-=5;a.g&=~(c|19);a.g|=129;a.wa=-1;a.Tc=b;a.Sc=d;-1==d&&H(a);if(-4<=d)throw b;}}function dd(a){var b=ed(a),c=ed(a);a.i&49152&&(c=c&-225|a.i&63712);R(a,b);qc(a,c);a.g&=-17} -function fd(a,b){var c=b>>13&31;31>c&&(b=a.la&32?a.Ga[c]+(b&8191)&4194303:b&-3932161);return b} -function Gb(a,b,c){var d,e,f;if(!(c&a.Aa))return f=b&65535,57344<=f&&(f|=a.Cb),f;d=b>>13;a.la&a.nc[a.C]||(d&=7);e=a.s[a.C][d];f=(a.I[a.C][d]<<6)+(b&8191)&a.Ba;3932160<=f&&(f=fd(a,f));if(a.bb)return f;f>=a.kc&&f>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&& -(g|=16384));a.s[a.C][d]=e;if(f!=(4194170&a.Ba)||a.C)a.Oa=a.C,a.Pa=d;g&&(g&57344&&(0<=a.wa&&(g|=128),a.H&57344||(g|=a.H&4096|a.Oa<<5|a.Pa<<1,nc(a,a.H&-61695|g&61694)),L(a,168,64,-2)),a.H&61440||!(f<(4191360&a.Ba)||f>(4194239&a.Ba))||(a.H|=4096,a.H&512&&(a.g|=64)));return f}function ed(a){var b=a.W(a.b[6]|a.ta);a.b[6]=a.b[6]+2&65535;return b}function cd(a,b){var c=a.b[6]-2&65535;a.b[6]=c;a.F=a.F&65535|(a.F&-65536)<<8|16121856;a.g&256||a.Xa(4,-2,c);a.nb(c,b)} -function gd(a,b,c,d){var e,f,g=d&8?0:a.ta;switch(b){case 0:return L(a,4,0,-3),0;case 1:return 6==c&&a.Xa(d,0,a.b[6]),a.a-=3,7==c?a.b[c]:a.b[c]|g;case 2:f=2;e=a.b[c];6==c&&a.Xa(d,f,e);7!=c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.b[c];7!=c&&(e|=g);e=a.W(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.b[c]+f&65535;6==c&&a.Xa(d,f,e);7!=c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.b[c]-2&65535;7!=c&&(e|=g);e=a.W(e)|g;a.a-=8;break;case 6:return e=a.W(Zc(a,2)),e=e+a.b[c]&65535,6==c&&a.Xa(d,0, -e),a.a-=6,e|g;case 7:return e=a.W(Zc(a,2)),e=e+a.b[c]&65535,e=a.W(e|a.ta),a.a-=10,e|g}a.b[c]=a.b[c]+f&65535;a.F=a.F&65535|(a.F&-65536)<<8|(f<<3&248|c)<<16;return e}h.Zc=function(a,b,c){!this.C&&0>=b&&c<=this.Fa&&(this.g|=32)};h.$c=function(a,b,c){this.C||(65534<=c&&(c|=-65536),a&4&&c<=this.Fa&&(c<=this.Fa-32?L(this,4,0,-4):(this.G|=8,this.g|=32)))};h.bd=function(a){return this.fc(a)};h.dd=function(a){return this.gc(a)};h.ye=function(a,b){this.Pb(a,b)};h.Ae=function(a,b){this.Rb(a,b)}; -h.cd=function(a,b,c){return gd(this,a,b,c)};h.xc=function(a,b,c){return Gb(this,gd(this,a,b,c),c)};h.pe=function(a){return this.u.xb(this.za=a)};h.Ac=function(a){return this.u.xb(this.za=Gb(this,a,2))};h.Df=function(a,b){this.u.yb(this.za=a,b)};h.Dc=function(a,b){this.u.yb(this.za=Gb(this,a,4),b)}; -function hd(a,b,c){var d=a.f=b&7;(b=a.h=(b&56)>>3)?(d=gd(a,b,d,2),c&65536||61440!==(a.i&61440)&&(d&=65535),a.C=a.i>>12&3,c=a.W(d|c&a.ta),a.C=a.i>>14&3):c=6!=d||(a.i>>2&12288)===(a.i&12288)?a.b[d]:a.X[a.i>>12&3];return c}function id(a,b,c,d){a.F=a.F&65535|1441792;var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=gd(a,b,e,4),c&65536||(e&=65535),a.C=a.i>>12&3,e=Gb(a,e|c&65536,4),a.C=a.i>>14&3,a.Fb(e,d)):6!=e||(a.i>>2&12288)===(a.i&12288)?a.b[e]=d:a.X[a.i>>12&3]=d} -function jd(a,b){b>>=6;var c=a.L=b&7;return(b=a.K=(b&56)>>3)?a.Db(a.oa(b,c,3)):a.b[c+a.Nb]&a.oc}function kd(a,b){var c;b>>=6;var d=a.L=b&7;(b=a.K=(b&56)>>3)?c=a.Eb(a.oa(b,d,2)):c=a.b[d+a.Nb];return c}function ld(a,b){var c=a.f=b&7;b=a.h=(b&56)>>3;return gd(a,b,c,8)}function md(a,b){var c=a.f=b&7;return(b=a.h=(b&56)>>3)?a.Db(a.oa(b,c,3)):a.b[c]&255}function nd(a,b){var c,d=a.f=b&7;(b=a.h=(b&56)>>3)?c=a.Eb(a.oa(b,d,2)):c=a.b[d];return c} -function T(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.Gb=a.oa(b,e,7),c=0>c?a.b[-c-1]&255:c,a.Ob(e,d.call(a,c,a.Db(e))),e&1&&a.a--):(b=a.b[e],c=0>c?a.b[-c-1]&255:c,a.b[e]=b&65280|d.call(a,c,b&255))}function U(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.oa(b,e,6),a.Fb(e,d.call(a,0>c?a.b[-c-1]:c,a.Eb(e)))):a.b[e]=d.call(a,0>c?a.b[-c-1]:c,a.b[e])} -function od(a,b,c,d,e){var f=a.f=b&7;(b=a.h=(b&56)>>3)?(d=a.oa(b,f,5),e.call(a,(c=0>c?a.b[-c-1]&255:c)<<8),a.Ob(d,c),d&1&&a.a--):(c?(c=0>c?a.b[-c-1]&255:c,a.b[f]=a.b[f]&~d|c<<24>>24&d):a.b[f]&=~d,e.call(a,c<<8))}function pd(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.oa(b,e,4),d.call(a,c=0>c?a.b[-c-1]:c),a.Fb(e,c)):(a.b[e]=c=0>c?a.b[-c-1]:c,d.call(a,c))} -h.Qb=function(a){this.l.complete=!0;var b=a?this.l.ac?0:1:-1;this.l.ac=!1;this.Da=this.a=a;this.g=this.g&-5|0;do{if(this.g){if(a=this.g&11)if(a=!1,this.g&2){var c=160,d=(this.Ra&224)>>5,e=this.ea&&this.ea.gb>d?this.ea:null;e&&(c=e.cc,d=e.gb);d>(this.i&224)>>5?(this.g&8&&(Zc(this,2),this.g&=-9),L(this,c,0,-10),d=!0):d=!1;d&&(e&&mc(this,e),a=!0);this.ea||this.Ra||(this.g&=-3)}else this.g&1&&this.g++;if(a){if(this.g&4&&this.D.b(this.b[7],b)){H(this);break}if(0>b)break}if(this.g&112&&$c(this)){if(this.g& -4&&this.D.b(this.b[7],b)){H(this);break}if(0>b)break}}this.g=this.g&15|this.i&16;a=this.F=this.b[7];e=this.W(a);this.b[7]=a+2&65535;this.jc(e)}while(0>1|b<<16;ad(this,a);return a&65535}function vd(a,b){a=b&128|b>>1|b<<8;ad(this,a<<8);return a&255}function wd(a,b){a=b&~a;this.da(a);return a}function xd(a,b){a=b&~a;this.da(a<<8);return a}function yd(a,b){a|=b;this.da(a);return a}function zd(a,b){a|=b;this.da(a<<8);return a} -function Ad(a,b){a=~b|65536;this.Ka(a);return a&65535}function Bd(a,b){a=~b|256;this.Ka(a<<8);return a&255}function Cd(a,b){this.w=this.o=a=b-a;this.m=b&(b^a);return a&65535}function Dd(a,b){a=b-a;var c=a<<8;b<<=8;this.w=this.o=c;this.m=b&(b^c);return a&255}function Ed(a,b){this.w=this.o=a=b+a;this.m=a&(b^a);return a&65535}function Fd(a,b){a=b+a;var c=a<<8;this.w=this.o=c;this.m=c&(b<<8^c);return a&255}function Gd(a,b){a=-b;this.Ka(a,a&b&32768);return a&65535} -function Hd(a,b){a=-b;this.Ka(a<<8,(a&b&128)<<8);return a&255}function Id(a,b){a=b<<1|this.v>>16&1;ad(this,a);return a&65535}function Jd(a,b){a=b<<1|this.v>>16&1;ad(this,a<<8);return a&255}function Kd(a,b){a=(this.v&65536|b)>>1|b<<16;ad(this,a);return a&65535}function Ld(a,b){a=((this.v&65536)>>8|b)>>1|b<<8;ad(this,a<<8);return a&255}function Md(a,b){var c=b-a;bd(this,c,a,b);return c&65535}function Nd(a,b){var c=b-a;bd(this,c<<8,a<<8,b<<8);return c&255} -function Od(a,b){this.w=this.o=b&65280;this.m=this.v=0;return(b<<8|b>>8)&65535}function Pd(a,b){a^=b;this.da(a);return a&65535}function Qd(a){U(this,a,kd(this,a),qd);this.a-=this.h?9+(this.L&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)} -function Rd(a){var b=nd(this,a);a=a>>6&7;var c=this.b[a];c&32768&&(c|=4294901760);this.v=this.m=0;b&=63;if(b&32)b=64-b,16>=b;else if(b)if(16>15&65535;d&&65535!==d&&(this.m=32768)}this.b[a]=c&65535;this.w=this.o=c;this.a-=(this.h?6:7)+b} -function Sd(a){var b=nd(this,a);a=a>>6&7;var c=this.b[a]<<16|this.b[a|1];this.v=this.m=0;b&=63;if(b&32){b=64-b;32>b-1;this.v=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<>15,d<<=1,32>=32-b)&&4294967295!==(c|4294967295<>16&65535;this.b[a|1]=d&65535;this.w=d>>16;this.o=d>>16|d;this.a-=(this.h?6:7)+b}function Td(a){S(this,a,!Xc(this))}function Ud(a){S(this,a,Xc(this))} -function Vd(a){U(this,a,kd(this,a),wd);this.a-=this.h?9+(this.L&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)}function Wd(a){T(this,a,jd(this,a),xd);this.a-=this.h?9+(this.L&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)}function Xd(a){U(this,a,kd(this,a),yd);this.a-=this.h?9+(this.L&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)}function Yd(a){T(this,a,jd(this,a),zd);this.a-=this.h?9+(this.L&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)} -function Zd(a){var b=kd(this,a);a=nd(this,a);this.da((0>b?this.b[-b-1]:b)&a);this.a-=this.h?4+(this.L&&6<=this.f?1:0):(this.K?4:3)+(7==this.f?2:0)}function $d(a){var b=jd(this,a);a=md(this,a);this.da(((0>b?this.b[-b-1]&255:b)&a)<<8);this.a-=this.h?4+(this.L&&6<=this.f?1:0):(this.K?4:3)+(7==this.f?2:0)}function ae(a){S(this,a,this.o&65535?0:4)}function be(a){S(this,a,!Yc(this)==!(this.m&32768))}function ce(a){S(this,a,!!(this.o&65535)&&!Yc(this)==!(this.m&32768))} -function de(a){S(this,a,!Xc(this)&&!!(this.o&65535))}function ee(a){S(this,a,(this.o&65535?0:4)||!Yc(this)!=!(this.m&32768))}function fe(a){S(this,a,Xc(this)||(this.o&65535?0:4))}function ge(a){S(this,a,!Yc(this)!=!(this.m&32768))}function he(a){S(this,a,Yc(this))}function ie(a){S(this,a,!!(this.o&65535))}function je(a){S(this,a,!Yc(this))}function ke(){L(this,12,0,-9)}function le(a){S(this,a,!0)}function me(a){S(this,a,!(this.m&32768))}function ne(a){S(this,a,this.m&32768?2:0)} -function V(a){a&1&&(this.v=0);a&2&&(this.m=0);a&4&&(this.o=1);a&8&&(this.w=0);this.a-=5}function oe(a){var b=kd(this,a);a=nd(this,a);var c=(b=0>b?this.b[-b-1]:b)-a;bd(this,c,a,b);this.a-=this.h?4+(this.L&&6<=this.f?1:0):(this.K?4:3)+(7==this.f?2:0)}function pe(a){var b=jd(this,a);a=md(this,a);var c=(b=(0>b?this.b[-b-1]&255:b)<<8)-(a<<=8);bd(this,c,a,b);this.a-=this.h?4+(this.L&&6<=this.f?1:0):(this.K?4:3)+(7==this.f?2:0)} -function qe(a){var b=nd(this,a);if(b){a=a>>6&7;var c=this.b[a]<<16|this.b[a|1];this.v=this.m=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.b[a]=d&65535,this.b[a|1]=c-d*b&65535,this.o=d>>16|d,this.w=d>>16):(this.m=32768,this.o=d>>15|d,this.w=c>>16,-1===b&&65534===this.b[a]&&(this.b[a]=this.b[a|1]=1));this.a-=53}else this.o=this.w=0,this.m=32768,this.v=65536,this.a-=7}function re(){L(this,24,0,-9);this.a-=20} -function se(){this.i&49152?(this.G|=128,L(this,4,0,-8)):(this.ka&&1120==this.pa&&this.ka.setData(this.b[0],!0),this.D?this.D.i():H(this));this.a-=7}function te(){L(this,16,0,-9);this.a-=20}var ue=[0,7,7,10,7,11,9,13];function ve(a){this.S=this.a;R(this,ld(this,a));this.a=this.S-ue[this.h]}var we=[0,14,14,17,14,18,16,20];function xe(a){this.S=this.a;var b=ld(this,a);a=a>>6&7;cd(this,this.b[a]);this.b[a]=this.b[7];R(this,b);this.a=this.S-we[this.h]}var ye=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17]; -function ze(a){var b=kd(this,a);this.S=this.a;pd(this,a,b,this.da);this.a=this.S-ye[(this.K?8:0)+this.h]+(7!=this.f||this.h?0:2)}function Ae(a){var b=jd(this,a);od(this,a,b,65535,this.da);this.a-=this.h?9+(this.L&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)}var Be=[7,13,13,17,14,18,17,21];function Ce(a){var b=nd(this,a);a=a>>6&7;b=(b<<16>>16)*(this.b[a]<<16>>16);this.b[a]=b>>16&65535;this.b[a|1]=b&65535;b|=0;this.w=b>>16;this.o=this.w|b;this.m=0;this.v=-32768>b||32767>6;if(this.b[b]=this.b[b]-1&65535)R(this,this.b[7]-((a&63)<<1)),this.a+=1;this.a-=6} -function Ie(a){U(this,a,kd(this,a),Md);this.a-=this.h?9+(this.L&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)}function Je(a){U(this,a,0,Od);this.a-=this.h?9:3+(7==this.f?2:0)}function Ke(){L(this,28,0,-9)}function Le(){this.ka&&(this.ka.ja=this.b[7],this.ka.setData(this.b[0],!0));this.g|=8;Zc(this,-2);this.a-=3}function Me(a){U(this,a,this.b[(a>>6&7)+this.Nb],Pd);this.a-=this.h?9:3+(7==this.f?2:0)}function X(){L(this,8,0,-9)}function Uc(a){Ne[a>>12].call(this,a)} -function Oe(a){Pe[a>>6&3].call(this,a)}function Qe(a){Re[a>>6&3].call(this,a)}function Se(a){Te[a>>6&3].call(this,a)}function Ue(a){Ve[a&15].call(this,a)}function We(a){Xe[a&15].call(this,a)}function Ye(a){Ze[a>>6&3].call(this,a)}function $e(a){af[a>>6&3].call(this,a)}function bf(a){cf[a>>6&3].call(this,a)} -var Ne=[function(a){df[a>>8&15].call(this,a)},ze,oe,Zd,Vd,Xd,Qd,X,function(a){ef[a>>8&15].call(this,a)},Ae,pe,$d,Wd,Yd,Ie,X],df=[function(a){ff[a>>4&15].call(this,a)},le,ie,ae,be,ge,ce,ee,xe,xe,Oe,Qe,Se,X,X,X],Pe=[function(a){pd(this,a,0,this.Ka);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,0,Ad);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,1,Ed);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,1,Cd);this.a-=this.h?9:3+(7==this.f?2:0)}],Re=[function(a){U(this,a,0,Gd); -this.a-=this.h?11:6},function(a){U(this,a,Xc(this)?1:0,qd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,Xc(this)?1:0,Md);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){a=nd(this,a);this.Ka(a);this.a-=this.h?4:3+(7==this.f?2:0)}],Te=[function(a){U(this,a,0,Kd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,0,Id);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,0,ud);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){U(this,a,0,sd);this.a-=this.h?9:3+(7==this.f?2:0)}],ff= -[function(a){gf[a&15].call(this,a)},X,X,X,ve,ve,ve,ve,Fe,X,Ue,We,Je,Je,Je,Je],gf=[se,Le,Ge,ke,te,Ee,X,X,X,X,X,X,X,X,X,X],Ve=[De,function(){this.v=0;this.a-=5},function(){this.m=0;this.a-=5},V,function(){this.o=1;this.a-=5},V,V,V,function(){this.w=0;this.a-=5},V,V,V,V,V,V,V],Xe=[De,function(){this.v=65536;this.a-=5},function(){this.m=32768;this.a-=5},W,function(){this.o=0;this.a-=5},W,W,W,function(){this.w=32768;this.a-=5},W,W,W,W,W,W,W],ef=[je,he,de,fe,me,ne,Td,Ud,re,Ke,Ye,$e,bf,X,X,X],Ze=[function(a){od(this, -a,0,255,this.Ka);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){T(this,a,0,Bd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){T(this,a,1,Fd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){T(this,a,1,Dd);this.a-=this.h?9:3+(7==this.f?2:0)}],af=[function(a){T(this,a,0,Hd);this.a-=this.h?11:6},function(a){T(this,a,Xc(this)?1:0,rd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){T(this,a,Xc(this)?1:0,Nd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){a=md(this,a);this.Ka(a<<8);this.a-=this.h?4:3+ -(7==this.f?2:0)}],cf=[function(a){T(this,a,0,Ld);this.a-=this.h?9+(this.Gb&1):3+(7==this.f?2:0)},function(a){T(this,a,0,Jd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){T(this,a,0,vd);this.a-=this.h?9+(this.Gb&1):3+(7==this.f?2:0)},function(a){T(this,a,0,td);this.a-=this.h?9:3+(7==this.f?2:0)}];function Vc(a){hf[a>>12].call(this,a)} -var hf=[function(a){jf[a>>8&15].call(this,a)},ze,oe,Zd,Vd,Xd,Qd,function(a){kf[a>>8&15].call(this,a)},function(a){lf[a>>8&15].call(this,a)},Ae,pe,$d,Wd,Yd,Ie,X],jf=[function(a){mf[a>>4&15].call(this,a)},le,ie,ae,be,ge,ce,ee,xe,xe,Oe,Qe,Se,function(a){nf[a>>6&3].call(this,a)},X,X],nf=[function(a){a=this.b[7]+((a&63)<<1)&65535;var b=this.W(a|this.ta);R(this,this.b[5]);this.b[6]=a+2&65535;this.b[5]=b;this.a-=8},function(a){a=hd(this,a,0);this.da(a);cd(this,a);this.a-=11},function(a){var b=ed(this);this.S= -this.a;this.da(b);id(this,a,0,b);this.a=this.S-Be[this.h]},function(a){pd(this,a,Yc(this)?65535:0,this.da);this.a-=this.h?9:3+(7==this.f?2:0)}],mf=[function(a){of[a&15].call(this,a)},X,X,X,ve,ve,ve,ve,Fe,function(a){!(a&8)||1145>this.pa?L(this,8,0,-9):(this.i&49152||(this.i=this.i&-225|(a&7)<<5,this.g|=1,this.g&=-3),this.a-=5)},Ue,We,Je,Je,Je,Je],of=[se,Le,function(){dd(this);this.g|=this.i&16;this.a-=13},ke,te,Ee,Ge,function(){L(this,8,0,-9)},X,X,X,X,X,X,X,X],kf=[Ce,Ce,qe,qe,Rd,Rd,Sd,Sd,Me,Me,X, -X,X,X,He,He],lf=[je,he,de,fe,me,ne,Td,Ud,re,Ke,Ye,$e,bf,function(a){1145>this.pa?L(this,8,0,-9):pf[a>>6&3].call(this,a)},X,X],pf=[function(){L(this,8,0,-9)},function(a){a=hd(this,a,65536);this.da(a);cd(this,a);this.a-=11},function(a){var b=ed(this);this.S=this.a;this.da(b);id(this,a,65536,b);this.a=this.S-Be[this.h]},function(){L(this,8,0,-9)}]; -function qf(a){r.call(this,"ROM",a,0,128);this.fa=this.b=null;this.h=+a.addr;this.a=+a.size;this.i=!1;this.f=a.alias;"string"==typeof this.f&&(this.f=eval(this.f));this.g=a.file;this.m=F(this.g);if(this.g){a=this.g;var b=Ba(this.m);"json"!=b&&"hex"!=b&&(a=Ka()+"/api/v1/dump?file="+this.g+"&format=bytes&decimal=true");var c=this;G(a,null,!0,function(a,b,f){f?(c.B("Unable to load ROM resource (error "+f+": "+a+")"),c.g=null):(qa(c.Ma,a,b),(a=Ja(a,b))?(c.b=a.N,c.fa=a.fa):c.g=null);rf(c)})}}n(qf,r); -h=qf.prototype;h.aa=function(a,b,c,d){this.u=b;this.c=c;this.D=d;rf(this)};h.ha=function(){this.fa&&(this.D&&this.D.a(this.id,this.h,this.a,this.fa),delete this.fa);return!0};h.ga=function(){return!0}; -function rf(a){if(!xa(a)){if(a.g){if(!a.b||!a.u)return;a.a||(a.a=a.b.length);if(a.b.length!=a.a)wa(a,"ROM size ("+Aa(a.b.length,8,!0)+") does not match specified size ("+Aa(a.a,8,!0)+")");else{var b;a:{b=a.h;a.status(a.a+"-byte ROM at "+za(b));if(57344<=b&&b<57344+Nb){var c={};b=(c[b]=[qf.prototype.be,qf.prototype.mf,null,null,null,a.a>>1],c);if(kb(a.u,a,b)){b=a.i=!0;break a}}else if(Tb(a.u,b,a.a,uc)){for(c=0;c>>f.h;0>>=f.h;0>>a.h;0=b.length)break;for(var l=l+2,p=b[l++]&255|(b[l++]&255)<<8,t=b[l++]&255|(b[l++]&255)<<8,m=m+((p&255)+(p>>8)+(t&255)+(t>>8)),x=l,w=p-=6;0=b.length)break;m+=b[l++]&255;if(m&255)break;if(w)for(;w--;)bc(a.u,t++,b[x++]&255);else t&1?g=!0:null==d&&(d=t);k=!0}else l++;else l+=2}if(!k&&(null==c&&(c=e),null!=c)){for(e=0;e< -b.length;e++)bc(a.u,c+e,b[e]);k=!0}if(k){if(null==d||g)H(a.c),f=!1;null!=d&&Wc(a.c,d,f)}return k}Ua(function(){for(var a=C(document,B,"ram"),b=0;b=q.hc&&c<=q.Uc&&(b=c-(q.hc-q.Gc));b&&(a.preventDefault&&a.preventDefault(),d.Hb(b));return!0},c.onkeypress=function(a){a=a||window.event;if(!a.metaKey){var b=a.which||a.keyCode;a.altKey&&b==q.Ic&&(b=q.Hc);d.Hb(b);a.preventDefault&&a.preventDefault()}return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation(); -a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.Hb(a.getData("Text"))},c.removeAttribute("readonly"),!0}return!1}; -h.aa=function(a,b,c,d){this.A=a;this.u=b;this.c=c;this.D=d;var e=this;this.H=kc(this.c,this.C?-1:48,4,262144);this.I=ic(this.c,function(){var a;a=-1;e.h.length&&(a=e.h.shift()&255,e.w&&97<=a&&122>a&&(a-=32),jc(e.c,e.I,1E3/Math.round(e.K/10)));0<=a&&(e.o=a,e.a&128?e.o|=49152:e.a|=128,e.a&64&&N(c,e.H))});this.F=kc(this.c,this.C?-1:52,4,262144);this.X=ic(this.c,function(){e.b|=128;e.b&64&&N(c,e.F)});kb(b,this,xf,this.C?64832+8*(this.C-1)-65392:0);mb(b,this.reset.bind(this));D(this)}; -h.yc=function(a){if(!this.f){var b=Jc(this.A,"connection");if(b){var c=b.split("->");if(2==c.length){var d=Ga(c[0]);if(d!=this.La)return;c=Ga(c[1]);if(this.f=ua(c)){var e=this.f.exports;if(e){var f=e.connect;f&&f.call(this.f,this.v);if(this.s=e.receiveData){this.v=a;this.G=e.receiveStatus;this.status(this.Ma+"."+d+" connected to "+c);return}}}}this.status("Unable to establish connection: "+b)}}}; -h.ha=function(a,b){if(!b)if(this.yc(this.v),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.ga=function(a){return a?this.save():!0};h.reset=function(){yf(this)};h.save=function(){var a=new J(this);a.set(0,[]);return a.data()};h.restore=function(){return yf(this)};function yf(a){a.o=0;a.a=8192;a.b=128;a.h=[];return!0} -h.Hb=function(a){if("number"==typeof a)this.h.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.S||8,c=a-this.m%a,this.S&&(b=" ".slice(0,c)));this.L&&!this.m&&c&&(b=String.fromCharCode(this.L)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.m+=c}}else if(null!= -this.i){if(10==a||1024<=this.i.length)this.V(this.i),this.i="";10!=a&&(this.i+=String.fromCharCode(a))}jc(this.c,this.X,1E3/Math.round(this.ea/10));this.b&=-129};var wf="buffer",zf={},xf=(zf[65392]=[null,null,Z.prototype.Pd,Z.prototype.Ze,"RCSR"],zf[65394]=[null,null,Z.prototype.Od,Z.prototype.Ye,"RBUF"],zf[65396]=[null,null,Z.prototype.te,Z.prototype.Ff,"XCSR"],zf[65398]=[null,null,Z.prototype.se,Z.prototype.Ef,"XBUF"],zf); -Ua(function(){for(var a=C(document,B,"serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.j[b]=c,!0;case "readTape":e=Df;case "loadTape":return e||(e=Ef),this.j[b]=c,c.onclick= -function(){var a=d.j.listTapes;a&&Ff(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.F){c.parentNode.removeChild(c);break}this.j[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Ff(d,F(b,!0),b,Ef,a)}return!1};return!0;case Gf:return this.j[b]=c,!0}return!1}; -h.aa=function(a,b,c,d){this.A=a;this.u=b;this.c=c;this.D=d;this.v=Hf(a);var e=this;if(a=Af(this,Jc(this.A,"autoMount")))for(var f in a)"PTR"==f&&(this.C[f]=a[f]);this.s=kc(this.c,56,4,4096);this.H=ic(this.c,function(){1==(e.a&32769)&&!(e.a&128)&&e.mc.indexOf("/api/v1/dump")&&(e=Ba(c),f="json"==e||"gz"==e?encodeURI(c):Ka()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!G(f,null,!0,function(e,f,g){var k=0>g&&!!a.A&&!a.A.l.R;g?a.B('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(qa(a.Ma,e,f),(e=Ja(e,f))&&Sf(a,b,c,d,e.N,e.Z,e.Y)); -a.l.Ta=!1;a.b&&(a.b--,a.b||D(a));Pf(a)})}function Kf(a,b,c,d){if((a=a.j.listTapes)&&a.options){for(var e=0;e>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.J);for(d=0;dc.indexOf("/api/v1/dump")&&(b=Ba(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):Ca(c,"/")&&(d="dir"),f=Ka()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.Ab?"":e)+"&format=json"));return!!G(f, -null,!0,function(b,c,d){$f(a,b,c,d)})} -function $f(a,b,c,d){var e=null,f=0>d&&!!a.A&&!a.A.l.R;a.g=!1;if(d)a.controller.B('Unable to load disk "'+a.na+'" (error '+d+": "+b+")",f);else{qa(a.controller.Ma,b,c);try{if(0g&&0c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+ -c+")");if(k.length)if(1==k.length)v(k[0]);else{a.J=k.length;a.O=k[0].length;a.M=k[0][0].length;var l=k[0][0][0];a.U=l&&l.length||512;for(d=c=0;d>2,p=l.pattern;void 0===p&&(p=l.pattern=0);var t=l.data;if(void 0===t){var x=l.bytes;if(void 0!==x&&x.length){for(var w=m<<2,Y=x.length;Y>2,e=Array(d),f=0;f>2,c=(d>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.g)return!1;if(b>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.ia?f=a.ra+a.ia&&(a.ia+=f-(a.ra+a.ia)+1):(a.ra=f,a.ia=1);d[f]=d[f]&~(255<g)break;e|=g<=this.a.length||l>=this.a[k].length||m>=this.a[k][l].length){c="sector (CHS="+k+":"+l+":"+m+") out of range ("+ -b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.a[k][l][m]){for(l=k.data.length;lb&&-2!=b&&this.controller.B("Unable to restore disk '"+this.na+": "+c);return b}; -h.toJSON=function(){var a;a=0;for(var b;b=bg(this,a++);)eg(b);a=JSON.stringify(this.a,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")}; -function eg(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}var Wf=0;function Q(a){r.call(this,"RK11",a,0,65536);this.o=fg(this,a.autoMount);this.m=0;this.f=Array(8);this.s=!Pa("Mobi")&&window&&"FileReader"in window;this.Ja=null;this.w=this.b=this.a=this.i=this.h=this.g=this.v=0}n(Q,r); -function fg(a,b){if(b&&"string"==typeof b)try{b=eval("("+b+")")}catch(c){v(a.type+" auto-mount error: "+c.message+" ("+b+")"),b=null}return b||{}}h=Q.prototype; -h.ca=function(a,b,c){var d=this;switch(b){case "listDisks":return this.j[b]=c,c.onchange=function(){var a=d.j.descDisk,b=c.options&&c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){v("RK11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.j[b]=c,c.onchange=function(){var a=E(c.value);null!=a&&gg(d,a)}, -!0;case "loadDisk":return this.j[b]=c,c.onclick=function(){var a=d.j.listDisks;a&&a.options&&hg(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.j[b]=c,c.onclick=function(){var a,b=d.j.listDrives,b=b&&E(b.value);null==b||0>b||b>=d.f.length||!(a=d.f[b])?d.B("Unable to boot the selected drive"):a.T?(Wc(d.c,0,!0),(a=d.sc(a,0,0,0,512,0,2))&&d.B("Unable to read the boot sector ("+a+")")):d.B("Load a disk into the drive first")},!0;case "saveDisk":if(!this.s){c.parentNode.removeChild(c); -break}this.j[b]=c;c.onclick=function(){var a=d.j.listDrives;a&&a.options&&d.f&&((a=d.f[E(a.value)||0])?(a=a.T)?(a=Sa(dg(a),a.Ib.replace(".json",".img")),v(a)):d.B("No disk loaded in drive."):d.B("No disk drive selected."))};return!0;case "mountDisk":if(this.s)return this.j[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;hg(d,F(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; -h.aa=function(a,b,c,d){this.A=a;this.u=b;this.c=c;this.D=d;if(a=fg(this,Jc(this.A,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.o[e]=a[e]);ig(this);this.Ja=kc(this.c,144,5,65536);kb(b,this,jg);mb(b,this.reset.bind(this));kg(this,"None",lg,!0);this.s&&kg(this,"Local Disk",mg);kg(this,"Remote Disk",ng);og(this)||D(this)}; -h.ha=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.A.m){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RK"+b;a.appendChild(c)}a.value="0";gg(this,0)}}return!0};h.ga=function(a){return a?this.save():!0};h.reset=function(){ig(this)};h.save=function(){return(new J(this)).data()}; -h.restore=function(a){return ig(this,a[0])};function og(a,b){b||(a.m=0);for(var c in a.o){var d=a.o[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.j.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.f.length)a.B("Unable to load the selected drive");else if(c)if(c==mg)a.B('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==ng){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=F(c);a.status("Attempting to load "+c+' as "'+b+'"')}qg(a,e,b,c,!1,d)}else pg(a,e)} -function qg(a,b,c,d,e,f){var g=-1,k=a.f[b];k.ba.toLowerCase()!=d.toLowerCase()&&(g++,pg(a,b,!0),k.Va?a.B("RK11 busy"):(k.Va=!0,e&&(k.Ua=!0,a.m++),k.ya=!!f,Zf(new Vf(a,k,"preload"),c,d,f,a.Mc)&&g++));return g}h.Mc=function(a,b,c,d,e){a.Va=!1;b&&(b.J>a.J||b.O>a.O)&&(this.B('Disk "'+c+'" too large for drive '+("RK"+a.Ia)),b=null);b?(a.T=b,a.na=c,a.ba=d,this.B('Loaded disk "'+c+'" in drive '+("RK"+a.Ia),a.Ua||e),this.A&&Qc(this.A)):a.ya=!1;a.Ua&&(a.Ua=!1,--this.m||D(this));gg(this,a.Ia)}; -function kg(a,b,c,d){if((a=a.j.listDisks)&&a.options){for(var e=0;e=a.J){m=64;break}p=a.seek(b,c,d+1);if(!p){m=4096;break}t=0;++d>=a.M&&(d=0,++c>=a.O&&(c=0,++b))}var x,w;if(0>(x=a.read(p,t++))||0>(w=a.read(p,t++))){m=32;break}if(!k&&(Fb(this.u,fd(this.c,f),x|w<<8),hc(this.u))){m=1024;break}t>=a.U&&(p=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; -h.Nc=function(a,b,c,d,e,f,g,k,l){var m=0;a=a.T;var p=null,t;a||(m=128,e=0);for(;e;){var x=Hb(this.u,fd(this.c,f));if(hc(this.u)){m=1024;break}if(!p){if(b>=a.J){m=64;break}p=a.seek(b,c,d+1,!0);if(!p){m=4096;break}t=0;++d>=a.M&&(d=0,++c>=a.O&&(c=0,++b))}if(k){var w,Y;if(0>(w=a.read(p,t++))||0>(Y=a.read(p,t++))){m=32;break}if(x!=(w|Y<<8)){m=1;break}}else if(!a.write(p,t++,x&255)||!a.write(p,t++,x>>8)){m=32;break}t>=a.U&&(p=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; -h.Lc=function(a,b,c,d,e,f){this.h=f&65535;this.a=this.a&-49|f>>12&48;this.i=65536-e&65535;this.g=this.g&-16|d&15;this.b|=a;rg(this);return!0};function rg(a){a.a&=-32769;a.b&&(a.b|=32768,a.a|=32768,a.b&32736&&(a.a|=16384))}h.Ud=function(){return this.w};h.df=function(){};h.Vd=function(){return this.b};h.ef=function(){};h.Rd=function(){return this.a&61438}; -h.af=function(a){this.a=this.a&-3968|a&3967;if(this.a&1){a=!0;var b,c,d=(this.g&57344)>>13,e=this.f[d],f,g,k,l,m,p;this.a&=-8321;this.b&=-4;switch(c=this.a&14){case 0:this.b=this.g=0;this.a=128;break;case 10:case 4:b=this.sc;case 6:case 2:b||(b=this.Nc);f=(this.g&8160)>>5;g=(this.g&16)>>4;k=this.g&15;l=65536-this.i&65535;m=(this.a&48)<<12|this.h;p=this.a&2048?0:2;if(f>=e.J){this.b|=64;break}if(k>=e.M){this.b|=32;break}a=b.call(this,e,f,g,k,l,m,p,6<=c,this.Lc.bind(this));break;case 8:f=(this.g&8160)>> -5;f'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.j[b]=c,c.onchange=function(){var a=E(c.value);null!=a&&ug(d,a)}, -!0;case "loadDisk":return this.j[b]=c,c.onclick=function(){var a=d.j.listDisks;a&&a.options&&vg(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.j[b]=c,c.onclick=function(){var a,b=d.j.listDrives,b=b&&E(b.value);null==b||0>b||b>=d.b.length||!(a=d.b[b])?d.B("Unable to boot the selected drive"):a.T?(Wc(d.c,0,!0),(a=d.tc(a,0,0,0,512,0))&&d.B("Unable to read the boot sector ("+a+")")):d.B("Load a disk into the drive first")},!0;case "saveDisk":if(!this.v){c.parentNode.removeChild(c); -break}this.j[b]=c;c.onclick=function(){var a=d.j.listDrives;a&&a.options&&d.b&&((a=d.b[E(a.value)||0])?(a=a.T)?(a=Sa(dg(a),a.Ib.replace(".json",".img")),v(a)):d.B("No disk loaded in drive."):d.B("No disk drive selected."))};return!0;case "mountDisk":if(this.v)return this.j[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;vg(d,F(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; -h.aa=function(a,b,c,d){this.A=a;this.u=b;this.c=c;this.D=d;if(a=tg(this,Jc(this.A,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.s[e]=a[e]);wg(this);this.Ja=kc(this.c,112,5,131072);kb(b,this,xg);mb(b,this.reset.bind(this));yg(this,"None",zg,!0);this.v&&yg(this,"Local Disk",Ag);yg(this,"Remote Disk",Bg);Cg(this)||D(this)}; -h.ha=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.A.m){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";ug(this,0)}}return!0};h.ga=function(a){return a?this.save():!0};h.reset=function(){wg(this)};h.save=function(){return(new J(this)).data()}; -h.restore=function(a){return wg(this,a[0])};function Cg(a,b){b||(a.o=0);for(var c in a.s){var d=a.s[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.j.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.b.length)a.B("Unable to load the selected drive");else if(c)if(c==Ag)a.B('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Bg){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=F(c);a.status("Attempting to load "+c+' as "'+b+'"')}Eg(a,e,b,c,!1,d)}else Dg(a,e)} -function Eg(a,b,c,d,e,f){var g=-1,k=a.b[b];k.ba.toLowerCase()!=d.toLowerCase()&&(g++,Dg(a,b,!0),k.Va?a.B("RL11 busy"):(k.Va=!0,e&&(k.Ua=!0,a.o++),k.ya=!!f,Zf(new Vf(a,k,"preload"),c,d,f,a.Pc)&&g++));return g}h.Pc=function(a,b,c,d,e){a.Va=!1;b&&(b.J>a.J||b.O>a.O)&&(this.B('Disk "'+c+'" too large for drive '+("RL"+a.Ia)),b=null);b?(a.T=b,a.na=c,a.ba=d,this.B('Loaded disk "'+c+'" in drive '+("RL"+a.Ia),a.Ua||e),this.A&&Qc(this.A)):a.ya=!1;a.Ua&&(a.Ua=!1,--this.o||D(this));ug(this,a.Ia)}; -function yg(a,b,c,d){if((a=a.j.listDisks)&&a.options){for(var e=0;e(p=a.read(l,m++))||0>(t=a.read(l,m++))){k=5120;break}Fb(this.u,fd(this.c,f),p|t<<8);if(hc(this.u)){k=8192;break}f+=2;e--;if(m>=a.U&&(l=null,++d>=a.M&&(d=0,++c>=a.O&&(c=0,++b>=a.J)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; -h.Qc=function(a,b,c,d,e,f,g){var k=0;a=a.T;var l=null,m;a||(k=5120,e=0);for(;e;){var p=Hb(this.u,fd(this.c,f));if(hc(this.u)){k=8192;break}f+=2;e--;if(!l){l=a.seek(b,c,d+1,!0);if(!l){k=5120;break}m=0}if(!a.write(l,m++,p&255)||!a.write(l,m++,p>>8)){k=5120;break}if(m>=a.U&&(l=null,++d>=a.M&&(d=0,++c>=a.O&&(c=0,++b>=a.J)))){k=5120;break}}return g?g(k,b,c,d,e,f):k}; -h.Oc=function(a,b,c,d,e,f){this.m=f&65535;this.a=this.a&-49|f>>12&48;this.h=f>>16&63;this.g=this.f=b<<7|(c?64:0)|d&63;this.i=65536-e&65535;a&&(this.a=this.a|a|32768);return!0};h.Zd=function(){return this.a&65535}; -h.jf=function(a){this.a=this.a&-1023|a&1022;this.h=this.h&60|(a&48)>>4;if(!(this.a&128)){a=!0;var b,c=this.b[(this.a&768)>>8],d=c.T,e,f,g;this.a&=-2;switch(this.a&14){case 4:this.i&8&&(this.a&=63);this.i=c.status|this.g&64|(d&&512==d.J?128:0);break;case 6:1==(this.f&3)&&(b=this.f&65408,c=(this.f&16)<<2,this.g=this.f&4?this.g+b:this.g-b,this.f=this.g=this.g&65408|c);break;case 8:this.i=this.g;break;case 12:b=this.tc;case 10:b||(b=this.Qc),e=this.f>>7,f=this.f&64?1:0,g=this.f&63,!d||e>=d.J||g>=d.M? -this.a|=37888:(a=65536-this.i&65535,d=(this.h&63)<<16|this.m,a=b.call(this,c,e,f,g,a,d,this.Oc.bind(this)))}a&&(this.a|=129,this.a&64&&N(this.c,this.Ja))}};h.Xd=function(){return this.m};h.gf=function(a){this.m=a&65534};h.$d=function(){return this.f};h.kf=function(a){this.f=a};h.ae=function(){return this.i};h.lf=function(a){this.i=a};h.Yd=function(){return this.h};h.hf=function(a){this.h=a&63;this.a=this.a&-49|(this.h&3)<<4}; -var zg="",Ag="?",Bg="??",Fg={},xg=(Fg[63744]=[null,null,P.prototype.Zd,P.prototype.jf,"RLCS"],Fg[63746]=[null,null,P.prototype.Xd,P.prototype.gf,"RLBA"],Fg[63748]=[null,null,P.prototype.$d,P.prototype.kf,"RLDA"],Fg[63750]=[null,null,P.prototype.ae,P.prototype.lf,"RLMP"],Fg[63752]=[null,null,P.prototype.Yd,P.prototype.hf,"RLBE"],Fg); -function Gg(a,b,c){r.call(this,"Computer",a,0,33554432);this.l.R=!1;this.G=null;Hg(this,b);this.C=Jc(this,"autoPower",a,6);this.g=0;this.K=+a.busWidth||+a.buswidth;this.v=this.s=this.w=null;this.o=this.I=!1;this.i=this.h=null;this.H=this.m=this.F=!1;this.L=Jc(this,"url")||"";(Math.random()+.1).toString(36);this.b=Ig(this);if(this.c=va("CPU",this.id)){this.D=va("Debugger",this.id);this.u=new Mb({id:this.Ma+".bus",busWidth:this.K},this.c,this.D);var d,e=y(this.id);if((this.f=va("Panel",this.id))&&this.f.ab)for(b= -0;b\nLicense: GPL version 3 or later ");this.V("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis ");for(b=0;bJg){if(Kg(d,this.v)){this.h=new J(this,"1.32.2",Tg);Kg(this.h)&&(Ug(this,d),a=Vg,Yg(this.h));this.h.set(Qg,Ia());Zg(this.h);var e=this.a&&!this.o;if(a==Rg||ta("Click OK to restore the previous "+cb+" machine state, or CANCEL to reset the machine.")){if(c=Pg(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Kg(d,g):("error"==f&&"no machine state"!= -g?(this.B("Error: "+g),"unable to verify user"==g&&(Oa($g,""),this.b=null)):this.V(f+": "+g),Yg(d),Kg(d)?(c=Pg(d),e=!0):c=!1))}e&&Ng(this,c?d:null)}else a==Vg&&d.clear()}else Ng(this);delete this.v;delete this.i}e=y(this.id);for(f=0;fa[1];a=a[2];this.H=!0;this.l.R=!0;var d=this.j.power;d&&(d.textContent="Shutdown");this.c&&(ah(this,this.c,b,c,a),Cb(this),this.c.ma());this.F&&(Ug(this,b),b.clear());!c&&this.h&&(this.h.clear(),delete this.h);this.g=0}; -function Ug(a,b){if(ta("There may be a problem with your "+cb+" machine.\n\nTo help us diagnose it, click OK to send this "+cb+" machine state to http://www.pcjs.org.")){var c=a.L;a=a.b||"";b=b.toString();var d={};d.app=cb;d.ver="1.32.2";d.url=c;d.user=a;d.type="bug";d.data=b;G("http://www.pcjs.org/api/v1/report",d,!0)}} -function bh(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new J(a,"1.32.2"),g=new J(a,"1.32.2",Og),k=Ia();g.set(Qg,k);f.set(Qg,k);f.set(ch,"1.32.2");f.set(dh,window?window.location.href:null);f.set(eh,window?window.navigator.userAgent:"");a.c&&a.c.ga&&(c&&H(a.c),d=a.c.ga(b,c),"object"===typeof d&&f.set(a.c.id,d),c&&(a.c.l.R=!1,!1===d&&(e=null)));for(var k=y(a.id),l=0;l=d||30<=(c.ec+=d))&&(e.textContent=c.l.P?c.Na.toFixed(2)+"Mhz":"Stopped",c.ec=0)}if(a.f&&(a=a.f,b=b||0,a.m)){c=a.c.l.P;d=!!(a.c.g&8);if(0>=b||60<=(a.i+=b)){for(e=0;ef.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDPjs$2"), -a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){f=null,a=p.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");G(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],g);mh(a,b,c)}})}else c(a,null)} -function nh(a,b,c,d){function e(a){if(void 0===k){var b=g&&C(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=Ea(a))}function f(a){e("Error: "+a);l&&(--jh||Ya(!0));l=!1}var g,k,l=!0;jh++;ra[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=m:t.appendChild(document.createTextNode(m));p.appendChild(t)}c|| -(c="/versions/pdpjs/1.32.2/components.xsl");m=function(d,k){k?kh(c,null,null,!1,e,function(d,l){l?(qa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--jh||Ya(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--jh||Ya(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?kh(b,a,d,!0,e,m):lh(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(x){f(x.message)}return l}window.embedPDP11=function(a,b,c,d){Ya(!1);return nh(a,b,c,d)};window.findMachineComponent=function(a,b){return va(b,a+".machine")};window.enableEvents=Ya;window.sendEvent=$a;})();//# sourceMappingURL=/tmp/pdpjs/1.32.2/pdp11.map +function Pa(a,b){var c,d={M:null,ga:null,ca:null,ba:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.ca=g.load;d.ba=g.exec;if(e=g.bytes)d.M=e;else if(e=g.words)for(d.M=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.M=Array(4*e.length),f=c=0;c>8&255,d.M[f++]=e[c]>>16&255,d.M[f++]=e[c]>>24&255;else d.M=g;d.ga=g.symbols;d.M.length?1==d.M.length&&(u(d.M[0]),d=null):(u("Empty resource: "+a),d=null)}catch(k){u("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;ca;a++)this.a["S"+a]=[0,0,!1,!1,this.De,a];this.F=this.c=this.u=this.A=null;B(this)}n(lb,q);h=lb.prototype; +h.reset=function(a){this.stop();a&&nb(this,this.f=0)}; +h.ka=function(a,b,c,d){if(this.A&&this.A.ka(a,b,c,d)||this.c&&this.c.ka(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.m[b]=c,this.l++,!0;default:return"led"==a||"rled"==a?(this.m[b]=c,this.h[b]=d?1:0,this.l++,!0):"switch"==a?(void 0===this.a[b]&&(this.a[b]=[d?1:0,d?1:0]),this.m[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,b){return function(){ob(a, +b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){pb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){ob(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){pb(a,b)}}(this,b),!0):q.prototype.ka.call(this,a,b,c,d)}};h.ha=function(a,b,c,d){this.A=a;this.u=b;this.c=c;this.F=d;qb(b,this,rb);sb(b,this.reset.bind(this));tb(this);ub(this)};h.ja=function(a,b){if(!b)if(this.D&&vb(),!a)this.reset(!0);else if(!this.restore(a))return!1;return!0}; +h.ia=function(a){return a?this.save():!0};h.save=function(){var a=new E(this);a.set(0,[this.U,this.f,this.b]);return a.data()};h.restore=function(a){if(a=a[0])wb(this,this.U=a[0]),nb(this,this.f=a[1]),xb(this,a[2]);return!0};function yb(a,b,c){if(a=a.m[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function tb(a,b){for(var c in a.h)yb(a,c,null!=b?b:a.h[c])}function zb(a,b,c){if(a=a.m[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"} +function ub(a){for(var b in a.a)zb(a,b,a.a[b][1])}function Ab(a,b,c,d){if(a.m[b]){var e=a.F&&a.F.h||8;c=c||0;c=8==e?Da(c,d):Ea(c,d);a.m[b].textContent!=c&&(a.m[b].textContent=c)}}function ob(a,b){var c=a.a[b];zb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);b!=Bb&&(a.w=b==Cb,a.B=b==Db)}function pb(a,b){var c=a.a[b];c[2]&&c[3]&&(zb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.Be=function(a){a||this.c.j.L||(a=this.c,a.u.reset(),Eb(a),this.a[Fb]&&this.a[Fb][1]&&Gb(this.c))};h.Ce=function(){}; +h.xe=function(a){a||F(this.c)};h.ve=function(a){if(!a&&!this.c.j.L)if(this.a[Fb]&&this.a[Fb][1])Gb(this.c);else{a=this.F;var b;if(b=a)a.j.Va&&(a.j.Ac=!0),b=!a.j.Va;if(b)Ba(a,!0),a.f(0,null),Ba(a,!1);else try{var c=this.c.kc(1);0=a.c.pa?8:16,c=65472<=a.U&&a.U<65472+b,b=c?1:2,c=c?15:a.u.v;a.a[Bb]&&a.a[Bb][1]||(b=-b);wb(a,a.U&~c|a.U+b&c)}function wb(a,b){a.U=b&a.u.v;if(a.s!==a.U){a.s=a.U;b=a.s;for(var c=0;22>c;c++)Pb(a,"A"+c,b&1<c;c++)Pb(a,"D"+c,b&1<c;c++)a.a["S"+c][1]=b&1<>2;this.f=this.g-1;this.s=this.C/this.g|0;this.K=this.s-1;this.Ka=[];this.l=0;this.o=!1;this.D=[];this.me=[Ub,Vb,Wb,Xb];this.a=this.b=[];this.B=this.w=this.i=this.H=this.I=0;a=new G(this);Yb(a);this.a=Array(this.s);this.b=Array(this.s);for(b=0;b>>this.h;this.w=0;this.i=this.v;B(this)}n(Sb,q);function ac(a,b){if(b!=a.w){for(var c=0;c>>a.h,a.b[a.I]=a.a[a.H])}}h=Sb.prototype;h.reset=function(){for(var a=0;a>>a.h;0g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.Ua)return l.Hb+=l.Ua-f,l.Ua=f,!0;if(f>=l.Ua+l.Hb){p=l.size-(f-m);p>g&&(p=g);l.Hb=f-l.Ua+p;f=m+a.g;g-=p;k++;continue}}return cc(dc,f,g)}f=new G(a,f,p,a.g,d,e);Yb(f,l);a.a[k++]=f;f=m+a.g;g-=p}return 0>=g?(a.status("Added "+(c>>10)+"Kb "+ec[d]+" at "+Da(b)),!0):cc(fc,b,c)}h.xd=function(a){return this.b[(a&this.i)>>>this.h].lb(a&this.f,a)}; +h.Kb=function(a){var b=a&this.f,c=(a&this.i)>>>this.h;return jb||b!=this.f?this.b[c].W(b,a):this.b[c++].lb(b,a)|this.b[c&this.K].lb(0,a+1)<<8};h.yd=function(a,b){this.b[(a&this.i)>>>this.h].ob(a&this.f,b,a)};h.Lb=function(a,b){var c=a&this.f,d=(a&this.i)>>>this.h;jb||c!=this.f?this.b[d].rb(c,b,a):(this.b[d++].ob(c,b&255,a),this.b[d&this.K].ob(0,b>>8&255,a+1))};function gc(a,b){return a.a[(b&a.v)>>>a.h]} +function Ob(a,b){var c;a.o=!1;a.l++;var d=b&a.f,e=gc(a,b);jb||d!=a.f?c=e.l(d,b):c=e.i(d,b)|gc(a,b+1).i(0,b+1)<<8;a.l--;return c}function hc(a,b,c){a.o=!1;a.l++;gc(a,b).m(b&a.f,c&255,b);a.l--}function Mb(a,b,c){a.o=!1;a.l++;var d=b&a.f,e=gc(a,b);jb||d!=a.f?e.F(d,c&65535,b):(e.m(d,c&255,b),gc(a,b+1).m(0,c>>8&255,b+1));a.l--} +function bc(a){for(var b=0,c=[],d=0;da.c.pa)){var k=g[0]?g[0].bind(b):null,l=g[1]?g[1].bind(b):null,m=g[2]?g[2].bind(b):null,p=g[3]?g[3].bind(b):null;65472<=f&&65487>=f&&(!k&&m&&(k=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!l&&p&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));for(var t=g[4],z=g[5]||1,y=0;y>8:e[2](f)&255):f&1&&(e=d.Ka[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return c;H(d,b,16);return 255} +function Vb(a,b,c){var d=!1,e=this.controller,f=e.Ka[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Ka[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d||H(e,c,16)}function Wb(a,b){var c=-1,d=this.controller;a=d.Ka[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return c;H(d,b,16);return 65535} +function Xb(a,b,c){var d=!1,e=this.controller;a=e.Ka[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d||H(e,c,16)}function J(a){q.call(this,"Device",a,256);this.a={Da:128,Jc:-1}}n(J,q);h=J.prototype;h.ha=function(a,b,c,d){this.u=b;this.A=a;this.c=c;this.F=d;var e=this;this.a.Jc=nc(c,function(){e.a.Da|=128;e.a.Da&64&&oc(e.c,e.a.jb);e.A&&Kb(e.A,1);pc(e.c,e.a.Jc,1E3/60)});this.a.jb=qc(c,64,6,524288);qb(b,this,sc);sb(b,this.reset.bind(this));B(this)}; +h.ja=function(a,b){if(!b)if(!a)this.reset();else if(!this.restore(a))return!1;return!0};h.ia=function(a){return a?this.save():!0};h.reset=function(){this.a.Da=128;pc(this.c,this.a.Jc,1E3/60,!0)};h.save=function(){var a=new E(this);a.set(0,[this.a.Da]);return a.data()};h.restore=function(a){a=ja(a[0]);this.a.Da=a.next().value;return!0};h.Pe=function(){return this.a.Da};h.bg=function(a){this.a.Da=a&192;this.a.Da&64||(a=this.a.jb)&&tc(this.c,a)};h.Re=function(){return uc(this.c)}; +h.dg=function(a){vc(this.c,a&-129|this.c.J&128)};h.Se=function(){return wc(this.c)};h.Te=function(){return xc(this.c)};h.Ue=function(){return this.c.qa};h.eg=function(a){yc(this.c,a)};h.Df=function(a){a=a>>1&63;var b=this.c.Ja[a>>1];return a&1?b>>16:b&65535};h.Mg=function(a,b){b=b>>1&63;var c=b>>1;this.c.Ja[c]=b&1?this.c.Ja[c]&65535|(a&63)<<16:this.c.Ja[c]&-65536|a&65534};h.wf=function(a){return this.c.s[1][a>>1&7]};h.Fg=function(a,b){this.c.s[1][b>>1&7]=a&65295}; +h.uf=function(a){return this.c.s[1][(a>>1&7)+8]};h.Dg=function(a,b){this.c.s[1][(b>>1&7)+8]=a&65295};h.vf=function(a){return this.c.H[1][a>>1&7]};h.Eg=function(a,b){b=b>>1&7;this.c.H[1][b]=a;this.c.s[1][b]&=65295};h.tf=function(a){return this.c.H[1][(a>>1&7)+8]};h.Cg=function(a,b){b=(b>>1&7)+8;this.c.H[1][b]=a;this.c.s[1][b]&=65295};h.Oe=function(a){return this.c.s[0][a>>1&7]};h.ag=function(a,b){this.c.s[0][b>>1&7]=a&65295};h.Me=function(a){return this.c.s[0][(a>>1&7)+8]}; +h.Zf=function(a,b){this.c.s[0][(b>>1&7)+8]=a&65295};h.Ne=function(a){return this.c.H[0][a>>1&7]};h.$f=function(a,b){b=b>>1&7;this.c.H[0][b]=a;this.c.s[0][b]&=65295};h.Le=function(a){return this.c.H[0][(a>>1&7)+8]};h.Yf=function(a,b){b=(b>>1&7)+8;this.c.H[0][b]=a;this.c.s[0][b]&=65295};h.Cf=function(a){return this.c.s[3][a>>1&7]};h.Lg=function(a,b){this.c.s[3][b>>1&7]=a&65295};h.Af=function(a){return this.c.s[3][(a>>1&7)+8]};h.Jg=function(a,b){this.c.s[3][(b>>1&7)+8]=a&65295}; +h.Bf=function(a){return this.c.H[3][a>>1&7]};h.Kg=function(a,b){b=b>>1&7;this.c.H[3][b]=a;this.c.s[3][b]&=65295};h.zf=function(a){return this.c.H[3][(a>>1&7)+8]};h.Ig=function(a,b){b=(b>>1&7)+8;this.c.H[3][b]=a;this.c.s[3][b]&=65295};h.mb=function(a){a&=7;return this.c.i&2048?this.c.sa[a]:this.c.b[a]};h.pb=function(a,b){b&=7;this.c.i&2048?this.c.sa[b]=a:this.c.b[b]=a};h.Ze=function(){return this.c.i&49152?this.c.fa[0]:this.c.b[6]};h.jg=function(a){this.c.i&49152?this.c.fa[0]=a:this.c.b[6]=a}; +h.bf=function(){return this.c.b[7]};h.mg=function(a){this.c.b[7]=a};h.nb=function(a){a&=7;return this.c.i&2048?this.c.b[a]:this.c.sa[a]};h.qb=function(a,b){b&=7;this.c.i&2048?this.c.b[b]=a:this.c.sa[b]=a};h.$e=function(){return 1==(this.c.i&49152)>>14?this.c.b[6]:this.c.fa[1]};h.kg=function(a){1==(this.c.i&49152)>>14?this.c.b[6]=a:this.c.fa[1]=a};h.af=function(){return 3==(this.c.i&49152)>>14?this.c.b[6]:this.c.fa[3]};h.lg=function(a){3==(this.c.i&49152)>>14?this.c.b[6]=a:this.c.fa[3]=a}; +h.Ke=function(a){return this.c.Eb[a-65504>>1]};h.Xf=function(a,b){this.c.Eb[b-65504>>1]=a};h.sd=function(a){return 65520==a?(ic(this.u)>>6)-1:0};h.vd=function(){};h.yf=function(){return 1};h.Hg=function(){};h.Je=function(){return this.c.D};h.Wf=function(){this.c.D=0};h.Qe=function(){return this.c.Bb};h.cg=function(a,b){b&1||(a&=255);this.c.Bb=a};h.Ve=function(a,b){return b?0:this.c.Sa};h.fg=function(a){var b=this.c;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1);b.g|=1}b.Sa=a}; +h.xf=function(a,b){return b?0:this.c.Ia&65280};h.Gg=function(a){this.c.Ia=a|255};h.Ye=function(){return zc(this.c)};h.ig=function(a){Ac(this.c,a)};h.ud=function(){}; +var K={},sc=(K[61568]=[null,null,J.prototype.Df,J.prototype.Mg,"UNIMAP",64,1170],K[62592]=[null,null,J.prototype.wf,J.prototype.Fg,"SIPDR",8,1145,64],K[62608]=[null,null,J.prototype.uf,J.prototype.Dg,"SDPDR",8,1145,64],K[62624]=[null,null,J.prototype.vf,J.prototype.Eg,"SIPAR",8,1145,64],K[62640]=[null,null,J.prototype.tf,J.prototype.Cg,"SDPAR",8,1145,64],K[62656]=[null,null,J.prototype.Oe,J.prototype.ag,"KIPDR",8,1140,64],K[62672]=[null,null,J.prototype.Me,J.prototype.Zf,"KDPDR",8,1145,64],K[62688]= +[null,null,J.prototype.Ne,J.prototype.$f,"KIPAR",8,1140,64],K[62704]=[null,null,J.prototype.Le,J.prototype.Yf,"KDPAR",8,1145,64],K[62798]=[null,null,J.prototype.Ue,J.prototype.eg,"MMR3",1,1145,64],K[65382]=[null,null,J.prototype.Pe,J.prototype.bg,"LKS"],K[65402]=[null,null,J.prototype.Re,J.prototype.dg,"MMR0",1,1140,64],K[65404]=[null,null,J.prototype.Se,J.prototype.ud,"MMR1",1,1145,64],K[65406]=[null,null,J.prototype.Te,J.prototype.ud,"MMR2",1,1140,64],K[65408]=[null,null,J.prototype.Cf,J.prototype.Lg, +"UIPDR",8,1140,64],K[65424]=[null,null,J.prototype.Af,J.prototype.Jg,"UDPDR",8,1145,64],K[65440]=[null,null,J.prototype.Bf,J.prototype.Kg,"UIPAR",8,1140,64],K[65456]=[null,null,J.prototype.zf,J.prototype.Ig,"UDPAR",8,1145,64],K[65472]=[null,null,J.prototype.mb,J.prototype.pb,"R0SET0"],K[65473]=[null,null,J.prototype.mb,J.prototype.pb,"R1SET0"],K[65474]=[null,null,J.prototype.mb,J.prototype.pb,"R2SET0"],K[65475]=[null,null,J.prototype.mb,J.prototype.pb,"R3SET0"],K[65476]=[null,null,J.prototype.mb, +J.prototype.pb,"R4SET0"],K[65477]=[null,null,J.prototype.mb,J.prototype.pb,"R5SET0"],K[65478]=[null,null,J.prototype.Ze,J.prototype.jg,"R6KERNEL"],K[65479]=[null,null,J.prototype.bf,J.prototype.mg,"R7KERNEL"],K[65480]=[null,null,J.prototype.nb,J.prototype.qb,"R0SET1",1,1145],K[65481]=[null,null,J.prototype.nb,J.prototype.qb,"R1SET1",1,1145],K[65482]=[null,null,J.prototype.nb,J.prototype.qb,"R2SET1",1,1145],K[65483]=[null,null,J.prototype.nb,J.prototype.qb,"R3SET1",1,1145],K[65484]=[null,null,J.prototype.nb, +J.prototype.qb,"R4SET1",1,1145],K[65485]=[null,null,J.prototype.nb,J.prototype.qb,"R5SET1",1,1145],K[65486]=[null,null,J.prototype.$e,J.prototype.kg,"R6SUPER",1,1145],K[65487]=[null,null,J.prototype.af,J.prototype.lg,"R6USER",1,1145],K[65504]=[null,null,J.prototype.Ke,J.prototype.Xf,"CTRL",8,1170],K[65520]=[null,null,J.prototype.sd,J.prototype.vd,"LSIZE",1,1170],K[65522]=[null,null,J.prototype.sd,J.prototype.vd,"HSIZE",1,1170],K[65524]=[null,null,J.prototype.yf,J.prototype.Hg,"SYSID",1,1170],K[65526]= +[null,null,J.prototype.Je,J.prototype.Wf,"ERR",1,1170],K[65528]=[null,null,J.prototype.Qe,J.prototype.cg,"MBR",1,1170],K[65530]=[null,null,J.prototype.Ve,J.prototype.fg,"PIR"],K[65532]=[null,null,J.prototype.xf,J.prototype.Gg,"SLR"],K[65534]=[null,null,J.prototype.Ye,J.prototype.ig,"PSW"],K); +Za(function(){for(var a=A(document,x,"device"),b=0;b>1),this.c=new Int32Array(this.f,0,this.size>>2),Fc(this,Gc?Hc:Ic);else{a=this.c=Array(this.size>>2);for(f=0;f>2),b=0;b>8,c)};h.He=function(a){return this.c[a>>2]>>>((a&3)<<3)&255};h.If=function(a,b){ib&&a&1&&H(this.b,b,64);b=a>>2;a=(a&3)<<3;var c=this.c[b]>>a;return 24>a?c&65535:c&255|(this.c[b+1]&255)<<8}; +h.Uf=function(a,b){var c=a>>2;a=(a&3)<<3;this.c[c]=this.c[c]&~(255<>2;a=(a&3)<<3;24>a?this.c[c]=this.c[c]&~(65535<>8);this.Ca=!0};h.Fe=function(a,b){return this.i(a,b)};h.Ff=function(a,b){return this.l(a,b)};h.Sf=function(a,b,c){this.A?this.Jb(0,0,c):this.m(a,b,c)};h.Og=function(a,b,c){this.A?this.Jb(0,0,c):this.F(a,b,c)};h.Ee=function(a){return this.a[a]}; +h.Ge=function(a){return this.a[a]};h.Ef=function(a,b){ib&&a&1&&H(this.b,b,64);return this.u.getUint16(a,!0)};h.Hf=function(a,b){ib&&a&1&&H(this.b,b,64);return!jb&&a&1?this.a[a]|this.a[a+1]<<8:this.o[a>>1]};h.Rf=function(a,b){this.a[a]=b;this.Ca=!0};h.Tf=function(a,b){this.a[a]=b;this.Ca=!0};h.Ng=function(a,b,c){ib&&a&1&&H(this.b,c,64);this.u.setUint16(a,b,!0);this.Ca=!0};h.Pg=function(a,b,c){ib&&a&1&&H(this.b,c,64);!jb&&a&1?(this.a[a]=b,this.a[a+1]=b>>8):this.o[a>>1]=b;this.Ca=!0}; +var Dc=0,jc=1,Ec=2,$b=4,ec=["NONE","RAM","ROM","VID","H/W"],Cc=0,Lc=[],Jc=[G.prototype.He,G.prototype.Uf,G.prototype.If,G.prototype.Qg],Oc=[G.prototype.Fe,G.prototype.Sf,G.prototype.Ff,G.prototype.Og];if(gb)var Ic=[G.prototype.Ee,G.prototype.Rf,G.prototype.Ef,G.prototype.Ng],Hc=[G.prototype.Ge,G.prototype.Tf,G.prototype.Hf,G.prototype.Pg];var Pc;if(gb){var Qc=new ArrayBuffer(2);(new DataView(Qc)).setUint16(0,256,!0);Pc=256===(new Uint16Array(Qc))[0]}else Pc=!1;var Gc=Pc; +function Rc(a,b){q.call(this,"CPU",a,1);b=+a.cycles||b;var c=+a.multiplier||1;this.Lc=0;this.ec=b;this.Ra=c;this.nc=Math.round(this.ec/1E4)/100;this.ab=this.nc*this.Ra;this.oc=this.Ab=this.eb=this.fc=0;this.j.L=this.j.Ic=!1;this.j.Y=a.autoStart;"string"==typeof this.j.Y&&(this.j.Y="true"==this.j.Y);this.j.Tb=!1;this.cc=this.cb=0;this.dc=+a.csStart;this.yb=+a.csInterval;this.zb=+a.csStop;this.X=[];this.bd=this.Mf.bind(this);this.Ha=this.Aa=this.Ga=this.a=this.aa=this.za=this.xb=this.Fa=this.fb=this.pc= +this.Oa=0;this.na=null;B(this)}n(Rc,q);h=Rc.prototype;h.ha=function(a,b,c,d){this.A=a;this.u=b;this.F=d;this.na=a.f;for(a=0;a=a.cb&&(a.cb+=a.yb,c=!0);0<=a.zb&&a.zb<=Wc(a)&&(a.yb=a.zb=-1,Vc(a),F(a),c=!0);c&&a.Z(Wc(a)+" cycles: checksum="+Ea(a.cc))}} +h.ka=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.m[b]=c,!0;case "run":return this.m[b]=c,c.onclick=function(){var a;if(a=d.A)if(a=d.A,a.j.O)a=!0;else{var b=null,c,k=xa(a.id);for(c=0;ca.Oa/a.ab&&(b=1);a.Ra=b;b=a.nc*a.Ra;if(a.ab!=b){a.ab=b;b=a.ab.toFixed(2)+"Mhz";var d=a.m.setSpeed;d&&(d.textContent=b);a.Z("target speed: "+b)}c&&a.A&&$c(a.A)}Ib(a,a.Aa);a.Aa=0;a.za=va();a.Fa=0;Yc(a)}function nc(a,b){var c=a.X.length;a.X.push([-1,b]);return c}function pc(a,b,c,d){0<=b&&ba.X[b][0])&&(c=a.ec*a.Ra/1E3*c|0,a.j.L&&(c+=ad(a)),a.X[b][0]=c)}function bd(a){for(var b=[],c=0;cd[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function ad(a,b){var c=a.Ga-=a.a;a.a=a.aa=0;b&&(a.Ga=0);return c} +h.Mf=function(){if(this.j.L){this.fc>=this.ec&&Yc(this,!0);this.fb=0;this.xb=va();if(this.Fa){var a=this.xb-this.Fa;a>this.oc&&(this.za+=a,this.za>this.xb&&(this.za=this.xb))}try{do{for(var b,c=this.j.Tb?1:this.Ab,d=this.X.length-1;0<=d;d--){var e=this.X[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.kc(b)}catch(f){if("number"!=typeof f)throw f;}b=ad(this,!0);this.fb+=b;this.Aa+=b;Jb(this,b);Hb(this,b);this.eb-=b;if(0>=this.eb){this.eb+=this.Ab;++this.pc>=cd&&(this.A&&Kb(this.A,void 0),this.pc=0);break}}while(this.j.L)}catch(f){F(this); +this.A&&this.A.stop(va(),Wc(this));a=f.stack||f.message;this.j.error=!0;this.G(a);return}if(this.j.L){a=setTimeout;b=this.bd;this.Fa=va();c=this.oc;this.fb&&(c=Math.round(c*this.fb/this.Ab));c-=this.Fa-this.xb;if(d=this.Fa-this.za)this.Oa=Math.round(this.Aa/(10*d))/100,864E5<=d&&(this.Ha=0,Xc(this));if(0>c||this.Oac&&(this.za-=c),c=0;this.fc+=this.fb;this.Fa+=c;a(b,c)}}}; +function Gb(a){var b;a.j.error?(a.Z(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.L)a.Z(a.toString()+" busy");else{Xc(a);a.j.L=!0;a.j.Ic=!0;if(b=a.m.run)b.textContent="Halt";a.A&&a.A.start(a.za,Wc(a));a.F||a.status("Started");setTimeout(a.bd,0)}}h.kc=function(){return 0};function F(a){var b=!1;if(a.j.L){ad(a);Ib(a,a.Aa);a.Aa=0;a.j.L=!1;if(b=a.m.run)b.textContent="Run";a.A&&a.A.stop(va(),Wc(a));b=!0;a.F||a.status("Stopped")}a.j.complete=void 0;return b}var Zc=30,cd=15,Sc=["power","reset"]; +function dd(a){var b=+a.model||1170;Rc.call(this,a,6666667);this.pa=b;this.Wc=+a.addrReset||0;this.Ba=this.i=this.B=this.v=this.l=this.o=this.w=0;this.b=this.sa=this.fa=[];this.H=this.s=this.Ja=this.Eb=[];this.Ea=this.C=this.Vc=this.bb=this.Pa=this.Qa=this.Wa=this.D=this.Bb=this.Sa=this.Ia=this.J=this.Cb=this.Db=this.qa=this.g=0;this.ge=[4,2,0,1];this.hc=0;this.$c=255;1120>=this.pa?(this.Uc=ed.bind(this),this.Za=this.pe,this.hc=8,this.$c=-1,this.fd=255,this.cd=0):(this.Uc=fd.bind(this),this.Za=this.qe, +this.fd=~(1792|(1140>=this.pa?2048:0))&65535,this.cd=1140e.Ib&&(e.Ib=c,c+=4)}return Rc.prototype.ja.call(this,a,b)}; +h.reset=function(){this.status("Model "+this.pa);this.j.L&&F(this);this.v=65536;this.l=32768;this.o=65535;this.w=32768;this.i=15;this.b=[0,0,0,0,0,0,0,this.Wc,-1,-2,-3,-4,-5,-6,-7,-8];this.sa=[0,0,0,0,0,0];this.fa=[0,0,0,0];this.H=[[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.s=[[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],[65535,65535,65535,65535,65535,65535,65535,65535,65535,65535, +65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Ja=[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];this.Eb=[0,0,0,0,0,0,0,0];this.B=0;this.Ba=-1;this.h=this.f=this.bc=this.K=this.R=this.g=this.Bb=0;Eb(this);Uc(this);this.j.error=!1;Rc.prototype.reset.call(this)};function Eb(a){a.J=0;a.Cb=0;a.Db=0;a.qa=0;a.D=0;a.Sa=0;a.Ia=255;a.bb=0;a.Pa=0;a.Qa=0;a.Wa=262143;a.Ea=a.b[7];a.C=0;a.I=null;a.u&&(gd(a),a.Vc=ic(a.u))} +function gd(a){a.Yb=a.Mc;a.Zb=a.ic;a.jc=a.lc;a.$b=a.mc;a.bb?(a.xa=65536,a.Xb=a.qa&16?4186112:253952,a.oa=a.pd,a.W=a.td,a.rb=a.wd,ac(a.u,a.qa&16?22:18)):(a.xa=0,a.Xb=57344,a.oa=a.te,a.W=a.Gf,a.rb=a.Rg,ac(a.u,16))}function uc(a){var b=a.J;b&57344||(b=b&-3199|a.Pa<<5|a.Qa<<1);return b}function vc(a,b){b&=-3073;if(a.J!=b){b&57344&&!(a.J&57344)&&(a.Cb=a.C>>16&65535,a.Db=a.C&65535);a.J=b;a.Pa=(b&96)>>5;a.Qa=(b&30)>>1;var c=0;b&257&&(c=4,b&1&&(c|=2));a.bb!=c&&(a.bb=c,gd(a))}} +function wc(a){a.J&57344||(a.Cb=a.C>>16&65535);a=a.Cb;a&65280&&(a=(a<<8|a>>8)&65535);return a}function xc(a){a.J&57344||(a.Db=a.C&65535);return a.Db}function yc(a,b){1170>a.pa&&(b&=-49);a.qa!=b&&(a.qa=b,a.Wa=b&16?4194303:262143,gd(a))}function hd(a,b,c){a.Wc=b;id(a,b);Ac(a,0);a.u.reset();Eb(a);if(c){for(b=2;5>=b;b++)a.b[b]=0;a.j.O?a.j.L||Gb(a):a.j.Y=!0}else a.F&&a.j.O?F(a)||(a.F.g(),Kb(a.A,-1)):!1===c&&F(a);!a.j.L&&a.na&&a.na.stop()}h.od=function(){return 0}; +h.save=function(){var a=new E(this);a.set(0,[this.b,this.sa,this.fa,this.H,this.s,this.Ja,this.Eb,this.D,this.Bb,this.Sa,this.Ia,this.Pa,this.Qa,this.Ea,this.g,this.C,this.Ba,this.sc,this.uc]);a.set(1,[zc(this),uc(this),wc(this),xc(this),this.qa]);a.set(2,[this.Ha,this.Ra,this.j.Y]);a.set(3,jd(this));a.set(4,bd(this));return a.data()}; +h.restore=function(a){var b=ja(a[0]);this.b=b.next().value;this.sa=b.next().value;this.fa=b.next().value;this.H=b.next().value;this.s=b.next().value;this.Ja=b.next().value;this.Eb=b.next().value;this.D=b.next().value;this.Bb=b.next().value;this.Sa=b.next().value;this.Ia=b.next().value;this.Pa=b.next().value;this.Qa=b.next().value;this.Ea=b.next().value;this.g=b.next().value;this.C=b.next().value;this.Ba=b.next().value;this.sc=b.next().value;this.uc=b.next().value;b=a[1];Ac(this,b[0]);vc(this,b[1]); +this.Cb=b[2];this.Db=b[3];yc(this,b[4]);b=a[2];this.Ha=b[0];Xc(this,b[1]);this.j.Y=b[2];for(var b=a[3],c=b.length-1;0<=c;c--){var d;a:{for(d=0;d>23)),a.a-=2);a.a-=3}function id(a,b){a.b[7]=b&65535}function qc(a,b,c,d){b={Ib:b,kb:c,message:d||0,name:kb[b],next:null};a.wb.push(b);return b}function tc(a,b){var c=a.I;if(c==b)a.I=b.next;else for(;c;){var d=c.next;if(d==b){c.next=d.next;break}c=d}a.I&&(a.g|=1)}function oc(a,b){if(b){if(b!=a.I){var c=a.I;if(!c||c.kb<=b.kb)b.next=c,a.I=b;else{do{var d=c.next;if(!d||d.kb<=b.kb){b.next=d;c.next=b;break}c=d}while(c)}}a.g|=1}} +function jd(a){var b=[];for(a=a.I;a;)b.push(a.Ib),a=a.next;return b}function nd(a){return a.g&64?(I(a,168,64,-6),!0):a.g&32?(I(a,4,32,-5),!0):a.g&16?(I(a,12,16,-7),!0):!1}function zc(a){return a.i=a.i&63728|ld(a)|(a.o&65535?0:4)|(a.l&32768?2:0)|kd(a)}function Ac(a,b){b&=a.fd;a.w=b<<12;a.o=~b&4;a.l=b<<14;a.v=b<<16;if((b^a.i)&a.cd)for(var c=a.sa.length;0<=--c;){var d=a.b[c];a.b[c]=a.sa[c];a.sa[c]=d}a.B=b>>14&3;c=a.i>>14&3;a.B!=c&&(a.fa[c]=a.b[6],a.b[6]=a.fa[a.B]);a.i=b;a.g&=-3;a.g|=a.I?2:1} +h.ea=function(a){this.w=this.o=a;this.l=0};h.La=function(a,b){this.w=this.o=this.v=a;this.l=b||0};function od(a,b){a.w=a.o=a.v=b;a.l=a.w^a.v>>1}function pd(a,b,c,d){a.w=a.o=a.v=b;a.l=(c^d)&(d^b)} +function I(a,b,c,d){if(!a.hb){0>a.Ba?a.Ba=zc(a):a.B||(d=-4);-4==d&&(a.g&256&&(d=-1),a.g|=256,a.D|=4,a.b[6]=b=4);if(-1!=d){a.C=b|4143316992;a.B=0;var e=a.W(b|a.xa),f=a.W(b+2&65535|a.xa);Ac(a,f&-12289|a.Ba>>2&12288);qd(a,a.Ba);qd(a,a.b[7]);id(a,e)}a.a-=5;a.g&=~(c|19);a.g|=129;a.Ba=-1;a.sc=d;a.uc=b;-1==d&&F(a);if(-4<=d)throw b;}}function rd(a){var b=sd(a),c=sd(a);a.i&49152&&(c=c&-225|a.i&63712);id(a,b);Ac(a,c);a.g&=-17} +function td(a,b){var c=b>>13&31;31>c&&(b=a.qa&32?a.Ja[c]+(b&8191)&4194303:b&-3932161);return b} +function Nb(a,b,c){var d,e,f;if(!(c&a.bb))return f=b&65535,57344<=f&&(f|=a.Xb),f;d=b>>13;a.qa&a.ge[a.B]||(d&=7);e=a.s[a.B][d];f=(a.H[a.B][d]<<6)+(b&8191)&a.Wa;3932160<=f&&(f=td(a,f));if(a.hb)return f;f>=a.Vc&&f>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&& +(g|=16384));a.s[a.B][d]=e;if(f!=(4194170&a.Wa)||a.B)a.Pa=a.B,a.Qa=d;g&&(g&57344&&(0<=a.Ba&&(g|=128),a.J&57344||(g|=a.J&4096|a.Pa<<5|a.Qa<<1,vc(a,a.J&-61695|g&61694)),I(a,168,64,-2)),a.J&61440||!(f<(4191360&a.Wa)||f>(4194239&a.Wa))||(a.J|=4096,a.J&512&&(a.g|=64)));return f}function sd(a){var b=a.W(a.b[6]|a.xa);a.b[6]=a.b[6]+2&65535;return b}function qd(a,b){var c=a.b[6]-2&65535;a.b[6]=c;a.C=a.C&65535|(a.C&-65536)<<8|16121856;a.g&256||a.Za(4,-2,c);a.rb(c,b)} +function ud(a,b,c,d){var e,f,g=d&8?0:a.xa;switch(b){case 0:return I(a,4,0,-3),0;case 1:return 6==c&&a.Za(d,0,a.b[6]),a.a-=3,7==c?a.b[c]:a.b[c]|g;case 2:f=2;e=a.b[c];6==c&&a.Za(d,f,e);7!=c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.b[c];7!=c&&(e|=g);e=a.W(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.b[c]+f&65535;6==c&&a.Za(d,f,e);7!=c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.b[c]-2&65535;7!=c&&(e|=g);e=a.W(e)|g;a.a-=8;break;case 6:return e=a.W(md(a,2)),e=e+a.b[c]&65535,6==c&&a.Za(d,0, +e),a.a-=6,e|g;case 7:return e=a.W(md(a,2)),e=e+a.b[c]&65535,e=a.W(e|a.xa),a.a-=10,e|g}a.b[c]=a.b[c]+f&65535;a.C=a.C&65535|(a.C&-65536)<<8|(f<<3&248|c)<<16;return e}h.pe=function(a,b,c){!this.B&&0>=b&&c<=this.Ia&&(this.g|=32)};h.qe=function(a,b,c){this.B||(65534<=c&&(c|=-65536),a&4&&c<=this.Ia&&(c<=this.Ia-32?I(this,4,0,-4):(this.D|=8,this.g|=32)))};h.se=function(a){return this.Mc(a)};h.ue=function(a){return this.ic(a)};h.Of=function(a,b){this.lc(a,b)};h.Qf=function(a,b){this.mc(a,b)}; +h.te=function(a,b,c){return ud(this,a,b,c)};h.pd=function(a,b,c){return Nb(this,ud(this,a,b,c),c)};h.Gf=function(a){return this.u.Kb(this.Ea=a)};h.td=function(a){return this.u.Kb(this.Ea=Nb(this,a,2))};h.Rg=function(a,b){this.u.Lb(this.Ea=a,b)};h.wd=function(a,b){this.u.Lb(this.Ea=Nb(this,a,4),b)}; +function vd(a,b,c){var d=a.f=b&7;(b=a.h=(b&56)>>3)?(d=ud(a,b,d,2),c&65536||61440!==(a.i&61440)&&(d&=65535),a.B=a.i>>12&3,c=a.W(d|c&a.xa),a.B=a.i>>14&3):c=6!=d||(a.i>>2&12288)===(a.i&12288)?a.b[d]:a.fa[a.i>>12&3];return c}function wd(a,b,c,d){a.C=a.C&65535|1441792;var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=ud(a,b,e,4),c&65536||(e&=65535),a.B=a.i>>12&3,e=Nb(a,e|c&65536,4),a.B=a.i>>14&3,a.$b(e,d)):6!=e||(a.i>>2&12288)===(a.i&12288)?a.b[e]=d:a.fa[a.i>>12&3]=d} +function xd(a,b){b>>=6;var c=a.R=b&7;return(b=a.K=(b&56)>>3)?a.Yb(a.oa(b,c,3)):a.b[c+a.hc]&a.$c}function yd(a,b){var c;b>>=6;var d=a.R=b&7;(b=a.K=(b&56)>>3)?c=a.Zb(a.oa(b,d,2)):c=a.b[d+a.hc];return c}function zd(a,b){var c=a.f=b&7;b=a.h=(b&56)>>3;return ud(a,b,c,8)}function Ad(a,b){var c=a.f=b&7;return(b=a.h=(b&56)>>3)?a.Yb(a.oa(b,c,3)):a.b[c]&255}function Bd(a,b){var c,d=a.f=b&7;(b=a.h=(b&56)>>3)?c=a.Zb(a.oa(b,d,2)):c=a.b[d];return c} +function O(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.bc=a.oa(b,e,7),c=0>c?a.b[-c-1]&255:c,a.jc(e,d.call(a,c,a.Yb(e))),e&1&&a.a--):(b=a.b[e],c=0>c?a.b[-c-1]&255:c,a.b[e]=b&65280|d.call(a,c,b&255))}function P(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.oa(b,e,6),a.$b(e,d.call(a,0>c?a.b[-c-1]:c,a.Zb(e)))):a.b[e]=d.call(a,0>c?a.b[-c-1]:c,a.b[e])} +function Cd(a,b,c,d,e){var f=a.f=b&7;(b=a.h=(b&56)>>3)?(d=a.oa(b,f,5),e.call(a,(c=0>c?a.b[-c-1]&255:c)<<8),a.jc(d,c),d&1&&a.a--):(c?(c=0>c?a.b[-c-1]&255:c,a.b[f]=a.b[f]&~d|c<<24>>24&d):a.b[f]&=~d,e.call(a,c<<8))}function Dd(a,b,c,d){var e=a.f=b&7;(b=a.h=(b&56)>>3)?(e=a.oa(b,e,4),d.call(a,c=0>c?a.b[-c-1]:c),a.$b(e,c)):(a.b[e]=c=0>c?a.b[-c-1]:c,d.call(a,c))} +h.kc=function(a){this.j.complete=!0;var b=a?this.j.Ic?0:1:-1;this.j.Ic=!1;this.Ga=this.a=a;this.g=this.g&-5|0;do{if(this.g){if(a=this.g&11)if(a=!1,this.g&2){var c=160,d=(this.Sa&224)>>5,e=this.I&&this.I.kb>d?this.I:null;e&&(c=e.Ib,d=e.kb);d>(this.i&224)>>5?(this.g&8&&(md(this,2),this.g&=-9),I(this,c,0,-10),d=!0):d=!1;d&&(e&&tc(this,e),a=!0);this.I||this.Sa||(this.g&=-3)}else this.g&1&&this.g++;if(a){if(this.g&4&&this.F.b(this.b[7],b)){F(this);break}if(0>b)break}if(this.g&112&&nd(this)){if(this.g& +4&&this.F.b(this.b[7],b)){F(this);break}if(0>b)break}}this.g=this.g&15|this.i&16;a=this.C=this.b[7];e=this.W(a);this.b[7]=a+2&65535;this.Uc(e)}while(0>1|b<<16;od(this,a);return a&65535}function Jd(a,b){a=b&128|b>>1|b<<8;od(this,a<<8);return a&255}function Kd(a,b){a=b&~a;this.ea(a);return a}function Ld(a,b){a=b&~a;this.ea(a<<8);return a}function Md(a,b){a|=b;this.ea(a);return a}function Nd(a,b){a|=b;this.ea(a<<8);return a} +function Od(a,b){a=~b|65536;this.La(a);return a&65535}function Pd(a,b){a=~b|256;this.La(a<<8);return a&255}function Qd(a,b){this.w=this.o=a=b-a;this.l=b&(b^a);return a&65535}function Rd(a,b){a=b-a;var c=a<<8;b<<=8;this.w=this.o=c;this.l=b&(b^c);return a&255}function Sd(a,b){this.w=this.o=a=b+a;this.l=a&(b^a);return a&65535}function Td(a,b){a=b+a;var c=a<<8;this.w=this.o=c;this.l=c&(b<<8^c);return a&255}function Ud(a,b){a=-b;this.La(a,a&b&32768);return a&65535} +function Vd(a,b){a=-b;this.La(a<<8,(a&b&128)<<8);return a&255}function Wd(a,b){a=b<<1|this.v>>16&1;od(this,a);return a&65535}function Xd(a,b){a=b<<1|this.v>>16&1;od(this,a<<8);return a&255}function Yd(a,b){a=(this.v&65536|b)>>1|b<<16;od(this,a);return a&65535}function Zd(a,b){a=((this.v&65536)>>8|b)>>1|b<<8;od(this,a<<8);return a&255}function $d(a,b){var c=b-a;pd(this,c,a,b);return c&65535}function ae(a,b){var c=b-a;pd(this,c<<8,a<<8,b<<8);return c&255} +function be(a,b){this.w=this.o=b&65280;this.l=this.v=0;return(b<<8|b>>8)&65535}function ce(a,b){a^=b;this.ea(a);return a&65535}function de(a){P(this,a,yd(this,a),Ed);this.a-=this.h?9+(this.R&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)} +function ee(a){var b=Bd(this,a);a=a>>6&7;var c=this.b[a];c&32768&&(c|=4294901760);this.v=this.l=0;b&=63;if(b&32)b=64-b,16>=b;else if(b)if(16>15&65535;d&&65535!==d&&(this.l=32768)}this.b[a]=c&65535;this.w=this.o=c;this.a-=(this.h?6:7)+b} +function fe(a){var b=Bd(this,a);a=a>>6&7;var c=this.b[a]<<16|this.b[a|1];this.v=this.l=0;b&=63;if(b&32){b=64-b;32>b-1;this.v=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<>15,d<<=1,32>=32-b)&&4294967295!==(c|4294967295<>16&65535;this.b[a|1]=d&65535;this.w=d>>16;this.o=d>>16|d;this.a-=(this.h?6:7)+b}function ge(a){N(this,a,!kd(this))}function he(a){N(this,a,kd(this))} +function ie(a){P(this,a,yd(this,a),Kd);this.a-=this.h?9+(this.R&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)}function je(a){O(this,a,xd(this,a),Ld);this.a-=this.h?9+(this.R&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)}function ke(a){P(this,a,yd(this,a),Md);this.a-=this.h?9+(this.R&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)}function le(a){O(this,a,xd(this,a),Nd);this.a-=this.h?9+(this.R&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)} +function me(a){var b=yd(this,a);a=Bd(this,a);this.ea((0>b?this.b[-b-1]:b)&a);this.a-=this.h?4+(this.R&&6<=this.f?1:0):(this.K?4:3)+(7==this.f?2:0)}function ne(a){var b=xd(this,a);a=Ad(this,a);this.ea(((0>b?this.b[-b-1]&255:b)&a)<<8);this.a-=this.h?4+(this.R&&6<=this.f?1:0):(this.K?4:3)+(7==this.f?2:0)}function oe(a){N(this,a,this.o&65535?0:4)}function pe(a){N(this,a,!ld(this)==!(this.l&32768))}function qe(a){N(this,a,!!(this.o&65535)&&!ld(this)==!(this.l&32768))} +function re(a){N(this,a,!kd(this)&&!!(this.o&65535))}function se(a){N(this,a,(this.o&65535?0:4)||!ld(this)!=!(this.l&32768))}function te(a){N(this,a,kd(this)||(this.o&65535?0:4))}function ue(a){N(this,a,!ld(this)!=!(this.l&32768))}function ve(a){N(this,a,ld(this))}function we(a){N(this,a,!!(this.o&65535))}function xe(a){N(this,a,!ld(this))}function ye(){I(this,12,0,-9)}function ze(a){N(this,a,!0)}function Ae(a){N(this,a,!(this.l&32768))}function Be(a){N(this,a,this.l&32768?2:0)} +function Q(a){a&1&&(this.v=0);a&2&&(this.l=0);a&4&&(this.o=1);a&8&&(this.w=0);this.a-=5}function Ce(a){var b=yd(this,a);a=Bd(this,a);var c=(b=0>b?this.b[-b-1]:b)-a;pd(this,c,a,b);this.a-=this.h?4+(this.R&&6<=this.f?1:0):(this.K?4:3)+(7==this.f?2:0)}function De(a){var b=xd(this,a);a=Ad(this,a);var c=(b=(0>b?this.b[-b-1]&255:b)<<8)-(a<<=8);pd(this,c,a,b);this.a-=this.h?4+(this.R&&6<=this.f?1:0):(this.K?4:3)+(7==this.f?2:0)} +function Ee(a){var b=Bd(this,a);if(b){a=a>>6&7;var c=this.b[a]<<16|this.b[a|1];this.v=this.l=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.b[a]=d&65535,this.b[a|1]=c-d*b&65535,this.o=d>>16|d,this.w=d>>16):(this.l=32768,this.o=d>>15|d,this.w=c>>16,-1===b&&65534===this.b[a]&&(this.b[a]=this.b[a|1]=1));this.a-=53}else this.o=this.w=0,this.l=32768,this.v=65536,this.a-=7}function Fe(){I(this,24,0,-9);this.a-=20} +function Ge(){this.i&49152?(this.D|=128,I(this,4,0,-8)):(this.na&&1120==this.pa&&this.na.setData(this.b[0],!0),this.F?this.F.i():F(this));this.a-=7}function He(){I(this,16,0,-9);this.a-=20}var Ie=[0,7,7,10,7,11,9,13];function Je(a){this.aa=this.a;id(this,zd(this,a));this.a=this.aa-Ie[this.h]}var Ke=[0,14,14,17,14,18,16,20];function Le(a){this.aa=this.a;var b=zd(this,a);a=a>>6&7;qd(this,this.b[a]);this.b[a]=this.b[7];id(this,b);this.a=this.aa-Ke[this.h]} +var Me=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Ne(a){var b=yd(this,a);this.aa=this.a;Dd(this,a,b,this.ea);this.a=this.aa-Me[(this.K?8:0)+this.h]+(7!=this.f||this.h?0:2)}function Oe(a){var b=xd(this,a);Cd(this,a,b,65535,this.ea);this.a-=this.h?9+(this.R&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)}var Pe=[7,13,13,17,14,18,17,21]; +function Qe(a){var b=Bd(this,a);a=a>>6&7;b=(b<<16>>16)*(this.b[a]<<16>>16);this.b[a]=b>>16&65535;this.b[a|1]=b&65535;b|=0;this.w=b>>16;this.o=this.w|b;this.l=0;this.v=-32768>b||32767>6;if(this.b[b]=this.b[b]-1&65535)id(this,this.b[7]-((a&63)<<1)),this.a+=1;this.a-=6}function We(a){P(this,a,yd(this,a),$d);this.a-=this.h?9+(this.R&&6<=this.f?1:0):(this.K?5:3)+(7==this.f?2:0)}function Xe(a){P(this,a,0,be);this.a-=this.h?9:3+(7==this.f?2:0)}function Ye(){I(this,28,0,-9)} +function Ze(){this.na&&(this.na.U=this.b[7],this.na.setData(this.b[0],!0));this.g|=8;md(this,-2);this.a-=3}function $e(a){P(this,a,this.b[(a>>6&7)+this.hc],ce);this.a-=this.h?9:3+(7==this.f?2:0)}function S(){I(this,8,0,-9)}function ed(a){af[a>>12].call(this,a)}function bf(a){cf[a>>6&3].call(this,a)}function df(a){ef[a>>6&3].call(this,a)}function ff(a){gf[a>>6&3].call(this,a)}function hf(a){jf[a&15].call(this,a)}function kf(a){lf[a&15].call(this,a)}function mf(a){nf[a>>6&3].call(this,a)} +function of(a){pf[a>>6&3].call(this,a)}function qf(a){rf[a>>6&3].call(this,a)} +var af=[function(a){sf[a>>8&15].call(this,a)},Ne,Ce,me,ie,ke,de,S,function(a){tf[a>>8&15].call(this,a)},Oe,De,ne,je,le,We,S],sf=[function(a){uf[a>>4&15].call(this,a)},ze,we,oe,pe,ue,qe,se,Le,Le,bf,df,ff,S,S,S],cf=[function(a){Dd(this,a,0,this.La);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Od);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){P(this,a,1,Sd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){P(this,a,1,Qd);this.a-=this.h?9:3+(7==this.f?2:0)}],ef=[function(a){P(this,a,0,Ud); +this.a-=this.h?11:6},function(a){P(this,a,kd(this)?1:0,Ed);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){P(this,a,kd(this)?1:0,$d);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){a=Bd(this,a);this.La(a);this.a-=this.h?4:3+(7==this.f?2:0)}],gf=[function(a){P(this,a,0,Yd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Wd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Id);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Gd);this.a-=this.h?9:3+(7==this.f?2:0)}],uf= +[function(a){vf[a&15].call(this,a)},S,S,S,Je,Je,Je,Je,Te,S,hf,kf,Xe,Xe,Xe,Xe],vf=[Ge,Ze,Ue,ye,He,Se,S,S,S,S,S,S,S,S,S,S],jf=[Re,function(){this.v=0;this.a-=5},function(){this.l=0;this.a-=5},Q,function(){this.o=1;this.a-=5},Q,Q,Q,function(){this.w=0;this.a-=5},Q,Q,Q,Q,Q,Q,Q],lf=[Re,function(){this.v=65536;this.a-=5},function(){this.l=32768;this.a-=5},R,function(){this.o=0;this.a-=5},R,R,R,function(){this.w=32768;this.a-=5},R,R,R,R,R,R,R],tf=[xe,ve,re,te,Ae,Be,ge,he,Fe,Ye,mf,of,qf,S,S,S],nf=[function(a){Cd(this, +a,0,255,this.La);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){O(this,a,0,Pd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){O(this,a,1,Td);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){O(this,a,1,Rd);this.a-=this.h?9:3+(7==this.f?2:0)}],pf=[function(a){O(this,a,0,Vd);this.a-=this.h?11:6},function(a){O(this,a,kd(this)?1:0,Fd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){O(this,a,kd(this)?1:0,ae);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){a=Ad(this,a);this.La(a<<8);this.a-=this.h?4:3+ +(7==this.f?2:0)}],rf=[function(a){O(this,a,0,Zd);this.a-=this.h?9+(this.bc&1):3+(7==this.f?2:0)},function(a){O(this,a,0,Xd);this.a-=this.h?9:3+(7==this.f?2:0)},function(a){O(this,a,0,Jd);this.a-=this.h?9+(this.bc&1):3+(7==this.f?2:0)},function(a){O(this,a,0,Hd);this.a-=this.h?9:3+(7==this.f?2:0)}];function fd(a){wf[a>>12].call(this,a)} +var wf=[function(a){xf[a>>8&15].call(this,a)},Ne,Ce,me,ie,ke,de,function(a){yf[a>>8&15].call(this,a)},function(a){zf[a>>8&15].call(this,a)},Oe,De,ne,je,le,We,S],xf=[function(a){Af[a>>4&15].call(this,a)},ze,we,oe,pe,ue,qe,se,Le,Le,bf,df,ff,function(a){Bf[a>>6&3].call(this,a)},S,S],Bf=[function(a){a=this.b[7]+((a&63)<<1)&65535;var b=this.W(a|this.xa);id(this,this.b[5]);this.b[6]=a+2&65535;this.b[5]=b;this.a-=8},function(a){a=vd(this,a,0);this.ea(a);qd(this,a);this.a-=11},function(a){var b=sd(this); +this.aa=this.a;this.ea(b);wd(this,a,0,b);this.a=this.aa-Pe[this.h]},function(a){Dd(this,a,ld(this)?65535:0,this.ea);this.a-=this.h?9:3+(7==this.f?2:0)}],Af=[function(a){Cf[a&15].call(this,a)},S,S,S,Je,Je,Je,Je,Te,function(a){!(a&8)||1145>this.pa?I(this,8,0,-9):(this.i&49152||(this.i=this.i&-225|(a&7)<<5,this.g|=1,this.g&=-3),this.a-=5)},hf,kf,Xe,Xe,Xe,Xe],Cf=[Ge,Ze,function(){rd(this);this.g|=this.i&16;this.a-=13},ye,He,Se,Ue,function(){I(this,8,0,-9)},S,S,S,S,S,S,S,S],yf=[Qe,Qe,Ee,Ee,ee,ee,fe,fe, +$e,$e,S,S,S,S,Ve,Ve],zf=[xe,ve,re,te,Ae,Be,ge,he,Fe,Ye,mf,of,qf,function(a){1145>this.pa?I(this,8,0,-9):Df[a>>6&3].call(this,a)},S,S],Df=[function(){I(this,8,0,-9)},function(a){a=vd(this,a,65536);this.ea(a);qd(this,a);this.a-=11},function(a){var b=sd(this);this.aa=this.a;this.ea(b);wd(this,a,65536,b);this.a=this.aa-Pe[this.h]},function(){I(this,8,0,-9)}]; +function Ef(a){q.call(this,"ROM",a,128);this.ga=this.b=null;this.h=+a.addr;this.a=+a.size;this.i=!1;this.f=a.alias;"string"==typeof this.f&&(this.f=eval(this.f));this.g=a.file;this.l=Fa(this.g);if(this.g){a=this.g;var b=Ga(this.l);"json"!=b&&"hex"!=b&&(a=Qa()+"/api/v1/dump?file="+this.g+"&format=bytes&decimal=true");var c=this;Oa(a,null,!0,function(a,b,f){f?(c.G("Unable to load ROM resource (error "+f+": "+a+")"),c.g=null):(ta(c.Na,a,b),(a=Pa(a,b))?(c.b=a.M,c.ga=a.ga):c.g=null);Ff(c)})}}n(Ef,q); +h=Ef.prototype;h.ha=function(a,b,c,d){this.u=b;this.c=c;this.F=d;Ff(this)};h.ja=function(){this.ga&&(this.F&&this.F.a(this.id,this.h,this.a,this.ga),delete this.ga);return!0};h.ia=function(){return!0}; +function Ff(a){if(!Aa(a)){if(a.g){if(!a.b||!a.u)return;a.a||(a.a=a.b.length);if(a.b.length!=a.a){var b="ROM size ("+Ea(a.b.length,8,!0)+") does not match specified size ("+Ea(a.a,8,!0)+")";a.j.error=!0;a.G(b)}else{a:{b=a.h;if(57344<=b&&b<57344+Tb){var c={},c=(c[b]=[Ef.prototype.sf,Ef.prototype.Bg,null,null,null,a.a>>1],c);if(qb(a.u,a,c)){a.status("Added "+a.a+"-byte ROM at "+Da(b));b=a.i=!0;break a}}else if(Zb(a.u,b,a.a,Ec)){for(c=0;c>>f.h;0>>=f.h;0>>a.h;0=b.length)break;for(var l=l+2,p=b[l++]&255|(b[l++]&255)<<8,t=b[l++]&255|(b[l++]&255)<<8,m=m+((p&255)+(p>>8)+(t&255)+(t>>8)),z=l,y=p-=6;0=b.length)break;m+=b[l++]&255;if(m&255)break;if(y)for(;y--;)hc(a.u,t++,b[z++]&255);else t&1?g=!0:null==d&&(d=t);k=!0}else l++;else l+=2}if(!k&&(null==c&&(c=e),null!=c)){for(e=0;e< +b.length;e++)hc(a.u,c+e,b[e]);k=!0}if(k){if(null==d||g)F(a.c),f=!1;null!=d&&hd(a.c,d,f)}return k}Za(function(){for(var a=A(document,x,"ram"),b=0;b=sa.Nc&&c<=sa.le&&(b=c-(sa.Nc-sa.Ad));b&&(a.preventDefault&&a.preventDefault(),d.ac(b));return!0},c.onkeypress=function(a){a=a||window.event;if(!a.metaKey){var b=a.which||a.keyCode;a.altKey&&b==sa.Cd&&(b=sa.Bd);d.ac(b);a.preventDefault&&a.preventDefault()}return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation(); +a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.ac(a.getData("Text"))},c.removeAttribute("readonly"),!0}return!1}; +h.ha=function(a,b,c,d){this.A=a;this.u=b;this.c=c;this.F=d;var e=this;this.H=qc(this.c,this.B?-1:48,4,262144);this.I=nc(this.c,function(){var a;a=-1;e.f.length&&(a=e.f.shift()&255,e.w&&97<=a&&122>a&&(a-=32),pc(e.c,e.I,1E3/Math.round(e.J/10)));0<=a&&(e.o=a,e.a&128?e.o|=49152:e.a|=128,e.a&64&&oc(c,e.H))});this.C=qc(this.c,this.B?-1:52,4,262144);this.X=nc(this.c,function(){e.b|=128;e.b&64&&oc(c,e.C)});qb(b,this,Lf,this.B?64832+8*(this.B-1)-65392:0);sb(b,this.reset.bind(this));B(this)}; +h.qd=function(a){if(!this.g){var b=Tc(this.A,"connection");if(b){var c=b.split("->");if(2==c.length){var d=Ka(c[0]);if(d!=this.$a)return;c=Ka(c[1]);if(this.g=ya(c)){var e=this.g.exports;if(e){var f=e.connect;f&&f.call(this.g,this.v);if(this.s=e.receiveData){this.v=a;this.D=e.receiveStatus;this.status("Connected "+this.Na+"."+d+" to "+c);return}}}}this.status("Unable to establish connection: "+b)}}};h.ja=function(a,b){if(!b)if(this.qd(this.v),!a)this.reset();else if(!this.restore(a))return!1;return!0}; +h.ia=function(a){return a?this.save():!0};h.reset=function(){Mf(this)};h.save=function(){var a=new E(this);a.set(0,[this.o,this.a,this.b,this.f]);return a.data()};h.restore=function(a){return Mf(this,a[0])};function Mf(a,b){b||(b=[0,8192,128,a.f]);b=ja(b);a.o=b.next().value;a.a=b.next().value;a.b=b.next().value;a.f=b.next().value;return!0} +h.ac=function(a){if("number"==typeof a)this.f.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.R||8,c=a-this.l%a,this.R&&(b=" ".slice(0,c)));this.K&&!this.l&&c&&(b=String.fromCharCode(this.K)+b);this.h.value+=b;this.h.scrollTop=this.h.scrollHeight;this.l+=c}}else if(null!= +this.i){if(10==a||1024<=this.i.length)this.Z(this.i),this.i="";10!=a&&(this.i+=String.fromCharCode(a))}pc(this.c,this.X,1E3/Math.round(this.aa/10));this.b&=-129};var Kf="buffer",Nf={},Lf=(Nf[65392]=[null,null,T.prototype.df,T.prototype.og,"RCSR"],Nf[65394]=[null,null,T.prototype.cf,T.prototype.ng,"RBUF"],Nf[65396]=[null,null,T.prototype.Kf,T.prototype.Tg,"XCSR"],Nf[65398]=[null,null,T.prototype.Jf,T.prototype.Sg,"XBUF"],Nf); +Za(function(){for(var a=A(document,x,"serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.m[b]=c,!0;case "readTape":e=Rf;case "loadTape":return e||(e=Sf),this.m[b]=c,c.onclick= +function(){var a=d.m.listTapes;a&&Tf(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.C){c.parentNode.removeChild(c);break}this.m[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Tf(d,Fa(b,!0),b,Sf,a)}return!1};return!0;case Uf:return this.m[b]=c,!0}return!1}; +h.ha=function(a,b,c,d){this.A=a;this.u=b;this.c=c;this.F=d;this.v=Vf(a);var e=this;if(a=Of(this,Tc(this.A,"autoMount")))for(var f in a)"PTR"==f&&(this.B[f]=a[f]);this.s=qc(this.c,56,4,4096);this.H=nc(this.c,function(){1==(e.a&32769)&&!(e.a&128)&&e.lc.indexOf("/api/v1/dump")&&(e=Ga(c),f="json"==e||"gz"==e?encodeURI(c):Qa()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Oa(f,null,!0,function(e,f,g){var k=0>g&&!!a.A&&!a.A.j.O;g?a.G('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(ta(a.Na,e,f),(e=Pa(e,f))&&fg(a,b,c,d,e.M,e.ca,e.ba)); +a.j.Va=!1;a.b&&(a.b--,a.b||B(a));cg(a)})}function Yf(a,b,c,d){if((a=a.m.listTapes)&&a.options){for(var e=0;e>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.N);for(d=0;dc.indexOf("/api/v1/dump")&&(b=Ga(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):Ha(c,"/")&&(d="dir"),f=Qa()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.Dc?"":e)+"&format=json"));return!!Oa(f, +null,!0,function(b,c,d){ng(a,b,c,d)})} +function ng(a,b,c,d){var e=null,f=0>d&&!!a.A&&!a.A.j.O;a.g=!1;if(d)a.controller.G('Unable to load disk "'+a.ua+'" (error '+d+": "+b+")",f);else{ta(a.controller.Na,b,c);try{if(0g&&0c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+ +c+")");if(k.length)if(1==k.length)u(k[0]);else{a.N=k.length;a.T=k[0].length;a.P=k[0][0].length;var l=k[0][0][0];a.da=l&&l.length||512;for(d=c=0;d>2,p=l.pattern;void 0===p&&(p=l.pattern=0);var t=l.data;if(void 0===t){var z=l.bytes;if(void 0!==z&&z.length){for(var y=m<<2,fa=z.length;fa>2,e=Array(d),f=0;f>2,c=(d>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.g)return!1;if(b>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.la?f=a.ta+a.la&&(a.la+=f-(a.ta+a.la)+1):(a.ta=f,a.la=1);d[f]=d[f]&~(255<g)break;e|=g<=this.a.length||l>=this.a[k].length||m>=this.a[k][l].length){c="sector (CHS="+k+":"+l+":"+m+") out of range ("+ +b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.a[k][l][m]){for(l=k.data.length;lb&&-2!=b&&this.controller.G("Unable to restore disk '"+this.ua+": "+c);return b}; +h.toJSON=function(){var a;a=0;for(var b;b=pg(this,a++);)rg(b);a=JSON.stringify(this.a,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")}; +function rg(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}var jg=0;function sg(a,b,c,d,e,f){q.call(this,a,b,c);this.w=tg(this,b.autoMount);this.s=0;this.D=d;this.H=e;this.I=f;this.C=d.Pc;this.b=Array(this.C);this.B=!Va("Mobi")&&window&&"FileReader"in window;this.h=[];this.jb=null;this.exports={selectDrive:this.Nf}}n(sg,q); +function tg(a,b){if(b&&"string"==typeof b)try{b=eval("("+b+")")}catch(c){u(a.type+" auto-mount error: "+c.message+" ("+b+")"),b=null}return b||{}}h=sg.prototype; +h.ka=function(a,b,c){var d=this;switch(b){case "listDisks":return this.m[b]=c,c.onchange=function(){var a=d.m.descDisk,b=c.options&&c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){u(d.type+" option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b=''+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.m[b]=c,c.onchange=function(){var a=Ca(c.value);null!=a&&ug(d, +a)},!0;case "loadDisk":return this.m[b]=c,c.onclick=function(){var a=d.m.listDisks;a&&a.options&&vg(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.m[b]=c,c.onclick=function(){var a,b=d.m.listDrives,b=b&&Ca(b.value);null==b||0>b||b>=d.b.length||!(a=d.b[b])?d.G("Unable to boot the selected drive"):a.V?(hd(d.c,0,!0),(a=d.Gb(a,0,0,0,512,0,2))&&d.G("Unable to read the boot sector ("+a+")")):d.G("Load a disk into the drive first")},!0;case "saveDisk":if(!this.B){c.parentNode.removeChild(c); +break}this.m[b]=c;c.onclick=function(){var a=d.m.listDrives;if(a&&a.options&&d.b)if(a=d.b[Ca(a.value)||0])if(a=a.V){var b;b="";for(var c=0,k;k=pg(a,c++);)for(var l=0,m=k.length;lg||9e||e>=a.b.length)a.G("Unable to load the selected drive");else if(c)if(c==yg)a.G('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==zg){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=Fa(c);a.status("Attempting to load "+c+' as "'+b+'"')}Fg(a,e,b,c,!1,d)}else Bg(a,e)} +function Fg(a,b,c,d,e,f){var g=-1,k=a.b[b];k.ma.toLowerCase()!=d.toLowerCase()&&(g++,Bg(a,b,!0),k.Cc?a.G(a.type+" busy"):(k.Cc=!0,e&&(k.Bc=!0,a.s++),k.ib=!!f,mg(new ig(a,k,"preload"),c,d,f,a.nd)&&g++));return g} +h.nd=function(a,b,c,d,e){a.Cc=!1;b&&(b.N>a.N||b.T>a.T)&&(this.G('Disk "'+c+'" too large for drive '+(this.type.substr(0,2)+a.Vb)),b=null);b?(a.V=b,a.ua=c,a.ma=d,Gg(this,c,d,b),this.G('Loaded disk "'+c+'" in drive '+(this.type.substr(0,2)+a.Vb),a.Bc||e),this.A&&$c(this.A)):a.ib=!1;a.Bc&&(a.Bc=!1,--this.s||B(this));ug(this,a.Vb)}; +function wg(a,b,c,d){if((a=a.m.listDisks)&&a.options){for(var e=0;e=a.N){m=V.Mb;break}p=a.seek(b,c,d+1);if(!p){m=V.gd;break}t=0;++d>=a.P&&(d=0,++c>=a.T&&(c=0,++b))}var z,y;if(0>(z=a.read(p,t++))||0>(y=a.read(p,t++))){m=V.Nb;break}if(!k&&(Mb(this.u,td(this.c,f),z|y<<8),mc(this.u))){m=V.ub;break}t>=a.da&&(p=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; +h.gc=function(a,b,c,d,e,f,g,k,l){var m=0;a=a.V;var p=null,t;a||(m=V.Yc,e=0);for(;e;){var z=Ob(this.u,td(this.c,f));if(mc(this.u)){m=V.ub;break}if(!p){if(b>=a.N){m=V.Mb;break}p=a.seek(b,c,d+1,!0);if(!p){m=V.gd;break}t=0;++d>=a.P&&(d=0,++c>=a.T&&(c=0,++b))}if(k){var y,fa;if(0>(y=a.read(p,t++))||0>(fa=a.read(p,t++))){m=V.Nb;break}if(z!=(y|fa<<8)){m=V.kd;break}}else if(!a.write(p,t++,z&255)||!a.write(p,t++,z>>8)){m=V.Nb;break}t>=a.da&&(p=null);f+=g;e--}return l?l(m,b,c,d,e,f):m}; +h.Rd=function(a,b,c,d,e,f){this.i=f&65535;this.a=this.a&~U.Ya|f>>16-U.S.Ya&U.Ya;this.l=65536-e&65535;this.g=this.g&~W.xc|d&W.xc;this.f|=a;Kg(this);return!0};function Kg(a){a.a&=~U.tb;a.f&&(a.f|=V.Fd,a.a|=U.tb,a.f&V.qc&&(a.a|=U.qc))}h.jf=function(){return this.v};h.tg=function(){};h.kf=function(){return this.f};h.ug=function(){};h.ff=function(){return this.a&U.wc}; +h.qg=function(a){this.a=this.a&~U.Ta|a&U.Ta;if(this.a&U.Rc){a=!0;var b,c,d=(this.g&W.Ma)>>W.S.Ma,e=this.b[d],f,g,k,l,m,p;this.a&=~(U.wa|U.yc);this.f&=~V.be;switch(c=this.a&U.ra){case Lg.zd:this.f=this.g=0;this.a=U.wa;break;case Lg.Nd:case Lg.Pd:b=this.Gb;case Lg.zc:case Lg.ke:b||(b=this.gc);f=(this.g&W.sb)>>W.S.sb;g=(this.g&W.rc)>>W.S.rc;k=this.g&W.xc;l=65536-this.l&65535;m=(this.a&U.Ya)<<16-U.S.Ya|this.i;p=this.a&U.Ld?0:2;if(f>=e.N){this.f|=V.Mb;break}if(k>=e.P){this.f|=V.Nb;break}a=b.call(this, +e,f,g,k,l,m,p,c>=Lg.zc,this.Rd.bind(this));break;case Lg.Sb:f=(this.g&W.sb)>>W.S.sb;f(p=a.read(k,m++))||0>(t=a.read(k,m++))){g=Y.ya;break}Mb(this.u,td(this.c,f),p|t<<8);if(mc(this.u)){g=Y.ub;break}f+=2;e--;if(m>=a.da&&(k=null,++d>=a.P&&(d=0,++c>=a.T&&(c=0,++b>=a.N)))){g=Y.ya;break}}return l?l(g,b,c,d,e,f):g}; +h.gc=function(a,b,c,d,e,f,g,k,l){g=0;a=a.V;k=null;var m;a||(g=Y.ya,e=0);for(;e;){var p=Ob(this.u,td(this.c,f));if(mc(this.u)){g=Y.ub;break}f+=2;e--;if(!k){k=a.seek(b,c,d+1,!0);if(!k){g=Y.ya;break}m=0}if(!a.write(k,m++,p&255)||!a.write(k,m++,p>>8)){g=Y.ya;break}if(m>=a.da&&(k=null,++d>=a.P&&(d=0,++c>=a.T&&(c=0,++b>=a.N)))){g=Y.ya;break}}return l?l(g,b,c,d,e,f):g}; +h.Wd=function(a,b,c,d,e,f){this.o=f&65535;this.a=this.a&~X.va|f>>16-X.S.va&X.va;this.i=f>>16&Og.vc;this.g=this.f=b<>X.S.va;if(!(this.a&X.wa)){a=!0;var b,c=this.b[(this.a&X.Ma)>>X.S.Ma],d=c.V,e,f,g;this.a&=~X.Xa;switch(this.a&X.ra){case Pg.fe:this.l&Qg.Sc&&(this.a&=X.Xa|X.ra|X.va);this.l=c.status|this.g&Z.Rb|(d&&512==d.N?Qg.Id:0);break;case Pg.Sb:(this.f&Z.Hd)==Z.ce&&(b=this.f&Z.vb,c=(this.f&Z.ee)<<2,this.g=this.f&Z.de?this.g+b:this.g-b,this.f=this.g=this.g&Z.vb|c);break;case Pg.Qd:this.l=this.g;break;case Pg.Od:b=this.Gb;case Pg.je:b||(b=this.gc), +e=this.f>>Z.S.vb,f=this.f&Z.Rb?1:0,g=this.f&Z.ed,!d||e>=d.N||g>=d.P?this.a=this.a|Y.ya|X.tb:(a=65536-this.l&65535,d=(this.i&Og.vc)<<16|this.o,a=b.call(this,c,e,f,g,a,d,2,!1,this.Wd.bind(this)))}a&&(this.a=this.a|X.Xa|X.wa,this.a&X.tc&&oc(this.c,this.jb))}};h.mf=function(){return this.o};h.wg=function(a){this.o=a&Rg.Ta};h.qf=function(){return this.f};h.zg=function(a){this.f=a};h.rf=function(){return this.l};h.Ag=function(a){this.l=a};h.nf=function(){return this.i}; +h.xg=function(a){this.i=a&Og.vc;this.a=this.a&~X.va|(this.i&3)<\nLicense: GPL version 3 or later ");this.Z("Portions adapted from the PDP-11/70 Emulator by Paul Nankervis ");for(b=0;bWg){if(Xg(d,this.s)){this.h=new E(this,"1.32.2",fh);Xg(this.h)&&(ih(this,d),a=jh,kh(this.h));this.h.set(ch,Na());lh(this.h);var e=this.a&&!this.l;if(a==dh||wa("Click OK to restore the previous "+hb+" machine state, or CANCEL to reset the machine.")){if(c=bh(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Xg(d,g):("error"==f&&"no machine state"!= +g?(this.G("Error: "+g),"unable to verify user"==g&&(Ua(mh,""),this.b=null)):this.Z(f+": "+g),kh(d),Xg(d)?(c=bh(d),e=!0):c=!1))}e&&$g(this,c?d:null)}else a==jh&&d.clear()}else $g(this);delete this.s;delete this.i}e=xa(this.id);for(f=0;fa[1];a=a[2];this.H=!0;this.j.O=!0;var d=this.m.power;d&&(d.textContent="Shutdown");this.c&&(nh(this,this.c,b,c,a),Kb(this,-2),this.c.Y());this.C&&(ih(this,b),b.clear());!c&&this.h&&(this.h.clear(),delete this.h);this.g=0}; +function ih(a,b){if(wa("There may be a problem with your "+hb+" machine.\n\nTo help us diagnose it, click OK to send this "+hb+" machine state to http://www.pcjs.org.")){var c=a.K;a=a.b||"";b=b.toString();var d={};d.app=hb;d.ver="1.32.2";d.url=c;d.user=a;d.type="bug";d.data=b;Oa("http://www.pcjs.org/api/v1/report",d,!0)}} +function oh(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new E(a,"1.32.2"),g=new E(a,"1.32.2",ah),k=Na();g.set(ch,k);f.set(ch,k);f.set(ph,"1.32.2");f.set(qh,window?window.location.href:null);f.set(rh,window?window.navigator.userAgent:"");a.c&&a.c.ia&&(c&&(b&&(a.c.j.Y=a.c.j.L),F(a.c)),d=a.c.ia(b,c),"object"===typeof d&&f.set(a.c.id,d),c&&(a.c.j.O=!1,!1===d&&(e=null)));for(var k=xa(a.id),l=0;l=d||30<=(c.Lc+=d))&&(e.textContent=c.j.L?c.Oa.toFixed(2)+"Mhz":"Stopped",c.Lc=0)}if(a.f&&(a=a.f,b=b||0,a.l)){c=a.c.j.L;d=!!(a.c.g&8);if(0>=b||60<=(a.i+=b)){for(e=0;eb?a.U=a.c.b[7]:0f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/().*?(<\/xsl:variable>)/,"$1PDPjs$2"), +a=a.replace(/().*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){f=null,a=p.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");Oa(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],g);zh(a,b,c)}})}else c(a,null)} +function Ah(a,b,c,d){function e(a){if(void 0===k){var b=g&&A(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=Ia(a))}function f(a){e("Error: "+a);l&&(--wh||cb(!0));l=!1}var g,k,l=!0;wh++;ua[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=m:t.appendChild(document.createTextNode(m));p.appendChild(t)}c|| +(c="/versions/pdpjs/1.32.2/components.xsl");m=function(d,k){k?xh(c,null,null,!1,e,function(d,l){l?(ta(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--wh||cb(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--wh||cb(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?xh(b,a,d,!0,e,m):yh(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(z){f(z.message)}return l}window.embedPDP11=function(a,b,c,d){cb(!1);return Ah(a,b,c,d)};window.findMachineComponent=function(a,b){return za(b,a+".machine")};window.enableEvents=cb;window.sendEvent=eb;})();//# sourceMappingURL=/tmp/pdpjs/1.32.2/pdp11.map