From 9e480d75748a828827e3a0b7d4522f1d09bf5e86 Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Mon, 24 Oct 2016 16:28:48 -0700 Subject: [PATCH] Added new RL11 component (work-in-progress) --- .../machine/1170/panel/debugger/machine.xml | 1 + devices/pdp11/machine/1170/panel/machine.xml | 1 + .../machine/1170/test/debugger/machine.xml | 1 + devices/pdp11/machine/1170/test/machine.xml | 1 + .../machine/1170/vt100/debugger/machine.xml | 1 + devices/pdp11/machine/1170/vt100/machine.xml | 1 + devices/pdp11/rl11/README.md | 42 + devices/pdp11/rl11/default.xml | 13 + docs/pcx86/examples/pcx86-dbg.js | 16 +- docs/pcx86/examples/pcx86.js | 14 +- modules/diskdump/lib/diskdump.js | 11 +- modules/pcx86/lib/disk.js | 18 +- modules/pcx86/lib/fdc.js | 40 +- modules/pdp11/lib/defines.js | 54 +- modules/pdp11/lib/device.js | 5 + modules/pdp11/lib/disk.js | 1233 +++++++++++++++++ modules/pdp11/lib/rk11.js | 85 -- modules/pdp11/lib/rl11.js | 868 ++++++++++++ modules/shared/lib/diskapi.js | 27 +- package.json | 3 + versions/pcx86/1.30.2/pcx86-dbg.js | 16 +- versions/pcx86/1.30.2/pcx86.js | 14 +- versions/pdpjs/1.30.2/pdp11-dbg.js | 513 +++---- versions/pdpjs/1.30.2/pdp11.js | 367 ++--- 24 files changed, 2760 insertions(+), 585 deletions(-) create mode 100644 devices/pdp11/rl11/README.md create mode 100644 devices/pdp11/rl11/default.xml create mode 100644 modules/pdp11/lib/disk.js delete mode 100644 modules/pdp11/lib/rk11.js create mode 100644 modules/pdp11/lib/rl11.js diff --git a/devices/pdp11/machine/1170/panel/debugger/machine.xml b/devices/pdp11/machine/1170/panel/debugger/machine.xml index 651afa204..45dc0237e 100644 --- a/devices/pdp11/machine/1170/panel/debugger/machine.xml +++ b/devices/pdp11/machine/1170/panel/debugger/machine.xml @@ -11,4 +11,5 @@ + diff --git a/devices/pdp11/machine/1170/panel/machine.xml b/devices/pdp11/machine/1170/panel/machine.xml index d67b09ac4..b0ba7dc2f 100644 --- a/devices/pdp11/machine/1170/panel/machine.xml +++ b/devices/pdp11/machine/1170/panel/machine.xml @@ -10,4 +10,5 @@ + diff --git a/devices/pdp11/machine/1170/test/debugger/machine.xml b/devices/pdp11/machine/1170/test/debugger/machine.xml index 1755805b5..7f7edaa71 100644 --- a/devices/pdp11/machine/1170/test/debugger/machine.xml +++ b/devices/pdp11/machine/1170/test/debugger/machine.xml @@ -10,4 +10,5 @@ + diff --git a/devices/pdp11/machine/1170/test/machine.xml b/devices/pdp11/machine/1170/test/machine.xml index d23a38295..11de545fe 100644 --- a/devices/pdp11/machine/1170/test/machine.xml +++ b/devices/pdp11/machine/1170/test/machine.xml @@ -9,4 +9,5 @@ + diff --git a/devices/pdp11/machine/1170/vt100/debugger/machine.xml b/devices/pdp11/machine/1170/vt100/debugger/machine.xml index 1ead1d4b6..d6b697b9f 100644 --- a/devices/pdp11/machine/1170/vt100/debugger/machine.xml +++ b/devices/pdp11/machine/1170/vt100/debugger/machine.xml @@ -10,4 +10,5 @@ + diff --git a/devices/pdp11/machine/1170/vt100/machine.xml b/devices/pdp11/machine/1170/vt100/machine.xml index 31267276b..86b340930 100644 --- a/devices/pdp11/machine/1170/vt100/machine.xml +++ b/devices/pdp11/machine/1170/vt100/machine.xml @@ -9,4 +9,5 @@ + diff --git a/devices/pdp11/rl11/README.md b/devices/pdp11/rl11/README.md new file mode 100644 index 000000000..ea6cc8416 --- /dev/null +++ b/devices/pdp11/rl11/README.md @@ -0,0 +1,42 @@ +--- +layout: page +title: RL11 Disk Controller +permalink: /devices/pdp11/rl11/ +--- + +RL11 Disk Controller +-------------------- + +Machines containing the [RL11 Component](/modules/pdp11/lib/pc11.js) include: + +- [PDP-11/70 Boot Test](/devices/pdp11/machine/1170/test/) (with [Debugger](/devices/pdp11/machine/1170/test/debugger/)) +- [PDP-11/70 with Front Panel](/devices/pdp11/machine/1170/panel/) (with [Debugger](/devices/pdp11/machine/1170/panel/debugger/)) + +PCjs has archived a selection of [RL02K Disk Images](/disks/dec/rl02k/) for use by those machines, most of which are +listed in the following RL11 Device XML file: + +- [Default](/devices/pdp11/rl11/default.xml) + +which is typically referenced by a Machine XML file as: + + + +Device XML files not only configure a device, but also list all the resource the device will use, and define UI elements +used to control the device, such as choosing which disks should be "auto-mounted" by the RL11 device. For example: + + + + Paper Tape Controls + + + + + + + Attach + Load + + + Tape Progress + + diff --git a/devices/pdp11/rl11/default.xml b/devices/pdp11/rl11/default.xml new file mode 100644 index 000000000..4cdd2817c --- /dev/null +++ b/devices/pdp11/rl11/default.xml @@ -0,0 +1,13 @@ + + + Disk Drive Controls + + + + + + Load + + + + diff --git a/docs/pcx86/examples/pcx86-dbg.js b/docs/pcx86/examples/pcx86-dbg.js index 98816b5d4..7b88797de 100644 --- a/docs/pcx86/examples/pcx86-dbg.js +++ b/docs/pcx86/examples/pcx86-dbg.js @@ -43,9 +43,9 @@ http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016 http://pcjs.org/modules/shared/lib/save.js (C) Jeff Parsons 2012-2016 */ -var l,aa,ba={163840:[40,1,8],184320:[40,1,9],327680:[40,2,8],368640:[40,2,9],737280:[80,2,9],1228800:[80,2,15],1474560:[80,2,18],2949120:[80,2,36],21368320:[615,4,17]},p={uo:1,dl:3,vo: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,ue:65,Bi:66,Ci:67,Di:68,E:69,Ei:70,Fi:71,Gi:72,Hi:73,Ii:74,Ji:75,Ki:76,Li:77,Mi:78,Ni:79,Oi:80,Q:81,Pi:82, -Qi:83,Ri:84,Si:85,Ti:86,Ui:87,Vi:88,Wi:89,ng:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,ve:97,ol:98,ql:99,d:100,e:101,Al:102,Bl:103,Cl:104,Dl:105,Tm:106,k:107,Um:108,Ym:109,n:110,en:111,p:112,q:113,r:114,lo:115,t:116,oo:117,po:118,qo:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},ca={};ca[186]=p[";"];ca[187]=p["="];ca[188]=p[","];ca[189]=p["-"];ca[190]=p["."];ca[191]=p["/"];ca[192]=p["`"];ca[219]=p["["];ca[220]=p["\\"];ca[221]=p["]"];ca[222]=p["'"];ca[173]=p["-"];var da={};da[p["1"]]=p["!"]; -da[p["2"]]=p["@"];da[p["3"]]=p["#"];da[p["4"]]=p.$;da[p["5"]]=p["%"];da[p["6"]]=p["^"];da[p["7"]]=p["&"];da[p["8"]]=p["*"];da[p["9"]]=p["("];da[p["0"]]=p[")"];da[186]=p[":"];da[187]=p["+"];da[188]=p["<"];da[189]=p._;da[190]=p[">"];da[191]=p["?"];da[192]=p["~"];da[219]=p["{"];da[220]=p["|"];da[221]=p["}"];da[222]=p['"'];da[173]=p._;da[61]=p["+"];da[59]=p[":"]; +var l,aa,ba={163840:[40,1,8],184320:[40,1,9],327680:[40,2,8],368640:[40,2,9],737280:[80,2,9],1228800:[80,2,15],1474560:[80,2,18],2949120:[80,2,36],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]},p={uo:1,dl:3,vo: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,ue:65,Bi:66,Ci:67,Di:68,E:69,Ei:70,Fi:71,Gi:72,Hi:73,Ii:74, +Ji:75,Ki:76,Li:77,Mi:78,Ni:79,Oi:80,Q:81,Pi:82,Qi:83,Ri:84,Si:85,Ti:86,Ui:87,Vi:88,Wi:89,ng:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,ve:97,ol:98,ql:99,d:100,e:101,Al:102,Bl:103,Cl:104,Dl:105,Tm:106,k:107,Um:108,Ym:109,n:110,en:111,p:112,q:113,r:114,lo:115,t:116,oo:117,po:118,qo:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},ca={};ca[186]=p[";"];ca[187]=p["="];ca[188]=p[","];ca[189]=p["-"];ca[190]=p["."];ca[191]=p["/"];ca[192]=p["`"];ca[219]=p["["];ca[220]=p["\\"];ca[221]=p["]"]; +ca[222]=p["'"];ca[173]=p["-"];var da={};da[p["1"]]=p["!"];da[p["2"]]=p["@"];da[p["3"]]=p["#"];da[p["4"]]=p.$;da[p["5"]]=p["%"];da[p["6"]]=p["^"];da[p["7"]]=p["&"];da[p["8"]]=p["*"];da[p["9"]]=p["("];da[p["0"]]=p[")"];da[186]=p[":"];da[187]=p["+"];da[188]=p["<"];da[189]=p._;da[190]=p[">"];da[191]=p["?"];da[192]=p["~"];da[219]=p["{"];da[220]=p["|"];da[221]=p["}"];da[222]=p['"'];da[173]=p._;da[61]=p["+"];da[59]=p[":"]; function ea(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0>=1;return c}function ha(a,b,c){var d="";if(!b||4>=8;return(c?"0b":"")+d} function ia(a,b,c){var d="";b?11>=3;return(c?"0o":"")+d}function r(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function u(a){return r(a,2,!0)}function v(a){return r(a,4,!0)} @@ -618,9 +618,9 @@ function ap(a,b,c){var d;c=c||2;var e=b&511,f=bp(a.za,a.xe[b>>9]);if(f){if(e+c<= Oo.prototype.xj=function(a,b){var c=null;if(this.yd)for(var d in this.yd){var e=this.yd[d];if(a>=e.oi&&a<=e.Ik){d=a-=e.oi;var f,g;for(g in e.we){var h=e.we[g],k=a-h[0];if(!k){c=this.jg+"!"+h[1];break}b&&0>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.Bb);for(c=0;cb.indexOf("/api/v1/dump")&&(a=ka(b),"json"==a||"gz"==a?f=encodeURI(b):"demandrw"==this.mode||"demandro"==this.mode?(f=hp(this,b),this.xg=!0):(c="path",d="&mbhd=10",!b.indexOf("http:")||!b.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(a)?(c="disk",d="&mbhd=0"):ma(b,"/")&& -(c="dir"),f=Ba()+"/api/v1/dump?"+c+"="+encodeURIComponent(b)+(this.cf?"":d)+"&format=json"));return!!Aa(f,null,!0,function(a,b,c){ip(g,a,b,c)})}; +l.load=function(a,b,c,d,e){var f=b;if(this.W)return!0;this.ga=a;this.V=b;this.Ug=ja(b);var g=this;this.W=d;this.ka=e||this.controller;if(c){var h=new FileReader;h.onload=function(){var a=h.result,b,c=a?a.byteLength:0,d=ba[c];if(d){g.Bb=d[0];g.ub=d[1];g.lb=d[2];g.Va=d[3]||512;b=g.Va>>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.Bb);for(c=0;cb.indexOf("/api/v1/dump")&&(a=ka(b),"json"==a||"gz"==a?f=encodeURI(b):"demandrw"==this.mode||"demandro"==this.mode?(f=hp(this,b),this.xg=!0):(c="path",d="&mbhd=10",!b.indexOf("http:")||!b.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(a)?(c="disk",d="&mbhd=0"):ma(b, +"/")&&(c="dir"),f=Ba()+"/api/v1/dump?"+c+"="+encodeURIComponent(b)+(this.cf?"":d)+"&format=json"));return!!Aa(f,null,!0,function(a,b,c){ip(g,a,b,c)})}; function ip(a,b,c,d){var e=null;a.ff=!1;var f=0>d&&a.X&&!a.X.la.ic;if(a.xg)d?a.controller.Na('Unable to connect to disk "'+a.V+'" (error '+d+": "+c+")",f):(a.N=!0,jp(a),e=a);else if(d)a.controller.Na('Unable to load disk "'+a.ga+'" (error '+d+": "+b+")",f);else{mb(a.controller.ce,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(h.length)if(1==h.length)w(h[0]);else{a.Bb=h.length;a.ub=h[0].length;a.lb=h[0][0].length;var k=h[0][0][0];a.Va=k&&k.length||512;for(d=c=0;d>2,n=k.pattern;void 0===n&&(n=k.pattern=0);var t=k.data;if(void 0===t){var q=k.bytes;if(void 0!==q&&q.length){for(var A= m<<2,F=q.length;F'+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 "loadDrive":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 "saveDrive":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)])? -(a=a.za)?(a=Na(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 "mountDrive":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}; +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 "loadDrive":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 "saveDrive":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=Na(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 "mountDrive":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.Ic=function(a,b,c,d){this.ga=b;this.F=c;this.ha=d;this.X=a;this.N=Jb(a,"ChipSet");if((this.U=Yc(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);qc(b,this,Ap);yc(b,this,Bp);Cp(this,"None","",!0);this.ia&&Cp(this,"Local Disk","?");Cp(this,"Remote Disk","??");Dp(this)||xb(this)}; l.hc=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.X.lh){this.B=[];for(a=0;a":62,"?":63,"@":64,Jd:65,wh:66,xh:67,yh:68,E:69,zh:70,Ah:71,Bh:72,Ch:73,Dh:74,Eh:75,Fh:76,Gh:77,Ih:78,Kh:79,Mh:80,Q:81,Ph:82, -Rh:83,Th:84,Vh:85,Xh:86,Zh:87,ai:88,ci:89,vf:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Ld:97,bk:98,ck:99,d:100,e:101,mk:102,nk:103,pk:104,qk:105,Bl:106,k:107,Cl:108,Fl:109,n:110,Kl:111,p:112,q:113,r:114,Mm:115,t:116,Pm:117,Qm:118,Rm:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},da={};da[186]=n[";"];da[187]=n["="];da[188]=n[","];da[189]=n["-"];da[190]=n["."];da[191]=n["/"];da[192]=n["`"];da[219]=n["["];da[220]=n["\\"];da[221]=n["]"];da[222]=n["'"];da[173]=n["-"];var p={};p[n["1"]]=n["!"]; -p[n["2"]]=n["@"];p[n["3"]]=n["#"];p[n["4"]]=n.$;p[n["5"]]=n["%"];p[n["6"]]=n["^"];p[n["7"]]=n["&"];p[n["8"]]=n["*"];p[n["9"]]=n["("];p[n["0"]]=n[")"];p[186]=n[":"];p[187]=n["+"];p[188]=n["<"];p[189]=n._;p[190]=n[">"];p[191]=n["?"];p[192]=n["~"];p[219]=n["{"];p[220]=n["|"];p[221]=n["}"];p[222]=n['"'];p[173]=n._;p[61]=n["+"];p[59]=n[":"]; +var l,ba,ca={163840:[40,1,8],184320:[40,1,9],327680:[40,2,8],368640:[40,2,9],737280:[80,2,9],1228800:[80,2,15],1474560:[80,2,18],2949120:[80,2,36],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]},n={Tm:1,Sj:3,Um: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,Jd:65,wh:66,xh:67,yh:68,E:69,zh:70,Ah:71,Bh:72,Ch:73,Dh:74, +Eh:75,Fh:76,Gh:77,Ih:78,Kh:79,Mh:80,Q:81,Ph:82,Rh:83,Th:84,Vh:85,Xh:86,Zh:87,ai:88,ci:89,vf:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Ld:97,bk:98,ck:99,d:100,e:101,mk:102,nk:103,pk:104,qk:105,Bl:106,k:107,Cl:108,Fl:109,n:110,Kl:111,p:112,q:113,r:114,Mm:115,t:116,Pm:117,Qm:118,Rm:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},da={};da[186]=n[";"];da[187]=n["="];da[188]=n[","];da[189]=n["-"];da[190]=n["."];da[191]=n["/"];da[192]=n["`"];da[219]=n["["];da[220]=n["\\"];da[221]=n["]"]; +da[222]=n["'"];da[173]=n["-"];var p={};p[n["1"]]=n["!"];p[n["2"]]=n["@"];p[n["3"]]=n["#"];p[n["4"]]=n.$;p[n["5"]]=n["%"];p[n["6"]]=n["^"];p[n["7"]]=n["&"];p[n["8"]]=n["*"];p[n["9"]]=n["("];p[n["0"]]=n[")"];p[186]=n[":"];p[187]=n["+"];p[188]=n["<"];p[189]=n._;p[190]=n[">"];p[191]=n["?"];p[192]=n["~"];p[219]=n["{"];p[220]=n["|"];p[221]=n["}"];p[222]=n['"'];p[173]=n._;p[61]=n["+"];p[59]=n[":"]; function ea(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function ga(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0":">",'"':""","'":"'"};function ka(a){return a.replace(/[&<>"']/g,function(a){return ja[a]})}function la(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} @@ -574,8 +574,8 @@ l.le=function(a,b){if(this.cc&&this.A&&this.A.ea.Nb)switch(a){case pl:this.S!=b& function cm(a,b,c){Ka.call(this,"Disk",{id:a.Fe+".disk"+fa(++dm,4)},cm);this.controller=a;this.ba=a.ba;this.Ia=a.Ia;this.C=b;this.B=b.name;this.qe=b.qe;this.Gf=this.D=!1;em(this,c,b.ib,b.jb,b.eb,b.nb);this.I=[];this.S=[];this.G=null;this.P=0;this.R=!1;t(this)}var dm=0;Ta(cm);l=cm.prototype;l.pc=function(a,b,c,d){this.Ia=d};l.Ub=function(a,b){b||!this.Gf||this.D||(t(this,!1),this.load(this.B,this.H,null,this.lk,this));return!0};l.lk=function(){t(this,!0)}; l.Tb=function(a,b){if(this.D){var c,d=0;if(this.R&&!ua("Disk writes are still in progress, shut down anyway?"))return!1;for(;c=fm(this,!1);)if(d=c[0]){this.controller.Ba('Unable to save "'+this.B+'" (error '+d+")");break}b&&this.D&&(b="action=close&volume="+this.H,b+="&machine="+this.controller.ue(),b+="&user="+this.controller.yd(),sa(ta()+"/api/v1/disk?"+b,null,!0),this.D=!1);!d&&a&&this.controller.Ba(this.B+" saved")}return!0}; function em(a,b,c,d,e,f){a.mode=b;a.ib=c;a.jb=d;a.eb=e;a.nb=f;a.A=[];if("preload"!=a.mode){b=Array(a.ib);for(c=0;c>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.ib);for(c=0;cb.indexOf("/api/v1/dump")&&(a=ha(b),"json"==a||"gz"==a?f=encodeURI(b):"demandrw"==this.mode||"demandro"==this.mode?(f=hm(this,b),this.Gf=!0):(c="path",d="&mbhd=10",!b.indexOf("http:")||!b.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(a)?(c="disk",d="&mbhd=0"): +l.load=function(a,b,c,d,e){var f=b;if(this.K)return!0;this.B=a;this.H=b;this.th=ga(b);var g=this;this.K=d;this.ia=e||this.controller;if(c){var h=new FileReader;h.onload=function(){var a=h.result,b,c=a?a.byteLength:0,d=ca[c];if(d){g.ib=d[0];g.jb=d[1];g.eb=d[2];g.nb=d[3]||512;b=g.nb>>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.ib);for(c=0;cb.indexOf("/api/v1/dump")&&(a=ha(b),"json"==a||"gz"==a?f=encodeURI(b):"demandrw"==this.mode||"demandro"==this.mode?(f=hm(this,b),this.Gf=!0):(c="path",d="&mbhd=10",!b.indexOf("http:")||!b.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(a)?(c="disk",d="&mbhd=0"): ia(b,"/")&&(c="dir"),f=ta()+"/api/v1/dump?"+c+"="+encodeURIComponent(b)+(this.qe?"":d)+"&format=json"));return!!sa(f,null,!0,function(a,b,c){im(g,a,b,c)})}; function im(a,b,c,d){var e=null;a.te=!1;var f=0>d&&a.ba&&!a.ba.ea.Vb;if(a.Gf)d?a.controller.Ba('Unable to connect to disk "'+a.H+'" (error '+d+": "+c+")",f):(a.D=!0,e=a);else if(d)a.controller.Ba('Unable to load disk "'+a.B+'" (error '+d+": "+b+")",f);else{Va(a.controller.Fe,b,c);try{if(0g&&0 c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+c+")");if(h.length)if(1==h.length)r(h[0]);else{a.ib=h.length;a.jb=h[0].length;a.eb=h[0][0].length;var k=h[0][0][0];a.nb=k&&k.length||512;for(d=c=0;d>2,q=k.pattern;void 0===q&&(q=k.pattern=0);var y=k.data;if(void 0===y){var w=k.bytes;if(void 0!==w&&w.length){for(var z= @@ -595,8 +595,8 @@ l.toJSON=function(){var a;a=0;for(var b;b=km(this,a++);)sm(b);a=JSON.stringify(t function sm(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)}}function tm(a){Ka.call(this,"FDC",a,tm);this.dmaRead=this.Tj;this.dmaWrite=this.Uj;this.dmaFormat=this.hk;this.K=a.autoMount||null;this.W=a.sortBy||"name";"none"==this.W&&(this.W=null);this.C=[];this.Y=!za("Mobi")&&window&&"FileReader"in window}Ta(tm);ba={}; var um={3:{gd:3,wd:0,name:ba.dn},4:{gd:2,wd:1,name:ba.bn},5:{gd:9,wd:7,name:ba.hn},6:{gd:9,wd:7,name:ba.Ym},7:{gd:2,wd:0,name:ba.$m},8:{gd:1,wd:2,name:ba.cn},10:{gd:2,wd:7,name:ba.Zm},13:{gd:6,wd:7,name:ba.Vm},15:{gd:3,wd:0,name:ba.an}};l=tm.prototype; l.zb=function(a,b,c){var d=this;switch(b){case "listDisks":this.la[b]=c;if(this.W){b=[];for(a=0;a'+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 "loadDrive":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 "saveDrive":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)])?(a= -a.ta)?(a=Aa(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 "mountDrive":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}; +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 "loadDrive":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 "saveDrive":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.ta)?(a=Aa(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 "mountDrive":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=mb(a,"ChipSet");if((this.K=nc(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);Sb(b,this,ym);Ub(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;a> 2, dwPattern = 0, dwChecksum = 0; var ib = 0; @@ -1138,7 +1138,7 @@ Disk.prototype.build = function(buffer, fModified) this.dwChecksum = dwChecksum; disk = this; } else { - this.notice("Unrecognized diskette format (" + cbDiskData + " bytes)"); + this.notice("Unrecognized disk format (" + cbDiskData + " bytes)"); } if (this.fnNotify) { diff --git a/modules/pcx86/lib/fdc.js b/modules/pcx86/lib/fdc.js index ee246e214..c4aafc8fb 100644 --- a/modules/pcx86/lib/fdc.js +++ b/modules/pcx86/lib/fdc.js @@ -547,7 +547,7 @@ FDC.prototype.setBinding = function(sHTMLType, sBinding, control, sValue) control.onclick = function onClickSaveDrive(event) { var controlDrives = fdc.bindings["listDrives"]; if (controlDrives && controlDrives.options && fdc.aDrives) { - var iDriveSelected = str.parseInt(controlDrives.value, 10); + var iDriveSelected = str.parseInt(controlDrives.value, 10) || 0; var drive = fdc.aDrives[iDriveSelected]; if (drive) { /* @@ -1069,17 +1069,17 @@ FDC.prototype.initDrive = function(drive, iDrive, data) * so all we have to do is mount a blank diskette and let disk.restore() do the rest; ie, there's nothing to * "load" (it's a purely synchronous operation). * - * Otherwise, we must call loadDiskette(); in the common case, loadDiskette() will have already "auto-mounted" + * Otherwise, we must call loadDrive(); in the common case, loadDrive() will have already "auto-mounted" * the diskette, so it will return true, and then we restore any deltas to the current image. * - * However, if loadDiskette() returns false, then it has initiated the load for a *different* disk 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.mountDiskette(iDrive, sDisketteName, sDiskettePath); + this.mountDrive(iDrive, sDisketteName, sDiskettePath); } - else if (this.loadDiskette(iDrive, sDisketteName, sDiskettePath, true)) { + else if (this.loadDrive(iDrive, sDisketteName, sDiskettePath, true)) { if (drive.disk) { if (sDiskettePath) { this.addDiskHistory(sDisketteName, sDiskettePath, drive.disk); @@ -1103,7 +1103,7 @@ FDC.prototype.initDrive = function(drive, iDrive, data) } /* - * TODO: If loadDiskette() returned true, then this can happen immediately. Otherwise, loadDiskette() + * TODO: If loadDrive() returned true, then this can happen immediately. Otherwise, loadDrive() * will have merely "queued up" the load request and drive.disk won't be ready yet, so figure out how/when * we can properly restore drive.sector in that case. */ @@ -1288,7 +1288,7 @@ FDC.prototype.autoMount = function(fRemount) */ var iDrive = sDrive.charCodeAt(0) - 0x41; if (iDrive >= 0 && iDrive < this.aDrives.length) { - if (!this.loadDiskette(iDrive, sDisketteName, sDiskettePath, true) && fRemount) { + if (!this.loadDrive(iDrive, sDisketteName, sDiskettePath, true) && fRemount) { this.setReady(false); } continue; @@ -1342,16 +1342,16 @@ FDC.prototype.loadSelectedDrive = function(sDisketteName, sDiskettePath, file) if (DEBUG) this.println("loading disk " + sDiskettePath + "..."); - while (this.loadDiskette(iDrive, sDisketteName, sDiskettePath, false, file) < 0) { + while (this.loadDrive(iDrive, sDisketteName, sDiskettePath, false, file) < 0) { if (!window.confirm("Click OK to reload the original disk.\n(WARNING: All disk changes will be discarded)")) { return; } /* - * So here's the story: loadDiskette() returned true, which it does ONLY if the specified disk is already + * So here's the story: loadDrive() returned true, which it does ONLY if the specified disk is already * mounted, AND the user clicked OK to reload the original disk image. So we must toss any history we have - * for the disk, unload it, and then loop back around to loadDiskette(). + * for the disk, unload it, and then loop back around to loadDrive(). * - * loadDiskette() should NEVER return true the second time, since no disk is loaded. In other words, + * loadDrive() should NEVER return true the second time, since no disk is loaded. In other words, * this isn't really a loop so much as a one-time retry operation. */ this.removeDiskHistory(sDisketteName, sDiskettePath); @@ -1363,24 +1363,24 @@ FDC.prototype.loadSelectedDrive = function(sDisketteName, sDiskettePath, file) }; /** - * mountDiskette(iDrive, sDisketteName, sDiskettePath) + * mountDrive(iDrive, sDisketteName, sDiskettePath) * * @this {FDC} * @param {number} iDrive * @param {string} sDisketteName * @param {string} sDiskettePath */ -FDC.prototype.mountDiskette = function(iDrive, sDisketteName, sDiskettePath) +FDC.prototype.mountDrive = function(iDrive, sDisketteName, sDiskettePath) { var drive = this.aDrives[iDrive]; this.unloadDrive(iDrive, true, true); drive.fLocal = true; var disk = new Disk(this, drive, DiskAPI.MODE.PRELOAD); - this.doneLoadDiskette(drive, disk, sDisketteName, sDiskettePath, true); + this.doneLoadDrive(drive, disk, sDisketteName, sDiskettePath, true); }; /** - * loadDiskette(iDrive, sDisketteName, sDiskettePath, fAutoMount, file) + * loadDrive(iDrive, sDisketteName, sDiskettePath, fAutoMount, file) * * NOTE: If sDiskettePath is already loaded in the drive, nothing needs to be done. * @@ -1392,7 +1392,7 @@ FDC.prototype.mountDiskette = function(iDrive, sDisketteName, sDiskettePath) * @param {File} [file] is set if there's an associated File object * @return {number} 1 if diskette loaded, 0 if queued up (or busy), -1 if already loaded */ -FDC.prototype.loadDiskette = function(iDrive, sDisketteName, sDiskettePath, fAutoMount, file) +FDC.prototype.loadDrive = function(iDrive, sDisketteName, sDiskettePath, fAutoMount, file) { var drive = this.aDrives[iDrive]; if (sDiskettePath) { @@ -1419,7 +1419,7 @@ FDC.prototype.loadDiskette = function(iDrive, sDisketteName, sDiskettePath, fAut } drive.fLocal = !!file; var disk = new Disk(this, drive, DiskAPI.MODE.PRELOAD); - if (!disk.load(sDisketteName, sDiskettePath, file, this.doneLoadDiskette)) { + if (!disk.load(sDisketteName, sDiskettePath, file, this.doneLoadDrive)) { return 0; } return 1; @@ -1429,7 +1429,7 @@ FDC.prototype.loadDiskette = function(iDrive, sDisketteName, sDiskettePath, fAut }; /** - * doneLoadDiskette(drive, disk, sDisketteName, sDiskettePath, fAutoMount) + * doneLoadDrive(drive, disk, sDisketteName, sDiskettePath, fAutoMount) * * @this {FDC} * @param {Object} drive @@ -1438,7 +1438,7 @@ FDC.prototype.loadDiskette = function(iDrive, sDisketteName, sDiskettePath, fAut * @param {string} sDiskettePath * @param {boolean} [fAutoMount] */ -FDC.prototype.doneLoadDiskette = function onFDCLoadNotify(drive, disk, sDisketteName, sDiskettePath, fAutoMount) +FDC.prototype.doneLoadDrive = function onFDCLoadNotify(drive, disk, sDisketteName, sDiskettePath, fAutoMount) { var aDiskInfo; @@ -1481,7 +1481,7 @@ FDC.prototype.doneLoadDiskette = function onFDCLoadNotify(drive, disk, sDiskette this.addDiskHistory(sDisketteName, sDiskettePath, disk); /* - * For a local disk (ie, one loaded via mountDiskette()), the disk.restore() performed by addDiskHistory() + * 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(); diff --git a/modules/pdp11/lib/defines.js b/modules/pdp11/lib/defines.js index 86601ffaf..27001524f 100644 --- a/modules/pdp11/lib/defines.js +++ b/modules/pdp11/lib/defines.js @@ -520,31 +520,6 @@ var PDP11 = { SL: 0o177774, // Stack Limit Register PSW: 0o177776 // 777776 17777776 0x3FFFFE Processor Status Word }, - PC11: { // High Speed Reader & Punch (PR11 is a Reader-only unit) - PRI: 4, // NOTE: reader has precedence over punch - RVEC: 0o70, // reader vector - PVEC: 0o74, // punch vector - PRS: { - RE: 0x0001, // Reader Enable (W/O) - RIE: 0x0040, // Reader Interrupt Enable (allows the DONE and ERROR bits to trigger an interrupt) - DONE: 0x0080, // Done (R/O) - BUSY: 0x0800, // Busy (R/O) - ERROR: 0x8000, // Error (R/O) - CLEAR: 0x08C0, // bits cleared on INIT - RMASK: 0xFFFE, // bits readable (TODO: All I know for sure is that bit 0 is NOT readable; see readPRS()) - WMASK: 0x0041, // bits writable - BAUD: 3600 - }, - PRB: { - MASK: 0x00FF // Data - }, - PPS: { - /* - * TODO: Flesh this out if/when we add Paper Tape Punch support - */ - BAUD: 600 - }, - }, DL11: { // Serial Line Interface (program compatible with the KL11 for control of console teleprinters) PRI: 4, RVEC: 0o60, @@ -595,6 +570,35 @@ var PDP11 = { IE: 0x0040, // Interrupt Enable MON: 0x0080 // Monitor } + }, + PC11: { // High Speed Reader & Punch (PR11 is a Reader-only unit) + PRI: 4, // NOTE: reader has precedence over punch + RVEC: 0o70, // reader vector + PVEC: 0o74, // punch vector + PRS: { + RE: 0x0001, // Reader Enable (W/O) + RIE: 0x0040, // Reader Interrupt Enable (allows the DONE and ERROR bits to trigger an interrupt) + DONE: 0x0080, // Done (R/O) + BUSY: 0x0800, // Busy (R/O) + ERROR: 0x8000, // Error (R/O) + CLEAR: 0x08C0, // bits cleared on INIT + RMASK: 0xFFFE, // bits readable (TODO: All I know for sure is that bit 0 is NOT readable; see readPRS()) + WMASK: 0x0041, // bits writable + BAUD: 3600 + }, + PRB: { + MASK: 0x00FF // Data + }, + PPS: { + /* + * TODO: Flesh this out if/when we add Paper Tape Punch support + */ + BAUD: 600 + }, + }, + RL11: { // RL11 Disk Controller + PRI: 5, // TODO: Review controller defaults and their configurability + VEC: 0o160 } }; diff --git a/modules/pdp11/lib/device.js b/modules/pdp11/lib/device.js index ab4bc2101..141040188 100644 --- a/modules/pdp11/lib/device.js +++ b/modules/pdp11/lib/device.js @@ -40,6 +40,7 @@ if (NODE) { var BusPDP11 = require("./bus"); var MessagesPDP11 = require("./messages"); var PC11 = require("./pc11"); + var RL11 = require("./rl11"); } /** @@ -1231,6 +1232,10 @@ DevicePDP11.init = function() device = new PC11(parmsDevice); Component.bindComponentControls(device, eDevice, PDP11.APPCLASS); break; + case 'rl11': + device = new RL11(parmsDevice); + Component.bindComponentControls(device, eDevice, PDP11.APPCLASS); + break; } } }; diff --git a/modules/pdp11/lib/disk.js b/modules/pdp11/lib/disk.js new file mode 100644 index 000000000..9df2ec0ff --- /dev/null +++ b/modules/pdp11/lib/disk.js @@ -0,0 +1,1233 @@ +/** + * @fileoverview Implements disk image support for various disk controllers. + * @author Jeff Parsons + * @copyright © Jeff Parsons 2012-2016 + * + * 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. + */ + +/* + * The DiskPDP11 component provides methods for: + * + * 1) creating an empty disk: create() + * 2) loading a disk image: load() + * 3) getting disk information: info() + * 4) seeking a disk sector: seek() + * 5) reading data from a sector: read() + * 6) writing data to a sector: write() + * 7) save disk deltas: save() + * 8) restore disk deltas: restore() + * 9) converting disk contents: toJSON() + * + * More functionality may be factored out of the disk controller components later and moved here, + * to further reduce some of the duplication between them, but the above functionality is a good start. + */ + +"use strict"; + +if (NODE) { + var str = require("../../shared/lib/strlib"); + var usr = require("../../shared/lib/usrlib"); + var web = require("../../shared/lib/weblib"); + var DiskAPI = require("../../shared/lib/diskapi"); + var DumpAPI = require("../../shared/lib/dumpapi"); + var Component = require("../../shared/lib/component"); + var MessagesPDP11 = require("./messages"); +} + +/** + * DiskPDP11(controller, drive, mode) + * + * Disk contents are stored as an array (aDiskData) of cylinders, each of which is an array of + * heads, each of which is an array of sector objects; the latter contain sector numbers and + * sector data, where sector data is an array of dwords. The format does not impose any + * limitations on number of cylinders, number of heads, sectors per track, or bytes per sector. + * + * WARNING: All accesses to disk sector properties must be via their string names, not their + * "dot" names, otherwise code will break after it's been processed by the Closure Compiler, + * and any dumped disks may be unmountable. This is a side-effect of how we mount and dump + * disk images (ie, as JSON-encoded streams). + * + * This means, for example, that all references to "track[iSector].data" must actually appear as + * "track[iSector]['data']". + * + * @constructor + * @extends Component + * @param {RL11} controller + * @param {Object} drive + * @param {string} mode + */ +function DiskPDP11(controller, drive, mode) +{ + Component.call(this, "Disk", {'id': controller.idMachine + ".disk" + str.toHex(++DiskPDP11.nDisks, 4)}, DiskPDP11, MessagesPDP11.DISK); + + /* + * Route all non-Debugger messages (eg, notice() and println() calls) through + * this.controller (eg, controller.notice() and controller.println()), because + * the Computer component is unaware of any Disk objects and therefore will not + * set up the usual overrides when a Control Panel is installed. + */ + this.controller = controller; + this.cmp = controller.cmp; + this.dbg = controller.dbg; + this.drive = drive; + + /* + * We pull out a number of drive properties that we may or may not need as defaults + */ + this.sDiskName = drive.name; + this.fRemovable = drive.fRemovable; + + /* + * Initialize the disk contents + */ + this.create(mode, drive.nCylinders, drive.nHeads, drive.nSectors, drive.cbSector); + + this.setReady(); +} + +/* + * A global disk count, used to form unique Disk component IDs (totally optional; for debugging purposes only) + */ +DiskPDP11.nDisks = 0; + +Component.subclass(DiskPDP11); + +/** + * Every Sector object (once loaded, parsed, and "normalized") should have ALL of the following named properties: + * + * 'sector': sector number + * 'length': size of the sector, in bytes + * 'data': array of dwords + * 'pattern': dword pattern to use for empty or partial sectors (or null if sector still needs to be loaded) + * + * initSector() also sets the following properties, to help us quickly identify its location within aDiskData: + * + * iCylinder + * iHead + * + * In addition, we will maintain the following information on a per-sector basis, as sectors are modified: + * + * iModify: index of first modified dword in sector + * cModify: number of modified dwords in sector + * fDirty: true if sector is dirty, false if clean (or cleaning in progress) + * + * @typedef {{ + * sector: number, + * length: number, + * data: Array., + * pattern: (number|null), + * iCylinder: number, + * iHead: number, + * iModify: number, + * cModify: number + * }} + */ +var SectorInfo; + +/** + * initBus(cmp, bus, cpu, dbg) + * + * We have no real interest in this notification, other than to obtain a reference to the Debugger + * for every disk loaded BEFORE the initBus() phase; any disk loaded AFTER that point will get its Debugger + * reference, if any, from the disk controller passed to the DiskPDP11() constructor. + * + * @this {DiskPDP11} + * @param {ComputerPDP11} cmp + * @param {BusPDP11} bus + * @param {CPUStatePDP11} cpu + * @param {DebuggerPDP11} dbg + */ +DiskPDP11.prototype.initBus = function(cmp, bus, cpu, dbg) { + this.dbg = dbg; +}; + +/** + * create() + * + * @this {DiskPDP11} + * @param {string} mode + * @param {number} nCylinders + * @param {number} nHeads + * @param {number} nSectors (per track) + * @param {number} cbSector + * + * Initializes the disk contents according to the current drive mode and parameters. + */ +DiskPDP11.prototype.create = function(mode, nCylinders, nHeads, nSectors, cbSector) +{ + this.mode = mode; + this.nCylinders = nCylinders; + this.nHeads = nHeads; + this.nSectors = nSectors; + this.cbSector = cbSector; + this.aDiskData = []; + /* + * If the drive is using PRELOAD mode, then it will use the load()/mount() process to initialize the disk contents; + * it wouldn't hurt to let create() do its thing, too, but it's a waste of time. + */ + if (this.mode != DiskAPI.MODE.PRELOAD) { + if (DEBUG && this.messageEnabled()) { + this.printMessage("blank disk for \"" + this.sDiskName + "\": " + this.nCylinders + " cylinders, " + this.nHeads + " head(s)"); + } + var aCylinders = new Array(this.nCylinders); + for (var iCylinder = 0; iCylinder < aCylinders.length; iCylinder++) { + var aHeads = new Array(this.nHeads); + for (var iHead = 0; iHead < aHeads.length; iHead++) { + var aSectors = new Array(this.nSectors); + for (var iSector = 1; iSector <= aSectors.length; iSector++) { + /* + * Now that our read() and write() functions can deal with unallocated data + * arrays, and can read/write the specified pattern on-the-fly, we no longer need + * to pre-allocate and pre-initialize the 'data' array. + */ + aSectors[iSector - 1] = this.initSector(null, iCylinder, iHead, iSector, this.cbSector, 0); + } + aHeads[iHead] = aSectors; + } + aCylinders[iCylinder] = aHeads; + } + this.aDiskData = aCylinders; + } + this.dwChecksum = null; +}; + +/** + * load(sDiskName, sDiskPath, file, fnNotify) + * + * TODO: Figure out how we can strongly type fnNotify, because the Closure Compiler has issues with: + * + * param {function(Component,Object,Disk,string,string)} fnNotify + * + * for: + * + * this.fnNotify.call(this.controller, this.drive, disk, this.sDiskName, this.sDiskPath); + * + * Also, while we're at it, learn if there are ways to: + * + * 1) declare a function taking NO parameters (ie, generate a warning if any parameters are specified) + * 2) declare a type for a function's return value + * + * @this {DiskPDP11} + * @param {string} sDiskName + * @param {string} sDiskPath + * @param {File} [file] is set if there's an associated File object + * @param {function(...)} [fnNotify] + * @param {Component} [controller] + * @return {boolean} true if load completed (successfully or not), false if queued + */ +DiskPDP11.prototype.load = function(sDiskName, sDiskPath, file, fnNotify, controller) +{ + var sDiskURL = sDiskPath; + + /* + * We could use this.log() as well, but it wouldn't display which component initiated the load. + */ + if (DEBUG) { + var sMessage = 'load("' + sDiskName + '","' + sDiskPath + '")'; + this.controller.log(sMessage); + this.printMessage(sMessage); + } + + if (this.fnNotify) { + if (DEBUG) this.controller.log('too many load requests for "' + sDiskName + '" (' + sDiskPath + ')'); + return true; + } + + this.sDiskName = sDiskName; + this.sDiskPath = sDiskPath; + this.sDiskFile = str.getBaseName(sDiskPath); + + var disk = this; + this.fnNotify = fnNotify; + this.controllerNotify = controller || this.controller; + + if (file) { + var reader = new FileReader(); + reader.onload = function() { + disk.build(reader.result, true); + }; + reader.readAsArrayBuffer(file); + return true; + } + + /* + * If there's an occurrence of API_ENDPOINT anywhere in the path, we assume we can use it as-is; + * ie, that the user has already formed a URL of the type we use ourselves for unconverted disk images. + */ + if (sDiskPath.indexOf(DumpAPI.ENDPOINT) < 0) { + /* + * If the selected disk image has a "json" extension, then we assume it's a pre-converted + * JSON-encoded disk image, so we load it as-is; otherwise, we ask our server-side disk image + * converter to return the corresponding JSON-encoded data. + */ + var sDiskExt = str.getExtension(sDiskPath); + if (sDiskExt == DumpAPI.FORMAT.JSON || sDiskExt == DumpAPI.FORMAT.JSON_GZ) { + sDiskURL = encodeURI(sDiskPath); + } else { + var sDiskParm = DumpAPI.QUERY.PATH; + var sSizeParm = '&' + DumpAPI.QUERY.MBHD + "=10"; + /* + * 'mbhd' is a new parm added for hard drive support. In the case of 'file' or 'dir' requests, + * 'mbhd' informs DumpAPI.ENDPOINT that it should create a hard disk image, and one not larger than + * the specified size (eg, 10mb). In fact, until DumpAPI.ENDPOINT is changed to create custom hard + * disk BPBs, you'll always get a standard PC XT 10mb disk image, so if the 'file' or 'dir' contains + * more than 10mb of data, the request will fail. Ultimately, I want to honor the controller's + * driveConfig 'size' parm, or to match the capacity required by the driveConfig 'type' parameter. + * + * If a 'disk' is specified, we pass mbhd=0, because the actual size will depend on the image. + * However, I don't currently have any "dsk" or "img" files containing hard disk images; those formats + * were really intended for floppy disk images. If I never create any hard disk image files, then + * we can simply eliminate sSizeParm in the 'disk' case. + * + * Added more extensions to the list of paths-treated-as-disk-images, so that URLs to files located here: + * + * ftp://ftp.oldskool.org/pub/TOPBENCH/dskimage/ + * + * can be used as-is. TODO: There's a TODO in netlib.getFile() regarding remote support that needs + * to be resolved first; DiskDump relies on that function for its remote requests, and it currently + * supports only HTTP. + */ + if (!sDiskPath.indexOf("http:") || !sDiskPath.indexOf("ftp:") || ["dsk", "ima", "img", "360", "720", "12", "144"].indexOf(sDiskExt) >= 0) { + sDiskParm = DumpAPI.QUERY.DISK; + sSizeParm = '&' + DumpAPI.QUERY.MBHD + "=0"; + } else if (str.endsWith(sDiskPath, '/')) { + sDiskParm = DumpAPI.QUERY.DIR; + } + sDiskURL = web.getHost() + DumpAPI.ENDPOINT + '?' + sDiskParm + '=' + encodeURIComponent(sDiskPath) + (this.fRemovable ? "" : sSizeParm) + "&" + DumpAPI.QUERY.FORMAT + "=" + DumpAPI.FORMAT.JSON; + } + } + return !!web.getResource(sDiskURL, null, true, function(sURL, sResponse, nErrorCode) { + disk.doneLoad(sURL, sResponse, nErrorCode); + }); +}; + +/** + * build(buffer, fModified) + * + * Builds a disk image from an ArrayBuffer (eg, from a FileReader object), rather than from JSON-encoded data. + * + * @this {DiskPDP11} + * @param {?} buffer (we KNOW this is an ArrayBuffer, but we can't seem to convince the Closure Compiler) + * @param {boolean} [fModified] is true if we should mark the entire disk modified (to ensure that we save/restore it) + */ +DiskPDP11.prototype.build = function(buffer, fModified) +{ + var disk; + var cbDiskData = buffer? buffer.byteLength : 0; + var diskFormat = DiskAPI.DISK_FORMATS[cbDiskData]; + + if (diskFormat) { + this.nCylinders = diskFormat[0]; + this.nHeads = diskFormat[1]; + this.nSectors = diskFormat[2]; + this.cbSector = (diskFormat[3] || 512); + + var cdw = this.cbSector >> 2, dwPattern = 0, dwChecksum = 0; + var ib = 0; + var dv = new DataView(buffer, 0, cbDiskData); + + this.aDiskData = new Array(this.nCylinders); + for (var iCylinder = 0; iCylinder < this.aDiskData.length; iCylinder++) { + var cylinder = this.aDiskData[iCylinder] = new Array(this.nHeads); + for (var iHead = 0; iHead < cylinder.length; iHead++) { + var head = cylinder[iHead] = new Array(this.nSectors); + for (var iSector = 0; iSector < head.length; iSector++) { + var sector = this.initSector(null, iCylinder, iHead, iSector + 1, this.cbSector, dwPattern); + var adw = sector['data']; + for (var idw = 0; idw < cdw; idw++, ib += 4) { + var dw = adw[idw] = dv.getInt32(ib, true); + dwChecksum = (dwChecksum + dw) & (0xffffffff|0); + } + if (fModified) sector.cModify = cdw; + head[iSector] = sector; + } + } + } + this.dwChecksum = dwChecksum; + disk = this; + } else { + this.notice("Unrecognized disk format (" + cbDiskData + " bytes)"); + } + + if (this.fnNotify) { + this.fnNotify.call(this.controller, this.drive, disk, this.sDiskName, this.sDiskPath); + this.fnNotify = null; + } +}; + +/** + * doneLoad(sURL, sDiskData, nErrorCode) + * + * This function was originally called mount(). If the mount is successful, we pass the Disk object to the + * caller's fnNotify handler; otherwise, we pass null. + * + * @this {DiskPDP11} + * @param {string} sURL + * @param {string} sDiskData + * @param {number} nErrorCode (response from server if anything other than 200) + */ +DiskPDP11.prototype.doneLoad = function(sURL, sDiskData, nErrorCode) +{ + var disk = null; + this.fWriteProtected = false; + var fPrintOnly = (nErrorCode < 0 && this.cmp && !this.cmp.flags.powered); + + if (nErrorCode) { + /* + * This can happen for innocuous reasons, such as the user switching away too quickly, forcing + * the request to be cancelled. And unfortunately, the browser cancels XMLHttpRequest requests + * BEFORE it notifies any page event handlers, so if the Computer's being powered down, we won't know + * that yet. For now, we rely on the lack of a specific error (nErrorCode < 0), and suppress the + * notify() alert if there's no specific error AND the computer is not powered up yet. + */ + this.controller.notice("Unable to load disk \"" + this.sDiskName + "\" (error " + nErrorCode + ": " + sURL + ")", fPrintOnly); + } else { + if (DEBUG && this.messageEnabled()) { + this.printMessage('doneLoad("' + this.sDiskPath + '")'); + } + + Component.addMachineResource(this.controller.idMachine, sURL, sDiskData); + + try { + /* + * The following code was a hack to turn on write-protection for a disk image if there was + * an initial comment line containing the string "write-protected". However, since comments + * are technically not allowed in JSON, I needed an alternative solution. So, if the basename + * contains the suffix "-readonly", then I'll turn on write-protection for that disk as well. + * + * TODO: Provide some UI for turning write-protection on/off for disks at will, and provide + * an XML-based solution (ie, a per-disk XML configuration option) for controlling it as well. + */ + var sBaseName = str.getBaseName(this.sDiskFile, true).toLowerCase(); + if (sBaseName.indexOf("-readonly") > 0) { + this.fWriteProtected = true; + } else { + var iEOL = sDiskData.indexOf("\n"); + if (iEOL > 0 && iEOL < 1024) { + var sConfig = sDiskData.substring(0, iEOL); + if (sConfig.indexOf("write-protected") > 0) { + this.fWriteProtected = true; + } + } + } + /* + * The most likely source of any exception will be here, where we're parsing the disk data. + */ + var aDiskData; + if (sDiskData.substr(0, 1) == "<") { // if the "data" begins with a "<"... + /* + * Early server configs reported an error (via the nErrorCode parameter) if a disk URL was invalid, + * but more recent server configs now display a somewhat friendlier HTML error page. The downside, + * however, is that the original error has been buried, and we've received "data" that isn't actually + * disk data. + * + * So, if the data we've received appears to be "HTML-like", all we can really do is assume that the + * disk image is missing. And so we pretend we received an error message to that effect. + */ + aDiskData = ["Missing disk image: " + this.sDiskName]; + } else { + /* + * TODO: IE9 is rather unfriendly and restrictive with regard to how much data it's willing to + * eval(). In particular, the 10Mb disk image we use for the Windows 1.01 demo config fails in + * IE9 with an "Out of memory" exception. One work-around would be to chop the data into chunks + * (perhaps one track per chunk, using regular expressions) and then manually re-assemble it. + * + * However, it turns out that using JSON.parse(sDiskData) instead of eval("(" + sDiskData + ")") + * is a much easier fix. The only drawback is that we must first quote any unquoted property names + * and remove any comments, because while eval() was cool with them, JSON.parse() is more particular; + * the following RegExp replacements take care of those requirements. + * + * The use of hex values is something else that eval() was OK with, but JSON.parse() is not, and + * while I've stopped using hex values in DumpAPI responses (at least when "format=json" is specified), + * I can't guarantee they won't show up in "legacy" images, and there's no simple RegExp replacement + * for transforming hex values into decimal values, so I cop out and fall back to eval() if I detect + * any hex prefixes ("0x") in the sequence. Ditto for error messages, which appear like so: + * + * ["unrecognized disk path: test.img"] + */ + if (sDiskData.indexOf("0x") < 0 && sDiskData.substr(0, 2) != "[\"") { + aDiskData = JSON.parse(sDiskData.replace(/([a-z]+):/gm, "\"$1\":").replace(/\/\/[^\n]*/gm, "")); + } else { + aDiskData = eval("(" + sDiskData + ")"); + } + } + + if (!aDiskData.length) { + Component.error("Empty disk image: " + this.sDiskName); + } + else if (aDiskData.length == 1) { + Component.error(aDiskData[0]); + } + /* + * aDiskData is an array of cylinders, each of which is an array of heads, each of which + * is an array of sector objects. The format does not impose any limitations on number of + * cylinders, number of heads, or number of bytes in any of the sector object byte-arrays. + * + * WARNING: All accesses to sector object properties must be via their string names, not their + * "dot" names, otherwise code will break after it's been processed by the Closure Compiler. + * + * Sector object properties include: + * + * 'sector' the sector number (1-based, not required to be sequential) + * 'length' the byte-length (ie, formatted length) of the sector + * 'data' the dword-array containing the sector data + * 'pattern' if the dword-array length is less than 'length'/4, this value must be used + * to pad out the sector; if no 'pattern' is specified, it's assumed to be zero + * + * We still support the older JSON encoding, where sector data was encoded as an array of 'bytes' + * rather than a dword 'data' array. However, our support is strictly limited to an on-the-fly + * conversion to a forward-compatible 'data' array. + */ + else { + if (DEBUG && this.messageEnabled(MessagesPDP11.DISK | MessagesPDP11.LOG)) { + var sCylinders = aDiskData.length + " track" + (aDiskData.length > 1 ? "s" : ""); + var nHeads = aDiskData[0].length; + var sHeads = nHeads + " head" + (nHeads > 1 ? "s" : ""); + var nSectorsPerTrack = aDiskData[0][0].length; + var sSectorsPerTrack = nSectorsPerTrack + " sector" + (nSectorsPerTrack > 1 ? "s" : "") + "/track"; + this.printMessage(sCylinders + ", " + sHeads + ", " + sSectorsPerTrack); + } + /* + * Before the image is usable, we must "normalize" all the sectors. In the past, this meant + * "inflating" them all. However, that's no longer strictly necessary. Mainly, it just means + * setting 'length', 'data', and 'pattern' properties, so that all the sectors are well-defined. + * This includes detecting sector data in older formats (eg, the old array of 'bytes' instead + * of the new 'data' array of dwords) and converting them on-the-fly to the current format. + */ + this.nCylinders = aDiskData.length; + this.nHeads = aDiskData[0].length; + this.nSectors = aDiskData[0][0].length; + var sector = aDiskData[0][0][0]; + this.cbSector = (sector && sector['length']) || 512; + + var dwChecksum = 0; + for (var iCylinder = 0; iCylinder < this.nCylinders; iCylinder++) { + for (var iHead = 0; iHead < this.nHeads; iHead++) { + for (var iSector = 0; iSector < this.nSectors; iSector++) { + sector = aDiskData[iCylinder][iHead][iSector]; + if (!sector) continue; // non-standard (eg, XDF) disk images may have "unused" (null) sectors + var length = sector['length']; + if (length === undefined) { // provide backward-compatibility with older JSON... + length = sector['length'] = 512; + } + length >>= 2; // convert length from a byte-length to a dword-length + var dwPattern = sector['pattern']; + if (dwPattern === undefined) { + dwPattern = sector['pattern'] = 0; + } + var adw = sector['data']; + if (adw === undefined) { + var ab = sector['bytes']; + if (ab === undefined || !ab.length) { + /* + * It would be odd if there was neither a 'bytes' nor 'data' array; I'm just + * being paranoid. It's more likely that the 'bytes' array is simply empty, + * in which case we need only create an empty 'data' array and turn the byte + * pattern, if any, into a dword pattern. + */ + adw = []; + this.assert((dwPattern & 0xff) == dwPattern); + dwPattern = sector['pattern'] = (dwPattern | (dwPattern << 8) | (dwPattern << 16) | (dwPattern << 24)); + sector['data'] = adw; + } else { + /* + * To keep the conversion code simple, we'll do any necessary pattern-filling first, + * to fully "inflate" the sector, eliminating the possibility of partial dwords and + * saving any code downstream from dealing with byte-size patterns. + */ + var cb = length << 2; + for (var ib = ab.length; ib < cb; ib++) { + ab[ib] = dwPattern; // the pattern for byte-arrays was only a byte + } + this.fill(sector, ab, 0); + } + delete sector['bytes']; + } + this.initSector(sector, iCylinder, iHead); + /* + * For the disk as a whole, we maintain a checksum of the original unmodified data: + * + * dwChecksum: summation of all dwords in all non-empty sectors + * + * Pattern-filling of sectors is deferred until absolutely necessary (eg, when a sector is + * being written). So all we need to do at this point is checksum all the initial sector data. + */ + for (var idw = 0; idw < adw.length; idw++) { + dwChecksum = (dwChecksum + adw[idw]) & (0xffffffff|0); + } + } + } + } + this.aDiskData = aDiskData; + this.dwChecksum = dwChecksum; + disk = this; + } + } catch (e) { + Component.error("Disk image error (" + sURL + "): " + e.message); + } + } + + if (this.fnNotify) { + this.fnNotify.call(this.controllerNotify, this.drive, disk, this.sDiskName, this.sDiskPath); + this.fnNotify = null; + } +}; + +/** + * getSectorString(sector, off, len) + * + * WARNING: This function is restricted to reading a string contained ENTIRELY within the specified sector. + * + * @this {DiskPDP11} + * @param {Object} sector + * @param {number} off (byte offset) + * @param {number} len (use -1 to read a null-terminated string) + * @return {string} + */ +DiskPDP11.prototype.getSectorString = function(sector, off, len) +{ + var s = ""; + while (len--) { + var b = this.read(sector, off++); + if (b <= 0) break; + s += String.fromCharCode(b); + } + return s; +}; + +/** + * initSector(sector, iCylinder, iHead, iSector, cbSector, dwPattern) + * + * Ensures every sector has ALL the properties of a proper Sector object; ie: + * + * 'sector': sector number + * 'length': size of the sector, in bytes + * 'data': array of dwords + * 'pattern': dword pattern to use for empty or partial sectors + * + * In addition, we will maintain the following information on a per-sector basis, + * as sectors are modified: + * + * iModify: index of first modified dword in sector + * cModify: number of modified dwords in sector + * fDirty: true if sector is dirty, false if clean (or cleaning in progress) + * + * @this {DiskPDP11} + * @param {Object} sector + * @param {number} iCylinder + * @param {number} iHead + * @param {number} [iSector] + * @param {number} [cbSector] + * @param {number|null} [dwPattern] + * @return {Object} + */ +DiskPDP11.prototype.initSector = function(sector, iCylinder, iHead, iSector, cbSector, dwPattern) +{ + if (!sector) { + sector = {'sector': iSector, 'length': cbSector, 'data': [], 'pattern': dwPattern}; + } + sector.iCylinder = iCylinder; + sector.iHead = iHead; + sector.iModify = sector.cModify = 0; + sector.fDirty = false; + return sector; +}; + +/** + * info() + * + * @this {DiskPDP11} + * @return {Array} containing: [nCylinders, nHeads, nSectorsPerTrack, nBytesPerSector] + */ +DiskPDP11.prototype.info = function() +{ + if (!this.aDiskData.length) { + return [0, 0, 0, 0]; + } + return [this.aDiskData.length, this.aDiskData[0].length, this.aDiskData[0][0].length, this.aDiskData[0][0][0]['length']]; +}; + +/** + * seek(iCylinder, iHead, iSector, fWrite, done) + * + * TODO: There's some dodgy code in seek() that allows floppy images to be dynamically + * reconfigured with more heads and/or sectors/track, and it does so by peeking at more drive + * properties. That code used to be in the FDC component, where it was perfectly reasonable + * to access those properties. We need a cleaner interface back to the drive, similar to the + * info() interface we provide to the controller. + * + * Whether or not the "dynamic reconfiguration" feature itself is perfectly reasonable is, + * of course, a separate question. + * + * @this {DiskPDP11} + * @param {number} iCylinder + * @param {number} iHead + * @param {number} iSector + * @param {boolean} [fWrite] + * @param {function(Object,boolean)} [done] + * @return {Object|null} is the requested sector, or null if not found (or not available yet) + */ +DiskPDP11.prototype.seek = function(iCylinder, iHead, iSector, fWrite, done) +{ + var sector = null; + var drive = this.drive; + var cylinder = this.aDiskData[iCylinder]; + if (cylinder) { + var i; + var track = cylinder[iHead]; + /* + * The following code allows a single-sided diskette image to be reformatted (ie, "expanded") + * as a double-sided image, provided the drive has more than one head (see drive.nHeads). + */ + if (!track && drive.bFormatting && iHead < drive.nHeads) { + track = cylinder[iHead] = new Array(drive.bSectorEnd); + for (i = 0; i < track.length; i++) { + track[i] = this.initSector(null, iCylinder, iHead, i + 1, drive.nBytes, 0); + } + } + if (track) { + for (i = 0; i < track.length; i++) { + if (track[i] && track[i]['sector'] == iSector) { + /* + * If the sector's pattern is null, then this sector's true contents have not yet + * been fetched from the server. + */ + sector = track[i]; + break; + } + } + /* + * The following code allows an 8-sector track to be reformatted (ie, "expanded") as a 9-sector track. + */ + if (!sector && drive.bFormatting && drive.bSector == 9) { + sector = track[i] = this.initSector(null, iCylinder, iHead, drive.bSector, drive.nBytes, 0); + } + } + } + if (done) done(sector, false); + return sector; +}; + +/** + * fill(sector, ab, off) + * + * @this {DiskPDP11} + * @param {Object} sector + * @param {*} ab (technically, this should be typed as Array. but I'm having trouble coercing JSON.parse() to that) + * @param {number} off + */ +DiskPDP11.prototype.fill = function(sector, ab, off) +{ + var cdw = sector['length'] >> 2; + var adw = new Array(cdw); + for (var idw = 0; idw < cdw; idw++) { + adw[idw] = ab[off] | (ab[off + 1] << 8) | (ab[off + 2] << 16) | (ab[off + 3] << 24); + off += 4; + } + sector['data'] = adw; + /* + * TODO: Consider taking this opportunity to shrink 'data' down by the number of dwords at the end of the buffer that + * contain the same pattern, and setting 'pattern' accordingly. + */ +}; + +/** + * toBytes(sector) + * + * @this {DiskPDP11} + * @param {Object} sector + * @return {Array.} is an array of bytes + */ +DiskPDP11.prototype.toBytes = function(sector) +{ + var cb = sector['length']; + var ab = new Array(cb); + var ib = 0; + var cdw = cb >> 2; + var adw = sector['data']; + var dwPattern = sector['pattern']; + for (var idw = 0; idw < cdw; idw++) { + var dw = (idw < adw.length? adw[idw] : dwPattern); + ab[ib++] = dw & 0xff; + ab[ib++] = (dw >> 8) & 0xff; + ab[ib++] = (dw >> 16) & 0xff; + ab[ib++] = (dw >> 24) & 0xff; + } + return ab; +}; + +/** + * read(sector, ibSector, fCompare) + * + * @this {DiskPDP11} + * @param {Object} sector (returned from a previous seek) + * @param {number} ibSector a byte index within the given sector + * @param {boolean} [fCompare] is true if this write-compare read + * @return {number} the specified (unsigned) byte, or -1 if no more data in the sector + */ +DiskPDP11.prototype.read = function(sector, ibSector, fCompare) +{ + var b = -1; + if (sector) { + if (DEBUG && !ibSector && !fCompare && this.messageEnabled()) { + this.printMessage('read("' + this.sDiskFile + '",CHS=' + sector.iCylinder + ':' + sector.iHead + ':' + sector['sector'] + ')'); + } + if (ibSector < sector['length']) { + var adw = sector['data']; + var idw = ibSector >> 2; + var dw = (idw < adw.length ? adw[idw] : sector['pattern']); + b = ((dw >> ((ibSector & 0x3) << 3)) & 0xff); + } + } + return b; +}; + +/** + * write(sector, ibSector, b) + * + * @this {DiskPDP11} + * @param {Object} sector (returned from a previous seek) + * @param {number} ibSector a byte index within the given sector + * @param {number} b the byte value to write + * @return {boolean|null} true if write successful, false if write-protected, null if out of bounds + */ +DiskPDP11.prototype.write = function(sector, ibSector, b) +{ + if (this.fWriteProtected) + return false; + + if (DEBUG && !ibSector && this.messageEnabled()) { + this.printMessage('write("' + this.sDiskFile + '",CHS=' + sector.iCylinder + ':' + sector.iHead + ':' + sector['sector'] + ')'); + } + + if (ibSector < sector['length']) { + if (b != this.read(sector, ibSector, true)) { + var adw = sector['data']; + var dwPattern = sector['pattern']; + var idw = ibSector >> 2; + var nShift = (ibSector & 0x3) << 3; + + /* + * Ensure every byte up to the specified byte is properly initialized. + */ + for (var i = adw.length; i <= idw; i++) adw[i] = dwPattern; + + if (!sector.cModify) { + sector.iModify = idw; + sector.cModify = 1; + } else if (idw < sector.iModify) { + sector.cModify += sector.iModify - idw; + sector.iModify = idw; + } else if (idw >= sector.iModify + sector.cModify) { + sector.cModify += idw - (sector.iModify + sector.cModify) + 1; + } + adw[idw] = (adw[idw] & ~(0xff << nShift)) | (b << nShift); + } + return true; + } + return null; +}; + +/** + * getSector(pba) + * + * @this {DiskPDP11} + * @param {number} pba (physical block address) + * @return {Object|null} sector + */ +DiskPDP11.prototype.getSector = function(pba) +{ + var nSectorsPerCylinder = this.nHeads * this.nSectors; + var iCylinder = (pba / nSectorsPerCylinder) | 0; + if (iCylinder < this.nCylinders) { + var nSectorsRemaining = (pba % nSectorsPerCylinder); + var iHead = (nSectorsRemaining / this.nSectors) | 0; + /* + * PBA numbers are 0-based, but the sector numbers in CHS addressing are 1-based, so add one to iSector + */ + var iSector = (nSectorsRemaining % this.nSectors) + 1; + return this.seek(iCylinder, iHead, iSector); + } + return null; +}; + +/** + * getSectorData(sector, off, len) + * + * WARNING: This function is restricted to reading data contained ENTIRELY within the specified sector. + * + * NOTE: Yes, this function is not the most efficient way to read a byte/word/dword value from within a sector, + * but given the different states a sector may be in, it's certainly the simplest and safest, and since this is + * only used by buildFileTable() and its progeny, it's not clear that we need to be superfast anyway. + * + * @this {DiskPDP11} + * @param {Object} sector + * @param {number} off (byte offset) + * @param {number} len (1 to 4 bytes) + * @return {number} + */ +DiskPDP11.prototype.getSectorData = function(sector, off, len) +{ + var dw = 0; + var nShift = 0; + this.assert(len > 0 && len <= 4); + while (len--) { + this.assert(off < sector['length']); + var b = this.read(sector, off++); + this.assert(b >= 0); + if (b < 0) break; + dw |= (b << nShift); + nShift += 8; + } + return dw; +}; + +/** + * encodeAsBase64() + * + * @this {DiskPDP11} + * @return {string} + */ +DiskPDP11.prototype.encodeAsBase64 = function() +{ + /* + * Gross, but simple; more importantly, it works -- at least for disks of typical floppy magnitude. + */ + var s = "", pba = 0, sector; + while ((sector = this.getSector(pba++))) { + for (var off = 0, len = sector['length']; off < len; off++) { + s += String.fromCharCode(this.getSectorData(sector, off, 1)); + } + } + return btoa(s); +}; + +/** + * save() + * + * The first array entry contains some disk information: + * + * [sDiskPath, dwChecksum, nCylinders, nHeads, nSectors, cbSector] + * + * Each subsequent entry in the returned array contains the following: + * + * [iCylinder, iHead, iSector, iModify, [...]] + * + * where [...] is an array of modified dword(s) in the corresponding sector. + * + * @this {DiskPDP11} + * @return {Array} of modified sectors + */ +DiskPDP11.prototype.save = function() +{ + var i = 0; + var deltas = []; + deltas[i++] = [this.sDiskPath, this.dwChecksum, this.nCylinders, this.nHeads, this.nSectors, this.cbSector]; + if (!this.fWriteProtected) { + var aDiskData = this.aDiskData; + for (var iCylinder = 0; iCylinder < aDiskData.length; iCylinder++) { + for (var iHead = 0; iHead < aDiskData[iCylinder].length; iHead++) { + for (var iSector = 0; iSector < aDiskData[iCylinder][iHead].length; iSector++) { + var sector = aDiskData[iCylinder][iHead][iSector]; + if (sector && sector.cModify) { + var mods = [], n = 0; + var iModify = sector.iModify, iModifyLimit = sector.iModify + sector.cModify; + while (iModify < iModifyLimit) { + mods[n++] = sector['data'][iModify++]; + } + deltas[i++] = [iCylinder, iHead, iSector, sector.iModify, mods]; + } + } + } + } + } + if (DEBUG && this.messageEnabled()) { + this.printMessage('save("' + this.sDiskName + '"): saved ' + (deltas.length - 1) + ' change(s)'); + } + return deltas; +}; + +/** + * restore(deltas) + * + * The first array entry contains some disk information: + * + * [sDiskPath, dwChecksum, nCylinders, nHeads, nSectors, cbSector] + * + * Each subsequent entry in the supplied array contains the following: + * + * [iCylinder, iHead, iSector, iModify, [...]] + * + * where [...] is an array of modified dword(s) in the corresponding sector. + * + * @this {DiskPDP11} + * @param {Array} deltas + * @return {number} 0 if no changes applied, -1 if an error occurred, otherwise the number of sectors modified + */ +DiskPDP11.prototype.restore = function(deltas) +{ + /* + * If deltas is undefined, that's not necessarily an error; the controller may simply be (re)initializing + * itself (although neither controller should be calling restore() under those conditions anymore). + */ + var nChanges = 0; + var sReason = "unsupported restore format"; + /* + * I originally added a check for aDiskData here on the assumption that if there was an error loading + * a disk image, we will have already notified the user, so any additional errors about differing checksums, + * failure to restore the disk state, etc, would just be annoying. HOWEVER, HDC will create an empty disk + * image if its initialization code discovers that no disk was loaded earlier (see verifyDrive). So while + * checking aDiskData is still a good idea, be aware that it won't necessarily avoid redundant error messages + * (at least in the case of HDC). + */ + if (deltas && deltas.length > 0) { + + var i = 0; + var aDiskInfo = deltas[i++]; + + if (aDiskInfo && aDiskInfo.length >= 2) { + /* + * Before getting to the checksum, we have to deal with a new situation: restoring an uninitialized + * disk image from a complete set of deltas. And that is only possible if the disk was saved with the + * original disk geometry. + */ + if (!this.aDiskData.length && aDiskInfo.length >= 6) { + this.create(DiskAPI.MODE.LOCAL, aDiskInfo[2], aDiskInfo[3], aDiskInfo[4], aDiskInfo[5]); + /* + * TODO: Consider setting a flag here that we can check at the end of the restore() function + * that indicates we should recalculate dwChecksum, because we currently have an inconsistency + * between local disks that are mounted via build() and the same disks that are "remounted" + * later by this code; the former has the correct checksum, while the latter has a null checksum. + * + * As you can see below, we currently deal with this by simply ignoring null checksums.... + */ + } + /* + * v1.01 failed to indicate an error if either one of these failure conditions occurred. Although maybe that's + * just as well, since v1.01 also failed to properly deal with situations where the user mounted different diskette(s) + * prior to exiting (hopefully fixed in v1.02). + */ + else if (aDiskInfo[1] != null && this.dwChecksum != null && aDiskInfo[1] != this.dwChecksum) { + sReason = "original checksum (" + aDiskInfo[1] + ") differs from current checksum (" + this.dwChecksum + ")"; + nChanges = -2; + } + /* + * Checksum is more important than disk path, and for now, I want the flexibility to move disk images. + * + else if (aDiskInfo[0] != this.sDiskPath) { + sReason = "original path '" + aDiskInfo[0] + "' differs from current path '" + this.sDiskPath + "'"; + nChanges = -1; + } + */ + } + + if (!this.aDiskData.length) nChanges = -1; + + while (i < deltas.length && nChanges >= 0) { + var m = 0; + var mod = deltas[i++]; + var iCylinder = mod[m++]; + var iHead = mod[m++]; + var iSector = mod[m++]; + /* + * Note the buried test for write-protection. Yes, an invariant condition should be tested + * outside the loop, not inside, but (a) it's a trivial test, (b) the test should never fail + * because save() should never generate any mods for a write-protected disk, and (c) it + * centralizes all the failure conditions we're currently checking (which, admittedly, ain't much). + */ + if (iCylinder >= this.aDiskData.length || iHead >= this.aDiskData[iCylinder].length || iSector >= this.aDiskData[iCylinder][iHead].length) { + sReason = "sector (CHS=" + iCylinder + ':' + iHead + ':' + iSector + ") out of range (" + nChanges + " changes applied)"; + nChanges = -1; + break; + } + if (this.fWriteProtected) { + sReason = "unable to modify write-protected disk"; + nChanges = -1; + break; + } + var iModify = mod[m++]; + var mods = mod[m++]; + var iModifyLimit = iModify + mods.length; + var sector = this.aDiskData[iCylinder][iHead][iSector]; + if (!sector) continue; + /* + * Since write() now deals with empty/partial sectors, we no longer need to completely "inflate" + * the sector prior to applying modifications. So let's just make sure that the sector is "inflated" + * up to iModify. + */ + var idw = sector['data'].length; + while (idw < iModify) { + sector['data'][idw++] = sector['pattern']; + } + var n = 0; + sector.iModify = iModify; + sector.cModify = mods.length; + while (iModify < iModifyLimit) { + sector['data'][iModify++] = mods[n++]; + } + nChanges++; + } + } + + if (nChanges < 0) { + /* + * We're suppressing checksum messages for the general public for now.... + */ + if (DEBUG || nChanges != -2) { + this.controller.notice("Unable to restore disk '" + this.sDiskName + ": " + sReason); + } + } else { + if (DEBUG && this.messageEnabled()) { + this.printMessage('restore("' + this.sDiskName + '"): restored ' + nChanges + ' change(s)'); + } + } + return nChanges; +}; + +/** + * toJSON() + * + * We perform some RegExp massaging on the JSON data to eliminate unnecessary properties + * (eg, 'length' values of 512, 'pattern' values of 0, since those are defaults). + * + * In addition, we first check every sector to see if it can be "deflated". Sectors that were + * initially "deflated" should remain that way unless/until they were modified, so technically, + * we could call deflateSector() just for modified sectors, but this isn't a common operation, + * so it doesn't hurt to check every sector. + * + * @this {DiskPDP11} + * @return {string} containing the entire disk image as JSON-encoded data + */ +DiskPDP11.prototype.toJSON = function() +{ + var s, pba = 0, sector, sectorLast; + + while ((sector = this.getSector(pba++))) { + this.deflateSector(sector); + } + + s = JSON.stringify(this.aDiskData, function(key, value) { + /* + * If BACKTRACK support is enabled, we have to filter out any 'file' properties that may + * be attached to the sector objects, lest we risk blowing the stack due to circular references. + */ + if (key == 'file') { + return undefined; + } + return value; + }); + + /* + * Eliminate unnecessary default properties (eg, 'length' values of 512, 'pattern' values of 0). + */ + s = s.replace(/,"length":512/gm, "").replace(/,"pattern":0/gm, ""); + + /* + * I don't really want to strip quotes from disk image property names, since I would have to put them + * back again during mount() -- or whenever JSON.parse() is used instead of eval(). But I still remove + * them temporarily, so that any remaining property names (eg, "iModify", "cModify", "fDirty") can + * easily be stripped out, by virtue of their being the only quoted properties left. We then "requote" + * all the property names that remain. + */ + s = s.replace(/"(sector|length|data|pattern)":/gm, "$1:"); + + /* + * The next line will remove any other numeric or boolean properties that were added at runtime, although + * they may have completely different ("minified") names if the code has been compiled. + */ + s = s.replace(/,"[^"]*":([0-9]+|true|false)/gm, ""); + s = s.replace(/(sector|length|data|pattern):/gm, "\"$1\":"); + + /* + * Last but not least, insert line breaks after every object definition, to ease the pain on text editors. + */ + s = s.replace(/([\]}]),/gm, "$1,\n"); + return s; +}; + +/** + * deflateSector(sector) + * + * This is just the first revision: it currently looks only at fully inflated sectors. + * + * @this {DiskPDP11} + * @param {Object} sector + */ +DiskPDP11.prototype.deflateSector = function(sector) +{ + var adw = sector['data']; + var cdw = adw.length; + if ((cdw << 2) == sector['length']) { + var idw = cdw - 1; + var dwPattern = adw[idw], cDupes = 0; + while (idw--) { + if (adw[idw] !== dwPattern) break; + cDupes++; + } + if (cDupes++) { + adw.length = cdw - cDupes; + sector['pattern'] = dwPattern; + } + } +}; + +/** + * dumpSector(sector, pba, sDesc) + * + * @this {DiskPDP11} + * @param {Object} sector (returned from a previous seek) + * @param {number} [pba] + * @param {string} [sDesc] + * @return {string} + */ +DiskPDP11.prototype.dumpSector = function(sector, pba, sDesc) +{ + var sDump = ""; + if (DEBUG && sector) { + if (pba != null) sDump += "sector " + pba + (sDesc? (" for " + sDesc) : "") + ':'; + var sBytes = "", sChars = ""; + var cbSector = sector['length']; + var cdwData = sector['data'].length; + var dw = 0; + for (var i = 0; i < cbSector; i++) { + if ((i % 16) === 0) { + if (sDump) sDump += sBytes + ' ' + sChars + '\n'; + sDump += str.toHex(i, 4) + ": "; + sBytes = sChars = ""; + } + if ((i % 4) === 0) { + var idw = i >> 2; + dw = (idw < cdwData? sector['data'][idw] : sector['pattern']); + } + var b = dw & 0xff; + dw >>>= 8; + sBytes += str.toHex(b, 2) + (i % 16 == 7? "-" : " "); + sChars += (b >= 32 && b < 128? String.fromCharCode(b) : "."); + } + if (sBytes) sDump += sBytes + ' ' + sChars; + } + return sDump; +}; + +if (NODE) module.exports = Disk; diff --git a/modules/pdp11/lib/rk11.js b/modules/pdp11/lib/rk11.js deleted file mode 100644 index 443e81eed..000000000 --- a/modules/pdp11/lib/rk11.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * @fileoverview Implements RK11 device support. - * @author Jeff Parsons - * @copyright © Jeff Parsons 2012-2016 - * - * 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. - * - * 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 web = require("../../shared/lib/weblib"); - var Component = require("../../shared/lib/component"); - var State = require("../../shared/lib/state"); - var BusPDP11 = require("./bus"); -} - -/** - * RK11(parmsDevice) - * - * @constructor - * @extends Component - * @param {Object} parmsRK11 - */ -function RK11(parmsRK11) -{ - Component.call(this, "RK11", parmsRK11, RK11); - - this.rkds = 0x9C0;/*04700*/ // 017777400 Drive Status - this.rker = 0; // 017777402 Error Register - this.rkcs = 0x80; /*0200*/ // 017777404 Control Status - this.rkwc = 0; // 017777406 Word Count - this.rkba = 0; // 017777410 Bus Address - this.rkda = 0; // 017777412 Disk Address - this.rkdb = 0; // 017777416 Data Buffer - this.meta = []; - this.TRACKS = [406, 406, 406, 406]; - this.SECTORS = [12, 12, 12, 12]; -} - -Component.subclass(RK11); - -/** - * initBus(cmp, bus, cpu, dbg) - * - * @this {DevicePDP11} - * @param {ComputerPDP11} cmp - * @param {BusPDP11} bus - * @param {CPUStatePDP11} cpu - * @param {DebuggerPDP11} dbg - */ -RK11.prototype.initBus = function(cmp, bus, cpu, dbg) -{ - this.bus = bus; - this.cpu = cpu; - this.dbg = dbg; - - this.setReady(); -}; - -if (NODE) module.exports = RK11; diff --git a/modules/pdp11/lib/rl11.js b/modules/pdp11/lib/rl11.js new file mode 100644 index 000000000..541201326 --- /dev/null +++ b/modules/pdp11/lib/rl11.js @@ -0,0 +1,868 @@ +/** + * @fileoverview Implements the RL11 Disk Controller (for RL01 and RL02 Disks) + * @author Jeff Parsons + * @copyright © Jeff Parsons 2012-2016 + * + * 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/lib/strlib"); + var web = require("../../shared/lib/weblib"); + var DiskAPI = require("../../shared/lib/diskapi"); + var Component = require("../../shared/lib/component"); + var State = require("../../shared/lib/state"); + var PDP11 = require("./defines"); + var MessagesPDP11 = require("./messages"); + var DiskPDP11 = require("./disk"); +} + +/** + * RL11(parms) + * + * The RL11 component has the following component-specific (parms) properties: + * + * autoMount: one or more JSON-encoded objects, each containing 'name' and 'path' properties + * + * @constructor + * @extends Component + * @param {Object} parms + */ +function RL11(parms) +{ + Component.call(this, "RL11", parms, RL11, MessagesPDP11.DISK); + + /* + * We record any 'autoMount' object now, but we no longer parse it until initBus(), because the + * Computer's getMachineParm() service may have an override for us. + */ + this.configMount = parms['autoMount'] || null; + this.cAutoMount = 0; + + /* + * TODO: Make this configurable + */ + this.nDrives = 1; + this.aDrives = new Array(this.nDrives); + + this.fLocalDisks = (!web.isMobile() && window && 'FileReader' in window); +} + +Component.subclass(RL11); + +/* + * There's nothing super special about these values, except that NONE should be falsey and the others should not. + */ +RL11.SOURCE = { + NONE: "", + LOCAL: "?", + REMOTE: "??" +}; + +/** + * 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 + */ +RL11.prototype.setBinding = function(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.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 "loadDrive": + this.bindings[sBinding] = control; + + control.onclick = function onClickLoadDrive(event) { + var controlDisks = rl11.bindings["listDisks"]; + if (controlDisks) { + var sDiskName = controlDisks.options[controlDisks.selectedIndex].text; + var sDiskPath = controlDisks.value; + rl11.loadSelectedDrive(sDiskName, sDiskPath); + } + }; + return true; + + case "saveDrive": + /* + * 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")); + web.alertUser(sAlert); + } else { + rl11.notice("No disk loaded in drive."); + } + } else { + rl11.notice("No disk drive selected."); + } + } + }; + return true; + + case "mountDrive": + 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 + */ +RL11.prototype.initBus = function(cmp, bus, cpu, dbg) +{ + this.cmp = cmp; + this.bus = bus; + this.cpu = cpu; + this.dbg = dbg; + + this.configMount = this.cmp.getMachineParm('autoMount') || this.configMount; + + if (this.configMount) { + if (typeof this.configMount == "string") { + try { + /* + * The most likely source of any exception will be right here, where we're parsing + * this JSON-encoded data. + */ + this.configMount = eval("(" + this.configMount + ")"); + } catch (e) { + Component.error("RL11 auto-mount error: " + e.message + " (" + this.configMount + ")"); + this.configMount = null; + } + } + } + + this.triggerReaderInterrupt = this.cpu.addTrigger(PDP11.RL11.VEC, PDP11.RL11.PRI); + + bus.addIOTable(this, RL11.UNIBUS_IOTABLE); + + 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} + */ +RL11.prototype.getDriveName = function(iDrive) +{ + return "RL" + iDrive; +}; + +/** + * powerUp(data, fRepower) + * + * @this {RL11} + * @param {Object|null} data + * @param {boolean} [fRepower] + * @return {boolean} true if successful, false if failure + */ +RL11.prototype.powerUp = function(data, fRepower) +{ + 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; + /* + * TODO: This conversion of drive number to drive letter, starting with A:, is very simplistic + * and will NOT match the drive mappings that DOS ultimately uses. We'll need to spiff this up at + * some point. + */ + controlOption.text = this.getDriveName(iDrive); + controlDrives.appendChild(controlOption); + } + if (this.nDrives > 0) { + controlDrives.value = "0"; + this.displayDisk(0); + } + } + } + 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 + */ +RL11.prototype.powerDown = function(fSave, fShutdown) +{ + return fSave? this.save() : true; +}; + +/** + * reset() + * + * @this {RL11} + */ +RL11.prototype.reset = function() +{ + this.initController(); +}; + +/** + * save() + * + * This implements save support for the RL11 component. + * + * @this {RL11} + * @return {Object} + */ +RL11.prototype.save = function() +{ + 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 + */ +RL11.prototype.restore = function(data) +{ + return true; // this.initController(data[0]); +}; + +/** + * initController(data) + * + * @this {RL11} + * @param {Array} [data] + * @return {boolean} true if successful, false if failure + */ +RL11.prototype.initController = function(data) +{ + 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 true; +}; + +/** + * saveController() + * + * @this {RL11} + * @return {Array} + */ +RL11.prototype.saveController = function() +{ + var data = []; + return data; +}; + +/** + * 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 + */ +RL11.prototype.initDrive = function(drive, iDrive, data) +{ + var i = 0; + var fSuccess = true; + + drive.iDrive = iDrive; + drive.fBusy = drive.fLocal = false; + + drive.name = this.idComponent; + 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.bCylinderSeek = 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 + } + + return fSuccess; +}; + +/** + * 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 + */ +RL11.prototype.autoMount = function(fRemount) +{ + if (!fRemount) this.cAutoMount = 0; + if (this.configMount) { + 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) { + /* + * WARNING: This conversion of drive letter to drive number, starting with A:, is very simplistic + * and is not guaranteed to match the drive mapping that DOS ultimately uses. + */ + var iDrive = sDrive.charCodeAt(0) - 0x41; + 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 + */ +RL11.prototype.loadSelectedDrive = function(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); +}; + +/** + * 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 + */ +RL11.prototype.loadDrive = function(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.doneLoadDrive)) { + nResult++; + } + } + } + return nResult; +}; + +/** + * doneLoadDrive(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] + */ +RL11.prototype.doneLoadDrive = function onLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount) +{ + var aDiskInfo; + + drive.fBusy = false; + + if (disk) { + /* + * We shouldn't mount the disk unless we're sure the drive is able to handle it. + */ + aDiskInfo = disk.info(); + if (disk && aDiskInfo[0] > drive.nCylinders || aDiskInfo[1] > drive.nHeads /* || aDiskInfo[2] > 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. + * + * WARNING: This conversion of drive number to drive letter, starting with A:, is very simplistic + * and will not match the drive mappings that DOS ultimately uses (ie, for drives beyond B:). + */ + this.notice("Mounted 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) + */ +RL11.prototype.addDisk = function(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} + */ +RL11.prototype.findDisk = function(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 {RL11} + * @param {number} iDrive (unvalidated) + * @param {boolean} [fUpdateDrive] is true to update the drive list to match the specified drive (eg, the auto-mount case) + */ +RL11.prototype.displayDisk = function(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? 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; + } + 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 {RL11} + * @param {number} iDrive + * @param {boolean} [fLoading] + */ +RL11.prototype.unloadDrive = function(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; + + /* + * WARNING: This conversion of drive number to drive letter, starting with A:, is very simplistic + * and is not guaranteed to match the drive mapping that DOS ultimately uses. + */ + 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 + */ +RL11.prototype.unloadAllDrives = function(fDiscard) +{ + // if (fDiscard) this.aDiskHistory = []; + + for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) { + this.unloadDrive(iDrive, true); + } +}; + +/* + * ES6 ALERT: As you can see below, I've finally started using computed property names. + */ +RL11.UNIBUS_IOTABLE = { +}; + +if (NODE) module.exports = RL11; diff --git a/modules/shared/lib/diskapi.js b/modules/shared/lib/diskapi.js index 1dead2e19..e42cf05a9 100644 --- a/modules/shared/lib/diskapi.js +++ b/modules/shared/lib/diskapi.js @@ -70,8 +70,16 @@ var DiskAPI = { /* * Common (supported) diskette formats + * + * For no particular reason that I can recall, each entry in DISK_FORMATS is an array of values in "CHS" order: + * + * [# cylinders, # heads, # sectors/track, # bytes/sector] + * + * If the 4th value is omitted, the sector size is assumed to be 512. The order of these "geometric" values mirrors + * the structure of our JSON-encoded disk images, which consist of an array of cylinders, each of which is an array of + * heads, each of which is an array of sector objects. */ -DiskAPI.DISKETTE_FORMATS = { +DiskAPI.DISK_FORMATS = { 163840: [40,1,8], // media type 0xFE: 40 cylinders, 1 head (single-sided), 8 sectors/track, ( 320 total sectors x 512 bytes/sector == 163840) 184320: [40,1,9], // media type 0xFC: 40 cylinders, 1 head (single-sided), 9 sectors/track, ( 360 total sectors x 512 bytes/sector == 184320) 327680: [40,2,8], // media type 0xFF: 40 cylinders, 2 heads (double-sided), 8 sectors/track, ( 640 total sectors x 512 bytes/sector == 327680) @@ -83,7 +91,22 @@ DiskAPI.DISKETTE_FORMATS = { /* * The following are common early hard drive sizes, which we explicitly map to CHS values, since the BPB can mislead us when attempting to calculate total cylinders */ - 21368320:[615,4,17] // PC AT 20Mb hard drive (type 2) + 21368320:[615,4,17], // PC AT 20Mb hard drive (type 2) + /* + * Assorted DEC disk pack formats. + */ + 5242880: [256,2,40,256], // RL01K single-platter disk cartridge: 256 tracks, 2 heads, 40 sectors/track, 256 bytes/sector, for a total of 5242880 bytes + 10485760:[512,2,40,256] // RL02K single-platter disk cartridge: 512 tracks, 2 heads, 40 sectors/track, 256 bytes/sector, for a total of 10485760 bytes +}; + +/* + * TODO: Eventually, our tools will need to support looking up disk formats by "model" rather than by raw disk size, + * because obviously multiple disk geometries can yield the same raw disk size. For each conflict that arises, I'll + * probably create a fake (approximate) disk size entry above, and then create a mapping to that approximate size below. + */ +DiskAPI.DISK_MODELS = { + "RL01": 5242880, + "RL02": 10485760 }; DiskAPI.MBR = { diff --git a/package.json b/package.json index 0eec26c5f..1d8ecc4e3 100644 --- a/package.json +++ b/package.json @@ -176,6 +176,7 @@ ], "pdp11Files": [ "./modules/shared/lib/defines.js", + "./modules/shared/lib/diskapi.js", "./modules/shared/lib/dumpapi.js", "./modules/shared/lib/reportapi.js", "./modules/shared/lib/userapi.js", @@ -198,6 +199,8 @@ "./modules/pdp11/lib/keyboard.js", "./modules/pdp11/lib/serialport.js", "./modules/pdp11/lib/pc11.js", + "./modules/pdp11/lib/disk.js", + "./modules/pdp11/lib/rl11.js", "./modules/shared/lib/debugger.js", "./modules/pdp11/lib/debugger.js", "./modules/pdp11/lib/computer.js", diff --git a/versions/pcx86/1.30.2/pcx86-dbg.js b/versions/pcx86/1.30.2/pcx86-dbg.js index 98816b5d4..7b88797de 100644 --- a/versions/pcx86/1.30.2/pcx86-dbg.js +++ b/versions/pcx86/1.30.2/pcx86-dbg.js @@ -43,9 +43,9 @@ http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016 http://pcjs.org/modules/shared/lib/save.js (C) Jeff Parsons 2012-2016 */ -var l,aa,ba={163840:[40,1,8],184320:[40,1,9],327680:[40,2,8],368640:[40,2,9],737280:[80,2,9],1228800:[80,2,15],1474560:[80,2,18],2949120:[80,2,36],21368320:[615,4,17]},p={uo:1,dl:3,vo: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,ue:65,Bi:66,Ci:67,Di:68,E:69,Ei:70,Fi:71,Gi:72,Hi:73,Ii:74,Ji:75,Ki:76,Li:77,Mi:78,Ni:79,Oi:80,Q:81,Pi:82, -Qi:83,Ri:84,Si:85,Ti:86,Ui:87,Vi:88,Wi:89,ng:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,ve:97,ol:98,ql:99,d:100,e:101,Al:102,Bl:103,Cl:104,Dl:105,Tm:106,k:107,Um:108,Ym:109,n:110,en:111,p:112,q:113,r:114,lo:115,t:116,oo:117,po:118,qo:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},ca={};ca[186]=p[";"];ca[187]=p["="];ca[188]=p[","];ca[189]=p["-"];ca[190]=p["."];ca[191]=p["/"];ca[192]=p["`"];ca[219]=p["["];ca[220]=p["\\"];ca[221]=p["]"];ca[222]=p["'"];ca[173]=p["-"];var da={};da[p["1"]]=p["!"]; -da[p["2"]]=p["@"];da[p["3"]]=p["#"];da[p["4"]]=p.$;da[p["5"]]=p["%"];da[p["6"]]=p["^"];da[p["7"]]=p["&"];da[p["8"]]=p["*"];da[p["9"]]=p["("];da[p["0"]]=p[")"];da[186]=p[":"];da[187]=p["+"];da[188]=p["<"];da[189]=p._;da[190]=p[">"];da[191]=p["?"];da[192]=p["~"];da[219]=p["{"];da[220]=p["|"];da[221]=p["}"];da[222]=p['"'];da[173]=p._;da[61]=p["+"];da[59]=p[":"]; +var l,aa,ba={163840:[40,1,8],184320:[40,1,9],327680:[40,2,8],368640:[40,2,9],737280:[80,2,9],1228800:[80,2,15],1474560:[80,2,18],2949120:[80,2,36],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]},p={uo:1,dl:3,vo: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,ue:65,Bi:66,Ci:67,Di:68,E:69,Ei:70,Fi:71,Gi:72,Hi:73,Ii:74, +Ji:75,Ki:76,Li:77,Mi:78,Ni:79,Oi:80,Q:81,Pi:82,Qi:83,Ri:84,Si:85,Ti:86,Ui:87,Vi:88,Wi:89,ng:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,ve:97,ol:98,ql:99,d:100,e:101,Al:102,Bl:103,Cl:104,Dl:105,Tm:106,k:107,Um:108,Ym:109,n:110,en:111,p:112,q:113,r:114,lo:115,t:116,oo:117,po:118,qo:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},ca={};ca[186]=p[";"];ca[187]=p["="];ca[188]=p[","];ca[189]=p["-"];ca[190]=p["."];ca[191]=p["/"];ca[192]=p["`"];ca[219]=p["["];ca[220]=p["\\"];ca[221]=p["]"]; +ca[222]=p["'"];ca[173]=p["-"];var da={};da[p["1"]]=p["!"];da[p["2"]]=p["@"];da[p["3"]]=p["#"];da[p["4"]]=p.$;da[p["5"]]=p["%"];da[p["6"]]=p["^"];da[p["7"]]=p["&"];da[p["8"]]=p["*"];da[p["9"]]=p["("];da[p["0"]]=p[")"];da[186]=p[":"];da[187]=p["+"];da[188]=p["<"];da[189]=p._;da[190]=p[">"];da[191]=p["?"];da[192]=p["~"];da[219]=p["{"];da[220]=p["|"];da[221]=p["}"];da[222]=p['"'];da[173]=p._;da[61]=p["+"];da[59]=p[":"]; function ea(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0>=1;return c}function ha(a,b,c){var d="";if(!b||4>=8;return(c?"0b":"")+d} function ia(a,b,c){var d="";b?11>=3;return(c?"0o":"")+d}function r(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function u(a){return r(a,2,!0)}function v(a){return r(a,4,!0)} @@ -618,9 +618,9 @@ function ap(a,b,c){var d;c=c||2;var e=b&511,f=bp(a.za,a.xe[b>>9]);if(f){if(e+c<= Oo.prototype.xj=function(a,b){var c=null;if(this.yd)for(var d in this.yd){var e=this.yd[d];if(a>=e.oi&&a<=e.Ik){d=a-=e.oi;var f,g;for(g in e.we){var h=e.we[g],k=a-h[0];if(!k){c=this.jg+"!"+h[1];break}b&&0>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.Bb);for(c=0;cb.indexOf("/api/v1/dump")&&(a=ka(b),"json"==a||"gz"==a?f=encodeURI(b):"demandrw"==this.mode||"demandro"==this.mode?(f=hp(this,b),this.xg=!0):(c="path",d="&mbhd=10",!b.indexOf("http:")||!b.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(a)?(c="disk",d="&mbhd=0"):ma(b,"/")&& -(c="dir"),f=Ba()+"/api/v1/dump?"+c+"="+encodeURIComponent(b)+(this.cf?"":d)+"&format=json"));return!!Aa(f,null,!0,function(a,b,c){ip(g,a,b,c)})}; +l.load=function(a,b,c,d,e){var f=b;if(this.W)return!0;this.ga=a;this.V=b;this.Ug=ja(b);var g=this;this.W=d;this.ka=e||this.controller;if(c){var h=new FileReader;h.onload=function(){var a=h.result,b,c=a?a.byteLength:0,d=ba[c];if(d){g.Bb=d[0];g.ub=d[1];g.lb=d[2];g.Va=d[3]||512;b=g.Va>>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.Bb);for(c=0;cb.indexOf("/api/v1/dump")&&(a=ka(b),"json"==a||"gz"==a?f=encodeURI(b):"demandrw"==this.mode||"demandro"==this.mode?(f=hp(this,b),this.xg=!0):(c="path",d="&mbhd=10",!b.indexOf("http:")||!b.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(a)?(c="disk",d="&mbhd=0"):ma(b, +"/")&&(c="dir"),f=Ba()+"/api/v1/dump?"+c+"="+encodeURIComponent(b)+(this.cf?"":d)+"&format=json"));return!!Aa(f,null,!0,function(a,b,c){ip(g,a,b,c)})}; function ip(a,b,c,d){var e=null;a.ff=!1;var f=0>d&&a.X&&!a.X.la.ic;if(a.xg)d?a.controller.Na('Unable to connect to disk "'+a.V+'" (error '+d+": "+c+")",f):(a.N=!0,jp(a),e=a);else if(d)a.controller.Na('Unable to load disk "'+a.ga+'" (error '+d+": "+b+")",f);else{mb(a.controller.ce,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(h.length)if(1==h.length)w(h[0]);else{a.Bb=h.length;a.ub=h[0].length;a.lb=h[0][0].length;var k=h[0][0][0];a.Va=k&&k.length||512;for(d=c=0;d>2,n=k.pattern;void 0===n&&(n=k.pattern=0);var t=k.data;if(void 0===t){var q=k.bytes;if(void 0!==q&&q.length){for(var A= m<<2,F=q.length;F'+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 "loadDrive":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 "saveDrive":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)])? -(a=a.za)?(a=Na(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 "mountDrive":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}; +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 "loadDrive":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 "saveDrive":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=Na(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 "mountDrive":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.Ic=function(a,b,c,d){this.ga=b;this.F=c;this.ha=d;this.X=a;this.N=Jb(a,"ChipSet");if((this.U=Yc(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);qc(b,this,Ap);yc(b,this,Bp);Cp(this,"None","",!0);this.ia&&Cp(this,"Local Disk","?");Cp(this,"Remote Disk","??");Dp(this)||xb(this)}; l.hc=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.X.lh){this.B=[];for(a=0;a":62,"?":63,"@":64,Jd:65,wh:66,xh:67,yh:68,E:69,zh:70,Ah:71,Bh:72,Ch:73,Dh:74,Eh:75,Fh:76,Gh:77,Ih:78,Kh:79,Mh:80,Q:81,Ph:82, -Rh:83,Th:84,Vh:85,Xh:86,Zh:87,ai:88,ci:89,vf:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Ld:97,bk:98,ck:99,d:100,e:101,mk:102,nk:103,pk:104,qk:105,Bl:106,k:107,Cl:108,Fl:109,n:110,Kl:111,p:112,q:113,r:114,Mm:115,t:116,Pm:117,Qm:118,Rm:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},da={};da[186]=n[";"];da[187]=n["="];da[188]=n[","];da[189]=n["-"];da[190]=n["."];da[191]=n["/"];da[192]=n["`"];da[219]=n["["];da[220]=n["\\"];da[221]=n["]"];da[222]=n["'"];da[173]=n["-"];var p={};p[n["1"]]=n["!"]; -p[n["2"]]=n["@"];p[n["3"]]=n["#"];p[n["4"]]=n.$;p[n["5"]]=n["%"];p[n["6"]]=n["^"];p[n["7"]]=n["&"];p[n["8"]]=n["*"];p[n["9"]]=n["("];p[n["0"]]=n[")"];p[186]=n[":"];p[187]=n["+"];p[188]=n["<"];p[189]=n._;p[190]=n[">"];p[191]=n["?"];p[192]=n["~"];p[219]=n["{"];p[220]=n["|"];p[221]=n["}"];p[222]=n['"'];p[173]=n._;p[61]=n["+"];p[59]=n[":"]; +var l,ba,ca={163840:[40,1,8],184320:[40,1,9],327680:[40,2,8],368640:[40,2,9],737280:[80,2,9],1228800:[80,2,15],1474560:[80,2,18],2949120:[80,2,36],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]},n={Tm:1,Sj:3,Um: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,Jd:65,wh:66,xh:67,yh:68,E:69,zh:70,Ah:71,Bh:72,Ch:73,Dh:74, +Eh:75,Fh:76,Gh:77,Ih:78,Kh:79,Mh:80,Q:81,Ph:82,Rh:83,Th:84,Vh:85,Xh:86,Zh:87,ai:88,ci:89,vf:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Ld:97,bk:98,ck:99,d:100,e:101,mk:102,nk:103,pk:104,qk:105,Bl:106,k:107,Cl:108,Fl:109,n:110,Kl:111,p:112,q:113,r:114,Mm:115,t:116,Pm:117,Qm:118,Rm:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},da={};da[186]=n[";"];da[187]=n["="];da[188]=n[","];da[189]=n["-"];da[190]=n["."];da[191]=n["/"];da[192]=n["`"];da[219]=n["["];da[220]=n["\\"];da[221]=n["]"]; +da[222]=n["'"];da[173]=n["-"];var p={};p[n["1"]]=n["!"];p[n["2"]]=n["@"];p[n["3"]]=n["#"];p[n["4"]]=n.$;p[n["5"]]=n["%"];p[n["6"]]=n["^"];p[n["7"]]=n["&"];p[n["8"]]=n["*"];p[n["9"]]=n["("];p[n["0"]]=n[")"];p[186]=n[":"];p[187]=n["+"];p[188]=n["<"];p[189]=n._;p[190]=n[">"];p[191]=n["?"];p[192]=n["~"];p[219]=n["{"];p[220]=n["|"];p[221]=n["}"];p[222]=n['"'];p[173]=n._;p[61]=n["+"];p[59]=n[":"]; function ea(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function ga(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0":">",'"':""","'":"'"};function ka(a){return a.replace(/[&<>"']/g,function(a){return ja[a]})}function la(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} @@ -574,8 +574,8 @@ l.le=function(a,b){if(this.cc&&this.A&&this.A.ea.Nb)switch(a){case pl:this.S!=b& function cm(a,b,c){Ka.call(this,"Disk",{id:a.Fe+".disk"+fa(++dm,4)},cm);this.controller=a;this.ba=a.ba;this.Ia=a.Ia;this.C=b;this.B=b.name;this.qe=b.qe;this.Gf=this.D=!1;em(this,c,b.ib,b.jb,b.eb,b.nb);this.I=[];this.S=[];this.G=null;this.P=0;this.R=!1;t(this)}var dm=0;Ta(cm);l=cm.prototype;l.pc=function(a,b,c,d){this.Ia=d};l.Ub=function(a,b){b||!this.Gf||this.D||(t(this,!1),this.load(this.B,this.H,null,this.lk,this));return!0};l.lk=function(){t(this,!0)}; l.Tb=function(a,b){if(this.D){var c,d=0;if(this.R&&!ua("Disk writes are still in progress, shut down anyway?"))return!1;for(;c=fm(this,!1);)if(d=c[0]){this.controller.Ba('Unable to save "'+this.B+'" (error '+d+")");break}b&&this.D&&(b="action=close&volume="+this.H,b+="&machine="+this.controller.ue(),b+="&user="+this.controller.yd(),sa(ta()+"/api/v1/disk?"+b,null,!0),this.D=!1);!d&&a&&this.controller.Ba(this.B+" saved")}return!0}; function em(a,b,c,d,e,f){a.mode=b;a.ib=c;a.jb=d;a.eb=e;a.nb=f;a.A=[];if("preload"!=a.mode){b=Array(a.ib);for(c=0;c>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.ib);for(c=0;cb.indexOf("/api/v1/dump")&&(a=ha(b),"json"==a||"gz"==a?f=encodeURI(b):"demandrw"==this.mode||"demandro"==this.mode?(f=hm(this,b),this.Gf=!0):(c="path",d="&mbhd=10",!b.indexOf("http:")||!b.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(a)?(c="disk",d="&mbhd=0"): +l.load=function(a,b,c,d,e){var f=b;if(this.K)return!0;this.B=a;this.H=b;this.th=ga(b);var g=this;this.K=d;this.ia=e||this.controller;if(c){var h=new FileReader;h.onload=function(){var a=h.result,b,c=a?a.byteLength:0,d=ca[c];if(d){g.ib=d[0];g.jb=d[1];g.eb=d[2];g.nb=d[3]||512;b=g.nb>>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.ib);for(c=0;cb.indexOf("/api/v1/dump")&&(a=ha(b),"json"==a||"gz"==a?f=encodeURI(b):"demandrw"==this.mode||"demandro"==this.mode?(f=hm(this,b),this.Gf=!0):(c="path",d="&mbhd=10",!b.indexOf("http:")||!b.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(a)?(c="disk",d="&mbhd=0"): ia(b,"/")&&(c="dir"),f=ta()+"/api/v1/dump?"+c+"="+encodeURIComponent(b)+(this.qe?"":d)+"&format=json"));return!!sa(f,null,!0,function(a,b,c){im(g,a,b,c)})}; function im(a,b,c,d){var e=null;a.te=!1;var f=0>d&&a.ba&&!a.ba.ea.Vb;if(a.Gf)d?a.controller.Ba('Unable to connect to disk "'+a.H+'" (error '+d+": "+c+")",f):(a.D=!0,e=a);else if(d)a.controller.Ba('Unable to load disk "'+a.B+'" (error '+d+": "+b+")",f);else{Va(a.controller.Fe,b,c);try{if(0g&&0 c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+c+")");if(h.length)if(1==h.length)r(h[0]);else{a.ib=h.length;a.jb=h[0].length;a.eb=h[0][0].length;var k=h[0][0][0];a.nb=k&&k.length||512;for(d=c=0;d>2,q=k.pattern;void 0===q&&(q=k.pattern=0);var y=k.data;if(void 0===y){var w=k.bytes;if(void 0!==w&&w.length){for(var z= @@ -595,8 +595,8 @@ l.toJSON=function(){var a;a=0;for(var b;b=km(this,a++);)sm(b);a=JSON.stringify(t function sm(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)}}function tm(a){Ka.call(this,"FDC",a,tm);this.dmaRead=this.Tj;this.dmaWrite=this.Uj;this.dmaFormat=this.hk;this.K=a.autoMount||null;this.W=a.sortBy||"name";"none"==this.W&&(this.W=null);this.C=[];this.Y=!za("Mobi")&&window&&"FileReader"in window}Ta(tm);ba={}; var um={3:{gd:3,wd:0,name:ba.dn},4:{gd:2,wd:1,name:ba.bn},5:{gd:9,wd:7,name:ba.hn},6:{gd:9,wd:7,name:ba.Ym},7:{gd:2,wd:0,name:ba.$m},8:{gd:1,wd:2,name:ba.cn},10:{gd:2,wd:7,name:ba.Zm},13:{gd:6,wd:7,name:ba.Vm},15:{gd:3,wd:0,name:ba.an}};l=tm.prototype; l.zb=function(a,b,c){var d=this;switch(b){case "listDisks":this.la[b]=c;if(this.W){b=[];for(a=0;a'+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 "loadDrive":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 "saveDrive":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)])?(a= -a.ta)?(a=Aa(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 "mountDrive":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}; +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 "loadDrive":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 "saveDrive":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.ta)?(a=Aa(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 "mountDrive":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=mb(a,"ChipSet");if((this.K=nc(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);Sb(b,this,ym);Ub(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;a>=3;return(c?"0o":"")+d}function l(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d} -function oa(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0":">",'"':""","'":"'"};function ta(a){return a.replace(/[&<>"']/g,function(a){return sa[a]})} -function ua(a,b){return(a+" ").slice(0,b)}function va(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var wa={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",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 xa(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a>1,h;h=c(b,a[g]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} -function Ba(a,b,c,d){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 h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"== -typeof b){var m="",p;for(p in b)b.hasOwnProperty(p)&&(m&&(m+="&"),m+=p+"="+encodeURIComponent(b[p]));m=m.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(m)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g} -function Ca(a,b){var c,d={da:null,fa:null,ya:null,xa: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.ya=g.load;d.xa=g.exec;if(e=g.bytes)d.da=e;else if(e=g.words)for(d.da=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.da=Array(4*e.length),f=c=0;c>8&255,d.da[f++]=e[c]>>16&255,d.da[f++]=e[c]>>24&255;else d.da=g;d.fa=g.symbols;d.da.length?1==d.da.length&&(n(d.da[0]),d=null):(n("Empty resource: "+a),d=null)}catch(h){n("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;cb?this.$a=this.id:(this.Sa=this.id.substr(0,b),this.$a=this.id.substr(b+1));this[a]=c;this.v={ready:!1,Ja:!1,Lb:!1,ka:!1,error:!1};this.Cb=null;this.v.error=!1;this.I={};this.i=null;this.na=d||0;t.push(this)}var Xa=void 0,db={}; -if(window){Xa||(Xa=window.location.search.substr(1));for(var eb,fb=/\+/g,gb=/([^&=]+)=?([^&]*)/g;eb=gb.exec(Xa);)db[decodeURIComponent(eb[1].replace(fb," "))]=decodeURIComponent(eb[2].replace(fb," "))}function hb(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} -function u(a,b){b||(b=r);a.prototype=hb(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var ib=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else ib={},t=[];function jb(a,b,c){ib[a]&&b&&(ib[a][b]=c)}function kb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>=3;return(c?"0o":"")+d}function l(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d} +function ra(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0":">",'"':""","'":"'"};function va(a){return a.replace(/[&<>"']/g,function(a){return ua[a]})} +function wa(a,b){return(a+" ").slice(0,b)}function xa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var ya={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",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 za(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a>1,h;h=c(b,a[g]);0a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())} +function Da(a,b,c,d){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 h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"== +typeof b){var m="",n;for(n in b)b.hasOwnProperty(n)&&(m&&(m+="&"),m+=n+"="+encodeURIComponent(b[n]));m=m.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(m)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g} +function Ea(a,b){var c,d={ea: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.ea=e;else if(e=g.words)for(d.ea=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.ea=Array(4*e.length),f=c=0;c>8&255,d.ea[f++]=e[c]>>16&255,d.ea[f++]=e[c]>>24&255;else d.ea=g;d.ga=g.symbols;d.ea.length?1==d.ea.length&&(p(d.ea[0]),d=null):(p("Empty resource: "+a),d=null)}catch(h){p("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;cb?this.Za=this.id:(this.Ia=this.id.substr(0,b),this.Za=this.id.substr(b+1));this[a]=c;this.v={ready:!1,Qa:!1,Vb:!1,ha:!1,error:!1};this.Lb=null;this.v.error=!1;this.F={};this.i=null;this.na=d||0;t.push(this)}var $a=void 0,ab={}; +if(window){$a||($a=window.location.search.substr(1));for(var hb,ib=/\+/g,jb=/([^&=]+)=?([^&]*)/g;hb=jb.exec($a);)ab[decodeURIComponent(hb[1].replace(ib," "))]=decodeURIComponent(hb[2].replace(ib," "))}function kb(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} +function u(a,b){b||(b=r);a.prototype=kb(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var lb=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else lb={},t=[];function mb(a,b,c){lb[a]&&b&&(lb[a][b]=c)}function nb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>2;this.w=this.ua-1;this.C=this.H/this.ua|0;this.Ia=[];this.f=0;this.A=[];this.nc=[Ob,Pb,Qb,Rb];a=new I(this);Sb(a,this.i);this.V=Array(this.C);for(b=0;b>8:e[2](b)&255):b&1&&(e=d.Ia[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.i&&F(this.i,64)&&D(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Ub(d,b,!0);this.i&&F(this.i,64)&&D(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c} -function Pb(a,b,c){var d=!1,e=this.controller,f=e.Ia[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.Ia[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d?this.i&&F(this.i,64)&&D(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Ub(e,c,!0,b),this.i&&F(this.i,64)&&D(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),!0,!0))} -function Qb(a,b){var c=-1,d=this.controller;(a=d.Ia[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.i&&F(this.i,64)&&D(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Ub(d,b,!1);this.i&&F(this.i,64)&&D(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c} -function Rb(a,b,c){var d=!1,e=this.controller;if(a=e.Ia[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.i&&F(this.i,64)&&D(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Ub(e,c,!1,b),this.i&&F(this.i,64)&&D(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!0))} -function Vb(a,b){if(b!=a.B){var c;a.B&&(c=(1<>>a.ia;0g&&(q=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.D)return m.yb+=m.D-f,m.D=f,!0;if(f>=m.D+m.yb){q=m.size-(f-p);q>g&&(q=g);m.yb=f-m.D+q;f=p+a.ua;g-=q;h++;continue}}return ac(1,f,g)}f=new I(a,f,q,a.ua,d,e);Sb(f,a.i,m);a.V[h++]=f;f=p+a.ua;g-=q}if(0>=g){c/=1024;var v;e="";v?10>>=a.ia;0>>=a.ia;0>>this.ia].Fb(a&this.w,a)};k.Db=function(a){this.f++;a=this.V[(a&this.g)>>>this.ia].Nb(a&this.w,a);this.f--;return a};k.oa=function(a){return this.V[(a&this.g)>>>this.ia].pa(a&this.w,a)}; -k.eb=function(a){var b=a&this.w,c=(a&this.g)>>>this.ia;this.f++;a=this.V[c].Ob(b,a);this.f--;return a};k.Gb=function(a,b){this.V[(a&this.g)>>>this.ia].Jb(a&this.w,b&255,a)};k.Ya=function(a,b){this.f++;this.V[(a&this.g)>>>this.ia].Kb(a&this.w,b&255,a);this.f--};k.Za=function(a,b){this.V[(a&this.g)>>>this.ia].zb(a&this.w,b&65535,a)};k.Hb=function(a,b){var c=a&this.w,d=(a&this.g)>>>this.ia;this.f++;this.V[d].Sb(c,b&65535,a);this.f--}; -function cc(a){for(var b=0,c=[],d=0;da.b.fb)){var g=f[0]?f[0].bind(b):null,h=f[1]?f[1].bind(b):null,m=f[2]?f[2].bind(b):null,p=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&m&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!h&&p&&(h=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));dc(a,e,e,g,h,m,p,f[4])}}}function fc(a,b){a.A.push(b)} -function gc(a,b,c){a.f||(a.i&&F(a.i,64)&&(D(a.i,"memory fault ("+c+") on address "+J(a.i,b),!0,!0),$b(a.i)),a.b.ha(4,b))}function ac(a,b,c){n("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}function K(a){r.call(this,"Device",a,K,256);this.g={data:0,Ud:0,Eb:20,jd:0};this.f={Vd:0,Rb:-1}}u(K);k=K.prototype; -k.Ea=function(a,b,c,d){this.w=b;this.b=c;this.i=d;var e=this;this.f.Rb=hc(c,function(){e.f.La|=128;e.f.La&64&&(ic(e.b,e.f.kd),jc(e.b,e.f.Rb,1E3/60))});this.f.kd=kc(64,6);ec(b,this,L);fc(b,this.reset.bind(this));H(this)};k.reset=function(){this.g.Eb=this.g.Eb&-120|20;this.f.La=0};k.Fc=function(){var a=this.f.La;this.f.La&=-129;return a};k.td=function(a){this.f.La=a;a&64&&jc(this.b,this.f.Rb,1E3/60);this.f.La=a&-129};k.yc=function(a){return(a?this.g.jd:this.g.data)&65535}; -k.md=function(a){this.g.data=a};k.Hc=function(){var a=this.b;return a.C&62337|a.Ba<<5|a.Ca<<1};k.vd=function(a){var b=this.b;a&=62337;if(b.C!=a){b.C=a;b.Ba=a>>5&3;b.Ca=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ma!=c&&(b.Ma=c,lc(b))}vc(this)};k.Ic=function(){var a=this.b.Oa;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.Jc=function(){return this.b.xb};k.Kc=function(){return this.b.Pa}; -k.wd=function(a){var b=this.b;1170>b.fb&&(a&=-49);b.Pa!=a&&(b.Pa=a,a&16?(b.rb=4194303,b.Ta=3915776):(b.rb=262143,b.Ta=253952),lc(b));vc(this)};function vc(a){a.g.Eb=a.g.Eb&-8|(a.b.Ma?a.b.Pa&16?1:2:4)}k.Yc=function(a){return this.b.U[1][a>>1&7]};k.Kd=function(a,b){this.b.U[1][b>>1&7]=a&65295};k.Wc=function(a){return this.b.U[1][(a>>1&7)+8]};k.Id=function(a,b){this.b.U[1][(b>>1&7)+8]=a&65295};k.Xc=function(a){return this.b.ta[1][a>>1&7]}; -k.Jd=function(a,b){b=b>>1&7;this.b.ta[1][b]=a;this.b.U[1][b]&=65295};k.Vc=function(a){return this.b.ta[1][(a>>1&7)+8]};k.Hd=function(a,b){b=(b>>1&7)+8;this.b.ta[1][b]=a;this.b.U[1][b]&=65295};k.Ec=function(a){return this.b.U[0][a>>1&7]};k.sd=function(a,b){this.b.U[0][b>>1&7]=a&65295};k.Cc=function(a){return this.b.U[0][(a>>1&7)+8]};k.qd=function(a,b){this.b.U[0][(b>>1&7)+8]=a&65295};k.Dc=function(a){return this.b.ta[0][a>>1&7]};k.rd=function(a,b){b=b>>1&7;this.b.ta[0][b]=a;this.b.U[0][b]&=65295}; -k.Bc=function(a){return this.b.ta[0][(a>>1&7)+8]};k.pd=function(a,b){b=(b>>1&7)+8;this.b.ta[0][b]=a;this.b.U[0][b]&=65295};k.dd=function(a){return this.b.U[3][a>>1&7]};k.Qd=function(a,b){this.b.U[3][b>>1&7]=a&65295};k.bd=function(a){return this.b.U[3][(a>>1&7)+8]};k.Od=function(a,b){this.b.U[3][(b>>1&7)+8]=a&65295};k.cd=function(a){return this.b.ta[3][a>>1&7]};k.Pd=function(a,b){b=b>>1&7;this.b.ta[3][b]=a;this.b.U[3][b]&=65295};k.ad=function(a){return this.b.ta[3][(a>>1&7)+8]}; -k.Nd=function(a,b){b=(b>>1&7)+8;this.b.ta[3][b]=a;this.b.U[3][b]&=65295};k.jb=function(a){a&=7;return this.b.M&2048?this.b.Ha[a]:this.b.u[a]};k.ob=function(a,b){b&=7;this.b.M&2048?this.b.Ha[b]=a:this.b.u[b]=a};k.Pc=function(){return this.b.M&49152?this.b.wa[0]:this.b.u[6]};k.Bd=function(a){this.b.M&49152?this.b.wa[0]=a:this.b.u[6]=a};k.Sc=function(){return this.b.u[7]};k.Ed=function(a){this.b.u[7]=a};k.kb=function(a){a&=7;return this.b.M&2048?this.b.u[a]:this.b.Ha[a]}; -k.pb=function(a,b){b&=7;this.b.M&2048?this.b.u[b]=a:this.b.Ha[b]=a};k.Qc=function(){return 1==(this.b.M&49152)>>14?this.b.u[6]:this.b.wa[1]};k.Cd=function(a){1==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.wa[1]=a};k.Rc=function(){return 3==(this.b.M&49152)>>14?this.b.u[6]:this.b.wa[3]};k.Dd=function(a){3==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.wa[3]=a};k.Ac=function(a){return this.b.hc[a-65504>>1]};k.od=function(a,b){this.b.hc[b-65504>>1]=a};k.ec=function(a){return 65520==a?61183:0};k.kc=function(){}; -k.$c=function(){return 1};k.Md=function(){};k.zc=function(){return this.b.ba};k.nd=function(){this.b.ba=0};k.Gc=function(){return this.b.gc};k.ud=function(a,b){b&1||(a&=255);this.b.gc=a};k.Lc=function(a){return a?this.b.Qb:0};k.xd=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Qb=a;b.G|=2};k.Zc=function(a){return a?this.b.Qa&65280:0};k.Ld=function(a){this.b.Qa=a|255};k.Oc=function(){return Lb(this.b)};k.Ad=function(a){wc(this.b,a&-1809|Lb(this.b)&1808);this.b.G|=128}; -k.jc=function(a,b){F(this)&&D(this,"writeIgnored("+na(b)+"): "+na(a),!0,!0)}; -var M={},L=(M[62592]=[null,null,K.prototype.Yc,K.prototype.Kd,"SISDR",1145],M[62608]=[null,null,K.prototype.Wc,K.prototype.Id,"SDSDR",1145],M[62624]=[null,null,K.prototype.Xc,K.prototype.Jd,"SISAR",1145],M[62640]=[null,null,K.prototype.Vc,K.prototype.Hd,"SDSAR",1145],M[62656]=[null,null,K.prototype.Ec,K.prototype.sd,"KISDR",1145],M[62672]=[null,null,K.prototype.Cc,K.prototype.qd,"KDSDR",1145],M[62688]=[null,null,K.prototype.Dc,K.prototype.rd,"KISAR",1145],M[62704]=[null,null,K.prototype.Bc,K.prototype.pd, -"KDSAR",1145],M[62798]=[null,null,K.prototype.Kc,K.prototype.wd,"MMR3",1145],M[65382]=[null,null,K.prototype.Fc,K.prototype.td,"LKS"],M[65400]=[null,null,K.prototype.yc,K.prototype.md,"CNSL"],M[65402]=[null,null,K.prototype.Hc,K.prototype.vd,"MMR0",1145],M[65404]=[null,null,K.prototype.Ic,K.prototype.jc,"MMR1",1145],M[65406]=[null,null,K.prototype.Jc,K.prototype.jc,"MMR2",1145],M[65408]=[null,null,K.prototype.dd,K.prototype.Qd,"UISDR",1145],M[65424]=[null,null,K.prototype.bd,K.prototype.Od,"UDSDR", -1145],M[65440]=[null,null,K.prototype.cd,K.prototype.Pd,"UISAR",1145],M[65456]=[null,null,K.prototype.ad,K.prototype.Nd,"UDSAR",1145],M[65472]=[null,null,K.prototype.jb,K.prototype.ob,"R0SET0"],M[65473]=[null,null,K.prototype.jb,K.prototype.ob,"R1SET0"],M[65474]=[null,null,K.prototype.jb,K.prototype.ob,"R2SET0"],M[65475]=[null,null,K.prototype.jb,K.prototype.ob,"R3SET0"],M[65476]=[null,null,K.prototype.jb,K.prototype.ob,"R4SET0"],M[65477]=[null,null,K.prototype.jb,K.prototype.ob,"R5SET0"],M[65478]= -[null,null,K.prototype.Pc,K.prototype.Bd,"R6KERNEL"],M[65479]=[null,null,K.prototype.Sc,K.prototype.Ed,"R7KERNEL"],M[65480]=[null,null,K.prototype.kb,K.prototype.pb,"R0SET1",1145],M[65481]=[null,null,K.prototype.kb,K.prototype.pb,"R1SET1",1145],M[65482]=[null,null,K.prototype.kb,K.prototype.pb,"R2SET1",1145],M[65483]=[null,null,K.prototype.kb,K.prototype.pb,"R3SET1",1145],M[65484]=[null,null,K.prototype.kb,K.prototype.pb,"R4SET1",1145],M[65485]=[null,null,K.prototype.kb,K.prototype.pb,"R5SET1",1145], -M[65486]=[null,null,K.prototype.Qc,K.prototype.Cd,"R6SUPER",1145],M[65487]=[null,null,K.prototype.Rc,K.prototype.Dd,"R6USER",1145],M[65504]=[null,null,K.prototype.Ac,K.prototype.od,"CTRL",1170],M[65520]=[null,null,K.prototype.ec,K.prototype.kc,"LSIZE",1170],M[65522]=[null,null,K.prototype.ec,K.prototype.kc,"HSIZE",1170],M[65524]=[null,null,K.prototype.$c,K.prototype.Md,"SYSID",1170],M[65526]=[null,null,K.prototype.zc,K.prototype.nd,"CPUERR",1170],M[65528]=[null,null,K.prototype.Gc,K.prototype.ud, -"MB",1170],M[65530]=[null,null,K.prototype.Lc,K.prototype.xd,"PIR"],M[65532]=[null,null,K.prototype.Zc,K.prototype.Ld,"SL"],M[65534]=[null,null,K.prototype.Oc,K.prototype.Ad,"PSW"],M);L[62594]=L[62592];L[62596]=L[62592];L[62598]=L[62592];L[62600]=L[62592];L[62602]=L[62592];L[62604]=L[62592];L[62606]=L[62592];L[62610]=L[62608];L[62612]=L[62608];L[62614]=L[62608];L[62616]=L[62608];L[62618]=L[62608];L[62620]=L[62608];L[62622]=L[62608];L[62626]=L[62624];L[62628]=L[62624];L[62630]=L[62624];L[62632]=L[62624]; +var vb="undefined"!==typeof ArrayBuffer,wb={cpu:1,trap:16,bus:64,memory:128,device:256,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function xb(a){r.call(this,"Panel",a,xb);this.f=0;this.v.jc=!0}u(xb);k=xb.prototype; +k.qa=function(a,b,c,d){if(this.B&&this.B.qa(a,b,c,d)||this.b&&this.b.qa(a,b,c,d)||this.i&&this.i.qa(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.F[b]=c,this.f++,!0;default:return"rled"==a?(this.F[b]=c,this.f++,!0):this.parent.qa.call(this,a,b,c,d)}};k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d};k.za=function(a,b){b||yb();return!0};k.ya=function(){return!0}; +function zb(a,b,c,d){if(a.F[b]){void 0===c&&(ub(a,"Value for "+b+" is invalid"),a.b.ia());var e=a.i&&a.i.Z||8;c=!a.b.v.fa||a.v.jc?8==e?qa(c,d):l(c,d):"--------".substr(0,d||4);a.F[b].textContent!=c&&(a.F[b].textContent=c)}}function Ab(a,b,c,d){for(var e=0;e>2;this.w=this.ua-1;this.C=this.I/this.ua|0;this.Pa=[];this.f=0;this.A=[];this.Fc=[Rb,Sb,Tb,Ub];a=new I(this);Vb(a,this.i);this.W=Array(this.C);for(b=0;b>8:e[2](b)&255):b&1&&(e=d.Pa[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.i&&F(this.i,64)&&E(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Xb(d,b,!0);this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c} +function Sb(a,b,c){var d=!1,e=this.controller,f=e.Pa[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.Pa[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d?this.i&&F(this.i,64)&&E(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Xb(e,c,!0,b),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),!0,!0))} +function Tb(a,b){var c=-1,d=this.controller;(a=d.Pa[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.i&&F(this.i,64)&&E(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Xb(d,b,!1);this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c} +function Ub(a,b,c){var d=!1,e=this.controller;if(a=e.Pa[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.i&&F(this.i,64)&&E(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Xb(e,c,!1,b),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!0))} +function Yb(a,b){if(b!=a.B){var c;a.B&&(c=(1<>>a.ka;0g&&(q=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.D)return m.Eb+=m.D-f,m.D=f,!0;if(f>=m.D+m.Eb){q=m.size-(f-n);q>g&&(q=g);m.Eb=f-m.D+q;f=n+a.ua;g-=q;h++;continue}}return dc(1,f,g)}f=new I(a,f,q,a.ua,d,e);Vb(f,a.i,m);a.W[h++]=f;f=n+a.ua;g-=q}if(0>=g){c/=1024;var w;e="";w?10>>=a.ka;0>>=a.ka;0>>this.ka].Pb(a&this.w,a)};k.Mb=function(a){this.f++;a=this.W[(a&this.g)>>>this.ka].ac(a&this.w,a);this.f--;return a};k.oa=function(a){return this.W[(a&this.g)>>>this.ka].pa(a&this.w,a)}; +k.lb=function(a){var b=a&this.w,c=(a&this.g)>>>this.ka;this.f++;a=this.W[c].bc(b,a);this.f--;return a};k.Qb=function(a,b){this.W[(a&this.g)>>>this.ka].Tb(a&this.w,b&255,a)};k.fb=function(a,b){this.f++;this.W[(a&this.g)>>>this.ka].Ub(a&this.w,b&255,a);this.f--};k.hb=function(a,b){this.W[(a&this.g)>>>this.ka].Fb(a&this.w,b&65535,a)};k.Rb=function(a,b){var c=a&this.w,d=(a&this.g)>>>this.ka;this.f++;this.W[d].fc(c,b&65535,a);this.f--}; +function fc(a){for(var b=0,c=[],d=0;da.b.mb)){var g=f[0]?f[0].bind(b):null,h=f[1]?f[1].bind(b):null,m=f[2]?f[2].bind(b):null,n=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&m&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!h&&n&&(h=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));gc(a,e,e,g,h,m,n,f[4])}}}function ic(a,b){a.A.push(b)} +function jc(a,b,c){a.f||(a.i&&F(a.i,64)&&(E(a.i,"memory fault ("+c+") on address "+J(a.i,b),!0,!0),cc(a.i)),a.b.ja(4,b))}function dc(a,b,c){p("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}function K(a){r.call(this,"Device",a,K,256);this.g={data:0,oe:0,Ob:20,Ed:0};this.f={se:0,ec:-1}}u(K);k=K.prototype; +k.wa=function(a,b,c,d){this.w=b;this.b=c;this.i=d;var e=this;this.f.ec=kc(c,function(){e.f.Ra|=128;e.f.Ra&64&&(lc(e.b,e.f.Fd),mc(e.b,e.f.ec,1E3/60))});this.f.Fd=nc(64,6);hc(b,this,L);ic(b,this.reset.bind(this));G(this)};k.reset=function(){this.g.Ob=this.g.Ob&-120|20;this.f.Ra=0};k.$c=function(){var a=this.f.Ra;this.f.Ra&=-129;return a};k.Od=function(a){this.f.Ra=a;a&64&&mc(this.b,this.f.ec,1E3/60);this.f.Ra=a&-129};k.Tc=function(a){return(a?this.g.Ed:this.g.data)&65535}; +k.Hd=function(a){this.g.data=a};k.bd=function(){var a=this.b;return a.C&62337|a.Ea<<5|a.Fa<<1};k.Qd=function(a){var b=this.b;a&=62337;if(b.C!=a){b.C=a;b.Ea=a>>5&3;b.Fa=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Sa!=c&&(b.Sa=c,oc(b))}pc(this)};k.cd=function(){var a=this.b.Ua;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.dd=function(){return this.b.Db};k.ed=function(){return this.b.Va}; +k.Rd=function(a){var b=this.b;1170>b.mb&&(a&=-49);b.Va!=a&&(b.Va=a,a&16?(b.xb=4194303,b.$a=3915776):(b.xb=262143,b.$a=253952),oc(b));pc(this)};function pc(a){a.g.Ob=a.g.Ob&-8|(a.b.Sa?a.b.Va&16?1:2:4)}k.td=function(a){return this.b.V[1][a>>1&7]};k.ee=function(a,b){this.b.V[1][b>>1&7]=a&65295};k.rd=function(a){return this.b.V[1][(a>>1&7)+8]};k.ce=function(a,b){this.b.V[1][(b>>1&7)+8]=a&65295};k.sd=function(a){return this.b.ta[1][a>>1&7]}; +k.de=function(a,b){b=b>>1&7;this.b.ta[1][b]=a;this.b.V[1][b]&=65295};k.qd=function(a){return this.b.ta[1][(a>>1&7)+8]};k.be=function(a,b){b=(b>>1&7)+8;this.b.ta[1][b]=a;this.b.V[1][b]&=65295};k.Zc=function(a){return this.b.V[0][a>>1&7]};k.Nd=function(a,b){this.b.V[0][b>>1&7]=a&65295};k.Xc=function(a){return this.b.V[0][(a>>1&7)+8]};k.Ld=function(a,b){this.b.V[0][(b>>1&7)+8]=a&65295};k.Yc=function(a){return this.b.ta[0][a>>1&7]};k.Md=function(a,b){b=b>>1&7;this.b.ta[0][b]=a;this.b.V[0][b]&=65295}; +k.Wc=function(a){return this.b.ta[0][(a>>1&7)+8]};k.Kd=function(a,b){b=(b>>1&7)+8;this.b.ta[0][b]=a;this.b.V[0][b]&=65295};k.zd=function(a){return this.b.V[3][a>>1&7]};k.ke=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.xd=function(a){return this.b.V[3][(a>>1&7)+8]};k.ie=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.yd=function(a){return this.b.ta[3][a>>1&7]};k.je=function(a,b){b=b>>1&7;this.b.ta[3][b]=a;this.b.V[3][b]&=65295};k.wd=function(a){return this.b.ta[3][(a>>1&7)+8]}; +k.he=function(a,b){b=(b>>1&7)+8;this.b.ta[3][b]=a;this.b.V[3][b]&=65295};k.qb=function(a){a&=7;return this.b.M&2048?this.b.Na[a]:this.b.u[a]};k.ub=function(a,b){b&=7;this.b.M&2048?this.b.Na[b]=a:this.b.u[b]=a};k.kd=function(){return this.b.M&49152?this.b.Aa[0]:this.b.u[6]};k.Wd=function(a){this.b.M&49152?this.b.Aa[0]=a:this.b.u[6]=a};k.nd=function(){return this.b.u[7]};k.Zd=function(a){this.b.u[7]=a};k.rb=function(a){a&=7;return this.b.M&2048?this.b.u[a]:this.b.Na[a]}; +k.vb=function(a,b){b&=7;this.b.M&2048?this.b.u[b]=a:this.b.Na[b]=a};k.ld=function(){return 1==(this.b.M&49152)>>14?this.b.u[6]:this.b.Aa[1]};k.Xd=function(a){1==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.Aa[1]=a};k.md=function(){return 3==(this.b.M&49152)>>14?this.b.u[6]:this.b.Aa[3]};k.Yd=function(a){3==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.Aa[3]=a};k.Vc=function(a){return this.b.yc[a-65504>>1]};k.Jd=function(a,b){this.b.yc[b-65504>>1]=a};k.vc=function(a){return 65520==a?61183:0};k.Cc=function(){}; +k.vd=function(){return 1};k.ge=function(){};k.Uc=function(){return this.b.ca};k.Id=function(){this.b.ca=0};k.ad=function(){return this.b.xc};k.Pd=function(a,b){b&1||(a&=255);this.b.xc=a};k.fd=function(a){return a?this.b.dc:0};k.Sd=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.dc=a;b.H|=2};k.ud=function(a){return a?this.b.Wa&65280:0};k.fe=function(a){this.b.Wa=a|255};k.jd=function(){return Bb(this.b)};k.Vd=function(a){qc(this.b,a&-1809|Bb(this.b)&1808);this.b.H|=128}; +k.Bc=function(a,b){F(this)&&E(this,"writeIgnored("+qa(b)+"): "+qa(a),!0,!0)}; +var M={},L=(M[62592]=[null,null,K.prototype.td,K.prototype.ee,"SISDR",1145],M[62608]=[null,null,K.prototype.rd,K.prototype.ce,"SDSDR",1145],M[62624]=[null,null,K.prototype.sd,K.prototype.de,"SISAR",1145],M[62640]=[null,null,K.prototype.qd,K.prototype.be,"SDSAR",1145],M[62656]=[null,null,K.prototype.Zc,K.prototype.Nd,"KISDR",1145],M[62672]=[null,null,K.prototype.Xc,K.prototype.Ld,"KDSDR",1145],M[62688]=[null,null,K.prototype.Yc,K.prototype.Md,"KISAR",1145],M[62704]=[null,null,K.prototype.Wc,K.prototype.Kd, +"KDSAR",1145],M[62798]=[null,null,K.prototype.ed,K.prototype.Rd,"MMR3",1145],M[65382]=[null,null,K.prototype.$c,K.prototype.Od,"LKS"],M[65400]=[null,null,K.prototype.Tc,K.prototype.Hd,"CNSL"],M[65402]=[null,null,K.prototype.bd,K.prototype.Qd,"MMR0",1145],M[65404]=[null,null,K.prototype.cd,K.prototype.Bc,"MMR1",1145],M[65406]=[null,null,K.prototype.dd,K.prototype.Bc,"MMR2",1145],M[65408]=[null,null,K.prototype.zd,K.prototype.ke,"UISDR",1145],M[65424]=[null,null,K.prototype.xd,K.prototype.ie,"UDSDR", +1145],M[65440]=[null,null,K.prototype.yd,K.prototype.je,"UISAR",1145],M[65456]=[null,null,K.prototype.wd,K.prototype.he,"UDSAR",1145],M[65472]=[null,null,K.prototype.qb,K.prototype.ub,"R0SET0"],M[65473]=[null,null,K.prototype.qb,K.prototype.ub,"R1SET0"],M[65474]=[null,null,K.prototype.qb,K.prototype.ub,"R2SET0"],M[65475]=[null,null,K.prototype.qb,K.prototype.ub,"R3SET0"],M[65476]=[null,null,K.prototype.qb,K.prototype.ub,"R4SET0"],M[65477]=[null,null,K.prototype.qb,K.prototype.ub,"R5SET0"],M[65478]= +[null,null,K.prototype.kd,K.prototype.Wd,"R6KERNEL"],M[65479]=[null,null,K.prototype.nd,K.prototype.Zd,"R7KERNEL"],M[65480]=[null,null,K.prototype.rb,K.prototype.vb,"R0SET1",1145],M[65481]=[null,null,K.prototype.rb,K.prototype.vb,"R1SET1",1145],M[65482]=[null,null,K.prototype.rb,K.prototype.vb,"R2SET1",1145],M[65483]=[null,null,K.prototype.rb,K.prototype.vb,"R3SET1",1145],M[65484]=[null,null,K.prototype.rb,K.prototype.vb,"R4SET1",1145],M[65485]=[null,null,K.prototype.rb,K.prototype.vb,"R5SET1",1145], +M[65486]=[null,null,K.prototype.ld,K.prototype.Xd,"R6SUPER",1145],M[65487]=[null,null,K.prototype.md,K.prototype.Yd,"R6USER",1145],M[65504]=[null,null,K.prototype.Vc,K.prototype.Jd,"CTRL",1170],M[65520]=[null,null,K.prototype.vc,K.prototype.Cc,"LSIZE",1170],M[65522]=[null,null,K.prototype.vc,K.prototype.Cc,"HSIZE",1170],M[65524]=[null,null,K.prototype.vd,K.prototype.ge,"SYSID",1170],M[65526]=[null,null,K.prototype.Uc,K.prototype.Id,"CPUERR",1170],M[65528]=[null,null,K.prototype.ad,K.prototype.Pd, +"MB",1170],M[65530]=[null,null,K.prototype.fd,K.prototype.Sd,"PIR"],M[65532]=[null,null,K.prototype.ud,K.prototype.fe,"SL"],M[65534]=[null,null,K.prototype.jd,K.prototype.Vd,"PSW"],M);L[62594]=L[62592];L[62596]=L[62592];L[62598]=L[62592];L[62600]=L[62592];L[62602]=L[62592];L[62604]=L[62592];L[62606]=L[62592];L[62610]=L[62608];L[62612]=L[62608];L[62614]=L[62608];L[62616]=L[62608];L[62618]=L[62608];L[62620]=L[62608];L[62622]=L[62608];L[62626]=L[62624];L[62628]=L[62624];L[62630]=L[62624];L[62632]=L[62624]; L[62634]=L[62624];L[62636]=L[62624];L[62638]=L[62624];L[62642]=L[62640];L[62644]=L[62640];L[62646]=L[62640];L[62648]=L[62640];L[62650]=L[62640];L[62652]=L[62640];L[62654]=L[62640];L[62658]=L[62656];L[62660]=L[62656];L[62662]=L[62656];L[62664]=L[62656];L[62666]=L[62656];L[62668]=L[62656];L[62670]=L[62656];L[62674]=L[62672];L[62676]=L[62672];L[62678]=L[62672];L[62680]=L[62672];L[62682]=L[62672];L[62684]=L[62672];L[62686]=L[62672];L[62690]=L[62688];L[62692]=L[62688];L[62694]=L[62688];L[62696]=L[62688]; L[62698]=L[62688];L[62700]=L[62688];L[62702]=L[62688];L[62706]=L[62704];L[62708]=L[62704];L[62710]=L[62704];L[62712]=L[62704];L[62714]=L[62704];L[62716]=L[62704];L[62718]=L[62704];L[65410]=L[65408];L[65412]=L[65408];L[65414]=L[65408];L[65416]=L[65408];L[65418]=L[65408];L[65420]=L[65408];L[65422]=L[65408];L[65426]=L[65424];L[65428]=L[65424];L[65430]=L[65424];L[65432]=L[65424];L[65434]=L[65424];L[65436]=L[65424];L[65438]=L[65424];L[65442]=L[65440];L[65444]=L[65440];L[65446]=L[65440];L[65448]=L[65440]; -L[65450]=L[65440];L[65452]=L[65440];L[65454]=L[65440];L[65458]=L[65456];L[65460]=L[65456];L[65462]=L[65456];L[65464]=L[65456];L[65466]=L[65456];L[65468]=L[65456];L[65470]=L[65456];L[65506]=L[65504];L[65508]=L[65504];L[65510]=L[65504];L[65512]=L[65504];L[65514]=L[65504];L[65516]=L[65504];L[65518]=L[65504];Ta(function(){for(var a=C(document,"pdp11","device"),b=0;b>1),this.b=new Int32Array(this.C,0,this.size>>2),Ec(this,Ac?Fc:Gc);else{a=this.b=Array(this.size>> -2);for(f=0;f>2),b=0;b>8,c)},R:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},la:function(a,b){a&1&&gc(this.w,b,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},Sa: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.Ka=!0},O:function(a,b){if(this.i&&null!=this.D){var c=this.i;Lc(c,this.D+a,1,c.L)&&c.ga(!0)}return this.Nb(a,b)},Y:function(a,b){if(this.i&&null!=this.D){var c=this.i;Lc(c,this.D+a,2,c.L)&&c.ga(!0)}return this.Ob(a, -b)},ra:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Lc(d,this.D+a,1,d.C)&&d.ga(!0)}this.g?this.A(a,b,c):this.Kb(a,b,c)},$a:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Lc(d,this.D+a,2,d.C)&&d.ga(!0)}this.g?this.A(a,b,c):this.Sb(a,b,c)},N:function(a){return this.f[a]},P:function(a,b){a=this.f[a];this.i&&F(this.i,128)&&D(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},X:function(a,b){a&1&&gc(this.w,b,2);return this.F.getUint16(a,!0)},aa:function(a,b){a&1&&gc(this.w, -b,2);a=this.J[a>>1];this.i&&F(this.i,128)&&D(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ma:function(a,b){this.f[a]=b;this.Ka=!0},sa:function(a,b,c){this.f[a]=b;this.Ka=!0;this.i&&F(this.i,128)&&D(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},va:function(a,b,c){a&1&&gc(this.w,c,4);this.F.setUint16(a,b,!0);this.Ka=!0},Ba:function(a,b,c){a&1&&gc(this.w,c,4);this.J[a>>1]=b;this.Ka=!0;this.i&&F(this.i,128)&&D(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i, -b)+")",!0)}};function Sb(a,b,c){a.i=b;a.I=a.B=0;c&&((a.I=c.I)&&Kc(a,Jc,!1),(a.B=c.B)&&Ic(a,Jc,!1))}function Mc(a,b){b?--a.B||(a.Jb=a.g?a.A:a.Kb,a.zb=a.g?a.H:a.Sb):--a.I||(a.Fb=a.Nb,a.pa=a.Ob)}function Ic(a,b,c){c&&a.B||(a.Jb=!a.g&&b[1]||a.A,a.zb=!a.g&&b[3]||a.H);if(c||void 0===c)a.Kb=b[1]||a.A,a.Sb=b[3]||a.H}function Kc(a,b,c){c&&a.I||(a.Fb=b[0]||a.K,a.pa=b[2]||a.L);if(c||void 0===c)a.Nb=b[0]||a.K,a.Ob=b[2]||a.L}function Ec(a,b){b||(b=Nc);Kc(a,b,void 0);Ic(a,b,void 0)} -var Nc=[],Hc=[I.prototype.R,I.prototype.Sa,I.prototype.la,I.prototype.Ca],Jc=[I.prototype.O,I.prototype.ra,I.prototype.Y,I.prototype.$a];if(sb)var Gc=[I.prototype.N,I.prototype.ma,I.prototype.X,I.prototype.va],Fc=[I.prototype.P,I.prototype.sa,I.prototype.aa,I.prototype.Ba]; -function Oc(a,b){r.call(this,"CPU",a,Oc,1);var c=a.multiplier||1;this.Ra=a.cycles||b;this.Na=c;this.qb=Math.round(this.Ra/1E4)/100;this.Xa=this.qb*this.Na;this.v.ea=!1;this.v.Ib=!1;this.v.ab=a.autoStart;this.v.cb=!1;this.ub=this.ma=0;this.vb=a.csStart;this.gb=a.csInterval;this.hb=a.csStop;this.K=[];this.dc=this.hd.bind(this);H(this)}u(Oc);var Pc=["power","reset"];k=Oc.prototype; -k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.i=d;for(b=0;b=a.ma&&(a.ma+=a.gb,c=!0);0<=a.hb&&a.hb<=Vc(a)&&(a.gb=a.hb=-1,Sc(a),a.ga(),c=!0);c&&a.j(Vc(a)+" cycles: checksum="+l(a.ub))}} -k.qa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.I[b]=c,!0;case "run":return this.I[b]=c,c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.v.ka)a=!0;else{var b=null,c,h=kb(a.id);for(c=0;ca.X/a.Xa?b=1:d=!0;a.Na=b;b=a.qb*a.Na;if(a.Xa!=b){a.Xa=b;b=a.Xa.toFixed(2)+"Mhz";var e=a.I.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.B&&a.B.lb()}Xc(a,a.R);a.R=0;a.P=za();a.Y=0;Yc(a);return d}function hc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function jc(a,b,c){0<=b&&ba.K[b][0]&&(c=a.Ra*a.Na/1E3*c|0,a.K[b][0]=c+Zc(a))} -function $c(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function ad(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Zc(a,b){var c=a.aa-=a.b;a.b=a.J=0;b&&(a.aa=0);return c} -k.hd=function(){if(this.v.ea){this.sb>=this.Ra&&Yc(this,!0);this.va=0;this.Ua=za();if(this.Y){var a=this.Ua-this.Y;a>this.ac&&(this.P+=a,this.P>this.Ua&&(this.P=this.Ua))}try{do{var b=$c(this,this.v.cb?1:this.Va);try{this.nb(b)}catch(e){if("number"!=typeof e)throw e;}b=Zc(this,!0);this.va+=b;this.R+=b;Uc(this,b);ad(this,b);this.ra-=b;if(0>=this.ra){this.ra+=this.Va;15<=++this.bc&&(this.B&&this.B.ca(),this.bc=0);break}}while(this.v.ea)}catch(e){this.ga();this.B&&this.B.stop(za(),Vc(this));rb(this, -e.stack||e.message);return}if(this.v.ea){a=setTimeout;b=this.dc;this.Y=za();var c=this.ac;this.va&&(c=Math.round(c*this.va/this.Va));var c=c-(this.Y-this.Ua),d=this.Y-this.P;d&&(this.X=Math.round(this.R/(10*d))/100,864E5<=d&&(this.la=0,Wc(this)));if(0>c||this.Xc&&(this.P-=c),c=0;this.sb+=this.va;this.Y+=c;a(b,c)}}}; -k.mb=function(a){if(qb(this))return!1;if(this.v.ea)return this.j(this.toString()+" busy"),!1;Wc(this);this.v.ea=!0;this.v.Ib=!0;var b=this.I.run;b&&(b.textContent="Halt");this.B&&(a&&this.B.lb(!0),this.B.start(this.P,Vc(this)));setTimeout(this.dc,0);return!0};k.nb=function(){return 0};k.ga=function(a){var b=!1;if(this.v.ea){Zc(this);Xc(this,this.R);this.R=0;this.v.ea=!1;if(b=this.I.run)b.textContent="Run";this.B&&this.B.stop(za(),Vc(this));b=!0}this.v.complete=a;return b}; -function bd(a){this.fb=+a.model||1170;this.Bb=a.addrReset||0;Oc.call(this,a,6666667);this.decode=1120==this.fb?cd.bind(this):dd.bind(this);ed(this);this.L=0;this.N=null;this.v.complete=!1}u(bd,Oc);k=bd.prototype;k.reset=function(){this.status("model "+this.fb);this.v.ea&&this.ga();ed(this);Rc(this);this.v.error=!1;this.parent.reset.call(this)}; -function ed(a){a.S=65536;a.T=32768;a.Z=65535;a.W=32768;a.M=15;a.u=[0,0,0,0,0,0,0,a.Bb];a.Ha=[0,0,0,0,0,0];a.wa=[0,0,0,0];a.A=0;a.Ca=0;a.sc=[4,2,0,1];a.U=[[0,0,0,0,0,0,0,0,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],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ta=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.xc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.hc=[0,0,0,0,0,0,0,0];a.gc=0;a.G=0;a.F=a.H=0;a.g=a.f=a.bb=0;a.sa=-1;fd(a)}function fd(a){a.Qa=255;a.ba=0;a.Qb=0;a.C=0;a.Oa=0;a.xb=0;a.Pa=0;a.Ma=0;a.Ba=0;a.rb=262143;a.Ta=253952;a.N=null;a.w&&lc(a)}function lc(a){a.Ma?(a.O=65536,a.$=a.rc,a.pa=a.ed,a.zb=a.Rd,Vb(a.w,a.Pa&16?22:18)):(a.O=0,a.$=a.qc,a.pa=a.fc,a.zb=a.lc,Vb(a.w,16))}function gd(a,b,c){a.Bb=b;N(a,b);!c&&a.i&&(a.ga()||a.i.ca())}k.Yb=function(){return 0}; -k.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.la,this.Na]);a.set(2,cc(this.w));return a.data()};k.restore=function(a){var b=a[1];this.la=b[1];Wc(this,b[3]);a:{b=this.w;a=a[2];var c;for(c=0;c>14&3;c=a.M>>14&3;a.A!=c&&(a.wa[c]=a.u[6],a.u[6]=a.wa[a.A]);a.M=b;a.G|=2}function P(a,b){a.G&128||(a.W=a.Z=b,a.T=0)}function md(a,b,c){a.G&128||(a.W=a.Z=a.S=b,a.T=c||0)}function Fd(a,b,c,d){a.G&128||(a.W=a.Z=a.S=b,a.T=(c^b)&(d^b))}function Gd(a,b){a.G&128||(a.W=a.Z=a.S=b,a.T=a.W^a.S>>1)} -function Hd(a,b,c,d){a.G&128||(a.W=a.Z=a.S=b,a.T=(c^d)&(d^b))}k.ha=function(a,b){if(!this.L){var c=!1;0>this.sa?this.sa=Lb(this):this.A||(a=4,c=!0);this.C&57344||(this.Oa=63222,this.xb=a);this.A=0;var d=this.pa(a|this.O),e=this.pa(a+2&65535|this.O);wc(this,e&-12289|this.sa>>2&12288);c&&(this.ba|=4,this.u[6]=4);Id(this,this.sa);Id(this,this.u[7]);N(this,d);this.G&=-113;this.sa=-1;this.G|=8;this.wc=a;this.vc=b;if(26!=b)throw a;}}; -function Jd(a){var b=Kd(a),c=Kd(a)&-1793;a.M&49152&&(c=c&-225|a.M&63712);N(a,b);wc(a,c);a.G&=-17} -function Ld(a,b,c){var d,e,f,g=0;d=b>>13;a.Pa&a.sc[a.A]||(d&=7);e=a.U[a.A][d];f=(a.ta[a.A][d]<<6)+(b&8191)&a.rb;if(ff){if(3932160<=f){f&=262143;var h=f>>13&31;31>h?a.Pa&32&&(f=a.xc[h]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Ta&&4186112>f&&(a.ba|=32,a.ha(4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c& -4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.U[a.A][d]=e;if(4194170!==f||a.A)a.Ba=a.A,a.Ca=d;g&&(g&57344&&(0<=a.sa&&(g|=128),a.C&57344||(a.C=a.C|g|a.Ba<<5|a.Ca<<1),a.ha(168,16)),a.C&61440||!(4191360>f||4194239c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!==c&&(e|=g);e=a.pa(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!==c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!==c&&(e|=g);e=a.pa(e)| -g;a.b-=8;break;case 6:return e=a.pa(ld(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.pa(ld(a,2)),e=e+a.u[c]&65535,e=a.pa(e|a.O)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.C&57344||(a.Oa=a.Oa<<8|f<<3&248|c);6==c&&!a.A&&d&4&&0>=f&&(a.u[6]<=a.Qa||65534<=a.u[6])&&(a.u[6]<=a.Qa-32?(a.ba|=4,a.u[6]=4,a.ha(4,24)):(a.ba|=8,a.G|=64));return e}k.Db=function(a){if(!this.Ma)return this.w.Db(a);this.L++;a=Md(this,Ld(this,a,3));this.L--;return a}; -k.eb=function(a){if(!this.Ma)return this.w.eb(a);this.L++;a=this.fc(Ld(this,a,2));this.L--;return a};k.Ya=function(a,b){this.Ma?(this.L++,Nd(this,Ld(this,a,5),b),this.L--):this.w.Ya(a,b)};k.Hb=function(a,b){this.Ma?(this.L++,this.lc(Ld(this,a,4),b),this.L--):this.w.Hb(a,b)};k.qc=function(a,b,c){return Od(this,a,b,c)};k.rc=function(a,b,c){return Ld(this,Od(this,a,b,c),c)};k.fc=function(a){return this.w.oa(a)};k.ed=function(a){return this.w.oa(Ld(this,a,2))};k.lc=function(a,b){this.w.Za(a,b&65535)}; -k.Rd=function(a,b){this.w.Za(Ld(this,a,4),b)};function Pd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=Od(a,b,d,2),c&65536||61440!==(a.M&61440)&&(d&=65535),a.A=a.M>>12&3,c=a.pa(d|c&a.O),a.A=a.M>>14&3):c=6!=d||(a.M>>2&12288)===(a.M&12288)?a.u[d]:a.wa[a.M>>12&3];return c}function Qd(a,b,c,d){a.C&57344||(a.Oa=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=Od(a,b,e,4),c&65536||(e&=65535),a.A=a.M>>12&3,e=Ld(a,e|c&65536,4),a.A=a.M>>14&3,a.w.Za(e,d)):6!=e||(a.M>>2&12288)===(a.M&12288)?a.u[e]=d:a.wa[a.M>>12&3]=d} -function Rd(a,b){b>>=6;var c=a.H=b&7;return(b=a.F=(b&56)>>3)?Md(a,a.$(b,c,3)):a.u[c]&255}function Sd(a,b){b>>=6;var c=a.H=b&7;return(b=a.F=(b&56)>>3)?a.w.oa(a.$(b,c,2)):a.u[c]}function Td(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return Od(a,b,c,8)}function Ud(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?Md(a,a.$(b,c,3)):a.u[c]&255}function Vd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.w.oa(a.$(b,c,2)):a.u[c]} -function Q(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.bb=a.$(b,e,7),Nd(a,e,d.call(a,c,Md(a,e)))):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.$(b,e,6),a.w.Za(e,d.call(a,c,a.w.oa(e)))):a.u[e]=d.call(a,c,a.u[e])}function Wd(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?Nd(a,a.$(b,e,5),c):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}function Xd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.Za(a.$(b,d,4),c):a.u[d]=c&65535;return c} -function S(a,b,c){c&&(N(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3} -k.nb=function(a){this.v.complete=!0;var b=this.i&&Yd(this.i)?1:this.v.Ib?-1:0,c=a?this.v.Ib?0:1:-1;this.v.Ib=!1;this.aa=this.b=a;do{if(b){if(this.i&&Zd(this.i,this.u[7],c)){this.ga();break}c||c++;b++}if(this.G){this.G&112&&(this.G&32?this.ha(168,28):this.G&64?this.ha(4,30):this.G&16&&this.ha(12,32),this.G&=-113);if(a=this.G&7){a=!1;if(this.G&2){this.G&=-3;var d=160,e=(this.Qb&224)>>5,f=this.N&&this.N.ib>e?this.N:null;f&&(d=f.ld,e=f.ib);e>(this.M&224)>>5?(this.G&4&&(ld(this,2),this.G&=-5),this.ha(d, -26),e=!0):e=!1;if(e){if(f)if(a=f,f=this.N,f==a)this.N=a.next;else for(;f;){e=f.next;if(e==a){f.next=e.next;break}f=e}a=!0}}else this.G&1&&this.G++;a=a&&0>c}if(a)break}this.G=this.G&7|this.M&16;this.decode(kd(this))}while(0>1|b<<16;Gd(this,a);return a&65535}function ee(a,b){a=b&2048|b>>1|b<<8;Gd(this,a<<8);return a&255}function fe(a,b){a=b&~a;P(this,a);return a}function ge(a,b){a=b&~a;P(this,a<<8);return a}function he(a,b){a|=b;P(this,a);return a}function ie(a,b){a|=b;P(this,a<<8);return a} -function je(a,b){a=~b|65536;md(this,a);return a&65535}function ke(a,b){a=~b|256;md(this,a<<8);return a&255}function le(a,b){a=b-a;this.G&128||(this.W=this.Z=a,this.T=b&(b^a));return a&65535}function me(a,b){a=b-a;var c=a<<8;b<<=8;this.G&128||(this.W=this.Z=c,this.T=b&(b^c));return a&255}function ne(a,b){a=b+a;this.G&128||(this.W=this.Z=a,this.T=a&(b^a));return a&65535}function oe(a,b){a=b+a;var c=a<<8;this.G&128||(this.W=this.Z=c,this.T=c&(b<<8^c));return a&255} -function pe(a,b){a=-b;md(this,a,a&b&32768);return a&65535}function qe(a,b){a=-b;md(this,a<<8,(a&b&128)<<8);return a&255}function re(a,b){a=b<<1|this.S>>16&1;Gd(this,a);return a&65535}function se(a,b){a=b<<1|this.S>>16&1;Gd(this,a<<8);return a&255}function te(a,b){a=(this.S&65536|b)>>1|b<<16;Gd(this,a);return a&65535}function ue(a,b){a=((this.S&65536)>>8|b)>>1|b<<8;Gd(this,a<<8);return a&255}function ve(a,b){var c=b-a;Hd(this,c,a,b);return c&65535} -function we(a,b){var c=b-a;Hd(this,c<<8,a<<8,b<<8);return c&255}function xe(a,b){this.G&128||(this.W=this.Z=b&65280,this.T=this.S=0);return(b<<8|b>>8)&65535}function ye(a,b){a^=b;P(this,a);return a&65535}function ze(a){R(this,a,Sd(this,a),$d);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)} -function Ae(a){var b=Vd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.S=this.T=0;b&=63;if(b&32)b=64-b,16>=b;else if(b)if(16>15&65535;d&&65535!==d&&(this.T=32768)}this.u[a]=c&65535;this.W=this.Z=c;this.b-=(this.g?6:7)+b} -function Be(a){var b=Vd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.S=this.T=0;b&=63;if(b&32){b=64-b;32>b-1;this.S=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.u[a|1]=d&65535;this.W=d>>16;this.Z=d>>16|d;this.b-=(this.g?6:7)+b}function Ce(a){S(this,a,!hd(this))}function De(a){S(this,a,hd(this))} -function Ee(a){R(this,a,Sd(this,a),fe);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}function Fe(a){Q(this,a,Rd(this,a),ge);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}function Ge(a){R(this,a,Sd(this,a),he);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}function He(a){Q(this,a,Rd(this,a),ie);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)} -function Ie(a){P(this,Sd(this,a)&Vd(this,a));this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}function Je(a){P(this,(Rd(this,a)&Ud(this,a))<<8);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}function Ke(a){S(this,a,jd(this))}function Le(a){S(this,a,!this.Ga()==!id(this))}function Me(a){S(this,a,!jd(this)&&!this.Ga()==!id(this))}function Ne(a){S(this,a,!hd(this)&&!jd(this))}function Oe(a){S(this,a,jd(this)||!this.Ga()!=!id(this))} -function Pe(a){S(this,a,hd(this)||jd(this))}function Qe(a){S(this,a,!this.Ga()!=!id(this))}function Re(a){S(this,a,this.Ga())}function Se(a){S(this,a,!jd(this))}function Te(a){S(this,a,!this.Ga())}function Ue(){this.ha(12,1);this.b-=5}function Ve(a){S(this,a,!0)}function We(a){S(this,a,!id(this))}function Xe(a){S(this,a,id(this))}function T(a){a&1&&(this.S=0);a&2&&(this.T=0);a&4&&(this.Z=1);a&8&&(this.W=0);this.b-=5} -function Ye(a){var b=Sd(this,a);a=Vd(this,a);Hd(this,b-a,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}function Ze(a){var b=Rd(this,a)<<8;a=Ud(this,a)<<8;Hd(this,b-a,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)} -function $e(a){var b=Vd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.S=this.T=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.Z=d>>16|d,this.W=d>>16):(this.T=32768,this.Z=d>>15|d,this.W=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.Z=this.W=0,this.T=32768,this.S=65536,this.b-=7}function af(){this.ha(24,2);this.b-=25} -function bf(){this.M&49152?(this.ba|=128,this.ha(4,3)):this.i?$b(this.i):this.ga();this.b-=7}function cf(){this.ha(16,4);this.b-=25}var df=[0,7,7,10,7,11,9,13];function ef(a){this.J=this.b;N(this,Td(this,a));this.b=this.J-df[this.g]}var ff=[0,14,14,17,14,18,16,20];function gf(a){this.J=this.b;var b=Td(this,a);a=a>>6&7;Id(this,this.u[a]);this.u[a]=this.u[7];N(this,b);this.b=this.J-ff[this.g]}var hf=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17]; -function jf(a){var b=Sd(this,a);this.J=this.b;P(this,Xd(this,a,b));this.b=this.J-hf[(this.F?8:0)+this.g]+(7!=this.f||this.g?0:2)}function kf(a){var b=Rd(this,a);P(this,Wd(this,a,b,1)<<8);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}var lf=[7,13,13,17,14,18,17,21]; -function mf(a){var b=Vd(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.G&128||(this.W=b>>16,this.Z=this.W|b,this.T=0,this.S=-32768>b||32767>6;if(this.u[b]=this.u[b]-1&65535)N(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function sf(a){R(this,a,Sd(this,a),ve);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)} -function tf(a){R(this,a,0,xe);this.b-=this.g?9:3+(7==this.f?2:0)}function uf(){this.ha(28,5);this.b-=5}function vf(){this.G&4||this.B.ca();this.G|=4;ld(this,-2);this.b-=3}function wf(a){R(this,a,Sd(this,a),ye);this.b-=this.g?9:3+(7==this.f?2:0)}function U(a){var b;if(b=this.i)b=this.i,D(b,"undefined opcode "+J(b,a),!0,!0),b=$b(b);b||this.ha(8,6)}function cd(a){xf[a>>12].call(this,a)}function yf(a){zf[a>>6&3].call(this,a)}function Af(a){Bf[a>>6&3].call(this,a)} -function Cf(a){Df[a>>6&3].call(this,a)}function Ef(a){Ff[a&15].call(this,a)}function Gf(a){Hf[a&15].call(this,a)}function If(a){Jf[a>>6&3].call(this,a)}function Kf(a){Lf[a>>6&3].call(this,a)}function Mf(a){Nf[a>>6&3].call(this,a)} -var xf=[function(a){Of[a>>8&15].call(this,a)},jf,Ye,Ie,Ee,Ge,ze,U,function(a){Pf[a>>8&15].call(this,a)},kf,Ze,Je,Fe,He,sf,U],Of=[function(a){Qf[a>>4&15].call(this,a)},Ve,Se,Ke,Le,Qe,Me,Oe,gf,gf,yf,Af,Cf,U,U,U],zf=[function(a){md(this,Xd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,je);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,ne);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,le);this.b-=this.g?9:3+(7==this.f?2:0)}],Bf=[function(a){R(this,a,0, -pe);this.b-=this.g?11:6},function(a){R(this,a,hd(this)?1:0,$d);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,hd(this)?1:0,ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Vd(this,a);md(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],Df=[function(a){R(this,a,0,te);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,de);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,be);this.b-=this.g?9:3+(7==this.f?2:0)}], -Qf=[function(a){Rf[a&15].call(this,a)},U,U,U,ef,ef,ef,ef,qf,U,Ef,Gf,tf,tf,tf,tf],Rf=[bf,vf,pf,Ue,cf,of,U,U,U,U,U,U,U,U,U,U],Ff=[nf,function(){this.S=0;this.b-=5},function(){this.T=0;this.b-=5},T,function(){this.Z=1;this.b-=5},T,T,T,function(){this.W=0;this.b-=5},T,T,T,T,T,T,T],Hf=[nf,function(){this.S=65536;this.b-=5},function(){this.T=32768;this.b-=5},W,function(){this.Z=0;this.b-=5},W,W,W,function(){this.W=32768;this.b-=5},W,W,W,W,W,W,W],Pf=[Te,Re,Ne,Pe,We,Xe,Ce,De,af,uf,If,Kf,Mf,U,U,U],Jf=[function(a){md(this, -Wd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,ke);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,oe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,me);this.b-=this.g?9:3+(7==this.f?2:0)}],Lf=[function(a){Q(this,a,0,qe);this.b-=this.g?11:6},function(a){Q(this,a,hd(this)?1:0,ae);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,hd(this)?1:0,we);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Ud(this,a);md(this,a<<8);this.b-=this.g?4:3+(7== -this.f?2:0)}],Nf=[function(a){Q(this,a,0,ue);this.b-=this.g?9+(this.bb&1):3+(7==this.f?2:0)},function(a){Q(this,a,0,se);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,ee);this.b-=this.g?9+(this.bb&1):3+(7==this.f?2:0)},function(a){Q(this,a,0,ce);this.b-=this.g?9:3+(7==this.f?2:0)}];function dd(a){Sf[a>>12].call(this,a)} -var Sf=[function(a){lg[a>>8&15].call(this,a)},jf,Ye,Ie,Ee,Ge,ze,function(a){mg[a>>8&15].call(this,a)},function(a){ng[a>>8&15].call(this,a)},kf,Ze,Je,Fe,He,sf,U],lg=[function(a){og[a>>4&15].call(this,a)},Ve,Se,Ke,Le,Qe,Me,Oe,gf,gf,yf,Af,Cf,function(a){pg[a>>6&3].call(this,a)},U,U],pg=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.pa(a|this.O);N(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=Pd(this,a,0);Id(this,a);P(this,a);this.b-=11},function(a){var b=Kd(this);this.J= -this.b;Qd(this,a,0,b);P(this,b);this.b=this.J-lf[this.g]},function(a){P(this,Xd(this,a,this.Ga?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],og=[function(a){qg[a&15].call(this,a)},U,U,U,ef,ef,ef,ef,qf,function(a){a&8?(this.M&49152||(this.M=this.M&-2017|(a&7)<<5,this.G|=1),this.b-=5):U.call(this,a)},Ef,Gf,tf,tf,tf,tf],qg=[bf,vf,pf,Ue,cf,of,function(){Jd(this);this.b-=13},U,U,U,U,U,U,U,U,U],mg=[mf,mf,$e,$e,Ae,Ae,Be,Be,wf,wf,U,U,U,U,rf,rf],ng=[Te,Re,Ne,Pe,We,Xe,Ce,De,af,uf,If,Kf,Mf,function(a){rg[a>> -6&3].call(this,a)},U,U],rg=[U,function(a){a=Pd(this,a,65536);Id(this,a);P(this,a);this.b-=11},function(a){var b=Kd(this);this.J=this.b;Qd(this,a,65536,b);P(this,b);this.b=this.J-lf[this.g]},U]; -function sg(a){r.call(this,"ROM",a,sg);this.fa=this.f=null;this.C=a.addr;this.g=a.size;this.A=a.alias;this.B=a.file;this.F=oa(this.B);if(this.B){a=this.B;var b=pa(this.F);"json"!=b&&"hex"!=b&&(a=ra()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var c=this;Ba(a,null,!0,function(a,b,f){f?c.ja("Unable to load ROM resource (error "+f+": "+a+")"):(jb(c.Sa,a,b),(a=Ca(a,b))?(c.f=a.da,c.fa=a.fa):c.B=null,tg(c))})}}u(sg);sg.prototype.Ea=function(a,b,c,d){this.w=b;this.b=c;this.i=d;tg(this)}; -sg.prototype.Aa=function(){this.fa&&(this.i&&ug(this.i,this.id,this.C,this.g,this.fa),delete this.fa);return!0};sg.prototype.za=function(){return!0}; -function tg(a){if(!pb(a)){if(a.B){if(!a.f||!a.w)return;a.g||(a.g=a.f.length);if(a.f.length!=a.g)rb(a,"ROM size ("+l(a.f.length,8,!0)+") does not match specified size ("+l(a.g,8,!0)+")");else{var b;b=a.C;if(Yb(a.w,b,a.g,Dc)){var c;for(c=0;c>>a.ia;0=b.length)break;for(var h=h+2,p=b[h++]&255|(b[h++]&255)<<8,q=b[h++]&255|(b[h++]&255)<<8,m=m+((p&255)+(p>>8)+(q&255)+(q>>8)),v=h,w=p-=6;0=b.length)break;m+=b[h++]&255;if(m&255)break;if(w)for(;w--;)a.b.Ya(q++,b[v++]&255);else q&1?a.b.ga():gd(a.b,q,f);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e=b)a.preventDefault&&a.preventDefault(),64e.K&&(e.K-=32),e.f|=128,e.f&64&&ic(e.b,e.la))});this.ma=kc(52,4);this.Y=hc(this.b,function(){e.g|=128;e.g&64&&ic(e.b,e.ma)});ec(b,this,Ag);H(this)}; -k.cc=function(){if(!this.J){var a=Qc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=va(b[0]);if(c!=this.$a)return;b=va(b[1]);if(this.J=lb(b)){var d=this.J.exports;if(d){var e=d.connect;e&&e.call(this.J);if(this.L=d.receiveData){this.status(this.Sa+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.Aa=function(a,b){if(!b)if(this.cc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0}; -k.za=function(a){return a?this.save():!0};k.reset=function(){Bg(this)};k.save=function(){var a=new O(this);a.set(0,[]);return a.data()};k.restore=function(){return Bg(this)};function Bg(a){a.K=0;a.f=0;a.g=128;a.C=[];return!0}k.Pb=function(a){if("number"==typeof a)this.C.push(a);else if("string"==typeof a)for(var b=0;b":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.R||8,c=a-this.H%a,this.R&&(b=ua("",c)));this.O&&!this.H&&c&&(b=String.fromCharCode(this.O)+b);this.A.value+=b;this.A.scrollTop=this.A.scrollHeight;this.H+=c}else if(null!=this.F){if(10==a||1024<=this.F.length)this.j(this.F), -this.F="";10!=a&&(this.F+=String.fromCharCode(a))}this.g&=-129;jc(this.b,this.Y,1E3/Math.round(this.P/10))}};var Cg={},Ag=(Cg[65392]=[null,null,X.prototype.Uc,X.prototype.Gd,"RCSR"],Cg[65394]=[null,null,X.prototype.Tc,X.prototype.Fd,"RBUF"],Cg[65396]=[null,null,X.prototype.gd,X.prototype.Td,"XCSR"],Cg[65398]=[null,null,X.prototype.fd,X.prototype.Sd,"XBUF"],Cg);Ta(function(){for(var a=C(document,"pdp11","serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.I[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.I[b]=c,c.onclick= -function(){var a=d.I.listTapes;a&&Fg(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.O){c.parentNode.removeChild(c);break}this.I[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;Fg(d,oa(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.I[b]=c,!0}return!1}; -k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;this.R=Gg(a);var e=this;if((this.g=Qc(this.B,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){n("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.X=kc(56,4);this.aa=hc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.Kc.indexOf("/api/v1/dump")&&(e=pa(c),f="json"==e||"gz"==e?encodeURI(c):ra()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Ba(f,null,!0,function(e,f,g){var h=0>g&&a.B&&!a.B.v.ka;g?a.ja('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(jb(a.Sa,e,f),(e=Ca(e,f))&&Pg(a,b,c,d,e.da,e.ya, -e.xa));a.v.Ja=!1;a.F&&(a.F--,a.F||H(a));Mg(a)})}function Jg(a,b,c,d){if((a=a.I.listTapes)&&a.options){for(var e=0;e=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Rg.prototype.Zb=function(){return-1};Rg.prototype.$b=function(){}; -function Tg(a,b,c,d){if(c)if(b){0>a.A&&a.g.length&&(a.A=0);if(0>a.A||b!=a.g[a.A])a.g.splice(0,0,b),a.A=0;a.A--}else a.O?b="end":b=a.g[a.A+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(va(b.substring(c,f))),c=f+1}}return a} -function Ug(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; +L[65450]=L[65440];L[65452]=L[65440];L[65454]=L[65440];L[65458]=L[65456];L[65460]=L[65456];L[65462]=L[65456];L[65464]=L[65456];L[65466]=L[65456];L[65468]=L[65456];L[65470]=L[65456];L[65506]=L[65504];L[65508]=L[65504];L[65510]=L[65504];L[65512]=L[65504];L[65514]=L[65504];L[65516]=L[65504];L[65518]=L[65504]; +Wa(function(){for(var a=D(document,"pdp11","device"),b=0;b>1),this.b=new Int32Array(this.C,0,this.size>>2),Ic(this,Ec?Jc:Kc);else{a=this.b=Array(this.size>> +2);for(f=0;f>2),b=0;b>8,c)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ba:function(a,b){a&1&&jc(this.w,b,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},sa: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.La=!0},P:function(a,b){if(this.i&&null!=this.D){var c=this.i;Pc(c,this.D+a,1,c.L)&&c.ia(!0)}return this.ac(a,b)},Y:function(a,b){if(this.i&&null!=this.D){var c=this.i;Pc(c,this.D+a,2,c.L)&&c.ia(!0)}return this.bc(a, +b)},ma:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Pc(d,this.D+a,1,d.C)&&d.ia(!0)}this.f?this.A(a,b,c):this.Ub(a,b,c)},va:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Pc(d,this.D+a,2,d.C)&&d.ia(!0)}this.f?this.A(a,b,c):this.fc(a,b,c)},N:function(a){return this.F[a]},R:function(a,b){a=this.F[a];this.i&&F(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},Ia:function(a,b){a&1&&jc(this.w,b,2);return this.G.getUint16(a,!0)},Z:function(a,b){a&1&&jc(this.w, +b,2);a=this.J[a>>1];this.i&&F(this.i,128)&&E(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},la:function(a,b){this.F[a]=b;this.La=!0},ra:function(a,b,c){this.F[a]=b;this.La=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},Za:function(a,b,c){a&1&&jc(this.w,c,4);this.G.setUint16(a,b,!0);this.La=!0},Ea:function(a,b,c){a&1&&jc(this.w,c,4);this.J[a>>1]=b;this.La=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i, +b)+")",!0)}};function Vb(a,b,c){a.i=b;a.g=a.B=0;c&&((a.g=c.g)&&Oc(a,Nc,!1),(a.B=c.B)&&Mc(a,Nc,!1))}function Qc(a,b){b?--a.B||(a.Tb=a.f?a.A:a.Ub,a.Fb=a.f?a.I:a.fc):--a.g||(a.Pb=a.ac,a.pa=a.bc)}function Mc(a,b,c){c&&a.B||(a.Tb=!a.f&&b[1]||a.A,a.Fb=!a.f&&b[3]||a.I);if(c||void 0===c)a.Ub=b[1]||a.A,a.fc=b[3]||a.I}function Oc(a,b,c){c&&a.g||(a.Pb=b[0]||a.K,a.pa=b[2]||a.L);if(c||void 0===c)a.ac=b[0]||a.K,a.bc=b[2]||a.L}function Ic(a,b){b||(b=Rc);Oc(a,b,void 0);Mc(a,b,void 0)} +var Rc=[],Lc=[I.prototype.S,I.prototype.sa,I.prototype.ba,I.prototype.Fa],Nc=[I.prototype.P,I.prototype.ma,I.prototype.Y,I.prototype.va];if(vb)var Kc=[I.prototype.N,I.prototype.la,I.prototype.Ia,I.prototype.Za],Jc=[I.prototype.R,I.prototype.ra,I.prototype.Z,I.prototype.Ea]; +function Sc(a,b){r.call(this,"CPU",a,Sc,1);var c=a.multiplier||1;this.Ya=a.cycles||b;this.Ta=c;this.wb=Math.round(this.Ya/1E4)/100;this.eb=this.wb*this.Ta;this.v.fa=!1;this.v.Sb=!1;this.v.ib=a.autoStart;this.v.kb=!1;this.Ab=this.ma=0;this.Bb=a.csStart;this.nb=a.csInterval;this.ob=a.csStop;this.K=[];this.tc=this.Dd.bind(this);G(this)}u(Sc);var Tc=["power","reset"];k=Sc.prototype; +k.wa=function(a,b,c,d){this.B=a;this.w=b;this.i=d;for(b=0;b=a.ma&&(a.ma+=a.nb,c=!0);0<=a.ob&&a.ob<=Zc(a)&&(a.nb=a.ob=-1,Wc(a),a.ia(),c=!0);c&&a.j(Zc(a)+" cycles: checksum="+l(a.Ab))}} +k.qa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.F[b]=c,!0;case "run":return this.F[b]=c,c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.v.ha)a=!0;else{var b=null,c,h=nb(a.id);for(c=0;ca.Y/a.eb?b=1:d=!0;a.Ta=b;b=a.wb*a.Ta;if(a.eb!=b){a.eb=b;b=a.eb.toFixed(2)+"Mhz";var e=a.F.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.B&&a.B.gb()}ad(a,a.S);a.S=0;a.R=Aa();a.Z=0;bd(a);return d}function kc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function mc(a,b,c){0<=b&&ba.K[b][0]&&(c=a.Ya*a.Ta/1E3*c|0,a.K[b][0]=c+cd(a))} +function dd(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function ed(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function cd(a,b){var c=a.ba-=a.b;a.b=a.J=0;b&&(a.ba=0);return c} +k.Dd=function(){if(this.v.fa){this.yb>=this.Ya&&bd(this,!0);this.va=0;this.ab=Aa();if(this.Z){var a=this.ab-this.Z;a>this.qc&&(this.R+=a,this.R>this.ab&&(this.R=this.ab))}try{do{var b=dd(this,this.v.kb?1:this.bb);try{this.tb(b)}catch(e){if("number"!=typeof e)throw e;}b=cd(this,!0);this.va+=b;this.S+=b;Yc(this,b);ed(this,b);this.ra-=b;if(0>=this.ra){this.ra+=this.bb;15<=++this.rc&&(this.B&&this.B.da(),this.rc=0);break}}while(this.v.fa)}catch(e){this.ia();this.B&&this.B.stop(Aa(),Zc(this));ub(this, +e.stack||e.message);return}if(this.v.fa){a=setTimeout;b=this.tc;this.Z=Aa();var c=this.qc;this.va&&(c=Math.round(c*this.va/this.bb));var c=c-(this.Z-this.ab),d=this.Z-this.R;d&&(this.Y=Math.round(this.S/(10*d))/100,864E5<=d&&(this.la=0,$c(this)));if(0>c||this.Yc&&(this.R-=c),c=0;this.yb+=this.va;this.Z+=c;a(b,c)}}}; +k.sb=function(a){if(tb(this))return!1;if(this.v.fa)return this.j(this.toString()+" busy"),!1;$c(this);this.v.fa=!0;this.v.Sb=!0;var b=this.F.run;b&&(b.textContent="Halt");this.B&&(a&&this.B.gb(!0),this.B.start(this.R,Zc(this)));setTimeout(this.tc,0);return!0};k.tb=function(){return 0};k.ia=function(a){var b=!1;if(this.v.fa){cd(this);ad(this,this.S);this.S=0;this.v.fa=!1;if(b=this.F.run)b.textContent="Run";this.B&&this.B.stop(Aa(),Zc(this));b=!0}this.v.complete=a;return b}; +function fd(a){this.mb=+a.model||1170;this.Kb=a.addrReset||0;Sc.call(this,a,6666667);this.decode=1120==this.mb?gd.bind(this):hd.bind(this);id(this);this.L=0;this.N=null;this.v.complete=!1}u(fd,Sc);k=fd.prototype;k.reset=function(){this.status("model "+this.mb);this.v.fa&&this.ia();id(this);Vc(this);this.v.error=!1;this.parent.reset.call(this)}; +function id(a){a.T=65536;a.U=32768;a.$=65535;a.X=32768;a.M=15;a.u=[0,0,0,0,0,0,0,a.Kb];a.Na=[0,0,0,0,0,0];a.Aa=[0,0,0,0];a.A=0;a.Fa=0;a.Nc=[4,2,0,1];a.V=[[0,0,0,0,0,0,0,0,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],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ta=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Sc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.yc=[0,0,0,0,0,0,0,0];a.xc=0;a.H=0;a.G=a.I=0;a.g=a.f=a.jb=0;a.sa=-1;jd(a)}function jd(a){a.Wa=255;a.ca=0;a.dc=0;a.C=0;a.Ua=0;a.Db=0;a.Va=0;a.Sa=0;a.Ea=0;a.xb=262143;a.$a=253952;a.N=null;a.w&&oc(a)}function oc(a){a.Sa?(a.P=65536,a.aa=a.Mc,a.pa=a.Ad,a.Fb=a.le,Yb(a.w,a.Va&16?22:18)):(a.P=0,a.aa=a.Lc,a.pa=a.wc,a.Fb=a.Dc,Yb(a.w,16))}function kd(a,b,c){a.Kb=b;N(a,b);!c&&a.i&&(a.ia()||a.i.da())}k.nc=function(){return 0}; +k.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.la,this.Ta]);a.set(2,fc(this.w));return a.data()};k.restore=function(a){var b=a[1];this.la=b[1];$c(this,b[3]);a:{b=this.w;a=a[2];var c;for(c=0;c>14&3;c=a.M>>14&3;a.A!=c&&(a.Aa[c]=a.u[6],a.u[6]=a.Aa[a.A]);a.M=b;a.H|=2}function Q(a,b){a.H&128||(a.X=a.$=b,a.U=0)}function qd(a,b,c){a.H&128||(a.X=a.$=a.T=b,a.U=c||0)}function rd(a,b,c,d){a.H&128||(a.X=a.$=a.T=b,a.U=(c^b)&(d^b))}function sd(a,b){a.H&128||(a.X=a.$=a.T=b,a.U=a.X^a.T>>1)} +function td(a,b,c,d){a.H&128||(a.X=a.$=a.T=b,a.U=(c^d)&(d^b))}k.ja=function(a,b){if(!this.L){var c=!1;0>this.sa?this.sa=Bb(this):this.A||(a=4,c=!0);this.C&57344||(this.Ua=63222,this.Db=a);this.A=0;var d=this.pa(a|this.P),e=this.pa(a+2&65535|this.P);qc(this,e&-12289|this.sa>>2&12288);c&&(this.ca|=4,this.u[6]=4);ud(this,this.sa);ud(this,this.u[7]);N(this,d);this.H&=-113;this.sa=-1;this.H|=8;this.Rc=a;this.Qc=b;if(26!=b)throw a;}}; +function Md(a){var b=Nd(a),c=Nd(a)&-1793;a.M&49152&&(c=c&-225|a.M&63712);N(a,b);qc(a,c);a.H&=-17} +function Od(a,b,c){var d,e,f,g=0;d=b>>13;a.Va&a.Nc[a.A]||(d&=7);e=a.V[a.A][d];f=(a.ta[a.A][d]<<6)+(b&8191)&a.xb;if(ff){if(3932160<=f){f&=262143;var h=f>>13&31;31>h?a.Va&32&&(f=a.Sc[h]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.$a&&4186112>f&&(a.ca|=32,a.ja(4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c& +4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.V[a.A][d]=e;if(4194170!==f||a.A)a.Ea=a.A,a.Fa=d;g&&(g&57344&&(0<=a.sa&&(g|=128),a.C&57344||(a.C=a.C|g|a.Ea<<5|a.Fa<<1),a.ja(168,16)),a.C&61440||!(4191360>f||4194239c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!==c&&(e|=g);e=a.pa(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!==c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!==c&&(e|=g);e=a.pa(e)| +g;a.b-=8;break;case 6:return e=a.pa(pd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.pa(pd(a,2)),e=e+a.u[c]&65535,e=a.pa(e|a.P)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.C&57344||(a.Ua=a.Ua<<8|f<<3&248|c);6==c&&!a.A&&d&4&&0>=f&&(a.u[6]<=a.Wa||65534<=a.u[6])&&(a.u[6]<=a.Wa-32?(a.ca|=4,a.u[6]=4,a.ja(4,24)):(a.ca|=8,a.H|=64));return e}k.Mb=function(a){if(!this.Sa)return this.w.Mb(a);this.L++;a=Pd(this,Od(this,a,3));this.L--;return a}; +k.lb=function(a){if(!this.Sa)return this.w.lb(a);this.L++;a=this.wc(Od(this,a,2));this.L--;return a};k.fb=function(a,b){this.Sa?(this.L++,Qd(this,Od(this,a,5),b),this.L--):this.w.fb(a,b)};k.Rb=function(a,b){this.Sa?(this.L++,this.Dc(Od(this,a,4),b),this.L--):this.w.Rb(a,b)};k.Lc=function(a,b,c){return Rd(this,a,b,c)};k.Mc=function(a,b,c){return Od(this,Rd(this,a,b,c),c)};k.wc=function(a){return this.w.oa(a)};k.Ad=function(a){return this.w.oa(Od(this,a,2))};k.Dc=function(a,b){this.w.hb(a,b&65535)}; +k.le=function(a,b){this.w.hb(Od(this,a,4),b)};function Sd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=Rd(a,b,d,2),c&65536||61440!==(a.M&61440)&&(d&=65535),a.A=a.M>>12&3,c=a.pa(d|c&a.P),a.A=a.M>>14&3):c=6!=d||(a.M>>2&12288)===(a.M&12288)?a.u[d]:a.Aa[a.M>>12&3];return c}function Td(a,b,c,d){a.C&57344||(a.Ua=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=Rd(a,b,e,4),c&65536||(e&=65535),a.A=a.M>>12&3,e=Od(a,e|c&65536,4),a.A=a.M>>14&3,a.w.hb(e,d)):6!=e||(a.M>>2&12288)===(a.M&12288)?a.u[e]=d:a.Aa[a.M>>12&3]=d} +function Ud(a,b){b>>=6;var c=a.I=b&7;return(b=a.G=(b&56)>>3)?Pd(a,a.aa(b,c,3)):a.u[c]&255}function Vd(a,b){b>>=6;var c=a.I=b&7;return(b=a.G=(b&56)>>3)?a.w.oa(a.aa(b,c,2)):a.u[c]}function Wd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return Rd(a,b,c,8)}function Xd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?Pd(a,a.aa(b,c,3)):a.u[c]&255}function Yd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.w.oa(a.aa(b,c,2)):a.u[c]} +function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.jb=a.aa(b,e,7),Qd(a,e,d.call(a,c,Pd(a,e)))):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.aa(b,e,6),a.w.hb(e,d.call(a,c,a.w.oa(e)))):a.u[e]=d.call(a,c,a.u[e])}function Zd(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?Qd(a,a.aa(b,e,5),c):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c} +function $d(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.hb(a.aa(b,d,4),c):a.u[d]=c&65535;return c}function T(a,b,c){c&&(N(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3} +k.tb=function(a){this.v.complete=!0;var b=this.i&&ae(this.i)?1:this.v.Sb?-1:0,c=a?this.v.Sb?0:1:-1;this.v.Sb=!1;this.ba=this.b=a;do{if(b){if(this.i&&be(this.i,this.u[7],c)){this.ia();break}c||c++;b++}if(this.H){this.H&112&&(this.H&32?this.ja(168,28):this.H&64?this.ja(4,30):this.H&16&&this.ja(12,32),this.H&=-113);if(a=this.H&7){a=!1;if(this.H&2){this.H&=-3;var d=160,e=(this.dc&224)>>5,f=this.N&&this.N.pb>e?this.N:null;f&&(d=f.Gd,e=f.pb);e>(this.M&224)>>5?(this.H&4&&(pd(this,2),this.H&=-5),this.ja(d, +26),e=!0):e=!1;if(e){if(f)if(a=f,f=this.N,f==a)this.N=a.next;else for(;f;){e=f.next;if(e==a){f.next=e.next;break}f=e}a=!0}}else this.H&1&&this.H++;a=a&&0>c}if(a)break}this.H=this.H&7|this.M&16;this.decode(od(this))}while(0>1|b<<16;sd(this,a);return a&65535}function he(a,b){a=b&2048|b>>1|b<<8;sd(this,a<<8);return a&255}function ie(a,b){a=b&~a;Q(this,a);return a}function je(a,b){a=b&~a;Q(this,a<<8);return a}function ke(a,b){a|=b;Q(this,a);return a}function le(a,b){a|=b;Q(this,a<<8);return a} +function me(a,b){a=~b|65536;qd(this,a);return a&65535}function ne(a,b){a=~b|256;qd(this,a<<8);return a&255}function oe(a,b){a=b-a;this.H&128||(this.X=this.$=a,this.U=b&(b^a));return a&65535}function pe(a,b){a=b-a;var c=a<<8;b<<=8;this.H&128||(this.X=this.$=c,this.U=b&(b^c));return a&255}function qe(a,b){a=b+a;this.H&128||(this.X=this.$=a,this.U=a&(b^a));return a&65535}function re(a,b){a=b+a;var c=a<<8;this.H&128||(this.X=this.$=c,this.U=c&(b<<8^c));return a&255} +function se(a,b){a=-b;qd(this,a,a&b&32768);return a&65535}function te(a,b){a=-b;qd(this,a<<8,(a&b&128)<<8);return a&255}function ue(a,b){a=b<<1|this.T>>16&1;sd(this,a);return a&65535}function ve(a,b){a=b<<1|this.T>>16&1;sd(this,a<<8);return a&255}function we(a,b){a=(this.T&65536|b)>>1|b<<16;sd(this,a);return a&65535}function xe(a,b){a=((this.T&65536)>>8|b)>>1|b<<8;sd(this,a<<8);return a&255}function ye(a,b){var c=b-a;td(this,c,a,b);return c&65535} +function ze(a,b){var c=b-a;td(this,c<<8,a<<8,b<<8);return c&255}function Ae(a,b){this.H&128||(this.X=this.$=b&65280,this.U=this.T=0);return(b<<8|b>>8)&65535}function Be(a,b){a^=b;Q(this,a);return a&65535}function Ce(a){S(this,a,Vd(this,a),ce);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)} +function De(a){var b=Yd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.T=this.U=0;b&=63;if(b&32)b=64-b,16>=b;else if(b)if(16>15&65535;d&&65535!==d&&(this.U=32768)}this.u[a]=c&65535;this.X=this.$=c;this.b-=(this.g?6:7)+b} +function Ee(a){var b=Yd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&=63;if(b&32){b=64-b;32>b-1;this.T=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.u[a|1]=d&65535;this.X=d>>16;this.$=d>>16|d;this.b-=(this.g?6:7)+b}function Fe(a){T(this,a,!ld(this))}function Ge(a){T(this,a,ld(this))} +function He(a){S(this,a,Vd(this,a),ie);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}function Ie(a){R(this,a,Ud(this,a),je);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}function Je(a){S(this,a,Vd(this,a),ke);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}function Ke(a){R(this,a,Ud(this,a),le);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)} +function Le(a){Q(this,Vd(this,a)&Yd(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}function Me(a){Q(this,(Ud(this,a)&Xd(this,a))<<8);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}function Ne(a){T(this,a,nd(this))}function Oe(a){T(this,a,!this.Ma()==!md(this))}function Pe(a){T(this,a,!nd(this)&&!this.Ma()==!md(this))}function Qe(a){T(this,a,!ld(this)&&!nd(this))}function Re(a){T(this,a,nd(this)||!this.Ma()!=!md(this))} +function Se(a){T(this,a,ld(this)||nd(this))}function Te(a){T(this,a,!this.Ma()!=!md(this))}function Ue(a){T(this,a,this.Ma())}function Ve(a){T(this,a,!nd(this))}function We(a){T(this,a,!this.Ma())}function Xe(){this.ja(12,1);this.b-=5}function Ye(a){T(this,a,!0)}function Ze(a){T(this,a,!md(this))}function $e(a){T(this,a,md(this))}function U(a){a&1&&(this.T=0);a&2&&(this.U=0);a&4&&(this.$=1);a&8&&(this.X=0);this.b-=5} +function af(a){var b=Vd(this,a);a=Yd(this,a);td(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}function bf(a){var b=Ud(this,a)<<8;a=Xd(this,a)<<8;td(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)} +function cf(a){var b=Yd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.$=d>>16|d,this.X=d>>16):(this.U=32768,this.$=d>>15|d,this.X=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.$=this.X=0,this.U=32768,this.T=65536,this.b-=7}function df(){this.ja(24,2);this.b-=25} +function ef(){this.M&49152?(this.ca|=128,this.ja(4,3)):this.i?cc(this.i):this.ia();this.b-=7}function ff(){this.ja(16,4);this.b-=25}var gf=[0,7,7,10,7,11,9,13];function hf(a){this.J=this.b;N(this,Wd(this,a));this.b=this.J-gf[this.g]}var jf=[0,14,14,17,14,18,16,20];function kf(a){this.J=this.b;var b=Wd(this,a);a=a>>6&7;ud(this,this.u[a]);this.u[a]=this.u[7];N(this,b);this.b=this.J-jf[this.g]}var lf=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17]; +function mf(a){var b=Vd(this,a);this.J=this.b;Q(this,$d(this,a,b));this.b=this.J-lf[(this.G?8:0)+this.g]+(7!=this.f||this.g?0:2)}function nf(a){var b=Ud(this,a);Q(this,Zd(this,a,b,1)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}var of=[7,13,13,17,14,18,17,21]; +function pf(a){var b=Yd(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.H&128||(this.X=b>>16,this.$=this.X|b,this.U=0,this.T=-32768>b||32767>6;if(this.u[b]=this.u[b]-1&65535)N(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function vf(a){S(this,a,Vd(this,a),ye);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)} +function wf(a){S(this,a,0,Ae);this.b-=this.g?9:3+(7==this.f?2:0)}function xf(){this.ja(28,5);this.b-=5}function yf(){this.H&4||this.B.da();this.H|=4;pd(this,-2);this.b-=3}function zf(a){S(this,a,Vd(this,a),Be);this.b-=this.g?9:3+(7==this.f?2:0)}function V(a){var b;if(b=this.i)b=this.i,E(b,"undefined opcode "+J(b,a),!0,!0),b=cc(b);b||this.ja(8,6)}function gd(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){If[a&15].call(this,a)}function Jf(a){Kf[a&15].call(this,a)}function Lf(a){Mf[a>>6&3].call(this,a)}function Nf(a){Of[a>>6&3].call(this,a)}function Pf(a){Qf[a>>6&3].call(this,a)} +var Af=[function(a){Rf[a>>8&15].call(this,a)},mf,af,Le,He,Je,Ce,V,function(a){Sf[a>>8&15].call(this,a)},nf,bf,Me,Ie,Ke,vf,V],Rf=[function(a){Tf[a>>4&15].call(this,a)},Ye,Ve,Ne,Oe,Te,Pe,Re,kf,kf,Bf,Df,Ff,V,V,V],Cf=[function(a){qd(this,$d(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,me);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,qe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,oe);this.b-=this.g?9:3+(7==this.f?2:0)}],Ef=[function(a){S(this,a,0, +se);this.b-=this.g?11:6},function(a){S(this,a,ld(this)?1:0,ce);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,ld(this)?1:0,ye);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Yd(this,a);qd(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],Gf=[function(a){S(this,a,0,we);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ue);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ge);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ee);this.b-=this.g?9:3+(7==this.f?2:0)}], +Tf=[function(a){Uf[a&15].call(this,a)},V,V,V,hf,hf,hf,hf,tf,V,Hf,Jf,wf,wf,wf,wf],Uf=[ef,yf,sf,Xe,ff,rf,V,V,V,V,V,V,V,V,V,V],If=[qf,function(){this.T=0;this.b-=5},function(){this.U=0;this.b-=5},U,function(){this.$=1;this.b-=5},U,U,U,function(){this.X=0;this.b-=5},U,U,U,U,U,U,U],Kf=[qf,function(){this.T=65536;this.b-=5},function(){this.U=32768;this.b-=5},W,function(){this.$=0;this.b-=5},W,W,W,function(){this.X=32768;this.b-=5},W,W,W,W,W,W,W],Sf=[We,Ue,Qe,Se,Ze,$e,Fe,Ge,df,xf,Lf,Nf,Pf,V,V,V],Mf=[function(a){qd(this, +Zd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,ne);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,pe);this.b-=this.g?9:3+(7==this.f?2:0)}],Of=[function(a){R(this,a,0,te);this.b-=this.g?11:6},function(a){R(this,a,ld(this)?1:0,de);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,ld(this)?1:0,ze);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Xd(this,a);qd(this,a<<8);this.b-=this.g?4:3+(7== +this.f?2:0)}],Qf=[function(a){R(this,a,0,xe);this.b-=this.g?9+(this.jb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,he);this.b-=this.g?9+(this.jb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,fe);this.b-=this.g?9:3+(7==this.f?2:0)}];function hd(a){Vf[a>>12].call(this,a)} +var Vf=[function(a){Wf[a>>8&15].call(this,a)},mf,af,Le,He,Je,Ce,function(a){Xf[a>>8&15].call(this,a)},function(a){Yf[a>>8&15].call(this,a)},nf,bf,Me,Ie,Ke,vf,V],Wf=[function(a){Zf[a>>4&15].call(this,a)},Ye,Ve,Ne,Oe,Te,Pe,Re,kf,kf,Bf,Df,Ff,function(a){$f[a>>6&3].call(this,a)},V,V],$f=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.pa(a|this.P);N(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=Sd(this,a,0);ud(this,a);Q(this,a);this.b-=11},function(a){var b=Nd(this);this.J= +this.b;Td(this,a,0,b);Q(this,b);this.b=this.J-of[this.g]},function(a){Q(this,$d(this,a,this.Ma?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Zf=[function(a){ag[a&15].call(this,a)},V,V,V,hf,hf,hf,hf,tf,function(a){a&8?(this.M&49152||(this.M=this.M&-2017|(a&7)<<5,this.H|=1),this.b-=5):V.call(this,a)},Hf,Jf,wf,wf,wf,wf],ag=[ef,yf,sf,Xe,ff,rf,function(){Md(this);this.b-=13},V,V,V,V,V,V,V,V,V],Xf=[pf,pf,cf,cf,De,De,Ee,Ee,zf,zf,V,V,V,V,uf,uf],Yf=[We,Ue,Qe,Se,Ze,$e,Fe,Ge,df,xf,Lf,Nf,Pf,function(a){bg[a>> +6&3].call(this,a)},V,V],bg=[V,function(a){a=Sd(this,a,65536);ud(this,a);Q(this,a);this.b-=11},function(a){var b=Nd(this);this.J=this.b;Td(this,a,65536,b);Q(this,b);this.b=this.J-of[this.g]},V]; +function cg(a){r.call(this,"ROM",a,cg);this.ga=this.f=null;this.C=a.addr;this.g=a.size;this.A=a.alias;this.B=a.file;this.G=ra(this.B);if(this.B){a=this.B;var b=sa(this.G);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?c.O("Unable to load ROM resource (error "+f+": "+a+")"):(mb(c.Ia,a,b),(a=Ea(a,b))?(c.f=a.ea,c.ga=a.ga):c.B=null,dg(c))})}}u(cg);cg.prototype.wa=function(a,b,c,d){this.w=b;this.b=c;this.i=d;dg(this)}; +cg.prototype.za=function(){this.ga&&(this.i&&eg(this.i,this.id,this.C,this.g,this.ga),delete this.ga);return!0};cg.prototype.ya=function(){return!0}; +function dg(a){if(!sb(a)){if(a.B){if(!a.f||!a.w)return;a.g||(a.g=a.f.length);if(a.f.length!=a.g)ub(a,"ROM size ("+l(a.f.length,8,!0)+") does not match specified size ("+l(a.g,8,!0)+")");else{var b;b=a.C;if(ac(a.w,b,a.g,Hc)){var c;for(c=0;c>>a.ka;0=b.length)break;for(var h=h+2,n=b[h++]&255|(b[h++]&255)<<8,q=b[h++]&255|(b[h++]&255)<<8,m=m+((n&255)+(n>>8)+(q&255)+(q>>8)),w=h,v=n-=6;0=b.length)break;m+=b[h++]&255;if(m&255)break;if(v)for(;v--;)a.b.fb(q++,b[w++]&255);else q&1?a.b.ia():kd(a.b,q,f);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e=b)a.preventDefault&&a.preventDefault(),64e.K&&(e.K-=32),e.f|=128,e.f&64&&lc(e.b,e.la))});this.ma=nc(52,4);this.Z=kc(this.b,function(){e.g|=128;e.g&64&&lc(e.b,e.ma)});hc(b,this,Dg);G(this)}; +k.sc=function(){if(!this.J){var a=Uc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=xa(b[0]);if(c!=this.Za)return;b=xa(b[1]);if(this.J=ob(b)){var d=this.J.exports;if(d){var e=d.connect;e&&e.call(this.J);if(this.L=d.receiveData){this.status(this.Ia+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.za=function(a,b){if(!b)if(this.sc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0}; +k.ya=function(a){return a?this.save():!0};k.reset=function(){Eg(this)};k.save=function(){var a=new O(this);a.set(0,[]);return a.data()};k.restore=function(){return Eg(this)};function Eg(a){a.K=0;a.f=0;a.g=128;a.C=[];return!0}k.cc=function(a){if("number"==typeof a)this.C.push(a);else if("string"==typeof a)for(var b=0;b":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.S||8,c=a-this.I%a,this.S&&(b=wa("",c)));this.P&&!this.I&&c&&(b=String.fromCharCode(this.P)+b);this.A.value+=b;this.A.scrollTop=this.A.scrollHeight;this.I+=c}else if(null!=this.G){if(10==a||1024<=this.G.length)this.j(this.G), +this.G="";10!=a&&(this.G+=String.fromCharCode(a))}this.g&=-129;mc(this.b,this.Z,1E3/Math.round(this.R/10))}};var Fg={},Dg=(Fg[65392]=[null,null,X.prototype.pd,X.prototype.ae,"RCSR"],Fg[65394]=[null,null,X.prototype.od,X.prototype.$d,"RBUF"],Fg[65396]=[null,null,X.prototype.Cd,X.prototype.ne,"XCSR"],Fg[65398]=[null,null,X.prototype.Bd,X.prototype.me,"XBUF"],Fg);Wa(function(){for(var a=D(document,"pdp11","serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.F[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.F[b]=c,c.onclick= +function(){var a=d.F.listTapes;a&&Ig(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.R){c.parentNode.removeChild(c);break}this.F[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;Ig(d,ra(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.F[b]=c,!0}return!1}; +k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;this.Y=Jg(a);var e=this;if((this.g=Uc(this.B,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){p("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.P=nc(56,4);this.ba=kc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.Kc.indexOf("/api/v1/dump")&&(e=sa(c),f="json"==e||"gz"==e?encodeURI(c):Fa()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Da(f,null,!0,function(e,f,g){var h=0>g&&a.B&&!a.B.v.ha;g?a.O('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(mb(a.Ia,e,f),(e=Ea(e,f))&&Sg(a,b,c,d,e.ea,e.Ca, +e.Ba));a.v.Qa=!1;a.G&&(a.G--,a.G||G(a));Pg(a)})}function Mg(a,b,c,d){if((a=a.F.listTapes)&&a.options){for(var e=0;e>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.Ha);for(d=0;dc.indexOf("/api/v1/dump")&&(b=sa(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"):ta(c,"/")&&(d="dir"),f=Fa()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.Zb?"":e)+"&format=json"));return!!Da(f, +null,!0,function(b,c,d){Zg(a,b,c,d)})} +function Zg(a,b,c,d){var e=null;a.g=!1;var f=0>d&&a.B&&!a.B.v.ha;if(d)a.controller.O('Unable to load disk "'+a.Oa+'" (error '+d+": "+b+")",f);else{mb(a.controller.Ia,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(h.length)if(1==h.length)p(h[0]);else{a.Ha=h.length;a.Da=h[0].length;a.xa=h[0][0].length;var m=h[0][0][0];a.Ja=m&&m.length||512;for(d=c=0;d>2,q=m.pattern;void 0===q&&(q=m.pattern=0);var w=m.data;if(void 0===w){var v=m.bytes;if(void 0!==v&&v.length){for(var x=n<<2,z=v.length;z>2,e=Array(d),f=0;f>2,g=(h>((f&3)<<3)&255;f=g;if(0>f)break;d|=f<=this.b.length||m>=this.b[h].length||n>=this.b[h][m].length){c="sector (CHS="+h+":"+m+":"+n+") 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(h=this.b[h][m][n]){for(m=h.data.length;mb&&-2!=b&&this.controller.O("Unable to restore disk '"+this.Oa+": "+c);return b}; +Ug.prototype.toJSON=function(){var a;a=0;for(var b;b=ah(this,a++);)ch(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 ch(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)}}function sc(a){r.call(this,"RL11",a,sc,2097152);this.g=a.autoMount||null;this.A=0;this.f=Array(1);this.C=!Oa("Mobi")&&window&&"FileReader"in window}u(sc);k=sc.prototype; +k.qa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.F[b]=c,c.onchange=function(){var a=d.F.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){p("RL11 option error: "+h.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.F[b]=c,c.onchange=function(){var a=pa(c.value,10);null!=a&&dh(d,a)},!0;case "loadDrive":return this.F[b]= +c,c.onclick=function(){var a=d.F.listDisks;a&&eh(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.C){c.parentNode.removeChild(c);break}this.F[b]=c;c.onclick=function(){var a=d.F.listDrives;if(a&&a.options&&d.f)if(a=d.f[pa(a.value,10)||0])if(a=a.Hb){var b;b="";for(var c=0,h;h=ah(a,c++);)for(var m=0,n=h.length;mb;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";dh(this,0)}}return!0};k.ya=function(a){return a?this.save():!0}; +k.reset=function(){for(var a=0;ae||e>=a.f.length)a.O("Unable to load the selected drive");else if(c)if("?"==c)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"')}jh(a,e,b,c,!1,d)}else ih(a,e)} +function jh(a,b,c,d,e,f){var g=-1,h=a.f[b];h.Xa.toLowerCase()!=d.toLowerCase()&&(g++,ih(a,b,!0),h.Yb?a.O("RL11 busy"):(h.Yb=!0,e&&(h.Xb=!0,a.A++,F(a)&&E(a,"auto-loading disk: "+c)),h.Ib=!!f,Yg(new Ug(a,h,"preload"),c,d,f,a.Jc)&&g++));return g} +k.Jc=function(a,b,c,d,e){var f;a.Yb=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.Ha||f[1]>a.Da)&&(this.O('Disk "'+c+'" too large for drive '+("RL"+a.$b)),b=null);b?(a.Hb=b,a.Oa=c,a.Xa=d,this.O('Mounted disk "'+c+'" in drive '+("RL"+a.$b),a.Xb||e),this.B&&this.B.gb()):a.Ib=!1;a.Xb&&(a.Xb=!1,--this.A||G(this));dh(this,a.$b)}; +function gh(a,b,c,d){if((a=a.F.listDisks)&&a.options){for(var e=0;e=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};kh.prototype.oc=function(){return-1};kh.prototype.pc=function(){}; +function mh(a,b,c,d){if(c)if(b){0>a.A&&a.g.length&&(a.A=0);if(0>a.A||b!=a.g[a.A])a.g.splice(0,0,b),a.A=0;a.A--}else a.P?b="end":b=a.g[a.A+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(xa(b.substring(c,f))),c=f+1}}return a} +function nh(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 Vg(a,b,c){var d;if(b){b=Wg(a,b);for(var e=0,f=!1,g=b,h=[],m=[],p=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;g=q+g;d>>=8}d=l(c,0,!0)+" "+c+". "+na(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function Zg(a,b){if(b)return Yg(a,b,a.R[b]);var c=0;for(b in a.R)Yg(a,b,a.R[b]),c++;return 0=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e>=1;g=q+g;d>>=8}d=l(c,0,!0)+" "+c+". "+qa(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function sh(a,b){if(b)return rh(a,b,a.S[b]);var c=0;for(b in a.S)rh(a,b,a.S[b]),c++;return 0this.b.fb?hh:[];ih(this,function(a){a:{var b=d.w.V,c=a[0],e=a=0,m=b.length;if(c){a=d.$(jh(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.w.ia;m=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,p=0;m--;){var q=b[e];q.type==c?p++||d.j("..."):(c=q.type,p=bc[c],q&&d.j(l(q.id,8)+" %"+l(e<d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;db||7a?"R"+a:6==a?"SP":"PC"}k.$b=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ha[a-8]:20>a?b=this.b.wa[a-16]:20==a&&(b=Lb(this.b)));return b}; -k.message=function(a,b){b&&(a+=" @"+J(this,Z(this.b.xb).D));this.na&1073741824?this.ra.push(a):this.aa&&a==this.aa||(this.aa=a,this.na&-2147483648&&(this.ga(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,Zc(a),a.ra=0,a.B.ca()))};function bh(a){var b;if(!Yd(a))a.F&&a.F.length&&a.j("instruction history buffer freed"),a.X=0,a.F=[];else if(!a.F||!a.F.length){a.F=Array(1E3);for(b=0;b>8;this.j("trapped to "+J(this,b&255,1)+(c?" ("+J(this,c)+")":""))}this.K=Z(this.b.u[7]);a&&1!=this.P?qh(this):rh(this)}};function ph(a,b){var c;(c=!a.b||!pb(a.b))||(c=a.b,c.v.ka?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.v.ea?(b||a.j("cpu busy or unavailable, command ignored"),!1):!qb(a.b)}k.Aa=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0}; -k.za=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){bh(this);this.sa=0;this.aa=null;this.J=0;this.K=Z(this.b.u[7]);this.v.ea=!1;sh(this);a||this.ca()};k.save=function(){var a=new O(this);a.set(0,lh(this.K));a.set(1,lh(this.N));a.set(2,[this.g,this.O,this.na]);a.set(3,this.H);return a.data()}; -k.restore=function(a){var b=0;void 0!==a[2]&&(this.K=mh(a[b++]),this.N=mh(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.O=a[b][1],this.na|=a[b][2]);a[3]&&(this.H=a[3]);return!0};k.start=function(a,b){this.P||this.j("running");this.v.ea=!0;this.rb=a;this.sb=b}; -k.stop=function(a,b){if(this.v.ea){this.v.ea=!1;this.J=b-this.sb;if(!this.P){b="stopped";if(this.J){a-=this.rb;var c=0d&&(d=a.b.eb(b)),65535!=(d&65535)&&(c=a.F[a.X],c.D=b,c.Da=!1,++a.X==a.F.length&&(a.X=0)));return!1}function $b(a){var b=a.b;if(b.v.ea)throw N(b,a.b.xb),a.ga(),-1;return!1} -function ah(a){var b,c;a.f=["bp"];if(a.L)for(b=1;b>>d.ia],!1)}a.L=["br"];if(a.C)for(b=1;b>>d.ia],!0);a.C=["bw"];a.Ra=0}k.Wa=function(a,b,c){var d=!0;c||th(this,a,b,!1,!0);if(a!=this.f){var e=this.$(b);if(-1===e)this.j("invalid address: "+J(this,b.D)),d=!1;else{var f=this.w;f.V[e>>>f.ia].Wa(e&f.w,a==this.C)}}d&&(a.push(b),c?b.Da=!0:(uh(this,a,a.length-1,"set"),bh(this)));return d}; -function th(a,b,c,d,e){var f=!1;c=a.$(c);for(var g=1;g>>d.ia],b==a.C));h.Da||bh(a);break}}return f}function vh(a,b){for(var c=1;c>23)&65535,y=J(x,w);else if(8192==A)w=w.D-((f&63)<<1)&65535,y=J(x,w);else if(12288==A)y=J(x,f&7,1);else if(24576==A)y=J(x,f&63,1);else if(32768==A)y=J(x,f&255,1);else if(A=f&E,E&4032&&(A>>=6,E>>=6), -E&63)switch(E=A&7,A&56){case 0:y=oh(E);break;case 8:y="@"+oh(E);break;case 16:7>E?y="("+oh(E)+")+":(A=x.oa(w,2),y="#"+J(x,A,0,!0));break;case 24:7>E?y="@("+oh(E)+")+":(A=x.oa(w,2),y="@#"+J(x,A,0,!0));break;case 32:y="-("+oh(E)+")";break;case 40:y="@-("+oh(E)+")";break;case 48:A=x.oa(w,2);y=J(x,A,0,!0)+"("+oh(E)+")";7==E&&(y=J(x,A+w.D&65535));break;case 56:A=x.oa(w,2),y="@"+J(x,A)+"("+oh(E)+")",7==E&&(y="@"+J(x,A+w.D&65535))}x=y;if(!x||!x.length){h="INVALID";break}"string"!=typeof x&&(p=x[1],x=x[0]); -0b?(c=oh(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Ha[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.wa[b-16]):20==b&&(c="PS="+J(a,Lb(d)));c&&(c+=" ");return c}function Ah(a){var b,c="";for(b=0;6>b;b++)c+=zh(a,b);c=c+"\n"+(zh(a,6)+zh(a,7)+zh(a,20));return c+=yh(a,"T")+yh(a,"N")+yh(a,"Z")+yh(a,"V")+yh(a,"C")}k.Ub=function(a,b){return a[0]>b[0]?1:a[0]>>0,g],v=xa(q,m,a.Ub);0>v&&q.splice(-(v+1),0,m)}p&&(h.a=p.replace(/''/g,'"'))}a.H.push({Wd:b,D:c,uc:d,fa:e,Tb:f})}function Bh(a,b,c){var d=[],e=a.$(b)>>>0;for(b=0;b>>0,h=f.uc;if(e>=g&&eb)){d.u[b]=f&65535;break}a.j("unknown register: "+e);return}a.B.ca();a.j("updated registers:")}a.j(Ah(a));c&&(a.K=Z(d.u[7]),rh(a,J(a,a.K.D)))}}function Fh(a,b){b=va(b);var c=b.match(/^(['"])(.*?)\1$/);c?1h[0].indexOf("+"))){var p=h[0]+":";h[2]&&(p+=" "+h[2]);a.j(p)}h[3]&&(g=h[3],f=null);f=xh(a,b,g,f);a.j(f);a.K=b;e-=b.D-m;c++}}} -function wh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.O&&(a.j("ended assemble at "+J(a,a.N.D)),a.K=a.N,a.O=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.aa=null;if(pb(a)&&0q||"z"ka.length&&(a.j("note: only "+ka.length+" available"),Y=ka.length);ca-=Y;0>ca&&(null==ka[ka.length-1].D?(Y=ca+Y,ca=0):ca+=ka.length);var qd=[];"call"==Yf&&(yb=1E5,qd=["CALL"]);for(void 0!==Xf&&a.j(Y+" instructions earlier:");0=ka.length&&(ca=0);a.Va=Y;$f++;yb--}}$f||(a.j("no "+Zf+"history available"),a.Va=void 0)}else{var Ab=jh(a,ja);if(Ab){var mc=0;Ia&&("l"==Ia.charAt(0)&&(Ia=Ia.substr(1)||Zh),mc=Xg(a,Ia)>>>0,65536>4||1;ai--&&0qc?String.fromCharCode(qc):".";nc-=pc}Bb&&(Bb+="\n");Bb+=ja+" "+rd+(0==Db?" "+cg:"")}Bb&&a.j(Bb);a.Ta=Ab}}}}break;case "e":if("else"==g[0])break;var cb,sd,td,ud,vd=g[0],wd=g[1];"eb"==vd?(cb=1,sd=255,td=a.tb,ud=a.Gb):"e"==vd||"ew"==vd?(cb=2,sd=65535,td=a.oa,ud=a.Za):wd=null;if(null==wd)a.j("edit memory commands:"),a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var rc=jh(a,wd);if(rc)for(var sc=2;sczd;){for(var Ja=null,ei=256;65536>Gb.D>>>0;){Ad.D=a.oa(Gb,2);if(null==Gb.D||!ei--)break;if(!(Ad.D&1)){for(var fi=a,tc=Ad,eg=null,Hb=tc.D,fg=Hb,Bd=1;6>=Bd&&Hb;Bd++){if(2\nLicense: GPL version 3 or later ");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis ");for(b=0;bKh){if(Mh(d,this.J)){this.C=new O(this,"1.30.2","failsafe");Mh(this.C)&&(Rh(this,d),a=2,Sh(this.C));this.C.set("timestamp",Aa());Th(this.C);var e=this.f&&!this.F;if(1==a||Da("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Qh(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Mh(d,g):("error"== -f&&"no machine state"!=g?(this.ja("Error: "+g),"unable to verify user"==g&&(Ka("user",""),this.g=null)):this.j(f+": "+g),Sh(d),Mh(d)?(c=Qh(d),e=!0):c=!1))}e&&Ph(this,c?d:null)}else 2==a&&d.clear()}else Ph(this);delete this.J;delete this.K}e=kb(this.id);for(f=0;fa[1];a=a[2];this.aa=!0;this.v.ka=!0;var d=this.I.power;d&&(d.textContent="Shutdown");this.b&&(Uh(this,this.b,b,c,a),this.b.ab());this.O&&(Rh(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.B=0}; -function Rh(a,b){if(Da("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.2"};d.url=a.Y;d.user=c;d.type="bug";d.data=b;Ba("http://www.pcjs.org/api/v1/report",d,!0)}} -function Hh(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new O(a,"1.30.2"),g=new O(a,"1.30.2","validate"),h=Aa();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.2");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.za&&(c&&a.b.ga(),d=a.b.za(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.ka=!1,!1===d&&(e=null)));for(var h=kb(a.id),m=0;mf.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(q){f=null,a=q.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");Ba(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=h[0],p,q=/( [a-z]+=)(['"])(.*?)\2/g;p=q.exec(f);)m=0>m.indexOf(p[1])?m.replace(">",p[0]+">"):m.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);h[0]!=m&&(g=g.replace(h[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],g);li(a,b,c)}})}else c(a,null)} -function mi(a,b,c,d){function e(a){if(void 0===h){var b=g&&C(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ta(a))}function f(a){e("Error: "+a);m&&(--Yh||Va(!0));m=!1}var g,h,m=!0;Yh++;ib[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=p:v.appendChild(document.createTextNode(p));q.appendChild(v)}c|| -(c="/versions/pdpjs/1.30.2/components.xsl");p=function(d,h){h?ji(c,null,null,!1,e,function(d,m){m?(jb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=h.transformNode(m))?(g.outerHTML=m,--Yh||Va(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Yh||Va(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?ji(b,a,d,!0,e,p):ki(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(w){f(w.message)}return m}window.embedPDP11=function(a,b,c,d){Va(!1);return mi(a,b,c,d)};window.enableEvents=Va;window.sendEvent=Wa;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11-dbg.map +63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},Ah=[0],Bh= +[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=th.prototype; +k.wa=function(a,b,c,d){this.w=b;this.b=c;this.B=a;(a=Uc(a,"messages"))&&wh(this,a);this.jb=zh;this.wb=1145>this.b.mb?Bh:[];Ch(this,function(a){a:{var b=d.w.W,c=a[0],e=a=0,m=b.length;if(c){a=d.aa(Dh(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.w.ka;m=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,n=0;m--;){var q=b[e];q.type==c?n++||d.j("..."):(c=q.type,n=ec[c],q&&d.j(l(q.id,8)+" %"+l(e<d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;db||7a?"R"+a:6==a?"SP":"PC"}k.pc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Na[a-8]:20>a?b=this.b.Aa[a-16]:20==a&&(b=Bb(this.b)));return b}; +k.message=function(a,b){b&&(a+=" @"+J(this,Y(this.b.Db).D));this.na&1073741824?this.ra.push(a):this.ba&&a==this.ba||(this.ba=a,this.na&-2147483648&&(this.ia(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,cd(a),a.ra=0,a.B.da()))};function vh(a){var b;if(!ae(a))a.G&&a.G.length&&a.j("instruction history buffer freed"),a.Y=0,a.G=[];else if(!a.G||!a.G.length){a.G=Array(1E3);for(b=0;b>8;this.j("trapped to "+J(this,b&255,1)+(c?" ("+J(this,c)+")":""))}this.K=Y(this.b.u[7]);a&&1!=this.R?Kh(this):Lh(this)}};function Jh(a,b){var c;(c=!a.b||!sb(a.b))||(c=a.b,c.v.ha?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.v.fa?(b||a.j("cpu busy or unavailable, command ignored"),!1):!tb(a.b)}k.za=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0}; +k.ya=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){vh(this);this.sa=0;this.ba=null;this.J=0;this.K=Y(this.b.u[7]);this.v.fa=!1;Mh(this);a||this.da()};k.save=function(){var a=new O(this);a.set(0,Fh(this.K));a.set(1,Fh(this.N));a.set(2,[this.g,this.P,this.na]);a.set(3,this.I);return a.data()}; +k.restore=function(a){var b=0;void 0!==a[2]&&(this.K=Gh(a[b++]),this.N=Gh(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.P=a[b][1],this.na|=a[b][2]);a[3]&&(this.I=a[3]);return!0};k.start=function(a,b){this.R||this.j("running");this.v.fa=!0;this.xb=a;this.yb=b}; +k.stop=function(a,b){if(this.v.fa){this.v.fa=!1;this.J=b-this.yb;if(!this.R){b="stopped";if(this.J){a-=this.xb;var c=0d&&(d=a.b.lb(b)),65535!=(d&65535)&&(c=a.G[a.Y],c.D=b,c.Ga=!1,++a.Y==a.G.length&&(a.Y=0)));return!1}function cc(a){var b=a.b;if(b.v.fa)throw N(b,a.b.Db),a.ia(),-1;return!1} +function uh(a){var b,c;a.f=["bp"];if(a.L)for(b=1;b>>d.ka],!1)}a.L=["br"];if(a.C)for(b=1;b>>d.ka],!0);a.C=["bw"];a.Ya=0}k.cb=function(a,b,c){var d=!0;c||Nh(this,a,b,!1,!0);if(a!=this.f){var e=this.aa(b);if(-1===e)this.j("invalid address: "+J(this,b.D)),d=!1;else{var f=this.w;f.W[e>>>f.ka].cb(e&f.w,a==this.C)}}d&&(a.push(b),c?b.Ga=!0:(Oh(this,a,a.length-1,"set"),vh(this)));return d}; +function Nh(a,b,c,d,e){var f=!1;c=a.aa(c);for(var g=1;g>>d.ka],b==a.C));h.Ga||vh(a);break}}return f}function Ph(a,b){for(var c=1;c>23)&65535,y=J(x,v);else if(8192==B)v=v.D-((f&63)<<1)&65535,y=J(x,v);else if(12288==B)y=J(x,f&7,1);else if(24576==B)y=J(x,f&63,1);else if(32768==B)y=J(x,f&255,1);else if(B=f&z,z&4032&&(B>>=6,z>>=6), +z&63)switch(z=B&7,B&56){case 0:y=Ih(z);break;case 8:y="@"+Ih(z);break;case 16:7>z?y="("+Ih(z)+")+":(B=x.oa(v,2),y="#"+J(x,B,0,!0));break;case 24:7>z?y="@("+Ih(z)+")+":(B=x.oa(v,2),y="@#"+J(x,B,0,!0));break;case 32:y="-("+Ih(z)+")";break;case 40:y="@-("+Ih(z)+")";break;case 48:B=x.oa(v,2);y=J(x,B,0,!0)+"("+Ih(z)+")";7==z&&(y=J(x,B+v.D&65535));break;case 56:B=x.oa(v,2),y="@"+J(x,B)+"("+Ih(z)+")",7==z&&(y="@"+J(x,B+v.D&65535))}x=y;if(!x||!x.length){h="INVALID";break}"string"!=typeof x&&(n=x[1],x=x[0]); +0b?(c=Ih(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Na[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.Aa[b-16]):20==b&&(c="PS="+J(a,Bb(d)));c&&(c+=" ");return c}function Uh(a){var b,c="";for(b=0;6>b;b++)c+=Th(a,b);c=c+"\n"+(Th(a,6)+Th(a,7)+Th(a,20));return c+=Sh(a,"T")+Sh(a,"N")+Sh(a,"Z")+Sh(a,"V")+Sh(a,"C")}k.ic=function(a,b){return a[0]>b[0]?1:a[0]>>0,g],w=za(q,m,a.ic);0>w&&q.splice(-(w+1),0,m)}n&&(h.a=n.replace(/''/g,'"'))}a.I.push({we:b,D:c,Pc:d,ga:e,gc:f})}function Vh(a,b,c){var d=[],e=a.aa(b)>>>0;for(b=0;b>>0,h=f.Pc;if(e>=g&&eb)){d.u[b]=f&65535;break}a.j("unknown register: "+e);return}a.B.da();a.j("updated registers:")}a.j(Uh(a));c&&(a.K=Y(d.u[7]),Lh(a,J(a,a.K.D)))}}function Zh(a,b){b=xa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1h[0].indexOf("+"))){var n=h[0]+":";h[2]&&(n+=" "+h[2]);a.j(n)}h[3]&&(g=h[3],f=null);f=Rh(a,b,g,f);a.j(f);a.K=b;e-=b.D-m;c++}}} +function Qh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.P&&(a.j("ended assemble at "+J(a,a.N.D)),a.K=a.N,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ba=null;if(sb(a)&&0q||"z"ma.length&&(a.j("note: only "+ma.length+" available"),Z=ma.length);ea-=Z;0>ea&&(null==ma[ma.length-1].D?(Z=ea+Z,ea=0):ea+=ma.length);var xd=[];"call"==kg&&(Db=1E5,xd=["CALL"]);for(void 0!==jg&&a.j(Z+" instructions earlier:");0=ma.length&&(ea=0);a.bb=Z;mg++;Db--}}mg||(a.j("no "+lg+"history available"),a.bb=void 0)}else{var Fb=Dh(a,la);if(Fb){var vc=0;La&&("l"==La.charAt(0)&&(La=La.substr(1)||si),vc=qh(a,La)>>>0,65536>4||1;ui--&&0zc?String.fromCharCode(zc):".";wc-=yc}Gb&&(Gb+="\n");Gb+=la+" "+yd+(0==Ib?" "+pg:"")}Gb&&a.j(Gb);a.$a=Fb}}}}break;case "e":if("else"==g[0])break;var gb,zd,Ad,Bd,Cd=g[0],Dd=g[1];"eb"==Cd?(gb=1,zd=255,Ad=a.zb,Bd=a.Qb):"e"==Cd||"ew"==Cd?(gb=2,zd=65535,Ad=a.oa,Bd=a.hb):Dd=null;if(null==Dd)a.j("edit memory commands:"),a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var Ac=Dh(a,Dd);if(Ac)for(var Bc=2;BcGd;){for(var Ma=null,yi=256;65536>Lb.D>>>0;){Hd.D=a.oa(Lb,2);if(null==Lb.D||!yi--)break;if(!(Hd.D&1)){for(var zi=a,Cc=Hd,rg=null,Mb=Cc.D,sg=Mb,Id=1;6>=Id&&Mb;Id++){if(2\nLicense: GPL version 3 or later ");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis ");for(b=0;bdi){if(fi(d,this.J)){this.C=new O(this,"1.30.2","failsafe");fi(this.C)&&(ki(this,d),a=2,li(this.C));this.C.set("timestamp",Ba());mi(this.C);var e=this.f&&!this.G;if(1==a||Ga("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=ji(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?fi(d,g):("error"== +f&&"no machine state"!=g?(this.O("Error: "+g),"unable to verify user"==g&&(Na("user",""),this.g=null)):this.j(f+": "+g),li(d),fi(d)?(c=ji(d),e=!0):c=!1))}e&&ii(this,c?d:null)}else 2==a&&d.clear()}else ii(this);delete this.J;delete this.K}e=nb(this.id);for(f=0;fa[1];a=a[2];this.ba=!0;this.v.ha=!0;var d=this.F.power;d&&(d.textContent="Shutdown");this.b&&(ni(this,this.b,b,c,a),this.b.ib());this.P&&(ki(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.B=0}; +function ki(a,b){if(Ga("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.2"};d.url=a.Z;d.user=c;d.type="bug";d.data=b;Da("http://www.pcjs.org/api/v1/report",d,!0)}} +function ai(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new O(a,"1.30.2"),g=new O(a,"1.30.2","validate"),h=Ba();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.2");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.ya&&(c&&a.b.ia(),d=a.b.ya(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.ha=!1,!1===d&&(e=null)));for(var h=nb(a.id),m=0;mf.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(q){f=null,a=q.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");Da(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=h[0],n,q=/( [a-z]+=)(['"])(.*?)\2/g;n=q.exec(f);)m=0>m.indexOf(n[1])?m.replace(">",n[0]+">"):m.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);h[0]!=m&&(g=g.replace(h[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],g);Fi(a,b,c)}})}else c(a,null)} +function Gi(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=va(a))}function f(a){e("Error: "+a);m&&(--ri||Ya(!0));m=!1}var g,h,m=!0;ri++;lb[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],w=document.createElement("style");w.type="text/css";w.styleSheet?w.styleSheet.cssText=n:w.appendChild(document.createTextNode(n));q.appendChild(w)}c|| +(c="/versions/pdpjs/1.30.2/components.xsl");n=function(d,h){h?Di(c,null,null,!1,e,function(d,m){m?(mb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=h.transformNode(m))?(g.outerHTML=m,--ri||Ya(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--ri||Ya(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Di(b,a,d,!0,e,n):Ei(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(v){f(v.message)}return m}window.embedPDP11=function(a,b,c,d){Ya(!1);return Gi(a,b,c,d)};window.enableEvents=Ya;window.sendEvent=Za;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11-dbg.map diff --git a/versions/pdpjs/1.30.2/pdp11.js b/versions/pdpjs/1.30.2/pdp11.js index 1184f6fdd..b2aef6efe 100644 --- a/versions/pdpjs/1.30.2/pdp11.js +++ b/versions/pdpjs/1.30.2/pdp11.js @@ -1,4 +1,5 @@ (function(){/* + http://pcjs.org/modules/shared/lib/diskapi.js (C) Jeff Parsons 2012-2016 http://pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2016 http://pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2016 http://pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2016 @@ -25,175 +26,205 @@ http://pcjs.org/modules/pdp11/lib/keyboard.js (C) Jeff Parsons 2012-2016 http://pcjs.org/modules/pdp11/lib/serialport.js (C) Jeff Parsons 2012-2016 http://pcjs.org/modules/pdp11/lib/pc11.js (C) Jeff Parsons 2012-2016 + http://pcjs.org/modules/pdp11/lib/disk.js (C) Jeff Parsons 2012-2016 + http://pcjs.org/modules/pdp11/lib/rl11.js (C) Jeff Parsons 2012-2016 http://pcjs.org/modules/pdp11/lib/computer.js (C) Jeff Parsons 2012-2016 http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016 */ -for(var g,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,ca=["Math","log2"],da=0;da>=3;return""+c}function ja(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d} -function ka(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0":">",'"':""","'":"'"};function pa(a){return a.replace(/[&<>"']/g,function(a){return oa[a]})} -function qa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var ra={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",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"},sa=Date.now||function(){return+new Date}; -function ta(){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 k(a,b,c,d){var e=0,f=null,h=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)}),h;var l=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(l.onreadystatechange=function(){4===l.readyState&&(f=l.responseText,200==l.status||!l.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=l.status||-1),d&&d(a,f,e))});if(b&&"object"== -typeof b){var n="",q;for(q in b)b.hasOwnProperty(q)&&(n&&(n+="&"),n+=q+"="+encodeURIComponent(b[q]));n=n.replace(/%20/g,"+");l.open("POST",a,!!c);l.setRequestHeader("Content-type","application/x-www-form-urlencoded");l.send(n)}else l.open("GET",a,!!c),"bytes"==b&&l.overrideMimeType("text/plain; charset=x-user-defined"),l.send();c||(f=l.responseText,200!=l.status&&(e=l.status||-1),d&&d(a,f,e),h=[f,e]);return h} -function ua(a,b){var c,d={K:null,T:null,$:null,Z:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,h;if("<"==b.substr(0,1))throw Error(b);h=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.$=h.load;d.Z=h.exec;if(e=h.bytes)d.K=e;else if(e=h.words)for(d.K=Array(2*e.length),f=c=0;c>8&255;else if(e=h.data)for(d.K=Array(4*e.length),f=c=0;c>8&255,d.K[f++]=e[c]>>16&255,d.K[f++]=e[c]>>24&255;else d.K=h;d.T=h.symbols;d.K.length?1==d.K.length&&(m(d.K[0]),d=null):(m("Empty resource: "+a),d=null)}catch(l){m("Resource data error ("+a+"): "+l.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;cb?this.La=this.id:(this.ta=this.id.substr(0,b),this.La=this.id.substr(b+1));this[a]=c;this.i={ready:!1,Za:!1,gd:!1,O:!1,error:!1};this.Va=null;this.i.error=!1;this.u={};this.D=null;v.push(this)}var Ia=void 0,Ja={}; -if(window){Ia||(Ia=window.location.search.substr(1));for(var Ka,La=/\+/g,Ma=/([^&=]+)=?([^&]*)/g;Ka=Ma.exec(Ia);)Ja[decodeURIComponent(Ka[1].replace(La," "))]=decodeURIComponent(Ka[2].replace(La," "))}function Na(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} -function w(a,b){b||(b=u);a.prototype=Na(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Oa=window.PCjs.Machines||(window.PCjs.Machines={}),v=window.PCjs.Components||(window.PCjs.Components=[])}else Oa={},v=[];function Pa(a,b,c){Oa[a]&&b&&(Oa[a][b]=c)}function x(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>=3;return""+c}function l(a,b,c){var d="";b?8=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d} +function n(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0":">",'"':""","'":"'"};function oa(a){return a.replace(/[&<>"']/g,function(a){return na[a]})} +function pa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var qa={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",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"},ra=Date.now||function(){return+new Date}; +function sa(){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 q(a,b,c,d){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 m="",p;for(p in b)b.hasOwnProperty(p)&&(m&&(m+="&"),m+=p+"="+encodeURIComponent(b[p]));m=m.replace(/%20/g,"+");k.open("POST",a,!!c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(m)}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 va(a,b){var c,d={L:null,T:null,aa:null,$: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.aa=g.load;d.$=g.exec;if(e=g.bytes)d.L=e;else if(e=g.words)for(d.L=Array(2*e.length),f=c=0;c>8&255;else if(e=g.data)for(d.L=Array(4*e.length),f=c=0;c>8&255,d.L[f++]=e[c]>>16&255,d.L[f++]=e[c]>>24&255;else d.L=g;d.T=g.symbols;d.L.length?1==d.L.length&&(r(d.L[0]),d=null):(r("Empty resource: "+a),d=null)}catch(k){r("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;cb?this.Aa=this.id:(this.ia=this.id.substr(0,b),this.Aa=this.id.substr(b+1));this[a]=c;this.j={ready:!1,jb:!1,Fd:!1,O:!1,error:!1};this.eb=null;this.j.error=!1;this.m={};this.D=null;z.push(this)}var Ja=void 0,Ka={}; +if(window){Ja||(Ja=window.location.search.substr(1));for(var La,Ma=/\+/g,Na=/([^&=]+)=?([^&]*)/g;La=Na.exec(Ja);)Ka[decodeURIComponent(La[1].replace(Ma," "))]=decodeURIComponent(La[2].replace(Ma," "))}function Oa(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b} +function A(a,b){b||(b=y);a.prototype=Oa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Pa=window.PCjs.Machines||(window.PCjs.Machines={}),z=window.PCjs.Components||(window.PCjs.Components=[])}else Pa={},z=[];function Qa(a,b,c){Pa[a]&&b&&(Pa[a][b]=c)}function B(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b>2;this.g=this.c-1;this.v=this.B/this.c|0;this.ma=[];this.l=0;this.s=[];this.Cb=[ab,bb,cb,db];a=new F(this);eb(a,this.D);this.b=Array(this.v);for(b=0;b>8:e[2](b)&255):b&1&&(e=d.ma[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);return 0<=c?c:c=gb(d,b)}function bb(a,b,c){var d=!1,e=this.controller,f=e.ma[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.ma[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d||gb(e,c)} -function cb(a,b){var c=-1,d=this.controller;(a=d.ma[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));return 0<=c?c:c=gb(d,b)}function db(a,b,c){var d=!1,e=this.controller;if(a=e.ma[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d||gb(e,c)}function hb(a,b){if(b!=a.o){var c;a.o&&(c=(1<>>a.j;0h&&(t=h);if(!e&&n&&n.size){if(n.type==d){if(f+h<=n.xa)return n.Xa+=n.xa-f,n.xa=f,!0;if(f>=n.xa+n.Xa){t=n.size-(f-q);t>h&&(t=h);n.Xa=f-n.xa+t;f=q+a.c;h-=t;l++;continue}}return mb(1,f,h)}f=new F(a,f,t,a.c,d,e);eb(f,a.D,n);a.b[l++]=f;f=q+a.c;h-=t}if(0>=h){c/=1024;var z;e="";z?10>>=a.j;0>>=a.j;0>>a.j].fb(b&a.g,b)}function pb(a,b){return a.b[(b&a.h)>>>a.j].S(b&a.g,b)}$a.prototype.Ja=function(a,b){this.l++;this.b[(a&this.h)>>>this.j].mb(a&this.g,b&255,a);this.l--}; -function qb(a,b,c){a.b[(b&a.h)>>>a.j].Ya(b&a.g,c&65535,b)}function rb(a){for(var b=0,c=[],d=0;da.a.Ka)){var h=f[0]?f[0].bind(b):null,l=f[1]?f[1].bind(b):null,n=f[2]?f[2].bind(b):null,q=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!h&&n&&(h=function(a){return function(b){return a(b)&255}.bind(b)}(n)),!l&&q&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(q)));sb(a,e,e,h,l,n,q,f[4])}}}function ub(a,b){a.s.push(b)}function H(a,b){a.l||G(a.a,4,b)} -function mb(a,b,c){m("Memory block error ("+a+": "+ja(b)+","+ja(c)+")");return!1}function I(a){u.call(this,"Device",a,I);this.c={data:0,fd:0,Wa:20,uc:0};this.b={hd:0,kb:-1}}w(I);g=I.prototype;g.ha=function(a,b,c,d){this.j=b;this.a=c;this.D=d;var e=this;this.b.kb=vb(c,function(){e.b.pa|=128;e.b.pa&64&&(wb(e.a,e.b.vc),xb(e.a,e.b.kb,1E3/60))});this.b.vc=yb(64,6);tb(b,this,J);ub(b,this.reset.bind(this));C(this)};g.reset=function(){this.c.Wa=this.c.Wa&-120|20;this.b.pa=0}; -g.Qb=function(){var a=this.b.pa;this.b.pa&=-129;return a};g.Ec=function(a){this.b.pa=a;a&64&&xb(this.a,this.b.kb,1E3/60);this.b.pa=a&-129};g.Jb=function(a){return(a?this.c.uc:this.c.data)&65535};g.xc=function(a){this.c.data=a};g.Sb=function(){var a=this.a;return a.w&62337|a.Ma<<5|a.Na<<1};g.Gc=function(a){var b=this.a;a&=62337;if(b.w!=a){b.w=a;b.Ma=a>>5&3;b.Na=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ha!=c&&(b.Ha=c,zb(b))}Ab(this)}; -g.Tb=function(){var a=this.a.qa;a&65280&&(a=(a<<8|a>>8)&65535);return a};g.Ub=function(){return this.a.hb};g.Vb=function(){return this.a.ra};g.Hc=function(a){var b=this.a;1170>b.Ka&&(a&=-49);b.ra!=a&&(b.ra=a,a&16?(b.bb=4194303,b.Oa=3915776):(b.bb=262143,b.Oa=253952),zb(b));Ab(this)};function Ab(a){a.c.Wa=a.c.Wa&-8|(a.a.Ha?a.a.ra&16?1:2:4)}g.ic=function(a){return this.a.F[1][a>>1&7]};g.Vc=function(a,b){this.a.F[1][b>>1&7]=a&65295};g.gc=function(a){return this.a.F[1][(a>>1&7)+8]}; -g.Tc=function(a,b){this.a.F[1][(b>>1&7)+8]=a&65295};g.hc=function(a){return this.a.U[1][a>>1&7]};g.Uc=function(a,b){b=b>>1&7;this.a.U[1][b]=a;this.a.F[1][b]&=65295};g.fc=function(a){return this.a.U[1][(a>>1&7)+8]};g.Sc=function(a,b){b=(b>>1&7)+8;this.a.U[1][b]=a;this.a.F[1][b]&=65295};g.Pb=function(a){return this.a.F[0][a>>1&7]};g.Dc=function(a,b){this.a.F[0][b>>1&7]=a&65295};g.Nb=function(a){return this.a.F[0][(a>>1&7)+8]};g.Bc=function(a,b){this.a.F[0][(b>>1&7)+8]=a&65295}; -g.Ob=function(a){return this.a.U[0][a>>1&7]};g.Cc=function(a,b){b=b>>1&7;this.a.U[0][b]=a;this.a.F[0][b]&=65295};g.Mb=function(a){return this.a.U[0][(a>>1&7)+8]};g.Ac=function(a,b){b=(b>>1&7)+8;this.a.U[0][b]=a;this.a.F[0][b]&=65295};g.oc=function(a){return this.a.F[3][a>>1&7]};g.ad=function(a,b){this.a.F[3][b>>1&7]=a&65295};g.mc=function(a){return this.a.F[3][(a>>1&7)+8]};g.Zc=function(a,b){this.a.F[3][(b>>1&7)+8]=a&65295};g.nc=function(a){return this.a.U[3][a>>1&7]}; -g.$c=function(a,b){b=b>>1&7;this.a.U[3][b]=a;this.a.F[3][b]&=65295};g.lc=function(a){return this.a.U[3][(a>>1&7)+8]};g.Yc=function(a,b){b=(b>>1&7)+8;this.a.U[3][b]=a;this.a.F[3][b]&=65295};g.za=function(a){a&=7;return this.a.A&2048?this.a.wa[a]:this.a.f[a]};g.Ba=function(a,b){b&=7;this.a.A&2048?this.a.wa[b]=a:this.a.f[b]=a};g.$b=function(){return this.a.A&49152?this.a.ca[0]:this.a.f[6]};g.Mc=function(a){this.a.A&49152?this.a.ca[0]=a:this.a.f[6]=a};g.cc=function(){return this.a.f[7]}; -g.Pc=function(a){this.a.f[7]=a};g.Aa=function(a){a&=7;return this.a.A&2048?this.a.f[a]:this.a.wa[a]};g.Ca=function(a,b){b&=7;this.a.A&2048?this.a.f[b]=a:this.a.wa[b]=a};g.ac=function(){return 1==(this.a.A&49152)>>14?this.a.f[6]:this.a.ca[1]};g.Nc=function(a){1==(this.a.A&49152)>>14?this.a.f[6]=a:this.a.ca[1]=a};g.bc=function(){return 3==(this.a.A&49152)>>14?this.a.f[6]:this.a.ca[3]};g.Oc=function(a){3==(this.a.A&49152)>>14?this.a.f[6]=a:this.a.ca[3]=a};g.Lb=function(a){return this.a.yb[a-65504>>1]}; -g.zc=function(a,b){this.a.yb[b-65504>>1]=a};g.wb=function(a){return 65520==a?61183:0};g.Bb=function(){};g.kc=function(){return 1};g.Xc=function(){};g.Kb=function(){return this.a.I};g.yc=function(){this.a.I=0};g.Rb=function(){return this.a.xb};g.Fc=function(a,b){b&1||(a&=255);this.a.xb=a};g.Wb=function(a){return a?this.a.ib:0};g.Ic=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.ib=a;b.m|=2};g.jc=function(a){return a?this.a.sa&65280:0};g.Wc=function(a){this.a.sa=a|255}; -g.Zb=function(){return Za(this.a)};g.Lc=function(a){Bb(this.a,a&-1809|Za(this.a)&1808);this.a.m|=128};g.Ab=function(){}; -var K={},J=(K[62592]=[null,null,I.prototype.ic,I.prototype.Vc,"SISDR",1145],K[62608]=[null,null,I.prototype.gc,I.prototype.Tc,"SDSDR",1145],K[62624]=[null,null,I.prototype.hc,I.prototype.Uc,"SISAR",1145],K[62640]=[null,null,I.prototype.fc,I.prototype.Sc,"SDSAR",1145],K[62656]=[null,null,I.prototype.Pb,I.prototype.Dc,"KISDR",1145],K[62672]=[null,null,I.prototype.Nb,I.prototype.Bc,"KDSDR",1145],K[62688]=[null,null,I.prototype.Ob,I.prototype.Cc,"KISAR",1145],K[62704]=[null,null,I.prototype.Mb,I.prototype.Ac, -"KDSAR",1145],K[62798]=[null,null,I.prototype.Vb,I.prototype.Hc,"MMR3",1145],K[65382]=[null,null,I.prototype.Qb,I.prototype.Ec,"LKS"],K[65400]=[null,null,I.prototype.Jb,I.prototype.xc,"CNSL"],K[65402]=[null,null,I.prototype.Sb,I.prototype.Gc,"MMR0",1145],K[65404]=[null,null,I.prototype.Tb,I.prototype.Ab,"MMR1",1145],K[65406]=[null,null,I.prototype.Ub,I.prototype.Ab,"MMR2",1145],K[65408]=[null,null,I.prototype.oc,I.prototype.ad,"UISDR",1145],K[65424]=[null,null,I.prototype.mc,I.prototype.Zc,"UDSDR", -1145],K[65440]=[null,null,I.prototype.nc,I.prototype.$c,"UISAR",1145],K[65456]=[null,null,I.prototype.lc,I.prototype.Yc,"UDSAR",1145],K[65472]=[null,null,I.prototype.za,I.prototype.Ba,"R0SET0"],K[65473]=[null,null,I.prototype.za,I.prototype.Ba,"R1SET0"],K[65474]=[null,null,I.prototype.za,I.prototype.Ba,"R2SET0"],K[65475]=[null,null,I.prototype.za,I.prototype.Ba,"R3SET0"],K[65476]=[null,null,I.prototype.za,I.prototype.Ba,"R4SET0"],K[65477]=[null,null,I.prototype.za,I.prototype.Ba,"R5SET0"],K[65478]= -[null,null,I.prototype.$b,I.prototype.Mc,"R6KERNEL"],K[65479]=[null,null,I.prototype.cc,I.prototype.Pc,"R7KERNEL"],K[65480]=[null,null,I.prototype.Aa,I.prototype.Ca,"R0SET1",1145],K[65481]=[null,null,I.prototype.Aa,I.prototype.Ca,"R1SET1",1145],K[65482]=[null,null,I.prototype.Aa,I.prototype.Ca,"R2SET1",1145],K[65483]=[null,null,I.prototype.Aa,I.prototype.Ca,"R3SET1",1145],K[65484]=[null,null,I.prototype.Aa,I.prototype.Ca,"R4SET1",1145],K[65485]=[null,null,I.prototype.Aa,I.prototype.Ca,"R5SET1",1145], -K[65486]=[null,null,I.prototype.ac,I.prototype.Nc,"R6SUPER",1145],K[65487]=[null,null,I.prototype.bc,I.prototype.Oc,"R6USER",1145],K[65504]=[null,null,I.prototype.Lb,I.prototype.zc,"CTRL",1170],K[65520]=[null,null,I.prototype.wb,I.prototype.Bb,"LSIZE",1170],K[65522]=[null,null,I.prototype.wb,I.prototype.Bb,"HSIZE",1170],K[65524]=[null,null,I.prototype.kc,I.prototype.Xc,"SYSID",1170],K[65526]=[null,null,I.prototype.Kb,I.prototype.yc,"CPUERR",1170],K[65528]=[null,null,I.prototype.Rb,I.prototype.Fc, -"MB",1170],K[65530]=[null,null,I.prototype.Wb,I.prototype.Ic,"PIR"],K[65532]=[null,null,I.prototype.jc,I.prototype.Wc,"SL"],K[65534]=[null,null,I.prototype.Zb,I.prototype.Lc,"PSW"],K);J[62594]=J[62592];J[62596]=J[62592];J[62598]=J[62592];J[62600]=J[62592];J[62602]=J[62592];J[62604]=J[62592];J[62606]=J[62592];J[62610]=J[62608];J[62612]=J[62608];J[62614]=J[62608];J[62616]=J[62608];J[62618]=J[62608];J[62620]=J[62608];J[62622]=J[62608];J[62626]=J[62624];J[62628]=J[62624];J[62630]=J[62624];J[62632]=J[62624]; -J[62634]=J[62624];J[62636]=J[62624];J[62638]=J[62624];J[62642]=J[62640];J[62644]=J[62640];J[62646]=J[62640];J[62648]=J[62640];J[62650]=J[62640];J[62652]=J[62640];J[62654]=J[62640];J[62658]=J[62656];J[62660]=J[62656];J[62662]=J[62656];J[62664]=J[62656];J[62666]=J[62656];J[62668]=J[62656];J[62670]=J[62656];J[62674]=J[62672];J[62676]=J[62672];J[62678]=J[62672];J[62680]=J[62672];J[62682]=J[62672];J[62684]=J[62672];J[62686]=J[62672];J[62690]=J[62688];J[62692]=J[62688];J[62694]=J[62688];J[62696]=J[62688]; -J[62698]=J[62688];J[62700]=J[62688];J[62702]=J[62688];J[62706]=J[62704];J[62708]=J[62704];J[62710]=J[62704];J[62712]=J[62704];J[62714]=J[62704];J[62716]=J[62704];J[62718]=J[62704];J[65410]=J[65408];J[65412]=J[65408];J[65414]=J[65408];J[65416]=J[65408];J[65418]=J[65408];J[65420]=J[65408];J[65422]=J[65408];J[65426]=J[65424];J[65428]=J[65424];J[65430]=J[65424];J[65432]=J[65424];J[65434]=J[65424];J[65436]=J[65424];J[65438]=J[65424];J[65442]=J[65440];J[65444]=J[65440];J[65446]=J[65440];J[65448]=J[65440]; -J[65450]=J[65440];J[65452]=J[65440];J[65454]=J[65440];J[65458]=J[65456];J[65460]=J[65456];J[65462]=J[65456];J[65464]=J[65456];J[65466]=J[65456];J[65468]=J[65456];J[65470]=J[65456];J[65506]=J[65504];J[65508]=J[65504];J[65510]=J[65504];J[65512]=J[65504];J[65514]=J[65504];J[65516]=J[65504];J[65518]=J[65504];r(function(){for(var a=B(document,"pdp11","device"),b=0;b>1),this.a=new Int32Array(this.c,0,this.size>>2),Ib(this,Eb?Jb:Kb);else{a=this.a=Array(this.size>> -2);for(f=0;f>2),b=0;b>8,c)},M:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ea:function(a,b){a&1&&H(this.j,b);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},ja: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.na=!0}, -G:function(a,b){return this.H(a,b)},P:function(a,b){return this.V(a,b)},ga:function(a,b,c){this.g?this.h(a,b,c):this.mb(a,b,c)},la:function(a,b,c){this.g?this.h(a,b,c):this.ta(a,b,c)},C:function(a){return this.b[a]},J:function(a){return this.b[a]},N:function(a,b){a&1&&H(this.j,b);return this.u.getUint16(a,!0)},W:function(a,b){a&1&&H(this.j,b);return this.s[a>>1]},fa:function(a,b){this.b[a]=b;this.na=!0},ia:function(a,b){this.b[a]=b;this.na=!0},ka:function(a,b,c){a&1&&H(this.j,c);this.u.setUint16(a, -b,!0);this.na=!0},ua:function(a,b,c){a&1&&H(this.j,c);this.s[a>>1]=b;this.na=!0}};function eb(a,b,c){a.D=b;a.o=a.l=0;c&&((a.o=c.o)&&Mb(a,Nb,!1),(a.l=c.l)&&Ob(a,Nb,!1))}function Ob(a,b,c){c&&a.l||(a.lb=!a.g&&b[1]||a.h,a.Ya=!a.g&&b[3]||a.B);if(c||void 0===c)a.mb=b[1]||a.h,a.ta=b[3]||a.B}function Mb(a,b,c){c&&a.o||(a.fb=b[0]||a.v,a.S=b[2]||a.w);if(c||void 0===c)a.H=b[0]||a.v,a.V=b[2]||a.w}function Ib(a,b){b||(b=Pb);Mb(a,b,void 0);Ob(a,b,void 0)} -var Pb=[],Lb=[F.prototype.M,F.prototype.ja,F.prototype.ea,F.prototype.va],Nb=[F.prototype.G,F.prototype.ga,F.prototype.P,F.prototype.la];if(Ua)var Kb=[F.prototype.C,F.prototype.fa,F.prototype.N,F.prototype.ka],Jb=[F.prototype.J,F.prototype.ia,F.prototype.W,F.prototype.ua]; -function Qb(a,b){u.call(this,"CPU",a,Qb);var c=a.multiplier||1;this.Ta=a.cycles||b;this.ga=c;this.ab=Math.round(this.Ta/1E4)/100;this.ia=this.ab*this.ga;this.i.X=!1;this.i.jb=!1;this.i.Fa=a.autoStart;this.i.Sa=!1;this.Qa=this.ka=0;this.Ra=a.csStart;this.ua=a.csInterval;this.va=a.csStop;this.H=[];this.vb=this.tc.bind(this);C(this)}w(Qb);var Rb=["power","reset"];g=Qb.prototype; -g.ha=function(a,b,c,d){this.o=a;this.j=b;this.D=d;for(b=0;ba.ea/a.ia&&(b=1);a.ga=b;b=a.ab*a.ga;if(a.ia!=b){a.ia=b;b=a.ia.toFixed(2)+"Mhz";var d=a.u.setSpeed;d&&(d.textContent=b);a.R("target speed: "+b)}c&&a.o&&(c=a.o,c.Ga&&(d=b=0,window&&(b=window.scrollX,d=window.scrollY),c.Ga.focus(),window&&window.scrollTo(b,d)))}a.M+=a.W;a.W=0;a.V=sa();a.fa=0;Xb(a)}function vb(a,b){var c=a.H.length;a.H.push([-1,b]);return c}function xb(a,b,c){0<=b&&ba.H[b][0]&&(c=a.Ta*a.ga/1E3*c|0,a.H[b][0]=c+Zb(a))} -function Zb(a,b){var c=a.ja-=a.a;a.a=a.G=0;b&&(a.ja=0);return c} -g.tc=function(){if(this.i.X){this.cb>=this.Ta&&Xb(this,!0);this.Ea=0;this.Pa=sa();if(this.fa){var a=this.Pa-this.fa;a>this.tb&&(this.V+=a,this.V>this.Pa&&(this.V=this.Pa))}try{do{for(var b,c=this.i.Sa?1:this.Ua,d=this.H.length-1;0<=d;d--){var e=this.H[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.zb(b)}catch(n){if("number"!=typeof n)throw n;}b=Zb(this,!0);this.Ea+=b;this.W+=b;a=b;if(this.i.Sa){var f=!1;this.Qa=this.Qa+this.pb()|0;this.ka-=a;0>=this.ka&&(this.ka+=this.ua,f=!0);0<=this.va&&this.va<=Yb(this)&& -(this.ua=this.va=-1,Ub(this),D(this),f=!0);f&&this.R(Yb(this)+" cycles: checksum="+ja(this.Qa))}for(var a=b,h=this.H.length-1;0<=h;h--){var l=this.H[h];0>l[0]||(l[0]-=a,0>=l[0]&&(l[0]=-1,l[1]()))}this.Da-=b;if(0>=this.Da){this.Da+=this.Ua;15<=++this.ub&&(this.o&&this.o.da(),this.ub=0);break}}while(this.i.X)}catch(n){D(this);this.o&&this.o.stop(sa(),Yb(this));b=n.stack||n.message;this.i.error=!0;this.L(b);return}if(this.i.X){b=setTimeout;c=this.vb;this.fa=sa();d=this.tb;this.Ea&&(d=Math.round(d*this.Ea/ -this.Ua));d-=this.fa-this.Pa;if(e=this.fa-this.V)this.ea=Math.round(this.W/(10*e))/100,864E5<=e&&(this.M=0,Wb(this));if(0>d||this.ead&&(this.V-=d),d=0;this.cb+=this.Ea;this.fa+=d;b(c,d)}}};function Vb(a){var b;a.i.error?(a.R(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.i.X)a.R(a.toString()+" busy");else{Wb(a);a.i.X=!0;a.i.jb=!0;if(b=a.u.run)b.textContent="Halt";a.o&&a.o.start(a.V,Yb(a));setTimeout(a.vb,0)}}g.zb=function(){return 0}; -function D(a){var b=!1;if(a.i.X){Zb(a);a.M+=a.W;a.W=0;a.i.X=!1;if(b=a.u.run)b.textContent="Run";a.o&&a.o.stop(sa(),Yb(a));b=!0}a.i.complete=void 0;return b}function $b(a){this.Ka=+a.model||1170;this.rb=a.addrReset||0;Qb.call(this,a,6666667);this.decode=1120==this.Ka?ac.bind(this):bc.bind(this);cc(this);this.eb=0;this.N=null;this.i.complete=!1}w($b,Qb);g=$b.prototype;g.reset=function(){this.status("model "+this.Ka);this.i.X&&D(this);cc(this);Tb(this);this.i.error=!1;this.parent.reset.call(this)}; -function cc(a){a.l=65536;a.g=32768;a.h=65535;a.s=32768;a.A=15;a.f=[0,0,0,0,0,0,0,a.rb];a.wa=[0,0,0,0,0,0];a.ca=[0,0,0,0];a.v=0;a.Na=0;a.Gb=[4,2,0,1];a.F=[[0,0,0,0,0,0,0,0,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],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.U=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Ib=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.yb=[0,0,0,0,0,0,0,0];a.xb=0;a.m=0;a.B=a.C=0;a.c=a.b=a.$a=0;a.la=-1;dc(a)}function dc(a){a.sa=255;a.I=0;a.ib=0;a.w=0;a.qa=0;a.hb=0;a.ra=0;a.Ha=0;a.Ma=0;a.bb=262143;a.Oa=253952;a.N=null;a.j&&zb(a)}function zb(a){a.Ha?(a.P=65536,a.J=a.Fb,a.S=a.qc,a.Ya=a.cd,hb(a.j,a.ra&16?22:18)):(a.P=0,a.J=a.Eb,a.S=a.pc,a.Ya=a.bd,hb(a.j,16))}function ec(a,b,c){a.rb=b;M(a,b);!c&&a.D&&(D(a)||a.D.da())}g.pb=function(){return 0}; -g.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.M,this.ga]);a.set(2,rb(this.j));return a.data()};g.restore=function(a){var b=a[1];this.M=b[1];Wb(this,b[3]);a:{b=this.j;a=a[2];var c;for(c=0;c>14&3;c=a.A>>14&3;a.v!=c&&(a.ca[c]=a.f[6],a.f[6]=a.ca[a.v]);a.A=b;a.m|=2}function P(a,b){a.m&128||(a.s=a.h=b,a.g=0)}function Q(a,b,c){a.m&128||(a.s=a.h=a.l=b,a.g=c||0)}function hc(a,b,c,d){a.m&128||(a.s=a.h=a.l=b,a.g=(c^b)&(d^b))}function R(a,b){a.m&128||(a.s=a.h=a.l=b,a.g=a.s^a.l>>1)}function ic(a,b,c,d){a.m&128||(a.s=a.h=a.l=b,a.g=(c^d)&(d^b))} -function G(a,b,c){if(!a.eb){var d=!1;0>a.la?a.la=Za(a):a.v||(b=4,d=!0);a.w&57344||(a.qa=63222,a.hb=b);a.v=0;var e=a.S(b|a.P),f=a.S(b+2&65535|a.P);Bb(a,f&-12289|a.la>>2&12288);d&&(a.I|=4,a.f[6]=4);jc(a,a.la);jc(a,a.f[7]);M(a,e);a.m&=-113;a.la=-1;a.m|=8;if(26!=c)throw b;}}function kc(a){var b=lc(a),c=lc(a)&-1793;a.A&49152&&(c=c&-225|a.A&63712);M(a,b);Bb(a,c);a.m&=-17} -function mc(a,b,c){var d,e,f,h=0;d=b>>13;a.ra&a.Gb[a.v]||(d&=7);e=a.F[a.v][d];f=(a.U[a.v][d]<<6)+(b&8191)&a.bb;if(ff){if(3932160<=f){f&=262143;var l=f>>13&31;31>l?a.ra&32&&(f=a.Ib[l]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Oa&&4186112>f&&(a.I|=32,G(a,4,12))}switch(e&7){case 1:h=4096;case 2:e|=128;c&4&&(h=8192);break;case 4:h=4096;case 5:c&4&&(h=4096);case 6:e|=c&4?192: -128;break;default:h=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(h|=16384):(b&8128)>(e>>2&8128)&&(h|=16384));a.F[a.v][d]=e;if(4194170!==f||a.v)a.Ma=a.v,a.Na=d;h&&(h&57344&&(0<=a.la&&(h|=128),a.w&57344||(a.w=a.w|h|a.Ma<<5|a.Na<<1),G(a,168,16)),a.w&61440||!(4191360>f||4194239>>a.j].lb(b&a.g,c&255,b)}function lc(a){var b=a.S(a.f[6]|a.P);a.f[6]=a.f[6]+2&65535;return b} -function jc(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.w&57344||(a.qa=a.qa<<8|246);!a.v&&c<=a.sa&&4c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.f[c];7!==c&&(e|=h);e=a.S(e);e|=h;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.f[c]+f&65535;7!==c&&(e|=h);a.a-=4;break;case 5:f=-2;e=a.f[c]-2&65535;7!==c&&(e|=h);e=a.S(e)|h;a.a-= -8;break;case 6:return e=a.S(gc(a,2)),e=e+a.f[c]&65535|h,a.a-=6,e;case 7:return e=a.S(gc(a,2)),e=e+a.f[c]&65535,e=a.S(e|a.P)|h,a.a-=10,e}a.f[c]=a.f[c]+f&65535;!h||a.w&57344||(a.qa=a.qa<<8|f<<3&248|c);6==c&&!a.v&&d&4&&0>=f&&(a.f[6]<=a.sa||65534<=a.f[6])&&(a.f[6]<=a.sa-32?(a.I|=4,a.f[6]=4,G(a,4,24)):(a.I|=8,a.m|=64));return e}g.Ja=function(a,b){this.Ha?(this.eb++,nc(this,mc(this,a,5),b),this.eb--):this.j.Ja(a,b)};g.Eb=function(a,b,c){return oc(this,a,b,c)}; -g.Fb=function(a,b,c){return mc(this,oc(this,a,b,c),c)};g.pc=function(a){return pb(this.j,a)};g.qc=function(a){return pb(this.j,mc(this,a,2))};g.bd=function(a,b){qb(this.j,a,b&65535)};g.cd=function(a,b){qb(this.j,mc(this,a,4),b)};function pc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=oc(a,b,d,2),c&65536||61440!==(a.A&61440)&&(d&=65535),a.v=a.A>>12&3,c=a.S(d|c&a.P),a.v=a.A>>14&3):c=6!=d||(a.A>>2&12288)===(a.A&12288)?a.f[d]:a.ca[a.A>>12&3];return c} -function qc(a,b,c,d){a.w&57344||(a.qa=22);var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=oc(a,b,e,4),c&65536||(e&=65535),a.v=a.A>>12&3,e=mc(a,e|c&65536,4),a.v=a.A>>14&3,qb(a.j,e,d)):6!=e||(a.A>>2&12288)===(a.A&12288)?a.f[e]=d:a.ca[a.A>>12&3]=d}function rc(a,b){b>>=6;var c=a.C=b&7;(b=a.B=(b&56)>>3)?(c=a.J(b,c,3),a=ob(a.j,c)):a=a.f[c]&255;return a}function S(a,b){b>>=6;var c=a.C=b&7;return(b=a.B=(b&56)>>3)?pb(a.j,a.J(b,c,2)):a.f[c]}function sc(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return oc(a,b,c,8)} -function tc(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.J(b,c,3),a=ob(a.j,c)):a=a.f[c]&255;return a}function uc(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?pb(a.j,a.J(b,c,2)):a.f[c]}function T(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.$a=a.J(b,e,7),nc(a,e,d.call(a,c,ob(a.j,e)))):a.f[e]=a.f[e]&65280|d.call(a,c,a.f[e])}function U(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.J(b,e,6),qb(a.j,e,d.call(a,c,pb(a.j,e)))):a.f[e]=d.call(a,c,a.f[e])} -function vc(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?nc(a,a.J(b,e,5),c):a.f[e]=c?d&1?c<<24>>24&65535:a.f[e]&-256|c&255:a.f[e]&-256;return c}function wc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?qb(a.j,a.J(b,d,4),c):a.f[d]=c&65535;return c}function V(a,b,c){c&&(M(a,a.f[7]+(b<<24>>23)),a.a-=2);a.a-=3} -g.zb=function(a){this.i.complete=!0;var b=a?this.i.jb?0:1:-1;this.i.jb=!1;this.ja=this.a=a;do{if(this.m){this.m&112&&(this.m&32?G(this,168,28):this.m&64?G(this,4,30):this.m&16&&G(this,12,32),this.m&=-113);if(a=this.m&7){a=!1;if(this.m&2){this.m&=-3;var c=160,d=(this.ib&224)>>5,e=this.N&&this.N.ya>d?this.N:null;e&&(c=e.wc,d=e.ya);d>(this.A&224)>>5?(this.m&4&&(gc(this,2),this.m&=-5),G(this,c,26),d=!0):d=!1;if(d){if(e)if(a=e,e=this.N,e==a)this.N=a.next;else for(;e;){d=e.next;if(d==a){e.next=d.next;break}e= -d}a=!0}}else this.m&1&&this.m++;a=a&&0>b}if(a)break}this.m=this.m&7|this.A&16;this.decode(fc(this))}while(0>1|b<<16;R(this,a);return a&65535}function Cc(a,b){a=b&2048|b>>1|b<<8;R(this,a<<8);return a&255}function Dc(a,b){a=b&~a;P(this,a);return a}function Ec(a,b){a=b&~a;P(this,a<<8);return a}function Fc(a,b){a|=b;P(this,a);return a}function Gc(a,b){a|=b;P(this,a<<8);return a}function Hc(a,b){a=~b|65536;Q(this,a);return a&65535}function Ic(a,b){a=~b|256;Q(this,a<<8);return a&255} -function Jc(a,b){a=b-a;this.m&128||(this.s=this.h=a,this.g=b&(b^a));return a&65535}function Kc(a,b){a=b-a;var c=a<<8;b<<=8;this.m&128||(this.s=this.h=c,this.g=b&(b^c));return a&255}function Lc(a,b){a=b+a;this.m&128||(this.s=this.h=a,this.g=a&(b^a));return a&65535}function Mc(a,b){a=b+a;var c=a<<8;this.m&128||(this.s=this.h=c,this.g=c&(b<<8^c));return a&255}function Nc(a,b){a=-b;Q(this,a,a&b&32768);return a&65535}function Oc(a,b){a=-b;Q(this,a<<8,(a&b&128)<<8);return a&255} -function Pc(a,b){a=b<<1|this.l>>16&1;R(this,a);return a&65535}function Qc(a,b){a=b<<1|this.l>>16&1;R(this,a<<8);return a&255}function Rc(a,b){a=(this.l&65536|b)>>1|b<<16;R(this,a);return a&65535}function Sc(a,b){a=((this.l&65536)>>8|b)>>1|b<<8;R(this,a<<8);return a&255}function Tc(a,b){var c=b-a;ic(this,c,a,b);return c&65535}function Uc(a,b){var c=b-a;ic(this,c<<8,a<<8,b<<8);return c&255}function Vc(a,b){this.m&128||(this.s=this.h=b&65280,this.g=this.l=0);return(b<<8|b>>8)&65535} -function Wc(a,b){a^=b;P(this,a);return a&65535}function Xc(a){U(this,a,S(this,a),xc);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function Yc(a){var b=uc(this,a);a=a>>6&7;var c=this.f[a];c&32768&&(c|=4294901760);this.l=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.f[a]=c&65535;this.s=this.h=c;this.a-=(this.c?6:7)+b} -function Zc(a){var b=uc(this,a);a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.l=this.g=0;b&=63;if(b&32){b=64-b;32>b-1;this.l=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.f[a|1]=d&65535;this.s=d>>16;this.h=d>>16|d;this.a-=(this.c?6:7)+b}function $c(a){V(this,a,!O(this))}function ad(a){V(this,a,O(this))} -function bd(a){U(this,a,S(this,a),Dc);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function cd(a){T(this,a,rc(this,a),Ec);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function dd(a){U(this,a,S(this,a),Fc);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function ed(a){T(this,a,rc(this,a),Gc);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)} -function fd(a){P(this,S(this,a)&uc(this,a));this.a-=this.c?4+(this.C&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function gd(a){P(this,(rc(this,a)&tc(this,a))<<8);this.a-=this.c?4+(this.C&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function hd(a){V(this,a,this.h&65535?0:4)}function id(a){V(this,a,!this.oa()==!(this.g&32768))}function jd(a){V(this,a,!!(this.h&65535)&&!this.oa()==!(this.g&32768))}function kd(a){V(this,a,!O(this)&&!!(this.h&65535))} -function ld(a){V(this,a,(this.h&65535?0:4)||!this.oa()!=!(this.g&32768))}function md(a){V(this,a,O(this)||(this.h&65535?0:4))}function nd(a){V(this,a,!this.oa()!=!(this.g&32768))}function od(a){V(this,a,this.oa())}function pd(a){V(this,a,!!(this.h&65535))}function qd(a){V(this,a,!this.oa())}function rd(){G(this,12,1);this.a-=5}function sd(a){V(this,a,!0)}function td(a){V(this,a,!(this.g&32768))}function ud(a){V(this,a,this.g&32768?2:0)} -function W(a){a&1&&(this.l=0);a&2&&(this.g=0);a&4&&(this.h=1);a&8&&(this.s=0);this.a-=5}function vd(a){var b=S(this,a);a=uc(this,a);ic(this,b-a,a,b);this.a-=this.c?4+(this.C&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function wd(a){var b=rc(this,a)<<8;a=tc(this,a)<<8;ic(this,b-a,a,b);this.a-=this.c?4+(this.C&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)} -function xd(a){var b=uc(this,a);if(b){a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.l=this.g=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.f[a]=d&65535,this.f[a|1]=c-d*b&65535,this.h=d>>16|d,this.s=d>>16):(this.g=32768,this.h=d>>15|d,this.s=c>>16,-1===b&&65534===this.f[a]&&(this.f[a]=this.f[a|1]=1));this.a-=53}else this.h=this.s=0,this.g=32768,this.l=65536,this.a-=7}function yd(){G(this,24,2);this.a-=25} -function zd(){this.A&49152?(this.I|=128,G(this,4,3)):this.D?this.D.c():D(this);this.a-=7}function Ad(){G(this,16,4);this.a-=25}var Bd=[0,7,7,10,7,11,9,13];function Cd(a){this.G=this.a;M(this,sc(this,a));this.a=this.G-Bd[this.c]}var Dd=[0,14,14,17,14,18,16,20];function Ed(a){this.G=this.a;var b=sc(this,a);a=a>>6&7;jc(this,this.f[a]);this.f[a]=this.f[7];M(this,b);this.a=this.G-Dd[this.c]}var Fd=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17]; -function Gd(a){var b=S(this,a);this.G=this.a;P(this,wc(this,a,b));this.a=this.G-Fd[(this.B?8:0)+this.c]+(7!=this.b||this.c?0:2)}function Hd(a){var b=rc(this,a);P(this,vc(this,a,b,1)<<8);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}var Id=[7,13,13,17,14,18,17,21]; -function Jd(a){var b=uc(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.f[a];c&32768&&(c|=-65536);b=~~(b*c);this.f[a]=b>>16&65535;this.f[a|1]=b&65535;this.m&128||(this.s=b>>16,this.h=this.s|b,this.g=0,this.l=-32768>b||32767>6;if(this.f[b]=this.f[b]-1&65535)M(this,this.f[7]-((a&63)<<1)),this.a+=1;this.a-=6}function Pd(a){U(this,a,S(this,a),Tc);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)} -function Qd(a){U(this,a,0,Vc);this.a-=this.c?9:3+(7==this.b?2:0)}function Rd(){G(this,28,5);this.a-=5}function Sd(){this.m&4||this.o.da();this.m|=4;gc(this,-2);this.a-=3}function Td(a){U(this,a,S(this,a),Wc);this.a-=this.c?9:3+(7==this.b?2:0)}function Y(){G(this,8,6)}function ac(a){Ud[a>>12].call(this,a)}function Vd(a){Wd[a>>6&3].call(this,a)}function Xd(a){Yd[a>>6&3].call(this,a)}function Zd(a){$d[a>>6&3].call(this,a)}function ae(a){be[a&15].call(this,a)}function ce(a){de[a&15].call(this,a)} -function ee(a){fe[a>>6&3].call(this,a)}function ge(a){he[a>>6&3].call(this,a)}function ie(a){je[a>>6&3].call(this,a)} -var Ud=[function(a){ke[a>>8&15].call(this,a)},Gd,vd,fd,bd,dd,Xc,Y,function(a){le[a>>8&15].call(this,a)},Hd,wd,gd,cd,ed,Pd,Y],ke=[function(a){me[a>>4&15].call(this,a)},sd,pd,hd,id,nd,jd,ld,Ed,Ed,Vd,Xd,Zd,Y,Y,Y],Wd=[function(a){Q(this,wc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Hc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,Lc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,Jc);this.a-=this.c?9:3+(7==this.b?2:0)}],Yd=[function(a){U(this,a,0,Nc); -this.a-=this.c?11:6},function(a){U(this,a,O(this)?1:0,xc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,O(this)?1:0,Tc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=uc(this,a);Q(this,a);this.a-=this.c?4:3+(7==this.b?2:0)}],$d=[function(a){U(this,a,0,Rc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Pc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Bc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,zc);this.a-=this.c?9:3+(7==this.b?2:0)}],me=[function(a){ne[a& -15].call(this,a)},Y,Y,Y,Cd,Cd,Cd,Cd,Nd,Y,ae,ce,Qd,Qd,Qd,Qd],ne=[zd,Sd,Md,rd,Ad,Ld,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y],be=[Kd,function(){this.l=0;this.a-=5},function(){this.g=0;this.a-=5},W,function(){this.h=1;this.a-=5},W,W,W,function(){this.s=0;this.a-=5},W,W,W,W,W,W,W],de=[Kd,function(){this.l=65536;this.a-=5},function(){this.g=32768;this.a-=5},X,function(){this.h=0;this.a-=5},X,X,X,function(){this.s=32768;this.a-=5},X,X,X,X,X,X,X],le=[qd,od,kd,md,td,ud,$c,ad,yd,Rd,ee,ge,ie,Y,Y,Y],fe=[function(a){Q(this,vc(this, -a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,Ic);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,Mc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,Kc);this.a-=this.c?9:3+(7==this.b?2:0)}],he=[function(a){T(this,a,0,Oc);this.a-=this.c?11:6},function(a){T(this,a,O(this)?1:0,yc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,O(this)?1:0,Uc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=tc(this,a);Q(this,a<<8);this.a-=this.c?4:3+(7==this.b?2:0)}], -je=[function(a){T(this,a,0,Sc);this.a-=this.c?9+(this.$a&1):3+(7==this.b?2:0)},function(a){T(this,a,0,Qc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,Cc);this.a-=this.c?9+(this.$a&1):3+(7==this.b?2:0)},function(a){T(this,a,0,Ac);this.a-=this.c?9:3+(7==this.b?2:0)}];function bc(a){oe[a>>12].call(this,a)} -var oe=[function(a){pe[a>>8&15].call(this,a)},Gd,vd,fd,bd,dd,Xc,function(a){qe[a>>8&15].call(this,a)},function(a){re[a>>8&15].call(this,a)},Hd,wd,gd,cd,ed,Pd,Y],pe=[function(a){se[a>>4&15].call(this,a)},sd,pd,hd,id,nd,jd,ld,Ed,Ed,Vd,Xd,Zd,function(a){te[a>>6&3].call(this,a)},Y,Y],te=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=this.S(a|this.P);M(this,this.f[5]);this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=pc(this,a,0);jc(this,a);P(this,a);this.a-=11},function(a){var b=lc(this);this.G= -this.a;qc(this,a,0,b);P(this,b);this.a=this.G-Id[this.c]},function(a){P(this,wc(this,a,this.oa?65535:0));this.a-=this.c?9:3+(7==this.b?2:0)}],se=[function(a){ue[a&15].call(this,a)},Y,Y,Y,Cd,Cd,Cd,Cd,Nd,function(a){a&8?(this.A&49152||(this.A=this.A&-2017|(a&7)<<5,this.m|=1),this.a-=5):G(this,8,6)},ae,ce,Qd,Qd,Qd,Qd],ue=[zd,Sd,Md,rd,Ad,Ld,function(){kc(this);this.a-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],qe=[Jd,Jd,xd,xd,Yc,Yc,Zc,Zc,Td,Td,Y,Y,Y,Y,Od,Od],re=[qd,od,kd,md,td,ud,$c,ad,yd,Rd,ee,ge,ie,function(a){ve[a>>6& -3].call(this,a)},Y,Y],ve=[Y,function(a){a=pc(this,a,65536);jc(this,a);P(this,a);this.a-=11},function(a){var b=lc(this);this.G=this.a;qc(this,a,65536,b);P(this,b);this.a=this.G-Id[this.c]},Y]; -function we(a){u.call(this,"ROM",a,we);this.T=this.b=null;this.o=a.addr;this.c=a.size;this.h=a.alias;this.g=a.file;this.l=ka(this.g);if(this.g){a=this.g;var b=la(this.l);"json"!=b&&"hex"!=b&&(a=na()+"/api/v1/dump?file="+this.g+"&format=bytes&decimal=true");var c=this;k(a,null,!0,function(a,b,f){f?c.L("Unable to load ROM resource (error "+f+": "+a+")"):(Pa(c.ta,a,b),(a=ua(a,b))?(c.b=a.K,c.T=a.T):c.g=null,xe(c))})}}w(we);we.prototype.ha=function(a,b,c,d){this.j=b;this.a=c;this.D=d;xe(this)}; -we.prototype.ba=function(){this.T&&(this.D&&this.D.a(this.id,this.o,this.c,this.T),delete this.T);return!0};we.prototype.aa=function(){return!0}; -function xe(a){if(!Ta(a)){if(a.g){if(!a.b||!a.j)return;a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size ("+ja(a.b.length,8,!0)+") does not match specified size ("+ja(a.c,8,!0)+")";a.i.error=!0;a.L(b)}else{b=a.o;if(kb(a.j,b,a.c,Hb)){var c;for(c=0;c>>a.j;0=b.length)break;for(var l=l+2,q=b[l++]&255|(b[l++]&255)<<8,t=b[l++]&255|(b[l++]&255)<<8,n=n+((q&255)+(q>>8)+(t&255)+(t>>8)),z=l,Ra=q-=6;0=b.length)break;n+=b[l++]&255;if(n&255)break;if(Ra)for(;Ra--;)a.a.Ja(t++,b[z++]&255);else t&1?D(a.a):ec(a.a,t,f);h=!0}else l++;else l+=2}if(!h&&(null==c&&(c=e),null!=c)){for(e=0;e=b)a.preventDefault&&a.preventDefault(),64e.w&&(e.w-=32),e.b|=128,e.b&64&&wb(e.a,e.V))});this.W=yb(52,4);this.N=vb(this.a,function(){e.c|=128;e.c&64&&wb(e.a,e.W)});tb(b,this,De);C(this)}; -g.qb=function(){if(!this.v){var a=Sb(this.o,"connection");if(a){var b=a.split("->");if(2==b.length){var c=qa(b[0]);if(c!=this.La)return;b=qa(b[1]);if(this.v=Qa(b)){var d=this.v.exports;if(d){var e=d.connect;e&&e.call(this.v);if(this.B=d.receiveData){this.status(this.ta+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};g.ba=function(a,b){if(!b)if(this.qb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0}; -g.aa=function(a){return a?this.save():!0};g.reset=function(){Ee(this)};g.save=function(){var a=new N(this);a.set(0,[]);return a.data()};g.restore=function(){return Ee(this)};function Ee(a){a.w=0;a.b=0;a.c=128;a.h=[];return!0}g.gb=function(a){if("number"==typeof a)this.h.push(a);else if("string"==typeof a)for(var b=0;b":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.J||8,c=a-this.s%a,this.J&&(b=" ".slice(0,c)));this.G&&!this.s&&c&&(b=String.fromCharCode(this.G)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.s+=c}else if(null!=this.l){if(10==a||1024<=this.l.length)this.R(this.l), -this.l="";10!=a&&(this.l+=String.fromCharCode(a))}this.c&=-129;xb(this.a,this.N,1E3/Math.round(this.H/10))}};var Fe={},De=(Fe[65392]=[null,null,Z.prototype.ec,Z.prototype.Rc,"RCSR"],Fe[65394]=[null,null,Z.prototype.dc,Z.prototype.Qc,"RBUF"],Fe[65396]=[null,null,Z.prototype.sc,Z.prototype.ed,"XCSR"],Fe[65398]=[null,null,Z.prototype.rc,Z.prototype.dd,"XBUF"],Fe);r(function(){for(var a=B(document,"pdp11","serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.u[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.u[b]=c,c.onclick=function(){var a= -d.u.listTapes;a&&Ie(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.G){c.parentNode.removeChild(c);break}this.u[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;Ie(d,ka(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.u[b]=c,!0}return!1}; -g.ha=function(a,b,c,d){this.o=a;this.j=b;this.a=c;this.D=d;this.J=Je(a);var e=this;if((this.c=Sb(this.o,"autoMount")||this.c)&&"string"==typeof this.c)try{this.c=eval("("+this.c+")")}catch(f){m("PC11 auto-mount error: "+f.message+" ("+this.c+")"),this.c=null}this.M=yb(56,4);this.P=vb(this.a,function(){1==(e.b&32769)&&!(e.b&128)&&e.wc.indexOf("/api/v1/dump")&&(e=la(c),f="json"==e||"gz"==e?encodeURI(c):na()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!k(f,null,!0,function(e,f,h){var l=0>h&&a.o&&!a.o.i.O;h?a.L('Unable to load tape "'+b+'" (error '+h+": "+e+")",l):(Pa(a.ta,e,f),(e=ua(e,f))&&Se(a,b,c,d,e.K,e.$,e.Z)); -a.i.Za=!1;a.l&&(a.l--,a.l||C(a));Pe(a)})}function Me(a,b,c,d){if((a=a.u.listTapes)&&a.options){for(var e=0;e\nLicense: GPL version 3 or later ");this.R("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis ");for(b=0;bWe){if(Ye(d,this.v)){this.o=new N(this,"1.30.2","failsafe");Ye(this.o)&&(cf(this,d),a=2,df(this.o));this.o.set("timestamp",ta());ef(this.o);var e=this.b&&!this.l;if(1==a||va("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=bf(d)){var f=d.get("code"),h=d.get("data");f&&("ok"==f?Ye(d,h):("error"== -f&&"no machine state"!=h?(this.L("Error: "+h),"unable to verify user"==h&&(za("user",""),this.c=null)):this.R(f+": "+h),df(d),Ye(d)?(c=bf(d),e=!0):c=!1))}e&&af(this,c?d:null)}else 2==a&&d.clear()}else af(this);delete this.v;delete this.w}e=x(this.id);for(f=0;fa[1];a=a[2];this.P=!0;this.i.O=!0;var d=this.u.power;d&&(d.textContent="Shutdown");this.a&&(ff(this,this.a,b,c,a),this.a.Fa());this.G&&(cf(this,b),b.clear());!c&&this.o&&(this.o.clear(),delete this.o);this.g=0}; -function cf(a,b){if(va("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.c||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.2"};d.url=a.N;d.user=c;d.type="bug";d.data=b;k("http://www.pcjs.org/api/v1/report",d,!0)}} -function gf(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new N(a,"1.30.2"),h=new N(a,"1.30.2","validate"),l=ta();h.set("timestamp",l);f.set("timestamp",l);f.set("version","1.30.2");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.aa&&(c&&D(a.a),d=a.a.aa(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.i.O=!1,!1===d&&(e=null)));for(var l=x(a.id),n=0;nf.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(t){f=null,a=t.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");k(e,null,!0,function(f,h,l){if(l||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+l+")");else{if(f=d[3])if(l=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var n=l[0],q,t=/( [a-z]+=)(['"])(.*?)\2/g;q=t.exec(f);)n=0>n.indexOf(q[1])?n.replace(">",q[0]+">"):n.replace(new RegExp(q[1]+"(['\"])(.*?)\\1"),q[0]);l[0]!=n&&(h=h.replace(l[0],n))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/, -"");a=a.replace(d[0],h);of(a,b,c)}})}else c(a,null)} -function pf(a,b,c,d){function e(a){if(void 0===l){var b=h&&B(h,"machine-warning");l=b&&b[0]||h}l&&(l.innerHTML=pa(a))}function f(a){e("Error: "+a);n&&(--lf||Ga(!0));n=!1}var h,l,n=!0;lf++;Oa[a]={};try{if(h=document.getElementById(a)){var q;if("object"==typeof resources&&(q=resources.css)){var t=document.head||document.getElementsByTagName("head")[0],z=document.createElement("style");z.type="text/css";z.styleSheet?z.styleSheet.cssText=q:z.appendChild(document.createTextNode(q));t.appendChild(z)}c|| -(c="/versions/pdpjs/1.30.2/components.xsl");q=function(d,l){l?mf(c,null,null,!1,e,function(d,n){n?(Pa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(n=l.transformNode(n))?(h.outerHTML=n,--lf||Ga(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(n),(n=d.transformToFragment(l,document))?h.parentNode?(h.parentNode.replaceChild(n,h),--lf||Ga(!0)):f("invalid machine element: "+ -a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?mf(b,a,d,!0,e,q):nf(b,null,a,d,!1,e,q)}else f("missing machine element: "+a)}catch(Ra){f(Ra.message)}return n}window.embedPDP11=function(a,b,c,d){Ga(!1);return pf(a,b,c,d)};window.enableEvents=Ga;window.sendEvent=Ha;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11.map +Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});var Ua="undefined"!==typeof ArrayBuffer;function Va(a){y.call(this,"Panel",a,Va);this.b=0;this.j.Cb=!0}A(Va);h=Va.prototype; +h.V=function(a,b,c,d){if(this.i&&this.i.V(a,b,c,d)||this.a&&this.a.V(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.b++,!0;default:return"rled"==a?(this.m[b]=c,this.b++,!0):this.parent.V.call(this,a,b,c,d)}};h.ba=function(a,b,c,d){this.i=a;this.l=b;this.a=c;this.D=d};h.ea=function(a,b){b||Wa();return!0};h.da=function(){return!0}; +function Xa(a,b,c,d){if(a.m[b]){void 0===c&&(a.j.error=!0,a.C("Value for "+b+" is invalid"),H(a.a));var e=a.D&&a.D.b||8;c=!a.a.j.Z||a.j.Cb?8==e?ka(c,d):l(c,d):"--------".substr(0,d||4);a.m[b].textContent!=c&&(a.m[b].textContent=c)}}function Ya(a,b,c,d){for(var e=0;e>2;this.i=this.c-1;this.v=this.B/this.c|0;this.ta=[];this.o=0;this.u=[];this.Ub=[ab,bb,cb,db];a=new J(this);eb(a,this.D);this.b=Array(this.v);for(b=0;b>8:e[2](b)&255):b&1&&(e=d.ta[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);return 0<=c?c:c=gb(d,b)}function bb(a,b,c){var d=!1,e=this.controller,f=e.ta[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.ta[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d||gb(e,c)} +function cb(a,b){var c=-1,d=this.controller;(a=d.ta[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));return 0<=c?c:c=gb(d,b)}function db(a,b,c){var d=!1,e=this.controller;if(a=e.ta[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d||gb(e,c)}function hb(a,b){if(b!=a.h){var c;a.h&&(c=(1<>>a.l;0g&&(t=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.Da)return m.hb+=m.Da-f,m.Da=f,!0;if(f>=m.Da+m.hb){t=m.size-(f-p);t>g&&(t=g);m.hb=f-m.Da+t;f=p+a.c;g-=t;k++;continue}}return mb(1,f,g)}f=new J(a,f,t,a.c,d,e);eb(f,a.D,m);a.b[k++]=f;f=p+a.c;g-=t}if(0>=g){c/=1024;var w;e="";w?10>>=a.l;0>>=a.l;0>>a.l].tb(b&a.i,b)}function pb(a,b){return a.b[(b&a.g)>>>a.l].S(b&a.i,b)}$a.prototype.Qa=function(a,b){this.o++;this.b[(a&this.g)>>>this.l].Ab(a&this.i,b&255,a);this.o--}; +function qb(a,b,c){a.b[(b&a.g)>>>a.l].ib(b&a.i,c&65535,b)}function rb(a){for(var b=0,c=[],d=0;da.a.Ra)){var g=f[0]?f[0].bind(b):null,k=f[1]?f[1].bind(b):null,m=f[2]?f[2].bind(b):null,p=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&m&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!k&&p&&(k=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));sb(a,e,e,g,k,m,p,f[4])}}}function ub(a,b){a.u.push(b)}function vb(a,b){a.o||K(a.a,4,b)} +function mb(a,b,c){r("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}function L(a){y.call(this,"Device",a,L);this.c={data:0,Bd:0,gb:20,Pc:0};this.b={Gd:0,yb:-1}}A(L);h=L.prototype;h.ba=function(a,b,c,d){this.l=b;this.a=c;this.D=d;var e=this;this.b.yb=wb(c,function(){e.b.va|=128;e.b.va&64&&(xb(e.a,e.b.Qc),yb(e.a,e.b.yb,1E3/60))});this.b.Qc=zb(64,6);tb(b,this,M);ub(b,this.reset.bind(this));G(this)};h.reset=function(){this.c.gb=this.c.gb&-120|20;this.b.va=0}; +h.kc=function(){var a=this.b.va;this.b.va&=-129;return a};h.Zc=function(a){this.b.va=a;a&64&&yb(this.a,this.b.yb,1E3/60);this.b.va=a&-129};h.dc=function(a){return(a?this.c.Pc:this.c.data)&65535};h.Sc=function(a){this.c.data=a};h.mc=function(){var a=this.a;return a.w&62337|a.Sa<<5|a.Ta<<1};h.ad=function(a){var b=this.a;a&=62337;if(b.w!=a){b.w=a;b.Sa=a>>5&3;b.Ta=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Oa!=c&&(b.Oa=c,Ab(b))}Bb(this)}; +h.nc=function(){var a=this.a.wa;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.oc=function(){return this.a.vb};h.pc=function(){return this.a.xa};h.bd=function(a){var b=this.a;1170>b.Ra&&(a&=-49);b.xa!=a&&(b.xa=a,a&16?(b.pb=4194303,b.Ua=3915776):(b.pb=262143,b.Ua=253952),Ab(b));Bb(this)};function Bb(a){a.c.gb=a.c.gb&-8|(a.a.Oa?a.a.xa&16?1:2:4)}h.Dc=function(a){return this.a.H[1][a>>1&7]};h.qd=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.Bc=function(a){return this.a.H[1][(a>>1&7)+8]}; +h.od=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};h.Cc=function(a){return this.a.U[1][a>>1&7]};h.pd=function(a,b){b=b>>1&7;this.a.U[1][b]=a;this.a.H[1][b]&=65295};h.Ac=function(a){return this.a.U[1][(a>>1&7)+8]};h.nd=function(a,b){b=(b>>1&7)+8;this.a.U[1][b]=a;this.a.H[1][b]&=65295};h.jc=function(a){return this.a.H[0][a>>1&7]};h.Yc=function(a,b){this.a.H[0][b>>1&7]=a&65295};h.hc=function(a){return this.a.H[0][(a>>1&7)+8]};h.Wc=function(a,b){this.a.H[0][(b>>1&7)+8]=a&65295}; +h.ic=function(a){return this.a.U[0][a>>1&7]};h.Xc=function(a,b){b=b>>1&7;this.a.U[0][b]=a;this.a.H[0][b]&=65295};h.gc=function(a){return this.a.U[0][(a>>1&7)+8]};h.Vc=function(a,b){b=(b>>1&7)+8;this.a.U[0][b]=a;this.a.H[0][b]&=65295};h.Jc=function(a){return this.a.H[3][a>>1&7]};h.wd=function(a,b){this.a.H[3][b>>1&7]=a&65295};h.Hc=function(a){return this.a.H[3][(a>>1&7)+8]};h.ud=function(a,b){this.a.H[3][(b>>1&7)+8]=a&65295};h.Ic=function(a){return this.a.U[3][a>>1&7]}; +h.vd=function(a,b){b=b>>1&7;this.a.U[3][b]=a;this.a.H[3][b]&=65295};h.Gc=function(a){return this.a.U[3][(a>>1&7)+8]};h.td=function(a,b){b=(b>>1&7)+8;this.a.U[3][b]=a;this.a.H[3][b]&=65295};h.Fa=function(a){a&=7;return this.a.A&2048?this.a.Ca[a]:this.a.f[a]};h.Ha=function(a,b){b&=7;this.a.A&2048?this.a.Ca[b]=a:this.a.f[b]=a};h.uc=function(){return this.a.A&49152?this.a.ga[0]:this.a.f[6]};h.gd=function(a){this.a.A&49152?this.a.ga[0]=a:this.a.f[6]=a};h.xc=function(){return this.a.f[7]}; +h.kd=function(a){this.a.f[7]=a};h.Ga=function(a){a&=7;return this.a.A&2048?this.a.f[a]:this.a.Ca[a]};h.Ia=function(a,b){b&=7;this.a.A&2048?this.a.f[b]=a:this.a.Ca[b]=a};h.vc=function(){return 1==(this.a.A&49152)>>14?this.a.f[6]:this.a.ga[1]};h.hd=function(a){1==(this.a.A&49152)>>14?this.a.f[6]=a:this.a.ga[1]=a};h.wc=function(){return 3==(this.a.A&49152)>>14?this.a.f[6]:this.a.ga[3]};h.jd=function(a){3==(this.a.A&49152)>>14?this.a.f[6]=a:this.a.ga[3]=a};h.fc=function(a){return this.a.Pb[a-65504>>1]}; +h.Uc=function(a,b){this.a.Pb[b-65504>>1]=a};h.Nb=function(a){return 65520==a?61183:0};h.Tb=function(){};h.Fc=function(){return 1};h.sd=function(){};h.ec=function(){return this.a.J};h.Tc=function(){this.a.J=0};h.lc=function(){return this.a.Ob};h.$c=function(a,b){b&1||(a&=255);this.a.Ob=a};h.qc=function(a){return a?this.a.wb:0};h.cd=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.wb=a;b.s|=2};h.Ec=function(a){return a?this.a.ya&65280:0};h.rd=function(a){this.a.ya=a|255}; +h.tc=function(){return Za(this.a)};h.fd=function(a){Cb(this.a,a&-1809|Za(this.a)&1808);this.a.s|=128};h.Sb=function(){}; +var N={},M=(N[62592]=[null,null,L.prototype.Dc,L.prototype.qd,"SISDR",1145],N[62608]=[null,null,L.prototype.Bc,L.prototype.od,"SDSDR",1145],N[62624]=[null,null,L.prototype.Cc,L.prototype.pd,"SISAR",1145],N[62640]=[null,null,L.prototype.Ac,L.prototype.nd,"SDSAR",1145],N[62656]=[null,null,L.prototype.jc,L.prototype.Yc,"KISDR",1145],N[62672]=[null,null,L.prototype.hc,L.prototype.Wc,"KDSDR",1145],N[62688]=[null,null,L.prototype.ic,L.prototype.Xc,"KISAR",1145],N[62704]=[null,null,L.prototype.gc,L.prototype.Vc, +"KDSAR",1145],N[62798]=[null,null,L.prototype.pc,L.prototype.bd,"MMR3",1145],N[65382]=[null,null,L.prototype.kc,L.prototype.Zc,"LKS"],N[65400]=[null,null,L.prototype.dc,L.prototype.Sc,"CNSL"],N[65402]=[null,null,L.prototype.mc,L.prototype.ad,"MMR0",1145],N[65404]=[null,null,L.prototype.nc,L.prototype.Sb,"MMR1",1145],N[65406]=[null,null,L.prototype.oc,L.prototype.Sb,"MMR2",1145],N[65408]=[null,null,L.prototype.Jc,L.prototype.wd,"UISDR",1145],N[65424]=[null,null,L.prototype.Hc,L.prototype.ud,"UDSDR", +1145],N[65440]=[null,null,L.prototype.Ic,L.prototype.vd,"UISAR",1145],N[65456]=[null,null,L.prototype.Gc,L.prototype.td,"UDSAR",1145],N[65472]=[null,null,L.prototype.Fa,L.prototype.Ha,"R0SET0"],N[65473]=[null,null,L.prototype.Fa,L.prototype.Ha,"R1SET0"],N[65474]=[null,null,L.prototype.Fa,L.prototype.Ha,"R2SET0"],N[65475]=[null,null,L.prototype.Fa,L.prototype.Ha,"R3SET0"],N[65476]=[null,null,L.prototype.Fa,L.prototype.Ha,"R4SET0"],N[65477]=[null,null,L.prototype.Fa,L.prototype.Ha,"R5SET0"],N[65478]= +[null,null,L.prototype.uc,L.prototype.gd,"R6KERNEL"],N[65479]=[null,null,L.prototype.xc,L.prototype.kd,"R7KERNEL"],N[65480]=[null,null,L.prototype.Ga,L.prototype.Ia,"R0SET1",1145],N[65481]=[null,null,L.prototype.Ga,L.prototype.Ia,"R1SET1",1145],N[65482]=[null,null,L.prototype.Ga,L.prototype.Ia,"R2SET1",1145],N[65483]=[null,null,L.prototype.Ga,L.prototype.Ia,"R3SET1",1145],N[65484]=[null,null,L.prototype.Ga,L.prototype.Ia,"R4SET1",1145],N[65485]=[null,null,L.prototype.Ga,L.prototype.Ia,"R5SET1",1145], +N[65486]=[null,null,L.prototype.vc,L.prototype.hd,"R6SUPER",1145],N[65487]=[null,null,L.prototype.wc,L.prototype.jd,"R6USER",1145],N[65504]=[null,null,L.prototype.fc,L.prototype.Uc,"CTRL",1170],N[65520]=[null,null,L.prototype.Nb,L.prototype.Tb,"LSIZE",1170],N[65522]=[null,null,L.prototype.Nb,L.prototype.Tb,"HSIZE",1170],N[65524]=[null,null,L.prototype.Fc,L.prototype.sd,"SYSID",1170],N[65526]=[null,null,L.prototype.ec,L.prototype.Tc,"CPUERR",1170],N[65528]=[null,null,L.prototype.lc,L.prototype.$c, +"MB",1170],N[65530]=[null,null,L.prototype.qc,L.prototype.cd,"PIR"],N[65532]=[null,null,L.prototype.Ec,L.prototype.rd,"SL"],N[65534]=[null,null,L.prototype.tc,L.prototype.fd,"PSW"],N);M[62594]=M[62592];M[62596]=M[62592];M[62598]=M[62592];M[62600]=M[62592];M[62602]=M[62592];M[62604]=M[62592];M[62606]=M[62592];M[62610]=M[62608];M[62612]=M[62608];M[62614]=M[62608];M[62616]=M[62608];M[62618]=M[62608];M[62620]=M[62608];M[62622]=M[62608];M[62626]=M[62624];M[62628]=M[62624];M[62630]=M[62624];M[62632]=M[62624]; +M[62634]=M[62624];M[62636]=M[62624];M[62638]=M[62624];M[62642]=M[62640];M[62644]=M[62640];M[62646]=M[62640];M[62648]=M[62640];M[62650]=M[62640];M[62652]=M[62640];M[62654]=M[62640];M[62658]=M[62656];M[62660]=M[62656];M[62662]=M[62656];M[62664]=M[62656];M[62666]=M[62656];M[62668]=M[62656];M[62670]=M[62656];M[62674]=M[62672];M[62676]=M[62672];M[62678]=M[62672];M[62680]=M[62672];M[62682]=M[62672];M[62684]=M[62672];M[62686]=M[62672];M[62690]=M[62688];M[62692]=M[62688];M[62694]=M[62688];M[62696]=M[62688]; +M[62698]=M[62688];M[62700]=M[62688];M[62702]=M[62688];M[62706]=M[62704];M[62708]=M[62704];M[62710]=M[62704];M[62712]=M[62704];M[62714]=M[62704];M[62716]=M[62704];M[62718]=M[62704];M[65410]=M[65408];M[65412]=M[65408];M[65414]=M[65408];M[65416]=M[65408];M[65418]=M[65408];M[65420]=M[65408];M[65422]=M[65408];M[65426]=M[65424];M[65428]=M[65424];M[65430]=M[65424];M[65432]=M[65424];M[65434]=M[65424];M[65436]=M[65424];M[65438]=M[65424];M[65442]=M[65440];M[65444]=M[65440];M[65446]=M[65440];M[65448]=M[65440]; +M[65450]=M[65440];M[65452]=M[65440];M[65454]=M[65440];M[65458]=M[65456];M[65460]=M[65456];M[65462]=M[65456];M[65464]=M[65456];M[65466]=M[65456];M[65468]=M[65456];M[65470]=M[65456];M[65506]=M[65504];M[65508]=M[65504];M[65510]=M[65504];M[65512]=M[65504];M[65514]=M[65504];M[65516]=M[65504];M[65518]=M[65504]; +x(function(){for(var a=E(document,"pdp11","device"),b=0;b>1),this.a=new Int32Array(this.m,0,this.size>>2),Lb(this,Hb?Mb:Nb);else{a=this.a=Array(this.size>> +2);for(f=0;f>2),b=0;b>8,c)},M:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ia:function(a,b){a&1&&vb(this.l,b);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},pa: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.na= +!0},G:function(a,b){return this.I(a,b)},P:function(a,b){return this.W(a,b)},ka:function(a,b,c){this.i?this.g(a,b,c):this.Ab(a,b,c)},ra:function(a,b,c){this.i?this.g(a,b,c):this.sa(a,b,c)},F:function(a){return this.b[a]},K:function(a){return this.b[a]},N:function(a,b){a&1&&vb(this.l,b);return this.c.getUint16(a,!0)},X:function(a,b){a&1&&vb(this.l,b);return this.u[a>>1]},ja:function(a,b){this.b[a]=b;this.na=!0},la:function(a,b){this.b[a]=b;this.na=!0},qa:function(a,b,c){a&1&&vb(this.l,c);this.c.setUint16(a, +b,!0);this.na=!0},Aa:function(a,b,c){a&1&&vb(this.l,c);this.u[a>>1]=b;this.na=!0}};function eb(a,b,c){a.D=b;a.h=a.o=0;c&&((a.h=c.h)&&Pb(a,Qb,!1),(a.o=c.o)&&Rb(a,Qb,!1))}function Rb(a,b,c){c&&a.o||(a.zb=!a.i&&b[1]||a.g,a.ib=!a.i&&b[3]||a.B);if(c||void 0===c)a.Ab=b[1]||a.g,a.sa=b[3]||a.B}function Pb(a,b,c){c&&a.h||(a.tb=b[0]||a.v,a.S=b[2]||a.w);if(c||void 0===c)a.I=b[0]||a.v,a.W=b[2]||a.w}function Lb(a,b){b||(b=Sb);Pb(a,b,void 0);Rb(a,b,void 0)} +var Sb=[],Ob=[J.prototype.M,J.prototype.pa,J.prototype.ia,J.prototype.Ba],Qb=[J.prototype.G,J.prototype.ka,J.prototype.P,J.prototype.ra];if(Ua)var Nb=[J.prototype.F,J.prototype.ja,J.prototype.N,J.prototype.qa],Mb=[J.prototype.K,J.prototype.la,J.prototype.X,J.prototype.Aa]; +function Tb(a,b){y.call(this,"CPU",a,Tb);var c=a.multiplier||1;this.$a=a.cycles||b;this.la=c;this.ob=Math.round(this.$a/1E4)/100;this.pa=this.ob*this.la;this.j.Z=!1;this.j.xb=!1;this.j.Ma=a.autoStart;this.j.Za=!1;this.Wa=this.ra=0;this.Ya=a.csStart;this.Ba=a.csInterval;this.Ja=a.csStop;this.I=[];this.Mb=this.Oc.bind(this);G(this)}A(Tb);var Ub=["power","reset"];h=Tb.prototype; +h.ba=function(a,b,c,d){this.i=a;this.l=b;this.D=d;for(b=0;ba.ja/a.pa&&(b=1);a.la=b;b=a.ob*a.la;if(a.pa!=b){a.pa=b;b=a.pa.toFixed(2)+"Mhz";var d=a.m.setSpeed;d&&(d.textContent=b);a.R("target speed: "+b)}c&&a.i&&dc(a.i)}a.M+=a.X;a.X=0;a.W=ra();a.ka=0;bc(a)}function wb(a,b){var c=a.I.length;a.I.push([-1,b]);return c}function yb(a,b,c){0<=b&&ba.I[b][0]&&(c=a.$a*a.la/1E3*c|0,a.I[b][0]=c+ec(a))}function ec(a,b){var c=a.qa-=a.a;a.a=a.G=0;b&&(a.qa=0);return c} +h.Oc=function(){if(this.j.Z){this.rb>=this.$a&&bc(this,!0);this.La=0;this.Va=ra();if(this.ka){var a=this.Va-this.ka;a>this.Jb&&(this.W+=a,this.W>this.Va&&(this.W=this.Va))}try{do{for(var b,c=this.j.Za?1:this.bb,d=this.I.length-1;0<=d;d--){var e=this.I[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.Rb(b)}catch(m){if("number"!=typeof m)throw m;}b=ec(this,!0);this.La+=b;this.X+=b;a=b;if(this.j.Za){var f=!1;this.Wa=this.Wa+this.Fb()|0;this.ra-=a;0>=this.ra&&(this.ra+=this.Ba,f=!0);0<=this.Ja&&this.Ja<=cc(this)&& +(this.Ba=this.Ja=-1,Zb(this),H(this),f=!0);f&&this.R(cc(this)+" cycles: checksum="+l(this.Wa))}for(var a=b,g=this.I.length-1;0<=g;g--){var k=this.I[g];0>k[0]||(k[0]-=a,0>=k[0]&&(k[0]=-1,k[1]()))}this.Ka-=b;if(0>=this.Ka){this.Ka+=this.bb;15<=++this.Lb&&(this.i&&this.i.ha(),this.Lb=0);break}}while(this.j.Z)}catch(m){H(this);this.i&&this.i.stop(ra(),cc(this));b=m.stack||m.message;this.j.error=!0;this.C(b);return}if(this.j.Z){b=setTimeout;c=this.Mb;this.ka=ra();d=this.Jb;this.La&&(d=Math.round(d*this.La/ +this.bb));d-=this.ka-this.Va;if(e=this.ka-this.W)this.ja=Math.round(this.X/(10*e))/100,864E5<=e&&(this.M=0,ac(this));if(0>d||this.jad&&(this.W-=d),d=0;this.rb+=this.La;this.ka+=d;b(c,d)}}};function $b(a){var b;a.j.error?(a.R(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.Z)a.R(a.toString()+" busy");else{ac(a);a.j.Z=!0;a.j.xb=!0;if(b=a.m.run)b.textContent="Halt";a.i&&a.i.start(a.W,cc(a));setTimeout(a.Mb,0)}}h.Rb=function(){return 0}; +function H(a){var b=!1;if(a.j.Z){ec(a);a.M+=a.X;a.X=0;a.j.Z=!1;if(b=a.m.run)b.textContent="Run";a.i&&a.i.stop(ra(),cc(a));b=!0}a.j.complete=void 0;return b}function fc(a){this.Ra=+a.model||1170;this.Hb=a.addrReset||0;Tb.call(this,a,6666667);this.decode=1120==this.Ra?gc.bind(this):hc.bind(this);ic(this);this.sb=0;this.N=null;this.j.complete=!1}A(fc,Tb);h=fc.prototype;h.reset=function(){this.status("model "+this.Ra);this.j.Z&&H(this);ic(this);Yb(this);this.j.error=!1;this.parent.reset.call(this)}; +function ic(a){a.o=65536;a.g=32768;a.h=65535;a.u=32768;a.A=15;a.f=[0,0,0,0,0,0,0,a.Hb];a.Ca=[0,0,0,0,0,0];a.ga=[0,0,0,0];a.v=0;a.Ta=0;a.ac=[4,2,0,1];a.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],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.U=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.cc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.Pb=[0,0,0,0,0,0,0,0];a.Ob=0;a.s=0;a.B=a.F=0;a.c=a.b=a.nb=0;a.sa=-1;jc(a)}function jc(a){a.ya=255;a.J=0;a.wb=0;a.w=0;a.wa=0;a.vb=0;a.xa=0;a.Oa=0;a.Sa=0;a.pb=262143;a.Ua=253952;a.N=null;a.l&&Ab(a)}function Ab(a){a.Oa?(a.P=65536,a.K=a.$b,a.S=a.Lc,a.ib=a.yd,hb(a.l,a.xa&16?22:18)):(a.P=0,a.K=a.Zb,a.S=a.Kc,a.ib=a.xd,hb(a.l,16))}function kc(a,b,c){a.Hb=b;O(a,b);!c&&a.D&&(H(a)||a.D.ha())}h.Fb=function(){return 0}; +h.save=function(){var a=new P(this);a.set(0,[]);a.set(1,[this.M,this.la]);a.set(2,rb(this.l));return a.data()};h.restore=function(a){var b=a[1];this.M=b[1];ac(this,b[3]);a:{b=this.l;a=a[2];var c;for(c=0;c>14&3;c=a.A>>14&3;a.v!=c&&(a.ga[c]=a.f[6],a.f[6]=a.ga[a.v]);a.A=b;a.s|=2}function S(a,b){a.s&128||(a.u=a.h=b,a.g=0)}function nc(a,b,c){a.s&128||(a.u=a.h=a.o=b,a.g=c||0)}function oc(a,b,c,d){a.s&128||(a.u=a.h=a.o=b,a.g=(c^b)&(d^b))}function pc(a,b){a.s&128||(a.u=a.h=a.o=b,a.g=a.u^a.o>>1)}function qc(a,b,c,d){a.s&128||(a.u=a.h=a.o=b,a.g=(c^d)&(d^b))} +function K(a,b,c){if(!a.sb){var d=!1;0>a.sa?a.sa=Za(a):a.v||(b=4,d=!0);a.w&57344||(a.wa=63222,a.vb=b);a.v=0;var e=a.S(b|a.P),f=a.S(b+2&65535|a.P);Cb(a,f&-12289|a.sa>>2&12288);d&&(a.J|=4,a.f[6]=4);rc(a,a.sa);rc(a,a.f[7]);O(a,e);a.s&=-113;a.sa=-1;a.s|=8;if(26!=c)throw b;}}function sc(a){var b=tc(a),c=tc(a)&-1793;a.A&49152&&(c=c&-225|a.A&63712);O(a,b);Cb(a,c);a.s&=-17} +function uc(a,b,c){var d,e,f,g=0;d=b>>13;a.xa&a.ac[a.v]||(d&=7);e=a.H[a.v][d];f=(a.U[a.v][d]<<6)+(b&8191)&a.pb;if(ff){if(3932160<=f){f&=262143;var k=f>>13&31;31>k?a.xa&32&&(f=a.cc[k]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Ua&&4186112>f&&(a.J|=32,K(a,4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192: +128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.H[a.v][d]=e;if(4194170!==f||a.v)a.Sa=a.v,a.Ta=d;g&&(g&57344&&(0<=a.sa&&(g|=128),a.w&57344||(a.w=a.w|g|a.Sa<<5|a.Ta<<1),K(a,168,16)),a.w&61440||!(4191360>f||4194239>>a.l].zb(b&a.i,c&255,b)}function tc(a){var b=a.S(a.f[6]|a.P);a.f[6]=a.f[6]+2&65535;return b} +function rc(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.w&57344||(a.wa=a.wa<<8|246);!a.v&&c<=a.ya&&4c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.f[c];7!==c&&(e|=g);e=a.S(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.f[c]+f&65535;7!==c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.f[c]-2&65535;7!==c&&(e|=g);e=a.S(e)|g;a.a-= +8;break;case 6:return e=a.S(mc(a,2)),e=e+a.f[c]&65535|g,a.a-=6,e;case 7:return e=a.S(mc(a,2)),e=e+a.f[c]&65535,e=a.S(e|a.P)|g,a.a-=10,e}a.f[c]=a.f[c]+f&65535;!g||a.w&57344||(a.wa=a.wa<<8|f<<3&248|c);6==c&&!a.v&&d&4&&0>=f&&(a.f[6]<=a.ya||65534<=a.f[6])&&(a.f[6]<=a.ya-32?(a.J|=4,a.f[6]=4,K(a,4,24)):(a.J|=8,a.s|=64));return e}h.Qa=function(a,b){this.Oa?(this.sb++,vc(this,uc(this,a,5),b),this.sb--):this.l.Qa(a,b)};h.Zb=function(a,b,c){return wc(this,a,b,c)}; +h.$b=function(a,b,c){return uc(this,wc(this,a,b,c),c)};h.Kc=function(a){return pb(this.l,a)};h.Lc=function(a){return pb(this.l,uc(this,a,2))};h.xd=function(a,b){qb(this.l,a,b&65535)};h.yd=function(a,b){qb(this.l,uc(this,a,4),b)};function xc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=wc(a,b,d,2),c&65536||61440!==(a.A&61440)&&(d&=65535),a.v=a.A>>12&3,c=a.S(d|c&a.P),a.v=a.A>>14&3):c=6!=d||(a.A>>2&12288)===(a.A&12288)?a.f[d]:a.ga[a.A>>12&3];return c} +function yc(a,b,c,d){a.w&57344||(a.wa=22);var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=wc(a,b,e,4),c&65536||(e&=65535),a.v=a.A>>12&3,e=uc(a,e|c&65536,4),a.v=a.A>>14&3,qb(a.l,e,d)):6!=e||(a.A>>2&12288)===(a.A&12288)?a.f[e]=d:a.ga[a.A>>12&3]=d}function zc(a,b){b>>=6;var c=a.F=b&7;(b=a.B=(b&56)>>3)?(c=a.K(b,c,3),a=ob(a.l,c)):a=a.f[c]&255;return a}function Ac(a,b){b>>=6;var c=a.F=b&7;return(b=a.B=(b&56)>>3)?pb(a.l,a.K(b,c,2)):a.f[c]}function Bc(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return wc(a,b,c,8)} +function Cc(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.K(b,c,3),a=ob(a.l,c)):a=a.f[c]&255;return a}function Dc(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?pb(a.l,a.K(b,c,2)):a.f[c]}function T(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.nb=a.K(b,e,7),vc(a,e,d.call(a,c,ob(a.l,e)))):a.f[e]=a.f[e]&65280|d.call(a,c,a.f[e])}function U(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.K(b,e,6),qb(a.l,e,d.call(a,c,pb(a.l,e)))):a.f[e]=d.call(a,c,a.f[e])} +function Ec(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?vc(a,a.K(b,e,5),c):a.f[e]=c?d&1?c<<24>>24&65535:a.f[e]&-256|c&255:a.f[e]&-256;return c}function Fc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?qb(a.l,a.K(b,d,4),c):a.f[d]=c&65535;return c}function V(a,b,c){c&&(O(a,a.f[7]+(b<<24>>23)),a.a-=2);a.a-=3} +h.Rb=function(a){this.j.complete=!0;var b=a?this.j.xb?0:1:-1;this.j.xb=!1;this.qa=this.a=a;do{if(this.s){this.s&112&&(this.s&32?K(this,168,28):this.s&64?K(this,4,30):this.s&16&&K(this,12,32),this.s&=-113);if(a=this.s&7){a=!1;if(this.s&2){this.s&=-3;var c=160,d=(this.wb&224)>>5,e=this.N&&this.N.Ea>d?this.N:null;e&&(c=e.Rc,d=e.Ea);d>(this.A&224)>>5?(this.s&4&&(mc(this,2),this.s&=-5),K(this,c,26),d=!0):d=!1;if(d){if(e)if(a=e,e=this.N,e==a)this.N=a.next;else for(;e;){d=e.next;if(d==a){e.next=d.next;break}e= +d}a=!0}}else this.s&1&&this.s++;a=a&&0>b}if(a)break}this.s=this.s&7|this.A&16;this.decode(lc(this))}while(0>1|b<<16;pc(this,a);return a&65535}function Lc(a,b){a=b&2048|b>>1|b<<8;pc(this,a<<8);return a&255}function Mc(a,b){a=b&~a;S(this,a);return a}function Nc(a,b){a=b&~a;S(this,a<<8);return a}function Oc(a,b){a|=b;S(this,a);return a}function Pc(a,b){a|=b;S(this,a<<8);return a}function Qc(a,b){a=~b|65536;nc(this,a);return a&65535}function Rc(a,b){a=~b|256;nc(this,a<<8);return a&255} +function Sc(a,b){a=b-a;this.s&128||(this.u=this.h=a,this.g=b&(b^a));return a&65535}function Tc(a,b){a=b-a;var c=a<<8;b<<=8;this.s&128||(this.u=this.h=c,this.g=b&(b^c));return a&255}function Uc(a,b){a=b+a;this.s&128||(this.u=this.h=a,this.g=a&(b^a));return a&65535}function Vc(a,b){a=b+a;var c=a<<8;this.s&128||(this.u=this.h=c,this.g=c&(b<<8^c));return a&255}function Wc(a,b){a=-b;nc(this,a,a&b&32768);return a&65535}function Xc(a,b){a=-b;nc(this,a<<8,(a&b&128)<<8);return a&255} +function Yc(a,b){a=b<<1|this.o>>16&1;pc(this,a);return a&65535}function Zc(a,b){a=b<<1|this.o>>16&1;pc(this,a<<8);return a&255}function $c(a,b){a=(this.o&65536|b)>>1|b<<16;pc(this,a);return a&65535}function ad(a,b){a=((this.o&65536)>>8|b)>>1|b<<8;pc(this,a<<8);return a&255}function bd(a,b){var c=b-a;qc(this,c,a,b);return c&65535}function cd(a,b){var c=b-a;qc(this,c<<8,a<<8,b<<8);return c&255}function dd(a,b){this.s&128||(this.u=this.h=b&65280,this.g=this.o=0);return(b<<8|b>>8)&65535} +function ed(a,b){a^=b;S(this,a);return a&65535}function fd(a){U(this,a,Ac(this,a),Gc);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function gd(a){var b=Dc(this,a);a=a>>6&7;var c=this.f[a];c&32768&&(c|=4294901760);this.o=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.f[a]=c&65535;this.u=this.h=c;this.a-=(this.c?6:7)+b} +function hd(a){var b=Dc(this,a);a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.o=this.g=0;b&=63;if(b&32){b=64-b;32>b-1;this.o=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.f[a|1]=d&65535;this.u=d>>16;this.h=d>>16|d;this.a-=(this.c?6:7)+b}function id(a){V(this,a,!Q(this))}function jd(a){V(this,a,Q(this))} +function kd(a){U(this,a,Ac(this,a),Mc);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function ld(a){T(this,a,zc(this,a),Nc);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function md(a){U(this,a,Ac(this,a),Oc);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function nd(a){T(this,a,zc(this,a),Pc);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)} +function od(a){S(this,Ac(this,a)&Dc(this,a));this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function pd(a){S(this,(zc(this,a)&Cc(this,a))<<8);this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function qd(a){V(this,a,this.h&65535?0:4)}function rd(a){V(this,a,!this.ua()==!(this.g&32768))}function sd(a){V(this,a,!!(this.h&65535)&&!this.ua()==!(this.g&32768))}function td(a){V(this,a,!Q(this)&&!!(this.h&65535))} +function ud(a){V(this,a,(this.h&65535?0:4)||!this.ua()!=!(this.g&32768))}function vd(a){V(this,a,Q(this)||(this.h&65535?0:4))}function wd(a){V(this,a,!this.ua()!=!(this.g&32768))}function xd(a){V(this,a,this.ua())}function yd(a){V(this,a,!!(this.h&65535))}function zd(a){V(this,a,!this.ua())}function Ad(){K(this,12,1);this.a-=5}function Bd(a){V(this,a,!0)}function Cd(a){V(this,a,!(this.g&32768))}function Dd(a){V(this,a,this.g&32768?2:0)} +function W(a){a&1&&(this.o=0);a&2&&(this.g=0);a&4&&(this.h=1);a&8&&(this.u=0);this.a-=5}function Ed(a){var b=Ac(this,a);a=Dc(this,a);qc(this,b-a,a,b);this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function Fd(a){var b=zc(this,a)<<8;a=Cc(this,a)<<8;qc(this,b-a,a,b);this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)} +function Gd(a){var b=Dc(this,a);if(b){a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.o=this.g=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.f[a]=d&65535,this.f[a|1]=c-d*b&65535,this.h=d>>16|d,this.u=d>>16):(this.g=32768,this.h=d>>15|d,this.u=c>>16,-1===b&&65534===this.f[a]&&(this.f[a]=this.f[a|1]=1));this.a-=53}else this.h=this.u=0,this.g=32768,this.o=65536,this.a-=7}function Hd(){K(this,24,2);this.a-=25} +function Id(){this.A&49152?(this.J|=128,K(this,4,3)):this.D?this.D.c():H(this);this.a-=7}function Jd(){K(this,16,4);this.a-=25}var Kd=[0,7,7,10,7,11,9,13];function Ld(a){this.G=this.a;O(this,Bc(this,a));this.a=this.G-Kd[this.c]}var Md=[0,14,14,17,14,18,16,20];function Nd(a){this.G=this.a;var b=Bc(this,a);a=a>>6&7;rc(this,this.f[a]);this.f[a]=this.f[7];O(this,b);this.a=this.G-Md[this.c]}var Od=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17]; +function Pd(a){var b=Ac(this,a);this.G=this.a;S(this,Fc(this,a,b));this.a=this.G-Od[(this.B?8:0)+this.c]+(7!=this.b||this.c?0:2)}function Qd(a){var b=zc(this,a);S(this,Ec(this,a,b,1)<<8);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}var Rd=[7,13,13,17,14,18,17,21]; +function Sd(a){var b=Dc(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.f[a];c&32768&&(c|=-65536);b=~~(b*c);this.f[a]=b>>16&65535;this.f[a|1]=b&65535;this.s&128||(this.u=b>>16,this.h=this.u|b,this.g=0,this.o=-32768>b||32767>6;if(this.f[b]=this.f[b]-1&65535)O(this,this.f[7]-((a&63)<<1)),this.a+=1;this.a-=6}function Yd(a){U(this,a,Ac(this,a),bd);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)} +function Zd(a){U(this,a,0,dd);this.a-=this.c?9:3+(7==this.b?2:0)}function $d(){K(this,28,5);this.a-=5}function ae(){this.s&4||this.i.ha();this.s|=4;mc(this,-2);this.a-=3}function be(a){U(this,a,Ac(this,a),ed);this.a-=this.c?9:3+(7==this.b?2:0)}function Y(){K(this,8,6)}function gc(a){ce[a>>12].call(this,a)}function de(a){ee[a>>6&3].call(this,a)}function fe(a){ge[a>>6&3].call(this,a)}function he(a){ie[a>>6&3].call(this,a)}function je(a){ke[a&15].call(this,a)}function le(a){me[a&15].call(this,a)} +function ne(a){oe[a>>6&3].call(this,a)}function pe(a){qe[a>>6&3].call(this,a)}function re(a){se[a>>6&3].call(this,a)} +var ce=[function(a){te[a>>8&15].call(this,a)},Pd,Ed,od,kd,md,fd,Y,function(a){ue[a>>8&15].call(this,a)},Qd,Fd,pd,ld,nd,Yd,Y],te=[function(a){ve[a>>4&15].call(this,a)},Bd,yd,qd,rd,wd,sd,ud,Nd,Nd,de,fe,he,Y,Y,Y],ee=[function(a){nc(this,Fc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Qc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,Uc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,Sc);this.a-=this.c?9:3+(7==this.b?2:0)}],ge=[function(a){U(this,a,0, +Wc);this.a-=this.c?11:6},function(a){U(this,a,Q(this)?1:0,Gc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,Q(this)?1:0,bd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Dc(this,a);nc(this,a);this.a-=this.c?4:3+(7==this.b?2:0)}],ie=[function(a){U(this,a,0,$c);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Yc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Kc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Ic);this.a-=this.c?9:3+(7==this.b?2:0)}], +ve=[function(a){we[a&15].call(this,a)},Y,Y,Y,Ld,Ld,Ld,Ld,Wd,Y,je,le,Zd,Zd,Zd,Zd],we=[Id,ae,Vd,Ad,Jd,Ud,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y],ke=[Td,function(){this.o=0;this.a-=5},function(){this.g=0;this.a-=5},W,function(){this.h=1;this.a-=5},W,W,W,function(){this.u=0;this.a-=5},W,W,W,W,W,W,W],me=[Td,function(){this.o=65536;this.a-=5},function(){this.g=32768;this.a-=5},X,function(){this.h=0;this.a-=5},X,X,X,function(){this.u=32768;this.a-=5},X,X,X,X,X,X,X],ue=[zd,xd,td,vd,Cd,Dd,id,jd,Hd,$d,ne,pe,re,Y,Y,Y],oe=[function(a){nc(this, +Ec(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,Rc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,Vc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,Tc);this.a-=this.c?9:3+(7==this.b?2:0)}],qe=[function(a){T(this,a,0,Xc);this.a-=this.c?11:6},function(a){T(this,a,Q(this)?1:0,Hc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,Q(this)?1:0,cd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Cc(this,a);nc(this,a<<8);this.a-=this.c?4:3+(7==this.b? +2:0)}],se=[function(a){T(this,a,0,ad);this.a-=this.c?9+(this.nb&1):3+(7==this.b?2:0)},function(a){T(this,a,0,Zc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,Lc);this.a-=this.c?9+(this.nb&1):3+(7==this.b?2:0)},function(a){T(this,a,0,Jc);this.a-=this.c?9:3+(7==this.b?2:0)}];function hc(a){xe[a>>12].call(this,a)} +var xe=[function(a){ye[a>>8&15].call(this,a)},Pd,Ed,od,kd,md,fd,function(a){ze[a>>8&15].call(this,a)},function(a){Ae[a>>8&15].call(this,a)},Qd,Fd,pd,ld,nd,Yd,Y],ye=[function(a){Be[a>>4&15].call(this,a)},Bd,yd,qd,rd,wd,sd,ud,Nd,Nd,de,fe,he,function(a){Ce[a>>6&3].call(this,a)},Y,Y],Ce=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=this.S(a|this.P);O(this,this.f[5]);this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=xc(this,a,0);rc(this,a);S(this,a);this.a-=11},function(a){var b=tc(this);this.G= +this.a;yc(this,a,0,b);S(this,b);this.a=this.G-Rd[this.c]},function(a){S(this,Fc(this,a,this.ua?65535:0));this.a-=this.c?9:3+(7==this.b?2:0)}],Be=[function(a){De[a&15].call(this,a)},Y,Y,Y,Ld,Ld,Ld,Ld,Wd,function(a){a&8?(this.A&49152||(this.A=this.A&-2017|(a&7)<<5,this.s|=1),this.a-=5):K(this,8,6)},je,le,Zd,Zd,Zd,Zd],De=[Id,ae,Vd,Ad,Jd,Ud,function(){sc(this);this.a-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],ze=[Sd,Sd,Gd,Gd,gd,gd,hd,hd,be,be,Y,Y,Y,Y,Xd,Xd],Ae=[zd,xd,td,vd,Cd,Dd,id,jd,Hd,$d,ne,pe,re,function(a){Ee[a>>6& +3].call(this,a)},Y,Y],Ee=[Y,function(a){a=xc(this,a,65536);rc(this,a);S(this,a);this.a-=11},function(a){var b=tc(this);this.G=this.a;yc(this,a,65536,b);S(this,b);this.a=this.G-Rd[this.c]},Y]; +function Fe(a){y.call(this,"ROM",a,Fe);this.T=this.b=null;this.h=a.addr;this.c=a.size;this.g=a.alias;this.i=a.file;this.o=n(this.i);if(this.i){a=this.i;var b=la(this.o);"json"!=b&&"hex"!=b&&(a=u()+"/api/v1/dump?file="+this.i+"&format=bytes&decimal=true");var c=this;q(a,null,!0,function(a,b,f){f?c.C("Unable to load ROM resource (error "+f+": "+a+")"):(Qa(c.ia,a,b),(a=va(a,b))?(c.b=a.L,c.T=a.T):c.i=null,Ge(c))})}}A(Fe);Fe.prototype.ba=function(a,b,c,d){this.l=b;this.a=c;this.D=d;Ge(this)}; +Fe.prototype.ea=function(){this.T&&(this.D&&this.D.a(this.id,this.h,this.c,this.T),delete this.T);return!0};Fe.prototype.da=function(){return!0}; +function Ge(a){if(!Ta(a)){if(a.i){if(!a.b||!a.l)return;a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size ("+l(a.b.length,8,!0)+") does not match specified size ("+l(a.c,8,!0)+")";a.j.error=!0;a.C(b)}else{b=a.h;if(kb(a.l,b,a.c,Kb)){var c;for(c=0;c>>a.l;0=b.length)break;for(var k=k+2,p=b[k++]&255|(b[k++]&255)<<8,t=b[k++]&255|(b[k++]&255)<<8,m=m+((p&255)+(p>>8)+(t&255)+(t>>8)),w=k,F=p-=6;0=b.length)break;m+=b[k++]&255;if(m&255)break;if(F)for(;F--;)a.a.Qa(t++,b[w++]&255);else t&1?H(a.a):kc(a.a,t,f);g=!0}else k++;else k+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e=b)a.preventDefault&&a.preventDefault(),64e.w&&(e.w-=32),e.b|=128,e.b&64&&xb(e.a,e.W))});this.X=zb(52,4);this.N=wb(this.a,function(){e.c|=128;e.c&64&&xb(e.a,e.X)});tb(b,this,Me);G(this)}; +h.Gb=function(){if(!this.v){var a=Vb(this.i,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.Aa)return;b=pa(b[1]);if(this.v=Ra(b)){var d=this.v.exports;if(d){var e=d.connect;e&&e.call(this.v);if(this.B=d.receiveData){this.status(this.ia+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.ea=function(a,b){if(!b)if(this.Gb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0}; +h.da=function(a){return a?this.save():!0};h.reset=function(){Ne(this)};h.save=function(){var a=new P(this);a.set(0,[]);return a.data()};h.restore=function(){return Ne(this)};function Ne(a){a.w=0;a.b=0;a.c=128;a.h=[];return!0}h.ub=function(a){if("number"==typeof a)this.h.push(a);else if("string"==typeof a)for(var b=0;b":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.K||8,c=a-this.u%a,this.K&&(b=" ".slice(0,c)));this.G&&!this.u&&c&&(b=String.fromCharCode(this.G)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.u+=c}else if(null!=this.o){if(10==a||1024<=this.o.length)this.R(this.o), +this.o="";10!=a&&(this.o+=String.fromCharCode(a))}this.c&=-129;yb(this.a,this.N,1E3/Math.round(this.I/10))}};var Oe={},Me=(Oe[65392]=[null,null,Z.prototype.zc,Z.prototype.md,"RCSR"],Oe[65394]=[null,null,Z.prototype.yc,Z.prototype.ld,"RBUF"],Oe[65396]=[null,null,Z.prototype.Nc,Z.prototype.Ad,"XCSR"],Oe[65398]=[null,null,Z.prototype.Mc,Z.prototype.zd,"XBUF"],Oe);x(function(){for(var a=E(document,"pdp11","serial"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descTape":return this.m[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.m[b]=c,c.onclick=function(){var a= +d.m.listTapes;a&&Re(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.I){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;Re(d,n(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.m[b]=c,!0}return!1}; +h.ba=function(a,b,c,d){this.i=a;this.l=b;this.a=c;this.D=d;this.M=Se(a);var e=this;if((this.c=Vb(this.i,"autoMount")||this.c)&&"string"==typeof this.c)try{this.c=eval("("+this.c+")")}catch(f){r("PC11 auto-mount error: "+f.message+" ("+this.c+")"),this.c=null}this.G=zb(56,4);this.P=wb(this.a,function(){1==(e.b&32769)&&!(e.b&128)&&e.wc.indexOf("/api/v1/dump")&&(e=la(c),f="json"==e||"gz"==e?encodeURI(c):u()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!q(f,null,!0,function(e,f,g){var k=0>g&&a.i&&!a.i.j.O;g?a.C('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(Qa(a.ia,e,f),(e=va(e,f))&&af(a,b,c,d,e.L,e.aa,e.$)); +a.j.jb=!1;a.o&&(a.o--,a.o||G(a));Ye(a)})}function Ve(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.fa);for(d=0;dc.indexOf("/api/v1/dump")&&(b=la(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"):ma(c,"/")&&(d="dir"),f=u()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.mb?"":e)+"&format=json"));return!!q(f, +null,!0,function(b,c,d){hf(a,b,c,d)})} +function hf(a,b,c,d){var e=null;a.l=!1;var f=0>d&&a.i&&!a.i.j.O;if(d)a.controller.C('Unable to load disk "'+a.oa+'" (error '+d+": "+b+")",f);else{Qa(a.controller.ia,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)r(k[0]);else{a.fa=k.length;a.ca=k[0].length;a.Y=k[0][0].length;var m=k[0][0][0];a.ma=m&&m.length||512;for(d=c=0;d>2,t=m.pattern;void 0===t&&(t=m.pattern=0);var w=m.data;if(void 0===w){var F=m.bytes;if(void 0!==F&&F.length){for(var R=p<<2,ta=F.length;ta>2,e=Array(d),f=0;f>2,g=(k>((f&3)<<3)&255;f=g;if(0>f)break;d|=f<=this.a.length||m>=this.a[k].length||p>=this.a[k][m].length){c="sector (CHS="+k+":"+m+":"+p+") out of range ("+ +b+" changes applied)";b=-1;break}if(this.l){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][m][p]){for(m=k.data.length;mb&&-2!=b&&this.controller.C("Unable to restore disk '"+this.oa+": "+c);return b}; +cf.prototype.toJSON=function(){var a;a=0;for(var b;b=kf(this,a++);)mf(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 mf(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)}}function Eb(a){y.call(this,"RL11",a,Eb);this.c=a.autoMount||null;this.g=0;this.b=Array(1);this.h=!Ba("Mobi")&&window&&"FileReader"in window}A(Eb);h=Eb.prototype; +h.V=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.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){r("RL11 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=ja(c.value);null!=a&&nf(d,a)},!0;case "loadDrive":return this.m[b]= +c,c.onclick=function(){var a=d.m.listDisks;a&&of(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.h){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[ja(a.value)||0])if(a=a.ab){var b;b="";for(var c=0,k;k=kf(a,c++);)for(var m=0,p=k.length;mb;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";nf(this,0)}}return!0};h.da=function(a){return a?this.save():!0}; +h.reset=function(){for(var a=0;ae||e>=a.b.length)a.C("Unable to load the selected drive");else if(c)if("?"==c)a.C('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=n(c);a.status("Attempting to load "+c+' as "'+b+'"')}tf(a,e,b,c,!1,d)}else sf(a,e)} +function tf(a,b,c,d,e,f){var g=-1,k=a.b[b];k.za.toLowerCase()!=d.toLowerCase()&&(g++,sf(a,b,!0),k.lb?a.C("RL11 busy"):(k.lb=!0,e&&(k.kb=!0,a.g++),k.cb=!!f,gf(new cf(a,k,"preload"),c,d,f,a.Xb)&&g++));return g} +h.Xb=function(a,b,c,d,e){var f;a.lb=!1;b&&(f=b.a.length?[b.a.length,b.a[0].length,b.a[0][0].length,b.a[0][0][0].length]:[0,0,0,0],b&&f[0]>a.fa||f[1]>a.ca)&&(this.C('Disk "'+c+'" too large for drive '+("RL"+a.qb)),b=null);b?(a.ab=b,a.oa=c,a.za=d,this.C('Mounted disk "'+c+'" in drive '+("RL"+a.qb),a.kb||e),this.i&&dc(this.i)):a.cb=!1;a.kb&&(a.kb=!1,--this.g||G(this));nf(this,a.qb)}; +function qf(a,b,c,d){if((a=a.m.listDisks)&&a.options){for(var e=0;e\nLicense: GPL version 3 or later ");this.R("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis ");for(b=0;bwf){if(yf(d,this.v)){this.h=new P(this,"1.30.2","failsafe");yf(this.h)&&(Df(this,d),a=2,Ef(this.h));this.h.set("timestamp",sa());Ff(this.h);var e=this.b&&!this.o;if(1==a||wa("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Cf(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?yf(d,g):("error"== +f&&"no machine state"!=g?(this.C("Error: "+g),"unable to verify user"==g&&(Aa("user",""),this.c=null)):this.R(f+": "+g),Ef(d),yf(d)?(c=Cf(d),e=!0):c=!1))}e&&Bf(this,c?d:null)}else 2==a&&d.clear()}else Bf(this);delete this.v;delete this.w}e=B(this.id);for(f=0;fa[1];a=a[2];this.P=!0;this.j.O=!0;var d=this.m.power;d&&(d.textContent="Shutdown");this.a&&(Gf(this,this.a,b,c,a),this.a.Ma());this.G&&(Df(this,b),b.clear());!c&&this.h&&(this.h.clear(),delete this.h);this.i=0}; +function Df(a,b){if(wa("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.c||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.2"};d.url=a.N;d.user=c;d.type="bug";d.data=b;q("http://www.pcjs.org/api/v1/report",d,!0)}} +function Jf(a,b,c){var d,e="none";if(a.i)return null;a.i--;var f=new P(a,"1.30.2"),g=new P(a,"1.30.2","validate"),k=sa();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.2");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.da&&(c&&H(a.a),d=a.a.da(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.j.O=!1,!1===d&&(e=null)));for(var k=B(a.id),m=0;mf.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(t){f=null,a=t.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");q(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 m=k[0],p,t=/( [a-z]+=)(['"])(.*?)\2/g;p=t.exec(f);)m=0>m.indexOf(p[1])?m.replace(">",p[0]+">"):m.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);k[0]!=m&&(g=g.replace(k[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, +"");a=a.replace(d[0],g);Qf(a,b,c)}})}else c(a,null)} +function Rf(a,b,c,d){function e(a){if(void 0===k){var b=g&&E(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=oa(a))}function f(a){e("Error: "+a);m&&(--Nf||Ha(!0));m=!1}var g,k,m=!0;Nf++;Pa[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var t=document.head||document.getElementsByTagName("head")[0],w=document.createElement("style");w.type="text/css";w.styleSheet?w.styleSheet.cssText=p:w.appendChild(document.createTextNode(p));t.appendChild(w)}c|| +(c="/versions/pdpjs/1.30.2/components.xsl");p=function(d,k){k?Of(c,null,null,!1,e,function(d,m){m?(Qa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=k.transformNode(m))?(g.outerHTML=m,--Nf||Ha(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Nf||Ha(!0)):f("invalid machine element: "+ +a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Of(b,a,d,!0,e,p):Pf(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(F){f(F.message)}return m}window.embedPDP11=function(a,b,c,d){Ha(!1);return Rf(a,b,c,d)};window.enableEvents=Ha;window.sendEvent=Ia;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11.map