Changed how DL11 transmitter interrupts are triggered on writes to the XCSR (to satisfy the TRAPS TEST)

This commit is contained in:
Jeff 2016-11-10 22:06:06 -08:00 • committed by Jeff Parsons
commit 03e4169df2
3 changed files with 78 additions and 78 deletions

View file

@ -45,14 +45,14 @@ d.K[f++]=e[c]>>8&255,d.K[f++]=e[c]>>16&255,d.K[f++]=e[c]>>24&255;else d.K=g;d.W=
function v(){return"http://"+(window?window.location.host:"www.pcjs.org")}function t(a){window&&window.alert(a)}function ua(a){var b=!1;window&&(b=window.confirm(a));return b}var va=null;function wa(){if(null==va){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}va=a}return va}
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 Ba={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 Ga(a){Ba.init.push(a)}function Ha(a){if(Ea)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ia(a){!Ea&&a?(Ea=!0,Ca&&Ja("init"),Da&&Ja("show")):Ea=a}function Ja(a){Ba[a]&&Ha(Ba[a])}Fa("onload",function(){Ca=!0;Ha(Ba.init)});Fa("onpageshow",function(){Da=!0;Ha(Ba.show)});
Fa(Aa("Opera")||Aa("iOS")?"onunload":"onbeforeunload",function(){Ha(Ba.exit)});function x(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Ob=b.comment;this.mc=b;b=this.id.indexOf(".");0>b?this.ya=this.id:(this.oa=this.id.substr(0,b),this.ya=this.id.substr(b+1));this[a]=c;this.j={ready:!1,Ea:!1,rb:!1,O:!1,error:!1};this.kb=null;this.j.error=!1;this.o={};this.F=null;y.push(this)}var Ka=void 0,La={};
Fa(Aa("Opera")||Aa("iOS")?"onunload":"onbeforeunload",function(){Ha(Ba.exit)});function x(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Ob=b.comment;this.mc=b;b=this.id.indexOf(".");0>b?this.ya=this.id:(this.oa=this.id.substr(0,b),this.ya=this.id.substr(b+1));this[a]=c;this.j={ready:!1,Ea:!1,rb:!1,N:!1,error:!1};this.kb=null;this.j.error=!1;this.o={};this.F=null;y.push(this)}var Ka=void 0,La={};
if(window){Ka||(Ka=window.location.search.substr(1));for(var Ma,Na=/\+/g,Oa=/([^&=]+)=?([^&]*)/g;Ma=Oa.exec(Ka);)La[decodeURIComponent(Ma[1].replace(Na," "))]=decodeURIComponent(Ma[2].replace(Na," "))}function Pa(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 z(a,b){b||(b=x);a.prototype=Pa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Qa=window.PCjs.Machines||(window.PCjs.Machines={}),y=window.PCjs.Components||(window.PCjs.Components=[])}else Qa={},y=[];function Ra(a,b,c){Qa[a]&&b&&(Qa[a][b]=c)}function A(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<y.length;b++){var d=y[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function Sa(a){if(void 0!==a){var b;for(b=0;b<y.length;b++)if(y[b].id===a)return y[b]}return null}function Ta(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<y.length;d++)if(c)c==y[d]&&(c=null);else if(!(a!=y[d].type||b&&y[d].id.indexOf(b)))return y[d]}return null}function B(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
function C(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(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pdp11-binding":(g=B(f))&&g.binding&&a.Z(g.type,g.binding,f,g.value),l=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}
x.prototype={constructor:x,parent:null,toString:function(){return this.name?this.name:this.id||this.type},Z:function(a,b,c){switch(b){case "clear":return this.o[b]||(this.o[b]=c,c.onclick=function(a){return function(){a.o.print&&(a.o.print.value="")}}(this)),!0;case "print":return this.o[b]||(this.Wa=this.o[b]=c,c.value="",this.T=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.G=function(a){this.T(a,this.ya)}),!0;default:return!1}},log:function(){},T:function(){},status:function(a){this.T(this.ya+": "+a)},G:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},ka:function(){return this.j.O=!0},ja:function(a,b){b&&(this.j.O=!1);return!0}};function Ua(a,b){a.j.rb?(a.j.Ea=!1,a.j.rb=!1):a.j.error?a.T(a.toString()+" error"):a.j.Ea=b}function F(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.kb,a.kb=null,b&&b()))}
this.G=function(a){this.T(a,this.ya)}),!0;default:return!1}},log:function(){},T:function(){},status:function(a){this.T(this.ya+": "+a)},G:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},ka:function(){return this.j.N=!0},ja:function(a,b){b&&(this.j.N=!1);return!0}};function Ua(a,b){a.j.rb?(a.j.Ea=!1,a.j.rb=!1):a.j.error?a.T(a.toString()+" error"):a.j.Ea=b}function F(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.kb,a.kb=null,b&&b()))}
function Va(a,b){b&&(a.j.ready?b():a.kb=b);return a.j.ready}function Wa(a,b){a.j.error=!0;a.G(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});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
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 Xa="undefined"!==typeof ArrayBuffer;
function Ya(a){x.call(this,"Panel",a,Ya);this.da=this.i=this.c=this.m=this.w=this.s=0;this.A=this.C=this.v=!1;this.D=Za;this.f={};this.b={START:[1,1,!0,!1,this.tc],STEP:[1,1,!1,!1,this.uc],ENABLE:[1,1,!1,!1,this.pc],CONT:[1,1,!0,!1,this.nc],DEP:[0,0,!0,!1,this.oc],EXAM:[1,1,!0,!1,this.qc],LOAD:[1,1,!0,!1,this.sc],TEST:[0,0,!0,!1,this.rc]};for(a=0;22>a;a++)this.b["S"+a]=[0,0,!1,!1,this.vc,a]}z(Ya);var Za=7;function $a(a,b){return a.b[b]&&a.b[b][1]}h=Ya.prototype;h.reset=function(){this.stop()};
@ -93,24 +93,24 @@ function I(a,b,c,d,e,f){this.g=a;this.id=dc+=2;this.a=null;this.Ka=b;this.pb=c;t
2);for(f=0;f<a.length;f++)a[f]=0;gc(this,jc)}else gc(this)}var ec=0,Ib=1,fc=2,Gb=4,Jb=["NONE","RAM","ROM","VID","H/W"],dc=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Xa)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(Xa)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.va=!0}return!1},v:function(a,b){J(this.g,b,32);return 255},f:function(a,b,c){J(this.g,c,32)},w:function(a,b){return this.Ab(a++,b++)|
this.Ab(a,b)<<8},A:function(a,b,c){this.Gb(a++,b&255,c++);this.Gb(a,b>>8,c)},M:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},aa:function(a,b){a&1&&J(this.g,b,64);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},ra:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.va=!0},ya:function(a,b,c){a&1&&J(this.g,c,64);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.va=!0},D:function(a,b){return this.I(a,b)},R:function(a,b){return this.Vb(a,b)},pa:function(a,b,c){this.l?this.f(a,b,c):this.Hb(a,b,c)},ta:function(a,b,c){this.l?this.f(a,b,c):this.bc(a,b,c)},C:function(a){return this.o[a]},J:function(a){return this.o[a]},N:function(a,b){a&1&&J(this.g,b,64);return this.c.getUint16(a,!0)},$:function(a,b){a&1&&J(this.g,b,64);return this.s[a>>1]},oa:function(a,b){this.o[a]=b;this.va=!0},qa:function(a,b){this.o[a]=b;this.va=!0},sa:function(a,b,c){a&1&&J(this.g,
b>>8);this.va=!0},D:function(a,b){return this.I(a,b)},R:function(a,b){return this.Vb(a,b)},pa:function(a,b,c){this.l?this.f(a,b,c):this.Hb(a,b,c)},ta:function(a,b,c){this.l?this.f(a,b,c):this.bc(a,b,c)},C:function(a){return this.o[a]},J:function(a){return this.o[a]},O:function(a,b){a&1&&J(this.g,b,64);return this.c.getUint16(a,!0)},$:function(a,b){a&1&&J(this.g,b,64);return this.s[a>>1]},oa:function(a,b){this.o[a]=b;this.va=!0},qa:function(a,b){this.o[a]=b;this.va=!0},sa:function(a,b,c){a&1&&J(this.g,
c,64);this.c.setUint16(a,b,!0);this.va=!0},ua:function(a,b,c){a&1&&J(this.g,c,64);this.s[a>>1]=b;this.va=!0}};function Ab(a,b,c){a.F=b;a.i=a.m=0;c&&((a.i=c.i)&&lc(a,mc,!1),(a.m=c.m)&&nc(a,mc,!1))}function nc(a,b,c){c&&a.m||(a.Gb=!a.l&&b[1]||a.f,a.qb=!a.l&&b[3]||a.A);if(c||void 0===c)a.Hb=b[1]||a.f,a.bc=b[3]||a.A}function lc(a,b,c){c&&a.i||(a.Ab=b[0]||a.v,a.V=b[2]||a.w);if(c||void 0===c)a.I=b[0]||a.v,a.Vb=b[2]||a.w}function gc(a,b){b||(b=oc);lc(a,b,void 0);nc(a,b,void 0)}
var oc=[],jc=[I.prototype.M,I.prototype.ra,I.prototype.aa,I.prototype.ya],mc=[I.prototype.D,I.prototype.pa,I.prototype.R,I.prototype.ta];if(Xa)var ic=[I.prototype.C,I.prototype.oa,I.prototype.N,I.prototype.sa],hc=[I.prototype.J,I.prototype.qa,I.prototype.$,I.prototype.ua];
var oc=[],jc=[I.prototype.M,I.prototype.ra,I.prototype.aa,I.prototype.ya],mc=[I.prototype.D,I.prototype.pa,I.prototype.R,I.prototype.ta];if(Xa)var ic=[I.prototype.C,I.prototype.oa,I.prototype.O,I.prototype.sa],hc=[I.prototype.J,I.prototype.qa,I.prototype.$,I.prototype.ua];
function pc(a,b){x.call(this,"CPU",a,pc);var c=a.multiplier||1;this.hb=a.cycles||b;this.sa=c;this.xb=Math.round(this.hb/1E4)/100;this.Ha=this.xb*this.sa;this.j.P=!1;this.j.Eb=!1;this.j.Va=a.autoStart;this.j.gb=!1;this.eb=this.Ia=0;this.fb=a.csStart;this.Ra=a.csInterval;this.Sa=a.csStop;this.J=[];this.Tb=this.od.bind(this);F(this)}z(pc);var qc=["power","reset"];h=pc.prototype;
h.ia=function(a,b,c,d){this.l=a;this.g=b;this.F=d;this.A=a.A;for(b=0;b<qc.length;b++)(c=this.o[qc[b]])&&this.l.Z(null,qc[b],c);a=rc(a,"autoStart");null!=a&&(this.j.Va="true"==a?!0:"false"==a?!1:!!a);F(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.ka=function(a,b){if(!b){if(a&&this.restore){sc(this);if(!this.restore(a))return!1;tc(this)}else this.reset();this.T("No debugger detected")}return!0};h.ja=function(a){return a?this.save():!0};
h.Va=function(){return this.j.Va||void 0===this.o.run?(mb(this),!0):!1};h.Lb=function(){return 0};function tc(a){void 0===a.fb&&(a.fb=0);void 0===a.Ra&&(a.Ra=-1);void 0===a.Sa&&(a.Sa=-1);a.j.gb=0<=a.fb&&0<a.Ra;a.j.gb&&(a.eb=0,a.Ia=a.fb-a.ua)}function pb(a,b){if(a.j.gb){var c=!1;a.eb=a.eb+a.Lb()|0;a.Ia-=b;0>=a.Ia&&(a.Ia+=a.Ra,c=!0);0<=a.Sa&&a.Sa<=uc(a)&&(a.Ra=a.Sa=-1,tc(a),G(a),c=!0);c&&a.T(uc(a)+" cycles: checksum="+m(a.eb))}}
h.Z=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.o[b]=c,!0;case "run":return this.o[b]=c,c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.j.O)a=!0;else{var b=null,c,k=A(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);t("The "+b.type+" component ("+b.id+") is not "+(b.j.ready?"powered yet":"ready yet"+(b.kb?" (waiting for notification)":""))+".");a=!1}a&&(d.j.P?G(d):mb(d))},!0;case "speed":return this.o[b]=
h.Z=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.o[b]=c,!0;case "run":return this.o[b]=c,c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.j.N)a=!0;else{var b=null,c,k=A(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.N);c++);c==k.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.j.ready?"powered yet":"ready yet"+(b.kb?" (waiting for notification)":""))+".");a=!1}a&&(d.j.P?G(d):mb(d))},!0;case "speed":return this.o[b]=
c,!0;case "setSpeed":return this.o[b]=c,c.onclick=function(){vc(d,d.sa<<1,!0)},c.textContent=this.Ha.toFixed(2)+"Mhz",!0}return!1};h.xa=function(a){this.l&&this.l.xa(a)};function ob(a,b,c){a.ua+=b;c&&(a.ra=a.a=a.I=0)}function wc(a,b){var c=1;b&&1<a.sa&&a.pa&&(c=a.pa/a.xb);a.Qb=Math.round(1E3/30);a.ib=Math.floor(a.hb/30*c);b||(a.Ta=a.ib);a.yb=0}function uc(a){return a.ua+a.aa+a.ra-a.a}function sc(a){a.pa=0;a.Rb=0;a.ua=a.aa=a.ra=a.a=a.I=0;tc(a);vc(a,1)}
function vc(a,b,c){if(void 0!==b){.8>a.pa/a.Ha&&(b=1);a.sa=b;b=a.xb*a.sa;if(a.Ha!=b){a.Ha=b;b=a.Ha.toFixed(2)+"Mhz";var d=a.o.setSpeed;d&&(d.textContent=b);a.T("target speed: "+b)}c&&a.l&&xc(a.l)}ob(a,a.aa);a.aa=0;a.$=ra();a.qa=0;wc(a)}function Rb(a,b){var c=a.J.length;a.J.push([-1,b]);return c}function Tb(a,b,c,d){0<=b&&b<a.J.length&&(d||0>a.J[b][0])&&(c=a.hb*a.sa/1E3*c|0,a.j.P&&(c+=yc(a)),a.J[b][0]=c)}
function nb(a,b){for(var c=a.J.length-1;0<=c;c--){var d=a.J[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function yc(a,b){var c=a.ra-=a.a;a.a=a.I=0;b&&(a.ra=0);return c}
h.od=function(){if(this.j.P){this.yb>=this.hb&&wc(this,!0);this.Ua=0;this.cb=ra();if(this.qa){var a=this.cb-this.qa;a>this.Qb&&(this.$+=a,this.$>this.cb&&(this.$=this.cb))}try{do{for(var b,c=this.j.gb?1:this.ib,d=this.J.length-1;0<=d;d--){var e=this.J[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.ob(b)}catch(f){if("number"!=typeof f)throw f;}b=yc(this,!0);this.Ua+=b;this.aa+=b;pb(this,b);nb(this,b);this.Ta-=b;if(0>=this.Ta){this.Ta+=this.ib;15<=++this.Rb&&(this.xa(),this.Rb=0);break}}while(this.j.P)}catch(f){G(this);
this.l&&this.l.stop(ra(),uc(this));Wa(this,f.stack||f.message);return}if(this.j.P){a=setTimeout;b=this.Tb;this.qa=ra();c=this.Qb;this.Ua&&(c=Math.round(c*this.Ua/this.ib));c-=this.qa-this.cb;if(d=this.qa-this.$)this.pa=Math.round(this.aa/(10*d))/100,864E5<=d&&(this.ua=0,vc(this));if(0>c||this.pa<this.Ha)-1E3>c&&(this.$-=c),c=0;this.yb+=this.Ua;this.qa+=c;a(b,c)}}};
function mb(a){var b;a.j.error?(a.T(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.P)a.T(a.toString()+" busy");else{vc(a);a.j.P=!0;a.j.Eb=!0;if(b=a.o.run)b.textContent="Halt";a.l&&a.l.start(a.$,uc(a));setTimeout(a.Tb,0)}}h.ob=function(){return 0};function G(a){var b=!1;if(a.j.P){yc(a);ob(a,a.aa);a.aa=0;a.j.P=!1;if(b=a.o.run)b.textContent="Run";a.l&&a.l.stop(ra(),uc(a));b=!0}a.j.complete=void 0;return b}
function zc(a){this.La=+a.model||1170;this.Mb=a.addrReset||0;pc.call(this,a,6666667);this.decode=1120==this.La?Ac.bind(this):Bc.bind(this);Cc(this);this.ta=0;this.N=null;this.j.complete=!1}z(zc,pc);h=zc.prototype;h.reset=function(){this.status("model "+this.La);this.j.P&&G(this);Cc(this);sc(this);this.j.error=!1;this.parent.reset.call(this)};
function zc(a){this.La=+a.model||1170;this.Mb=a.addrReset||0;pc.call(this,a,6666667);this.decode=1120==this.La?Ac.bind(this):Bc.bind(this);Cc(this);this.ta=0;this.O=null;this.j.complete=!1}z(zc,pc);h=zc.prototype;h.reset=function(){this.status("model "+this.La);this.j.P&&G(this);Cc(this);sc(this);this.j.error=!1;this.parent.reset.call(this)};
function Cc(a){a.m=65536;a.f=32768;a.i=65535;a.s=32768;a.B=15;a.h=[0,0,0,0,0,0,0,a.Mb];a.Ga=[0,0,0,0,0,0];a.na=[0,0,0,0];a.v=0;a.ab=0;a.lc=[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.X=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.$a=[0,0,0,0,0,0,0,0,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.u=0;a.C=a.D=0;a.c=a.b=a.wb=0;a.Ja=-1;lb(a)}function lb(a){a.mb=255;a.ea=0;a.Db=0;a.w=0;a.Ca=0;a.Cb=0;a.Fa=0;a.Ba=0;a.bb=0;a.Pb=262143;a.N=null;a.g&&Xb(a)}function Xb(a){a.Ba?(a.R=65536,a.M=a.kc,a.V=a.ld,a.qb=a.de,Cb(a.g,a.Fa&16?22:18)):(a.R=0,a.M=a.jc,a.V=a.Wb,a.qb=a.cc,Cb(a.g,16))}h.Lb=function(){return 0};h.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.ua,this.sa]);a.set(2,Ob(this.g));return a.data()};
0,0,0,0,0,0,0,0,0];a.Yb=[0,0,0,0,0,0,0,0];a.Xb=0;a.u=0;a.C=a.D=0;a.c=a.b=a.wb=0;a.Ja=-1;lb(a)}function lb(a){a.mb=255;a.ea=0;a.Db=0;a.w=0;a.Ca=0;a.Cb=0;a.Fa=0;a.Ba=0;a.bb=0;a.Pb=262143;a.O=null;a.g&&Xb(a)}function Xb(a){a.Ba?(a.R=65536,a.M=a.kc,a.V=a.ld,a.qb=a.de,Cb(a.g,a.Fa&16?22:18)):(a.R=0,a.M=a.jc,a.V=a.Wb,a.qb=a.cc,Cb(a.g,16))}h.Lb=function(){return 0};h.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.ua,this.sa]);a.set(2,Ob(this.g));return a.data()};
h.restore=function(a){var b=a[1];this.ua=b[1];vc(this,b[3]);a:{b=this.g;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.D){for(var f=0,g=Array(b.D),k=0;k<e.length-1;)for(var l=e[k++],n=e[k++];l--;)g[f++]=n;e=g}f=b.g[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function P(a){return a.m&65536?1:0}h.Aa=function(){return this.s&32768?8:0};function Dc(a){var b=a.h[7];a.w&57344||(a.Ca=0,a.Cb=b);a.h[7]=b+2&65535;return a.V(b)}
function Ec(a,b){var c=a.h[7];a.h[7]=c+b&65535;return c}function Q(a,b){a.h[7]=b&65535}function Ub(a,b){return{qd:a,Ma:b,next:null}}function Sb(a,b){if(b!=a.N){var c=a.N;if(!c||c.Ma<=b.Ma)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.Ma<=b.Ma){b.next=d;c.next=b;break}c=d}while(c)}}a.u|=2}function Yb(a){return a.B=a.B&63728|a.Aa()|(a.i&65535?0:4)|(a.f&32768?2:0)|P(a)}
function Ec(a,b){var c=a.h[7];a.h[7]=c+b&65535;return c}function Q(a,b){a.h[7]=b&65535}function Ub(a,b){return{qd:a,Ma:b,next:null}}function Sb(a,b){if(b!=a.O){var c=a.O;if(!c||c.Ma<=b.Ma)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.Ma<=b.Ma){b.next=d;c.next=b;break}c=d}while(c)}}a.u|=2}function Yb(a){return a.B=a.B&63728|a.Aa()|(a.i&65535?0:4)|(a.f&32768?2:0)|P(a)}
function Zb(a,b){a.s=b<<12;a.i=~b&4;a.f=b<<14;a.m=b<<16;if((b^a.B)&2048)for(var c=a.Ga.length;0<=--c;){var d=a.h[c];a.h[c]=a.Ga[c];a.Ga[c]=d}a.v=b>>14&3;c=a.B>>14&3;a.v!=c&&(a.na[c]=a.h[6],a.h[6]=a.na[a.v]);a.B=b;a.u|=2}function R(a,b){a.u&128||(a.s=a.i=b,a.f=0)}function Fc(a,b,c){a.u&128||(a.s=a.i=a.m=b,a.f=c||0)}function Gc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.f=(c^b)&(d^b))}function Hc(a,b){a.u&128||(a.s=a.i=a.m=b,a.f=a.s^a.m>>1)}function Ic(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.f=(c^d)&(d^b))}
function K(a,b,c,d){if(!a.ta){var e=!1;0>a.Ja?a.Ja=Yb(a):a.v||(b=4,e=!0);a.w&57344||(a.Ca=63222,a.Cb=b);a.v=0;var f=a.V(b|a.R),g=a.V(b+2&65535|a.R);Zb(a,g&-12289|a.Ja>>2&12288);e&&(a.ea|=4,a.h[6]=4);Jc(a,a.Ja);Jc(a,a.h[7]);Q(a,f);a.u&=~c;a.Ja=-1;a.u|=8;if(-18!=d)throw b;}}function Kc(a){var b=Lc(a),c=Lc(a)&-1793;a.B&49152&&(c=c&-225|a.B&63712);Q(a,b);Zb(a,c);a.u&=-17}
function Lb(a,b){var c=b>>13&31;31>c&&a.Fa&32&&(b=a.$a[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
@ -123,7 +123,7 @@ h.kc=function(a,b,c){return Mc(this,Pc(this,a,b,c),c)};h.Wb=function(a){return M
function Rc(a,b,c,d){a.w&57344||(a.Ca=22);var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=Pc(a,b,e,4),c&65536||(e&=65535),a.v=a.B>>12&3,e=Mc(a,e|c&65536,4),a.v=a.B>>14&3,Nb(a.g,e,d)):6!=e||(a.B>>2&12288)===(a.B&12288)?a.h[e]=d:a.na[a.B>>12&3]=d}function Sc(a,b){b>>=6;var c=a.D=b&7;(b=a.C=(b&56)>>3)?(c=a.M(b,c,3),a=Kb(a.g,c)):a=a.h[c]&255;return a}function Tc(a,b){b>>=6;var c=a.D=b&7;return(b=a.C=(b&56)>>3)?Mb(a.g,a.M(b,c,2)):a.h[c]}function Uc(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return Pc(a,b,c,8)}
function Vc(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.M(b,c,3),a=Kb(a.g,c)):a=a.h[c]&255;return a}function Wc(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?Mb(a.g,a.M(b,c,2)):a.h[c]}function S(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.wb=a.M(b,e,7),Nc(a,e,d.call(a,c,Kb(a.g,e)))):a.h[e]=a.h[e]&65280|d.call(a,c,a.h[e]&255)}function T(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.M(b,e,6),Nb(a.g,e,d.call(a,c,Mb(a.g,e)))):a.h[e]=d.call(a,c,a.h[e])}
function Xc(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?Nc(a,a.M(b,e,5),c):a.h[e]=c?a.h[e]&~d|c<<24>>24&d:a.h[e]&~d;return c}function Yc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?Nb(a.g,a.M(b,d,4),c):a.h[d]=c&65535;return c}function V(a,b,c){c&&(Q(a,a.h[7]+(b<<24>>23)),a.a-=2);a.a-=3}
h.ob=function(a){this.j.complete=!0;var b=a?this.j.Eb?0:1:-1;this.j.Eb=!1;this.ra=this.a=a;do{if(this.u){this.u&112&&(this.u&32?K(this,168,32,-7):this.u&16?K(this,12,16,-9):this.u&64&&K(this,4,64,-8));if(a=this.u&7){a=!1;if(this.u&2){this.u&=-3;var c=160,d=(this.Db&224)>>5,e=this.N&&this.N.Ma>d?this.N:null;e&&(c=e.qd,d=e.Ma);d>(this.B&224)>>5?(this.u&4&&(Ec(this,2),this.u&=-5),K(this,c,0,-18),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=
h.ob=function(a){this.j.complete=!0;var b=a?this.j.Eb?0:1:-1;this.j.Eb=!1;this.ra=this.a=a;do{if(this.u){this.u&112&&(this.u&32?K(this,168,32,-7):this.u&16?K(this,12,16,-9):this.u&64&&K(this,4,64,-8));if(a=this.u&7){a=!1;if(this.u&2){this.u&=-3;var c=160,d=(this.Db&224)>>5,e=this.O&&this.O.Ma>d?this.O:null;e&&(c=e.qd,d=e.Ma);d>(this.B&224)>>5?(this.u&4&&(Ec(this,2),this.u&=-5),K(this,c,0,-18),d=!0):d=!1;if(d){if(e)if(a=e,e=this.O,e==a)this.O=a.next;else for(;e;){d=e.next;if(d==a){e.next=d.next;break}e=
d}a=!0}}else this.u&1&&this.u++;a=a&&0>b}if(a)break}this.u=this.u&7|this.B&16;this.decode(Dc(this))}while(0<this.a);return this.j.complete?this.ra-this.a:void 0===this.j.complete?0:-1};Ga(function(){for(var a=E(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new zc(d);C(d,c)}});function Zc(a,b){var c=b+a;Gc(this,c,a,b);return c&65535}function $c(a,b){var c=b+a;Gc(this,c<<8,a<<8,b<<8);return c&255}function ad(a,b){a=b<<1;Hc(this,a);return a&65535}
function bd(a,b){a=b<<1;Hc(this,a<<8);return a&255}function cd(a,b){a=b&32768|b>>1|b<<16;Hc(this,a);return a&65535}function dd(a,b){a=b&128|b>>1|b<<8;Hc(this,a<<8);return a&255}function ed(a,b){a=b&~a;R(this,a);return a}function fd(a,b){a=b&~a;R(this,a<<8);return a}function gd(a,b){a|=b;R(this,a);return a}function hd(a,b){a|=b;R(this,a<<8);return a}function id(a,b){a=~b|65536;Fc(this,a);return a&65535}function jd(a,b){a=~b|256;Fc(this,a<<8);return a&255}
function kd(a,b){a=b-a;this.u&128||(this.s=this.i=a,this.f=b&(b^a));return a&65535}function ld(a,b){a=b-a;var c=a<<8;b<<=8;this.u&128||(this.s=this.i=c,this.f=b&(b^c));return a&255}function md(a,b){a=b+a;this.u&128||(this.s=this.i=a,this.f=a&(b^a));return a&65535}function nd(a,b){a=b+a;var c=a<<8;this.u&128||(this.s=this.i=c,this.f=c&(b<<8^c));return a&255}function od(a,b){a=-b;Fc(this,a,a&b&32768);return a&65535}function pd(a,b){a=-b;Fc(this,a<<8,(a&b&128)<<8);return a&255}
@ -158,30 +158,30 @@ af.prototype.ia=function(a,b,c,d){this.g=b;this.a=c;this.F=d;bf(this)};af.protot
af.prototype.reset=function(){if(this.f){for(var a=this.g,b=this.l,c=this.i,d=b&a.l,b=b>>>a.c;0<c&&b<a.g.length;){var e=a.g[b];if(e.controller&&a.i&&a.i.length==a.v.length){var f=a.i.indexOf(e);0<=f&&(e=a.v[f])}if(e){var f=c,g=0,k,d=d||0,g=g&255;void 0===f&&(f=e.size);if(Xa&&e.o)for(k=d;f--&&k<e.o.length;k++)e.o[k]=g;else for(k=d;f--&&k<e.size;k++)e.Hb(d,g,e.Ka+d)}c-=a.b;b++;d=0}this.c&&cf(this,this.c,this.ga,this.fa,this.l,!0)}};
function cf(a,b,c,d,e,f){var g=!1;if(null==c)for(var k=0;k<b.length-1;){var l=b[k]&255|(b[k+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(k+6>=b.length)break;for(var k=k+2,n=b[k++]&255|(b[k++]&255)<<8,p=b[k++]&255|(b[k++]&255)<<8,l=l+((n&255)+(n>>8)+(p&255)+(p>>8)),u=k,w=n-=6;0<n&&k<b.length;)l+=b[k++]&255,n--;if(n||k>=b.length)break;l+=b[k++]&255;if(l&255)break;if(w)for(;w--;)a.a.Za(p++,b[u++]&255);else p&1?G(a.a):null==d&&(d=p);g=!0}else k++;else k+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.a.Za(c+
g,b[g]);g=!0}g&&null!=d&&(a=a.a,a.Mb=d,Q(a,d),!f&&a.F&&(G(a)||a.F.c()));return g}Ga(function(){for(var a=E(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new af(d);C(d,c)}});function df(a){x.call(this,"Keyboard",a,df);F(this)}z(df);df.prototype.Z=function(){return!1};df.prototype.ia=function(a,b,c,d){this.l=a;this.a=c;this.F=d};Ga(function(){for(var a=E(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new df(d);C(d,c)}});
function Z(a){this.C=a.baudReceive||9600;this.I=a.baudTransmit||9600;this.R=a.upperCase;this.f=this.m=null;this.J=a.tabSize;this.D=a.charBOL;this.s=0;x.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.m="";else{var c;a=ef;b&&(void 0===c&&(c="Panel"),(c=Ta(c,this.id))&&(b=c.o[b])&&this.Z(null,a,b))}this.v=this.A=null;this.exports={connect:this.Nb,receiveData:this.Bb}}z(Z);var ef="buffer";h=Z.prototype;
function Z(a){this.C=a.baudReceive||9600;this.R=a.baudTransmit||9600;this.O=a.upperCase;this.f=this.m=null;this.I=a.tabSize;this.D=a.charBOL;this.s=0;x.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.m="";else{var c;a=ef;b&&(void 0===c&&(c="Panel"),(c=Ta(c,this.id))&&(b=c.o[b])&&this.Z(null,a,b))}this.v=this.A=null;this.exports={connect:this.Nb,receiveData:this.Bb}}z(Z);var ef="buffer";h=Z.prototype;
h.Z=function(a,b,c){var d=this;switch(b){case ef:return this.o[b]=this.f=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.Bb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Bb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.ia=function(a,b,c,d){this.l=a;this.g=b;this.a=c;this.F=d;var e=this;this.$=Ub(48,4);this.M=Rb(this.a,function(){e.b&128||!e.i.length||(e.w=e.i.shift()&255,e.R&&97<=e.w&&122>e.w&&(e.w-=32),e.b|=128,e.b&64&&Sb(e.a,e.$))});this.aa=Ub(52,4);this.N=Rb(this.a,function(){e.c|=128;e.c&64&&Sb(e.a,e.aa)});cb(b,this,ff);F(this)};
h.ia=function(a,b,c,d){this.l=a;this.g=b;this.a=c;this.F=d;var e=this;this.aa=Ub(48,4);this.J=Rb(this.a,function(){e.b&128||!e.i.length||(e.w=e.i.shift()&255,e.O&&97<=e.w&&122>e.w&&(e.w-=32),e.b|=128,e.b&64&&Sb(e.a,e.aa))});this.M=Ub(52,4);this.$=Rb(this.a,function(){e.c|=128;e.c&64&&Sb(e.a,e.M)});cb(b,this,ff);F(this)};
h.Nb=function(){if(!this.v){var a=rc(this.l,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.ya)return;b=pa(b[1]);if(this.v=Sa(b)){var d=this.v.exports;if(d){var e=d.connect;e&&e.call(this.v);if(this.A=d.receiveData){this.status(this.oa+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.ka=function(a,b){if(!b)if(this.Nb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.ja=function(a){return a?this.save():!0};h.reset=function(){gf(this)};h.save=function(){var a=new O(this);a.set(0,[]);return a.data()};h.restore=function(){return gf(this)};function gf(a){a.w=0;a.b=0;a.c=128;a.i=[];return!0}h.Bb=function(a){if("number"==typeof a)this.i.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.i.push(a.charCodeAt(b));else this.i=this.i.concat(a);Tb(this.a,this.M,1E3/Math.round(this.C/10));return!0};h.Tc=function(){return this.b&65534};
h.Md=function(a){this.b=this.b&-112|a&111};h.Sc=function(){this.b&=-129;0<this.i.length&&Tb(this.a,this.M,1E3/Math.round(this.C/10));return this.w};h.Ld=function(){};h.nd=function(){return this.c};h.fe=function(a){128==(this.c&192)&&a&64&&Tb(this.a,this.N,1E3/Math.round(this.I/10));this.c=this.c&-70|a&69};h.md=function(){return 0};
h.ee=function(a){if(a&=255){this.A&&this.A.call(this.v,a);if(this.f)if(13==a)this.s=0;else if(8==a)this.f.value=this.f.value.slice(0,-1),0<this.s&&this.s--;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.J||8,c=a-this.s%a,this.J&&(b=" ".slice(0,c)));this.D&&!this.s&&c&&(b=String.fromCharCode(this.D)+b);this.f.value+=b;this.f.scrollTop=this.f.scrollHeight;this.s+=c}else if(null!=this.m){if(10==a||1024<=this.m.length)this.T(this.m),
this.m="";10!=a&&(this.m+=String.fromCharCode(a))}this.c&=-129;Tb(this.a,this.N,1E3/Math.round(this.I/10))}};var hf={},ff=(hf[65392]=[null,null,Z.prototype.Tc,Z.prototype.Md,"RCSR"],hf[65394]=[null,null,Z.prototype.Sc,Z.prototype.Ld,"RBUF"],hf[65396]=[null,null,Z.prototype.nd,Z.prototype.fe,"XCSR"],hf[65398]=[null,null,Z.prototype.md,Z.prototype.ee,"XBUF"],hf);Ga(function(){for(var a=E(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Z(d);C(d,c)}});
function $b(a){x.call(this,"PC11",a,$b);this.c=a.autoMount||null;this.m=0;this.N=a.baudReceive||3600;this.w=this.A=this.b=0;this.v=[];this.s=jf;this.f=kf;this.C=this.i="";this.K=this.ga=this.fa=null;this.I=-1;this.D=!Aa("Mobi")&&window&&"FileReader"in window}z($b);var jf="",kf=0;h=$b.prototype;
h.ja=function(a){return a?this.save():!0};h.reset=function(){gf(this)};h.save=function(){var a=new O(this);a.set(0,[]);return a.data()};h.restore=function(){return gf(this)};function gf(a){a.w=0;a.b=0;a.c=128;a.i=[];return!0}h.Bb=function(a){if("number"==typeof a)this.i.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.i.push(a.charCodeAt(b));else this.i=this.i.concat(a);Tb(this.a,this.J,1E3/Math.round(this.C/10));return!0};h.Tc=function(){return this.b&65534};
h.Md=function(a){this.b=this.b&-112|a&111};h.Sc=function(){this.b&=-129;0<this.i.length&&Tb(this.a,this.J,1E3/Math.round(this.C/10));return this.w};h.Ld=function(){};h.nd=function(){return this.c};h.fe=function(a){this.c&128&&a&64&&Sb(this.a,this.M);this.c=this.c&-70|a&69};h.md=function(){return 0};
h.ee=function(a){if(a&=255){this.A&&this.A.call(this.v,a);if(this.f)if(13==a)this.s=0;else if(8==a)this.f.value=this.f.value.slice(0,-1),0<this.s&&this.s--;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.I||8,c=a-this.s%a,this.I&&(b=" ".slice(0,c)));this.D&&!this.s&&c&&(b=String.fromCharCode(this.D)+b);this.f.value+=b;this.f.scrollTop=this.f.scrollHeight;this.s+=c}else if(null!=this.m){if(10==a||1024<=this.m.length)this.T(this.m),
this.m="";10!=a&&(this.m+=String.fromCharCode(a))}this.c&=-129;Tb(this.a,this.$,1E3/Math.round(this.R/10))}};var hf={},ff=(hf[65392]=[null,null,Z.prototype.Tc,Z.prototype.Md,"RCSR"],hf[65394]=[null,null,Z.prototype.Sc,Z.prototype.Ld,"RBUF"],hf[65396]=[null,null,Z.prototype.nd,Z.prototype.fe,"XCSR"],hf[65398]=[null,null,Z.prototype.md,Z.prototype.ee,"XBUF"],hf);Ga(function(){for(var a=E(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Z(d);C(d,c)}});
function $b(a){x.call(this,"PC11",a,$b);this.c=a.autoMount||null;this.m=0;this.O=a.baudReceive||3600;this.w=this.A=this.b=0;this.v=[];this.s=jf;this.f=kf;this.C=this.i="";this.K=this.ga=this.fa=null;this.I=-1;this.D=!Aa("Mobi")&&window&&"FileReader"in window}z($b);var jf="",kf=0;h=$b.prototype;
h.Z=function(a,b,c){var d=this,e=kf;switch(b){case "listTapes":return this.o[b]=c,c.onchange=function(){var a=d.o.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){t("PC11 option error: "+l.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.o[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.o[b]=c,c.onclick=function(){var a=
d.o.listTapes;a&&lf(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.D){c.parentNode.removeChild(c);break}this.o[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;lf(d,q(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.o[b]=c,!0}return!1};
h.ia=function(a,b,c,d){this.l=a;this.g=b;this.a=c;this.F=d;this.J=mf(a);var e=this;if((this.c=rc(this.l,"autoMount")||this.c)&&"string"==typeof this.c)try{this.c=eval("("+this.c+")")}catch(f){t("PC11 auto-mount error: "+f.message+" ("+this.c+")"),this.c=null}this.M=Ub(56,4);this.R=Rb(this.a,function(){1==(e.b&32769)&&!(e.b&128)&&e.w<e.v.length&&(e.A=e.v[e.w++]&255,nf(e,e.w/e.v.length*100),e.b|=128,e.b&=-2049,e.b&64&&Sb(e.a,e.M))});cb(b,this,of);pf(this,"None",jf,!0);this.D&&pf(this,"Local Tape","?");
pf(this,"Remote Tape","??");qf(this)||F(this)};h.ka=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.ja=function(a){return a?this.save():!0};h.reset=function(){this.b&=-2241;this.A=0};function qf(a){a.m=0;if(a.c){var b=a.c.path||"",c;if(!(c=a.c.name))a:{if((c=a.o.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=q(b,!0)}b&&c?rf(a,c,b,1,!0):sf(a)}return!!a.m}
function lf(a,b,c,d,e){if(c)if("?"==c)a.G('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=q(c);a.status("Attempting to load "+c+' as "'+b+'"');a.s="??"}else a.s=c;rf(a,b,c,d,!1,e)}else tf(a,!1)}function rf(a,b,c,d,e,f){var g=-1;if(a.i.toLowerCase()!=c.toLowerCase()||a.f!=d)g++,tf(a,!0),a.j.Ea?a.G("PC11 busy"):(e&&a.m++,uf(a,b,c,d,f)?g++:a.j.Ea=!0);g&&vf(a,a.C,a.i,a.f,a.K,a.ga,a.fa)}
function uf(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),vf(a,b,c,d,e),a.s="?");sf(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=la(c),f="json"==e||"gz"==e?encodeURI(c):v()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!r(f,null,!0,function(e,f,g){var k=0>g&&a.l&&!a.l.j.O;g?a.G('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(Ra(a.oa,e,f),(e=ta(e,f))&&vf(a,b,c,d,e.K,e.ga,e.fa));
function uf(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),vf(a,b,c,d,e),a.s="?");sf(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=la(c),f="json"==e||"gz"==e?encodeURI(c):v()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!r(f,null,!0,function(e,f,g){var k=0>g&&a.l&&!a.l.j.N;g?a.G('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(Ra(a.oa,e,f),(e=ta(e,f))&&vf(a,b,c,d,e.K,e.ga,e.fa));
a.j.Ea=!1;a.m&&(a.m--,a.m||F(a));sf(a)})}function pf(a,b,c,d){if((a=a.o.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 sf(a){var b=a.o.listTapes;if(b&&b.options){a=a.s||a.i;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 nf(a,b){b|=0;if(b!==a.I){var c=a.o.readProgress;c&&(c=(c=E(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.I=b}}function vf(a,b,c,d,e,f,g){a.C=b;a.i=c;a.f=d;a.K=e;a.ga=f;a.fa=g;2==d?a.J&&cf(a.J,e,f,g)?a.status("tape loaded: "+b):(a.C="",a.i="",a.s=jf,a.f=kf,a.G("No load address available for tape: "+b)):(a.w=0,a.v=e,a.status("tape attached: "+b),nf(a,0))}
function tf(a,b){if(a.i||!1===b)a.C="",a.i="",b||(a.f&&a.status(1==a.f?"tape detached":"tape unloaded"),a.s=jf,a.f=kf,sf(a))}h.save=function(){return(new O(this)).data()};h.restore=function(){return!0};h.Mc=function(){return this.b&65534};h.Fd=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&Sb(this.a,this.M)):(this.b&=-129,this.b|=2048,this.A=0,Tb(this.a,this.R,1E3/Math.round(this.N/10))));this.b=this.b&-66|a&65};h.Lc=function(){this.b&=-129;this.b|=2048;return this.A};h.Ed=function(){};
function tf(a,b){if(a.i||!1===b)a.C="",a.i="",b||(a.f&&a.status(1==a.f?"tape detached":"tape unloaded"),a.s=jf,a.f=kf,sf(a))}h.save=function(){return(new O(this)).data()};h.restore=function(){return!0};h.Mc=function(){return this.b&65534};h.Fd=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&Sb(this.a,this.M)):(this.b&=-129,this.b|=2048,this.A=0,Tb(this.a,this.R,1E3/Math.round(this.O/10))));this.b=this.b&-66|a&65};h.Lc=function(){this.b&=-129;this.b|=2048;return this.A};h.Ed=function(){};
var wf={},of=(wf[65384]=[null,null,$b.prototype.Mc,$b.prototype.Fd,"PRS"],wf[65386]=[null,null,$b.prototype.Lc,$b.prototype.Ed,"PRB"],wf);function xf(a,b,c){x.call(this,"Disk",{id:a.oa+".disk"+m(++yf,4)},xf);this.controller=a;this.l=a.l;this.F=a.F;this.f=b;this.wa=b.name;this.vb=b.vb;zf(this,c,b.U,b.Y,b.S,b.ha);F(this)}var yf=0;z(xf);h=xf.prototype;h.ia=function(a,b,c,d){this.F=d};
function zf(a,b,c,d,e,f){a.mode=b;a.U=c;a.Y=d;a.S=e;a.ha=f;a.a=[];if("preload"!=a.mode){b=Array(a.U);for(c=0;c<b.length;c++){d=Array(a.Y);for(e=0;e<d.length;e++){f=Array(a.S);for(var g=1;g<=f.length;g++)f[g-1]=Af(null,c,e,g,a.ha,0);d[e]=f}b[c]=d}a.a=b}a.b=null}
function Bf(a,b,c,d,e){var f=c;if(a.g)return!0;a.wa=b;a.Da=c;a.Zb=q(c);a.g=e;a.i=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.U=e[0];a.Y=e[1];a.S=e[2];a.ha=e[3]||512;c=a.ha>>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.U);for(d=0;d<a.a.length;d++)for(var w=a.a[d]=Array(a.Y),D=0;D<w.length;D++)for(var U=w[D]=Array(a.S),xa=0;xa<U.length;xa++){for(var Vb=Af(null,d,D,xa+1,a.ha,0),Oe=Vb.data,kc=0;kc<c;kc++,f+=4)var cg=Oe[kc]=b.getInt32(f,
!0),e=e+cg&-1;Vb.ba=c;U[xa]=Vb}a.b=e;c=a}else a.G("Unrecognized disk format ("+d+" bytes)");a.g&&(a.g.call(a.controller,a.f,c,a.wa,a.Da),a.g=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=v()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.vb?"":e)+"&format=json"));return!!r(f,
null,!0,function(b,c,d){Cf(a,b,c,d)})}
function Cf(a,b,c,d){var e=null;a.c=!1;var f=0>d&&a.l&&!a.l.j.O;if(d)a.controller.G('Unable to load disk "'+a.wa+'" (error '+d+": "+b+")",f);else{Ra(a.controller.oa,b,c);try{if(0<q(a.Zb,!0).toLowerCase().indexOf("-readonly"))a.c=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.c=!0)}var k;"<"==c.substr(0,1)?k=["Missing disk image: "+a.wa]:k=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
function Cf(a,b,c,d){var e=null;a.c=!1;var f=0>d&&a.l&&!a.l.j.N;if(d)a.controller.G('Unable to load disk "'+a.wa+'" (error '+d+": "+b+")",f);else{Ra(a.controller.oa,b,c);try{if(0<q(a.Zb,!0).toLowerCase().indexOf("-readonly"))a.c=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.c=!0)}var k;"<"==c.substr(0,1)?k=["Missing disk image: "+a.wa]: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)t(k[0]);else{a.U=k.length;a.Y=k[0].length;a.S=k[0][0].length;var l=k[0][0][0];a.ha=l&&l.length||512;for(d=c=0;d<a.U;d++)for(f=0;f<a.Y;f++)for(g=0;g<a.S;g++)if(l=k[d][f][g]){var n=l.length;void 0===n&&(n=l.length=512);var n=n>>2,p=l.pattern;void 0===p&&(p=l.pattern=0);var u=l.data;if(void 0===u){var w=l.bytes;if(void 0!==w&&w.length){for(var D=n<<2,U=w.length;U<D;U++)w[U]=p;Df(l,w)}else u=[],p=l.pattern=p|p<<8|p<<16|p<<24,l.data=u;delete l.bytes}Af(l,d,f);for(D=0;D<
u.length;D++)c=c+u[D]&-1}a.a=k;a.b=c;e=a}else t("Empty disk image: "+a.wa)}catch(xa){t("Disk image error ("+b+"): "+xa.message)}}a.g&&(a.g.call(a.i,a.f,e,a.wa,a.Da),a.g=null)}function Af(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.ie=b;a.je=c;a.la=a.ba=0;a.va=!1;return a}
h.seek=function(a,b,c,d,e){d=null;var f=this.f,g=this.a[a];if(g){var k=g[b];if(!k&&f.ec&&b<f.Y)for(k=g[b]=Array(f.fc),g=0;g<k.length;g++)k[g]=Af(null,a,b,g+1,f.Sb,0);if(k){for(g=0;g<k.length;g++)if(k[g]&&k[g].sector==c){d=k[g];break}!d&&f.ec&&9==f.Ib&&(d=k[g]=Af(null,a,b,f.Ib,f.Sb,0))}}e&&e(d,!1);return d};function Df(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}
@ -210,27 +210,27 @@ h.ud=function(a,b,c,d,e,f,g){var k=0,l=a.ca,n=null,p;l||(k=5120,e=0);for(;e--;){
h.Pd=function(a){this.L=this.L&-1023|a&1022;this.C=this.C&-4|(a&48)>>4;if(!(this.L&128)){var b;a=!0;var c=this.b[(this.L&768)>>8],d,e,f,g;this.L&=-2;switch(this.L&14){case 4:this.c&8&&(this.L&=63);this.m=c.status|this.i&64;break;case 6:1==(this.c&3)&&(b=this.c&65408,c=(this.c&16)<<2,this.i=this.c&4?this.i+b:this.i-b,this.c=this.i=this.i&65408|c);break;case 8:this.m=this.i;break;case 12:b=this.zc;case 10:b||(b=this.ud),d=this.c>>7,e=this.c&64?1:0,f=this.c&63,d>=c.U||f>=c.S?this.L|=37888:(g=(this.w&
63)<<16|this.v,a=65536-this.m&65535,a=b.call(this,c,d,e,f,a,g,this.hc.bind(this)))}a&&(this.L|=129,this.L&64&&Sb(this.a,this.D))}};h.Uc=function(){return this.v};h.Nd=function(a){this.v=a&65534};h.Xc=function(){return this.c};h.Qd=function(a){this.c=a};h.Yc=function(){return this.m};h.Rd=function(a){this.m=a};h.Vc=function(){return this.w};h.Od=function(a){this.w=a&63};
var Pf={},Kf=(Pf[63744]=[null,null,N.prototype.Wc,N.prototype.Pd,"RLCS"],Pf[63746]=[null,null,N.prototype.Uc,N.prototype.Nd,"RLBA"],Pf[63748]=[null,null,N.prototype.Xc,N.prototype.Qd,"RLDA"],Pf[63750]=[null,null,N.prototype.Yc,N.prototype.Rd,"RLMP"],Pf[63752]=[null,null,N.prototype.Vc,N.prototype.Od,"RLBE"],Pf);
function Qf(a,b,c){x.call(this,"Computer",a,Qf);this.j.O=!1;Rf(this,b);this.w=rc(this,"autoPower",a);this.l=0;this.M=a.busWidth||a.buswidth;this.b=Sf;this.s=null;this.i=this.I=!1;this.N=rc(this,"url")||"";(Math.random()+.1).toString(36);this.c=Tf(this);if(this.a=Ta("CPU",this.id)){this.F=Ta("Debugger",this.id);this.g=new vb({id:this.oa+".bus",busWidth:this.M},this.a,this.F);var d,e=A(this.id);if((this.A=Ta("Panel",this.id))&&this.A.Wa)for(b=0;b<e.length;b++)d=e[b],d.G=this.A.G,d.T=this.A.T,d.Wa=this.A.Wa;
function Qf(a,b,c){x.call(this,"Computer",a,Qf);this.j.N=!1;Rf(this,b);this.w=rc(this,"autoPower",a);this.l=0;this.M=a.busWidth||a.buswidth;this.b=Sf;this.s=null;this.i=this.I=!1;this.O=rc(this,"url")||"";(Math.random()+.1).toString(36);this.c=Tf(this);if(this.a=Ta("CPU",this.id)){this.F=Ta("Debugger",this.id);this.g=new vb({id:this.oa+".bus",busWidth:this.M},this.a,this.F);var d,e=A(this.id);if((this.A=Ta("Panel",this.id))&&this.A.Wa)for(b=0;b<e.length;b++)d=e[b],d.G=this.A.G,d.T=this.A.T,d.Wa=this.A.Wa;
this.T("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.T("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.ia&&d.ia(this,this.g,this.a,this.F);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.m=d:this.b=parseInt(d,10));var f;if(a=rc(this,"state")||(f=!0,a.state))b=this.C=a,f||(this.i=!0,this.b=Sf),this.b&&(this.v=new O(this,
"1.30.3"),Uf(this.v)?b=null:delete this.v);!b&&this.b&&(b=Vf(this))&&(this.i=!0);if(b){var g=this;r(b,null,!0,function(a,b,c){c?(g.m=null,g.i=!1,g.G("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.s=b,g.I=!0);F(g)})}else F(this);this.o.power||(this.w=!0);!c&&this.w&&Wf(this,this.Ya)}else t("Unable to find CPU component")}z(Qf);var Sf=0;
function Rf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.J=b}function rc(a,b,c){var d=b.toLowerCase(),d=La[b]||La[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 Wf(a,b,c){for(var d=A(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Va(f)){Va(f,function(){Wf(a,b,c)});return}}b.call(a,c)}
function Xf(a,b){var c=new O(a,"1.30.3","validate");if(Uf(c)&&Yf(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.G("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=Qf.prototype;
h.Ya=function(a){void 0===a&&(a=this.b||(this.s?1:Sf));if(!this.l){this.l++;var b=!1,c=!1;this.D=!1;var d=this.v||new O(this,"1.30.3");if(-1==a)b=!0;else if(a>Sf){if(Uf(d,this.s)){this.f=new O(this,"1.30.3","failsafe");Uf(this.f)&&(Zf(this,d),a=2,$f(this.f));this.f.set("timestamp",sa());ag(this.f);var e=this.b&&!this.i;if(1==a||ua("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Yf(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Uf(d,g):("error"==
f&&"no machine state"!=g?(this.G("Error: "+g),"unable to verify user"==g&&(za("user",""),this.c=null)):this.T(f+": "+g),$f(d),Uf(d)?(c=Yf(d),e=!0):c=!1))}e&&Xf(this,c?d:null)}else 2==a&&d.clear()}else Xf(this);delete this.s;delete this.v}e=A(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=bg(this,g,d,b,c));b=[d,a,c];-1!=a?Wf(this,this.Jb,b):this.Jb(b)}};
function bg(a,b,c,d,e){if(!b.j.O){b.j.O=!0;if(b.ka){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.ka(f,d)&&f&&(t("Unable to restore state for "+b.type),a.C&&!a.I?(c.clear(),a.b=Sf,window&&window.location.reload()):a.D=!0,b.ka(null),e=!1)}if(!d&&b.Ob)for(a=b.Ob.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Jb=function(a){var b=a[0],c=0>a[1];a=a[2];this.R=!0;this.j.O=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(bg(this,this.a,b,c,a),this.xa(),this.a.Va());this.D&&(Zf(this,b),b.clear());!c&&this.f&&(this.f.clear(),delete this.f);this.l=0};
function Zf(a,b){if(ua("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.3"};d.url=a.N;d.user=c;d.type="bug";d.data=b;r("http://www.pcjs.org/api/v1/report",d,!0)}}
function dg(a,b,c){var d,e="none";if(a.l)return null;a.l--;var f=new O(a,"1.30.3"),g=new O(a,"1.30.3","validate"),k=sa();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.ja&&(c&&G(a.a),d=a.a.ja(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.j.O=!1,!1===d&&(e=null)));for(var k=A(a.id),l=0;l<k.length;l++){var n=k[l];n.j.O&&(n.ja&&(d=n.ja(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.j.O=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.c&&eg(a,a.c,f.toString()),ag(g)&&ag(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.o.power)&&(b.textContent="Power");a.l=0;return e}h.reset=function(){this.g&&this.g.reset&&this.g.reset();this.a&&this.a.reset&&this.a.reset();for(var a=A(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.g&&c!==this.a&&c.reset&&c.reset()}this.xa(-1)};
function bg(a,b,c,d,e){if(!b.j.N){b.j.N=!0;if(b.ka){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.ka(f,d)&&f&&(t("Unable to restore state for "+b.type),a.C&&!a.I?(c.clear(),a.b=Sf,window&&window.location.reload()):a.D=!0,b.ka(null),e=!1)}if(!d&&b.Ob)for(a=b.Ob.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Jb=function(a){var b=a[0],c=0>a[1];a=a[2];this.R=!0;this.j.N=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(bg(this,this.a,b,c,a),this.xa(),this.a.Va());this.D&&(Zf(this,b),b.clear());!c&&this.f&&(this.f.clear(),delete this.f);this.l=0};
function Zf(a,b){if(ua("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.3"};d.url=a.O;d.user=c;d.type="bug";d.data=b;r("http://www.pcjs.org/api/v1/report",d,!0)}}
function dg(a,b,c){var d,e="none";if(a.l)return null;a.l--;var f=new O(a,"1.30.3"),g=new O(a,"1.30.3","validate"),k=sa();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.ja&&(c&&G(a.a),d=a.a.ja(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.j.N=!1,!1===d&&(e=null)));for(var k=A(a.id),l=0;l<k.length;l++){var n=k[l];n.j.N&&(n.ja&&(d=n.ja(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.j.N=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.c&&eg(a,a.c,f.toString()),ag(g)&&ag(f)||(e=null,d=k=!0)):a.b&&(d=!0,k=3==a.b),d&&f.clear(k)):e=f.toString());c&&(a.j.N=!1,b=a.o.power)&&(b.textContent="Power");a.l=0;return e}h.reset=function(){this.g&&this.g.reset&&this.g.reset();this.a&&this.a.reset&&this.a.reset();for(var a=A(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.g&&c!==this.a&&c.reset&&c.reset()}this.xa(-1)};
h.start=function(a,b){for(var c=A(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.xa(-1)};h.stop=function(a,b){for(var c=A(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.xa(-1)};
h.xa=function(a){if(this.a){var b=this.a,c=b.o.speed;c&&(c.textContent=b.j.P&&b.pa?b.pa.toFixed(2)+"Mhz":"Stopped")}if(this.A&&(b=this.A,b.s)){var c=b.a.j.P,d=!!(b.a.u&4);if(!(0<a&&60>(b.w+=a))){for(var e=0;e<b.a.h.length;e++)kb(b,"R"+e,b.a.h[e]);e=Yb(b.a);kb(b,"PS",e);kb(b,"NF",e&8?1:0,1);kb(b,"ZF",e&4?1:0,1);kb(b,"VF",e&2?1:0,1);kb(b,"CF",e&1?1:0,1);b.w=0}sb(b,0<a&&c&&!d?b.a.h[7]:b.da);rb(b,b.m);a=b.a.Ba?b.a.Fa&16?1:2:4;tb(b,"B22",a&1);tb(b,"B18",a&2);tb(b,"B16",a&4)}};
h.Z=function(a,b,c){var d=this;switch(b){case "power":return this.o[b]=c,c.onclick=function(){d.l||(d.j.O?dg(d,!1,!0):Wf(d,d.Ya))},!0;case "reset":return this.o[b]=c,c.onclick=function(){if(d.j.O&&!d.l)if(d.b&&!d.m){var a=ua("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");dg(d,a,!0);!a&&d.C?window&&window.location.reload():(a||(d.Kb=!0),d.Ya(Sf),d.Kb=!1)}else d.reset(),d.a&&d.a.Va()},!0;case "save":if(ma(v(),"pcjs.org"))c.parentNode.removeChild(c);
h.Z=function(a,b,c){var d=this;switch(b){case "power":return this.o[b]=c,c.onclick=function(){d.l||(d.j.N?dg(d,!1,!0):Wf(d,d.Ya))},!0;case "reset":return this.o[b]=c,c.onclick=function(){if(d.j.N&&!d.l)if(d.b&&!d.m){var a=ua("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");dg(d,a,!0);!a&&d.C?window&&window.location.reload():(a||(d.Kb=!0),d.Ya(Sf),d.Kb=!1)}else d.reset(),d.a&&d.a.Va()},!0;case "save":if(ma(v(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.o[b]=c,c.onclick=function(){var a=Tf(d,!0);if(a){var b=!!(d.b&&!d.m||d.C),c=dg(d,b);b?eg(d,a,c):d.G("Resume disabled, machine state not saved")}},!0}return!1};
function Tf(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=fg(a,c))||a.G("The user ID is invalid.")):b&&a.G("Browser local storage is not available"));return c}
function fg(a,b){a.c=null;b=r(v()+"/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){t(d.message+" ("+c+")")}return a.c}function Vf(a){var b=null;a.c&&(b=v()+"/api/v1/user?req=load&user="+a.c+"&state="+gg(a,"1.30.3"));return b}
function eg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=gg(a,"1.30.3");d.data=c;b=r(v()+"/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.G("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.G(c),za("user",""),a.c=null)}}
function mf(a){var b;a=A(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 xc(a){if(a.Wa){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Wa.focus();window&&window.scrollTo(b,c)}}Ga(function(){for(var a=E(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=B(c),c=E(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=B(f),g=new Qf(g,d,!0);C(g,f);g.w&&Wf(g,g.Ya)}});
Ba.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=Ta("Computer",c.id))&&c.R&&!c.j.O&&c.Ya(-1)}});Ba.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=Ta("Computer",c.id))&&c.j.O&&dg(c,!(!c.b||c.m),!0)}});function O(a,b,c){this.id=a.id;this.key=gg(a,b,c);this.F=a.F;$f(this,a.mc)}function gg(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}
Ba.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=Ta("Computer",c.id))&&c.R&&!c.j.N&&c.Ya(-1)}});Ba.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=Ta("Computer",c.id))&&c.j.N&&dg(c,!(!c.b||c.m),!0)}});function O(a,b,c){this.id=a.id;this.key=gg(a,b,c);this.F=a.F;$f(this,a.mc)}function gg(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){$f(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 $f(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function ag(a){var b=!0;if(wa()){var c=JSON.stringify(a[a.id]);za(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Yf(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Uf(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:wa()&&(b=ya(a.key))?(a[a.id]=b,a.a=!0):!1}var hg=0;
function ig(a,b,c,d,e,f){e("Loading "+a+"...");r(a,null,!0,function(g,k,l){l?(k||(k="unable to load "+a+" ("+l+")"),f(k,null)):jg(k,a,b,c,d,e,f)})}