pcjs/versions/pdpjs/1.30.2/pdp11.js

240 lines
86 KiB
JavaScript

(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
http://pcjs.org/modules/shared/lib/keys.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/weblib.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/messages.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/debugger.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/debugger.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/embed.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/component.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/defines.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/panel.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/bus.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/device.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/memory.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/cpu.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/cpustate.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/cpuops.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/rom.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/ram.js (C) Jeff Parsons 2012-2016
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 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,,254],184320:[40,1,9,,252],327680:[40,2,8,,255],368640:[40,2,9,,253],737280:[80,2,9,,249],1228800:[80,2,15,,249],1474560:[80,2,18,,240],2949120:[80,2,36,,240],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 k(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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};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 r(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 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 m="",p;for(p in b)b.hasOwnProperty(p)&&(m&&(m+="&"),m+=p+"="+encodeURIComponent(b[p]));m=m.replace(/%20/g,"+");l.open("POST",a,!!c);l.setRequestHeader("Content-type","application/x-www-form-urlencoded");l.send(m)}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),g=[f,e]);return g}
function ta(a,b){var c,d={L:null,W:null,fa:null,ea: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.fa=g.load;d.ea=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.W=g.symbols;d.L.length?1==d.L.length&&(t(d.L[0]),d=null):(t("Empty resource: "+a),d=null)}catch(l){t("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)){t("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.L=e)}return d}
function v(){return"http://"+(window?window.location.host:"www.pcjs.org")}function t(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 w={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){w.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){w[a]&&Ha(w[a])}Fa("onload",function(){Ca=!0;Ha(w.init)});Fa("onpageshow",function(){Da=!0;Ha(w.show)});
Fa(Ba("Opera")||Ba("iOS")?"onunload":"onbeforeunload",function(){Ha(w.exit)});function x(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Lb=b.comment;this.jc=b;b=this.id.indexOf(".");0>b?this.Na=this.id:(this.na=this.id.substr(0,b),this.Na=this.id.substr(b+1));this[a]=c;this.l={ready:!1,lb:!1,Xd:!1,P:!1,error:!1};this.hb=null;this.l.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 A(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 B(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 C(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(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 l=g.split(" "),m=0;m<l.length;m++)switch(g=l[m],g){case "pdp11-binding":(g=C(f))&&g.binding&&a.Z(g.type,g.binding,f,g.value),m=l.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.Ta=this.o[b]=c,c.value="",this.U=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.U(a,this.Na)}),!0;default:return!1}},log:function(){},U:function(){},status:function(a){this.U(this.Na+": "+a)},C:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},ja:function(){return this.l.P=!0},ia:function(a,b){b&&(this.l.P=!1);return!0}};function F(a,b){a.l.error||(a.l.ready=!1!==b,a.l.ready&&(b=a.hb,a.hb=null,b&&b()))}function Ua(a,b){b&&(a.l.ready?b():a.hb=b);return a.l.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});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 Va="undefined"!==typeof ArrayBuffer;function Wa(a){x.call(this,"Panel",a,Wa);this.b=0;this.l.Fb=!0}A(Wa);h=Wa.prototype;
h.Z=function(a,b,c,d){if(this.j&&this.j.Z(a,b,c,d)||this.a&&this.a.Z(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.o[b]=c,this.b++,!0;default:return"rled"==a?(this.o[b]=c,this.b++,!0):this.parent.Z.call(this,a,b,c,d)}};h.ha=function(a,b,c,d){this.j=a;this.h=b;this.a=c;this.F=d};h.ja=function(a,b){b||Xa();return!0};h.ia=function(){return!0};
function Ya(a,b,c,d){if(a.o[b]){void 0===c&&(a.l.error=!0,a.C("Value for "+b+" is invalid"),G(a.a));var e=a.F&&a.F.h||8;c=!a.a.l.da||a.l.Fb?8==e?ka(c,d):k(c,d):"--------".substr(0,d||4);a.o[b].textContent!=c&&(a.o[b].textContent=c)}}function Za(a,b,c,d){for(var e=0;e<d;e++){var f=a.o[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
h.ma=function(a){if(this.b&&(a||!this.a.l.da||this.l.Fb)){for(a=0;a<this.a.g.length;a++)Ya(this,"R"+a,this.a.g[a]);a=$a(this.a);Ya(this,"PS",a);Ya(this,"NF",a&8?1:0,1);Ya(this,"ZF",a&4?1:0,1);Ya(this,"VF",a&2?1:0,1);Ya(this,"CF",a&1?1:0,1);Za(this,"D",this.a.g[0],16);Za(this,"A",this.a.g[7],22)}};function Xa(){for(var a=!1,b=E(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=C(d),f=Sa(e.id);f||(a=!0,f=new Wa(e));D(f,d);a&&F(f)}}Ga(Xa);
function ab(a,b,c){x.call(this,"Bus",a,ab);this.a=b;this.F=c;this.K=a.busWidth||16;this.s=0;this.J=[];this.A=null;this.D=Math.pow(2,this.K);this.i=this.D-1|0;this.b=H;this.c=Math.log2(this.b);this.G=this.b>>2;this.j=this.b-1;this.w=this.D/this.b|0;this.xa=[];this.f=0;this.m=!1;this.v=[];this.ac=[bb,cb,db,eb];a=new I(this);fb(a,this.F);this.h=Array(this.w);for(b=0;b<this.w;b++)this.h[b]=a;F(this)}A(ab);var H=8192,gb=H-1;
function bb(a,b){var c=-1,d=this.controller,e=d.xa[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.xa[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);return 0<=c?c:c=hb(d,b)}function cb(a,b,c){var d=!1,e=this.controller,f=e.xa[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.xa[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d||hb(e,c)}
function db(a,b){var c=-1,d=this.controller;(a=d.xa[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));return 0<=c?c:c=hb(d,b)}function eb(a,b,c){var d=!1,e=this.controller;if(a=e.xa[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||hb(e,c)}function ib(a,b){if(b!=a.s){var c;a.s&&(c=(1<<a.s)-H,jb(a,c,H,a.J),a.s=0);b&&(a.s=b,c=(1<<b)-H,a.J=kb(a,c,H),a.A?jb(a,c,H,a.A):(lb(a,c,H,mb,a),a.A=kb(a,c,H)))}}h=ab.prototype;
h.reset=function(){for(var a=0;a<this.v.length;a++)this.v[a]();ib(this,16)};function hb(a,b){a.f||(a.a.I|=16,J(a.a,4,b));return 0}h.ja=function(a,b){b||this.reset();return!0};
function lb(a,b,c,d,e){for(var f=b,g=c,l=f>>>a.c;0<g&&l<a.h.length;){var m=a.h[l],p=l*a.b,q=a.b-(f-p);q>g&&(q=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.Ha)return m.jb+=m.Ha-f,m.Ha=f,!0;if(f>=m.Ha+m.jb){q=m.size-(f-p);q>g&&(q=g);m.jb=f-m.Ha+q;f=p+a.b;g-=q;l++;continue}}return nb(1,f,g)}f=new I(a,f,q,a.b,d,e);fb(f,a.F,m);a.h[l++]=f;f=p+a.b;g-=q}if(0>=g){c/=1024;var u;e="";u?10<u&&(u=10):u=c&-65536?10:5;if(null==c||isNaN(c))for(;0<u--;)e="?"+e;else for(;0<u--;)e=String.fromCharCode(c%10+48)+e,c/=
10;a.status(e+"Kb "+ob[d]+" at "+ka(b));return!0}return nb(2,b,c)}function kb(a,b,c){var d=[];for(b>>>=a.c;0<c&&b<a.h.length;)d.push(a.h[b++]),c-=a.b;return d}function jb(a,b,c,d){var e=0;for(b>>>=a.c;0<c&&b<a.h.length;){var f=d[e++];if(!f)break;a.h[b++]=f;c-=a.b}}function pb(a,b){return a.h[(b&a.i)>>>a.c].vb(b&a.j,b)}function qb(a,b){return a.h[(b&a.i)>>>a.c].V(b&a.j,b)}h.qb=function(a){var b=a&this.j,c=(a&this.i)>>>this.c;this.m=!1;this.f++;a=this.h[c].Rb(b,a);this.f--;return a};
h.Va=function(a,b){this.m=!1;this.f++;this.h[(a&this.i)>>>this.c].Db(a&this.j,b&255,a);this.f--};function rb(a,b,c){a.h[(b&a.i)>>>a.c].kb(b&a.j,c&65535,b)}h.zb=function(a,b){var c=a&this.j,d=(a&this.i)>>>this.c;this.m=!1;this.f++;this.h[d].Zb(c,b&65535,a);this.f--};
function sb(a){for(var b=0,c=[],d=0;d<a.w;d++){var e=a.h[d];if(e.sa||e.fc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,l=0,m=[];g<e.length;){for(var p=e[g],q=g+1;q<e.length&&e[q]===p;)q++;m[l++]=q-g;m[l++]=p;g=q}m.length<e.length&&(e=m)}c[f]=e}}return c}function tb(a,b,c,d,e,f,g,l){for(;b<=c;b+=2){var m=b&gb;void 0!==a.xa[m]?t("I/O address already registered: "+k(b,8,!0)):a.xa[m]=[d,e,f,g,l||"unknown",!1]}}
function ub(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.a.Za)){var g=f[0]?f[0].bind(b):null,l=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)),!l&&p&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));tb(a,e,e,g,l,m,p,f[4])}}}function vb(a,b){a.v.push(b)}function wb(a,b){a.f||J(a.a,4,b);a.m=!0}function xb(a){var b=a.m;a.m=!1;return b}
function nb(a,b,c){t("Memory block error ("+a+": "+k(b)+","+k(c)+")");return!1}function K(a){x.call(this,"Device",a,K);this.c={data:0,Td:0,ib:20,bd:0};this.b={M:0,Bb:-1}}A(K);h=K.prototype;h.ha=function(a,b,c,d){this.h=b;this.a=c;this.F=d;var e=this;this.b.Bb=yb(c,function(){e.b.za|=128;e.b.za&64&&(zb(e.a,e.b.cd),Ab(e.a,e.b.Bb,1E3/60))});this.b.cd=Bb(64,6);ub(b,this,L);vb(b,this.reset.bind(this));F(this)};h.reset=function(){this.c.ib=this.c.ib&-120|20;this.b.za=0};
h.tc=function(){var a=this.b.za;this.b.za&=-129;return a};h.nd=function(a){this.b.za=a;a&64&&Ab(this.a,this.b.Bb,1E3/60);this.b.za=a&-129};h.lc=function(a){return(a?this.c.bd:this.c.data)&65535};h.ed=function(a){this.c.data=a};h.vc=function(){var a=this.a;return a.w&62337|a.Xa<<5|a.Ya<<1};h.pd=function(a){var b=this.a;a&=62337;if(b.w!=a){b.w=a;b.Xa=a>>5&3;b.Ya=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ea!=c&&(b.Ea=c,Cb(b))}Db(this)};
h.wc=function(){var a=this.a.Aa;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.xc=function(){return this.a.xb};h.yc=function(){return this.a.Ba};h.qd=function(a){var b=this.a;1170>b.Za&&(a&=-49);b.Ba!=a&&(b.Ba=a,a&16?(b.tb=4194303,b.Wa=3915776):(b.tb=262143,b.Wa=253952),Cb(b));Db(this)};function Db(a){a.c.ib=a.c.ib&-8|(a.a.Ea?a.a.Ba&16?1:2:4)}h.Rc=function(a){return this.a.H[1][a>>1&7]};h.Jd=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.Pc=function(a){return this.a.H[1][(a>>1&7)+8]};
h.Hd=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};h.Qc=function(a){return this.a.X[1][a>>1&7]};h.Id=function(a,b){b=b>>1&7;this.a.X[1][b]=a;this.a.H[1][b]&=65295};h.Oc=function(a){return this.a.X[1][(a>>1&7)+8]};h.Gd=function(a,b){b=(b>>1&7)+8;this.a.X[1][b]=a;this.a.H[1][b]&=65295};h.sc=function(a){return this.a.H[0][a>>1&7]};h.md=function(a,b){this.a.H[0][b>>1&7]=a&65295};h.qc=function(a){return this.a.H[0][(a>>1&7)+8]};h.kd=function(a,b){this.a.H[0][(b>>1&7)+8]=a&65295};
h.rc=function(a){return this.a.X[0][a>>1&7]};h.ld=function(a,b){b=b>>1&7;this.a.X[0][b]=a;this.a.H[0][b]&=65295};h.pc=function(a){return this.a.X[0][(a>>1&7)+8]};h.jd=function(a,b){b=(b>>1&7)+8;this.a.X[0][b]=a;this.a.H[0][b]&=65295};h.Xc=function(a){return this.a.H[3][a>>1&7]};h.Pd=function(a,b){this.a.H[3][b>>1&7]=a&65295};h.Vc=function(a){return this.a.H[3][(a>>1&7)+8]};h.Nd=function(a,b){this.a.H[3][(b>>1&7)+8]=a&65295};h.Wc=function(a){return this.a.X[3][a>>1&7]};
h.Od=function(a,b){b=b>>1&7;this.a.X[3][b]=a;this.a.H[3][b]&=65295};h.Uc=function(a){return this.a.X[3][(a>>1&7)+8]};h.Md=function(a,b){b=(b>>1&7)+8;this.a.X[3][b]=a;this.a.H[3][b]&=65295};h.Ja=function(a){a&=7;return this.a.B&2048?this.a.Fa[a]:this.a.g[a]};h.La=function(a,b){b&=7;this.a.B&2048?this.a.Fa[b]=a:this.a.g[b]=a};h.Dc=function(){return this.a.B&49152?this.a.la[0]:this.a.g[6]};h.vd=function(a){this.a.B&49152?this.a.la[0]=a:this.a.g[6]=a};h.Gc=function(){return this.a.g[7]};
h.yd=function(a){this.a.g[7]=a};h.Ka=function(a){a&=7;return this.a.B&2048?this.a.g[a]:this.a.Fa[a]};h.Ma=function(a,b){b&=7;this.a.B&2048?this.a.g[b]=a:this.a.Fa[b]=a};h.Ec=function(){return 1==(this.a.B&49152)>>14?this.a.g[6]:this.a.la[1]};h.wd=function(a){1==(this.a.B&49152)>>14?this.a.g[6]=a:this.a.la[1]=a};h.Fc=function(){return 3==(this.a.B&49152)>>14?this.a.g[6]:this.a.la[3]};h.xd=function(a){3==(this.a.B&49152)>>14?this.a.g[6]=a:this.a.la[3]=a};h.nc=function(a){return this.a.Ub[a-65504>>1]};
h.gd=function(a,b){this.a.Ub[b-65504>>1]=a};h.Qb=function(a){return 65520==a?61183:0};h.Yb=function(){};h.Tc=function(){return 1};h.Ld=function(){};h.mc=function(){return this.a.I};h.fd=function(){this.a.I=0};h.uc=function(){return this.a.Tb};h.od=function(a,b){b&1||(a&=255);this.a.Tb=a};h.zc=function(a){return a?this.a.yb:0};h.rd=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.yb=a;b.u|=2};h.Sc=function(a){return a?this.a.Ca&65280:0};h.Kd=function(a){this.a.Ca=a|255};
h.Cc=function(){return $a(this.a)};h.ud=function(a){Eb(this.a,a&-1809|$a(this.a)&1808);this.a.u|=128};h.Xb=function(){};
var M={},L=(M[62592]=[null,null,K.prototype.Rc,K.prototype.Jd,"SISDR",1145],M[62608]=[null,null,K.prototype.Pc,K.prototype.Hd,"SDSDR",1145],M[62624]=[null,null,K.prototype.Qc,K.prototype.Id,"SISAR",1145],M[62640]=[null,null,K.prototype.Oc,K.prototype.Gd,"SDSAR",1145],M[62656]=[null,null,K.prototype.sc,K.prototype.md,"KISDR",1145],M[62672]=[null,null,K.prototype.qc,K.prototype.kd,"KDSDR",1145],M[62688]=[null,null,K.prototype.rc,K.prototype.ld,"KISAR",1145],M[62704]=[null,null,K.prototype.pc,K.prototype.jd,
"KDSAR",1145],M[62798]=[null,null,K.prototype.yc,K.prototype.qd,"MMR3",1145],M[65382]=[null,null,K.prototype.tc,K.prototype.nd,"LKS"],M[65400]=[null,null,K.prototype.lc,K.prototype.ed,"CNSL"],M[65402]=[null,null,K.prototype.vc,K.prototype.pd,"MMR0",1145],M[65404]=[null,null,K.prototype.wc,K.prototype.Xb,"MMR1",1145],M[65406]=[null,null,K.prototype.xc,K.prototype.Xb,"MMR2",1145],M[65408]=[null,null,K.prototype.Xc,K.prototype.Pd,"UISDR",1145],M[65424]=[null,null,K.prototype.Vc,K.prototype.Nd,"UDSDR",
1145],M[65440]=[null,null,K.prototype.Wc,K.prototype.Od,"UISAR",1145],M[65456]=[null,null,K.prototype.Uc,K.prototype.Md,"UDSAR",1145],M[65472]=[null,null,K.prototype.Ja,K.prototype.La,"R0SET0"],M[65473]=[null,null,K.prototype.Ja,K.prototype.La,"R1SET0"],M[65474]=[null,null,K.prototype.Ja,K.prototype.La,"R2SET0"],M[65475]=[null,null,K.prototype.Ja,K.prototype.La,"R3SET0"],M[65476]=[null,null,K.prototype.Ja,K.prototype.La,"R4SET0"],M[65477]=[null,null,K.prototype.Ja,K.prototype.La,"R5SET0"],M[65478]=
[null,null,K.prototype.Dc,K.prototype.vd,"R6KERNEL"],M[65479]=[null,null,K.prototype.Gc,K.prototype.yd,"R7KERNEL"],M[65480]=[null,null,K.prototype.Ka,K.prototype.Ma,"R0SET1",1145],M[65481]=[null,null,K.prototype.Ka,K.prototype.Ma,"R1SET1",1145],M[65482]=[null,null,K.prototype.Ka,K.prototype.Ma,"R2SET1",1145],M[65483]=[null,null,K.prototype.Ka,K.prototype.Ma,"R3SET1",1145],M[65484]=[null,null,K.prototype.Ka,K.prototype.Ma,"R4SET1",1145],M[65485]=[null,null,K.prototype.Ka,K.prototype.Ma,"R5SET1",1145],
M[65486]=[null,null,K.prototype.Ec,K.prototype.wd,"R6SUPER",1145],M[65487]=[null,null,K.prototype.Fc,K.prototype.xd,"R6USER",1145],M[65504]=[null,null,K.prototype.nc,K.prototype.gd,"CTRL",1170],M[65520]=[null,null,K.prototype.Qb,K.prototype.Yb,"LSIZE",1170],M[65522]=[null,null,K.prototype.Qb,K.prototype.Yb,"HSIZE",1170],M[65524]=[null,null,K.prototype.Tc,K.prototype.Ld,"SYSID",1170],M[65526]=[null,null,K.prototype.mc,K.prototype.fd,"CPUERR",1170],M[65528]=[null,null,K.prototype.uc,K.prototype.od,
"MB",1170],M[65530]=[null,null,K.prototype.zc,K.prototype.rd,"PIR"],M[65532]=[null,null,K.prototype.Sc,K.prototype.Kd,"SL"],M[65534]=[null,null,K.prototype.Cc,K.prototype.ud,"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];
Ga(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 K(c);D(c,d);break;case "pc11":c=new Fb(c);D(c,d);break;case "rl11":c=new N(c),D(c,d)}}});var Gb;if(Va){var Hb=new ArrayBuffer(2);(new DataView(Hb)).setUint16(0,256,!0);Gb=256===(new Uint16Array(Hb))[0]}else Gb=!1;var Ib=Gb;
function I(a,b,c,d,e,f){this.h=a;this.id=Jb+=2;this.a=null;this.Ha=b;this.jb=c;this.size=d||0;this.type=e||Kb;this.j=e==Lb;this.controller=null;fb(this);this.sa=this.fc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],Mb(this,f.ac);else if(Va)this.o=new ArrayBuffer(this.size),this.c=new DataView(this.o,0,this.size),this.b=new Uint8Array(this.o,0,this.size),this.s=new Uint16Array(this.o,0,this.size>>1),this.a=new Int32Array(this.o,0,this.size>>2),Mb(this,Ib?Nb:Ob);else{a=this.a=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;Mb(this,Pb)}else Mb(this)}var Kb=0,Lb=2,mb=4,ob=["NONE","RAM","ROM","VID","H/W"],Jb=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Va)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(Va)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.sa=!0}return!1},v:function(a,b){wb(this.h,b);return 255},f:function(a,b,c){wb(this.h,c)},w:function(a,b){return this.vb(a++,b++)|this.vb(a,
b)<<8},A:function(a,b,c){this.Cb(a++,b&255,c++);this.Cb(a,b>>8,c)},N:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},aa:function(a,b){a&1&&wb(this.h,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},qa:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.sa=!0},wa:function(a,b,c){a&1&&wb(this.h,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.sa=
!0},G:function(a,b){return this.J(a,b)},R:function(a,b){return this.Rb(a,b)},oa:function(a,b,c){this.j?this.f(a,b,c):this.Db(a,b,c)},ua:function(a,b,c){this.j?this.f(a,b,c):this.Zb(a,b,c)},D:function(a){return this.b[a]},K:function(a){return this.b[a]},O:function(a,b){a&1&&wb(this.h,b);return this.c.getUint16(a,!0)},$:function(a,b){a&1&&wb(this.h,b);return this.s[a>>1]},na:function(a,b){this.b[a]=b;this.sa=!0},pa:function(a,b){this.b[a]=b;this.sa=!0},ra:function(a,b,c){a&1&&wb(this.h,c);this.c.setUint16(a,
b,!0);this.sa=!0},va:function(a,b,c){a&1&&wb(this.h,c);this.s[a>>1]=b;this.sa=!0}};function fb(a,b,c){a.F=b;a.i=a.m=0;c&&((a.i=c.i)&&Qb(a,Rb,!1),(a.m=c.m)&&Sb(a,Rb,!1))}function Sb(a,b,c){c&&a.m||(a.Cb=!a.j&&b[1]||a.f,a.kb=!a.j&&b[3]||a.A);if(c||void 0===c)a.Db=b[1]||a.f,a.Zb=b[3]||a.A}function Qb(a,b,c){c&&a.i||(a.vb=b[0]||a.v,a.V=b[2]||a.w);if(c||void 0===c)a.J=b[0]||a.v,a.Rb=b[2]||a.w}function Mb(a,b){b||(b=Tb);Qb(a,b,void 0);Sb(a,b,void 0)}
var Tb=[],Pb=[I.prototype.N,I.prototype.qa,I.prototype.aa,I.prototype.wa],Rb=[I.prototype.G,I.prototype.oa,I.prototype.R,I.prototype.ua];if(Va)var Ob=[I.prototype.D,I.prototype.na,I.prototype.O,I.prototype.ra],Nb=[I.prototype.K,I.prototype.pa,I.prototype.$,I.prototype.va];
function Ub(a,b){x.call(this,"CPU",a,Ub);var c=a.multiplier||1;this.eb=a.cycles||b;this.qa=c;this.rb=Math.round(this.eb/1E4)/100;this.ua=this.rb*this.qa;this.l.da=!1;this.l.Ab=!1;this.l.Sa=a.autoStart;this.l.bb=!1;this.ab=this.wa=0;this.cb=a.csStart;this.Oa=a.csInterval;this.Pa=a.csStop;this.J=[];this.Pb=this.ad.bind(this);F(this)}A(Ub);var Vb=["power","reset"];h=Ub.prototype;
h.ha=function(a,b,c,d){this.j=a;this.h=b;this.F=d;for(b=0;b<Vb.length;b++)(c=this.o[Vb[b]])&&this.j.Z(null,Vb[b],c);a=Wb(a,"autoStart");null!=a&&(this.l.Sa="true"==a?!0:"false"==a?!1:!!a);F(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.ja=function(a,b){if(!b){if(a&&this.restore){Xb(this);if(!this.restore(a))return!1;$b(this)}else this.reset();this.U("No debugger detected")}this.j.ma();return!0};h.ia=function(a){return a?this.save():!0};
h.Sa=function(){return this.l.Sa||void 0===this.o.run?(ac(this),!0):!1};h.Ib=function(){return 0};function $b(a){void 0===a.cb&&(a.cb=0);void 0===a.Oa&&(a.Oa=-1);void 0===a.Pa&&(a.Pa=-1);a.l.bb=0<=a.cb&&0<a.Oa;a.l.bb&&(a.ab=0,a.wa=a.cb-a.N)}
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.j)if(a=d.j,a.l.P)a=!0;else{var b=null,c,l=B(a.id);for(c=0;c<l.length&&(b=l[c],b===a||b.l.ready);c++);if(c==l.length)for(c=0;c<l.length&&(b=l[c],b===a||b.l.P);c++);c==l.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.l.ready?"powered yet":"ready yet"+(b.hb?" (waiting for notification)":""))+".");a=!1}a&&(d.l.da?G(d):ac(d))},!0;case "speed":return this.o[b]=
c,!0;case "setSpeed":return this.o[b]=c,c.onclick=function(){bc(d,d.qa<<1,!0)},c.textContent=this.ua.toFixed(2)+"Mhz",!0}return!1};h.ma=function(){var a=this.o.speed;a&&(a.textContent=this.l.da&&this.oa?this.oa.toFixed(2)+"Mhz":"Stopped")};function cc(a,b){var c=1;b&&1<a.qa&&a.oa&&(c=a.oa/a.rb);a.Mb=Math.round(1E3/30);a.gb=Math.floor(a.eb/30*c);b||(a.Qa=a.gb);a.ub=0}function dc(a){return a.N+a.aa+a.va-a.a}function Xb(a){a.oa=0;a.Ob=0;a.N=a.aa=a.va=a.a=a.G=0;$b(a);bc(a,1)}
function bc(a,b,c){if(void 0!==b){.8>a.oa/a.ua&&(b=1);a.qa=b;b=a.rb*a.qa;if(a.ua!=b){a.ua=b;b=a.ua.toFixed(2)+"Mhz";var d=a.o.setSpeed;d&&(d.textContent=b);a.U("target speed: "+b)}c&&a.j&&ec(a.j)}a.N+=a.aa;a.aa=0;a.$=ra();a.pa=0;cc(a)}function yb(a,b){var c=a.J.length;a.J.push([-1,b]);return c}function Ab(a,b,c){0<=b&&b<a.J.length&&0>a.J[b][0]&&(c=a.eb*a.qa/1E3*c|0,a.J[b][0]=c+fc(a))}function fc(a,b){var c=a.va-=a.a;a.a=a.G=0;b&&(a.va=0);return c}
h.ad=function(){if(this.l.da){this.ub>=this.eb&&cc(this,!0);this.Ra=0;this.$a=ra();if(this.pa){var a=this.$a-this.pa;a>this.Mb&&(this.$+=a,this.$>this.$a&&(this.$=this.$a))}try{do{for(var b,c=this.l.bb?1:this.gb,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.Wb(b)}catch(m){if("number"!=typeof m)throw m;}b=fc(this,!0);this.Ra+=b;this.aa+=b;a=b;if(this.l.bb){var f=!1;this.ab=this.ab+this.Ib()|0;this.wa-=a;0>=this.wa&&(this.wa+=this.Oa,f=!0);0<=this.Pa&&this.Pa<=dc(this)&&
(this.Oa=this.Pa=-1,$b(this),G(this),f=!0);f&&this.U(dc(this)+" cycles: checksum="+k(this.ab))}for(var a=b,g=this.J.length-1;0<=g;g--){var l=this.J[g];0>l[0]||(l[0]-=a,0>=l[0]&&(l[0]=-1,l[1]()))}this.Qa-=b;if(0>=this.Qa){this.Qa+=this.gb;15<=++this.Ob&&(this.j&&this.j.ma(),this.Ob=0);break}}while(this.l.da)}catch(m){G(this);this.j&&this.j.stop(ra(),dc(this));b=m.stack||m.message;this.l.error=!0;this.C(b);return}if(this.l.da){b=setTimeout;c=this.Pb;this.pa=ra();d=this.Mb;this.Ra&&(d=Math.round(d*this.Ra/
this.gb));d-=this.pa-this.$a;if(e=this.pa-this.$)this.oa=Math.round(this.aa/(10*e))/100,864E5<=e&&(this.N=0,bc(this));if(0>d||this.oa<this.ua)-1E3>d&&(this.$-=d),d=0;this.ub+=this.Ra;this.pa+=d;b(c,d)}}};function ac(a){var b;a.l.error?(a.U(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.l.da)a.U(a.toString()+" busy");else{bc(a);a.l.da=!0;a.l.Ab=!0;if(b=a.o.run)b.textContent="Halt";a.j&&a.j.start(a.$,dc(a));setTimeout(a.Pb,0)}}h.Wb=function(){return 0};
function G(a){var b=!1;if(a.l.da){fc(a);a.N+=a.aa;a.aa=0;a.l.da=!1;if(b=a.o.run)b.textContent="Run";a.j&&a.j.stop(ra(),dc(a));b=!0}a.l.complete=void 0;return b}function gc(a){this.Za=+a.model||1170;this.Kb=a.addrReset||0;Ub.call(this,a,6666667);this.decode=1120==this.Za?hc.bind(this):ic.bind(this);jc(this);this.ra=0;this.O=null;this.l.complete=!1}A(gc,Ub);h=gc.prototype;h.reset=function(){this.status("model "+this.Za);this.l.da&&G(this);jc(this);Xb(this);this.l.error=!1;this.parent.reset.call(this)};
function jc(a){a.m=65536;a.f=32768;a.i=65535;a.s=32768;a.B=15;a.g=[0,0,0,0,0,0,0,a.Kb];a.Fa=[0,0,0,0,0,0];a.la=[0,0,0,0];a.v=0;a.Ya=0;a.ic=[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.kc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.Ub=[0,0,0,0,0,0,0,0];a.Tb=0;a.u=0;a.A=a.D=0;a.c=a.b=a.pb=0;a.Ga=-1;kc(a)}function kc(a){a.Ca=255;a.I=0;a.yb=0;a.w=0;a.Aa=0;a.xb=0;a.Ba=0;a.Ea=0;a.Xa=0;a.tb=262143;a.Wa=253952;a.O=null;a.h&&Cb(a)}function Cb(a){a.Ea?(a.R=65536,a.K=a.hc,a.V=a.Yc,a.kb=a.Qd,ib(a.h,a.Ba&16?22:18)):(a.R=0,a.K=a.gc,a.V=a.Sb,a.kb=a.$b,ib(a.h,16))}function lc(a,b,c){a.Kb=b;O(a,b);!c&&a.F&&(G(a)||a.F.ma())}h.Ib=function(){return 0};
h.save=function(){var a=new P(this);a.set(0,[]);a.set(1,[this.N,this.qa]);a.set(2,sb(this.h));return a.data()};h.restore=function(a){var b=a[1];this.N=b[1];bc(this,b[3]);a:{b=this.h;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.G){for(var f=0,g=Array(b.G),l=0;l<e.length-1;)for(var m=e[l++],p=e[l++];m--;)g[f++]=p;e=g}f=b.h[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Q(a){return a.m&65536?1:0}
h.ya=function(){return this.s&32768?8:0};function mc(a){var b=a.g[7];a.w&57344||(a.Aa=0,a.xb=b);a.g[7]=b+2&65535;return a.V(b)}function nc(a,b){var c=a.g[7];a.g[7]=c+b&65535;return c}function O(a,b){a.g[7]=b&65535}function Bb(a,b){return{dd:a,Ia:b,next:null}}function zb(a,b){if(b!=a.O){var c=a.O;if(!c||c.Ia<=b.Ia)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.Ia<=b.Ia){b.next=d;c.next=b;break}c=d}while(c)}}a.u|=2}function $a(a){return a.B=a.B&63728|a.ya()|(a.i&65535?0:4)|(a.f&32768?2:0)|Q(a)}
function Eb(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.Fa.length;0<=--c;){var d=a.g[c];a.g[c]=a.Fa[c];a.Fa[c]=d}a.v=b>>14&3;c=a.B>>14&3;a.v!=c&&(a.la[c]=a.g[6],a.g[6]=a.la[a.v]);a.B=b;a.u|=2}function R(a,b){a.u&128||(a.s=a.i=b,a.f=0)}function oc(a,b,c){a.u&128||(a.s=a.i=a.m=b,a.f=c||0)}function pc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.f=(c^b)&(d^b))}function qc(a,b){a.u&128||(a.s=a.i=a.m=b,a.f=a.s^a.m>>1)}function rc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.f=(c^d)&(d^b))}
function J(a,b,c){if(!a.ra){var d=!1;0>a.Ga?a.Ga=$a(a):a.v||(b=4,d=!0);a.w&57344||(a.Aa=63222,a.xb=b);a.v=0;var e=a.V(b|a.R),f=a.V(b+2&65535|a.R);Eb(a,f&-12289|a.Ga>>2&12288);d&&(a.I|=4,a.g[6]=4);sc(a,a.Ga);sc(a,a.g[7]);O(a,e);a.u&=-113;a.Ga=-1;a.u|=8;if(26!=c)throw b;}}function tc(a){var b=uc(a),c=uc(a)&-1793;a.B&49152&&(c=c&-225|a.B&63712);O(a,b);Eb(a,c);a.u&=-17}
function vc(a,b){var c=b>>13&31;31>c?a.Ba&32&&(b=a.kc[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b}
function wc(a,b,c){var d,e,f,g=0;d=b>>13;a.Ba&a.ic[a.v]||(d&=7);e=a.H[a.v][d];f=(a.X[a.v][d]<<6)+(b&8191)&a.tb;f<a.Wa?f&1&&!(c&1)&&(a.I|=64,J(a,4,10)):(a.Ba&16||253952<=f&&(f|=4186112),4186112>f&&(3932160<=f&&(f=vc(a,f&262143)),f>=a.Wa&&4186112>f&&(a.I|=32,J(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.Xa=a.v,a.Ya=d;g&&(g&57344&&(0<=a.Ga&&(g|=128),a.w&57344||(a.w=a.w|g|a.Xa<<5|a.Ya<<1),J(a,168,16)),a.w&61440||!(4191360>f||4194239<f)||(a.w|=4096,a.w&512&&(a.u|=32)));return f}function xc(a,b,c){b&1&&a.a--;a=a.h;a.h[(b&a.i)>>>a.c].Cb(b&a.j,c&255,b)}function uc(a){var b=a.V(a.g[6]|a.R);a.g[6]=a.g[6]+2&65535;return b}
function sc(a,b){var c=a.g[6]-2&65535;a.g[6]=c;a.w&57344||(a.Aa=a.Aa<<8|246);!a.v&&c<=a.Ca&&4<c&&(c<=a.Ca-32?(a.I|=4,a.g[6]=4,J(a,4,18)):(a.I|=8,a.u|=4));a.kb(c,b)}
function yc(a,b,c,d){var e,f,g=d&8?0:a.R;switch(b){case 0:return J(a,4,20),0;case 1:return 6===c&&!a.v&&d&4&&(a.g[6]<=a.Ca||65534<=a.g[6])&&(a.g[6]<=a.Ca-32||65534<=a.g[6]?(a.I|=4,a.g[6]=4,J(a,4,22)):(a.I|=8,a.u|=64)),a.a-=3,7===c?a.g[c]:a.g[c]|g;case 2:f=2;e=a.g[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.g[c];7!==c&&(e|=g);e=a.V(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.g[c]+f&65535;7!==c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.g[c]-2&65535;7!==c&&(e|=g);e=a.V(e)|g;a.a-=
8;break;case 6:return e=a.V(nc(a,2)),e=e+a.g[c]&65535|g,a.a-=6,e;case 7:return e=a.V(nc(a,2)),e=e+a.g[c]&65535,e=a.V(e|a.R)|g,a.a-=10,e}a.g[c]=a.g[c]+f&65535;!g||a.w&57344||(a.Aa=a.Aa<<8|f<<3&248|c);6==c&&!a.v&&d&4&&0>=f&&(a.g[6]<=a.Ca||65534<=a.g[6])&&(a.g[6]<=a.Ca-32?(a.I|=4,a.g[6]=4,J(a,4,24)):(a.I|=8,a.u|=64));return e}h.qb=function(a){if(!this.Ea)return this.h.qb(a);this.ra++;a=this.Sb(wc(this,a,2));this.ra--;return a};
h.Va=function(a,b){this.Ea?(this.ra++,xc(this,wc(this,a,5),b),this.ra--):this.h.Va(a,b)};h.zb=function(a,b){this.Ea?(this.ra++,this.$b(wc(this,a,4),b),this.ra--):this.h.zb(a,b)};h.gc=function(a,b,c){return yc(this,a,b,c)};h.hc=function(a,b,c){return wc(this,yc(this,a,b,c),c)};h.Sb=function(a){return qb(this.h,a)};h.Yc=function(a){return qb(this.h,wc(this,a,2))};h.$b=function(a,b){rb(this.h,a,b&65535)};h.Qd=function(a,b){rb(this.h,wc(this,a,4),b)};
function zc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=yc(a,b,d,2),c&65536||61440!==(a.B&61440)&&(d&=65535),a.v=a.B>>12&3,c=a.V(d|c&a.R),a.v=a.B>>14&3):c=6!=d||(a.B>>2&12288)===(a.B&12288)?a.g[d]:a.la[a.B>>12&3];return c}function Ac(a,b,c,d){a.w&57344||(a.Aa=22);var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=yc(a,b,e,4),c&65536||(e&=65535),a.v=a.B>>12&3,e=wc(a,e|c&65536,4),a.v=a.B>>14&3,rb(a.h,e,d)):6!=e||(a.B>>2&12288)===(a.B&12288)?a.g[e]=d:a.la[a.B>>12&3]=d}
function Bc(a,b){b>>=6;var c=a.D=b&7;(b=a.A=(b&56)>>3)?(c=a.K(b,c,3),a=pb(a.h,c)):a=a.g[c]&255;return a}function Cc(a,b){b>>=6;var c=a.D=b&7;return(b=a.A=(b&56)>>3)?qb(a.h,a.K(b,c,2)):a.g[c]}function Dc(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return yc(a,b,c,8)}function Ec(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.K(b,c,3),a=pb(a.h,c)):a=a.g[c]&255;return a}function Fc(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?qb(a.h,a.K(b,c,2)):a.g[c]}
function T(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.pb=a.K(b,e,7),xc(a,e,d.call(a,c,pb(a.h,e)))):a.g[e]=a.g[e]&65280|d.call(a,c,a.g[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),rb(a.h,e,d.call(a,c,qb(a.h,e)))):a.g[e]=d.call(a,c,a.g[e])}function Gc(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?xc(a,a.K(b,e,5),c):a.g[e]=c?d&1?c<<24>>24&65535:a.g[e]&-256|c&255:a.g[e]&-256;return c}
function Hc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?rb(a.h,a.K(b,d,4),c):a.g[d]=c&65535;return c}function V(a,b,c){c&&(O(a,a.g[7]+(b<<24>>23)),a.a-=2);a.a-=3}
h.Wb=function(a){this.l.complete=!0;var b=a?this.l.Ab?0:1:-1;this.l.Ab=!1;this.va=this.a=a;do{if(this.u){this.u&112&&(this.u&32?J(this,168,28):this.u&64?J(this,4,30):this.u&16&&J(this,12,32),this.u&=-113);if(a=this.u&7){a=!1;if(this.u&2){this.u&=-3;var c=160,d=(this.yb&224)>>5,e=this.O&&this.O.Ia>d?this.O:null;e&&(c=e.dd,d=e.Ia);d>(this.B&224)>>5?(this.u&4&&(nc(this,2),this.u&=-5),J(this,c,26),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(mc(this))}while(0<this.a);return this.l.complete?this.va-this.a:void 0===this.l.complete?0:-1};Ga(function(){for(var a=E(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new gc(d);D(d,c)}});function Ic(a,b){var c=b+a;pc(this,c,a,b);return c&65535}function Jc(a,b){var c=b+a;pc(this,c<<8,a<<8,b<<8);return c&255}function Kc(a,b){a=b<<1;qc(this,a);return a&65535}
function Lc(a,b){a=b<<1;qc(this,a<<8);return a&255}function Mc(a,b){a=b&32768|b>>1|b<<16;qc(this,a);return a&65535}function Nc(a,b){a=b&2048|b>>1|b<<8;qc(this,a<<8);return a&255}function Oc(a,b){a=b&~a;R(this,a);return a}function Pc(a,b){a=b&~a;R(this,a<<8);return a}function Qc(a,b){a|=b;R(this,a);return a}function Rc(a,b){a|=b;R(this,a<<8);return a}function Sc(a,b){a=~b|65536;oc(this,a);return a&65535}function Tc(a,b){a=~b|256;oc(this,a<<8);return a&255}
function Uc(a,b){a=b-a;this.u&128||(this.s=this.i=a,this.f=b&(b^a));return a&65535}function Vc(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 Wc(a,b){a=b+a;this.u&128||(this.s=this.i=a,this.f=a&(b^a));return a&65535}function Xc(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 Yc(a,b){a=-b;oc(this,a,a&b&32768);return a&65535}function Zc(a,b){a=-b;oc(this,a<<8,(a&b&128)<<8);return a&255}
function $c(a,b){a=b<<1|this.m>>16&1;qc(this,a);return a&65535}function ad(a,b){a=b<<1|this.m>>16&1;qc(this,a<<8);return a&255}function bd(a,b){a=(this.m&65536|b)>>1|b<<16;qc(this,a);return a&65535}function cd(a,b){a=((this.m&65536)>>8|b)>>1|b<<8;qc(this,a<<8);return a&255}function dd(a,b){var c=b-a;rc(this,c,a,b);return c&65535}function ed(a,b){var c=b-a;rc(this,c<<8,a<<8,b<<8);return c&255}function fd(a,b){this.u&128||(this.s=this.i=b&65280,this.f=this.m=0);return(b<<8|b>>8)&65535}
function gd(a,b){a^=b;R(this,a);return a&65535}function hd(a){U(this,a,Cc(this,a),Ic);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function id(a){var b=Fc(this,a);a=a>>6&7;var c=this.g[a];c&32768&&(c|=4294901760);this.m=this.f=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.m=c<<17-b,c>>=b;else if(b)if(16<b)this.f=c,c=0;else{this.m=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.f=32768)}this.g[a]=c&65535;this.s=this.i=c;this.a-=(this.c?6:7)+b}
function jd(a){var b=Fc(this,a);a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.m=this.f=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.m=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.m=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.f=32768)):d=c;this.g[a]=d>>16&65535;this.g[a|1]=d&65535;this.s=d>>16;this.i=d>>16|d;this.a-=(this.c?6:7)+b}function kd(a){V(this,a,!Q(this))}function ld(a){V(this,a,Q(this))}
function md(a){U(this,a,Cc(this,a),Oc);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function nd(a){T(this,a,Bc(this,a),Pc);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function od(a){U(this,a,Cc(this,a),Qc);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function pd(a){T(this,a,Bc(this,a),Rc);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}
function qd(a){R(this,Cc(this,a)&Fc(this,a));this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}function rd(a){R(this,(Bc(this,a)&Ec(this,a))<<8);this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}function sd(a){V(this,a,this.i&65535?0:4)}function td(a){V(this,a,!this.ya()==!(this.f&32768))}function ud(a){V(this,a,!!(this.i&65535)&&!this.ya()==!(this.f&32768))}function vd(a){V(this,a,!Q(this)&&!!(this.i&65535))}
function wd(a){V(this,a,(this.i&65535?0:4)||!this.ya()!=!(this.f&32768))}function xd(a){V(this,a,Q(this)||(this.i&65535?0:4))}function yd(a){V(this,a,!this.ya()!=!(this.f&32768))}function zd(a){V(this,a,this.ya())}function Ad(a){V(this,a,!!(this.i&65535))}function Bd(a){V(this,a,!this.ya())}function Cd(){J(this,12,1);this.a-=5}function Dd(a){V(this,a,!0)}function Ed(a){V(this,a,!(this.f&32768))}function Fd(a){V(this,a,this.f&32768?2:0)}
function W(a){a&1&&(this.m=0);a&2&&(this.f=0);a&4&&(this.i=1);a&8&&(this.s=0);this.a-=5}function Gd(a){var b=Cc(this,a);a=Fc(this,a);rc(this,b-a,a,b);this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}function Hd(a){var b=Bc(this,a)<<8;a=Ec(this,a)<<8;rc(this,b-a,a,b);this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}
function Id(a){var b=Fc(this,a);if(b){a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.m=this.f=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.g[a]=d&65535,this.g[a|1]=c-d*b&65535,this.i=d>>16|d,this.s=d>>16):(this.f=32768,this.i=d>>15|d,this.s=c>>16,-1===b&&65534===this.g[a]&&(this.g[a]=this.g[a|1]=1));this.a-=53}else this.i=this.s=0,this.f=32768,this.m=65536,this.a-=7}function Jd(){J(this,24,2);this.a-=25}
function Kd(){this.B&49152?(this.I|=128,J(this,4,3)):this.F?this.F.b():G(this);this.a-=7}function Ld(){J(this,16,4);this.a-=25}var Md=[0,7,7,10,7,11,9,13];function Nd(a){this.G=this.a;O(this,Dc(this,a));this.a=this.G-Md[this.c]}var Od=[0,14,14,17,14,18,16,20];function Pd(a){this.G=this.a;var b=Dc(this,a);a=a>>6&7;sc(this,this.g[a]);this.g[a]=this.g[7];O(this,b);this.a=this.G-Od[this.c]}var Qd=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
function Rd(a){var b=Cc(this,a);this.G=this.a;R(this,Hc(this,a,b));this.a=this.G-Qd[(this.A?8:0)+this.c]+(7!=this.b||this.c?0:2)}function Sd(a){var b=Bc(this,a);R(this,Gc(this,a,b,1)<<8);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}var Td=[7,13,13,17,14,18,17,21];
function Ud(a){var b=Fc(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.g[a];c&32768&&(c|=-65536);b=~~(b*c);this.g[a]=b>>16&65535;this.g[a|1]=b&65535;this.u&128||(this.s=b>>16,this.i=this.s|b,this.f=0,this.m=-32768>b||32767<b?65536:0);this.a-=23}function Vd(){this.a-=5}function Wd(){this.B&49152||(kc(this),this.h.reset());this.a-=667}function Xd(){tc(this);this.u|=this.B&16;this.a-=13}
function Yd(a){if(a&8)J(this,8,6);else{var b=uc(this);a&=7;7==a?O(this,b):(O(this,this.g[a]),this.g[a]=b);this.a-=9}}function X(a){a&1&&(this.m=65536);a&2&&(this.f=32768);a&4&&(this.i=0);a&8&&(this.s=32768);this.a-=5}function Zd(a){var b=(a&448)>>6;if(this.g[b]=this.g[b]-1&65535)O(this,this.g[7]-((a&63)<<1)),this.a+=1;this.a-=6}function $d(a){U(this,a,Cc(this,a),dd);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}
function ae(a){U(this,a,0,fd);this.a-=this.c?9:3+(7==this.b?2:0)}function be(){J(this,28,5);this.a-=5}function ce(){this.u&4||this.j.ma();this.u|=4;nc(this,-2);this.a-=3}function de(a){U(this,a,Cc(this,a),gd);this.a-=this.c?9:3+(7==this.b?2:0)}function Y(){J(this,8,6)}function hc(a){ee[a>>12].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>>6&3].call(this,a)}function le(a){me[a&15].call(this,a)}function ne(a){oe[a&15].call(this,a)}
function pe(a){qe[a>>6&3].call(this,a)}function re(a){se[a>>6&3].call(this,a)}function te(a){ue[a>>6&3].call(this,a)}
var ee=[function(a){ve[a>>8&15].call(this,a)},Rd,Gd,qd,md,od,hd,Y,function(a){we[a>>8&15].call(this,a)},Sd,Hd,rd,nd,pd,$d,Y],ve=[function(a){xe[a>>4&15].call(this,a)},Dd,Ad,sd,td,yd,ud,wd,Pd,Pd,fe,he,je,Y,Y,Y],ge=[function(a){oc(this,Hc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Sc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,Wc);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)}],ie=[function(a){U(this,a,0,
Yc);this.a-=this.c?11:6},function(a){U(this,a,Q(this)?1:0,Ic);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,Q(this)?1:0,dd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Fc(this,a);oc(this,a);this.a-=this.c?4:3+(7==this.b?2:0)}],ke=[function(a){U(this,a,0,bd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,$c);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,Mc);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)}],
xe=[function(a){ye[a&15].call(this,a)},Y,Y,Y,Nd,Nd,Nd,Nd,Yd,Y,le,ne,ae,ae,ae,ae],ye=[Kd,ce,Xd,Cd,Ld,Wd,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y],me=[Vd,function(){this.m=0;this.a-=5},function(){this.f=0;this.a-=5},W,function(){this.i=1;this.a-=5},W,W,W,function(){this.s=0;this.a-=5},W,W,W,W,W,W,W],oe=[Vd,function(){this.m=65536;this.a-=5},function(){this.f=32768;this.a-=5},X,function(){this.i=0;this.a-=5},X,X,X,function(){this.s=32768;this.a-=5},X,X,X,X,X,X,X],we=[Bd,zd,vd,xd,Ed,Fd,kd,ld,Jd,be,pe,re,te,Y,Y,Y],qe=[function(a){oc(this,
Gc(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,Tc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,Xc);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)}],se=[function(a){T(this,a,0,Zc);this.a-=this.c?11:6},function(a){T(this,a,Q(this)?1:0,Jc);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,Q(this)?1:0,ed);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Ec(this,a);oc(this,a<<8);this.a-=this.c?4:3+(7==this.b?
2:0)}],ue=[function(a){T(this,a,0,cd);this.a-=this.c?9+(this.pb&1):3+(7==this.b?2:0)},function(a){T(this,a,0,ad);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,Nc);this.a-=this.c?9+(this.pb&1):3+(7==this.b?2:0)},function(a){T(this,a,0,Lc);this.a-=this.c?9:3+(7==this.b?2:0)}];function ic(a){ze[a>>12].call(this,a)}
var ze=[function(a){Ae[a>>8&15].call(this,a)},Rd,Gd,qd,md,od,hd,function(a){Be[a>>8&15].call(this,a)},function(a){Ce[a>>8&15].call(this,a)},Sd,Hd,rd,nd,pd,$d,Y],Ae=[function(a){De[a>>4&15].call(this,a)},Dd,Ad,sd,td,yd,ud,wd,Pd,Pd,fe,he,je,function(a){Ee[a>>6&3].call(this,a)},Y,Y],Ee=[function(a){a=this.g[7]+((a&63)<<1)&65535;var b=this.V(a|this.R);O(this,this.g[5]);this.g[6]=a+2&65535;this.g[5]=b;this.a-=8},function(a){a=zc(this,a,0);sc(this,a);R(this,a);this.a-=11},function(a){var b=uc(this);this.G=
this.a;Ac(this,a,0,b);R(this,b);this.a=this.G-Td[this.c]},function(a){R(this,Hc(this,a,this.ya?65535:0));this.a-=this.c?9:3+(7==this.b?2:0)}],De=[function(a){Fe[a&15].call(this,a)},Y,Y,Y,Nd,Nd,Nd,Nd,Yd,function(a){a&8?(this.B&49152||(this.B=this.B&-2017|(a&7)<<5,this.u|=1),this.a-=5):J(this,8,6)},le,ne,ae,ae,ae,ae],Fe=[Kd,ce,Xd,Cd,Ld,Wd,function(){tc(this);this.a-=13},Y,Y,Y,Y,Y,Y,Y,Y,Y],Be=[Ud,Ud,Id,Id,id,id,jd,jd,de,de,Y,Y,Y,Y,Zd,Zd],Ce=[Bd,zd,vd,xd,Ed,Fd,kd,ld,Jd,be,pe,re,te,function(a){Ge[a>>6&
3].call(this,a)},Y,Y],Ge=[Y,function(a){a=zc(this,a,65536);sc(this,a);R(this,a);this.a-=11},function(a){var b=uc(this);this.G=this.a;Ac(this,a,65536,b);R(this,b);this.a=this.G-Td[this.c]},Y];
function He(a){x.call(this,"ROM",a,He);this.W=this.b=null;this.i=a.addr;this.c=a.size;this.f=a.alias;this.j=a.file;this.m=n(this.j);if(this.j){a=this.j;var b=la(this.m);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.j+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?c.C("Unable to load ROM resource (error "+f+": "+a+")"):(Ra(c.na,a,b),(a=ta(a,b))?(c.b=a.L,c.W=a.W):c.j=null,Ie(c))})}}A(He);He.prototype.ha=function(a,b,c,d){this.h=b;this.a=c;this.F=d;Ie(this)};
He.prototype.ja=function(){this.W&&(this.F&&this.F.a(this.id,this.i,this.c,this.W),delete this.W);return!0};He.prototype.ia=function(){return!0};
function Ie(a){if(!Ua(a)){if(a.j){if(!a.b||!a.h)return;a.c||(a.c=a.b.length);if(a.b.length!=a.c){var b="ROM size ("+k(a.b.length,8,!0)+") does not match specified size ("+k(a.c,8,!0)+")";a.l.error=!0;a.C(b)}else{b=a.i;if(lb(a.h,b,a.c,Lb)){var c;for(c=0;c<a.b.length;c++)a.h.Va(b+c,a.b[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.f?b.push(a.f):null!=a.f&&a.f.length&&(b=a.f);for(c=0;c<b.length;c++){var d=a,e=b[c],f=kb(d.h,d.i,d.c);jb(d.h,e,d.c,f)}delete a.b}}}F(a)}}
Ga(function(){for(var a=E(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new He(d);D(d,c)}});
function Je(a){x.call(this,"RAM",a,Je);this.W=this.c=null;this.j=a.addr;this.i=a.size;this.fa=a.load;this.ea=a.exec;this.f=!1;this.b=a.file;this.m=n(this.b);if(this.b){a=this.b;var b=la(this.m);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?c.C("Unable to load RAM resource (error "+f+": "+a+")"):(Ra(c.na,a,b),(a=ta(a,b))?(c.c=a.L,c.W=a.W,null==c.fa&&(c.fa=a.fa),null==c.ea&&(c.ea=a.ea)):c.b=null,Ke(c))})}}A(Je);
Je.prototype.ha=function(a,b,c,d){this.h=b;this.a=c;this.F=d;Ke(this)};Je.prototype.ja=function(){this.W&&(this.F&&this.F.a(this.id,this.j,this.i,this.W),delete this.W);return!0};Je.prototype.ia=function(){return!0};function Ke(a){if(a.h&&(!a.f&&a.i&&lb(a.h,a.j,a.i,1)&&(a.f=!0),!Ua(a))){if(!a.f)t("No RAM allocated");else if(a.b){if(!a.c||!a.h)return;Le(a,a.c,a.fa,a.ea,a.j)}F(a)}}
Je.prototype.reset=function(){if(this.f){for(var a=this.h,b=this.j,c=this.i,d=b&a.j,b=b>>>a.c;0<c&&b<a.h.length;){var e=a.h[b],f=c,g,d=d||0;void 0===f&&(f=e.size);if(Va)for(g=d;f--&&g<e.b.length;g++)e.b[g]=0;else for(g=d;f--&&g<e.size;g++)e.Db(d,0,e.Ha+d);c-=a.b;b++;d=0}this.c&&Le(this,this.c,this.fa,this.ea,this.j,!0)}};
function Le(a,b,c,d,e,f){var g=!1;if(null==c)for(var l=0;l<b.length-1;){var m=b[l]&255|(b[l+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(l+6>=b.length)break;for(var l=l+2,p=b[l++]&255|(b[l++]&255)<<8,q=b[l++]&255|(b[l++]&255)<<8,m=m+((p&255)+(p>>8)+(q&255)+(q>>8)),u=l,z=p-=6;0<p&&l<b.length;)m+=b[l++]&255,p--;if(p||l>=b.length)break;m+=b[l++]&255;if(m&255)break;if(z)for(;z--;)a.a.Va(q++,b[u++]&255);else q&1?G(a.a):lc(a.a,q,f);g=!0}else l++;else l+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.a.Va(c+
e,b[e]);null!=d&&lc(a.a,d,f);g=!0}return g}Ga(function(){for(var a=E(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Je(d);D(d,c)}});function Me(a){x.call(this,"Keyboard",a,Me);F(this)}A(Me);Me.prototype.Z=function(){return!1};Me.prototype.ha=function(a,b,c,d){this.j=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=C(c),d=new Me(d);D(d,c)}});
function Z(a){this.D=a.baudReceive||9600;this.J=a.baudTransmit||9600;this.R=a.upperCase;this.f=this.m=null;this.K=a.tabSize;this.G=a.charBOL;this.s=0;x.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.m="";else{var c;a=Ne;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.Jb,receiveData:this.wb}}A(Z);var Ne="buffer";h=Z.prototype;
h.Z=function(a,b,c){var d=this;switch(b){case Ne: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.wb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.wb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.ha=function(a,b,c,d){this.j=a;this.h=b;this.a=c;this.F=d;var e=this;this.$=Bb(48,4);this.N=yb(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&&zb(e.a,e.$))});this.aa=Bb(52,4);this.O=yb(this.a,function(){e.c|=128;e.c&64&&zb(e.a,e.aa)});ub(b,this,Oe);F(this)};
h.Jb=function(){if(!this.v){var a=Wb(this.j,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.Na)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.na+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.ja=function(a,b){if(!b)if(this.Jb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.ia=function(a){return a?this.save():!0};h.reset=function(){Pe(this)};h.save=function(){var a=new P(this);a.set(0,[]);return a.data()};h.restore=function(){return Pe(this)};function Pe(a){a.w=0;a.b=0;a.c=128;a.i=[];return!0}h.wb=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);Ab(this.a,this.N,1E3/Math.round(this.D/10));return!0};h.Ic=function(){return this.b&65534};
h.Ad=function(a){this.b=this.b&-112|a&111};h.Hc=function(){this.b&=-129;0<this.i.length&&Ab(this.a,this.N,1E3/Math.round(this.D/10));return this.w};h.zd=function(){};h.$c=function(){return this.c};h.Sd=function(a){128==(this.c&192)&&a&64&&Ab(this.a,this.O,1E3/Math.round(this.J/10));this.c=this.c&-70|a&69};h.Zc=function(){return 0};
h.Rd=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.K||8,c=a-this.s%a,this.K&&(b=" ".slice(0,c)));this.G&&!this.s&&c&&(b=String.fromCharCode(this.G)+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.U(this.m),
this.m="";10!=a&&(this.m+=String.fromCharCode(a))}this.c&=-129;Ab(this.a,this.O,1E3/Math.round(this.J/10))}};var Qe={},Oe=(Qe[65392]=[null,null,Z.prototype.Ic,Z.prototype.Ad,"RCSR"],Qe[65394]=[null,null,Z.prototype.Hc,Z.prototype.zd,"RBUF"],Qe[65396]=[null,null,Z.prototype.$c,Z.prototype.Sd,"XCSR"],Qe[65398]=[null,null,Z.prototype.Zc,Z.prototype.Rd,"XBUF"],Qe);Ga(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 Fb(a){x.call(this,"PC11",a,Fb);this.c=a.autoMount||null;this.m=0;this.O=a.baudReceive||3600;this.w=this.A=this.b=0;this.v=[];this.s=Re;this.f=Se;this.D=this.i="";this.L=this.fa=this.ea=null;this.J=-1;this.G=!Ba("Mobi")&&window&&"FileReader"in window}A(Fb);var Re="",Se=0;h=Fb.prototype;
h.Z=function(a,b,c){var d=this,e=Se;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(m){t("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.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&&Te(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.G){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;Te(d,n(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.o[b]=c,!0}return!1};
h.ha=function(a,b,c,d){this.j=a;this.h=b;this.a=c;this.F=d;this.K=Ue(a);var e=this;if((this.c=Wb(this.j,"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.N=Bb(56,4);this.R=yb(this.a,function(){1==(e.b&32769)&&!(e.b&128)&&e.w<e.v.length&&(e.A=e.v[e.w++]&255,Ve(e,e.w/e.v.length*100),e.b|=128,e.b&=-2049,e.b&64&&zb(e.a,e.N))});ub(b,this,We);Xe(this,"None",Re,!0);this.G&&Xe(this,"Local Tape","?");
Xe(this,"Remote Tape","??");Ye(this)||F(this)};h.ja=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.ia=function(a){return a?this.save():!0};h.reset=function(){this.b&=-2241;this.A=0};function Ye(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=n(b,!0)}b&&c?Ze(a,c,b,1,!0):$e(a)}return!!a.m}
function Te(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.s="??"}else a.s=c;Ze(a,b,c,d,!1,e)}else af(a,!1)}function Ze(a,b,c,d,e,f){var g=-1;if(a.i.toLowerCase()!=c.toLowerCase()||a.f!=d)g++,af(a,!0),a.l.lb?a.C("PC11 busy"):(e&&a.m++,bf(a,b,c,d,f)?g++:a.l.lb=!0);g&&cf(a,a.D,a.i,a.f,a.L,a.fa,a.ea)}
function bf(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),cf(a,b,c,d,e),a.s="?");$e(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 l=0>g&&a.j&&!a.j.l.P;g?a.C('Unable to load tape "'+b+'" (error '+g+": "+e+")",l):(Ra(a.na,e,f),(e=ta(e,f))&&cf(a,b,c,d,e.L,e.fa,e.ea));
a.l.lb=!1;a.m&&(a.m--,a.m||F(a));$e(a)})}function Xe(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 $e(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 Ve(a,b){b|=0;if(b!==a.J){var c=a.o.readProgress;c&&(c=(c=E(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.J=b}}function cf(a,b,c,d,e,f,g){a.D=b;a.i=c;a.f=d;a.L=e;a.fa=f;a.ea=g;2==d?a.K&&Le(a.K,e,f,g)?a.status("tape loaded: "+b):(a.D="",a.i="",a.s=Re,a.f=Se,a.C("No load address available for tape: "+b)):(a.w=0,a.v=e,a.status("tape attached: "+b),Ve(a,0))}
function af(a,b){if(a.i||!1===b)a.D="",a.i="",b||(a.f&&a.status(1==a.f?"tape detached":"tape unloaded"),a.s=Re,a.f=Se,$e(a))}h.save=function(){return(new P(this)).data()};h.restore=function(){return!0};h.Bc=function(){return this.b&65534};h.td=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&zb(this.a,this.N)):(this.b&=-129,this.b|=2048,this.A=0,Ab(this.a,this.R,1E3/Math.round(this.O/10))));this.b=this.b&-66|a&65};h.Ac=function(){this.b&=-129;this.b|=2048;return this.A};h.sd=function(){};
var df={},We=(df[65384]=[null,null,Fb.prototype.Bc,Fb.prototype.td,"PRS"],df[65386]=[null,null,Fb.prototype.Ac,Fb.prototype.sd,"PRB"],df);function ef(a,b,c){x.call(this,"Disk",{id:a.na+".disk"+k(++ff,4)},ef);this.controller=a;this.j=a.j;this.F=a.F;this.f=b;this.ta=b.name;this.ob=b.ob;gf(this,c,b.T,b.Y,b.S,b.ga);F(this)}var ff=0;A(ef);h=ef.prototype;h.ha=function(a,b,c,d){this.F=d};
function gf(a,b,c,d,e,f){a.mode=b;a.T=c;a.Y=d;a.S=e;a.ga=f;a.a=[];if("preload"!=a.mode){b=Array(a.T);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]=hf(null,c,e,g,a.ga,0);d[e]=f}b[c]=d}a.a=b}a.b=null}
function jf(a,b,c,d,e){var f=c;if(a.h)return!0;a.ta=b;a.Da=c;a.Vb=n(c);a.h=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.T=e[0];a.Y=e[1];a.S=e[2];a.ga=e[3]||512;c=a.ga>>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.T);for(d=0;d<a.a.length;d++)for(var z=a.a[d]=Array(a.Y),S=0;S<z.length;S++)for(var ua=z[S]=Array(a.S),va=0;va<ua.length;va++){for(var Yb=hf(null,d,S,va+1,a.ga,0),Lf=Yb.data,Zb=0;Zb<c;Zb++,f+=4)var Mf=Lf[Zb]=b.getInt32(f,
!0),e=e+Mf&-1;Yb.ba=c;ua[va]=Yb}a.b=e;c=a}else a.C("Unrecognized disk format ("+d+" bytes)");a.h&&(a.h.call(a.controller,a.f,c,a.ta,a.Da),a.h=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.ob?"":e)+"&format=json"));return!!r(f,
null,!0,function(b,c,d){kf(a,b,c,d)})}
function kf(a,b,c,d){var e=null;a.c=!1;var f=0>d&&a.j&&!a.j.l.P;if(d)a.controller.C('Unable to load disk "'+a.ta+'" (error '+d+": "+b+")",f);else{Ra(a.controller.na,b,c);try{if(0<n(a.Vb,!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 l;"<"==c.substr(0,1)?l=["Missing disk image: "+a.ta]:l=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(l.length)if(1==l.length)t(l[0]);else{a.T=l.length;a.Y=l[0].length;a.S=l[0][0].length;var m=l[0][0][0];a.ga=m&&m.length||512;for(d=c=0;d<a.T;d++)for(f=0;f<a.Y;f++)for(g=0;g<a.S;g++)if(m=l[d][f][g]){var p=m.length;void 0===p&&(p=m.length=512);var p=p>>2,q=m.pattern;void 0===q&&(q=m.pattern=0);var u=m.data;if(void 0===u){var z=m.bytes;if(void 0!==z&&z.length){for(var S=p<<2,ua=z.length;ua<S;ua++)z[ua]=q;lf(m,z)}else u=[],q=m.pattern=q|q<<8|q<<16|q<<24,m.data=u;delete m.bytes}hf(m,d,f);for(S=
0;S<u.length;S++)c=c+u[S]&-1}a.a=l;a.b=c;e=a}else t("Empty disk image: "+a.ta)}catch(va){t("Disk image error ("+b+"): "+va.message)}}a.h&&(a.h.call(a.i,a.f,e,a.ta,a.Da),a.h=null)}function hf(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.Yd=b;a.Zd=c;a.ka=a.ba=0;a.sa=!1;return a}
h.seek=function(a,b,c,d,e){d=null;var f=this.f,g=this.a[a];if(g){var l=g[b];if(!l&&f.bc&&b<f.Y)for(l=g[b]=Array(f.cc),g=0;g<l.length;g++)l[g]=hf(null,a,b,g+1,f.Nb,0);if(l){for(g=0;g<l.length;g++)if(l[g]&&l[g].sector==c){d=l[g];break}!d&&f.bc&&9==f.Eb&&(d=l[g]=hf(null,a,b,f.Eb,f.Nb,0))}}e&&e(d,!1);return d};function lf(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}
h.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.c)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.ba?f<a.ka?(a.ba+=a.ka-f,a.ka=f):f>=a.ka+a.ba&&(a.ba+=f-(a.ka+a.ba)+1):(a.ka=f,a.ba=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
function mf(a,b){var c=a.Y*a.S,d=b/c|0;return d<a.T?(b%=c,a.seek(d,b/a.S|0,b%a.S+1)):null}function nf(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}h.save=function(){var a=0,b=[];b[a++]=[this.Da,this.b,this.T,this.Y,this.S,this.ga];if(!this.c)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.ba){for(var l=[],m=0,p=g.ka,q=g.ka+g.ba;p<q;)l[m++]=g.data[p++];b[a++]=[d,e,f,g.ka,l]}}return b};
h.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?gf(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.b&&e[1]!=this.b&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.b+")",b=-2));for(this.a.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],l=g[f++],m=g[f++],p=g[f++];if(l>=this.a.length||m>=this.a[l].length||p>=this.a[l][m].length){c="sector (CHS="+l+":"+m+":"+p+") out of range ("+
b+" changes applied)";b=-1;break}if(this.c){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(l=this.a[l][m][p]){for(m=l.data.length;m<e;)l.data[m++]=l.pattern;m=0;l.ka=e;for(l.ba=f.length;e<g;)l.data[e++]=f[m++];b++}}}0>b&&-2!=b&&this.controller.C("Unable to restore disk '"+this.ta+": "+c);return b};
h.toJSON=function(){var a;a=0;for(var b;b=mf(this,a++);)of(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 of(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 N(a){x.call(this,"RL11",a,N);this.f=a.autoMount||null;this.s=0;this.b=Array(1);this.A=!Ba("Mobi")&&window&&"FileReader"in window}A(N);h=N.prototype;
h.Z=function(a,b,c){var d=this;switch(b){case "listDisks":return this.o[b]=c,c.onchange=function(){var a=d.o.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(l){t("RL11 option error: "+l.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.o[b]=c,c.onchange=function(){var a=ja(c.value);null!=a&&pf(d,a)},!0;case "loadDrive":return this.o[b]=
c,c.onclick=function(){var a=d.o.listDisks;a&&qf(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.A){c.parentNode.removeChild(c);break}this.o[b]=c;c.onclick=function(){var a=d.o.listDrives;if(a&&a.options&&d.b)if(a=d.b[ja(a.value)||0])if(a=a.ca){var b;b="";for(var c=0,l;l=mf(a,c++);)for(var m=0,p=l.length;m<p;m++)b+=String.fromCharCode(nf(a,l,m));b=btoa(b);a=a.Vb.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+")":"")+".");t(a)}else d.C("No disk loaded in drive.");else d.C("No disk drive selected.")};return!0;case "mountDrive":if(this.A)return 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;qf(d,n(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
h.ha=function(a,b,c,d){this.j=a;this.h=b;this.a=c;this.F=d;if((this.f=Wb(this.j,"autoMount")||this.f)&&"string"==typeof this.f)try{this.f=eval("("+this.f+")")}catch(e){t("RL11 auto-mount error: "+e.message+" ("+this.f+")"),this.f=null}rf(this);this.G=Bb(112,5);ub(b,this,sf);tf(this,"None","",!0);this.A&&tf(this,"Local Disk","?");tf(this,"Remote Disk","??");uf(this)||F(this)};
h.ja=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.j.Hb){for(a=0;a<this.b.length;a++)vf(this,a,!0);uf(this,!0)}}else if(!this.restore(a))return!1;if(a=this.o.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";pf(this,0)}}return!0};h.ia=function(a){return a?this.save():!0};h.reset=function(){rf(this)};h.save=function(){return(new P(this)).data()};
h.restore=function(a){return rf(this,a[0])};function uf(a,b){b||(a.s=0);if(a.f)for(var c in a.f){var d=a.f[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.o.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var l=f.options[g];if(l.value==e){f=l.text;break a}}f=n(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.b.length)){!wf(a,g,f,e,!0)&&b&&F(a,!1);continue}a.C("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.s}
function qf(a,b,c,d){var e=a.o.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+'"')}wf(a,e,b,c,!1,d)}else vf(a,e)}
function wf(a,b,c,d,e,f){var g=-1,l=a.b[b];l.Da.toLowerCase()!=d.toLowerCase()&&(g++,vf(a,b,!0),l.nb?a.C("RL11 busy"):(l.nb=!0,e&&(l.mb=!0,a.s++),l.fb=!!f,jf(new ef(a,l,"preload"),c,d,f,a.dc)&&g++));return g}
h.dc=function(a,b,c,d,e){var f;a.nb=!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.T||f[1]>a.Y)&&(this.C('Disk "'+c+'" too large for drive '+("RL"+a.sb)),b=null);b?(a.ca=b,a.ta=c,a.Da=d,this.C('Mounted disk "'+c+'" in drive '+("RL"+a.sb),a.mb||e),this.j&&ec(this.j)):a.fb=!1;a.mb&&(a.mb=!1,--this.s||F(this));pf(this,a.sb)};
function tf(a,b,c,d){if((a=a.o.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 pf(a,b){if(0<=b&&b<a.b.length){var c=a.b[b],d=a.o.listDisks;a=a.o.listDrives;if(d&&a&&d.options&&a.options&&(a=ja(a.value),c=c.fb?"?":c.Da,!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 vf(a,b,c){var d=a.b[b];if(d.ca||!1===c)d.ta="",d.Da="",d.ca=null,d.fb=!1,c||(a.C("Drive RL"+b+" unloaded",c),pf(a,b))}
function rf(a,b){var c=0;b||(b=[]);a.M=b[c++]||0;a.v=b[c++]||0;a.c=b[c++]||0;a.i=b[c++]||0;a.m=b[c++]||0;a.w=b[c]||0;for(b=0;b<a.b.length;b++){var d=a.b[b];void 0===d&&(d=a.b[b]={});c=a;d.sb=b;d.nb=d.fb=!1;d.name=c.Na;d.T=512;d.Y=2;d.S=40;d.ga=256;d.ob=!0;d.Wd=0;d.Vd=0;d.Ud=0;d.Eb=1;d.cc=d.S;d.Nb=d.ga;d.$d=0;d.ae=null;d.ca||(d.Da="");d.status=29|(512==d.T?128:0)}return!0}
h.ec=function(a,b,c,d,e,f){this.v=f&65535;this.M=this.M&-49|f>>12&48;this.w=f>>16&63;this.i=this.c=b<<7|(c?64:0)|d&63;this.m=65536-e&65535;a&&(this.M=this.M|a|32768);return!0};
h.oc=function(a,b,c,d,e,f,g){for(var l=0,m=a.ca,p=null,q;e--;){if(!p){p=a.ca.seek(b,c,d,!0);if(!p){l=5120;break}q=0}var u,z;if(0>(u=a.ca.read(p,q++))||0>(z=a.ca.read(p,q++))){l=5120;break}this.h.zb(vc(this.a,f),u|z<<8);if(xb(this.h)){l=8192;break}f+=2;if(q>=m.ga&&(p=null,++d>=m.S&&(d=0,++c>=m.Y&&(c=0,++b>=m.T)))){l=5120;break}}return g(l,b,c,d,e,f)};
h.hd=function(a,b,c,d,e,f,g){for(var l=0,m=a.ca,p=null,q;e--;){var u=this.h.qb(vc(this.a,f));if(xb(this.h)){l=8192;break}f+=2;if(!p){p=a.ca.seek(b,c,d,!0);if(!p){l=5120;break}q=0}if(!a.ca.write(p,q++,u&255)||!a.ca.write(p,q++,u>>8)){l=5120;break}if(q>=m.ga&&(p=null,++d>=m.S&&(d=0,++c>=m.Y&&(c=0,++b>=m.T)))){l=5120;break}}return g(l,b,c,d,e,f)};h.Lc=function(){return this.M&65535};
h.Dd=function(a){this.M=this.M&-1023|a&1022;this.D=this.D&-4|(a&48)>>4;if(!(this.M&128)){var b;a=!0;var c=this.b[(this.M&768)>>8],d,e,f,g;this.M&=-2;switch(this.M&14){case 4:this.c&8&&(this.M&=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.oc;case 10:b||(b=this.hd),d=this.c>>7,e=this.c&64?0:1,f=this.c&63,d>=c.T||f>=c.S?this.M|=37888:(g=(this.w&
63)<<16|this.v,a=65536-this.m&65535,a=b.call(this,c,d,e,f,a,g,this.ec.bind(this)))}a&&(this.M|=129,this.M&64&&zb(this.a,this.G))}};h.Jc=function(){return this.v};h.Bd=function(a){this.v=a&65534};h.Mc=function(){return this.c};h.Ed=function(a){this.c=a};h.Nc=function(){return this.m};h.Fd=function(a){this.m=a};h.Kc=function(){return this.w};h.Cd=function(a){this.w=a&63};
var xf={},sf=(xf[63744]=[null,null,N.prototype.Lc,N.prototype.Dd,"RLCS"],xf[63746]=[null,null,N.prototype.Jc,N.prototype.Bd,"RLBA"],xf[65284]=[null,null,N.prototype.Mc,N.prototype.Ed,"RLDA"],xf[65286]=[null,null,N.prototype.Nc,N.prototype.Fd,"RLMP"],xf[65288]=[null,null,N.prototype.Kc,N.prototype.Cd,"RLBE"],xf);
function yf(a,b,c){x.call(this,"Computer",a,yf);this.l.P=!1;zf(this,b);this.A=Wb(this,"autoPower",a);this.j=0;this.N=a.busWidth||a.buswidth;this.b=Af;this.v=null;this.m=this.J=!1;this.O=Wb(this,"url")||"";(Math.random()+.1).toString(36);this.c=Bf(this);if(this.a=Ta("CPU",this.id)){this.F=Ta("Debugger",this.id);this.h=new ab({id:this.na+".bus",busWidth:this.N},this.a,this.F);var d,e=B(this.id);if((this.f=Ta("Panel",this.id))&&this.f.Ta)for(b=0;b<e.length;b++)d=e[b],d.C=this.f.C,d.U=this.f.U,d.Ta=this.f.Ta;
this.U("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.U("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.h,this.a,this.F);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.s=d:this.b=parseInt(d,10));var f;if(a=Wb(this,"state")||(f=!0,a.state))b=this.D=a,f||(this.m=!0,this.b=Af),this.b&&(this.w=new P(this,
"1.30.2"),Cf(this.w)?b=null:delete this.w);!b&&this.b&&(b=Df(this))&&(this.m=!0);if(b){var g=this;r(b,null,!0,function(a,b,c){c?(g.s=null,g.m=!1,g.C("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.v=b,g.J=!0);F(g)})}else F(this);this.o.power||(this.A=!0);!c&&this.A&&Ef(this,this.Ua)}else t("Unable to find CPU component")}A(yf);var Af=0;
function zf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.K=b}function Wb(a,b,c){var d=b.toLowerCase(),d=La[b]||La[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 Ef(a,b,c){for(var d=B(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ua(f)){Ua(f,function(){Ef(a,b,c)});return}}b.call(a,c)}
function Ff(a,b){var c=new P(a,"1.30.2","validate");if(Cf(c)&&Gf(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=yf.prototype;
h.Ua=function(a){void 0===a&&(a=this.b||(this.v?1:Af));if(!this.j){this.j++;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>Af){if(Cf(d,this.v)){this.i=new P(this,"1.30.2","failsafe");Cf(this.i)&&(Hf(this,d),a=2,If(this.i));this.i.set("timestamp",sa());Jf(this.i);var e=this.b&&!this.m;if(1==a||wa("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Gf(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Cf(d,g):("error"==
f&&"no machine state"!=g?(this.C("Error: "+g),"unable to verify user"==g&&(Aa("user",""),this.c=null)):this.U(f+": "+g),If(d),Cf(d)?(c=Gf(d),e=!0):c=!1))}e&&Ff(this,c?d:null)}else 2==a&&d.clear()}else Ff(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=Kf(this,g,d,b,c));b=[d,a,c];-1!=a?Ef(this,this.Gb,b):this.Gb(b)}};
function Kf(a,b,c,d,e){if(!b.l.P){b.l.P=!0;if(b.ja){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.ja(f,d)&&f&&(t("Unable to restore state for "+b.type),a.D&&!a.J?(c.clear(),a.b=Af,window&&window.location.reload()):a.G=!0,b.ja(null),e=!1)}if(!d&&b.Lb)for(a=b.Lb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Gb=function(a){var b=a[0],c=0>a[1];a=a[2];this.R=!0;this.l.P=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(Kf(this,this.a,b,c,a),this.a.Sa());this.G&&(Hf(this,b),b.clear());!c&&this.i&&(this.i.clear(),delete this.i);this.j=0};
function Hf(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.O;d.user=c;d.type="bug";d.data=b;r("http://www.pcjs.org/api/v1/report",d,!0)}}
function Nf(a,b,c){var d,e="none";if(a.j)return null;a.j--;var f=new P(a,"1.30.2"),g=new P(a,"1.30.2","validate"),l=sa();g.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.ia&&(c&&G(a.a),d=a.a.ia(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.l.P=!1,!1===d&&(e=null)));for(var l=B(a.id),m=0;m<l.length;m++){var p=l[m];p.l.P&&(p.ia&&(d=p.ia(b,c),"object"===typeof d&&f.set(p.id,
d)),c&&(p.l.P=!1,!1===d&&(e=null)))}e&&(c?(l=d=!1,b?(a.c&&Of(a,a.c,f.toString()),Jf(g)&&Jf(f)||(e=null,d=l=!0)):a.b&&(d=!0,l=3==a.b),d&&f.clear(l)):e=f.toString());c&&(a.l.P=!1,b=a.o.power)&&(b.textContent="Power");a.j=0;return e}h.reset=function(){this.h&&this.h.reset&&this.h.reset();for(var a=B(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.h&&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.ma(!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.ma(!0)};
h.Z=function(a,b,c){var d=this;switch(b){case "power":return this.o[b]=c,c.onclick=function(){d.j||(d.l.P?Nf(d,!1,!0):Ef(d,d.Ua))},!0;case "reset":return this.o[b]=c,c.onclick=function(){if(d.l.P&&!d.j)if(d.b&&!d.s){var a=wa("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Nf(d,a,!0);!a&&d.D?window&&window.location.reload():(a||(d.Hb=!0),d.Ua(Af),d.Hb=!1)}else d.reset(),d.a&&d.a.Sa()},!0;case "save":if(ma(v(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.o[b]=c,c.onclick=function(){var a=Bf(d,!0);if(a){var b=!!(d.b&&!d.s||d.D),c=Nf(d,b);b?Of(d,a,c):d.C("Resume disabled, machine state not saved")}},!0}return!1};
function Bf(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=Pf(a,c))||a.C("The user ID is invalid.")):b&&a.C("Browser local storage is not available"));return c}
function Pf(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&&(Aa("user",b.data),a.c=b.data)}catch(d){t(d.message+" ("+c+")")}return a.c}function Df(a){var b=null;a.c&&(b=v()+"/api/v1/user?req=load&user="+a.c+"&state="+Qf(a,"1.30.2"));return b}
function Of(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Qf(a,"1.30.2");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.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 Ue(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 ec(a){if(a.Ta){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Ta.focus();window&&window.scrollTo(b,c)}}h.ma=function(a){this.a&&this.a.ma(a);this.f&&this.f.ma(a)};
Ga(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 yf(g,d,!0);D(g,f);g.A&&Ef(g,g.Ua)}});w.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Ta("Computer",c.id))&&c.R&&!c.l.P&&c.Ua(-1)}});w.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Ta("Computer",c.id))&&c.l.P&&Nf(c,!(!c.b||c.s),!0)}});
function P(a,b,c){this.id=a.id;this.key=Qf(a,b,c);this.F=a.F;If(this,a.jc)}function Qf(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){If(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 If(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function Jf(a){var b=!0;if(ya()){var c=JSON.stringify(a[a.id]);Aa(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Gf(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Cf(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 Rf=0;
function Sf(a,b,c,d,e,f){e("Loading "+a+"...");r(a,null,!0,function(g,l,m){m?(l||(l="unable to load "+a+" ("+m+")"),f(l,null)):Tf(l,a,b,c,d,e,f)})}
function Tf(a,b,c,d,e,f,g){function l(a,f){if(f)g(f,null);else{c&&(Ra(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?Uf(a,f,l):l(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Uf(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");r(e,null,!0,function(f,g,l){if(l||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+l+")");else{if(f=d[3])if(l=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=l[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]);l[0]!=m&&(g=g.replace(l[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);Uf(a,b,c)}})}else c(a,null)}
function Vf(a,b,c,d){function e(a){if(void 0===l){var b=g&&E(g,"machine-warning");l=b&&b[0]||g}l&&(l.innerHTML=oa(a))}function f(a){e("Error: "+a);m&&(--Rf||Ia(!0));m=!1}var g,l,m=!0;Rf++;Qa[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.type="text/css";u.styleSheet?u.styleSheet.cssText=p:u.appendChild(document.createTextNode(p));q.appendChild(u)}c||
(c="/versions/pdpjs/1.30.2/components.xsl");p=function(d,l){l?Sf(c,null,null,!1,e,function(d,m){m?(Ra(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=l.transformNode(m))?(g.outerHTML=m,--Rf||Ia(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(l,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Rf||Ia(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Sf(b,a,d,!0,e,p):Tf(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(z){f(z.message)}return m}window.embedPDP11=function(a,b,c,d){Ia(!1);return Vf(a,b,c,d)};window.enableEvents=Ia;window.sendEvent=Ja;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11.map