Added new RL11 component (work-in-progress)
This commit is contained in:
parent
de916981f3
commit
9e480d7574
24 changed files with 2760 additions and 585 deletions
|
|
@ -11,4 +11,5 @@
|
|||
<panel ref="/devices/pdp11/panel/1170/debugger/front.xml"/>
|
||||
<debugger id="debugger" base="8" messages="" commands=""/>
|
||||
<device ref="/devices/pdp11/pc11/default.xml"/>
|
||||
<device ref="/devices/pdp11/rl11/default.xml"/>
|
||||
</machine>
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
<serial id="dl11" adapter="0" binding="print" upperCase="true"/>
|
||||
<panel ref="/devices/pdp11/panel/1170/front.xml"/>
|
||||
<device ref="/devices/pdp11/pc11/default.xml"/>
|
||||
<device ref="/devices/pdp11/rl11/default.xml"/>
|
||||
</machine>
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
<serial id="dl11" adapter="0" binding="print"/>
|
||||
<panel ref="/devices/pdp11/panel/test/debugger/terminal.xml"/>
|
||||
<debugger id="debugger" base="8" messages="" commands=""/>
|
||||
<device ref="/devices/pdp11/rl11/default.xml"/>
|
||||
</machine>
|
||||
|
|
|
|||
|
|
@ -9,4 +9,5 @@
|
|||
<device id="default" type="default"/>
|
||||
<serial id="dl11" adapter="0" binding="print"/>
|
||||
<panel ref="/devices/pdp11/panel/test/terminal.xml"/>
|
||||
<device ref="/devices/pdp11/rl11/default.xml"/>
|
||||
</machine>
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
<serial id="dl11" adapter="0"/>
|
||||
<panel ref="/devices/pdp11/panel/1170/debugger/front.xml"/>
|
||||
<debugger id="debugger" base="8" messages="" commands=""/>
|
||||
<device ref="/devices/pdp11/rl11/default.xml"/>
|
||||
</machine>
|
||||
|
|
|
|||
|
|
@ -9,4 +9,5 @@
|
|||
<device id="default" type="default"/>
|
||||
<serial id="dl11" adapter="0"/>
|
||||
<panel ref="/devices/pdp11/panel/1170/front.xml"/>
|
||||
<device ref="/devices/pdp11/rl11/default.xml"/>
|
||||
</machine>
|
||||
|
|
|
|||
42
devices/pdp11/rl11/README.md
Normal file
42
devices/pdp11/rl11/README.md
Normal file
|
|
@ -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 ref="/devices/pdp11/rl11/default.xml"/>
|
||||
|
||||
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:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<device id="pc11" type="pc11" baudReceive="9600" autoMount='{path:"/apps/pdp11/tapes/absloader/DEC-11-L2PC-PO.json"}' pos="left" width="35%" padLeft="8px" padBottom="8px">
|
||||
<name>Paper Tape Controls</name>
|
||||
<control type="container">
|
||||
<control type="list" binding="listTapes">
|
||||
<tape id="tape00" name="Bootstrap Loader (16Kb)" path="/apps/pdp11/boot/bootstrap/BOOTSTRAP-16KB.json"/>
|
||||
<tape id="tape01" name="Absolute Loader" path="/apps/pdp11/tapes/absloader/DEC-11-L2PC-PO.json"/>
|
||||
<tape id="tape02" name="BASIC (Single User)" path="/apps/pdp11/tapes/basic/DEC-11-AJPB-PB.json"/>
|
||||
</control>
|
||||
<control type="button" binding="attachTape">Attach</control>
|
||||
<control type="button" binding="loadTape">Load</control>
|
||||
<control type="description" binding="descTape" padRight="8px"/>
|
||||
<control type="file" binding="mountTape"/>
|
||||
<control type="progress" binding="readProgress" pos="default" width="250px" padTop="8px">Tape Progress</control>
|
||||
</control>
|
||||
</device>
|
||||
13
devices/pdp11/rl11/default.xml
Normal file
13
devices/pdp11/rl11/default.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<device id="rl11" type="rl11" autoMount='{RL0:{path:"/disks/dec/rl02k/RL02K-DEMO3.json"}}' pos="left" width="35%" padLeft="8px" padBottom="8px">
|
||||
<name>Disk Drive Controls</name>
|
||||
<control type="container">
|
||||
<control type="list" binding="listDrives"/>
|
||||
<control type="list" binding="listDisks">
|
||||
<tape id="disk00" name="DEMO3 (10Mb)" path="/disks/dec/rl02k/RL02K-DEMO3.json"/>
|
||||
</control>
|
||||
<control type="button" binding="loadDrive">Load</control>
|
||||
<control type="description" binding="descDisk" padRight="8px"/>
|
||||
<control type="file" binding="mountDisk"/>
|
||||
</control>
|
||||
</device>
|
||||
|
|
@ -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<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
|
||||
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function fa(a,b){var c="";b?32<b&&(b=32):b=32;if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;)c=(a&1?"1":"0")+c,a>>=1;return c}function ha(a,b,c){var d="";if(!b||4<b)b=4;for(var e=0;e<b;e++)d&&(d=","+d),d=fa(a&255,8)+d,a>>=8;return(c?"0b":"")+d}
|
||||
function ia(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function r(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=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<k&&k<d&&(f=h,d=k)}!c&&f&&(c=this.jg+"!"+f[1]+"+"+v(d));break}}return c||this.kc+"+"+r(a,8,!0)};l=Lo.prototype;l.Ic=function(a,b,c,d){this.ha=d};l.hc=function(a,b){b||!this.xg||this.N||(xb(this,!1),this.load(this.ga,this.V,null,this.zl,this));return!0};l.zl=function(){xb(this,!0)};
|
||||
l.gc=function(a,b){if(this.N){var c,d=0;if(this.fa&&!Ea("Disk writes are still in progress, shut down anyway?"))return!1;for(;c=fp(this,!1);)if(d=c[0]){this.controller.Na('Unable to save "'+this.ga+'" (error '+d+")");break}b&&this.N&&(b="action=close&volume="+this.V,b+="&machine="+this.controller.gf(),b+="&user="+this.controller.ie(),Aa(Ba()+"/api/v1/disk?"+b,null,!0),this.N=!1);!d&&a&&this.controller.Na(this.ga+" saved")}return!0};
|
||||
function No(a,b,c,d,e,f){a.mode=b;a.Bb=c;a.ub=d;a.lb=e;a.Va=f;a.A=[];if("preload"!=a.mode){b=Array(a.Bb);for(c=0;c<b.length;c++){d=Array(a.ub);for(e=0;e<d.length;e++){f=Array(a.lb);for(var g=1;g<=f.length;g++)f[g-1]=gp(null,c,e,g,a.Va,"local"==a.mode?0:null);d[e]=f}b[c]=d}a.A=b}a.aa=null}
|
||||
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=512;b=g.Va>>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.Bb);for(c=0;c<g.A.length;c++)for(var f=g.A[c]=Array(g.ub),F=0;F<f.length;F++)for(var C=f[F]=Array(g.lb),D=0;D<C.length;D++){for(var L=gp(null,c,F,D+1,g.Va,0),G=L.data,ga=0;ga<b;ga++,
|
||||
e+=4)var S=G[ga]=a.getInt32(e,!0),d=d+S&-1;L.Zc=b;C[D]=L}g.aa=d;b=g}else g.Na("Unrecognized diskette format ("+c+" bytes)");g.W&&(g.W.call(g.controller,g.B,b,g.ga,g.V),g.W=null)};h.readAsArrayBuffer(c);return!0}0>b.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;c<g.A.length;c++)for(var f=g.A[c]=Array(g.ub),F=0;F<f.length;F++)for(var C=f[F]=Array(g.lb),D=0;D<C.length;D++){for(var L=gp(null,c,F,D+1,g.Va,0),G=L.data,ga=0;ga<
|
||||
b;ga++,e+=4)var S=G[ga]=a.getInt32(e,!0),d=d+S&-1;L.Zc=b;C[D]=L}g.aa=d;b=g}else g.Na("Unrecognized disk format ("+c+" bytes)");g.W&&(g.W.call(g.controller,g.B,b,g.ga,g.V),g.W=null)};h.readAsArrayBuffer(c);return!0}0>b.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(0<ja(a.Ug,!0).toLowerCase().indexOf("-readonly"))a.ff=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.ff=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.ga]:
|
||||
h=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)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<a.Bb;d++)for(f=0;f<a.ub;f++)for(g=0;g<a.lb;g++)if(k=h[d][f][g]){var m=k.length;void 0===m&&(m=k.length=512);var m=m>>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<A;F++)q[F]=n;kp(k,q,0)}else t=[],n=k.pattern=n|n<<8|n<<16|n<<24,k.data=t;delete k.bytes}gp(k,d,f);for(A=0;A<t.length;A++)c=c+t[A]&-1}a.A=h;a.aa=c;jp(a);e=a}else w("Empty disk image: "+a.ga)}catch(C){w("Disk image error ("+b+"): "+C.message)}}a.W&&(a.W.call(a.ka,a.B,e,a.ga,a.V),a.W=null)}
|
||||
|
|
@ -646,8 +646,8 @@ l.toJSON=function(){var a;a=0;for(var b;b=bp(this,a++);)up(b);a=JSON.stringify(t
|
|||
function up(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 vp(a){bb.call(this,"FDC",a,vp,524288);this.dmaRead=this.el;this.dmaWrite=this.fl;this.dmaFormat=this.vl;this.U=a.autoMount||null;this.fa=a.sortBy||"name";"none"==this.fa&&(this.fa=null);this.B=[];this.ia=!La("Mobi")&&window&&"FileReader"in window}jb(vp);aa={};
|
||||
var wp={3:{Ud:3,ge:0,name:aa.Fo},4:{Ud:2,ge:1,name:aa.Do},5:{Ud:9,ge:7,name:aa.Jo},6:{Ud:9,ge:7,name:aa.zo},7:{Ud:2,ge:0,name:aa.Bo},8:{Ud:1,ge:2,name:aa.Eo},10:{Ud:2,ge:7,name:aa.Ao},13:{Ud:6,ge:7,name:aa.wo},15:{Ud:3,ge:0,name:aa.Co}};l=vp.prototype;
|
||||
l.Pb=function(a,b,c){var d=this;switch(b){case "listDisks":this.qa[b]=c;if(this.fa){b=[];for(a=0;a<c.options.length;a++)b.push(c.options[a]);b.sort(function(a,b){return"path"!=d.fa?a.text.localeCompare(b.text):a.value.localeCompare(b.value)});for(a=0;a<b.length;a++)c.options[a]=b[a]}c.onchange=function(){var a=d.qa.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){w("FDC option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=
|
||||
g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");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='<a href="'+g+'" target="_blank">'+b+"</a>");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<this.A.length;a++)Ep(this,a,!0);Dp(this,!0)}}else if(!this.restore(a))return!1;if(a=this.qa.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;b<this.ka;b++){var c=document.createElement("option");c.value=b;c.text=String.fromCharCode(65+b)+":";a.appendChild(c)}0<this.ka&&(a.value="0",xp(this,0))}}return!0};l.gc=function(a){return a?this.save():!0};l.reset=function(){zp(this)};
|
||||
l.save=function(){var a=new qf(this);a.set(0,Fp(this));return a.data()};l.restore=function(a){return zp(this,a[0])};
|
||||
|
|
|
|||
|
|
@ -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,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]},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[":"];
|
||||
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<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
|
||||
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function fa(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=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<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}
|
||||
function ha(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ia(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ja={"&":"&","<":"<",">":">",'"':""","'":"'"};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<b.length;c++){d=Array(a.jb);for(e=0;e<d.length;e++){f=Array(a.eb);for(var g=1;g<=f.length;g++)f[g-1]=gm(null,c,e,g,a.nb,"local"==a.mode?0:null);d[e]=f}b[c]=d}a.A=b}a.L=null}
|
||||
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=512;b=g.nb>>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.ib);for(c=0;c<g.A.length;c++)for(var f=g.A[c]=Array(g.jb),B=0;B<f.length;B++)for(var Q=f[B]=Array(g.eb),V=0;V<Q.length;V++){for(var aa=gm(null,c,B,V+1,g.nb,0),Sa=aa.data,nb=0;nb<
|
||||
b;nb++,e+=4)var Df=Sa[nb]=a.getInt32(e,!0),d=d+Df&-1;aa.Dc=b;Q[V]=aa}g.L=d;b=g}else g.Ba("Unrecognized diskette format ("+c+" bytes)");g.K&&(g.K.call(g.controller,g.C,b,g.B,g.H),g.K=null)};h.readAsArrayBuffer(c);return!0}0>b.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;c<g.A.length;c++)for(var f=g.A[c]=Array(g.jb),B=0;B<f.length;B++)for(var Q=f[B]=Array(g.eb),V=0;V<Q.length;V++){for(var aa=gm(null,c,B,V+1,g.nb,0),Sa=aa.data,nb=
|
||||
0;nb<b;nb++,e+=4)var Df=Sa[nb]=a.getInt32(e,!0),d=d+Df&-1;aa.Dc=b;Q[V]=aa}g.L=d;b=g}else g.Ba("Unrecognized disk format ("+c+" bytes)");g.K&&(g.K.call(g.controller,g.C,b,g.B,g.H),g.K=null)};h.readAsArrayBuffer(c);return!0}0>b.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(0<ga(a.th,!0).toLowerCase().indexOf("-readonly"))a.te=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.te=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.B]:h=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<a.ib;d++)for(f=0;f<a.jb;f++)for(g=0;g<a.eb;g++)if(k=h[d][f][g]){var m=k.length;void 0===m&&(m=k.length=512);var m=m>>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<c.options.length;a++)b.push(c.options[a]);b.sort(function(a,b){return"path"!=d.W?a.text.localeCompare(b.text):a.value.localeCompare(b.value)});for(a=0;a<b.length;a++)c.options[a]=b[a]}c.onchange=function(){var a=d.la.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){r("FDC option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;
|
||||
void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");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='<a href="'+g+'" target="_blank">'+b+"</a>");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<this.B.length;a++)Cm(this,a,!0);Bm(this,!0)}}else if(!this.restore(a))return!1;if(a=this.la.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;b<this.Z;b++){var c=document.createElement("option");c.value=b;c.text=String.fromCharCode(65+b)+":";a.appendChild(c)}0<this.Z&&(a.value="0",vm(this,0))}}return!0};l.Tb=function(a){return a?this.save():!0};l.reset=function(){xm(this)};
|
||||
l.save=function(){var a=new de(this);a.set(0,Dm(this));return a.data()};l.restore=function(a){return xm(this,a[0])};
|
||||
|
|
|
|||
|
|
@ -2499,11 +2499,12 @@ DiskDump.prototype.convertToJSON = function()
|
|||
* image whose logical format doesn't agree with its physical structure.
|
||||
*/
|
||||
var fXDFOutput = false;
|
||||
var disketteFormat = DiskAPI.DISKETTE_FORMATS[cbDiskData];
|
||||
if (disketteFormat) {
|
||||
nCylinders = disketteFormat[0];
|
||||
nHeads = disketteFormat[1];
|
||||
nSectorsPerTrack = disketteFormat[2];
|
||||
var diskFormat = DiskAPI.DISK_FORMATS[cbDiskData];
|
||||
if (diskFormat) {
|
||||
nCylinders = diskFormat[0];
|
||||
nHeads = diskFormat[1];
|
||||
nSectorsPerTrack = diskFormat[2];
|
||||
cbSector = diskFormat[3] || cbSector;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -804,7 +804,7 @@ var SectorInfo;
|
|||
* 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 Disk() constructor.
|
||||
*
|
||||
* @this {ChipSet}
|
||||
* @this {Disk}
|
||||
* @param {Computer} cmp
|
||||
* @param {Bus} bus
|
||||
* @param {X86CPU} cpu
|
||||
|
|
@ -858,7 +858,7 @@ Disk.prototype.powerUp = function(data, fRepower) {
|
|||
*
|
||||
* This is a callback issued by the Disk component once the load() from powerUp() has finished.
|
||||
*
|
||||
* @this {HDC}
|
||||
* @this {Disk}
|
||||
* @param {Object} drive
|
||||
* @param {Disk} disk is set if the disk was successfully mounted, null if not
|
||||
* @param {string} sDiskName
|
||||
|
|
@ -1106,13 +1106,13 @@ Disk.prototype.build = function(buffer, fModified)
|
|||
{
|
||||
var disk;
|
||||
var cbDiskData = buffer? buffer.byteLength : 0;
|
||||
var disketteFormat = DiskAPI.DISKETTE_FORMATS[cbDiskData];
|
||||
var diskFormat = DiskAPI.DISK_FORMATS[cbDiskData];
|
||||
|
||||
if (disketteFormat) {
|
||||
this.nCylinders = disketteFormat[0];
|
||||
this.nHeads = disketteFormat[1];
|
||||
this.nSectors = disketteFormat[2];
|
||||
this.cbSector = 512;
|
||||
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;
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
1233
modules/pdp11/lib/disk.js
Normal file
1233
modules/pdp11/lib/disk.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,85 +0,0 @@
|
|||
/**
|
||||
* @fileoverview Implements RK11 device support.
|
||||
* @author <a href="mailto:Jeff@pcjs.org">Jeff Parsons</a>
|
||||
* @copyright © Jeff Parsons 2012-2016
|
||||
*
|
||||
* This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
|
||||
*
|
||||
* 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 <http://skn.noip.me/pdp11/pdp11.html>. 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 <http://www.gnu.org/licenses/gpl.html>.
|
||||
*
|
||||
* 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
|
||||
* <http://pcjs.org/modules/shared/lib/defines.js>.
|
||||
*
|
||||
* 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;
|
||||
868
modules/pdp11/lib/rl11.js
Normal file
868
modules/pdp11/lib/rl11.js
Normal file
|
|
@ -0,0 +1,868 @@
|
|||
/**
|
||||
* @fileoverview Implements the RL11 Disk Controller (for RL01 and RL02 Disks)
|
||||
* @author <a href="mailto:Jeff@pcjs.org">Jeff Parsons</a>
|
||||
* @copyright © Jeff Parsons 2012-2016
|
||||
*
|
||||
* This file is part of PCjs, a computer emulation software project at <http://pcjs.org/>.
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/gpl.html>.
|
||||
*
|
||||
* 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
|
||||
* <http://pcjs.org/modules/shared/lib/defines.js>.
|
||||
*
|
||||
* 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 = "<a href=\"" + sHRef + "\" target=\"_blank\">" + sHTML + "</a>";
|
||||
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;
|
||||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
|
||||
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function fa(a,b){var c="";b?32<b&&(b=32):b=32;if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;)c=(a&1?"1":"0")+c,a>>=1;return c}function ha(a,b,c){var d="";if(!b||4<b)b=4;for(var e=0;e<b;e++)d&&(d=","+d),d=fa(a&255,8)+d,a>>=8;return(c?"0b":"")+d}
|
||||
function ia(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function r(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=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<k&&k<d&&(f=h,d=k)}!c&&f&&(c=this.jg+"!"+f[1]+"+"+v(d));break}}return c||this.kc+"+"+r(a,8,!0)};l=Lo.prototype;l.Ic=function(a,b,c,d){this.ha=d};l.hc=function(a,b){b||!this.xg||this.N||(xb(this,!1),this.load(this.ga,this.V,null,this.zl,this));return!0};l.zl=function(){xb(this,!0)};
|
||||
l.gc=function(a,b){if(this.N){var c,d=0;if(this.fa&&!Ea("Disk writes are still in progress, shut down anyway?"))return!1;for(;c=fp(this,!1);)if(d=c[0]){this.controller.Na('Unable to save "'+this.ga+'" (error '+d+")");break}b&&this.N&&(b="action=close&volume="+this.V,b+="&machine="+this.controller.gf(),b+="&user="+this.controller.ie(),Aa(Ba()+"/api/v1/disk?"+b,null,!0),this.N=!1);!d&&a&&this.controller.Na(this.ga+" saved")}return!0};
|
||||
function No(a,b,c,d,e,f){a.mode=b;a.Bb=c;a.ub=d;a.lb=e;a.Va=f;a.A=[];if("preload"!=a.mode){b=Array(a.Bb);for(c=0;c<b.length;c++){d=Array(a.ub);for(e=0;e<d.length;e++){f=Array(a.lb);for(var g=1;g<=f.length;g++)f[g-1]=gp(null,c,e,g,a.Va,"local"==a.mode?0:null);d[e]=f}b[c]=d}a.A=b}a.aa=null}
|
||||
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=512;b=g.Va>>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.Bb);for(c=0;c<g.A.length;c++)for(var f=g.A[c]=Array(g.ub),F=0;F<f.length;F++)for(var C=f[F]=Array(g.lb),D=0;D<C.length;D++){for(var L=gp(null,c,F,D+1,g.Va,0),G=L.data,ga=0;ga<b;ga++,
|
||||
e+=4)var S=G[ga]=a.getInt32(e,!0),d=d+S&-1;L.Zc=b;C[D]=L}g.aa=d;b=g}else g.Na("Unrecognized diskette format ("+c+" bytes)");g.W&&(g.W.call(g.controller,g.B,b,g.ga,g.V),g.W=null)};h.readAsArrayBuffer(c);return!0}0>b.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;c<g.A.length;c++)for(var f=g.A[c]=Array(g.ub),F=0;F<f.length;F++)for(var C=f[F]=Array(g.lb),D=0;D<C.length;D++){for(var L=gp(null,c,F,D+1,g.Va,0),G=L.data,ga=0;ga<
|
||||
b;ga++,e+=4)var S=G[ga]=a.getInt32(e,!0),d=d+S&-1;L.Zc=b;C[D]=L}g.aa=d;b=g}else g.Na("Unrecognized disk format ("+c+" bytes)");g.W&&(g.W.call(g.controller,g.B,b,g.ga,g.V),g.W=null)};h.readAsArrayBuffer(c);return!0}0>b.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(0<ja(a.Ug,!0).toLowerCase().indexOf("-readonly"))a.ff=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.ff=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.ga]:
|
||||
h=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)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<a.Bb;d++)for(f=0;f<a.ub;f++)for(g=0;g<a.lb;g++)if(k=h[d][f][g]){var m=k.length;void 0===m&&(m=k.length=512);var m=m>>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<A;F++)q[F]=n;kp(k,q,0)}else t=[],n=k.pattern=n|n<<8|n<<16|n<<24,k.data=t;delete k.bytes}gp(k,d,f);for(A=0;A<t.length;A++)c=c+t[A]&-1}a.A=h;a.aa=c;jp(a);e=a}else w("Empty disk image: "+a.ga)}catch(C){w("Disk image error ("+b+"): "+C.message)}}a.W&&(a.W.call(a.ka,a.B,e,a.ga,a.V),a.W=null)}
|
||||
|
|
@ -646,8 +646,8 @@ l.toJSON=function(){var a;a=0;for(var b;b=bp(this,a++);)up(b);a=JSON.stringify(t
|
|||
function up(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 vp(a){bb.call(this,"FDC",a,vp,524288);this.dmaRead=this.el;this.dmaWrite=this.fl;this.dmaFormat=this.vl;this.U=a.autoMount||null;this.fa=a.sortBy||"name";"none"==this.fa&&(this.fa=null);this.B=[];this.ia=!La("Mobi")&&window&&"FileReader"in window}jb(vp);aa={};
|
||||
var wp={3:{Ud:3,ge:0,name:aa.Fo},4:{Ud:2,ge:1,name:aa.Do},5:{Ud:9,ge:7,name:aa.Jo},6:{Ud:9,ge:7,name:aa.zo},7:{Ud:2,ge:0,name:aa.Bo},8:{Ud:1,ge:2,name:aa.Eo},10:{Ud:2,ge:7,name:aa.Ao},13:{Ud:6,ge:7,name:aa.wo},15:{Ud:3,ge:0,name:aa.Co}};l=vp.prototype;
|
||||
l.Pb=function(a,b,c){var d=this;switch(b){case "listDisks":this.qa[b]=c;if(this.fa){b=[];for(a=0;a<c.options.length;a++)b.push(c.options[a]);b.sort(function(a,b){return"path"!=d.fa?a.text.localeCompare(b.text):a.value.localeCompare(b.value)});for(a=0;a<b.length;a++)c.options[a]=b[a]}c.onchange=function(){var a=d.qa.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){w("FDC option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=
|
||||
g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");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='<a href="'+g+'" target="_blank">'+b+"</a>");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<this.A.length;a++)Ep(this,a,!0);Dp(this,!0)}}else if(!this.restore(a))return!1;if(a=this.qa.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;b<this.ka;b++){var c=document.createElement("option");c.value=b;c.text=String.fromCharCode(65+b)+":";a.appendChild(c)}0<this.ka&&(a.value="0",xp(this,0))}}return!0};l.gc=function(a){return a?this.save():!0};l.reset=function(){zp(this)};
|
||||
l.save=function(){var a=new qf(this);a.set(0,Fp(this));return a.data()};l.restore=function(a){return zp(this,a[0])};
|
||||
|
|
|
|||
|
|
@ -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,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]},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[":"];
|
||||
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<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
|
||||
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function fa(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=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<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}
|
||||
function ha(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ia(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ja={"&":"&","<":"<",">":">",'"':""","'":"'"};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<b.length;c++){d=Array(a.jb);for(e=0;e<d.length;e++){f=Array(a.eb);for(var g=1;g<=f.length;g++)f[g-1]=gm(null,c,e,g,a.nb,"local"==a.mode?0:null);d[e]=f}b[c]=d}a.A=b}a.L=null}
|
||||
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=512;b=g.nb>>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.ib);for(c=0;c<g.A.length;c++)for(var f=g.A[c]=Array(g.jb),B=0;B<f.length;B++)for(var Q=f[B]=Array(g.eb),V=0;V<Q.length;V++){for(var aa=gm(null,c,B,V+1,g.nb,0),Sa=aa.data,nb=0;nb<
|
||||
b;nb++,e+=4)var Df=Sa[nb]=a.getInt32(e,!0),d=d+Df&-1;aa.Dc=b;Q[V]=aa}g.L=d;b=g}else g.Ba("Unrecognized diskette format ("+c+" bytes)");g.K&&(g.K.call(g.controller,g.C,b,g.B,g.H),g.K=null)};h.readAsArrayBuffer(c);return!0}0>b.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;c<g.A.length;c++)for(var f=g.A[c]=Array(g.jb),B=0;B<f.length;B++)for(var Q=f[B]=Array(g.eb),V=0;V<Q.length;V++){for(var aa=gm(null,c,B,V+1,g.nb,0),Sa=aa.data,nb=
|
||||
0;nb<b;nb++,e+=4)var Df=Sa[nb]=a.getInt32(e,!0),d=d+Df&-1;aa.Dc=b;Q[V]=aa}g.L=d;b=g}else g.Ba("Unrecognized disk format ("+c+" bytes)");g.K&&(g.K.call(g.controller,g.C,b,g.B,g.H),g.K=null)};h.readAsArrayBuffer(c);return!0}0>b.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(0<ga(a.th,!0).toLowerCase().indexOf("-readonly"))a.te=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.te=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.B]:h=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<a.ib;d++)for(f=0;f<a.jb;f++)for(g=0;g<a.eb;g++)if(k=h[d][f][g]){var m=k.length;void 0===m&&(m=k.length=512);var m=m>>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<c.options.length;a++)b.push(c.options[a]);b.sort(function(a,b){return"path"!=d.W?a.text.localeCompare(b.text):a.value.localeCompare(b.value)});for(a=0;a<b.length;a++)c.options[a]=b[a]}c.onchange=function(){var a=d.la.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){r("FDC option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;
|
||||
void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");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='<a href="'+g+'" target="_blank">'+b+"</a>");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<this.B.length;a++)Cm(this,a,!0);Bm(this,!0)}}else if(!this.restore(a))return!1;if(a=this.la.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;b<this.Z;b++){var c=document.createElement("option");c.value=b;c.text=String.fromCharCode(65+b)+":";a.appendChild(c)}0<this.Z&&(a.value="0",vm(this,0))}}return!0};l.Tb=function(a){return a?this.save():!0};l.reset=function(){xm(this)};
|
||||
l.save=function(){var a=new de(this);a.set(0,Dm(this));return a.data()};l.restore=function(a){return xm(this,a[0])};
|
||||
|
|
|
|||
|
|
@ -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,253 +26,283 @@
|
|||
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 k,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,da=["Math","log2"],ea=0;ea<da.length-1;ea++){var fa=da[ea];fa in ba||(ba[fa]={});ba=ba[fa]}var ga=da[da.length-1],ha=ba[ga],ia=ha?ha:function(a){return Math.log(a)/Math.LN2};
|
||||
ia!=ha&&null!=ia&&aa(ba,ga,{configurable:!0,writable:!0,value:ia});function na(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function l(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=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<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function pa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function qa(){var a=ra();return-1!==a.indexOf("pcjs.org",a.length-8)}var sa={"&":"&","<":"<",">":">",'"':""","'":"'"};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<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var za=Date.now||function(){return+new Date};function Aa(){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 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<e.length;c++)d.da[f++]=e[c]&255,d.da[f++]=e[c]>>8&255;else if(e=g.data)for(d.da=Array(4*e.length),f=c=0;c<e.length;c++)d.da[f++]=
|
||||
e[c]&255,d.da[f++]=e[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;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){n("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.da=e)}return d}
|
||||
function ra(){return"http://"+(window?window.location.host:"www.pcjs.org")}function n(a){window&&window.alert(a)}function Da(a){var b=!1;window&&(b=window.confirm(a));return b}var Ea=null;function Fa(){if(null==Ea){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ea=a}return Ea}
|
||||
function Ga(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Ka(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function La(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Ma(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
||||
function Na(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Oa={init:[],show:[],exit:[]},Pa=!1,Qa=!1,Ra=!0;function Sa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ta(a){Oa.init.push(a)}
|
||||
function Ua(a){if(Ra)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){n(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Va(a){!Ra&&a?(Ra=!0,Pa&&Wa("init"),Qa&&Wa("show")):Ra=a}function Wa(a){Oa[a]&&Ua(Oa[a])}Sa("onload",function(){Pa=!0;Ua(Oa.init)});Sa("onpageshow",function(){Qa=!0;Ua(Oa.show)});Sa(La("Opera")||La("iOS")?"onunload":"onbeforeunload",function(){Ua(Oa.exit)});
|
||||
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Xb=b.comment;this.tc=b;b=this.id.indexOf(".");0>b?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<t.length;b++){var d=t[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function lb(a){if(void 0!==a){var b;for(b=0;b<t.length;b++)if(t[b].id===a)return t[b]}return null}function mb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<t.length;d++)if(c)c==t[d]&&(c=null);else if(!(a!=t[d].type||b&&t[d].id.indexOf(b)))return t[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){n(c.message+" ("+a+")")}return b}
|
||||
function B(a,b){b=C(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),m=0;m<h.length;m++)switch(g=h[m],g){case "pdp11-binding":(g=z(f))&&g.binding&&a.qa(g.type,g.binding,f,g.value),m=h.length}}}}
|
||||
function C(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
|
||||
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},qa:function(a,b,c){switch(b){case "clear":return this.I[b]||(this.I[b]=c,c.onclick=function(a){return function(){a.I.print&&(a.I.print.value="")}}(this)),!0;case "print":return this.I[b]||(this.Fa=this.I[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
|
||||
this.ja=function(a){this.j(a,this.$a)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.$a+": "+a)},ja:function(a,b,c){c=c||this.type;b||n((c?c+": ":"")+a)},Aa:function(){return this.v.ka=!0},za:function(a,b){b&&(this.v.ka=!1);return!0}};function D(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.na;var c=a.i.na&b;return!!b&&c===b||!!(c&a.i.oc)}return!1}
|
||||
function nb(a,b){if(a.v.Lb)return a.v.Ja=!1,a.v.Lb=!1;if(a.v.error)return a.j(a.toString()+" error"),!1;a.v.Ja=b;return a.v.Ja}function ob(a,b){a.v.Ja&&(b?a.v.Lb=!0:void 0===b&&a.j(a.toString()+" busy"));return a.v.Ja}function H(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.Cb;a.Cb=null;b&&b()}}function pb(a,b){b&&(a.v.ready?b():a.Cb=b);return a.v.ready}function qb(a){return a.v.error?(a.j(a.toString()+" error"),!0):!1}function rb(a,b){a.v.error=!0;a.ja(b)}
|
||||
for(var k,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<ca.length-1;da++){var fa=ca[da];fa in ba||(ba[fa]={});ba=ba[fa]}var ga=ca[ca.length-1],ha=ba[ga],ja=ha?ha:function(a){return Math.log(a)/Math.LN2};
|
||||
ja!=ha&&null!=ja&&aa(ba,ga,{configurable:!0,writable:!0,value:ja});var ka={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]};
|
||||
function pa(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
|
||||
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function qa(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function l(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=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<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function sa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ta(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ua={"&":"&","<":"<",">":">",'"':""","'":"'"};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<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var Aa=Date.now||function(){return+new Date};function Ba(){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 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<e.length;c++)d.ea[f++]=e[c]&255,d.ea[f++]=e[c]>>8&255;else if(e=g.data)for(d.ea=Array(4*e.length),f=c=0;c<e.length;c++)d.ea[f++]=
|
||||
e[c]&255,d.ea[f++]=e[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;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){p("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.ea=e)}return d}
|
||||
function Fa(){return"http://"+(window?window.location.host:"www.pcjs.org")}function p(a){window&&window.alert(a)}function Ga(a){var b=!1;window&&(b=window.confirm(a));return b}var Ha=null;function Ia(){if(null==Ha){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ha=a}return Ha}
|
||||
function Ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Na(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Oa(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Pa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
||||
function Qa(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Ra={init:[],show:[],exit:[]},Sa=!1,Ta=!1,Ua=!0;function Va(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Wa(a){Ra.init.push(a)}
|
||||
function Xa(a){if(Ua)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){p(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ya(a){!Ua&&a?(Ua=!0,Sa&&Za("init"),Ta&&Za("show")):Ua=a}function Za(a){Ra[a]&&Xa(Ra[a])}Va("onload",function(){Sa=!0;Xa(Ra.init)});Va("onpageshow",function(){Ta=!0;Xa(Ra.show)});Va(Oa("Opera")||Oa("iOS")?"onunload":"onbeforeunload",function(){Xa(Ra.exit)});
|
||||
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.mc=b.comment;this.Oc=b;b=this.id.indexOf(".");0>b?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<t.length;b++){var d=t[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function ob(a){if(void 0!==a){var b;for(b=0;b<t.length;b++)if(t[b].id===a)return t[b]}return null}function pb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<t.length;d++)if(c)c==t[d]&&(c=null);else if(!(a!=t[d].type||b&&t[d].id.indexOf(b)))return t[d]}return null}function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){p(c.message+" ("+a+")")}return b}
|
||||
function C(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),m=0;m<h.length;m++)switch(g=h[m],g){case "pdp11-binding":(g=A(f))&&g.binding&&a.qa(g.type,g.binding,f,g.value),m=h.length}}}}
|
||||
function D(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
|
||||
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},qa:function(a,b,c){switch(b){case "clear":return this.F[b]||(this.F[b]=c,c.onclick=function(a){return function(){a.F.print&&(a.F.print.value="")}}(this)),!0;case "print":return this.F[b]||(this.Ka=this.F[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
|
||||
this.O=function(a){this.j(a,this.Za)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.Za+": "+a)},O:function(a,b,c){c=c||this.type;b||p((c?c+": ":"")+a)},za:function(){return this.v.ha=!0},ya:function(a,b){b&&(this.v.ha=!1);return!0}};function E(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.na;var c=a.i.na&b;return!!b&&c===b||!!(c&a.i.Ic)}return!1}
|
||||
function qb(a,b){if(a.v.Vb)return a.v.Qa=!1,a.v.Vb=!1;if(a.v.error)return a.j(a.toString()+" error"),!1;a.v.Qa=b;return a.v.Qa}function rb(a,b){a.v.Qa&&(b?a.v.Vb=!0:void 0===b&&a.j(a.toString()+" busy"));return a.v.Qa}function G(a,b){a.v.error||(a.v.ready=!1!==b,a.v.ready&&(b=a.Lb,a.Lb=null,b&&b()))}function sb(a,b){b&&(a.v.ready?b():a.Lb=b);return a.v.ready}function tb(a){return a.v.error?(a.j(a.toString()+" error"),!0):!1}function ub(a,b){a.v.error=!0;a.O(b)}
|
||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});
|
||||
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 sb="undefined"!==typeof ArrayBuffer,tb={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 ub(a){r.call(this,"Panel",a,ub);this.f=0;this.v.Vb=!0}u(ub);k=ub.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.I[b]=c,this.f++,!0;default:return"rled"==a?(this.I[b]=c,this.f++,!0):this.parent.qa.call(this,a,b,c,d)}};k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d};k.Aa=function(a,b){b||vb();return!0};k.za=function(){return!0};
|
||||
function wb(a,b,c,d){if(a.I[b]){void 0===c&&(rb(a,"Value for "+b+" is invalid"),a.b.ga());var e=a.i&&a.i.Y||8;c=!a.b.v.ea||a.v.Vb?8==e?na(c,d):l(c,d):"--------".substr(0,d||4);a.I[b].textContent!=c&&(a.I[b].textContent=c)}}function xb(a,b,c,d){for(var e=0;e<d;e++){var f=a.I[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
|
||||
k.ca=function(a){if(this.f&&(a||!this.b.v.ea||this.v.Vb)){for(a=0;a<this.b.u.length;a++)wb(this,"R"+a,this.b.u[a]);a=Lb(this.b);wb(this,"PS",a);wb(this,"NF",a&8?1:0,1);wb(this,"ZF",a&4?1:0,1);wb(this,"VF",a&2?1:0,1);wb(this,"CF",a&1?1:0,1);xb(this,"D",this.b.u[0],16);xb(this,"A",this.b.u[7],22)}};function vb(){for(var a=!1,b=C(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=lb(e.id);f||(a=!0,f=new ub(e));B(f,d);a&&H(f)}}Ta(vb);
|
||||
function Mb(a,b,c){r.call(this,"Bus",a,Mb,64);this.b=b;this.i=c;this.L=a.busWidth||16;this.B=0;this.K=[];this.F=null;this.H=Math.pow(2,this.L);this.g=this.H-1|0;this.ua=Nb;this.ia=Math.log2(this.ua);this.J=this.ua>>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<this.C;b++)this.V[b]=a;H(this)}u(Mb);var Nb=8192,Tb=Nb-1;
|
||||
function Ob(a,b){var c=-1,d=this.controller,e=d.Ia[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>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.B)-Nb,Wb(a,c,Nb,a.K),a.B=0);b&&(a.B=b,c=(1<<b)-Nb,a.K=Xb(a,c,Nb),a.F?Wb(a,c,Nb,a.F):(Yb(a,c,Nb,Zb,a),a.F=Xb(a,c,Nb)))}}k=Mb.prototype;k.reset=function(){for(var a=0;a<this.A.length;a++)this.A[a]();Vb(this,16)};function Ub(a,b,c,d){a.i&&F(a.i,536870912)&&(D(a.i,"warning: unknown I/O access ("+J(a.i,b)+","+J(a.i,d,c?1:2)+")",!0,!0),$b(a.i));a.f||a.b.ha(4,b);return 0}k.Aa=function(a,b){b||this.reset();return!0};
|
||||
function Yb(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ia;0<g&&h<a.V.length;){var m=a.V[h],p=h*a.ua,q=a.ua-(f-p);q>g&&(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<v&&(v=10):v=c&-65536?10:5;if(null==c||isNaN(c))for(;0<v--;)e="?"+e;else for(;0<v--;)e=String.fromCharCode(c%10+48)+e,c/=
|
||||
10;a.status(e+"Kb "+bc[d]+" at "+na(b));return!0}return ac(2,b,c)}function Xb(a,b,c){var d=[];for(b>>>=a.ia;0<c&&b<a.V.length;)d.push(a.V[b++]),c-=a.ua;return d}function Wb(a,b,c,d){var e=0;for(b>>>=a.ia;0<c&&b<a.V.length;){var f=d[e++];if(!f)break;a.V[b++]=f;c-=a.ua}}k.tb=function(a){return this.V[(a&this.g)>>>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;d<a.C;d++){var e=a.V[d];if(e.Ka||e.pc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,m=[];g<e.length;){for(var p=e[g],q=g+1;q<e.length&&e[q]===p;)q++;m[h++]=q-g;m[h++]=p;g=q}m.length<e.length&&(e=m)}c[f]=e}}return c}function dc(a,b,c,d,e,f,g,h){for(;b<=c;b+=2){var m=b&Tb;void 0!==a.Ia[m]?n("I/O address already registered: "+l(b,8,!0)):a.Ia[m]=[d,e,f,g,h||"unknown",!1]}}
|
||||
function ec(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.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<d;e++){var f=a.F[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
|
||||
k.da=function(a){if(this.f&&(a||!this.b.v.fa||this.v.jc)){for(a=0;a<this.b.u.length;a++)zb(this,"R"+a,this.b.u[a]);a=Bb(this.b);zb(this,"PS",a);zb(this,"NF",a&8?1:0,1);zb(this,"ZF",a&4?1:0,1);zb(this,"VF",a&2?1:0,1);zb(this,"CF",a&1?1:0,1);Ab(this,"D",this.b.u[0],16);Ab(this,"A",this.b.u[7],22)}};function yb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=ob(e.id);f||(a=!0,f=new xb(e));C(f,d);a&&G(f)}}Wa(yb);
|
||||
function Cb(a,b,c){r.call(this,"Bus",a,Cb,64);this.b=b;this.i=c;this.L=a.busWidth||16;this.B=0;this.K=[];this.G=null;this.I=Math.pow(2,this.L);this.g=this.I-1|0;this.ua=Qb;this.ka=Math.log2(this.ua);this.J=this.ua>>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<this.C;b++)this.W[b]=a;G(this)}u(Cb);var Qb=8192,Wb=Qb-1;
|
||||
function Rb(a,b){var c=-1,d=this.controller,e=d.Pa[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>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.B)-Qb,Zb(a,c,Qb,a.K),a.B=0);b&&(a.B=b,c=(1<<b)-Qb,a.K=$b(a,c,Qb),a.G?Zb(a,c,Qb,a.G):(ac(a,c,Qb,bc,a),a.G=$b(a,c,Qb)))}}k=Cb.prototype;k.reset=function(){for(var a=0;a<this.A.length;a++)this.A[a]();Yb(this,16)};function Xb(a,b,c,d){a.i&&F(a.i,536870912)&&(E(a.i,"warning: unknown I/O access ("+J(a.i,b)+","+J(a.i,d,c?1:2)+")",!0,!0),cc(a.i));a.f||a.b.ja(4,b);return 0}k.za=function(a,b){b||this.reset();return!0};
|
||||
function ac(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ka;0<g&&h<a.W.length;){var m=a.W[h],n=h*a.ua,q=a.ua-(f-n);q>g&&(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<w&&(w=10):w=c&-65536?10:5;if(null==c||isNaN(c))for(;0<w--;)e="?"+e;else for(;0<w--;)e=String.fromCharCode(c%10+48)+e,c/=
|
||||
10;a.status(e+"Kb "+ec[d]+" at "+qa(b));return!0}return dc(2,b,c)}function $b(a,b,c){var d=[];for(b>>>=a.ka;0<c&&b<a.W.length;)d.push(a.W[b++]),c-=a.ua;return d}function Zb(a,b,c,d){var e=0;for(b>>>=a.ka;0<c&&b<a.W.length;){var f=d[e++];if(!f)break;a.W[b++]=f;c-=a.ua}}k.zb=function(a){return this.W[(a&this.g)>>>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;d<a.C;d++){var e=a.W[d];if(e.La||e.Kc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,m=[];g<e.length;){for(var n=e[g],q=g+1;q<e.length&&e[q]===n;)q++;m[h++]=q-g;m[h++]=n;g=q}m.length<e.length&&(e=m)}c[f]=e}}return c}function gc(a,b,c,d,e,f,g,h){for(;b<=c;b+=2){var m=b&Wb;void 0!==a.Pa[m]?p("I/O address already registered: "+l(b,8,!0)):a.Pa[m]=[d,e,f,g,h||"unknown",!1]}}
|
||||
function hc(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.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<a.length;b++){var c,d=a[b];c=z(d);switch(c.type){case "default":c=new K(c);B(c,d);break;case "pc11":c=new xc(c),B(c,d)}}});var yc;
|
||||
if(sb){var zc=new ArrayBuffer(2);(new DataView(zc)).setUint16(0,256,!0);yc=256===(new Uint16Array(zc))[0]}else yc=!1;var Ac=yc;
|
||||
function I(a,b,c,d,e,f){this.w=a;this.id=Bc+=2;this.b=null;this.D=b;this.yb=c;this.size=d||0;this.type=e||Cc;this.g=e==Dc;this.controller=null;Sb(this);this.Ka=this.pc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],Ec(this,f.nc);else if(sb)this.C=new ArrayBuffer(this.size),this.F=new DataView(this.C,0,this.size),this.f=new Uint8Array(this.C,0,this.size),this.J=new Uint16Array(this.C,0,this.size>>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<a.length;f++)a[f]=0;Ec(this,Hc)}else Ec(this)}var Cc=0,Dc=2,Zb=4,bc=["NONE","RAM","ROM","VID","H/W"],Bc=0;
|
||||
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(sb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.F.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(sb)for(b=0;b<a.length;b++)this.F.setInt32(b<<2,a[b],!0);else this.b=a;return this.Ka=!0}return!1},Wa:function(a,b){b?this.B++||Ic(this,Jc,!1):this.I++||Kc(this,Jc,!1)},K:function(a,b){this.i&&F(this.i,128)&&(D(this.i,
|
||||
"attempt to read invalid address "+J(this.i,b),!0),$b(this.i));gc(this.w,b,2);return 255},A:function(a,b,c){this.i&&F(this.i,128)&&(D(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0),$b(this.i));gc(this.w,c,4)},L:function(a,b){return this.Fb(a++,b++)|this.Fb(a,b)<<8},H:function(a,b,c){this.Jb(a++,b&255,c++);this.Jb(a,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<<a)|b<<a;this.Ka=!0},Ca:function(a,b,c){a&1&&gc(this.w,c,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>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<Pc.length;b++)(c=this.I[Pc[b]])&&this.B.qa(null,Pc[b],c);a=Qc(a,"autoStart");null!=a&&(this.v.ab="true"==a?!0:"false"==a?!1:!!a);H(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
|
||||
k.Aa=function(a,b){if(!b){if(a&&this.restore){Rc(this);if(!this.restore(a))return!1;Sc(this)}else this.reset();this.i?(a=this.i,b=this.v.ab,a.Ua=!0,a.j("Type ? for help with PDP11 Debugger commands"),a.ca(),b||a.lb(),a.Ca&&(b=a.Ca,a.Ca=null,Tc(a,b))):this.j("No debugger detected")}this.B.ca();return!0};k.za=function(a){return a?this.save():!0};k.ab=function(){return this.v.ab||!this.i&&void 0===this.I.run?(this.mb(),!0):!1};k.Yb=function(){return 0};
|
||||
function Sc(a){void 0===a.vb&&(a.vb=0);void 0===a.gb&&(a.gb=-1);void 0===a.hb&&(a.hb=-1);a.v.cb=0<=a.vb&&0<a.gb;a.v.cb&&(a.ub=0,a.ma=a.vb-a.la)}function Uc(a,b){if(a.v.cb){var c=!1;a.ub=a.ub+a.Yb()|0;a.ma-=b;0>=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;c<h.length&&(b=h[c],b===a||b.v.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.v.ka);c++);c==h.length&&(b=a);n("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.Cb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ea?d.ga():d.mb())},
|
||||
!0;case "speed":return this.I[b]=c,!0;case "setSpeed":return this.I[b]=c,c.onclick=function(){Wc(d,d.Na<<1,!0)},c.textContent=this.Xa.toFixed(2)+"Mhz",!0}return!1};k.ca=function(){var a=this.I.speed;a&&(a.textContent=this.v.ea&&this.X?this.X.toFixed(2)+"Mhz":"Stopped")};function Xc(a,b,c){a.la+=b;c&&(a.aa=a.b=a.J=0)}function Yc(a,b){var c=1;b&&1<a.Na&&a.X&&(c=a.X/a.qb);a.ac=Math.round(1E3/30);a.Va=Math.floor(a.Ra/30*c);b||(a.ra=a.Va);a.sb=0}function Vc(a){return a.la+a.R+a.aa-a.b}
|
||||
function Rc(a){a.X=0;a.bc=0;a.la=a.R=a.aa=a.b=a.J=0;Sc(a);Wc(a,1)}function Wc(a,b,c){var d=!1;if(void 0!==b){.8>a.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&&b<a.K.length&&0>a.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.X<this.Xa)-1E3>c&&(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<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.J){for(var f=0,g=Array(b.J),h=0;h<e.length-1;)for(var m=e[h++],p=e[h++];m--;)g[f++]=p;e=g}f=b.V[d];if(!f||!f.restore(e)){n("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function hd(a){return a.S&65536?1:0}
|
||||
function id(a){return a.T&32768?2:0}function jd(a){return a.Z&65535?0:4}k.Ga=function(){return this.W&32768?8:0};function kd(a){var b=a.u[7];a.C&57344||(a.Oa=0,a.xb=b);a.u[7]=b+2&65535;return a.pa(b)}function ld(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function N(a,b){a.u[7]=b&65535}function kc(a,b){return{ld:a,ib:b,next:null}}function ic(a,b){if(b!=a.N){var c=a.N;if(!c||c.ib<=b.ib)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.ib<=b.ib){b.next=d;c.next=b;break}c=d}while(c)}}a.G|=2}
|
||||
function Lb(a){return a.M=a.M&63728|a.Ga()|jd(a)|id(a)|hd(a)}function wc(a,b){a.W=b<<12;a.Z=~b&4;a.T=b<<14;a.S=b<<16;if((b^a.M)&2048)for(var c=a.Ha.length;0<=--c;){var d=a.u[c];a.u[c]=a.Ha[c];a.Ha[c]=d}a.A=b>>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(f<a.Ta)f&1&&!(c&1)&&(a.ba|=64,a.ha(4,10));else if(a.Pa&16||253952<=f&&(f|=4186112),4186112>f){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||4194239<f)||(a.C|=4096,a.C&512&&(a.G|=32)));return f}function Md(a,b){return a.w.tb(b)}function Nd(a,b,c){b&1&&a.b--;a.w.Gb(b,c&255)}function Kd(a){var b=a.pa(a.u[6]|a.O);a.u[6]=a.u[6]+2&65535;return b}
|
||||
function Id(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.C&57344||(a.Oa=a.Oa<<8|246);!a.A&&c<=a.Qa&&4<c&&(c<=a.Qa-32?(a.ba|=4,a.u[6]=4,a.ha(4,18)):(a.ba|=8,a.G|=4));a.zb(c,b)}
|
||||
function Od(a,b,c,d){var e,f,g=d&8?0:a.O;switch(b){case 0:return a.ha(4,20),0;case 1:return 6===c&&!a.A&&d&4&&(a.u[6]<=a.Qa||65534<=a.u[6])&&(a.u[6]<=a.Qa-32||65534<=a.u[6]?(a.ba|=4,a.u[6]=4,a.ha(4,22)):(a.ba|=8,a.G|=64)),a.b-=3,7===c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!==c&&(e|=g,6>c&&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<this.b);return this.v.complete?this.aa-this.b:void 0===this.v.complete?0:-1};Ta(function(){for(var a=C(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new bd(d);B(d,c)}});function $d(a,b){var c=b+a;Fd(this,c,a,b);return c&65535}
|
||||
function ae(a,b){var c=b+a;Fd(this,c<<8,a<<8,b<<8);return c&255}function be(a,b){a=b<<1;Gd(this,a);return a&65535}function ce(a,b){a=b<<1;Gd(this,a<<8);return a&255}function de(a,b){a=b&32768|b>>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&&(b=16),this.S=c<<17-b,c>>=b;else if(b)if(16<b)this.T=c,c=0;else{this.S=c<<=b;var d=c>>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&&(b=32);var d=c>>b-1;this.S=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.S=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.T=32768)):d=c;this.u[a]=d>>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<b?65536:0);this.b-=23}function nf(){this.b-=5}function of(){this.M&49152||(fd(this),this.w.reset());this.b-=667}function pf(){Jd(this);this.G|=this.M&16;this.b-=13}
|
||||
function qf(a){if(a&8)U.call(this,a);else{var b=Kd(this);a&=7;7==a?N(this,b):(N(this,this.u[a]),this.u[a]=b);this.b-=9}}function W(a){a&1&&(this.S=65536);a&2&&(this.T=32768);a&4&&(this.Z=0);a&8&&(this.W=32768);this.b-=5}function rf(a){var b=(a&448)>>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.f.length;c++)a.w.Ya(b+c,a.f[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.A?b.push(a.A):null!=a.A&&a.A.length&&(b=a.A);for(c=0;c<b.length;c++){var d=a,e=b[c],f=Xb(d.w,d.C,d.g);Wb(d.w,e,d.g,f)}delete a.f}}}H(a)}}
|
||||
Ta(function(){for(var a=C(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new sg(d);B(d,c)}});
|
||||
function vg(a){r.call(this,"RAM",a,vg);this.fa=this.g=null;this.B=a.addr;this.C=a.size;this.ya=a.load;this.xa=a.exec;this.A=!1;this.f=a.file;this.F=oa(this.f);if(this.f){a=this.f;var b=pa(this.F);"json"!=b&&"hex"!=b&&(a=ra()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Ba(a,null,!0,function(a,b,f){f?c.ja("Unable to load RAM resource (error "+f+": "+a+")"):(jb(c.Sa,a,b),(a=Ca(a,b))?(c.g=a.da,c.fa=a.fa,null==c.ya&&(c.ya=a.ya),null==c.xa&&(c.xa=a.xa)):c.f=null,wg(c))})}}u(vg);
|
||||
vg.prototype.Ea=function(a,b,c,d){this.w=b;this.b=c;this.i=d;wg(this)};vg.prototype.Aa=function(){this.fa&&(this.i&&ug(this.i,this.id,this.B,this.C,this.fa),delete this.fa);return!0};vg.prototype.za=function(){return!0};function wg(a){if(a.w&&(!a.A&&a.C&&Yb(a.w,a.B,a.C,1)&&(a.A=!0),!pb(a))){if(!a.A)n("No RAM allocated");else if(a.f){if(!a.g||!a.w)return;xg(a,a.g,a.ya,a.xa,a.B)}H(a)}}
|
||||
vg.prototype.reset=function(){if(this.A){for(var a=this.w,b=this.B,c=this.C,d=b&a.w,b=b>>>a.ia;0<c&&b<a.V.length;){var e=a.V[b],f=c,g,d=d||0;void 0===f&&(f=e.size);if(sb)for(g=d;f--&&g<e.f.length;g++)e.f[g]=0;else for(g=d;f--&&g<e.size;g++)e.Kb(d,0,e.D+d);c-=a.ua;b++;d=0}this.g&&xg(this,this.g,this.ya,this.xa,this.B,!0)}};
|
||||
function xg(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var m=b[h]&255|(b[h+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(h+6>=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<p&&h<b.length;)m+=b[h++]&255,p--;if(p||h>=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.length;e++)a.b.Ya(c+
|
||||
e,b[e]);null!=d&&gd(a.b,d,f);g=!0}return g}Ta(function(){for(var a=C(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new vg(d);B(d,c)}});function yg(a){r.call(this,"Keyboard",a,yg,65536);H(this)}u(yg);yg.prototype.qa=function(){return!1};yg.prototype.Ea=function(a,b,c,d){this.B=a;this.b=c;this.i=d};Ta(function(){for(var a=C(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new yg(d);B(d,c)}});
|
||||
function X(a){this.N=a.baudReceive||9600;this.P=a.baudTransmit||9600;this.aa=a.upperCase;this.A=this.F=null;this.R=a.tabSize;this.O=a.charBOL;this.H=0;r.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.F="";else{var c;a=zg;b&&(void 0===c&&(c="Panel"),(c=mb(c,this.id))&&(b=c.I[b])&&this.qa(null,a,b))}this.J=this.L=null;this.exports={connect:this.cc,receiveData:this.Pb}}u(X);var zg="buffer";k=X.prototype;
|
||||
k.qa=function(a,b,c){var d=this;switch(b){case zg:return this.I[b]=this.A=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.Pb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Pb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
|
||||
k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;var e=this;this.la=kc(48,4);this.X=hc(this.b,function(){e.f&128||!e.C.length||(e.K=e.C.shift()&255,e.aa&&97<=e.K&&122>e.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<a.length;b++)this.C.push(a.charCodeAt(b));else this.C=this.C.concat(a);jc(this.b,this.X,1E3/Math.round(this.N/10));return!0};k.Uc=function(){return this.f&65534};
|
||||
k.Gd=function(a){this.f=this.f&-112|a&111};k.Tc=function(){this.f&=-129;0<this.C.length&&jc(this.b,this.X,1E3/Math.round(this.N/10));return this.K};k.Fd=function(){};k.gd=function(){return this.g};k.Td=function(a){128==(this.g&192)&&a&64&&jc(this.b,this.Y,1E3/Math.round(this.P/10));this.g=this.g&-70|a&69};k.fd=function(){return 0};
|
||||
k.Sd=function(a){if(a&=255){D(this,"transmitByte("+l(a,2,!0)+")");this.L&&this.L.call(this.J,a);if(this.A)if(13==a)this.H=0;else if(8==a)this.A.value=this.A.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=wa[a])?"<"+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<a.length;b++){var c=a[b],d=z(c),d=new X(d);B(d,c)}});
|
||||
function xc(a){r.call(this,"PC11",a,xc);this.g=a.autoMount||null;this.F=0;this.Y=a.baudReceive||3600;this.K=this.L=this.f=0;this.J=[];this.H=Dg;this.A=Eg;this.N=this.C="";this.da=this.ya=this.xa=null;this.P=-1;this.O=!La("Mobi")&&window&&"FileReader"in window}u(xc);var Dg="",Eg=0;k=xc.prototype;
|
||||
k.qa=function(a,b,c){var d=this,e=Eg;switch(b){case "listTapes":return this.I[b]=c,c.onchange=function(){var a=d.I.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(m){n("PC11 option error: "+m.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");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.K<e.J.length&&(e.L=e.J[e.K++]&255,Hg(e,e.K/e.J.length*100),e.f|=128,e.f&=-2049,e.f&64&&ic(e.b,e.X))});ec(b,this,Ig);Jg(this,"None",Dg,!0);this.O&&Jg(this,"Local Tape",
|
||||
"?");Jg(this,"Remote Tape","??");Kg(this)||H(this)};k.Aa=function(a,b){if(!b)if(!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(){this.f&=-2241;this.L=0};function Kg(a){a.F=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.I.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=oa(b,!0)}b&&c?Lg(a,c,b,1,!0):Mg(a)}return!!a.F}
|
||||
function Fg(a,b,c,d,e){if(c)if("?"==c)a.ja('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=oa(c);a.status("Attempting to load "+c+' as "'+b+'"');a.H="??"}else a.H=c;Lg(a,b,c,d,!1,e)}else Ng(a,!1)}
|
||||
function Lg(a,b,c,d,e,f){var g=-1;if(a.C.toLowerCase()!=c.toLowerCase()||a.A!=d)g++,Ng(a,!0),a.v.Ja?a.ja("PC11 busy"):(e&&(a.F++,F(a)&&D(a,"auto-loading tape: "+b)),Og(a,b,c,d,f)?g++:a.v.Ja=!0);g&&Pg(a,a.N,a.C,a.A,a.da,a.ya,a.xa)}
|
||||
function Og(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),Pg(a,b,c,d,e),a.H="?");Mg(a)};g.readAsArrayBuffer(e);return!0}0>c.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<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
|
||||
function Mg(a){var b=a.I.listTapes;if(b&&b.options){a=a.H||a.C;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function Hg(a,b){b|=0;if(b!==a.P){var c=a.I.readProgress;c&&(c=(c=C(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.P=b}}
|
||||
function Pg(a,b,c,d,e,f,g){a.N=b;a.C=c;a.A=d;a.da=e;a.ya=f;a.xa=g;2==d?a.R&&xg(a.R,e,f,g)?a.status("tape loaded: "+b):(a.N="",a.C="",a.H=Dg,a.A=Eg,a.ja("No load address available for tape: "+b)):(a.K=0,a.J=e,a.status("tape attached: "+b),Hg(a,0))}function Ng(a,b){if(a.C||!1===b)a.N="",a.C="",b||(a.A&&a.status(1==a.A?"tape detached":"tape unloaded"),a.H=Dg,a.A=Eg,Mg(a))}k.save=function(){return(new O(this)).data()};k.restore=function(){return!0};k.Nc=function(){return this.f&65534};
|
||||
k.zd=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&ic(this.b,this.X)):(this.f&=-129,this.f|=2048,this.L=0,jc(this.b,this.aa,1E3/Math.round(this.Y/10))));this.f=this.f&-66|a&65};k.Mc=function(){this.f&=-129;this.f|=2048;return this.L};k.yd=function(){};var Qg={},Ig=(Qg[65384]=[null,null,xc.prototype.Nc,xc.prototype.zd,"PRS"],Qg[65386]=[null,null,xc.prototype.Mc,xc.prototype.yd,"PRB"],Qg);
|
||||
function Rg(a){r.call(this,"Debugger",a,Rg);this.Y=a.base||16;this.va=!1;this.J=0;this.O=!1;this.A=-1;this.g=[];this.R={}}u(Rg);var Sg={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":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<<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;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?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<a.length;b++){var c,d=a[b];c=A(d);switch(c.type){case "default":c=new K(c);C(c,d);break;case "pc11":c=new rc(c);C(c,d);break;case "rl11":c=new sc(c),C(c,d)}}});var tc;if(vb){var uc=new ArrayBuffer(2);(new DataView(uc)).setUint16(0,256,!0);tc=256===(new Uint16Array(uc))[0]}else tc=!1;var Ec=tc;
|
||||
function I(a,b,c,d,e,f){this.w=a;this.id=Fc+=2;this.b=null;this.D=b;this.Eb=c;this.size=d||0;this.type=e||Gc;this.f=e==Hc;this.controller=null;Vb(this);this.La=this.Kc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],Ic(this,f.Fc);else if(vb)this.C=new ArrayBuffer(this.size),this.G=new DataView(this.C,0,this.size),this.F=new Uint8Array(this.C,0,this.size),this.J=new Uint16Array(this.C,0,this.size>>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<a.length;f++)a[f]=0;Ic(this,Lc)}else Ic(this)}var Gc=0,Hc=2,bc=4,ec=["NONE","RAM","ROM","VID","H/W"],Fc=0;
|
||||
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(vb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.G.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(vb)for(b=0;b<a.length;b++)this.G.setInt32(b<<2,a[b],!0);else this.b=a;return this.La=!0}return!1},cb:function(a,b){b?this.B++||Mc(this,Nc,!1):this.g++||Oc(this,Nc,!1)},K:function(a,b){this.i&&F(this.i,128)&&(E(this.i,
|
||||
"attempt to read invalid address "+J(this.i,b),!0),cc(this.i));jc(this.w,b,2);return 255},A:function(a,b,c){this.i&&F(this.i,128)&&(E(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0),cc(this.i));jc(this.w,c,4)},L:function(a,b){return this.Pb(a++,b++)|this.Pb(a,b)<<8},I:function(a,b,c){this.Tb(a++,b&255,c++);this.Tb(a,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<<a)|b<<a;this.La=!0},Fa:function(a,b,c){a&1&&jc(this.w,c,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>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<Tc.length;b++)(c=this.F[Tc[b]])&&this.B.qa(null,Tc[b],c);a=Uc(a,"autoStart");null!=a&&(this.v.ib="true"==a?!0:"false"==a?!1:!!a);G(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
|
||||
k.za=function(a,b){if(!b){if(a&&this.restore){Vc(this);if(!this.restore(a))return!1;Wc(this)}else this.reset();this.i?(a=this.i,b=this.v.ib,a.ab=!0,a.j("Type ? for help with PDP11 Debugger commands"),a.da(),b||a.gb(),a.Fa&&(b=a.Fa,a.Fa=null,Xc(a,b))):this.j("No debugger detected")}this.B.da();return!0};k.ya=function(a){return a?this.save():!0};k.ib=function(){return this.v.ib||!this.i&&void 0===this.F.run?(this.sb(),!0):!1};k.nc=function(){return 0};
|
||||
function Wc(a){void 0===a.Bb&&(a.Bb=0);void 0===a.nb&&(a.nb=-1);void 0===a.ob&&(a.ob=-1);a.v.kb=0<=a.Bb&&0<a.nb;a.v.kb&&(a.Ab=0,a.ma=a.Bb-a.la)}function Yc(a,b){if(a.v.kb){var c=!1;a.Ab=a.Ab+a.nc()|0;a.ma-=b;0>=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;c<h.length&&(b=h[c],b===a||b.v.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.v.ha);c++);c==h.length&&(b=a);p("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.Lb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.fa?d.ia():d.sb())},
|
||||
!0;case "speed":return this.F[b]=c,!0;case "setSpeed":return this.F[b]=c,c.onclick=function(){$c(d,d.Ta<<1,!0)},c.textContent=this.eb.toFixed(2)+"Mhz",!0}return!1};k.da=function(){var a=this.F.speed;a&&(a.textContent=this.v.fa&&this.Y?this.Y.toFixed(2)+"Mhz":"Stopped")};function ad(a,b,c){a.la+=b;c&&(a.ba=a.b=a.J=0)}function bd(a,b){var c=1;b&&1<a.Ta&&a.Y&&(c=a.Y/a.wb);a.qc=Math.round(1E3/30);a.bb=Math.floor(a.Ya/30*c);b||(a.ra=a.bb);a.yb=0}function Zc(a){return a.la+a.S+a.ba-a.b}
|
||||
function Vc(a){a.Y=0;a.rc=0;a.la=a.S=a.ba=a.b=a.J=0;Wc(a);$c(a,1)}function $c(a,b,c){var d=!1;if(void 0!==b){.8>a.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&&b<a.K.length&&0>a.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.Y<this.eb)-1E3>c&&(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<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.J){for(var f=0,g=Array(b.J),h=0;h<e.length-1;)for(var m=e[h++],n=e[h++];m--;)g[f++]=n;e=g}f=b.W[d];if(!f||!f.restore(e)){p("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function ld(a){return a.T&65536?1:0}
|
||||
function md(a){return a.U&32768?2:0}function nd(a){return a.$&65535?0:4}k.Ma=function(){return this.X&32768?8:0};function od(a){var b=a.u[7];a.C&57344||(a.Ua=0,a.Db=b);a.u[7]=b+2&65535;return a.pa(b)}function pd(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function N(a,b){a.u[7]=b&65535}function nc(a,b){return{Gd:a,pb:b,next:null}}function lc(a,b){if(b!=a.N){var c=a.N;if(!c||c.pb<=b.pb)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.pb<=b.pb){b.next=d;c.next=b;break}c=d}while(c)}}a.H|=2}
|
||||
function Bb(a){return a.M=a.M&63728|a.Ma()|nd(a)|md(a)|ld(a)}function qc(a,b){a.X=b<<12;a.$=~b&4;a.U=b<<14;a.T=b<<16;if((b^a.M)&2048)for(var c=a.Na.length;0<=--c;){var d=a.u[c];a.u[c]=a.Na[c];a.Na[c]=d}a.A=b>>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(f<a.$a)f&1&&!(c&1)&&(a.ca|=64,a.ja(4,10));else if(a.Va&16||253952<=f&&(f|=4186112),4186112>f){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||4194239<f)||(a.C|=4096,a.C&512&&(a.H|=32)));return f}function Pd(a,b){return a.w.zb(b)}function Qd(a,b,c){b&1&&a.b--;a.w.Qb(b,c&255)}function Nd(a){var b=a.pa(a.u[6]|a.P);a.u[6]=a.u[6]+2&65535;return b}
|
||||
function ud(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.C&57344||(a.Ua=a.Ua<<8|246);!a.A&&c<=a.Wa&&4<c&&(c<=a.Wa-32?(a.ca|=4,a.u[6]=4,a.ja(4,18)):(a.ca|=8,a.H|=4));a.Fb(c,b)}
|
||||
function Rd(a,b,c,d){var e,f,g=d&8?0:a.P;switch(b){case 0:return a.ja(4,20),0;case 1:return 6===c&&!a.A&&d&4&&(a.u[6]<=a.Wa||65534<=a.u[6])&&(a.u[6]<=a.Wa-32||65534<=a.u[6]?(a.ca|=4,a.u[6]=4,a.ja(4,22)):(a.ca|=8,a.H|=64)),a.b-=3,7===c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!==c&&(e|=g,6>c&&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<this.b);return this.v.complete?this.ba-this.b:void 0===this.v.complete?0:-1};Wa(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new fd(d);C(d,c)}});function ce(a,b){var c=b+a;rd(this,c,a,b);return c&65535}
|
||||
function de(a,b){var c=b+a;rd(this,c<<8,a<<8,b<<8);return c&255}function ee(a,b){a=b<<1;sd(this,a);return a&65535}function fe(a,b){a=b<<1;sd(this,a<<8);return a&255}function ge(a,b){a=b&32768|b>>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&&(b=16),this.T=c<<17-b,c>>=b;else if(b)if(16<b)this.U=c,c=0;else{this.T=c<<=b;var d=c>>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&&(b=32);var d=c>>b-1;this.T=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.T=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.U=32768)):d=c;this.u[a]=d>>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<b?65536:0);this.b-=23}function qf(){this.b-=5}function rf(){this.M&49152||(jd(this),this.w.reset());this.b-=667}function sf(){Md(this);this.H|=this.M&16;this.b-=13}
|
||||
function tf(a){if(a&8)V.call(this,a);else{var b=Nd(this);a&=7;7==a?N(this,b):(N(this,this.u[a]),this.u[a]=b);this.b-=9}}function W(a){a&1&&(this.T=65536);a&2&&(this.U=32768);a&4&&(this.$=0);a&8&&(this.X=32768);this.b-=5}function uf(a){var b=(a&448)>>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.f.length;c++)a.w.fb(b+c,a.f[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.A?b.push(a.A):null!=a.A&&a.A.length&&(b=a.A);for(c=0;c<b.length;c++){var d=a,e=b[c],f=$b(d.w,d.C,d.g);Zb(d.w,e,d.g,f)}delete a.f}}}G(a)}}
|
||||
Wa(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new cg(d);C(d,c)}});
|
||||
function yg(a){r.call(this,"RAM",a,yg);this.ga=this.g=null;this.B=a.addr;this.C=a.size;this.Ca=a.load;this.Ba=a.exec;this.A=!1;this.f=a.file;this.G=ra(this.f);if(this.f){a=this.f;var b=sa(this.G);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?c.O("Unable to load RAM resource (error "+f+": "+a+")"):(mb(c.Ia,a,b),(a=Ea(a,b))?(c.g=a.ea,c.ga=a.ga,null==c.Ca&&(c.Ca=a.Ca),null==c.Ba&&(c.Ba=a.Ba)):c.f=null,zg(c))})}}u(yg);
|
||||
yg.prototype.wa=function(a,b,c,d){this.w=b;this.b=c;this.i=d;zg(this)};yg.prototype.za=function(){this.ga&&(this.i&&eg(this.i,this.id,this.B,this.C,this.ga),delete this.ga);return!0};yg.prototype.ya=function(){return!0};function zg(a){if(a.w&&(!a.A&&a.C&&ac(a.w,a.B,a.C,1)&&(a.A=!0),!sb(a))){if(!a.A)p("No RAM allocated");else if(a.f){if(!a.g||!a.w)return;Ag(a,a.g,a.Ca,a.Ba,a.B)}G(a)}}
|
||||
yg.prototype.reset=function(){if(this.A){for(var a=this.w,b=this.B,c=this.C,d=b&a.w,b=b>>>a.ka;0<c&&b<a.W.length;){var e=a.W[b],f=c,g,d=d||0;void 0===f&&(f=e.size);if(vb)for(g=d;f--&&g<e.F.length;g++)e.F[g]=0;else for(g=d;f--&&g<e.size;g++)e.Ub(d,0,e.D+d);c-=a.ua;b++;d=0}this.g&&Ag(this,this.g,this.Ca,this.Ba,this.B,!0)}};
|
||||
function Ag(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var m=b[h]&255|(b[h+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(h+6>=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<n&&h<b.length;)m+=b[h++]&255,n--;if(n||h>=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.length;e++)a.b.fb(c+
|
||||
e,b[e]);null!=d&&kd(a.b,d,f);g=!0}return g}Wa(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new yg(d);C(d,c)}});function Bg(a){r.call(this,"Keyboard",a,Bg,65536);G(this)}u(Bg);Bg.prototype.qa=function(){return!1};Bg.prototype.wa=function(a,b,c,d){this.B=a;this.b=c;this.i=d};Wa(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Bg(d);C(d,c)}});
|
||||
function X(a){this.N=a.baudReceive||9600;this.R=a.baudTransmit||9600;this.ba=a.upperCase;this.A=this.G=null;this.S=a.tabSize;this.P=a.charBOL;this.I=0;r.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.G="";else{var c;a=Cg;b&&(void 0===c&&(c="Panel"),(c=pb(c,this.id))&&(b=c.F[b])&&this.qa(null,a,b))}this.J=this.L=null;this.exports={connect:this.sc,receiveData:this.cc}}u(X);var Cg="buffer";k=X.prototype;
|
||||
k.qa=function(a,b,c){var d=this;switch(b){case Cg:return this.F[b]=this.A=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.cc(b);return!0},c.onkeypress=function(a){a=a||window.event;d.cc(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
|
||||
k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;var e=this;this.la=nc(48,4);this.Y=kc(this.b,function(){e.f&128||!e.C.length||(e.K=e.C.shift()&255,e.ba&&97<=e.K&&122>e.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<a.length;b++)this.C.push(a.charCodeAt(b));else this.C=this.C.concat(a);mc(this.b,this.Y,1E3/Math.round(this.N/10));return!0};k.pd=function(){return this.f&65534};
|
||||
k.ae=function(a){this.f=this.f&-112|a&111};k.od=function(){this.f&=-129;0<this.C.length&&mc(this.b,this.Y,1E3/Math.round(this.N/10));return this.K};k.$d=function(){};k.Cd=function(){return this.g};k.ne=function(a){128==(this.g&192)&&a&64&&mc(this.b,this.Z,1E3/Math.round(this.R/10));this.g=this.g&-70|a&69};k.Bd=function(){return 0};
|
||||
k.me=function(a){if(a&=255){E(this,"transmitByte("+l(a,2,!0)+")");this.L&&this.L.call(this.J,a);if(this.A)if(13==a)this.I=0;else if(8==a)this.A.value=this.A.value.slice(0,-1),0<this.I&&this.I--;else{var b;b=(b=ya[a])?"<"+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<a.length;b++){var c=a[b],d=A(c),d=new X(d);C(d,c)}});
|
||||
function rc(a){r.call(this,"PC11",a,rc);this.g=a.autoMount||null;this.G=0;this.Z=a.baudReceive||3600;this.K=this.L=this.f=0;this.J=[];this.I=Gg;this.A=Hg;this.N=this.C="";this.ea=this.Ca=this.Ba=null;this.S=-1;this.R=!Oa("Mobi")&&window&&"FileReader"in window}u(rc);var Gg="",Hg=0;k=rc.prototype;
|
||||
k.qa=function(a,b,c){var d=this,e=Hg;switch(b){case "listTapes":return this.F[b]=c,c.onchange=function(){var a=d.F.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(m){p("PC11 option error: "+m.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");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.K<e.J.length&&(e.L=e.J[e.K++]&255,Kg(e,e.K/e.J.length*100),e.f|=128,e.f&=-2049,e.f&64&&lc(e.b,e.P))});hc(b,this,Lg);Mg(this,"None",Gg,!0);this.R&&Mg(this,"Local Tape",
|
||||
"?");Mg(this,"Remote Tape","??");Ng(this)||G(this)};k.za=function(a,b){if(!b)if(!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(){this.f&=-2241;this.L=0};function Ng(a){a.G=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.F.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=ra(b,!0)}b&&c?Og(a,c,b,1,!0):Pg(a)}return!!a.G}
|
||||
function Ig(a,b,c,d,e){if(c)if("?"==c)a.O('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"');a.I="??"}else a.I=c;Og(a,b,c,d,!1,e)}else Qg(a,!1)}
|
||||
function Og(a,b,c,d,e,f){var g=-1;if(a.C.toLowerCase()!=c.toLowerCase()||a.A!=d)g++,Qg(a,!0),a.v.Qa?a.O("PC11 busy"):(e&&(a.G++,F(a)&&E(a,"auto-loading tape: "+b)),Rg(a,b,c,d,f)?g++:a.v.Qa=!0);g&&Sg(a,a.N,a.C,a.A,a.ea,a.Ca,a.Ba)}
|
||||
function Rg(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),Sg(a,b,c,d,e),a.I="?");Pg(a)};g.readAsArrayBuffer(e);return!0}0>c.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<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
|
||||
function Pg(a){var b=a.F.listTapes;if(b&&b.options){a=a.I||a.C;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function Kg(a,b){b|=0;if(b!==a.S){var c=a.F.readProgress;c&&(c=(c=D(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.S=b}}
|
||||
function Sg(a,b,c,d,e,f,g){a.N=b;a.C=c;a.A=d;a.ea=e;a.Ca=f;a.Ba=g;2==d?a.Y&&Ag(a.Y,e,f,g)?a.status("tape loaded: "+b):(a.N="",a.C="",a.I=Gg,a.A=Hg,a.O("No load address available for tape: "+b)):(a.K=0,a.J=e,a.status("tape attached: "+b),Kg(a,0))}function Qg(a,b){if(a.C||!1===b)a.N="",a.C="",b||(a.A&&a.status(1==a.A?"tape detached":"tape unloaded"),a.I=Gg,a.A=Hg,Pg(a))}k.save=function(){return(new O(this)).data()};k.restore=function(){return!0};k.hd=function(){return this.f&65534};
|
||||
k.Ud=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&lc(this.b,this.P)):(this.f&=-129,this.f|=2048,this.L=0,mc(this.b,this.ba,1E3/Math.round(this.Z/10))));this.f=this.f&-66|a&65};k.gd=function(){this.f&=-129;this.f|=2048;return this.L};k.Td=function(){};var Tg={},Lg=(Tg[65384]=[null,null,rc.prototype.hd,rc.prototype.Ud,"PRS"],Tg[65386]=[null,null,rc.prototype.gd,rc.prototype.Td,"PRB"],Tg);
|
||||
function Ug(a,b,c){r.call(this,"Disk",{id:a.Ia+".disk"+l(++Vg,4)},Ug,2097152);this.controller=a;this.B=a.B;this.i=a.i;this.A=b;this.Oa=b.name;this.Zb=b.Zb;Wg(this,c,b.Ha,b.Da,b.xa,b.Ja);G(this)}var Vg=0;u(Ug);Ug.prototype.wa=function(a,b,c,d){this.i=d};
|
||||
function Wg(a,b,c,d,e,f){a.mode=b;a.Ha=c;a.Da=d;a.xa=e;a.Ja=f;a.b=[];if("preload"!=a.mode){b=Array(a.Ha);for(c=0;c<b.length;c++){d=Array(a.Da);for(e=0;e<d.length;e++){f=Array(a.xa);for(var g=1;g<=f.length;g++)f[g-1]=Xg(null,c,e,g,a.Ja,0);d[e]=f}b[c]=d}a.b=b}a.f=null}
|
||||
function Yg(a,b,c,d,e){var f=c;if(a.w)return!0;a.Oa=b;a.Xa=c;a.Ac=ra(c);a.w=e;a.C=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ka[d];if(e){a.Ha=e[0];a.Da=e[1];a.xa=e[2];a.Ja=e[3]||512;c=a.Ja>>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.Ha);for(d=0;d<a.b.length;d++)for(var v=a.b[d]=Array(a.Da),x=0;x<v.length;x++)for(var z=v[x]=Array(a.xa),y=0;y<z.length;y++){for(var B=Xg(null,d,x,y+1,a.Ja,0),ia=B.data,Ja=0;Ja<c;Ja++,f+=4)var P=ia[Ja]=b.getInt32(f,
|
||||
!0),e=e+P&-1;B.Gb=c;z[y]=B}a.f=e;c=a}else a.O("Unrecognized disk format ("+d+" bytes)");a.w&&(a.w.call(a.controller,a.A,c,a.Oa,a.Xa),a.w=null)};g.readAsArrayBuffer(d);return!0}0>c.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(0<ra(a.Ac,!0).toLowerCase().indexOf("-readonly"))a.g=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.g=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.Oa]:h=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)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<a.Ha;d++)for(f=0;f<a.Da;f++)for(g=0;g<a.xa;g++)if(m=h[d][f][g]){var n=m.length;void 0===n&&(n=m.length=512);var n=n>>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<x;z++)v[z]=q;$g(m,v)}else w=[],q=m.pattern=q|q<<8|q<<16|q<<24,m.data=w;delete m.bytes}Xg(m,d,f);for(x=
|
||||
0;x<w.length;x++)c=c+w[x]&-1}a.b=h;a.f=c;e=a}else p("Empty disk image: "+a.Oa)}catch(y){p("Disk image error ("+b+"): "+y.message)}}a.w&&(a.w.call(a.C,a.A,e,a.Oa,a.Xa),a.w=null)}function Xg(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.te=b;a.ue=c;a.Nb=a.Gb=0;a.La=!1;return a}function $g(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
|
||||
function ah(a,b){var c=a.Da*a.xa,d=b/c|0;if(d<a.Ha){c=b%c;b=c/a.xa|0;var c=c%a.xa+1,e=null,f=a.A,g=a.b[d];if(g){a=g[b];if(!a&&f.Gc&&b<f.Da)for(a=g[b]=Array(f.Hc),g=0;g<a.length;g++)a[g]=Xg(null,d,b,g+1,f.uc,0);if(a){for(g=0;g<a.length;g++)if(a[g]&&a[g].sector==c){e=a[g];break}!e&&f.Gc&&9==f.hc&&(e=a[g]=Xg(null,d,b,f.hc,f.uc,0))}}return e}return null}
|
||||
function bh(a,b){for(var c=1,d=0,e=0;c--;){var f;f=b++;var g=-1;if(a&&f<a.length)var g=a.data,h=f>>2,g=(h<g.length?g[h]:a.pattern)>>((f&3)<<3)&255;f=g;if(0>f)break;d|=f<<e;e+=8}return d}
|
||||
Ug.prototype.save=function(){var a=0,b=[];b[a++]=[this.Xa,this.f,this.Ha,this.Da,this.xa,this.Ja];if(!this.g)for(var c=this.b,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Gb){for(var h=[],m=0,n=g.Nb,q=g.Nb+g.Gb;n<q;)h[m++]=g.data[n++];b[a++]=[d,e,f,g.Nb,h]}}return b};
|
||||
Ug.prototype.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.b.length&&6<=e.length?Wg(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.f&&e[1]!=this.f&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.f+")",b=-2));for(this.b.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],h=g[f++],m=g[f++],n=g[f++];if(h>=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;m<e;)h.data[m++]=h.pattern;m=0;h.Nb=e;for(h.Gb=f.length;e<g;)h.data[e++]=f[m++];b++}}}0>b&&-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='<a href="'+g+'" target="_blank">'+b+"</a>");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;m<n;m++)b+=String.fromCharCode(bh(h,m));b=btoa(b);a=a.Ac.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),"string"!=
|
||||
typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");p(a)}else d.O("No disk loaded in drive.");else d.O("No disk drive selected.")};return!0;case "mountDrive":if(this.C)return 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;eh(d,ra(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;if((this.g=Uc(this.B,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(e){p("RL11 auto-mount error: "+e.message+" ("+this.g+")"),this.g=null}this.P=nc(112,5);hc(b,this,fh);gh(this,"None","",!0);this.C&&gh(this,"Local Disk","?");gh(this,"Remote Disk","??");hh(this)||G(this)};
|
||||
k.za=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.B.lc){for(a=0;a<this.f.length;a++)ih(this,a,!0);hh(this,!0)}}else if(!this.restore(a))return!1;if(a=this.F.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;1>b;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;a<this.f.length;a++){var b=this.f[a];void 0===b&&(b=this.f[a]={});b.$b=a;b.Yb=b.Ib=!1;b.name=this.Za;b.Ha=512;b.Da=2;b.xa=40;b.Ja=256;b.Zb=!0;b.re=0;b.qe=0;b.pe=0;b.hc=1;b.Hc=b.xa;b.uc=b.Ja;b.ve=0;b.xe=null;b.Hb||(b.Xa="")}};k.save=function(){return(new O(this)).data()};k.restore=function(){return!0};
|
||||
function hh(a,b){b||(a.A=0);if(a.g)for(var c in a.g){var d=a.g[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.F.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=ra(e,!0)}if(e&&f&&(g=c.charCodeAt(0)-65,0<=g&&g<a.f.length)){!jh(a,g,f,e,!0)&&b&&G(a,!1);continue}a.O("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.A}
|
||||
function eh(a,b,c,d){var e=a.F.listDrives,e=e&&pa(e.value,10);if(void 0===e||0>e||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<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
|
||||
function dh(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.F.listDisks;a=a.F.listDrives;if(d&&a&&d.options&&a.options&&(a=pa(a.value,10),c=c.Ib?"?":c.Xa,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function ih(a,b,c){var d=a.f[b];if(d.Hb||!1===c)d.Oa="",d.Xa="",d.Hb=null,d.Ib=!1,c||(a.O("Drive RL"+b+" unloaded",c),dh(a,b))}var fh={};
|
||||
function kh(a){r.call(this,"Debugger",a,kh);this.Z=a.base||16;this.va=!1;this.J=0;this.P=!1;this.A=-1;this.g=[];this.S={}}u(kh);var lh={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":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<<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;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?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<p.length;){var q=p[e++],v=q.length,q=va(q);if(!q){f=!0;break}q=Xg(a,q,null,!1===c);if(void 0===q){f=!0;c=!1;break}h.push(q);if(e==p.length)break;var q=p[e++],w=q.length;m.length&&Sg[q]<Sg[m[m.length-1]]&&Ug(h,m,1);m.push(q);b=b.substr(v+w)}Ug(h,m)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&Yg(a,null,
|
||||
d))}return d}function Wg(a,b){for(var c,d=a.va?"(":"{",e=a.va?")":"}",f=new RegExp(a.va?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=Vg(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
|
||||
function Xg(a,b,c,d){var e;if(null!=b){e=a.Zb(b);if(0<=e)e=a.$b(e);else if(e=a.R[b],null==e){e=b;var f=a.Y,g;if(e){f||(f=10);var h=e.charAt(0),m=0<e.indexOf(",");m&&(e=e.replace(/,/g,""));"#"==h?(f=8,h=null):"$"==h&&(f=16,h=null);null==h?e=e.substr(1):("0"==h&&(h=e.charAt(1),"b"==h&&m&&(f=2,h=null),"o"==h?(f=8,h=null):"x"==h&&(f=16,h=null)),null==h?e=e.substr(2):(h=e.charAt(e.length-1).toLowerCase(),"y"==h?(f=2,h=null):"."==h?(f=10,h=null):"h"==h&&(f=16,h=null),null==h&&(e=e.substr(0,e.length-1))));
|
||||
var p,h=e;((m=f)&&10!=m?16==m?h.match(/^[0-9a-f]+$/i):8==m?h.match(/^[0-7]+$/):2==m&&h.match(/^[01]+$/):h.match(/^[0-9]+$/))&&!isNaN(p=parseInt(e,f))&&(g=p|0)}e=g}null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)}else d||a.j("missing "+(c||"value"));return e}
|
||||
function Yg(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var m=d&255,p=8,q="";p?32<p&&(p=32):p=32;if(null==m||isNaN(m))for(;0<p--;)q="?"+q;else for(;0<p--;)q=(m&1?"1":"0")+q,m>>=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<c}
|
||||
function J(a,b,c,d){switch(a.Y){case 8:a=na(b,3*c);break;case 10:a=b.toString();break;default:a=l(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
|
||||
function $g(a){Rg.call(this,a);this.Ua=!1;this.va=!0;this.K=Z(0);this.Ta=Z(0);this.N=Z(0);this.H=[];this.f=this.L=this.C=[];ah(this);this.ma=0;bh(this);this.Ba={};ch(this,a.messages);this.Ca=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Tc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Tc(b,a)})}u($g,Rg);
|
||||
var dh={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},eh=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
|
||||
fh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
|
||||
function oh(a,b,c){var d;if(b){b=ph(a,b);for(var e=0,f=!1,g=b,h=[],m=[],n=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<n.length;){var q=n[e++],w=q.length,q=xa(q);if(!q){f=!0;break}q=qh(a,q,null,!1===c);if(void 0===q){f=!0;c=!1;break}h.push(q);if(e==n.length)break;var q=n[e++],v=q.length;m.length&&lh[q]<lh[m[m.length-1]]&&nh(h,m,1);m.push(q);b=b.substr(w+v)}nh(h,m)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&rh(a,null,
|
||||
d))}return d}function ph(a,b){for(var c,d=a.va?"(":"{",e=a.va?")":"}",f=new RegExp(a.va?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=oh(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
|
||||
function qh(a,b,c,d){var e;null!=b?(e=a.oc(b),0<=e?e=a.pc(e):(e=a.S[b],null==e&&(e=pa(b,a.Z))),null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)):d||a.j("missing "+(c||"value"));return e}
|
||||
function rh(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var m=d&255,n=8,q="";n?32<n&&(n=32):n=32;if(null==m||isNaN(m))for(;0<n--;)q="?"+q;else for(;0<n--;)q=(m&1?"1":"0")+q,m>>=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 0<c}
|
||||
function J(a,b,c,d){switch(a.Z){case 8:a=qa(b,3*c);break;case 10:a=b.toString();break;default:a=l(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
|
||||
function th(a){kh.call(this,a);this.ab=!1;this.va=!0;this.K=Y(0);this.$a=Y(0);this.N=Y(0);this.I=[];this.f=this.L=this.C=[];uh(this);this.ma=0;vh(this);this.Ea={};wh(this,a.messages);this.Fa=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Xc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Xc(b,a)})}u(th,kh);
|
||||
var xh={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},yh=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
|
||||
zh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
|
||||
33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106,32768],35072:[107,32768]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,
|
||||
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]}},gh=[0],hh=
|
||||
[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=$g.prototype;
|
||||
k.Ea=function(a,b,c,d){this.w=b;this.b=c;this.B=a;(a=Qc(a,"messages"))&&ch(this,a);this.bb=fh;this.qb=1145>this.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.w.ia,
|
||||
8)+" %%"+l(q.D,8)+" "+l(q.yb,4,!0)+" "+l(q.size,4,!0)+" "+p),c!=Cc&&(c=-1),p=0);a+=d.w.ua;e++}}});H(this)};
|
||||
k.qa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.la=this.I[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Tc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.A<d.g.length-1&&(b=d.g[++d.A])):40==a.keyCode&&(0<d.A?b=d.g[--d.A]:(b="",d.A=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.I[b]=c,Na(c,function(){if(d.la){var a=d.la.value;
|
||||
d.la.value="";Tc(d,a,!0);return!0}return!1}),!0;case "step":return this.I[b]=c,Na(c,function(a){var b=!1;ob(d,!0)||(nb(d,!0),b=d.nb(a?1:0),nb(d,!1));return b}),!0}return!1};k.lb=function(a){if(this.la){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.la.focus();!a&&window&&window.scrollTo(b,c)}};k.$=function(a){a=a&&a.D;null==a&&(a=-1);return a};k.tb=function(a,b){var c=255,d=this.$(a,!1,1);-1!==d&&(c=a.Ab?this.w.Db(d):this.b.Db(d),b&&kh(a,b));return c};
|
||||
k.oa=function(a,b){var c=65535,d=this.$(a,!1,2);-1!==d&&(c=a.Ab?this.w.eb(d):this.b.eb(d),b&&kh(a,b));return c};k.Gb=function(a,b,c){var d=this.$(a,!0,1);-1!==d&&(a.Ab?this.w.Ya(d,b):this.b.Ya(d,b),c&&kh(a,c),this.B.ca(!0))};k.Za=function(a,b,c){var d=this.$(a,!0,2);-1!==d&&(a.Ab?this.w.Hb(d,b):this.b.Hb(d,b),c&&kh(a,c),this.B.ca(!0))};function Z(a,b){return{D:a,Ab:b,Da:!1}}function lh(a){return[a.D,a.Da]}function mh(a){return{D:a[0],Da:a[1]}}
|
||||
function jh(a,b,c){var d,e=(c?a.K:a.Ta).D;c=!1;if(void 0!==b){b=Wg(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.H.length;e++){var g=a.H[e].fa[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Z(d));break}}if(d=f)return d;e=Vg(a,b,void 0)}null!=e&&(d=Z(e,c));return d}function nh(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.mc=Tg(a,b.ic=c[2]))}function kh(a,b){null!=a.D&&(a.D+=b||1)}
|
||||
function ch(a,b){a.i=a;a.na=a.oc=536870912;a.aa=null;a.ra=[];b=Tg(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in tb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.na|=tb[c],a.j(c+" messages enabled"))}}function ih(a,b){for(var c in tb)if(64==tb[c]){a.Ba[c]=b;break}}
|
||||
k.Zb=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function oh(a){return 6>a?"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<a.F.length;b++)a.F[b]=Z();a.X=0;a.j("instruction history buffer allocated")}}
|
||||
k.mb=function(a,b){if(!ph(this,b))return!1;this.b.mb(a);return!0};k.nb=function(a,b,c){if(!ph(this))return!1;this.J=0;a||Yd(this)&&Zd(this,this.b.u[7],0);try{a=$c(this.b,a);var d=this.b.nb(a);0<d&&(ad(this.b,a),this.J+=d,Xc(this.b,d,!0),Uc(this.b,d),this.sa++)}catch(e){"number"!=typeof e&&(this.J=0,rb(this.b,e.stack||e.message))}!1!==c&&this.B.ca();this.ca(b||!1);return 0<this.J};k.ga=function(a){this.b&&this.b.ga(a)};
|
||||
k.ca=function(a){if(this.Ua){void 0===a&&(a=!0);var b;b=this.b;if(b=b.G&8?b.wc|b.vc<<8:0){var c=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=0<a?Math.round(1E3*this.J/a):0;b+=" (";Yd(this)&&(b+=this.sa+" instructions, ",this.sa=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}this.ca(!0);this.lb();sh(this,this.b.u[7]);this.aa=null}};function Yd(a){return 1<a.f.length||!!a.ma}
|
||||
function Zd(a,b,c){var d=-1;c||(d=a.b.eb(b),0==d&&(b=ld(a.b,2)));if(0<c&&(a.ma&&!--a.ma||Lc(a,b,1,a.f)))return!0;0<=c&&a.F.length&&(a.sa++,0>d&&(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<a.L.length;b++){c=a.L[b];var d=a.w;c=a.$(c);Mc(d.V[c>>>d.ia],!1)}a.L=["br"];if(a.C)for(b=1;b<a.C.length;b++)c=a.C[b],d=a.w,c=a.$(c),Mc(d.V[c>>>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<b.length;g++){var h=b[g];if(c==a.$(h)&&(!d||h.Da)){f=!0;h.Da||e||uh(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.w,Mc(d.V[c>>>d.ia],b==a.C));h.Da||bh(a);break}}return f}function vh(a,b){for(var c=1;c<b.length;c++)uh(a,b,c);return b.length-1}function uh(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.D)+(d?" "+d:c.ic?' "'+c.ic+'"':""))}
|
||||
function sh(a,b){if(void 0!==b)Lc(a,b,1,a.f,!0),a.P=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Da){if(!th(a,a.f,c,!0))break;b=0}}}
|
||||
function Lc(a,b,c,d,e){var f=!1;if(!a.Ra++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Da)for(var m=a.$(h),p=0;p<c;p++)if(b+p==m){var q,f=!0;h.Da&&(th(a,d,h,!0),e=!0);if(q=h.mc){for(var f=!1,v=0;v<q.length;v++)if(!wh(a,q[v],!0)){if(q[v].indexOf("if")){f=!0;break}for(var w=v+1;w<q.length&&q[w].indexOf("else");w++)v++;if(w==q.length){f=!0;break}}a.b.v.ea||(f=!0)}if(f){e||uh(a,d,g,"hit");break}}}a.Ra--;return f}
|
||||
function xh(a,b,c,d){var e=Z(b.D),f=a.oa(b,2),g,h;for(h in a.bb)if(g=a.bb[h][f&h])break;g||(g=gh);var m=g[0];0<=a.qb.indexOf(m)&&(g=gh,m=g[0]);var p=h="",q=eh[m],v=g.length-1;m||v||(h=J(a,f));for(m=1;m<=v;m++){var w=g[m];if(void 0!==w){var x;x=a;var E=w,w=b,y="",A=E&61440;if(4096==A)w=w.D+((f&255)<<24>>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]);
|
||||
0<h.length&&(h+=",");h+=x||"???"}}f="";g=J(a,e.D)+":";if(-1!==e.D&&-1!==b.D){do if(f+=" "+J(a,a.oa(e,2)),null==e.D)break;while(e.D!=b.D)}g+=ua(f,24);g+=ua(q,5);h&&(g+=" "+h);if(c||p)g=ua(g,60)+";"+(c||""),g=a.b.v.cb?g+("cycles="+Vc(a.b).toString()+" cs="+l(a.b.ub)):g+(null!=d?"="+d.toString():""),p&&(g+=" @"+p);return g}function yh(a,b){switch(b){case "N":a=a.b.Ga();break;case "Z":a=jd(a.b);break;case "V":a=id(a.b);break;case "C":a=hd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
|
||||
function zh(a,b){var c="",d=a.b;8>b?(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]<b[0]?-1:0};
|
||||
function ug(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var m=h.o,p=h.a;if(void 0!==m){var q=f,m=[m>>>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<a.H.length;b++){var f=a.H[b],g=f.D>>>0,h=f.uc;if(e>=g&&e<g+h){e=xa(f.Tb,[e-g],a.Ub);0<=e?Ch(a,b,e,d):c&&(e=~e,Ch(a,b,e-1,d),Ch(a,b,e,d));break}}return d}
|
||||
function Ch(a,b,c,d){var e={},f=a.H[b].Tb,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.H[b].fa[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function Dh(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Zg(a)||a.j("no variables"),!0;if(!c[2])return Zg(a,c[1]);if(!c[3])return delete a.R[c[1]],!0;b=Vg(a,c[3]);return void 0!==b?(a.R[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
|
||||
function Eh(a,b,c){var d=null;if(b=jh(a,b,!0)){a.$(b);var e=Bh(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.D-e[1])&&(g=" + "+l(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.j(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.D)&&(g=" - "+l(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
|
||||
function qh(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}f=Vg(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":N(d,f);a.K=Z(d.u[7]);break;case "N":d.W=f?32768:0;break;case "Z":d.Z=
|
||||
f?0:1;break;case "V":d.T=f?32768:0;break;case "C":d.S=f?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){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?1<c[2].length?a.j(c[2]):Yg(a,null,c[2].charCodeAt(0)):Vg(a,b,!0)}
|
||||
function Gh(a,b,c){var d="t"!=b;c=Xg(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ma(c,function(){return nb(a,!0)&&a.nb(e,d,!1)},function(){a.B.ca();nb(a,!1)})}
|
||||
function rh(a,b,c,d){if(b=jh(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=Xg(a,c.substr(1)),null!=c&&(d=c);else{d=jh(a,c,!0);if(!d||d.D<b.D)return;e=d.D-b.D;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=ob(a,!1)||a.P?a.J:null;var g=null!=f?"cycles":null,h=Bh(a,b),m=b.D;if(h[0]&&d&&(!c&&d||0>h[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)&&0<b.length){a.O&&(b="a "+J(a,a.N.D)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],m=h.charAt(0),p=1;p<h.length;p++){var q=h.charAt(p);if("?"==m||"r"==m||"a">q||"z"<q){g[0]=h.substr(p);g.unshift(h.substr(0,p));break}}switch(g[0].charAt(0)){case "a":var v=
|
||||
jh(a,g[1],!0);if(v)if(a.N=v,void 0===g[2])a.j("begin assemble at "+J(a,v.D)),a.O=!0,a.B.ca();else{var w;a.j("not supported yet");w=[];if(w.length){for(var x=0;x<w.length;x++)a.Gb(v,w[x],1);a.j(xh(a,a.N))}}break;case "b":a:{var E=g[0],y=g[1],A=b;if("?"==y)a.j("breakpoint commands:"),a.j("\tbp [a]\tset exec breakpoint at addr [a]"),a.j("\tbr [a]\tset read breakpoint at addr [a]"),a.j("\tbw [a]\tset write breakpoint at addr [a]"),a.j("\tbc [a]\tclear breakpoint at addr [a]"),a.j("\tbl\tlist all breakpoints"),
|
||||
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var Ha=E.charAt(1);if("l"==Ha){var nd;nd=0+vh(a,a.f);nd+=vh(a,a.L);(nd+=vh(a,a.C))||a.j("no breakpoints")}else if("n"==Ha)a.ma=Xg(a,y),a.j("break after "+a.ma+" instruction(s)");else if(void 0===y)a.j("missing breakpoint address");else{var V=Z();if("*"!=y&&(V=jh(a,y,!0),!V))break a;"c"==Ha?null==V.D?(ah(a),a.j("all breakpoints cleared")):th(a,a.f,V)||th(a,a.L,V)||th(a,a.C,V)||a.j("breakpoint missing: "+J(a,V.D)):null!=V.D&&(nh(a,V,A),"p"==Ha?a.Wa(a.f,
|
||||
V):"r"==Ha?a.Wa(a.L,V):"w"==Ha?a.Wa(a.C,V):a.j("unknown breakpoint command: "+Ha))}}}break;case "c":a.Fa&&(a.Fa.value="");break;case "d":a:{var Ya,Za=g[0],ja=g[1],Ia=g[2],Zh=g[3];if("?"==ja){var $a="";for(Ya in tb)a.Ba[Ya]&&($a&&($a+=","),$a+=Ya);$a+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
|
||||
$a.length&&a.j("dump extension commands:\n\t"+$a)}else if("state"==ja){var Tf=Hh(a.B,!0);"console"==Ia?console.log(Tf):(a.Fa&&(a.Fa.value=""),a.j(Tf))}else if("symbols"==ja)for(var od=0;od<a.H.length;od++){var pd=a.H[od],ab;for(ab in pd.fa)if("."!=ab.charAt(0)){var Uf=pd.fa[ab].o;if(void 0!==Uf){var Vf=pd.fa[ab].l;Vf&&(ab=Vf);a.j(J(a,Uf)+" "+ab)}}}else{if("d"==Za){for(Ya in tb)if(g[1]==Ya){var Wf=a.Ba[Ya];Wf?(g.shift(),g.shift(),Wf(g)):a.j("no dump registered for "+ja);break a}ja||(Za=a.Bb||"db")}else a.Bb=
|
||||
Za;if("dh"==Za){var Xf=ja,Yf=Ia,Zf="",$f=0,ca=a.X,ka=a.F;if(ka.length){var Y=+Xf||a.Va,yb=+Yf||10;isNaN(Y)?Y=yb:Zf="more ";Y>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<yb&&ca!=a.X;){var ag=ka[ca++];if(null==ag.D)break;var zb=Z(ag.D),$h=Y--,bg=xh(a,zb,"history",$h);(!qd.length||0<=bg.indexOf(qd[0]))&&a.j(bg);zb.Mb&&(ca+=
|
||||
zb.Mb,yb-=zb.Mb,Y-=zb.Mb);ca>=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<mc&&(mc=65536));for(var Bb="",bb="dd"==Za?4:"dw"==Za?2:1,nc=bb*mc||128,ai=nc+15>>4||1;ai--&&0<nc;){var oc=0,Cb=0,Db,rd="",cg="",ja=J(a,Ab.D);for(Db=4==bb?16:a.Y;0<Db&&0<nc;Db--){var pc=1,qc=1==bb?a.tb(Ab,pc):a.oa(Ab,pc=2),oc=oc|qc<<(Cb<<3),Cb=Cb+pc;Cb==bb&&(rd+=J(a,oc,bb),rd+=1==
|
||||
bb?9==Db?"-":" ":" ",oc=Cb=0);cg+=32<=qc&&128>qc?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;sc<g.length;sc++){var Eb=
|
||||
Vg(a,g[sc]);if(void 0===Eb){a.j("unrecognized value: "+g[sc]);break}Eb&~sd&&a.j("warning: "+l(Eb)+" exceeds "+cb+"-byte value");var bi=td.call(a,rc);a.j("changing "+J(a,rc.D)+" from "+J(a,bi,cb)+" to "+J(a,Eb,cb));ud.call(a,rc,Eb,cb)}}break;case "g":a:{var dg=g[1],ci=b;if(void 0!==dg){var xd=jh(a,dg,!0);if(!xd)break a;nh(a,xd,ci);a.Wa(a.f,xd,!0)}a.mb(!0,c)}break;case "h":a.v.ea?(c||a.j("halting"),a.ga()):ob(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var yd;var Fb=b.substr(2),Fb=
|
||||
va(Fb);Vg(a,Fb)?(c||a.j("true: "+Fb),yd=!0):(c||a.j("false: "+Fb),yd=!1);yd||(d=!1);break}f=!0;break;case "k":var di=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var zd=0,Ad=Z(),Gb=Z(a.b.u[6]);for(a.j("stack trace for "+J(a,Gb.D));10>zd;){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<Bd){tc.D=Hb;var uc=xh(fi,
|
||||
tc);if(0<=uc.indexOf("JSR")){var gg=uc.indexOf(" ");if(Hb+(uc.indexOf(" ",gg+1)-gg-1)/2==fg){eg=uc;break}}}Hb-=2}tc.D=fg;if(Ja=eg)break}}if(!Ja||null==Ja)break;var hg=null;if("ks"==di){var ig=Ja.match(/[0-9A-F]+$/);ig&&(hg=Eh(a,ig[0]))}Ja=ua(Ja,50)+" ;"+(hg||"stack="+J(a,Gb.D));a.j(Ja);zd++}zd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){Eh(a,g[1],!0);break}f=!0;break;case "m":a:{var la,ma=null,G=g[1];"?"==G&&(G=void 0);if(void 0!==G){var ya=0;if("all"==G)ya=1878917119,G=null;
|
||||
else if("on"==G)ma=!0,G=null;else if("off"==G)ma=!1,G=null;else{"keys"==G&&(G="key");"kbd"==G&&(G="keyboard");for(la in tb)if(G==la){ya=tb[la];ma=!!(a.na&ya);break}if(!ya){a.j("unknown message category: "+G);break a}}if(ya)if("on"==g[2])a.na|=ya,ma=!0;else if("off"==g[2]&&(a.na&=~ya,ma=!1,1073741824==ya)){for(var Cd=0;Cd<a.ra.length;Cd++)a.j(a.ra[Cd]);a.ra=[]}}var gi=0,Ib="";for(la in tb)if(!G||G==la){var hi=!!(a.na&tb[la]);if(null===ma||ma==hi)Ib&&(Ib+=","),++gi%10||(Ib+="\n\t"),"key"==la&&(la="keys"),
|
||||
Ib+=la}void 0===G&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==ma?ma?"messages on: ":"messages off: ":"message categories:\n\t")+(Ib||"none"));bh(a)}break;case "p":if("print"==g[0]){Fh(a,b.substr(5));break}var ii="pr"==g[0]?1:0;if(a.P)a.j("step in progress");else{var jg=Z(a.b.u[7]);a.tb(jg);a.P?(a.Wa(a.f,jg,!0),a.mb()||(a.B&&a.B.lb(),a.P=0)):Gh(a,ii?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}qh(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Jb=
|
||||
+g[2];if(8==Jb||10==Jb||16==Jb)a.Y=Jb;else{a.j("invalid base: "+Jb);break}}a.j("default base: "+a.Y);break;case "cs":var Kb;void 0!==g[3]&&(Kb=+g[3]);switch(g[2]){case "int":a.b.gb=Kb;break;case "start":a.b.vb=Kb;break;case "stop":a.b.hb=Kb;break;default:a.j("unknown cs option");break a}void 0!==Kb&&Sc(a.b);a.j("checksums "+(a.b.v.cb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Wc(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.Xa.toFixed(2)+
|
||||
"Mhz")+" ("+a.b.Na+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":Gh(a,g[0],g[1]);break;case "u":rh(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Dh(a,b.substr(3))||(d=!1);break}if("ver"==
|
||||
g[0]){a.j("PDPjs version 1.30.2 ("+a.b.fb+",RELEASE"+(sb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){Fh(a,b.substr(1));break}var Dd="commands:",Ed;for(Ed in dh)Dd+="\n"+ua(Ed,9)+dh[Ed];Yd(a)||(Dd+="\nnote: history disabled if no exec breakpoints");a.j(Dd);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(kg){a.j("debugger error: "+(kg.stack||kg.message)),d=!1}return d}
|
||||
function Tc(a,b,c){b=Tg(a,b,c);for(var d in b)if(!wh(a,b[+d]))return!1;return!0}Ta(function(){for(var a=C(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new $g(d);B(d,c)}});
|
||||
function Ih(a,b,c){r.call(this,"Computer",a,Ih,67108864);this.v.ka=!1;Jh(this,b);this.L=Qc(this,"autoPower",a);this.B=0;this.X=a.busWidth||a.buswidth;this.f=Kh;this.J=null;this.F=this.P=!1;this.Y=Qc(this,"url")||"";(Math.random()+.1).toString(36);this.g=Lh(this);if(this.b=mb("CPU",this.id)){this.i=mb("Debugger",this.id);this.w=new Mb({id:this.Sa+".bus",busWidth:this.X},this.b,this.i);var d,e=kb(this.id);if((this.A=mb("Panel",this.id))&&this.A.Fa)for(b=0;b<e.length;b++)d=e[b],d.ja=this.A.ja,d.j=this.A.j,
|
||||
d.Fa=this.A.Fa;this.j("PDPjs v1.30.2\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ea&&d.Ea(this,this.w,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=Qc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.F=!0,this.f=Kh),this.f&&(this.K=
|
||||
new O(this,"1.30.2"),Mh(this.K)?b=null:delete this.K);!b&&this.f&&(b=Nh(this))&&(this.F=!0);if(b){var g=this;Ba(b,null,!0,function(a,b,c){c?(g.H=null,g.F=!1,g.ja("Unable to load machine state from server (error "+c+(b?": "+va(b):"")+")")):(g.J=b,g.P=!0);H(g)})}else H(this);this.I.power||(this.L=!0);!c&&this.L&&Oh(this,this.wb)}else n("Unable to find CPU component")}u(Ih);var Kh=0;
|
||||
function Jh(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){n(d.message+" ("+c+")")}}a.R=b}function Qc(a,b,c){var d=b.toLowerCase(),d=db[b]||db[d];void 0===d&&a.R&&(d=a.R[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Oh(a,b,c){for(var d=kb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!pb(f)){pb(f,function(){Oh(a,b,c)});return}}b.call(a,c)}
|
||||
function Ph(a,b){var c=new O(a,"1.30.2","validate");if(Mh(c)&&Qh(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.ja("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=Ih.prototype;
|
||||
k.wb=function(a){void 0===a&&(a=this.f||(this.J?1:Kh));if(!this.B){this.B++;var b=!1,c=!1;this.O=!1;var d=this.K||new O(this,"1.30.2");if(-1==a)b=!0;else if(a>Kh){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;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Uh(this,g,d,b,c));b=[d,a,c];-1!=a?Oh(this,this.Wb,b):this.Wb(b)}};
|
||||
function Uh(a,b,c,d,e){if(!b.v.ka){b.v.ka=!0;if(b.Aa){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Aa(f,d)&&f&&(n("Unable to restore state for "+b.type),a.N&&!a.P?(c.clear(),a.f=Kh,window&&window.location.reload()):a.O=!0,b.Aa(null),e=!1)}if(!d&&b.Xb)for(a=b.Xb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
k.Wb=function(a){var b=a[0],c=0>a[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;m<h.length;m++){var p=h[m];p.v.ka&&(p.za&&(d=p.za(b,c),"object"===typeof d&&f.set(p.id,
|
||||
d)),c&&(p.v.ka=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&Vh(a,a.g,f.toString()),Th(g)&&Th(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.v.ka=!1,b=a.I.power)&&(b.textContent="Power");a.B=0;return e}k.reset=function(){this.w&&this.w.reset&&(D(this,"Resetting "+this.w.type),this.w.reset());for(var a=kb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.w&&c.reset&&(D(this,"Resetting "+c.type),c.reset())}};
|
||||
k.start=function(a,b){for(var c=kb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.ca(!0)};k.stop=function(a,b){for(var c=kb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.ca(!0)};
|
||||
k.qa=function(a,b,c){var d=this;switch(b){case "power":return this.I[b]=c,c.onclick=function(){d.B||(d.v.ka?Hh(d,!1,!0):Oh(d,d.wb))},!0;case "reset":return this.I[b]=c,c.onclick=function(){if(d.v.ka&&!d.B)if(d.f&&!d.H){var a=Da("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Hh(d,a,!0);!a&&d.N?window&&window.location.reload():d.wb(Kh)}else d.reset(),d.b&&d.b.ab()},!0;case "save":if(qa())c.parentNode.removeChild(c);else return this.I[b]=
|
||||
c,c.onclick=function(){var a=Lh(d,!0);if(a){var b=!!(d.f&&!d.H||d.N),c=Hh(d,b);b?Vh(d,a,c):d.ja("Resume disabled, machine state not saved")}},!0}return!1};
|
||||
function Lh(a,b){var c=a.g;c||((c=Ga("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Wh(a,c))||a.ja("The user ID is invalid.")):b&&a.ja("Browser local storage is not available"));return c}
|
||||
function Wh(a,b){a.g=null;b=Ba(ra()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ka("user",b.data),a.g=b.data)}catch(d){n(d.message+" ("+c+")")}return a.g}function Nh(a){var b=null;a.g&&(b=ra()+"/api/v1/user?req=load&user="+a.g+"&state="+Xh(a,"1.30.2"));return b}
|
||||
function Vh(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Xh(a,"1.30.2");d.data=c;b=Ba(ra()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.ja("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.ja(c),Ka("user",""),a.g=null)}}
|
||||
function Gg(a){var b;a=kb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.lb=function(a){if(this.Fa){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Fa.focus();!a&&window&&window.scrollTo(b,c)}};k.ca=function(a){this.b&&this.b.ca(a);this.A&&this.A.ca(a)};
|
||||
Ta(function(){for(var a=C(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=C(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=z(f),g=new Ih(g,d,!0);B(g,f);g.L&&Oh(g,g.wb)}});Oa.show.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=mb("Computer",c.id))&&c.aa&&!c.v.ka&&c.wb(-1)}});
|
||||
Oa.exit.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=mb("Computer",c.id))&&c.v.ka&&Hh(c,!(!c.f||c.H),!0)}});function O(a,b,c){this.id=a.id;this.key=Xh(a,b,c);this.i=a.i;Sh(this,a.tc)}function Xh(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
||||
O.prototype={constructor:O,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Sh(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
|
||||
1);c=0}}};function Sh(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Th(a){var b=!0;if(Fa()){var c=JSON.stringify(a[a.id]);Ka(a.key,c)||(n("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Qh(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){n(c.message||c),b=!1}return b}function Mh(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Fa()&&(b=Ga(a.key))?(a[a.id]=b,a.b=!0):!1}var Yh=0;
|
||||
function ji(a,b,c,d,e,f){e("Loading "+a+"...");Ba(a,null,!0,function(g,h,m){m?(h||(h="unable to load "+a+" ("+m+")"),f(h,null)):ki(h,a,b,c,d,e,f)})}
|
||||
function ki(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(jb(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\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<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?li(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
||||
function li(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/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.w.ka,
|
||||
8)+" %%"+l(q.D,8)+" "+l(q.Eb,4,!0)+" "+l(q.size,4,!0)+" "+n),c!=Gc&&(c=-1),n=0);a+=d.w.ua;e++}}});G(this)};
|
||||
k.qa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.la=this.F[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Xc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.A<d.g.length-1&&(b=d.g[++d.A])):40==a.keyCode&&(0<d.A?b=d.g[--d.A]:(b="",d.A=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.F[b]=c,Qa(c,function(){if(d.la){var a=d.la.value;
|
||||
d.la.value="";Xc(d,a,!0);return!0}return!1}),!0;case "step":return this.F[b]=c,Qa(c,function(a){var b=!1;rb(d,!0)||(qb(d,!0),b=d.tb(a?1:0),qb(d,!1));return b}),!0}return!1};k.gb=function(a){if(this.la){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.la.focus();!a&&window&&window.scrollTo(b,c)}};k.aa=function(a){a=a&&a.D;null==a&&(a=-1);return a};k.zb=function(a,b){var c=255,d=this.aa(a,!1,1);-1!==d&&(c=a.Jb?this.w.Mb(d):this.b.Mb(d),b&&Eh(a,b));return c};
|
||||
k.oa=function(a,b){var c=65535,d=this.aa(a,!1,2);-1!==d&&(c=a.Jb?this.w.lb(d):this.b.lb(d),b&&Eh(a,b));return c};k.Qb=function(a,b,c){var d=this.aa(a,!0,1);-1!==d&&(a.Jb?this.w.fb(d,b):this.b.fb(d,b),c&&Eh(a,c),this.B.da(!0))};k.hb=function(a,b,c){var d=this.aa(a,!0,2);-1!==d&&(a.Jb?this.w.Rb(d,b):this.b.Rb(d,b),c&&Eh(a,c),this.B.da(!0))};function Y(a,b){return{D:a,Jb:b,Ga:!1}}function Fh(a){return[a.D,a.Ga]}function Gh(a){return{D:a[0],Ga:a[1]}}
|
||||
function Dh(a,b,c){var d,e=(c?a.K:a.$a).D;c=!1;if(void 0!==b){b=ph(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.I.length;e++){var g=a.I[e].ga[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Y(d));break}}if(d=f)return d;e=oh(a,b,void 0)}null!=e&&(d=Y(e,c));return d}function Hh(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Ec=mh(a,b.zc=c[2]))}function Eh(a,b){null!=a.D&&(a.D+=b||1)}
|
||||
function wh(a,b){a.i=a;a.na=a.Ic=536870912;a.ba=null;a.ra=[];b=mh(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in wb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.na|=wb[c],a.j(c+" messages enabled"))}}function Ch(a,b){for(var c in wb)if(64==wb[c]){a.Ea[c]=b;break}}
|
||||
k.oc=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function Ih(a){return 6>a?"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<a.G.length;b++)a.G[b]=Y();a.Y=0;a.j("instruction history buffer allocated")}}
|
||||
k.sb=function(a,b){if(!Jh(this,b))return!1;this.b.sb(a);return!0};k.tb=function(a,b,c){if(!Jh(this))return!1;this.J=0;a||ae(this)&&be(this,this.b.u[7],0);try{a=dd(this.b,a);var d=this.b.tb(a);0<d&&(ed(this.b,a),this.J+=d,ad(this.b,d,!0),Yc(this.b,d),this.sa++)}catch(e){"number"!=typeof e&&(this.J=0,ub(this.b,e.stack||e.message))}!1!==c&&this.B.da();this.da(b||!1);return 0<this.J};k.ia=function(a){this.b&&this.b.ia(a)};
|
||||
k.da=function(a){if(this.ab){void 0===a&&(a=!0);var b;b=this.b;if(b=b.H&8?b.Rc|b.Qc<<8:0){var c=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=0<a?Math.round(1E3*this.J/a):0;b+=" (";ae(this)&&(b+=this.sa+" instructions, ",this.sa=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}this.da(!0);this.gb();Mh(this,this.b.u[7]);this.ba=null}};function ae(a){return 1<a.f.length||!!a.ma}
|
||||
function be(a,b,c){var d=-1;c||(d=a.b.lb(b),0==d&&(b=pd(a.b,2)));if(0<c&&(a.ma&&!--a.ma||Pc(a,b,1,a.f)))return!0;0<=c&&a.G.length&&(a.sa++,0>d&&(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<a.L.length;b++){c=a.L[b];var d=a.w;c=a.aa(c);Qc(d.W[c>>>d.ka],!1)}a.L=["br"];if(a.C)for(b=1;b<a.C.length;b++)c=a.C[b],d=a.w,c=a.aa(c),Qc(d.W[c>>>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<b.length;g++){var h=b[g];if(c==a.aa(h)&&(!d||h.Ga)){f=!0;h.Ga||e||Oh(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.w,Qc(d.W[c>>>d.ka],b==a.C));h.Ga||vh(a);break}}return f}function Ph(a,b){for(var c=1;c<b.length;c++)Oh(a,b,c);return b.length-1}function Oh(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.D)+(d?" "+d:c.zc?' "'+c.zc+'"':""))}
|
||||
function Mh(a,b){if(void 0!==b)Pc(a,b,1,a.f,!0),a.R=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ga){if(!Nh(a,a.f,c,!0))break;b=0}}}
|
||||
function Pc(a,b,c,d,e){var f=!1;if(!a.Ya++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Ga)for(var m=a.aa(h),n=0;n<c;n++)if(b+n==m){var q,f=!0;h.Ga&&(Nh(a,d,h,!0),e=!0);if(q=h.Ec){for(var f=!1,w=0;w<q.length;w++)if(!Qh(a,q[w],!0)){if(q[w].indexOf("if")){f=!0;break}for(var v=w+1;v<q.length&&q[v].indexOf("else");v++)w++;if(v==q.length){f=!0;break}}a.b.v.fa||(f=!0)}if(f){e||Oh(a,d,g,"hit");break}}}a.Ya--;return f}
|
||||
function Rh(a,b,c,d){var e=Y(b.D),f=a.oa(b,2),g,h;for(h in a.jb)if(g=a.jb[h][f&h])break;g||(g=Ah);var m=g[0];0<=a.wb.indexOf(m)&&(g=Ah,m=g[0]);var n=h="",q=yh[m],w=g.length-1;m||w||(h=J(a,f));for(m=1;m<=w;m++){var v=g[m];if(void 0!==v){var x;x=a;var z=v,v=b,y="",B=z&61440;if(4096==B)v=v.D+((f&255)<<24>>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]);
|
||||
0<h.length&&(h+=",");h+=x||"???"}}f="";g=J(a,e.D)+":";if(-1!==e.D&&-1!==b.D){do if(f+=" "+J(a,a.oa(e,2)),null==e.D)break;while(e.D!=b.D)}g+=wa(f,24);g+=wa(q,5);h&&(g+=" "+h);if(c||n)g=wa(g,60)+";"+(c||""),g=a.b.v.kb?g+("cycles="+Zc(a.b).toString()+" cs="+l(a.b.Ab)):g+(null!=d?"="+d.toString():""),n&&(g+=" @"+n);return g}function Sh(a,b){switch(b){case "N":a=a.b.Ma();break;case "Z":a=nd(a.b);break;case "V":a=md(a.b);break;case "C":a=ld(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
|
||||
function Th(a,b){var c="",d=a.b;8>b?(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]<b[0]?-1:0};
|
||||
function eg(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var m=h.o,n=h.a;if(void 0!==m){var q=f,m=[m>>>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<a.I.length;b++){var f=a.I[b],g=f.D>>>0,h=f.Pc;if(e>=g&&e<g+h){e=za(f.gc,[e-g],a.ic);0<=e?Wh(a,b,e,d):c&&(e=~e,Wh(a,b,e-1,d),Wh(a,b,e,d));break}}return d}
|
||||
function Wh(a,b,c,d){var e={},f=a.I[b].gc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.I[b].ga[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function Xh(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return sh(a)||a.j("no variables"),!0;if(!c[2])return sh(a,c[1]);if(!c[3])return delete a.S[c[1]],!0;b=oh(a,c[3]);return void 0!==b?(a.S[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
|
||||
function Yh(a,b,c){var d=null;if(b=Dh(a,b,!0)){a.aa(b);var e=Vh(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.D-e[1])&&(g=" + "+l(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.j(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.D)&&(g=" - "+l(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
|
||||
function Kh(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}f=oh(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":N(d,f);a.K=Y(d.u[7]);break;case "N":d.X=f?32768:0;break;case "Z":d.$=
|
||||
f?0:1;break;case "V":d.U=f?32768:0;break;case "C":d.T=f?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){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?1<c[2].length?a.j(c[2]):rh(a,null,c[2].charCodeAt(0)):oh(a,b,!0)}
|
||||
function $h(a,b,c){var d="t"!=b;c=qh(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Pa(c,function(){return qb(a,!0)&&a.tb(e,d,!1)},function(){a.B.da();qb(a,!1)})}
|
||||
function Lh(a,b,c,d){if(b=Dh(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=qh(a,c.substr(1)),null!=c&&(d=c);else{d=Dh(a,c,!0);if(!d||d.D<b.D)return;e=d.D-b.D;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=rb(a,!1)||a.R?a.J:null;var g=null!=f?"cycles":null,h=Vh(a,b),m=b.D;if(h[0]&&d&&(!c&&d||0>h[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)&&0<b.length){a.P&&(b="a "+J(a,a.N.D)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],m=h.charAt(0),n=1;n<h.length;n++){var q=h.charAt(n);if("?"==m||"r"==m||"a">q||"z"<q){g[0]=h.substr(n);g.unshift(h.substr(0,n));break}}switch(g[0].charAt(0)){case "a":var w=
|
||||
Dh(a,g[1],!0);if(w)if(a.N=w,void 0===g[2])a.j("begin assemble at "+J(a,w.D)),a.P=!0,a.B.da();else{var v;a.j("not supported yet");v=[];if(v.length){for(var x=0;x<v.length;x++)a.Qb(w,v[x],1);a.j(Rh(a,a.N))}}break;case "b":a:{var z=g[0],y=g[1],B=b;if("?"==y)a.j("breakpoint commands:"),a.j("\tbp [a]\tset exec breakpoint at addr [a]"),a.j("\tbr [a]\tset read breakpoint at addr [a]"),a.j("\tbw [a]\tset write breakpoint at addr [a]"),a.j("\tbc [a]\tclear breakpoint at addr [a]"),a.j("\tbl\tlist all breakpoints"),
|
||||
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var ia=z.charAt(1);if("l"==ia){var Ja;Ja=0+Ph(a,a.f);Ja+=Ph(a,a.L);(Ja+=Ph(a,a.C))||a.j("no breakpoints")}else if("n"==ia)a.ma=qh(a,y),a.j("break after "+a.ma+" instruction(s)");else if(void 0===y)a.j("missing breakpoint address");else{var P=Y();if("*"!=y&&(P=Dh(a,y,!0),!P))break a;"c"==ia?null==P.D?(uh(a),a.j("all breakpoints cleared")):Nh(a,a.f,P)||Nh(a,a.L,P)||Nh(a,a.C,P)||a.j("breakpoint missing: "+J(a,P.D)):null!=P.D&&(Hh(a,P,B),"p"==ia?a.cb(a.f,
|
||||
P):"r"==ia?a.cb(a.L,P):"w"==ia?a.cb(a.C,P):a.j("unknown breakpoint command: "+ia))}}}break;case "c":a.Ka&&(a.Ka.value="");break;case "d":a:{var bb,cb=g[0],la=g[1],La=g[2],si=g[3];if("?"==la){var db="";for(bb in wb)a.Ea[bb]&&(db&&(db+=","),db+=bb);db+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
|
||||
db.length&&a.j("dump extension commands:\n\t"+db)}else if("state"==la){var fg=ai(a.B,!0);"console"==La?console.log(fg):(a.Ka&&(a.Ka.value=""),a.j(fg))}else if("symbols"==la)for(var vd=0;vd<a.I.length;vd++){var wd=a.I[vd],eb;for(eb in wd.ga)if("."!=eb.charAt(0)){var gg=wd.ga[eb].o;if(void 0!==gg){var hg=wd.ga[eb].l;hg&&(eb=hg);a.j(J(a,gg)+" "+eb)}}}else{if("d"==cb){for(bb in wb)if(g[1]==bb){var ig=a.Ea[bb];ig?(g.shift(),g.shift(),ig(g)):a.j("no dump registered for "+la);break a}la||(cb=a.Kb||"db")}else a.Kb=
|
||||
cb;if("dh"==cb){var jg=la,kg=La,lg="",mg=0,ea=a.Y,ma=a.G;if(ma.length){var Z=+jg||a.bb,Db=+kg||10;isNaN(Z)?Z=Db:lg="more ";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<Db&&ea!=a.Y;){var ng=ma[ea++];if(null==ng.D)break;var Eb=Y(ng.D),ti=Z--,og=Rh(a,Eb,"history",ti);(!xd.length||0<=og.indexOf(xd[0]))&&a.j(og);Eb.Wb&&(ea+=
|
||||
Eb.Wb,Db-=Eb.Wb,Z-=Eb.Wb);ea>=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<vc&&(vc=65536));for(var Gb="",fb="dd"==cb?4:"dw"==cb?2:1,wc=fb*vc||128,ui=wc+15>>4||1;ui--&&0<wc;){var xc=0,Hb=0,Ib,yd="",pg="",la=J(a,Fb.D);for(Ib=4==fb?16:a.Z;0<Ib&&0<wc;Ib--){var yc=1,zc=1==fb?a.zb(Fb,yc):a.oa(Fb,yc=2),xc=xc|zc<<(Hb<<3),Hb=Hb+yc;Hb==fb&&(yd+=J(a,xc,fb),yd+=1==
|
||||
fb?9==Ib?"-":" ":" ",xc=Hb=0);pg+=32<=zc&&128>zc?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;Bc<g.length;Bc++){var Jb=
|
||||
oh(a,g[Bc]);if(void 0===Jb){a.j("unrecognized value: "+g[Bc]);break}Jb&~zd&&a.j("warning: "+l(Jb)+" exceeds "+gb+"-byte value");var vi=Ad.call(a,Ac);a.j("changing "+J(a,Ac.D)+" from "+J(a,vi,gb)+" to "+J(a,Jb,gb));Bd.call(a,Ac,Jb,gb)}}break;case "g":a:{var qg=g[1],wi=b;if(void 0!==qg){var Ed=Dh(a,qg,!0);if(!Ed)break a;Hh(a,Ed,wi);a.cb(a.f,Ed,!0)}a.sb(!0,c)}break;case "h":a.v.fa?(c||a.j("halting"),a.ia()):rb(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var Fd;var Kb=b.substr(2),Kb=
|
||||
xa(Kb);oh(a,Kb)?(c||a.j("true: "+Kb),Fd=!0):(c||a.j("false: "+Kb),Fd=!1);Fd||(d=!1);break}f=!0;break;case "k":var xi=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var Gd=0,Hd=Y(),Lb=Y(a.b.u[6]);for(a.j("stack trace for "+J(a,Lb.D));10>Gd;){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<Id){Cc.D=Mb;var Dc=Rh(zi,
|
||||
Cc);if(0<=Dc.indexOf("JSR")){var tg=Dc.indexOf(" ");if(Mb+(Dc.indexOf(" ",tg+1)-tg-1)/2==sg){rg=Dc;break}}}Mb-=2}Cc.D=sg;if(Ma=rg)break}}if(!Ma||null==Ma)break;var ug=null;if("ks"==xi){var vg=Ma.match(/[0-9A-F]+$/);vg&&(ug=Yh(a,vg[0]))}Ma=wa(Ma,50)+" ;"+(ug||"stack="+J(a,Lb.D));a.j(Ma);Gd++}Gd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){Yh(a,g[1],!0);break}f=!0;break;case "m":a:{var na,oa=null,H=g[1];"?"==H&&(H=void 0);if(void 0!==H){var Ca=0;if("all"==H)Ca=1878917119,H=null;
|
||||
else if("on"==H)oa=!0,H=null;else if("off"==H)oa=!1,H=null;else{"keys"==H&&(H="key");"kbd"==H&&(H="keyboard");for(na in wb)if(H==na){Ca=wb[na];oa=!!(a.na&Ca);break}if(!Ca){a.j("unknown message category: "+H);break a}}if(Ca)if("on"==g[2])a.na|=Ca,oa=!0;else if("off"==g[2]&&(a.na&=~Ca,oa=!1,1073741824==Ca)){for(var Jd=0;Jd<a.ra.length;Jd++)a.j(a.ra[Jd]);a.ra=[]}}var Ai=0,Nb="";for(na in wb)if(!H||H==na){var Bi=!!(a.na&wb[na]);if(null===oa||oa==Bi)Nb&&(Nb+=","),++Ai%10||(Nb+="\n\t"),"key"==na&&(na="keys"),
|
||||
Nb+=na}void 0===H&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==oa?oa?"messages on: ":"messages off: ":"message categories:\n\t")+(Nb||"none"));vh(a)}break;case "p":if("print"==g[0]){Zh(a,b.substr(5));break}var Ci="pr"==g[0]?1:0;if(a.R)a.j("step in progress");else{var wg=Y(a.b.u[7]);a.zb(wg);a.R?(a.cb(a.f,wg,!0),a.sb()||(a.B&&a.B.gb(),a.R=0)):$h(a,Ci?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}Kh(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Ob=
|
||||
+g[2];if(8==Ob||10==Ob||16==Ob)a.Z=Ob;else{a.j("invalid base: "+Ob);break}}a.j("default base: "+a.Z);break;case "cs":var Pb;void 0!==g[3]&&(Pb=+g[3]);switch(g[2]){case "int":a.b.nb=Pb;break;case "start":a.b.Bb=Pb;break;case "stop":a.b.ob=Pb;break;default:a.j("unknown cs option");break a}void 0!==Pb&&Wc(a.b);a.j("checksums "+(a.b.v.kb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&($c(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.eb.toFixed(2)+
|
||||
"Mhz")+" ("+a.b.Ta+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":$h(a,g[0],g[1]);break;case "u":Lh(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Xh(a,b.substr(3))||(d=!1);break}if("ver"==
|
||||
g[0]){a.j("PDPjs version 1.30.2 ("+a.b.mb+",RELEASE"+(vb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){Zh(a,b.substr(1));break}var Kd="commands:",Ld;for(Ld in xh)Kd+="\n"+wa(Ld,9)+xh[Ld];ae(a)||(Kd+="\nnote: history disabled if no exec breakpoints");a.j(Kd);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(xg){a.j("debugger error: "+(xg.stack||xg.message)),d=!1}return d}
|
||||
function Xc(a,b,c){b=mh(a,b,c);for(var d in b)if(!Qh(a,b[+d]))return!1;return!0}Wa(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new th(d);C(d,c)}});
|
||||
function bi(a,b,c){r.call(this,"Computer",a,bi,67108864);this.v.ha=!1;ci(this,b);this.L=Uc(this,"autoPower",a);this.B=0;this.Y=a.busWidth||a.buswidth;this.f=di;this.J=null;this.G=this.R=!1;this.Z=Uc(this,"url")||"";(Math.random()+.1).toString(36);this.g=ei(this);if(this.b=pb("CPU",this.id)){this.i=pb("Debugger",this.id);this.w=new Cb({id:this.Ia+".bus",busWidth:this.Y},this.b,this.i);var d,e=nb(this.id);if((this.A=pb("Panel",this.id))&&this.A.Ka)for(b=0;b<e.length;b++)d=e[b],d.O=this.A.O,d.j=this.A.j,
|
||||
d.Ka=this.A.Ka;this.j("PDPjs v1.30.2\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.wa&&d.wa(this,this.w,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.I=d:this.f=parseInt(d,10));var f;if(a=Uc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.G=!0,this.f=di),this.f&&(this.K=
|
||||
new O(this,"1.30.2"),fi(this.K)?b=null:delete this.K);!b&&this.f&&(b=gi(this))&&(this.G=!0);if(b){var g=this;Da(b,null,!0,function(a,b,c){c?(g.I=null,g.G=!1,g.O("Unable to load machine state from server (error "+c+(b?": "+xa(b):"")+")")):(g.J=b,g.R=!0);G(g)})}else G(this);this.F.power||(this.L=!0);!c&&this.L&&hi(this,this.Cb)}else p("Unable to find CPU component")}u(bi);var di=0;
|
||||
function ci(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){p(d.message+" ("+c+")")}}a.S=b}function Uc(a,b,c){var d=b.toLowerCase(),d=ab[b]||ab[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function hi(a,b,c){for(var d=nb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!sb(f)){sb(f,function(){hi(a,b,c)});return}}b.call(a,c)}
|
||||
function ii(a,b){var c=new O(a,"1.30.2","validate");if(fi(c)&&ji(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.O("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=bi.prototype;
|
||||
k.Cb=function(a){void 0===a&&(a=this.f||(this.J?1:di));if(!this.B){this.B++;var b=!1,c=!1;this.P=!1;var d=this.K||new O(this,"1.30.2");if(-1==a)b=!0;else if(a>di){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;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=ni(this,g,d,b,c));b=[d,a,c];-1!=a?hi(this,this.kc,b):this.kc(b)}};
|
||||
function ni(a,b,c,d,e){if(!b.v.ha){b.v.ha=!0;if(b.za){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.za(f,d)&&f&&(p("Unable to restore state for "+b.type),a.N&&!a.R?(c.clear(),a.f=di,window&&window.location.reload()):a.P=!0,b.za(null),e=!1)}if(!d&&b.mc)for(a=b.mc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
k.kc=function(a){var b=a[0],c=0>a[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;m<h.length;m++){var n=h[m];n.v.ha&&(n.ya&&(d=n.ya(b,c),"object"===typeof d&&f.set(n.id,
|
||||
d)),c&&(n.v.ha=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&oi(a,a.g,f.toString()),mi(g)&&mi(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.v.ha=!1,b=a.F.power)&&(b.textContent="Power");a.B=0;return e}k.reset=function(){this.w&&this.w.reset&&(E(this,"Resetting "+this.w.type),this.w.reset());for(var a=nb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.w&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}};
|
||||
k.start=function(a,b){for(var c=nb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.da(!0)};k.stop=function(a,b){for(var c=nb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.da(!0)};
|
||||
k.qa=function(a,b,c){var d=this;switch(b){case "power":return this.F[b]=c,c.onclick=function(){d.B||(d.v.ha?ai(d,!1,!0):hi(d,d.Cb))},!0;case "reset":return this.F[b]=c,c.onclick=function(){if(d.v.ha&&!d.B)if(d.f&&!d.I){var a=Ga("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");ai(d,a,!0);!a&&d.N?window&&window.location.reload():(a||(d.lc=!0),d.Cb(di),d.lc=!1)}else d.reset(),d.b&&d.b.ib()},!0;case "save":if(ta(Fa(),"pcjs.org"))c.parentNode.removeChild(c);
|
||||
else return this.F[b]=c,c.onclick=function(){var a=ei(d,!0);if(a){var b=!!(d.f&&!d.I||d.N),c=ai(d,b);b?oi(d,a,c):d.O("Resume disabled, machine state not saved")}},!0}return!1};
|
||||
function ei(a,b){var c=a.g;c||((c=Ka("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=pi(a,c))||a.O("The user ID is invalid.")):b&&a.O("Browser local storage is not available"));return c}
|
||||
function pi(a,b){a.g=null;b=Da(Fa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Na("user",b.data),a.g=b.data)}catch(d){p(d.message+" ("+c+")")}return a.g}function gi(a){var b=null;a.g&&(b=Fa()+"/api/v1/user?req=load&user="+a.g+"&state="+qi(a,"1.30.2"));return b}
|
||||
function oi(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=qi(a,"1.30.2");d.data=c;b=Da(Fa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.O("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.O(c),Na("user",""),a.g=null)}}
|
||||
function Jg(a){var b;a=nb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.gb=function(a){if(this.Ka){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Ka.focus();!a&&window&&window.scrollTo(b,c)}};k.da=function(a){this.b&&this.b.da(a);this.A&&this.A.da(a)};
|
||||
Wa(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new bi(g,d,!0);C(g,f);g.L&&hi(g,g.Cb)}});Ra.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=pb("Computer",c.id))&&c.ba&&!c.v.ha&&c.Cb(-1)}});
|
||||
Ra.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=pb("Computer",c.id))&&c.v.ha&&ai(c,!(!c.f||c.I),!0)}});function O(a,b,c){this.id=a.id;this.key=qi(a,b,c);this.i=a.i;li(this,a.Oc)}function qi(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
||||
O.prototype={constructor:O,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){li(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
|
||||
1);c=0}}};function li(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function mi(a){var b=!0;if(Ia()){var c=JSON.stringify(a[a.id]);Na(a.key,c)||(p("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function ji(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){p(c.message||c),b=!1}return b}function fi(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ia()&&(b=Ka(a.key))?(a[a.id]=b,a.b=!0):!1}var ri=0;
|
||||
function Di(a,b,c,d,e,f){e("Loading "+a+"...");Da(a,null,!0,function(g,h,m){m?(h||(h="unable to load "+a+" ("+m+")"),f(h,null)):Ei(h,a,b,c,d,e,f)})}
|
||||
function Ei(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(mb(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\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<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Fi(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
||||
function Fi(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/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
|
||||
|
|
|
|||
|
|
@ -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<ca.length-1;da++){var ea=ca[da];ea in ba||(ba[ea]={});ba=ba[ea]}var fa=ca[ca.length-1],ga=ba[fa],ha=ga?ga:function(a){return Math.log(a)/Math.LN2};
|
||||
ha!=ga&&null!=ha&&aa(ba,fa,{configurable:!0,writable:!0,value:ha});function ia(a,b){var c="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;)c=String.fromCharCode((a&7)+48)+c,a>>=3;return""+c}function ja(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=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<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function la(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ma(){var a=na();return-1!==a.indexOf("pcjs.org",a.length-8)}var oa={"&":"&","<":"<",">":">",'"':""","'":"'"};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<e.length;c++)d.K[f++]=e[c]&255,d.K[f++]=e[c]>>8&255;else if(e=h.data)for(d.K=Array(4*e.length),f=c=0;c<e.length;c++)d.K[f++]=e[c]&255,d.K[f++]=
|
||||
e[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;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){m("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.K=e)}return d}
|
||||
function na(){return"http://"+(window?window.location.host:"www.pcjs.org")}function m(a){window&&window.alert(a)}function va(a){var b=!1;window&&(b=window.confirm(a));return b}var wa=null;function xa(){if(null==wa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}wa=a}return wa}
|
||||
function ya(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function za(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Aa(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var p={init:[],show:[],exit:[]},Ba=!1,Ca=!1,Da=!0;
|
||||
function Ea(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function r(a){p.init.push(a)}function Fa(a){if(Da)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){m(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ga(a){!Da&&a?(Da=!0,Ba&&Ha("init"),Ca&&Ha("show")):Da=a}function Ha(a){p[a]&&Fa(p[a])}Ea("onload",function(){Ba=!0;Fa(p.init)});Ea("onpageshow",function(){Ca=!0;Fa(p.show)});
|
||||
Ea(Aa("Opera")||Aa("iOS")?"onunload":"onbeforeunload",function(){Fa(p.exit)});function u(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.sb=b.comment;this.Hb=b;b=this.id.indexOf(".");0>b?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<v.length;b++){var d=v[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function Qa(a){if(void 0!==a){var b;for(b=0;b<v.length;b++)if(v[b].id===a)return v[b]}return null}function Sa(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<v.length;d++)if(c)c==v[d]&&(c=null);else if(!(a!=v[d].type||b&&v[d].id.indexOf(b)))return v[d]}return null}function y(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){m(c.message+" ("+a+")")}return b}
|
||||
function A(a,b){b=B(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var h=f.getAttribute("class");if(h)for(var l=h.split(" "),n=0;n<l.length;n++)switch(h=l[n],h){case "pdp11-binding":(h=y(f))&&h.binding&&a.Y(h.type,h.binding,f,h.value),n=l.length}}}}
|
||||
function B(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
|
||||
u.prototype={constructor:u,parent:null,toString:function(){return this.name?this.name:this.id||this.type},Y:function(a,b,c){switch(b){case "clear":return this.u[b]||(this.u[b]=c,c.onclick=function(a){return function(){a.u.print&&(a.u.print.value="")}}(this)),!0;case "print":return this.u[b]||(this.Ga=this.u[b]=c,c.value="",this.R=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
|
||||
this.L=function(a){this.R(a,this.La)}),!0;default:return!1}},log:function(){},R:function(){},status:function(a){this.R(this.La+": "+a)},L:function(a,b,c){c=c||this.type;b||m((c?c+": ":"")+a)},ba:function(){return this.i.O=!0},aa:function(a,b){b&&(this.i.O=!1);return!0}};function C(a){if(!a.i.error&&(a.i.ready=!0,a.i.ready)){var b=a.Va;a.Va=null;b&&b()}}function Ta(a,b){b&&(a.i.ready?b():a.Va=b);return a.i.ready}
|
||||
for(var h,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,ca=["Math","log2"],da=0;da<ca.length-1;da++){var ea=ca[da];ea in ba||(ba[ea]={});ba=ba[ea]}var fa=ca[ca.length-1],ga=ba[fa],ha=ga?ga:function(a){return Math.log(a)/Math.LN2};
|
||||
ha!=ga&&null!=ha&&aa(ba,fa,{configurable:!0,writable:!0,value:ha});var ia={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]};
|
||||
function ja(a){var b=10,c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==
|
||||
e&&d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function ka(a,b){var c="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;)c=String.fromCharCode((a&7)+48)+c,a>>=3;return""+c}function l(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=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<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function la(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ma(a,b){return-1!==a.indexOf(b,a.length-b.length)}var na={"&":"&","<":"<",">":">",'"':""","'":"'"};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<e.length;c++)d.L[f++]=e[c]&255,d.L[f++]=e[c]>>8&255;else if(e=g.data)for(d.L=Array(4*e.length),f=c=0;c<e.length;c++)d.L[f++]=e[c]&255,
|
||||
d.L[f++]=e[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;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){r("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.L=e)}return d}
|
||||
function u(){return"http://"+(window?window.location.host:"www.pcjs.org")}function r(a){window&&window.alert(a)}function wa(a){var b=!1;window&&(b=window.confirm(a));return b}var xa=null;function ya(){if(null==xa){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}xa=a}return xa}
|
||||
function za(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Aa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ba(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var v={init:[],show:[],exit:[]},Ca=!1,Da=!1,Ea=!0;
|
||||
function Fa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function x(a){v.init.push(a)}function Ga(a){if(Ea)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){r(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ha(a){!Ea&&a?(Ea=!0,Ca&&Ia("init"),Da&&Ia("show")):Ea=a}function Ia(a){v[a]&&Ga(v[a])}Fa("onload",function(){Ca=!0;Ga(v.init)});Fa("onpageshow",function(){Da=!0;Ga(v.show)});
|
||||
Fa(Ba("Opera")||Ba("iOS")?"onunload":"onbeforeunload",function(){Ga(v.exit)});function y(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Ib=b.comment;this.bc=b;b=this.id.indexOf(".");0>b?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<z.length;b++){var d=z[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
||||
function Ra(a){if(void 0!==a){var b;for(b=0;b<z.length;b++)if(z[b].id===a)return z[b]}return null}function Sa(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<z.length;d++)if(c)c==z[d]&&(c=null);else if(!(a!=z[d].type||b&&z[d].id.indexOf(b)))return z[d]}return null}function C(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){r(c.message+" ("+a+")")}return b}
|
||||
function D(a,b){b=E(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var k=g.split(" "),m=0;m<k.length;m++)switch(g=k[m],g){case "pdp11-binding":(g=C(f))&&g.binding&&a.V(g.type,g.binding,f,g.value),m=k.length}}}}
|
||||
function E(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
|
||||
y.prototype={constructor:y,parent:null,toString:function(){return this.name?this.name:this.id||this.type},V:function(a,b,c){switch(b){case "clear":return this.m[b]||(this.m[b]=c,c.onclick=function(a){return function(){a.m.print&&(a.m.print.value="")}}(this)),!0;case "print":return this.m[b]||(this.Na=this.m[b]=c,c.value="",this.R=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
|
||||
this.C=function(a){this.R(a,this.Aa)}),!0;default:return!1}},log:function(){},R:function(){},status:function(a){this.R(this.Aa+": "+a)},C:function(a,b,c){c=c||this.type;b||r((c?c+": ":"")+a)},ea:function(){return this.j.O=!0},da:function(a,b){b&&(this.j.O=!1);return!0}};function G(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.eb,a.eb=null,b&&b()))}function Ta(a,b){b&&(a.j.ready?b():a.eb=b);return a.j.ready}
|
||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});
|
||||
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){u.call(this,"Panel",a,Va);this.b=0;this.i.nb=!0}w(Va);g=Va.prototype;
|
||||
g.Y=function(a,b,c,d){if(this.o&&this.o.Y(a,b,c,d)||this.a&&this.a.Y(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.u[b]=c,this.b++,!0;default:return"rled"==a?(this.u[b]=c,this.b++,!0):this.parent.Y.call(this,a,b,c,d)}};g.ha=function(a,b,c,d){this.o=a;this.j=b;this.a=c;this.D=d};g.ba=function(a,b){b||Wa();return!0};g.aa=function(){return!0};
|
||||
function Xa(a,b,c,d){if(a.u[b]){void 0===c&&(a.i.error=!0,a.L("Value for "+b+" is invalid"),D(a.a));var e=a.D&&a.D.b||8;c=!a.a.i.X||a.i.nb?8==e?ia(c,d):ja(c,d):"--------".substr(0,d||4);a.u[b].textContent!=c&&(a.u[b].textContent=c)}}function Ya(a,b,c,d){for(var e=0;e<d;e++){var f=a.u[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
|
||||
g.da=function(a){if(this.b&&(a||!this.a.i.X||this.i.nb)){for(a=0;a<this.a.f.length;a++)Xa(this,"R"+a,this.a.f[a]);a=Za(this.a);Xa(this,"PS",a);Xa(this,"NF",a&8?1:0,1);Xa(this,"ZF",a&4?1:0,1);Xa(this,"VF",a&2?1:0,1);Xa(this,"CF",a&1?1:0,1);Ya(this,"D",this.a.f[0],16);Ya(this,"A",this.a.f[7],22)}};function Wa(){for(var a=!1,b=B(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=y(d),f=Qa(e.id);f||(a=!0,f=new Va(e));A(f,d);a&&C(f)}}r(Wa);
|
||||
function $a(a,b,c){u.call(this,"Bus",a,$a);this.a=b;this.D=c;this.H=a.busWidth||16;this.o=0;this.G=[];this.w=null;this.B=Math.pow(2,this.H);this.h=this.B-1|0;this.c=E;this.j=Math.log2(this.c);this.C=this.c>>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<this.v;b++)this.b[b]=a;C(this)}w($a);var E=8192,fb=E-1;
|
||||
function ab(a,b){var c=-1,d=this.controller,e=d.ma[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>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.o)-E,ib(a,c,E,a.G),a.o=0);b&&(a.o=b,c=(1<<b)-E,a.G=jb(a,c,E),a.w?ib(a,c,E,a.w):(kb(a,c,E,lb,a),a.w=jb(a,c,E)))}}
|
||||
$a.prototype.reset=function(){for(var a=0;a<this.s.length;a++)this.s[a]();hb(this,16)};function gb(a,b){a.l||G(a.a,4,b);return 0}$a.prototype.ba=function(a,b){b||this.reset();return!0};
|
||||
function kb(a,b,c,d,e){for(var f=b,h=c,l=f>>>a.j;0<h&&l<a.b.length;){var n=a.b[l],q=l*a.c,t=a.c-(f-q);t>h&&(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<z&&(z=10):z=c&-65536?10:5;if(null==c||isNaN(c))for(;0<z--;)e="?"+e;else for(;0<z--;)e=String.fromCharCode(c%10+48)+e,c/=
|
||||
10;a.status(e+"Kb "+nb[d]+" at "+ia(b));return!0}return mb(2,b,c)}function jb(a,b,c){var d=[];for(b>>>=a.j;0<c&&b<a.b.length;)d.push(a.b[b++]),c-=a.c;return d}function ib(a,b,c,d){var e=0;for(b>>>=a.j;0<c&&b<a.b.length;){var f=d[e++];if(!f)break;a.b[b++]=f;c-=a.c}}function ob(a,b){return a.b[(b&a.h)>>>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;d<a.v;d++){var e=a.b[d];if(e.na||e.Db){c[b++]=d;var f=b++;if(e=e.save()){for(var h=0,l=0,n=[];h<e.length;){for(var q=e[h],t=h+1;t<e.length&&e[t]===q;)t++;n[l++]=t-h;n[l++]=q;h=t}n.length<e.length&&(e=n)}c[f]=e}}return c}function sb(a,b,c,d,e,f,h,l){for(;b<=c;b+=2){var n=b&fb;void 0!==a.ma[n]?m("I/O address already registered: "+ja(b,8,!0)):a.ma[n]=[d,e,f,h,l||"unknown",!1]}}
|
||||
function tb(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.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<a.length;b++){var c,d=a[b];c=y(d);switch(c.type){case "default":c=new I(c);A(c,d);break;case "pc11":c=new L(c),A(c,d)}}});var Cb;
|
||||
if(Ua){var Db=new ArrayBuffer(2);(new DataView(Db)).setUint16(0,256,!0);Cb=256===(new Uint16Array(Db))[0]}else Cb=!1;var Eb=Cb;
|
||||
function F(a,b,c,d,e,f){this.j=a;this.id=Fb+=2;this.a=null;this.xa=b;this.Xa=c;this.size=d||0;this.type=e||Gb;this.g=e==Hb;this.controller=null;eb(this);this.na=this.Db=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],Ib(this,f.Cb);else if(Ua)this.c=new ArrayBuffer(this.size),this.u=new DataView(this.c,0,this.size),this.b=new Uint8Array(this.c,0,this.size),this.s=new Uint16Array(this.c,0,this.size>>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<a.length;f++)a[f]=0;Ib(this,Lb)}else Ib(this)}var Gb=0,Hb=2,lb=4,nb=["NONE","RAM","ROM","VID","H/W"],Fb=0;
|
||||
F.prototype={constructor:F,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ua)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.u.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Ua)for(b=0;b<a.length;b++)this.u.setInt32(b<<2,a[b],!0);else this.a=a;return this.na=!0}return!1},v:function(a,b){H(this.j,b);return 255},h:function(a,b,c){H(this.j,c)},w:function(a,b){return this.fb(a++,b++)|this.fb(a,
|
||||
b)<<8},B:function(a,b,c){this.lb(a++,b&255,c++);this.lb(a,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<<a)|b<<a;this.na=!0},va:function(a,b,c){a&1&&H(this.j,c);c=a>>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<<a)|b<<a:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|b>>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;b<Rb.length;b++)(c=this.u[Rb[b]])&&this.o.Y(null,Rb[b],c);a=Sb(a,"autoStart");null!=a&&(this.i.Fa="true"==a?!0:"false"==a?!1:!!a);C(this)};g.reset=function(){};g.save=function(){return null};g.restore=function(){return!1};g.ba=function(a,b){if(!b){if(a&&this.restore){Tb(this);if(!this.restore(a))return!1;Ub(this)}else this.reset();this.R("No debugger detected")}this.o.da();return!0};g.aa=function(a){return a?this.save():!0};
|
||||
g.Fa=function(){return this.i.Fa||void 0===this.u.run?(Vb(this),!0):!1};g.pb=function(){return 0};function Ub(a){void 0===a.Ra&&(a.Ra=0);void 0===a.ua&&(a.ua=-1);void 0===a.va&&(a.va=-1);a.i.Sa=0<=a.Ra&&0<a.ua;a.i.Sa&&(a.Qa=0,a.ka=a.Ra-a.M)}
|
||||
g.Y=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.u[b]=c,!0;case "run":return this.u[b]=c,c.onclick=function(){var a;if(a=d.o)if(a=d.o,a.i.O)a=!0;else{var b=null,c,l=x(a.id);for(c=0;c<l.length&&(b=l[c],b===a||b.i.ready);c++);if(c==l.length)for(c=0;c<l.length&&(b=l[c],b===a||b.i.O);c++);c==l.length&&(b=a);m("The "+b.type+" component ("+b.id+") is not "+(b.i.ready?"powered yet":"ready yet"+(b.Va?" (waiting for notification)":""))+".");a=!1}a&&(d.i.X?D(d):Vb(d))},!0;case "speed":return this.u[b]=
|
||||
c,!0;case "setSpeed":return this.u[b]=c,c.onclick=function(){Wb(d,d.ga<<1,!0)},c.textContent=this.ia.toFixed(2)+"Mhz",!0}return!1};g.da=function(){var a=this.u.speed;a&&(a.textContent=this.i.X&&this.ea?this.ea.toFixed(2)+"Mhz":"Stopped")};function Xb(a,b){var c=1;b&&1<a.ga&&a.ea&&(c=a.ea/a.ab);a.tb=Math.round(1E3/30);a.Ua=Math.floor(a.Ta/30*c);b||(a.Da=a.Ua);a.cb=0}function Yb(a){return a.M+a.W+a.ja-a.a}function Tb(a){a.ea=0;a.ub=0;a.M=a.W=a.ja=a.a=a.G=0;Ub(a);Wb(a,1)}
|
||||
function Wb(a,b,c){if(void 0!==b){.8>a.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&&b<a.H.length&&0>a.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.ea<this.ia)-1E3>d&&(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<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.C){for(var f=0,h=Array(b.C),l=0;l<e.length-1;)for(var n=e[l++],q=e[l++];n--;)h[f++]=q;e=h}f=b.b[d];if(!f||!f.restore(e)){m("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function O(a){return a.l&65536?1:0}
|
||||
g.oa=function(){return this.s&32768?8:0};function fc(a){var b=a.f[7];a.w&57344||(a.qa=0,a.hb=b);a.f[7]=b+2&65535;return a.S(b)}function gc(a,b){var c=a.f[7];a.f[7]=c+b&65535;return c}function M(a,b){a.f[7]=b&65535}function yb(a,b){return{wc:a,ya:b,next:null}}function wb(a,b){if(b!=a.N){var c=a.N;if(!c||c.ya<=b.ya)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.ya<=b.ya){b.next=d;c.next=b;break}c=d}while(c)}}a.m|=2}function Za(a){return a.A=a.A&63728|a.oa()|(a.h&65535?0:4)|(a.g&32768?2:0)|O(a)}
|
||||
function Bb(a,b){a.s=b<<12;a.h=~b&4;a.g=b<<14;a.l=b<<16;if((b^a.A)&2048)for(var c=a.wa.length;0<=--c;){var d=a.f[c];a.f[c]=a.wa[c];a.wa[c]=d}a.v=b>>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(f<a.Oa)f&1&&!(c&1)&&(a.I|=64,G(a,4,10));else if(a.ra&16||253952<=f&&(f|=4186112),4186112>f){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<f)||(a.w|=4096,a.w&512&&(a.m|=32)));return f}function nc(a,b,c){b&1&&a.a--;a=a.j;a.b[(b&a.h)>>>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&&4<c&&(c<=a.sa-32?(a.I|=4,a.f[6]=4,G(a,4,18)):(a.I|=8,a.m|=4));a.Ya(c,b)}
|
||||
function oc(a,b,c,d){var e,f,h=d&8?0:a.P;switch(b){case 0:return G(a,4,20),0;case 1:return 6===c&&!a.v&&d&4&&(a.f[6]<=a.sa||65534<=a.f[6])&&(a.f[6]<=a.sa-32||65534<=a.f[6]?(a.I|=4,a.f[6]=4,G(a,4,22)):(a.I|=8,a.m|=64)),a.a-=3,7===c?a.f[c]:a.f[c]|h;case 2:f=2;e=a.f[c];7!==c&&(e|=h,6>c&&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<this.a);return this.i.complete?this.ja-this.a:void 0===this.i.complete?0:-1};r(function(){for(var a=B(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new $b(d);A(d,c)}});function xc(a,b){var c=b+a;hc(this,c,a,b);return c&65535}function yc(a,b){var c=b+a;hc(this,c<<8,a<<8,b<<8);return c&255}function zc(a,b){a=b<<1;R(this,a);return a&65535}
|
||||
function Ac(a,b){a=b<<1;R(this,a<<8);return a&255}function Bc(a,b){a=b&32768|b>>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&&(b=16),this.l=c<<17-b,c>>=b;else if(b)if(16<b)this.g=c,c=0;else{this.l=c<<=b;var d=c>>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&&(b=32);var d=c>>b-1;this.l=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.l=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.g=32768)):d=c;this.f[a]=d>>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<b?65536:0);this.a-=23}function Kd(){this.a-=5}function Ld(){this.A&49152||(dc(this),this.j.reset());this.a-=667}function Md(){kc(this);this.m|=this.A&16;this.a-=13}
|
||||
function Nd(a){if(a&8)G(this,8,6);else{var b=lc(this);a&=7;7==a?M(this,b):(M(this,this.f[a]),this.f[a]=b);this.a-=9}}function X(a){a&1&&(this.l=65536);a&2&&(this.g=32768);a&4&&(this.h=0);a&8&&(this.s=32768);this.a-=5}function Od(a){var b=(a&448)>>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.b.length;c++)a.j.Ja(b+c,a.b[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.h?b.push(a.h):null!=a.h&&a.h.length&&(b=a.h);for(c=0;c<b.length;c++){var d=a,e=b[c],f=jb(d.j,d.o,d.c);ib(d.j,e,d.c,f)}delete a.b}}}C(a)}}
|
||||
r(function(){for(var a=B(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new we(d);A(d,c)}});
|
||||
function ye(a){u.call(this,"RAM",a,ye);this.T=this.c=null;this.g=a.addr;this.o=a.size;this.$=a.load;this.Z=a.exec;this.h=!1;this.b=a.file;this.l=ka(this.b);if(this.b){a=this.b;var b=la(this.l);"json"!=b&&"hex"!=b&&(a=na()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;k(a,null,!0,function(a,b,f){f?c.L("Unable to load RAM resource (error "+f+": "+a+")"):(Pa(c.ta,a,b),(a=ua(a,b))?(c.c=a.K,c.T=a.T,null==c.$&&(c.$=a.$),null==c.Z&&(c.Z=a.Z)):c.b=null,ze(c))})}}w(ye);
|
||||
ye.prototype.ha=function(a,b,c,d){this.j=b;this.a=c;this.D=d;ze(this)};ye.prototype.ba=function(){this.T&&(this.D&&this.D.a(this.id,this.g,this.o,this.T),delete this.T);return!0};ye.prototype.aa=function(){return!0};function ze(a){if(a.j&&(!a.h&&a.o&&kb(a.j,a.g,a.o,1)&&(a.h=!0),!Ta(a))){if(!a.h)m("No RAM allocated");else if(a.b){if(!a.c||!a.j)return;Ae(a,a.c,a.$,a.Z,a.g)}C(a)}}
|
||||
ye.prototype.reset=function(){if(this.h){for(var a=this.j,b=this.g,c=this.o,d=b&a.g,b=b>>>a.j;0<c&&b<a.b.length;){var e=a.b[b],f=c,h,d=d||0;void 0===f&&(f=e.size);if(Ua)for(h=d;f--&&h<e.b.length;h++)e.b[h]=0;else for(h=d;f--&&h<e.size;h++)e.mb(d,0,e.xa+d);c-=a.c;b++;d=0}this.c&&Ae(this,this.c,this.$,this.Z,this.g,!0)}};
|
||||
function Ae(a,b,c,d,e,f){var h=!1;if(null==c)for(var l=0;l<b.length-1;){var n=b[l]&255|(b[l+1]&255)<<8;if(n)if(n&255){if(1!=n)break;if(l+6>=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<q&&l<b.length;)n+=b[l++]&255,q--;if(q||l>=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.length;e++)a.a.Ja(c+
|
||||
e,b[e]);null!=d&&ec(a.a,d,f);h=!0}return h}r(function(){for(var a=B(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new ye(d);A(d,c)}});function Be(a){u.call(this,"Keyboard",a,Be);C(this)}w(Be);Be.prototype.Y=function(){return!1};Be.prototype.ha=function(a,b,c,d){this.o=a;this.a=c;this.D=d};r(function(){for(var a=B(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=y(c),d=new Be(d);A(d,c)}});
|
||||
function Z(a){this.C=a.baudReceive||9600;this.H=a.baudTransmit||9600;this.P=a.upperCase;this.g=this.l=null;this.J=a.tabSize;this.G=a.charBOL;this.s=0;u.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.l="";else{var c;a=Ce;b&&(void 0===c&&(c="Panel"),(c=Sa(c,this.id))&&(b=c.u[b])&&this.Y(null,a,b))}this.v=this.B=null;this.exports={connect:this.qb,receiveData:this.gb}}w(Z);var Ce="buffer";g=Z.prototype;
|
||||
g.Y=function(a,b,c){var d=this;switch(b){case Ce:return this.u[b]=this.g=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.gb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.gb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
|
||||
g.ha=function(a,b,c,d){this.o=a;this.j=b;this.a=c;this.D=d;var e=this;this.V=yb(48,4);this.M=vb(this.a,function(){e.b&128||!e.h.length||(e.w=e.h.shift()&255,e.P&&97<=e.w&&122>e.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<a.length;b++)this.h.push(a.charCodeAt(b));else this.h=this.h.concat(a);xb(this.a,this.M,1E3/Math.round(this.C/10));return!0};g.ec=function(){return this.b&65534};
|
||||
g.Rc=function(a){this.b=this.b&-112|a&111};g.dc=function(){this.b&=-129;0<this.h.length&&xb(this.a,this.M,1E3/Math.round(this.C/10));return this.w};g.Qc=function(){};g.sc=function(){return this.c};g.ed=function(a){128==(this.c&192)&&a&64&&xb(this.a,this.N,1E3/Math.round(this.H/10));this.c=this.c&-70|a&69};g.rc=function(){return 0};
|
||||
g.dd=function(a){if(a&=255){this.B&&this.B.call(this.v,a);if(this.g)if(13==a)this.s=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.s&&this.s--;else{var b;b=(b=ra[a])?"<"+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<a.length;b++){var c=a[b],d=y(c),d=new Z(d);A(d,c)}});
|
||||
function L(a){u.call(this,"PC11",a,L);this.c=a.autoMount||null;this.l=0;this.N=a.baudReceive||3600;this.w=this.B=this.b=0;this.v=[];this.s=Ge;this.g=He;this.C=this.h="";this.K=this.$=this.Z=null;this.H=-1;this.G=!Aa("Mobi")&&window&&"FileReader"in window}w(L);var Ge="",He=0;g=L.prototype;
|
||||
g.Y=function(a,b,c){var d=this,e=He;switch(b){case "listTapes":return this.u[b]=c,c.onchange=function(){var a=d.u.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(n){m("PC11 option error: "+n.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");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.w<e.v.length&&(e.B=e.v[e.w++]&255,Ke(e,e.w/e.v.length*100),e.b|=128,e.b&=-2049,e.b&64&&wb(e.a,e.M))});tb(b,this,Le);Me(this,"None",Ge,!0);this.G&&Me(this,"Local Tape","?");
|
||||
Me(this,"Remote Tape","??");Ne(this)||C(this)};g.ba=function(a,b){if(!b)if(!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(){this.b&=-2241;this.B=0};function Ne(a){a.l=0;if(a.c){var b=a.c.path||"",c;if(!(c=a.c.name))a:{if((c=a.u.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=ka(b,!0)}b&&c?Oe(a,c,b,1,!0):Pe(a)}return!!a.l}
|
||||
function Ie(a,b,c,d,e){if(c)if("?"==c)a.L('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=ka(c);a.status("Attempting to load "+c+' as "'+b+'"');a.s="??"}else a.s=c;Oe(a,b,c,d,!1,e)}else Qe(a,!1)}function Oe(a,b,c,d,e,f){var h=-1;if(a.h.toLowerCase()!=c.toLowerCase()||a.g!=d)h++,Qe(a,!0),a.i.Za?a.L("PC11 busy"):(e&&a.l++,Re(a,b,c,d,f)?h++:a.i.Za=!0);h&&Se(a,a.C,a.h,a.g,a.K,a.$,a.Z)}
|
||||
function Re(a,b,c,d,e){var f=c;if(e){var h=new FileReader;h.onload=function(){var e=h.result;e&&(e=new Uint8Array(e,0,e.byteLength),Se(a,b,c,d,e),a.s="?");Pe(a)};h.readAsArrayBuffer(e);return!0}0>c.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<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}function Pe(a){var b=a.u.listTapes;if(b&&b.options){a=a.s||a.h;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}
|
||||
function Ke(a,b){b|=0;if(b!==a.H){var c=a.u.readProgress;c&&(c=(c=B(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.H=b}}function Se(a,b,c,d,e,f,h){a.C=b;a.h=c;a.g=d;a.K=e;a.$=f;a.Z=h;2==d?a.J&&Ae(a.J,e,f,h)?a.status("tape loaded: "+b):(a.C="",a.h="",a.s=Ge,a.g=He,a.L("No load address available for tape: "+b)):(a.w=0,a.v=e,a.status("tape attached: "+b),Ke(a,0))}
|
||||
function Qe(a,b){if(a.h||!1===b)a.C="",a.h="",b||(a.g&&a.status(1==a.g?"tape detached":"tape unloaded"),a.s=Ge,a.g=He,Pe(a))}g.save=function(){return(new N(this)).data()};g.restore=function(){return!0};g.Yb=function(){return this.b&65534};g.Kc=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&wb(this.a,this.M)):(this.b&=-129,this.b|=2048,this.B=0,xb(this.a,this.P,1E3/Math.round(this.N/10))));this.b=this.b&-66|a&65};g.Xb=function(){this.b&=-129;this.b|=2048;return this.B};g.Jc=function(){};
|
||||
var Te={},Le=(Te[65384]=[null,null,L.prototype.Yb,L.prototype.Kc,"PRS"],Te[65386]=[null,null,L.prototype.Xb,L.prototype.Jc,"PRB"],Te);
|
||||
function Ue(a,b,c){u.call(this,"Computer",a,Ue);this.i.O=!1;Ve(this,b);this.B=Sb(this,"autoPower",a);this.g=0;this.M=a.busWidth||a.buswidth;this.b=We;this.v=null;this.l=this.H=!1;this.N=Sb(this,"url")||"";(Math.random()+.1).toString(36);this.c=Xe(this);if(this.a=Sa("CPU",this.id)){this.D=Sa("Debugger",this.id);this.j=new $a({id:this.ta+".bus",busWidth:this.M},this.a,this.D);var d,e=x(this.id);if((this.h=Sa("Panel",this.id))&&this.h.Ga)for(b=0;b<e.length;b++)d=e[b],d.L=this.h.L,d.R=this.h.R,d.Ga=this.h.Ga;
|
||||
this.R("PDPjs v1.30.2\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.R("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.ha&&d.ha(this,this.j,this.a,this.D);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.b=parseInt(d,10));var f;if(a=Sb(this,"state")||(f=!0,a.state))b=this.C=a,f||(this.l=!0,this.b=We),this.b&&(this.w=new N(this,
|
||||
"1.30.2"),Ye(this.w)?b=null:delete this.w);!b&&this.b&&(b=Ze(this))&&(this.l=!0);if(b){var h=this;k(b,null,!0,function(a,b,c){c?(h.s=null,h.l=!1,h.L("Unable to load machine state from server (error "+c+(b?": "+qa(b):"")+")")):(h.v=b,h.H=!0);C(h)})}else C(this);this.u.power||(this.B=!0);!c&&this.B&&$e(this,this.Ia)}else m("Unable to find CPU component")}w(Ue);var We=0;
|
||||
function Ve(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){m(d.message+" ("+c+")")}}a.J=b}function Sb(a,b,c){var d=b.toLowerCase(),d=Ja[b]||Ja[d];void 0===d&&a.J&&(d=a.J[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function $e(a,b,c){for(var d=x(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ta(f)){Ta(f,function(){$e(a,b,c)});return}}b.call(a,c)}
|
||||
function af(a,b){var c=new N(a,"1.30.2","validate");if(Ye(c)&&bf(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.L("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}g=Ue.prototype;
|
||||
g.Ia=function(a){void 0===a&&(a=this.b||(this.v?1:We));if(!this.g){this.g++;var b=!1,c=!1;this.G=!1;var d=this.w||new N(this,"1.30.2");if(-1==a)b=!0;else if(a>We){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;f<e.length;f++)h=e[f],h!==this&&h!=this.a&&(c=ff(this,h,d,b,c));b=[d,a,c];-1!=a?$e(this,this.ob,b):this.ob(b)}};
|
||||
function ff(a,b,c,d,e){if(!b.i.O){b.i.O=!0;if(b.ba){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ba(f,d)&&f&&(m("Unable to restore state for "+b.type),a.C&&!a.H?(c.clear(),a.b=We,window&&window.location.reload()):a.G=!0,b.ba(null),e=!1)}if(!d&&b.sb)for(a=b.sb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
g.ob=function(a){var b=a[0],c=0>a[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;n<l.length;n++){var q=l[n];q.i.O&&(q.aa&&(d=q.aa(b,c),"object"===typeof d&&f.set(q.id,
|
||||
d)),c&&(q.i.O=!1,!1===d&&(e=null)))}e&&(c?(l=d=!1,b?(a.c&&hf(a,a.c,f.toString()),ef(h)&&ef(f)||(e=null,d=l=!0)):a.b&&(d=!0,l=3==a.b),d&&f.clear(l)):e=f.toString());c&&(a.i.O=!1,b=a.u.power)&&(b.textContent="Power");a.g=0;return e}g.reset=function(){this.j&&this.j.reset&&this.j.reset();for(var a=x(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.j&&c.reset&&c.reset()}};g.start=function(a,b){for(var c=x(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.da(!0)};
|
||||
g.stop=function(a,b){for(var c=x(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.da(!0)};
|
||||
g.Y=function(a,b,c){var d=this;switch(b){case "power":return this.u[b]=c,c.onclick=function(){d.g||(d.i.O?gf(d,!1,!0):$e(d,d.Ia))},!0;case "reset":return this.u[b]=c,c.onclick=function(){if(d.i.O&&!d.g)if(d.b&&!d.s){var a=va("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");gf(d,a,!0);!a&&d.C?window&&window.location.reload():d.Ia(We)}else d.reset(),d.a&&d.a.Fa()},!0;case "save":if(ma())c.parentNode.removeChild(c);else return this.u[b]=
|
||||
c,c.onclick=function(){var a=Xe(d,!0);if(a){var b=!!(d.b&&!d.s||d.C),c=gf(d,b);b?hf(d,a,c):d.L("Resume disabled, machine state not saved")}},!0}return!1};
|
||||
function Xe(a,b){var c=a.c;c||((c=ya("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=jf(a,c))||a.L("The user ID is invalid.")):b&&a.L("Browser local storage is not available"));return c}
|
||||
function jf(a,b){a.c=null;b=k(na()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(za("user",b.data),a.c=b.data)}catch(d){m(d.message+" ("+c+")")}return a.c}function Ze(a){var b=null;a.c&&(b=na()+"/api/v1/user?req=load&user="+a.c+"&state="+kf(a,"1.30.2"));return b}
|
||||
function hf(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=kf(a,"1.30.2");d.data=c;b=k(na()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.L("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.L(c),za("user",""),a.c=null)}}
|
||||
function Je(a){var b;a=x(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}g.da=function(a){this.a&&this.a.da(a);this.h&&this.h.da(a)};r(function(){for(var a=B(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=y(c),c=B(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],h=y(f),h=new Ue(h,d,!0);A(h,f);h.B&&$e(h,h.Ia)}});
|
||||
p.show.push(function(){for(var a=B(document,"pdp11","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=Sa("Computer",c.id))&&c.P&&!c.i.O&&c.Ia(-1)}});p.exit.push(function(){for(var a=B(document,"pdp11","computer"),b=0;b<a.length;b++){var c=y(a[b]);(c=Sa("Computer",c.id))&&c.i.O&&gf(c,!(!c.b||c.s),!0)}});function N(a,b,c){this.id=a.id;this.key=kf(a,b,c);this.D=a.D;df(this,a.Hb)}function kf(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
||||
N.prototype={constructor:N,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){df(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
|
||||
1);c=0}}};function df(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function ef(a){var b=!0;if(xa()){var c=JSON.stringify(a[a.id]);za(a.key,c)||(m("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function bf(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){m(c.message||c),b=!1}return b}function Ye(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:xa()&&(b=ya(a.key))?(a[a.id]=b,a.a=!0):!1}var lf=0;
|
||||
function mf(a,b,c,d,e,f){e("Loading "+a+"...");k(a,null,!0,function(h,l,n){n?(l||(l="unable to load "+a+" ("+n+")"),f(l,null)):nf(l,a,b,c,d,e,f)})}
|
||||
function nf(a,b,c,d,e,f,h){function l(a,f){if(f)h(f,null);else{c&&(Pa(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\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<a.length?a.substr(0,255)+"...":a);h(a,f)}}a?e?of(a,f,l):l(a,null):h("no data"+(b?" for file: "+b:""),null)}
|
||||
function of(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/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<d;e++){var f=a.m[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
|
||||
h.ha=function(a){if(this.b&&(a||!this.a.j.Z||this.j.Cb)){for(a=0;a<this.a.f.length;a++)Xa(this,"R"+a,this.a.f[a]);a=Za(this.a);Xa(this,"PS",a);Xa(this,"NF",a&8?1:0,1);Xa(this,"ZF",a&4?1:0,1);Xa(this,"VF",a&2?1:0,1);Xa(this,"CF",a&1?1:0,1);Ya(this,"D",this.a.f[0],16);Ya(this,"A",this.a.f[7],22)}};function Wa(){for(var a=!1,b=E(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=C(d),f=Ra(e.id);f||(a=!0,f=new Va(e));D(f,d);a&&G(f)}}x(Wa);
|
||||
function $a(a,b,c){y.call(this,"Bus",a,$a);this.a=b;this.D=c;this.I=a.busWidth||16;this.h=0;this.G=[];this.w=null;this.B=Math.pow(2,this.I);this.g=this.B-1|0;this.c=I;this.l=Math.log2(this.c);this.F=this.c>>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<this.v;b++)this.b[b]=a;G(this)}A($a);var I=8192,fb=I-1;
|
||||
function ab(a,b){var c=-1,d=this.controller,e=d.ta[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>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.h)-I,ib(a,c,I,a.G),a.h=0);b&&(a.h=b,c=(1<<b)-I,a.G=jb(a,c,I),a.w?ib(a,c,I,a.w):(kb(a,c,I,lb,a),a.w=jb(a,c,I)))}}
|
||||
$a.prototype.reset=function(){for(var a=0;a<this.u.length;a++)this.u[a]();hb(this,16)};function gb(a,b){a.o||K(a.a,4,b);return 0}$a.prototype.ea=function(a,b){b||this.reset();return!0};
|
||||
function kb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.l;0<g&&k<a.b.length;){var m=a.b[k],p=k*a.c,t=a.c-(f-p);t>g&&(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<w&&(w=10):w=c&-65536?10:5;if(null==c||isNaN(c))for(;0<w--;)e="?"+e;else for(;0<w--;)e=String.fromCharCode(c%10+48)+e,c/=
|
||||
10;a.status(e+"Kb "+nb[d]+" at "+ka(b));return!0}return mb(2,b,c)}function jb(a,b,c){var d=[];for(b>>>=a.l;0<c&&b<a.b.length;)d.push(a.b[b++]),c-=a.c;return d}function ib(a,b,c,d){var e=0;for(b>>>=a.l;0<c&&b<a.b.length;){var f=d[e++];if(!f)break;a.b[b++]=f;c-=a.c}}function ob(a,b){return a.b[(b&a.g)>>>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;d<a.v;d++){var e=a.b[d];if(e.na||e.Yb){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,k=0,m=[];g<e.length;){for(var p=e[g],t=g+1;t<e.length&&e[t]===p;)t++;m[k++]=t-g;m[k++]=p;g=t}m.length<e.length&&(e=m)}c[f]=e}}return c}function sb(a,b,c,d,e,f,g,k){for(;b<=c;b+=2){var m=b&fb;void 0!==a.ta[m]?r("I/O address already registered: "+l(b,8,!0)):a.ta[m]=[d,e,f,g,k||"unknown",!1]}}
|
||||
function tb(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.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<a.length;b++){var c,d=a[b];c=C(d);switch(c.type){case "default":c=new L(c);D(c,d);break;case "pc11":c=new Db(c);D(c,d);break;case "rl11":c=new Eb(c),D(c,d)}}});var Fb;if(Ua){var Gb=new ArrayBuffer(2);(new DataView(Gb)).setUint16(0,256,!0);Fb=256===(new Uint16Array(Gb))[0]}else Fb=!1;var Hb=Fb;
|
||||
function J(a,b,c,d,e,f){this.l=a;this.id=Ib+=2;this.a=null;this.Da=b;this.hb=c;this.size=d||0;this.type=e||Jb;this.i=e==Kb;this.controller=null;eb(this);this.na=this.Yb=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],Lb(this,f.Ub);else if(Ua)this.m=new ArrayBuffer(this.size),this.c=new DataView(this.m,0,this.size),this.b=new Uint8Array(this.m,0,this.size),this.u=new Uint16Array(this.m,0,this.size>>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<a.length;f++)a[f]=0;Lb(this,Ob)}else Lb(this)}var Jb=0,Kb=2,lb=4,nb=["NONE","RAM","ROM","VID","H/W"],Ib=0;
|
||||
J.prototype={constructor:J,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ua)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.c.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Ua)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.na=!0}return!1},v:function(a,b){vb(this.l,b);return 255},g:function(a,b,c){vb(this.l,c)},w:function(a,b){return this.tb(a++,b++)|this.tb(a,
|
||||
b)<<8},B:function(a,b,c){this.zb(a++,b&255,c++);this.zb(a,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<<a)|b<<a;this.na=!0},Ba:function(a,b,c){a&1&&vb(this.l,c);c=a>>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<<a)|b<<a:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|b>>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;b<Ub.length;b++)(c=this.m[Ub[b]])&&this.i.V(null,Ub[b],c);a=Vb(a,"autoStart");null!=a&&(this.j.Ma="true"==a?!0:"false"==a?!1:!!a);G(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.ea=function(a,b){if(!b){if(a&&this.restore){Yb(this);if(!this.restore(a))return!1;Zb(this)}else this.reset();this.R("No debugger detected")}this.i.ha();return!0};h.da=function(a){return a?this.save():!0};
|
||||
h.Ma=function(){return this.j.Ma||void 0===this.m.run?($b(this),!0):!1};h.Fb=function(){return 0};function Zb(a){void 0===a.Ya&&(a.Ya=0);void 0===a.Ba&&(a.Ba=-1);void 0===a.Ja&&(a.Ja=-1);a.j.Za=0<=a.Ya&&0<a.Ba;a.j.Za&&(a.Wa=0,a.ra=a.Ya-a.M)}
|
||||
h.V=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.m[b]=c,!0;case "run":return this.m[b]=c,c.onclick=function(){var a;if(a=d.i)if(a=d.i,a.j.O)a=!0;else{var b=null,c,k=B(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.j.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.j.O);c++);c==k.length&&(b=a);r("The "+b.type+" component ("+b.id+") is not "+(b.j.ready?"powered yet":"ready yet"+(b.eb?" (waiting for notification)":""))+".");a=!1}a&&(d.j.Z?H(d):$b(d))},!0;case "speed":return this.m[b]=
|
||||
c,!0;case "setSpeed":return this.m[b]=c,c.onclick=function(){ac(d,d.la<<1,!0)},c.textContent=this.pa.toFixed(2)+"Mhz",!0}return!1};h.ha=function(){var a=this.m.speed;a&&(a.textContent=this.j.Z&&this.ja?this.ja.toFixed(2)+"Mhz":"Stopped")};function bc(a,b){var c=1;b&&1<a.la&&a.ja&&(c=a.ja/a.ob);a.Jb=Math.round(1E3/30);a.bb=Math.floor(a.$a/30*c);b||(a.Ka=a.bb);a.rb=0}function cc(a){return a.M+a.X+a.qa-a.a}function Yb(a){a.ja=0;a.Lb=0;a.M=a.X=a.qa=a.a=a.G=0;Zb(a);ac(a,1)}
|
||||
function ac(a,b,c){if(void 0!==b){.8>a.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&&b<a.I.length&&0>a.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.ja<this.pa)-1E3>d&&(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<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.F){for(var f=0,g=Array(b.F),k=0;k<e.length-1;)for(var m=e[k++],p=e[k++];m--;)g[f++]=p;e=g}f=b.b[d];if(!f||!f.restore(e)){r("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Q(a){return a.o&65536?1:0}
|
||||
h.ua=function(){return this.u&32768?8:0};function lc(a){var b=a.f[7];a.w&57344||(a.wa=0,a.vb=b);a.f[7]=b+2&65535;return a.S(b)}function mc(a,b){var c=a.f[7];a.f[7]=c+b&65535;return c}function O(a,b){a.f[7]=b&65535}function zb(a,b){return{Rc:a,Ea:b,next:null}}function xb(a,b){if(b!=a.N){var c=a.N;if(!c||c.Ea<=b.Ea)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.Ea<=b.Ea){b.next=d;c.next=b;break}c=d}while(c)}}a.s|=2}function Za(a){return a.A=a.A&63728|a.ua()|(a.h&65535?0:4)|(a.g&32768?2:0)|Q(a)}
|
||||
function Cb(a,b){a.u=b<<12;a.h=~b&4;a.g=b<<14;a.o=b<<16;if((b^a.A)&2048)for(var c=a.Ca.length;0<=--c;){var d=a.f[c];a.f[c]=a.Ca[c];a.Ca[c]=d}a.v=b>>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(f<a.Ua)f&1&&!(c&1)&&(a.J|=64,K(a,4,10));else if(a.xa&16||253952<=f&&(f|=4186112),4186112>f){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<f)||(a.w|=4096,a.w&512&&(a.s|=32)));return f}function vc(a,b,c){b&1&&a.a--;a=a.l;a.b[(b&a.g)>>>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&&4<c&&(c<=a.ya-32?(a.J|=4,a.f[6]=4,K(a,4,18)):(a.J|=8,a.s|=4));a.ib(c,b)}
|
||||
function wc(a,b,c,d){var e,f,g=d&8?0:a.P;switch(b){case 0:return K(a,4,20),0;case 1:return 6===c&&!a.v&&d&4&&(a.f[6]<=a.ya||65534<=a.f[6])&&(a.f[6]<=a.ya-32||65534<=a.f[6]?(a.J|=4,a.f[6]=4,K(a,4,22)):(a.J|=8,a.s|=64)),a.a-=3,7===c?a.f[c]:a.f[c]|g;case 2:f=2;e=a.f[c];7!==c&&(e|=g,6>c&&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<this.a);return this.j.complete?this.qa-this.a:void 0===this.j.complete?0:-1};x(function(){for(var a=E(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new fc(d);D(d,c)}});function Gc(a,b){var c=b+a;oc(this,c,a,b);return c&65535}function Hc(a,b){var c=b+a;oc(this,c<<8,a<<8,b<<8);return c&255}function Ic(a,b){a=b<<1;pc(this,a);return a&65535}
|
||||
function Jc(a,b){a=b<<1;pc(this,a<<8);return a&255}function Kc(a,b){a=b&32768|b>>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&&(b=16),this.o=c<<17-b,c>>=b;else if(b)if(16<b)this.g=c,c=0;else{this.o=c<<=b;var d=c>>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&&(b=32);var d=c>>b-1;this.o=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.o=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.g=32768)):d=c;this.f[a]=d>>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<b?65536:0);this.a-=23}function Td(){this.a-=5}function Ud(){this.A&49152||(jc(this),this.l.reset());this.a-=667}function Vd(){sc(this);this.s|=this.A&16;this.a-=13}
|
||||
function Wd(a){if(a&8)K(this,8,6);else{var b=tc(this);a&=7;7==a?O(this,b):(O(this,this.f[a]),this.f[a]=b);this.a-=9}}function X(a){a&1&&(this.o=65536);a&2&&(this.g=32768);a&4&&(this.h=0);a&8&&(this.u=32768);this.a-=5}function Xd(a){var b=(a&448)>>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.b.length;c++)a.l.Qa(b+c,a.b[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.g?b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){var d=a,e=b[c],f=jb(d.l,d.h,d.c);ib(d.l,e,d.c,f)}delete a.b}}}G(a)}}
|
||||
x(function(){for(var a=E(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Fe(d);D(d,c)}});
|
||||
function He(a){y.call(this,"RAM",a,He);this.T=this.c=null;this.i=a.addr;this.h=a.size;this.aa=a.load;this.$=a.exec;this.g=!1;this.b=a.file;this.o=n(this.b);if(this.b){a=this.b;var b=la(this.o);"json"!=b&&"hex"!=b&&(a=u()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;q(a,null,!0,function(a,b,f){f?c.C("Unable to load RAM resource (error "+f+": "+a+")"):(Qa(c.ia,a,b),(a=va(a,b))?(c.c=a.L,c.T=a.T,null==c.aa&&(c.aa=a.aa),null==c.$&&(c.$=a.$)):c.b=null,Ie(c))})}}A(He);
|
||||
He.prototype.ba=function(a,b,c,d){this.l=b;this.a=c;this.D=d;Ie(this)};He.prototype.ea=function(){this.T&&(this.D&&this.D.a(this.id,this.i,this.h,this.T),delete this.T);return!0};He.prototype.da=function(){return!0};function Ie(a){if(a.l&&(!a.g&&a.h&&kb(a.l,a.i,a.h,1)&&(a.g=!0),!Ta(a))){if(!a.g)r("No RAM allocated");else if(a.b){if(!a.c||!a.l)return;Je(a,a.c,a.aa,a.$,a.i)}G(a)}}
|
||||
He.prototype.reset=function(){if(this.g){for(var a=this.l,b=this.i,c=this.h,d=b&a.i,b=b>>>a.l;0<c&&b<a.b.length;){var e=a.b[b],f=c,g,d=d||0;void 0===f&&(f=e.size);if(Ua)for(g=d;f--&&g<e.b.length;g++)e.b[g]=0;else for(g=d;f--&&g<e.size;g++)e.Ab(d,0,e.Da+d);c-=a.c;b++;d=0}this.c&&Je(this,this.c,this.aa,this.$,this.i,!0)}};
|
||||
function Je(a,b,c,d,e,f){var g=!1;if(null==c)for(var k=0;k<b.length-1;){var m=b[k]&255|(b[k+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(k+6>=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<p&&k<b.length;)m+=b[k++]&255,p--;if(p||k>=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.length;e++)a.a.Qa(c+
|
||||
e,b[e]);null!=d&&kc(a.a,d,f);g=!0}return g}x(function(){for(var a=E(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new He(d);D(d,c)}});function Ke(a){y.call(this,"Keyboard",a,Ke);G(this)}A(Ke);Ke.prototype.V=function(){return!1};Ke.prototype.ba=function(a,b,c,d){this.i=a;this.a=c;this.D=d};x(function(){for(var a=E(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Ke(d);D(d,c)}});
|
||||
function Z(a){this.F=a.baudReceive||9600;this.I=a.baudTransmit||9600;this.P=a.upperCase;this.g=this.o=null;this.K=a.tabSize;this.G=a.charBOL;this.u=0;y.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.o="";else{var c;a=Le;b&&(void 0===c&&(c="Panel"),(c=Sa(c,this.id))&&(b=c.m[b])&&this.V(null,a,b))}this.v=this.B=null;this.exports={connect:this.Gb,receiveData:this.ub}}A(Z);var Le="buffer";h=Z.prototype;
|
||||
h.V=function(a,b,c){var d=this;switch(b){case Le:return this.m[b]=this.g=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.ub(b);return!0},c.onkeypress=function(a){a=a||window.event;d.ub(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
|
||||
h.ba=function(a,b,c,d){this.i=a;this.l=b;this.a=c;this.D=d;var e=this;this.W=zb(48,4);this.M=wb(this.a,function(){e.b&128||!e.h.length||(e.w=e.h.shift()&255,e.P&&97<=e.w&&122>e.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<a.length;b++)this.h.push(a.charCodeAt(b));else this.h=this.h.concat(a);yb(this.a,this.M,1E3/Math.round(this.F/10));return!0};h.zc=function(){return this.b&65534};
|
||||
h.md=function(a){this.b=this.b&-112|a&111};h.yc=function(){this.b&=-129;0<this.h.length&&yb(this.a,this.M,1E3/Math.round(this.F/10));return this.w};h.ld=function(){};h.Nc=function(){return this.c};h.Ad=function(a){128==(this.c&192)&&a&64&&yb(this.a,this.N,1E3/Math.round(this.I/10));this.c=this.c&-70|a&69};h.Mc=function(){return 0};
|
||||
h.zd=function(a){if(a&=255){this.B&&this.B.call(this.v,a);if(this.g)if(13==a)this.u=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.u&&this.u--;else{var b;b=(b=qa[a])?"<"+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<a.length;b++){var c=a[b],d=C(c),d=new Z(d);D(d,c)}});
|
||||
function Db(a){y.call(this,"PC11",a,Db);this.c=a.autoMount||null;this.o=0;this.N=a.baudReceive||3600;this.w=this.B=this.b=0;this.v=[];this.u=Pe;this.g=Qe;this.F=this.h="";this.L=this.aa=this.$=null;this.K=-1;this.I=!Ba("Mobi")&&window&&"FileReader"in window}A(Db);var Pe="",Qe=0;h=Db.prototype;
|
||||
h.V=function(a,b,c){var d=this,e=Qe;switch(b){case "listTapes":return this.m[b]=c,c.onchange=function(){var a=d.m.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(m){r("PC11 option error: "+m.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");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.w<e.v.length&&(e.B=e.v[e.w++]&255,Te(e,e.w/e.v.length*100),e.b|=128,e.b&=-2049,e.b&64&&xb(e.a,e.G))});tb(b,this,Ue);Ve(this,"None",Pe,!0);this.I&&Ve(this,"Local Tape","?");
|
||||
Ve(this,"Remote Tape","??");We(this)||G(this)};h.ea=function(a,b){if(!b)if(!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(){this.b&=-2241;this.B=0};function We(a){a.o=0;if(a.c){var b=a.c.path||"",c;if(!(c=a.c.name))a:{if((c=a.m.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=n(b,!0)}b&&c?Xe(a,c,b,1,!0):Ye(a)}return!!a.o}
|
||||
function Re(a,b,c,d,e){if(c)if("?"==c)a.C('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=n(c);a.status("Attempting to load "+c+' as "'+b+'"');a.u="??"}else a.u=c;Xe(a,b,c,d,!1,e)}else Ze(a,!1)}function Xe(a,b,c,d,e,f){var g=-1;if(a.h.toLowerCase()!=c.toLowerCase()||a.g!=d)g++,Ze(a,!0),a.j.jb?a.C("PC11 busy"):(e&&a.o++,$e(a,b,c,d,f)?g++:a.j.jb=!0);g&&af(a,a.F,a.h,a.g,a.L,a.aa,a.$)}
|
||||
function $e(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),af(a,b,c,d,e),a.u="?");Ye(a)};g.readAsArrayBuffer(e);return!0}0>c.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<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}function Ye(a){var b=a.m.listTapes;if(b&&b.options){a=a.u||a.h;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}
|
||||
function Te(a,b){b|=0;if(b!==a.K){var c=a.m.readProgress;c&&(c=(c=E(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.K=b}}function af(a,b,c,d,e,f,g){a.F=b;a.h=c;a.g=d;a.L=e;a.aa=f;a.$=g;2==d?a.M&&Je(a.M,e,f,g)?a.status("tape loaded: "+b):(a.F="",a.h="",a.u=Pe,a.g=Qe,a.C("No load address available for tape: "+b)):(a.w=0,a.v=e,a.status("tape attached: "+b),Te(a,0))}
|
||||
function Ze(a,b){if(a.h||!1===b)a.F="",a.h="",b||(a.g&&a.status(1==a.g?"tape detached":"tape unloaded"),a.u=Pe,a.g=Qe,Ye(a))}h.save=function(){return(new P(this)).data()};h.restore=function(){return!0};h.sc=function(){return this.b&65534};h.ed=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&xb(this.a,this.G)):(this.b&=-129,this.b|=2048,this.B=0,yb(this.a,this.P,1E3/Math.round(this.N/10))));this.b=this.b&-66|a&65};h.rc=function(){this.b&=-129;this.b|=2048;return this.B};h.dd=function(){};
|
||||
var bf={},Ue=(bf[65384]=[null,null,Db.prototype.sc,Db.prototype.ed,"PRS"],bf[65386]=[null,null,Db.prototype.rc,Db.prototype.dd,"PRB"],bf);function cf(a,b,c){y.call(this,"Disk",{id:a.ia+".disk"+l(++df,4)},cf);this.controller=a;this.i=a.i;this.D=a.D;this.g=b;this.oa=b.name;this.mb=b.mb;ef(this,c,b.fa,b.ca,b.Y,b.ma);G(this)}var df=0;A(cf);cf.prototype.ba=function(a,b,c,d){this.D=d};
|
||||
function ef(a,b,c,d,e,f){a.mode=b;a.fa=c;a.ca=d;a.Y=e;a.ma=f;a.a=[];if("preload"!=a.mode){b=Array(a.fa);for(c=0;c<b.length;c++){d=Array(a.ca);for(e=0;e<d.length;e++){f=Array(a.Y);for(var g=1;g<=f.length;g++)f[g-1]=ff(null,c,e,g,a.ma,0);d[e]=f}b[c]=d}a.a=b}a.c=null}
|
||||
function gf(a,b,c,d,e){var f=c;if(a.b)return!0;a.oa=b;a.za=c;a.Qb=n(c);a.b=e;a.h=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ia[d];if(e){a.fa=e[0];a.ca=e[1];a.Y=e[2];a.ma=e[3]||512;c=a.ma>>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.fa);for(d=0;d<a.a.length;d++)for(var F=a.a[d]=Array(a.ca),R=0;R<F.length;R++)for(var ta=F[R]=Array(a.Y),ua=0;ua<ta.length;ua++){for(var Wb=ff(null,d,R,ua+1,a.ma,0),Hf=Wb.data,Xb=0;Xb<c;Xb++,f+=4)var If=Hf[Xb]=b.getInt32(f,
|
||||
!0),e=e+If&-1;Wb.Xa=c;ta[ua]=Wb}a.c=e;c=a}else a.C("Unrecognized disk format ("+d+" bytes)");a.b&&(a.b.call(a.controller,a.g,c,a.oa,a.za),a.b=null)};g.readAsArrayBuffer(d);return!0}0>c.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(0<n(a.Qb,!0).toLowerCase().indexOf("-readonly"))a.l=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.l=!0)}var k;"<"==c.substr(0,1)?k=["Missing disk image: "+a.oa]:k=0>c.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<a.fa;d++)for(f=0;f<a.ca;f++)for(g=0;g<a.Y;g++)if(m=k[d][f][g]){var p=m.length;void 0===p&&(p=m.length=512);var p=p>>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<R;ta++)F[ta]=t;jf(m,F)}else w=[],t=m.pattern=t|t<<8|t<<16|t<<24,m.data=w;delete m.bytes}ff(m,d,f);
|
||||
for(R=0;R<w.length;R++)c=c+w[R]&-1}a.a=k;a.c=c;e=a}else r("Empty disk image: "+a.oa)}catch(ua){r("Disk image error ("+b+"): "+ua.message)}}a.b&&(a.b.call(a.h,a.g,e,a.oa,a.za),a.b=null)}function ff(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.Hd=b;a.Id=c;a.fb=a.Xa=0;a.na=!1;return a}function jf(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
|
||||
function kf(a,b){var c=a.ca*a.Y,d=b/c|0;if(d<a.fa){c=b%c;b=c/a.Y|0;var c=c%a.Y+1,e=null,f=a.g,g=a.a[d];if(g){a=g[b];if(!a&&f.Vb&&b<f.ca)for(a=g[b]=Array(f.Wb),g=0;g<a.length;g++)a[g]=ff(null,d,b,g+1,f.Kb,0);if(a){for(g=0;g<a.length;g++)if(a[g]&&a[g].sector==c){e=a[g];break}!e&&f.Vb&&9==f.Bb&&(e=a[g]=ff(null,d,b,f.Bb,f.Kb,0))}}return e}return null}
|
||||
function lf(a,b){for(var c=1,d=0,e=0;c--;){var f;f=b++;var g=-1;if(a&&f<a.length)var g=a.data,k=f>>2,g=(k<g.length?g[k]:a.pattern)>>((f&3)<<3)&255;f=g;if(0>f)break;d|=f<<e;e+=8}return d}
|
||||
cf.prototype.save=function(){var a=0,b=[];b[a++]=[this.za,this.c,this.fa,this.ca,this.Y,this.ma];if(!this.l)for(var c=this.a,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Xa){for(var k=[],m=0,p=g.fb,t=g.fb+g.Xa;p<t;)k[m++]=g.data[p++];b[a++]=[d,e,f,g.fb,k]}}return b};
|
||||
cf.prototype.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.a.length&&6<=e.length?ef(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.c&&e[1]!=this.c&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.c+")",b=-2));for(this.a.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],k=g[f++],m=g[f++],p=g[f++];if(k>=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;m<e;)k.data[m++]=k.pattern;m=0;k.fb=e;for(k.Xa=f.length;e<g;)k.data[e++]=f[m++];b++}}}0>b&&-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='<a href="'+g+'" target="_blank">'+b+"</a>");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;m<p;m++)b+=String.fromCharCode(lf(k,m));b=btoa(b);a=a.Qb.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),"string"!=
|
||||
typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");r(a)}else d.C("No disk loaded in drive.");else d.C("No disk drive selected.")};return!0;case "mountDrive":if(this.h)return 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;of(d,n(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};h.ba=function(a,b,c,d){this.i=a;this.l=b;this.a=c;this.D=d;if((this.c=Vb(this.i,"autoMount")||this.c)&&"string"==typeof this.c)try{this.c=eval("("+this.c+")")}catch(e){r("RL11 auto-mount error: "+e.message+" ("+this.c+")"),this.c=null}this.G=zb(112,5);tb(b,this,pf);qf(this,"None","",!0);this.h&&qf(this,"Local Disk","?");qf(this,"Remote Disk","??");rf(this)||G(this)};
|
||||
h.ea=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.i.Eb){for(a=0;a<this.b.length;a++)sf(this,a,!0);rf(this,!0)}}else if(!this.restore(a))return!1;if(a=this.m.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;1>b;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;a<this.b.length;a++){var b=this.b[a];void 0===b&&(b=this.b[a]={});b.qb=a;b.lb=b.cb=!1;b.name=this.Aa;b.fa=512;b.ca=2;b.Y=40;b.ma=256;b.mb=!0;b.Ed=0;b.Dd=0;b.Cd=0;b.Bb=1;b.Wb=b.Y;b.Kb=b.ma;b.Jd=0;b.Kd=null;b.ab||(b.za="")}};h.save=function(){return(new P(this)).data()};h.restore=function(){return!0};
|
||||
function rf(a,b){b||(a.g=0);if(a.c)for(var c in a.c){var d=a.c[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.m.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var k=f.options[g];if(k.value==e){f=k.text;break a}}f=n(e,!0)}if(e&&f&&(g=c.charCodeAt(0)-65,0<=g&&g<a.b.length)){!tf(a,g,f,e,!0)&&b&&G(a,!1);continue}a.C("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.g}
|
||||
function of(a,b,c,d){var e=a.m.listDrives,e=e&&ja(e.value);if(void 0===e||0>e||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<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
|
||||
function nf(a,b){if(0<=b&&b<a.b.length){var c=a.b[b],d=a.m.listDisks;a=a.m.listDrives;if(d&&a&&d.options&&a.options&&(a=ja(a.value),c=c.cb?"?":c.za,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function sf(a,b,c){var d=a.b[b];if(d.ab||!1===c)d.oa="",d.za="",d.ab=null,d.cb=!1,c||(a.C("Drive RL"+b+" unloaded",c),nf(a,b))}var pf={};
|
||||
function uf(a,b,c){y.call(this,"Computer",a,uf);this.j.O=!1;vf(this,b);this.B=Vb(this,"autoPower",a);this.i=0;this.M=a.busWidth||a.buswidth;this.b=wf;this.v=null;this.o=this.I=!1;this.N=Vb(this,"url")||"";(Math.random()+.1).toString(36);this.c=xf(this);if(this.a=Sa("CPU",this.id)){this.D=Sa("Debugger",this.id);this.l=new $a({id:this.ia+".bus",busWidth:this.M},this.a,this.D);var d,e=B(this.id);if((this.g=Sa("Panel",this.id))&&this.g.Na)for(b=0;b<e.length;b++)d=e[b],d.C=this.g.C,d.R=this.g.R,d.Na=this.g.Na;
|
||||
this.R("PDPjs v1.30.2\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.R("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.ba&&d.ba(this,this.l,this.a,this.D);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.u=d:this.b=parseInt(d,10));var f;if(a=Vb(this,"state")||(f=!0,a.state))b=this.F=a,f||(this.o=!0,this.b=wf),this.b&&(this.w=new P(this,
|
||||
"1.30.2"),yf(this.w)?b=null:delete this.w);!b&&this.b&&(b=zf(this))&&(this.o=!0);if(b){var g=this;q(b,null,!0,function(a,b,c){c?(g.u=null,g.o=!1,g.C("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.v=b,g.I=!0);G(g)})}else G(this);this.m.power||(this.B=!0);!c&&this.B&&Af(this,this.Pa)}else r("Unable to find CPU component")}A(uf);var wf=0;
|
||||
function vf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){r(d.message+" ("+c+")")}}a.K=b}function Vb(a,b,c){var d=b.toLowerCase(),d=Ka[b]||Ka[d];void 0===d&&a.K&&(d=a.K[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Af(a,b,c){for(var d=B(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ta(f)){Ta(f,function(){Af(a,b,c)});return}}b.call(a,c)}
|
||||
function Bf(a,b){var c=new P(a,"1.30.2","validate");if(yf(c)&&Cf(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.C("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=uf.prototype;
|
||||
h.Pa=function(a){void 0===a&&(a=this.b||(this.v?1:wf));if(!this.i){this.i++;var b=!1,c=!1;this.G=!1;var d=this.w||new P(this,"1.30.2");if(-1==a)b=!0;else if(a>wf){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;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=Gf(this,g,d,b,c));b=[d,a,c];-1!=a?Af(this,this.Db,b):this.Db(b)}};
|
||||
function Gf(a,b,c,d,e){if(!b.j.O){b.j.O=!0;if(b.ea){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ea(f,d)&&f&&(r("Unable to restore state for "+b.type),a.F&&!a.I?(c.clear(),a.b=wf,window&&window.location.reload()):a.G=!0,b.ea(null),e=!1)}if(!d&&b.Ib)for(a=b.Ib.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
||||
h.Db=function(a){var b=a[0],c=0>a[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;m<k.length;m++){var p=k[m];p.j.O&&(p.da&&(d=p.da(b,c),"object"===typeof d&&f.set(p.id,
|
||||
d)),c&&(p.j.O=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.c&&Kf(a,a.c,f.toString()),Ff(g)&&Ff(f)||(e=null,d=k=!0)):a.b&&(d=!0,k=3==a.b),d&&f.clear(k)):e=f.toString());c&&(a.j.O=!1,b=a.m.power)&&(b.textContent="Power");a.i=0;return e}h.reset=function(){this.l&&this.l.reset&&this.l.reset();for(var a=B(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.l&&c.reset&&c.reset()}};h.start=function(a,b){for(var c=B(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.ha(!0)};
|
||||
h.stop=function(a,b){for(var c=B(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.ha(!0)};
|
||||
h.V=function(a,b,c){var d=this;switch(b){case "power":return this.m[b]=c,c.onclick=function(){d.i||(d.j.O?Jf(d,!1,!0):Af(d,d.Pa))},!0;case "reset":return this.m[b]=c,c.onclick=function(){if(d.j.O&&!d.i)if(d.b&&!d.u){var a=wa("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Jf(d,a,!0);!a&&d.F?window&&window.location.reload():(a||(d.Eb=!0),d.Pa(wf),d.Eb=!1)}else d.reset(),d.a&&d.a.Ma()},!0;case "save":if(ma(u(),"pcjs.org"))c.parentNode.removeChild(c);
|
||||
else return this.m[b]=c,c.onclick=function(){var a=xf(d,!0);if(a){var b=!!(d.b&&!d.u||d.F),c=Jf(d,b);b?Kf(d,a,c):d.C("Resume disabled, machine state not saved")}},!0}return!1};
|
||||
function xf(a,b){var c=a.c;c||((c=za("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Lf(a,c))||a.C("The user ID is invalid.")):b&&a.C("Browser local storage is not available"));return c}
|
||||
function Lf(a,b){a.c=null;b=q(u()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Aa("user",b.data),a.c=b.data)}catch(d){r(d.message+" ("+c+")")}return a.c}function zf(a){var b=null;a.c&&(b=u()+"/api/v1/user?req=load&user="+a.c+"&state="+Mf(a,"1.30.2"));return b}
|
||||
function Kf(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Mf(a,"1.30.2");d.data=c;b=q(u()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.C("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.C(c),Aa("user",""),a.c=null)}}
|
||||
function Se(a){var b;a=B(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}function dc(a){if(a.Na){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Na.focus();window&&window.scrollTo(b,c)}}h.ha=function(a){this.a&&this.a.ha(a);this.g&&this.g.ha(a)};
|
||||
x(function(){for(var a=E(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=C(c),c=E(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=C(f),g=new uf(g,d,!0);D(g,f);g.B&&Af(g,g.Pa)}});v.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Sa("Computer",c.id))&&c.P&&!c.j.O&&c.Pa(-1)}});v.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Sa("Computer",c.id))&&c.j.O&&Jf(c,!(!c.b||c.u),!0)}});
|
||||
function P(a,b,c){this.id=a.id;this.key=Mf(a,b,c);this.D=a.D;Ef(this,a.bc)}function Mf(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
||||
P.prototype={constructor:P,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Ef(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
|
||||
1);c=0}}};function Ef(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function Ff(a){var b=!0;if(ya()){var c=JSON.stringify(a[a.id]);Aa(a.key,c)||(r("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Cf(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){r(c.message||c),b=!1}return b}function yf(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:ya()&&(b=za(a.key))?(a[a.id]=b,a.a=!0):!1}var Nf=0;
|
||||
function Of(a,b,c,d,e,f){e("Loading "+a+"...");q(a,null,!0,function(g,k,m){m?(k||(k="unable to load "+a+" ("+m+")"),f(k,null)):Pf(k,a,b,c,d,e,f)})}
|
||||
function Pf(a,b,c,d,e,f,g){function k(a,f){if(f)g(f,null);else{c&&(Qa(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
|
||||
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\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<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Qf(a,f,k):k(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
||||
function Qf(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/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
|
||||
|
|
|
|||
Loading…
Reference in a new issue