pcjs/versions/pdpjs/1.30.1/pdp11-dbg.js

261 lines
97 KiB
JavaScript

(function(){/*
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/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,da=["Math","log2"],ea=0;ea<da.length-1;ea++){var fa=da[ea];fa in ba||(ba[fa]={});ba=ba[fa]}var ga=da[da.length-1],la=ba[ga],ma=la?la:function(a){return Math.log(a)/Math.LN2};
ma!=la&&null!=ma&&aa(ba,ga,{configurable:!0,writable:!0,value:ma});function na(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function 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 oa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}function pa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function qa(){var a=ra();return-1!==a.indexOf("pcjs.org",a.length-8)}var sa={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function ta(a){return a.replace(/[&<>"']/g,function(a){return sa[a]})}function ua(a,b){return(a+" ").slice(0,b)}
function va(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var wa={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
function ya(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,l;l=c(b,a[g]);0<l?d=g+1:(e=g,f=!l)}return f?d:~d}var za=Date.now||function(){return+new Date};function Aa(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function Ba(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var 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 Fa(a,b){var c,d={ga:null,ja:null,Lb:null,Kb:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g=eval("("+b+")");d.Lb=g.load;d.Kb=g.exec;if(e=g.bytes)d.ga=e;else if(e=g.words)for(d.ga=Array(2*e.length),f=c=0;c<e.length;c++)d.ga[f++]=e[c]&255,d.ga[f++]=e[c]>>8&255;else if(e=g.data)for(d.ga=Array(4*e.length),f=c=0;c<e.length;c++)d.ga[f++]=e[c]&255,d.ga[f++]=e[c]>>8&255,d.ga[f++]=e[c]>>16&255,d.ga[f++]=e[c]>>24&255;else d.ga=g;d.ja=g.symbols;d.ga.length?1==d.ga.length&&(n(d.ga[0]),d=null):
(n("Empty resource: "+a),d=null)}catch(l){n("Resource data error: "+l.message),d=null}else for(a=b.replace(/\n/gm," ").replace(/ +$/,"").split(" "),d.ga=Array(a.length),c=0;c<a.length;c++)d.ga[c]=parseInt(a[c],16);return d}function ra(){return"http://"+(window?window.location.host:"www.pcjs.org")}function n(a){window&&window.alert(a)}function Ga(a){var b=!1;window&&(b=window.confirm(a));return b}var Ha=null;
function Ia(){if(null==Ha){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ha=a}return Ha}function Ja(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Ka(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}
function La(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Ma(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Na(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Oa={init:[],show:[],exit:[]},Pa=!1,Qa=!1,Ra=!0;function Sa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ta(a){Oa.init.push(a)}
function Ua(a){if(Ra)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){n(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Va(a){!Ra&&a?(Ra=!0,Pa&&Wa("init"),Qa&&Wa("show")):Ra=a}function Wa(a){Oa[a]&&Ua(Oa[a])}Sa("onload",function(){Pa=!0;Ua(Oa.init)});Sa("onpageshow",function(){Qa=!0;Ua(Oa.show)});Sa(La("Opera")||La("iOS")?"onunload":"onbeforeunload",function(){Ua(Oa.exit)});
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Yb=b.comment;this.tc=b;b=this.id.indexOf(".");0>b?this.Ua=this.id:(this.Va=this.id.substr(0,b),this.Ua=this.id.substr(b+1));this[a]=c;this.v={ready:!1,mb:!1,Ib:!1,ia:!1,error:!1};this.zb=null;this.v.error=!1;this.J={};this.i=null;this.ka=d||0;t.push(this)}var cb=void 0,db={};
if(window){cb||(cb=window.location.search.substr(1));for(var eb,fb=/\+/g,gb=/([^&=]+)=?([^&]*)/g;eb=gb.exec(cb);)db[decodeURIComponent(eb[1].replace(fb," "))]=decodeURIComponent(eb[2].replace(fb," "))}function hb(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function u(a,b){b||(b=r);a.prototype=hb(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var ib=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else ib={},t=[];function jb(a,b,c){ib[a]&&b&&(ib[a][b]=c)}function kb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<t.length;b++){var d=t[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function lb(a){if(void 0!==a){var b;for(b=0;b<t.length;b++)if(t[b].id===a)return t[b]}return null}function mb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<t.length;d++)if(c)c==t[d]&&(c=null);else if(!(a!=t[d].type||b&&t[d].id.indexOf(b)))return t[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){n(c.message+" ("+a+")")}return b}
function A(a,b){b=B(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var 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=z(f))&&g.binding&&a.qa(g.type,g.binding,f,g.value),m=l.length}}}}
function B(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},qa:function(a,b,c){switch(b){case "clear":return this.J[b]||(this.J[b]=c,c.onclick=function(a){return function(){a.J.print&&(a.J.print.value="")}}(this)),!0;case "print":return this.J[b]||(this.Ra=this.J[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.pa=function(a){this.j(a,this.Ua)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.Ua+": "+a)},pa:function(a,b,c){c=c||this.type;b||n((c?c+": ":"")+a)},Aa:function(){return this.v.ia=!0},za:function(a,b){b&&(this.v.ia=!1);return!0}};function E(a,b,c,d){a.i&&(!0===c||G(a,c|0))&&a.i.message(b,d)}function G(a,b){if(a.i){a===a.i?b|=0:b=b||a.ka;var c=a.i.ka&b;return!!b&&c===b||!!(c&a.i.nc)}return!1}
function nb(a,b){if(a.v.Ib)return a.v.mb=!1,a.v.Ib=!1;if(a.v.error)return a.j(a.toString()+" error"),!1;a.v.mb=b;return a.v.mb}function ob(a,b){a.v.mb&&(b?a.v.Ib=!0:void 0===b&&a.j(a.toString()+" busy"));return a.v.mb}function H(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.zb;a.zb=null;b&&b()}}function pb(a,b){b&&(a.v.ready?b():a.zb=b);return a.v.ready}function qb(a){return a.v.error?(a.j(a.toString()+" error"),!0):!1}function rb(a,b){a.v.error=!0;a.pa(b)}
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
var sb="undefined"!==typeof ArrayBuffer,Gb={cpu:1,trap:16,bus:64,memory:128,device:256,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function Hb(a){r.call(this,"Panel",a,Hb);this.f=0;this.v.Wb=!0}u(Hb);h=Hb.prototype;
h.qa=function(a,b,c,d){if(this.B&&this.B.qa(a,b,c,d)||this.b&&this.b.qa(a,b,c,d)||this.i&&this.i.qa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.J[b]=c,this.f++,!0;default:return"rled"==a?(this.J[b]=c,this.f++,!0):this.parent.qa.call(this,a,b,c,d)}};h.Ca=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d};h.Aa=function(a,b){b||Ib();return!0};h.za=function(){return!0};
function Jb(a,b,c,d){if(a.J[b]){void 0===c&&(rb(a,"Value for "+b+" is invalid"),a.b.da());var e=a.i&&a.i.la||8;c=!a.b.v.ca||a.v.Wb?8==e?na(c,d):k(c,d):"--------".substr(0,d||4);a.J[b].textContent!=c&&(a.J[b].textContent=c)}}function Kb(a,b,c,d){for(var e=0;e<d;e++){var f=a.J[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
h.$=function(a){if(this.f&&(a||!this.b.v.ca||this.v.Wb)){for(a=0;a<this.b.u.length;a++)Jb(this,"R"+a,this.b.u[a]);a=Lb(this.b);Jb(this,"PS",a);Jb(this,"NF",a&8?1:0,1);Jb(this,"ZF",a&4?1:0,1);Jb(this,"VF",a&2?1:0,1);Jb(this,"CF",a&1?1:0,1);Kb(this,"D",this.b.u[0],16);Kb(this,"A",this.b.u[7],22)}};function Ib(){for(var a=!1,b=B(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=lb(e.id);f||(a=!0,f=new Hb(e));A(f,d);a&&H(f)}}Ta(Ib);
function Mb(a,b,c){r.call(this,"Bus",a,Mb,64);this.b=b;this.i=c;this.M=a.busWidth||16;this.g=0;this.K=[];this.G=null;this.H=Math.pow(2,this.M);this.f=this.H-1|0;this.ua=Nb;this.ha=Math.log2(this.ua);this.I=this.ua>>2;this.w=this.ua-1;this.D=this.H/this.ua|0;this.Ha=[];this.C=0;this.B=[];this.mc=[Ob,Pb,Qb,Rb];a=new I(this);Sb(a,this.i);this.W=Array(this.D);for(b=0;b<this.D;b++)this.W[b]=a;H(this)}u(Mb);var Nb=8192,Tb=Nb-1;
function Ob(a,b){var c=-1,d=this.controller,e=d.Ha[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.Ha[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.i&&G(this.i,64)&&E(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Ub(d,b,!0);this.i&&G(this.i,64)&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
function Pb(a,b,c){var d=!1,e=this.controller,f=e.Ha[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.Ha[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d?this.i&&G(this.i,64)&&E(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Ub(e,c,!0,b),this.i&&G(this.i,64)&&E(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
function Qb(a,b){var c=-1,d=this.controller;(a=d.Ha[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.i&&G(this.i,64)&&E(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Ub(d,b,!1);this.i&&G(this.i,64)&&E(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
function Rb(a,b,c){var d=!1,e=this.controller;if(a=e.Ha[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.i&&G(this.i,64)&&E(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Ub(e,c,!1,b),this.i&&G(this.i,64)&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
function Vb(a,b){if(b!=a.g){var c;a.g&&(c=(1<<a.g)-Nb,Wb(a,c,Nb,a.K),a.g=0);b&&(a.g=b,c=(1<<b)-Nb,a.K=Xb(a,c,Nb),a.G?Wb(a,c,Nb,a.G):(Yb(a,c,Nb,Zb,a),a.G=Xb(a,c,Nb)))}}h=Mb.prototype;h.reset=function(){for(var a=0;a<this.B.length;a++)this.B[a]();Vb(this,16)};function Ub(a,b,c,d){if(a.i&&G(a.i,536870912)&&(E(a.i,"warning: unknown I/O access ("+J(a.i,b)+","+J(a.i,d,c?1:2)+")",!0,!0),$b(a.i)))return 0;a.C||a.b.ea(4,b);return 0}h.Aa=function(a,b){b||this.reset();return!0};
function Yb(a,b,c,d,e){for(var f=b,g=c,l=f>>>a.ha;0<g&&l<a.W.length;){var m=a.W[l],p=l*a.ua,q=a.ua-(f-p);q>g&&(q=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.A)return m.vb+=m.A-f,m.A=f,!0;if(f>=m.A+m.vb){q=m.size-(f-p);q>g&&(q=g);m.vb=f-m.A+q;f=p+a.ua;g-=q;l++;continue}}return ac(1,f,g)}f=new I(a,f,q,a.ua,d,e);Sb(f,a.i,m);a.W[l++]=f;f=p+a.ua;g-=q}if(0>=g){c/=1024;var v;e="";v?10<v&&(v=10):v=c&-65536?10:5;if(null==c||isNaN(c))for(;0<v--;)e="?"+e;else for(;0<v--;)e=String.fromCharCode(c%10+48)+e,c/=
10;a.status(e+"Kb "+bc[d]+" at "+na(b));return!0}return ac(2,b,c)}function Xb(a,b,c){var d=[];for(b>>>=a.ha;0<c&&b<a.W.length;)d.push(a.W[b++]),c-=a.ua;return d}function Wb(a,b,c,d){var e=0;for(b>>>=a.ha;0<c&&b<a.W.length;){var f=d[e++];if(!f)break;a.W[b++]=f;c-=a.ua}}h.ob=function(a){return this.W[(a&this.f)>>>this.ha].Eb(a&this.w,a)};h.Bb=function(a){this.C++;a=this.W[(a&this.f)>>>this.ha].Mb(a&this.w,a);this.C--;return a};h.ma=function(a){return this.W[(a&this.f)>>>this.ha].ta(a&this.w,a)};
h.pb=function(a){var b=a&this.w,c=(a&this.f)>>>this.ha;this.C++;a=this.W[c].Nb(b,a);this.C--;return a};h.Fb=function(a,b){this.W[(a&this.f)>>>this.ha].Hb(a&this.w,b&255,a)};h.gb=function(a,b){this.C++;this.W[(a&this.f)>>>this.ha].Sb(a&this.w,b&255,a);this.C--};h.Ta=function(a,b){this.W[(a&this.f)>>>this.ha].wb(a&this.w,b&65535,a)};h.Gb=function(a,b){var c=a&this.w,d=(a&this.f)>>>this.ha;this.C++;this.W[d].Tb(c,b&65535,a);this.C--};
function cc(a){for(var b=0,c=[],d=0;d<a.D;d++){var e=a.W[d];if(e.Ia||e.pc){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 lc(a,b,c,d,e,f,g,l){for(;b<=c;b+=2){var m=b&Tb;void 0!==a.Ha[m]?n("I/O address already registered: "+k(b,8,!0)):a.Ha[m]=[d,e,f,g,l||"unknown",!1]}}
function mc(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.b.$a)){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)));lc(a,e,e,g,l,m,p,f[4])}}}function nc(a,b){a.B.push(b)}
function oc(a,b){a.C||(a.i&&G(a.i,536870912)&&E(a.i,"memory fault on address "+J(a.i,b),!0,!0),a.b.ea(4,b))}function ac(a,b,c){n("Memory block error ("+a+": "+k(b)+","+k(c)+")");return!1}function K(a){r.call(this,"Device",a,K,256);this.g={data:0,Sd:0,Db:20,gd:0};this.f={Td:0,Rb:-1}}u(K);h=K.prototype;
h.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;var e=this;this.f.Rb=pc(c,function(){e.f.Ja|=128;e.f.Ja&64&&(qc(e.b,e.f.hd),rc(e.b,e.f.Rb,1E3/60))});this.f.hd=sc(64,6);mc(b,this,L);nc(b,this.reset.bind(this));H(this)};h.reset=function(){this.g.Db=this.g.Db&-120|20;this.f.Ja=0};h.Dc=function(){var a=this.f.Ja;this.f.Ja&=-129;return a};h.rd=function(a){this.f.Ja=a;a&64&&rc(this.b,this.f.Rb,1E3/60);this.f.Ja=a&-129};h.wc=function(a){return(a?this.g.gd:this.g.data)&65535};
h.kd=function(a){this.g.data=a};h.Fc=function(){var a=this.b;return a.G&62337|a.wa<<5|a.xa<<1};h.td=function(a){var b=this.b;a&=62337;if(b.G!=a){b.G=a;b.wa=a>>5&3;b.xa=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ka!=c&&(b.Ka=c,tc(b))}uc(this)};h.Gc=function(){var a=this.b.Ma;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Hc=function(){return this.b.tb};h.Ic=function(){return this.b.Na};
h.ud=function(a){var b=this.b;1170>b.$a&&(a&=-49);b.Na!=a&&(b.Na=a,a&16?(b.Ya=4194303,b.ya=3915776):(b.Ya=262143,b.ya=253952),tc(b));uc(this)};function uc(a){a.g.Db=a.g.Db&-8|(a.b.Ka?a.b.Na&16?1:2:4)}h.Wc=function(a){return this.b.P[1][a>>1&7]};h.Id=function(a,b){this.b.P[1][b>>1&7]=a&65295};h.Uc=function(a){return this.b.P[1][(a>>1&7)+8]};h.Gd=function(a,b){this.b.P[1][(b>>1&7)+8]=a&65295};h.Vc=function(a){return this.b.sa[1][a>>1&7]};
h.Hd=function(a,b){b=b>>1&7;this.b.sa[1][b]=a;this.b.P[1][b]&=65295};h.Tc=function(a){return this.b.sa[1][(a>>1&7)+8]};h.Fd=function(a,b){b=(b>>1&7)+8;this.b.sa[1][b]=a;this.b.P[1][b]&=65295};h.Cc=function(a){return this.b.P[0][a>>1&7]};h.qd=function(a,b){this.b.P[0][b>>1&7]=a&65295};h.Ac=function(a){return this.b.P[0][(a>>1&7)+8]};h.od=function(a,b){this.b.P[0][(b>>1&7)+8]=a&65295};h.Bc=function(a){return this.b.sa[0][a>>1&7]};h.pd=function(a,b){b=b>>1&7;this.b.sa[0][b]=a;this.b.P[0][b]&=65295};
h.zc=function(a){return this.b.sa[0][(a>>1&7)+8]};h.nd=function(a,b){b=(b>>1&7)+8;this.b.sa[0][b]=a;this.b.P[0][b]&=65295};h.bd=function(a){return this.b.P[3][a>>1&7]};h.Od=function(a,b){this.b.P[3][b>>1&7]=a&65295};h.$c=function(a){return this.b.P[3][(a>>1&7)+8]};h.Md=function(a,b){this.b.P[3][(b>>1&7)+8]=a&65295};h.ad=function(a){return this.b.sa[3][a>>1&7]};h.Nd=function(a,b){b=b>>1&7;this.b.sa[3][b]=a;this.b.P[3][b]&=65295};h.Zc=function(a){return this.b.sa[3][(a>>1&7)+8]};
h.Ld=function(a,b){b=(b>>1&7)+8;this.b.sa[3][b]=a;this.b.P[3][b]&=65295};h.eb=function(a){a&=7;return this.b.L&2048?this.b.Ea[a]:this.b.u[a]};h.jb=function(a,b){b&=7;this.b.L&2048?this.b.Ea[b]=a:this.b.u[b]=a};h.Nc=function(){return this.b.L&49152?this.b.va[0]:this.b.u[6]};h.zd=function(a){this.b.L&49152?this.b.va[0]=a:this.b.u[6]=a};h.Qc=function(){return this.b.u[7]};h.Cd=function(a){this.b.u[7]=a};h.fb=function(a){a&=7;return this.b.L&2048?this.b.u[a]:this.b.Ea[a]};
h.kb=function(a,b){b&=7;this.b.L&2048?this.b.u[b]=a:this.b.Ea[b]=a};h.Oc=function(){return 1==(this.b.L&49152)>>14?this.b.u[6]:this.b.va[1]};h.Ad=function(a){1==(this.b.L&49152)>>14?this.b.u[6]=a:this.b.va[1]=a};h.Pc=function(){return 3==(this.b.L&49152)>>14?this.b.u[6]:this.b.va[3]};h.Bd=function(a){3==(this.b.L&49152)>>14?this.b.u[6]=a:this.b.va[3]=a};h.yc=function(a){return this.b.gc[a-65504>>1]};h.md=function(a,b){this.b.gc[b-65504>>1]=a};h.dc=function(a){return 65520==a?61183:0};h.jc=function(){};
h.Yc=function(){return 1};h.Kd=function(){};h.xc=function(){return this.b.Z};h.ld=function(){this.b.Z=0};h.Ec=function(){return this.b.fc};h.sd=function(a,b){b&1||(a&=255);this.b.fc=a};h.Jc=function(a){return a?this.b.Pb:0};h.vd=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Pb=a;b.F|=2};h.Xc=function(a){return a?this.b.Oa&65280:0};h.Jd=function(a){this.b.Oa=a|255};h.Mc=function(){return Lb(this.b)};h.yd=function(a){vc(this.b,a&-1809|Lb(this.b)&1808);this.b.F|=128};
h.ic=function(a,b){G(this)&&E(this,"writeIgnored("+na(b)+"): "+na(a),!0,!0)};
var M={},L=(M[62592]=[null,null,K.prototype.Wc,K.prototype.Id,"SISDR",1145],M[62608]=[null,null,K.prototype.Uc,K.prototype.Gd,"SDSDR",1145],M[62624]=[null,null,K.prototype.Vc,K.prototype.Hd,"SISAR",1145],M[62640]=[null,null,K.prototype.Tc,K.prototype.Fd,"SDSAR",1145],M[62656]=[null,null,K.prototype.Cc,K.prototype.qd,"KISDR",1145],M[62672]=[null,null,K.prototype.Ac,K.prototype.od,"KDSDR",1145],M[62688]=[null,null,K.prototype.Bc,K.prototype.pd,"KISAR",1145],M[62704]=[null,null,K.prototype.zc,K.prototype.nd,
"KDSAR",1145],M[62798]=[null,null,K.prototype.Ic,K.prototype.ud,"MMR3",1145],M[65382]=[null,null,K.prototype.Dc,K.prototype.rd,"LKS"],M[65400]=[null,null,K.prototype.wc,K.prototype.kd,"CNSL"],M[65402]=[null,null,K.prototype.Fc,K.prototype.td,"MMR0",1145],M[65404]=[null,null,K.prototype.Gc,K.prototype.ic,"MMR1",1145],M[65406]=[null,null,K.prototype.Hc,K.prototype.ic,"MMR2",1145],M[65408]=[null,null,K.prototype.bd,K.prototype.Od,"UISDR",1145],M[65424]=[null,null,K.prototype.$c,K.prototype.Md,"UDSDR",
1145],M[65440]=[null,null,K.prototype.ad,K.prototype.Nd,"UISAR",1145],M[65456]=[null,null,K.prototype.Zc,K.prototype.Ld,"UDSAR",1145],M[65472]=[null,null,K.prototype.eb,K.prototype.jb,"R0SET0"],M[65473]=[null,null,K.prototype.eb,K.prototype.jb,"R1SET0"],M[65474]=[null,null,K.prototype.eb,K.prototype.jb,"R2SET0"],M[65475]=[null,null,K.prototype.eb,K.prototype.jb,"R3SET0"],M[65476]=[null,null,K.prototype.eb,K.prototype.jb,"R4SET0"],M[65477]=[null,null,K.prototype.eb,K.prototype.jb,"R5SET0"],M[65478]=
[null,null,K.prototype.Nc,K.prototype.zd,"R6KERNEL"],M[65479]=[null,null,K.prototype.Qc,K.prototype.Cd,"R7KERNEL"],M[65480]=[null,null,K.prototype.fb,K.prototype.kb,"R0SET1",1145],M[65481]=[null,null,K.prototype.fb,K.prototype.kb,"R1SET1",1145],M[65482]=[null,null,K.prototype.fb,K.prototype.kb,"R2SET1",1145],M[65483]=[null,null,K.prototype.fb,K.prototype.kb,"R3SET1",1145],M[65484]=[null,null,K.prototype.fb,K.prototype.kb,"R4SET1",1145],M[65485]=[null,null,K.prototype.fb,K.prototype.kb,"R5SET1",1145],
M[65486]=[null,null,K.prototype.Oc,K.prototype.Ad,"R6SUPER",1145],M[65487]=[null,null,K.prototype.Pc,K.prototype.Bd,"R6USER",1145],M[65504]=[null,null,K.prototype.yc,K.prototype.md,"CTRL",1170],M[65520]=[null,null,K.prototype.dc,K.prototype.jc,"LSIZE",1170],M[65522]=[null,null,K.prototype.dc,K.prototype.jc,"HSIZE",1170],M[65524]=[null,null,K.prototype.Yc,K.prototype.Kd,"SYSID",1170],M[65526]=[null,null,K.prototype.xc,K.prototype.ld,"CPUERR",1170],M[65528]=[null,null,K.prototype.Ec,K.prototype.sd,
"MB",1170],M[65530]=[null,null,K.prototype.Jc,K.prototype.vd,"PIR"],M[65532]=[null,null,K.prototype.Xc,K.prototype.Jd,"SL"],M[65534]=[null,null,K.prototype.Mc,K.prototype.yd,"PSW"],M);L[62594]=L[62592];L[62596]=L[62592];L[62598]=L[62592];L[62600]=L[62592];L[62602]=L[62592];L[62604]=L[62592];L[62606]=L[62592];L[62610]=L[62608];L[62612]=L[62608];L[62614]=L[62608];L[62616]=L[62608];L[62618]=L[62608];L[62620]=L[62608];L[62622]=L[62608];L[62626]=L[62624];L[62628]=L[62624];L[62630]=L[62624];L[62632]=L[62624];
L[62634]=L[62624];L[62636]=L[62624];L[62638]=L[62624];L[62642]=L[62640];L[62644]=L[62640];L[62646]=L[62640];L[62648]=L[62640];L[62650]=L[62640];L[62652]=L[62640];L[62654]=L[62640];L[62658]=L[62656];L[62660]=L[62656];L[62662]=L[62656];L[62664]=L[62656];L[62666]=L[62656];L[62668]=L[62656];L[62670]=L[62656];L[62674]=L[62672];L[62676]=L[62672];L[62678]=L[62672];L[62680]=L[62672];L[62682]=L[62672];L[62684]=L[62672];L[62686]=L[62672];L[62690]=L[62688];L[62692]=L[62688];L[62694]=L[62688];L[62696]=L[62688];
L[62698]=L[62688];L[62700]=L[62688];L[62702]=L[62688];L[62706]=L[62704];L[62708]=L[62704];L[62710]=L[62704];L[62712]=L[62704];L[62714]=L[62704];L[62716]=L[62704];L[62718]=L[62704];L[65410]=L[65408];L[65412]=L[65408];L[65414]=L[65408];L[65416]=L[65408];L[65418]=L[65408];L[65420]=L[65408];L[65422]=L[65408];L[65426]=L[65424];L[65428]=L[65424];L[65430]=L[65424];L[65432]=L[65424];L[65434]=L[65424];L[65436]=L[65424];L[65438]=L[65424];L[65442]=L[65440];L[65444]=L[65440];L[65446]=L[65440];L[65448]=L[65440];
L[65450]=L[65440];L[65452]=L[65440];L[65454]=L[65440];L[65458]=L[65456];L[65460]=L[65456];L[65462]=L[65456];L[65464]=L[65456];L[65466]=L[65456];L[65468]=L[65456];L[65470]=L[65456];L[65506]=L[65504];L[65508]=L[65504];L[65510]=L[65504];L[65512]=L[65504];L[65514]=L[65504];L[65516]=L[65504];L[65518]=L[65504];Ta(function(){for(var a=B(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=z(d);switch(c.type){case "default":c=new K(c);A(c,d);break;case "pc11":c=new wc(c),A(c,d)}}});var xc;
if(sb){var yc=new ArrayBuffer(2);(new DataView(yc)).setUint16(0,256,!0);xc=256===(new Uint16Array(yc))[0]}else xc=!1;var zc=xc;
function I(a,b,c,d,e,f){this.w=a;this.id=Ac+=2;this.b=null;this.A=b;this.vb=c;this.size=d||0;this.type=e||Bc;this.f=e==Cc;this.controller=null;Sb(this);this.Ia=this.pc=!1;if(d)if(f)this.controller=f,this.b=null,Dc(this,f.mc);else if(sb)this.C=new ArrayBuffer(d),this.G=new DataView(this.C,0,d),this.D=new Uint8Array(this.C,0,d),this.I=new Uint16Array(this.C,0,d>>1),this.b=new Int32Array(this.C,0,d>>2),Dc(this,zc?Ec:Fc);else{this.b=Array(d>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;Dc(this,Gc)}else Dc(this)}
var Bc=0,Cc=2,Zb=4,bc=["NONE","RAM","ROM","VID","H/W"],Ac=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(sb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.G.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(sb)for(b=0;b<a.length;b++)this.G.setInt32(b<<2,a[b],!0);else this.b=a;return this.Ia=!0}return!1},Qa:function(a,b){b?this.B++||Hc(this,Ic,!1):this.g++||Jc(this,Ic,!1)},K:function(){this.i&&G(this.i,128)&&(E(this.i,"attempt to read invalid block %"+
k(this.A),!0),this.i.da());return 255},J:function(a,b){this.i&&G(this.i,128)&&(E(this.i,"attempt to write "+k(b,4,!0)+" to invalid block %"+k(this.A),!0),this.i.da())},M:function(a,b){return this.Eb(a++,b++)|this.Eb(a,b)<<8},H:function(a,b,c){this.Hb(a++,b&255,c++);this.Hb(a,b>>8,c)},V:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},la:function(a,b){a&1&&oc(this.w,b);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},wa:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=
this.b[c]&~(255<<a)|b<<a;this.Ia=!0},Va:function(a,b,c){a&1&&oc(this.w,c);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Ia=!0},T:function(a,b){if(this.i&&null!=this.A){var c=this.i;Kc(c,this.A+a,1,c.M)&&c.da(!0)}return this.Mb(a,b)},ba:function(a,b){if(this.i&&null!=this.A){var c=this.i;Kc(c,this.A+a,2,c.M)&&c.da(!0)}return this.Nb(a,b)},oa:function(a,b,c){if(this.i&&null!=this.A){var d=this.i;Kc(d,this.A+a,
1,d.D)&&d.da(!0)}this.f?this.J(a,b,c):this.Sb(a,b,c)},ya:function(a,b,c){if(this.i&&null!=this.A){var d=this.i;Kc(d,this.A+a,2,d.D)&&d.da(!0)}this.f?this.J(a,b,c):this.Tb(a,b,c)},R:function(a){return this.D[a]},U:function(a,b){a=this.D[a];this.i&&G(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},aa:function(a,b){a&1&&oc(this.w,b);return this.G.getUint16(a,!0)},fa:function(a,b){a&1&&oc(this.w,b);a=this.I[a>>1];this.i&&G(this.i,128)&&E(this.i,"Memory.readWord("+
J(this.i,b)+"): "+J(this.i,a),!0);return a},na:function(a,b){this.D[a]=b;this.Ia=!0},ra:function(a,b,c){this.D[a]=b;this.Ia=!0;this.i&&G(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},xa:function(a,b,c){a&1&&oc(this.w,c);this.G.setUint16(a,b,!0);this.Ia=!0},Ua:function(a,b,c){a&1&&oc(this.w,c);this.I[a>>1]=b;this.Ia=!0;this.i&&G(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0)}};
function Sb(a,b,c){a.i=b;a.g=a.B=0;c&&((a.g=c.g)&&Jc(a,Ic,!1),(a.B=c.B)&&Hc(a,Ic,!1))}function Lc(a,b){b?--a.B||(a.Hb=a.f?a.J:a.Sb,a.wb=a.f?a.H:a.Tb):--a.g||(a.Eb=a.Mb,a.ta=a.Nb)}function Hc(a,b,c){c&&a.B||(a.Hb=!a.f&&b[1]||a.J,a.wb=!a.f&&b[3]||a.H);if(c||void 0===c)a.Sb=b[1]||a.J,a.Tb=b[3]||a.H}function Jc(a,b,c){c&&a.g||(a.Eb=b[0]||a.K,a.ta=b[2]||a.M);if(c||void 0===c)a.Mb=b[0]||a.K,a.Nb=b[2]||a.M}function Dc(a,b){b||(b=Mc);Jc(a,b,void 0);Hc(a,b,void 0)}
var Mc=[],Gc=[I.prototype.V,I.prototype.wa,I.prototype.la,I.prototype.Va],Ic=[I.prototype.T,I.prototype.oa,I.prototype.ba,I.prototype.ya];if(sb)var Fc=[I.prototype.R,I.prototype.na,I.prototype.aa,I.prototype.xa],Ec=[I.prototype.U,I.prototype.ra,I.prototype.fa,I.prototype.Ua];
function Nc(a,b){r.call(this,"CPU",a,Nc,1);var c=a.multiplier||1;this.Ga=a.cycles||b;this.La=c;this.Xa=Math.round(this.Ga/1E4)/100;this.Sa=this.Xa*this.La;this.v.ca=!1;this.v.Qb=!1;this.v.lb=a.autoStart;this.v.Za=!1;this.qb=this.la=0;this.rb=a.csStart;this.ab=a.csInterval;this.bb=a.csStop;this.K=[];this.bc=this.fd.bind(this);H(this)}u(Nc);var Oc=["power","reset"];h=Nc.prototype;
h.Ca=function(a,b,c,d){this.B=a;this.w=b;this.i=d;for(b=0;b<Oc.length;b++)(c=this.J[Oc[b]])&&this.B.qa(null,Oc[b],c);a=Pc(a,"autoStart");null!=a&&(this.v.lb="true"==a?!0:"false"==a?!1:!!a);H(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};
h.Aa=function(a,b){if(!b){if(a&&this.restore){Qc(this);if(!this.restore(a))return!1;Rc(this)}else this.reset();this.i?(a=this.i,a.j("Type ? for help with PDP11 Debugger commands"),a.$(),a.Ga&&(b=a.Ga,a.Ga=null,Sc(a,b))):this.j("No debugger detected")}this.B.$();return!0};h.za=function(a){return a?this.save():!0};h.lb=function(){return this.v.lb||!this.i&&void 0===this.J.run?(this.hb(!0),!0):!1};h.Zb=function(){return 0};
function Rc(a){void 0===a.rb&&(a.rb=0);void 0===a.ab&&(a.ab=-1);void 0===a.bb&&(a.bb=-1);a.v.Za=0<=a.rb&&0<a.ab;a.v.Za&&(a.qb=0,a.la=a.rb-a.fa)}function Tc(a,b){if(a.v.Za){var c=!1;a.qb=a.qb+a.Zb()|0;a.la-=b;0>=a.la&&(a.la+=a.ab,c=!0);0<=a.bb&&a.bb<=Uc(a)&&(a.ab=a.bb=-1,Rc(a),a.da(),c=!0);c&&a.j(Uc(a)+" cycles: checksum="+k(a.qb))}}
h.qa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.J[b]=c,!0;case "run":return this.J[b]=c,c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.v.ia)a=!0;else{var b=null,c,l=kb(a.id);for(c=0;c<l.length&&(b=l[c],b===a||b.v.ready);c++);if(c==l.length)for(c=0;c<l.length&&(b=l[c],b===a||b.v.ia);c++);c==l.length&&(b=a);n("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.zb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ca?d.da():d.hb())},
!0;case "speed":return this.J[b]=c,!0;case "setSpeed":return this.J[b]=c,c.onclick=function(){Vc(d,d.La<<1,!0)},c.textContent=this.Sa.toFixed(2)+"Mhz",!0}return!1};h.$=function(){var a=this.J.speed;a&&(a.textContent=this.v.ca&&this.V?this.V.toFixed(2)+"Mhz":"Stopped")};function Wc(a,b,c){a.fa+=b;c&&(a.ba=a.b=0)}function Xc(a,b){var c=1;b&&1<a.La&&a.V&&(c=a.V/a.Xa);a.Ab=Math.round(1E3/30);a.Pa=Math.floor(a.Ga/30*c);b||(a.na=a.Pa);a.nb=0}function Uc(a){return a.fa+a.T+a.ba-a.b}
function Qc(a){a.V=0;a.Cb=0;a.fa=a.T=a.ba=a.b=0;Rc(a);Vc(a,1)}function Vc(a,b,c){var d=!1;if(void 0!==b){.8>a.V/a.Sa?b=1:d=!0;a.La=b;b=a.Xa*a.La;if(a.Sa!=b){a.Sa=b;b=a.Sa.toFixed(2)+"Mhz";var e=a.J.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.B&&a.B.ub()}Wc(a,a.T);a.T=0;a.R=za();a.aa=0;Xc(a);return d}function pc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function rc(a,b,c){0<=b&&b<a.K.length&&0>a.K[b][0]&&(c=a.Ga*a.La/1E3*c|0,a.K[b][0]=c+Yc(a))}
function Zc(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function $c(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Yc(a,b){var c=a.ba-=a.b;a.b=0;b&&(a.ba=0);return c}
h.fd=function(){if(this.v.ca){this.nb>=this.Ga&&Xc(this,!0);this.ra=0;this.Fa=za();if(this.aa){var a=this.Fa-this.aa;a>this.Ab&&(this.R+=a,this.R>this.Fa&&(this.R=this.Fa))}try{do{var b=Zc(this,this.v.Za?1:this.Pa);try{this.ib(b)}catch(e){if("number"!=typeof e)throw e;}b=Yc(this,!0);this.ra+=b;this.T+=b;Tc(this,b);$c(this,b);this.na-=b;if(0>=this.na){this.na+=this.Pa;15<=++this.Cb&&(this.B&&this.B.$(),this.Cb=0);break}}while(this.v.ca)}catch(e){this.da();this.B&&this.B.stop(za(),Uc(this));rb(this,
e.stack||e.message);return}if(this.v.ca){a=setTimeout;b=this.bc;this.aa=za();var c=this.Ab;this.ra&&(c=Math.round(c*this.ra/this.Pa));var c=c-(this.aa-this.Fa),d=this.aa-this.R;d&&(this.V=Math.round(this.T/(10*d))/100,864E5<=d&&(this.fa=0,Vc(this)));if(0>c||this.V<this.Sa)-1E3>c&&(this.R-=c),c=0;this.nb+=this.ra;this.aa+=c;a(b,c)}}};
h.hb=function(a){if(qb(this))return!1;if(this.v.ca)return this.j(this.toString()+" busy"),!1;Vc(this);this.v.ca=!0;this.v.Qb=!0;var b=this.J.run;b&&(b.textContent="Halt");this.B&&(a&&this.B.ub(!0),this.B.start(this.R,Uc(this)));setTimeout(this.bc,0);return!0};h.ib=function(){return 0};h.da=function(a){if(this.v.ca){Yc(this);Wc(this,this.T);this.T=0;this.v.ca=!1;var b=this.J.run;b&&(b.textContent="Run");this.B&&this.B.stop(za(),Uc(this))}this.v.complete=a};
function ad(a){this.$a=+a.model||1170;this.xb=a.addrReset||0;Nc.call(this,a,6666667);this.decode=1120==this.$a?ud.bind(this):vd.bind(this);wd(this);this.C=0;this.U=null;this.v.complete=this.v.oc=!1}u(ad,Nc);h=ad.prototype;h.reset=function(){this.status("model "+this.$a);this.v.ca&&this.da();wd(this);Qc(this);this.v.error=!1;this.parent.reset.call(this)};
function wd(a){a.N=65536;a.O=32768;a.X=65535;a.S=32768;a.L=15;a.u=[0,0,0,0,0,0,0,a.xb];a.Ea=[0,0,0,0,0,0];a.va=[0,0,0,0];a.D=0;a.xa=0;a.sc=[4,2,0,1];a.P=[[0,0,0,0,0,0,0,0,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.sa=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.uc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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.gc=[0,0,0,0,0,0,0,0];a.fc=0;a.F=0;a.H=a.I=0;a.g=a.f=a.Wa=0;a.oa=-1;xd(a)}function xd(a){a.Oa=255;a.Z=0;a.Pb=0;a.G=0;a.Ma=0;a.tb=0;a.Na=0;a.Ka=0;a.wa=0;a.Ya=262143;a.ya=253952;a.F|=2;a.w&&tc(a)}function tc(a){a.Ka?(a.M=65536,a.Y=a.rc,a.ta=a.cd,a.wb=a.Pd,Vb(a.w,a.Na&16?22:18)):(a.M=0,a.Y=a.qc,a.ta=a.ec,a.wb=a.kc,Vb(a.w,16))}h.Zb=function(){return 0};
h.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.fa,this.La]);a.set(2,cc(this.w));return a.data()};h.restore=function(a){var b=a[1];this.fa=b[1];Vc(this,b[3]);a:{b=this.w;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.I){for(var f=0,g=Array(b.I),l=0;l<e.length-1;)for(var m=e[l++],p=e[l++];m--;)g[f++]=p;e=g}f=b.W[d];if(!f||!f.restore(e)){n("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function yd(a){return a.N&65536?1:0}
function zd(a){return a.O&32768?2:0}function Ad(a){return a.X&65535?0:4}h.Da=function(){return this.S&32768?8:0};function Bd(a){var b=a.ta(a.u[7]);a.u[7]=a.u[7]+2&65535;return b}function O(a,b){a.u[7]=b&65535}function sc(a,b){return{jd:a,cb:b,next:null}}function qc(a,b){if(b!=a.U){var c=a.U;if(!c||c.cb<=b.cb)b.next=c,a.U=b;else{do{var d=c.next;if(!d||d.cb<=b.cb){b.next=d;c.next=b;break}c=d}while(c)}}a.F|=2}function Lb(a){return a.L=a.L&63728|a.Da()|Ad(a)|zd(a)|yd(a)}
function vc(a,b){a.S=b<<12;a.X=~b&4;a.O=b<<14;a.N=b<<16;if((b^a.L)&2048)for(var c=a.Ea.length;0<=--c;){var d=a.u[c];a.u[c]=a.Ea[c];a.Ea[c]=d}a.D=b>>14&3;c=a.L>>14&3;a.D!=c&&(a.va[c]=a.u[6],a.u[6]=a.va[a.D]);a.L=b;a.F|=2}function P(a,b){a.F&128||(a.S=a.X=b,a.O=0)}function Cd(a,b,c){a.F&128||(a.S=a.X=a.N=b,a.O=c||0)}function Dd(a,b,c,d){a.F&128||(a.S=a.X=a.N=b,a.O=(c^b)&(d^b))}function Ed(a,b){a.F&128||(a.S=a.X=a.N=b,a.O=a.S^a.N>>1)}function Fd(a,b,c,d){a.F&128||(a.S=a.X=a.N=b,a.O=(c^d)&(d^b))}
h.ea=function(a,b){if(!this.C){var c=!1;0>this.oa?this.oa=Lb(this):this.D||(a=4,c=!0);this.G&57344||(this.Ma=63222,this.tb=a);this.D=0;var d=this.ta(a|this.M),e=this.ta(a+2&65535|this.M);vc(this,e&-12289|this.oa>>2&12288);c&&(this.Z|=4,this.u[6]=4);Gd(this,this.oa);Gd(this,this.u[7]);O(this,d);this.F&=-113;this.oa=-1;if(26!=b)throw a;}};function Hd(a){var b=Id(a),c=Id(a)&-1793;a.L&49152&&(c=c&-225|a.L&63712);O(a,b);vc(a,c);a.F&=-17}
function Jd(a,b,c){var d,e,f,g=0;d=b>>13;a.Na&a.sc[a.D]||(d&=7);e=a.P[a.D][d];f=(a.sa[a.D][d]<<6)+(b&8191)&a.Ya;if(f<a.ya)f&1&&!(c&1)&&(a.Z|=64,a.ea(4,10));else if(a.Na&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var l=f>>13&31;31>l?a.Na&32&&(f=a.uc[l]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.ya&&4186112>f&&(a.Z|=32,a.ea(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.P[a.D][d]=e;if(4194170!==f||a.D)a.wa=a.D,a.xa=d;g&&(g&57344&&(0<=a.oa&&(g|=128),a.G&57344||(a.G=a.G|g|a.wa<<5|a.xa<<1),a.ea(168,16)),a.G&61440||!(4191360>f||4194239<f)||(a.G|=4096,a.G&512&&(a.F|=32)));return f}function Kd(a,b){return a.w.ob(b)}function Ld(a,b,c){b&1&&a.b--;a.w.Fb(b,c&255)}function Id(a){var b=a.ta(a.u[6]|a.M);a.u[6]=a.u[6]+2&65535;return b}
function Gd(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.G&57344||(a.Ma=a.Ma<<8|246);!a.D&&c<=a.Oa&&4<c&&(c<=a.Oa-32?(a.Z|=4,a.u[6]=4,a.ea(4,18)):(a.Z|=8,a.F|=4));a.wb(c,b)}
function Md(a,b,c,d){var e,f,g=d&8?0:a.M;switch(b){case 0:return a.ea(4,20),0;case 1:return 6===c&&!a.D&&d&4&&(a.u[6]<=a.Oa||65534<=a.u[6])&&(a.u[6]<=a.Oa-32||65534<=a.u[6]?(a.Z|=4,a.u[6]=4,a.ea(4,22)):(a.Z|=8,a.F|=64)),a.b-=3,7===c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!==c&&(e|=g);e=a.ta(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!==c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!==c&&(e|=g);e=a.ta(e)|g;
a.b-=8;break;case 6:return e=Bd(a),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=Bd(a),e=e+a.u[c]&65535,e=a.ta(e|a.M)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.G&57344||(a.Ma=a.Ma<<8|f<<3&248|c);6==c&&!a.D&&d&4&&0>=f&&(a.u[6]<=a.Oa||65534<=a.u[6])&&(a.u[6]<=a.Oa-32?(a.Z|=4,a.u[6]=4,a.ea(4,24)):(a.Z|=8,a.F|=64));return e}h.Bb=function(a){if(!this.Ka)return this.w.Bb(a);this.C++;a=Kd(this,Jd(this,a,3));this.C--;return a};
h.pb=function(a){if(!this.Ka)return this.w.pb(a);this.C++;a=this.ec(Jd(this,a,2));this.C--;return a};h.gb=function(a,b){this.Ka?(this.C++,Ld(this,Jd(this,a,5),b),this.C--):this.w.gb(a,b)};h.Gb=function(a,b){this.Ka?(this.C++,this.kc(Jd(this,a,4),b),this.C--):this.w.Gb(a,b)};h.qc=function(a,b,c){return Md(this,a,b,c)};h.rc=function(a,b,c){return Jd(this,Md(this,a,b,c),c)};h.ec=function(a){return this.w.ma(a)};h.cd=function(a){return this.w.ma(Jd(this,a,2))};h.kc=function(a,b){this.w.Ta(a,b&65535)};
h.Pd=function(a,b){this.w.Ta(Jd(this,a,4),b)};function Nd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=Md(a,b,d,2),c&65536||61440!==(a.L&61440)&&(d&=65535),a.D=a.L>>12&3,c=a.ta(d|c&a.M),a.D=a.L>>14&3):c=6!=d||(a.L>>2&12288)===(a.L&12288)?a.u[d]:a.va[a.L>>12&3];return c}function Od(a,b,c,d){a.G&57344||(a.Ma=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=Md(a,b,e,4),c&65536||(e&=65535),a.D=a.L>>12&3,e=Jd(a,e|c&65536,4),a.D=a.L>>14&3,a.w.Ta(e,d)):6!=e||(a.L>>2&12288)===(a.L&12288)?a.u[e]=d:a.va[a.L>>12&3]=d}
function Pd(a,b){b>>=6;var c=a.I=b&7;return(b=a.H=(b&56)>>3)?Kd(a,a.Y(b,c,3)):a.u[c]&255}function Qd(a,b){b>>=6;var c=a.I=b&7;return(b=a.H=(b&56)>>3)?a.w.ma(a.Y(b,c,2)):a.u[c]}function Rd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return Md(a,b,c,8)}function Sd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?Kd(a,a.Y(b,c,3)):a.u[c]&255}function Td(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.w.ma(a.Y(b,c,2)):a.u[c]}
function Q(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.Wa=a.Y(b,e,7),Ld(a,e,d.call(a,c,Kd(a,e)))):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.Y(b,e,6),a.w.Ta(e,d.call(a,c,a.w.ma(e)))):a.u[e]=d.call(a,c,a.u[e])}function Ud(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?Ld(a,a.Y(b,e,5),c):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}function Vd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.Ta(a.Y(b,d,4),c):a.u[d]=c&65535;return c}
function S(a,b,c){c&&(O(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
h.ib=function(a){this.v.complete=!0;var b=this.v.oc=this.i&&Wd(this.i),c=a?this.v.Qb?0:1:-1;this.v.Qb=!1;this.ba=this.b=a;do{if(b){if(Xd(this.i,this.u[7],c)){this.da();break}c=1}if(this.F&&(this.F&112&&(this.F&32?this.ea(168,28):this.F&64?this.ea(4,30):this.F&16&&this.ea(12,32),this.F&=-113),this.F&7))if(this.F&2){this.F&=-3;var d=160,e=(this.Pb&224)>>5;if(a=this.U&&this.U.cb>e?this.U:null)d=a.jd,e=a.cb;e>(this.L&224)>>5?(this.F&4&&(this.u[7]=this.u[7]+2&65535,this.F&=-5),this.ea(d,26),e=!0):e=!1;
if(e&&a)if(e=this.U,e==a)this.U=a.next;else for(;e;){d=e.next;if(d==a){e.next=d.next;break}e=d}}else this.F&1&&this.F++;this.G&57344||(this.Ma=0,this.tb=this.u[7]);this.F=this.F&7|this.L&16;this.decode(Bd(this))}while(0<this.b);return this.v.complete?this.ba-this.b:void 0===this.v.complete?0:-1};Ta(function(){for(var a=B(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new ad(d);A(d,c)}});function Yd(a,b){var c=b+a;Dd(this,c,a,b);return c&65535}
function Zd(a,b){var c=b+a;Dd(this,c<<8,a<<8,b<<8);return c&255}function $d(a,b){a=b<<1;Ed(this,a);return a&65535}function ae(a,b){a=b<<1;Ed(this,a<<8);return a&255}function be(a,b){a=b&32768|b>>1|b<<16;Ed(this,a);return a&65535}function ce(a,b){a=b&2048|b>>1|b<<8;Ed(this,a<<8);return a&255}function de(a,b){a=b&~a;P(this,a);return a}function ee(a,b){a=b&~a;P(this,a<<8);return a}function fe(a,b){a|=b;P(this,a);return a}function ge(a,b){a|=b;P(this,a<<8);return a}
function he(a,b){a=~b|65536;Cd(this,a);return a&65535}function ie(a,b){a=~b|256;Cd(this,a<<8);return a&255}function je(a,b){a=b-a;this.F&128||(this.S=this.X=a,this.O=b&(b^a));return a&65535}function ke(a,b){a=b-a;var c=a<<8;b<<=8;this.F&128||(this.S=this.X=c,this.O=b&(b^c));return a&255}function le(a,b){a=b+a;this.F&128||(this.S=this.X=a,this.O=a&(b^a));return a&65535}function me(a,b){a=b+a;var c=a<<8;this.F&128||(this.S=this.X=c,this.O=c&(b<<8^c));return a&255}
function ne(a,b){a=-b;Cd(this,a,a&b&32768);return a&65535}function oe(a,b){a=-b;Cd(this,a<<8,(a&b&128)<<8);return a&255}function pe(a,b){a=b<<1|this.N>>16&1;Ed(this,a);return a&65535}function qe(a,b){a=b<<1|this.N>>16&1;Ed(this,a<<8);return a&255}function re(a,b){a=(this.N&65536|b)>>1|b<<16;Ed(this,a);return a&65535}function se(a,b){a=((this.N&65536)>>8|b)>>1|b<<8;Ed(this,a<<8);return a&255}function te(a,b){var c=b-a;Fd(this,c,a,b);return c&65535}
function ue(a,b){var c=b-a;Fd(this,c<<8,a<<8,b<<8);return c&255}function ve(a,b){this.F&128||(this.S=this.X=b&65280,this.O=this.N=0);return(b<<8|b>>8)&65535}function we(a,b){a^=b;P(this,a);return a&65535}function xe(a){R(this,a,Qd(this,a),Yd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}
function ye(a){var b=Td(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.N=this.O=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.N=c<<17-b,c>>=b;else if(b)if(16<b)this.O=c,c=0;else{this.N=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.O=32768)}this.u[a]=c&65535;this.S=this.X=c;this.b-=(this.g?6:7)+b}
function ze(a){var b=Td(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.N=this.O=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.N=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.N=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.O=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.S=d>>16;this.X=d>>16|d;this.b-=(this.g?6:7)+b}function Ae(a){S(this,a,!yd(this))}function Be(a){S(this,a,yd(this))}
function Ce(a){R(this,a,Qd(this,a),de);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function De(a){Q(this,a,Pd(this,a),ee);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function Ee(a){R(this,a,Qd(this,a),fe);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function Fe(a){Q(this,a,Pd(this,a),ge);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}
function Ge(a){P(this,Qd(this,a)&Td(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)}function He(a){P(this,(Pd(this,a)&Sd(this,a))<<8);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)}function Ie(a){S(this,a,Ad(this))}function Je(a){S(this,a,!this.Da()==!zd(this))}function Ke(a){S(this,a,!Ad(this)&&!this.Da()==!zd(this))}function Le(a){S(this,a,!yd(this)&&!Ad(this))}function Me(a){S(this,a,Ad(this)||!this.Da()!=!zd(this))}
function Ne(a){S(this,a,yd(this)||Ad(this))}function Oe(a){S(this,a,!this.Da()!=!zd(this))}function Pe(a){S(this,a,this.Da())}function Qe(a){S(this,a,!Ad(this))}function Re(a){S(this,a,!this.Da())}function Se(){this.ea(12,1);this.b-=5}function Te(a){S(this,a,!0)}function Ue(a){S(this,a,!zd(this))}function Ve(a){S(this,a,zd(this))}function T(a){a&1&&(this.N=0);a&2&&(this.O=0);a&4&&(this.X=1);a&8&&(this.S=0);this.b-=5}
function We(a){var b=Qd(this,a);a=Td(this,a);Fd(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)}function Xe(a){var b=Pd(this,a)<<8;a=Sd(this,a)<<8;Fd(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)}
function Ye(a){var b=Td(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.N=this.O=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.X=d>>16|d,this.S=d>>16):(this.O=32768,this.X=d>>15|d,this.S=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.X=this.S=0,this.O=32768,this.N=65536,this.b-=7}function Ze(){this.ea(24,2);this.b-=25}function $e(){this.L&49152?(this.Z|=128,this.ea(4,3)):this.da();this.b-=7}
function af(){this.ea(16,4);this.b-=25}var bf=[0,7,7,10,7,11,9,13];function cf(a){var b=this.b;O(this,Rd(this,a));this.b=b-bf[this.g]}var df=[0,14,14,17,14,18,16,20];function ef(a){var b=this.b,c=Rd(this,a);a=a>>6&7;Gd(this,this.u[a]);this.u[a]=this.u[7];O(this,c);this.b=b-df[this.g]}var ff=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function gf(a){var b=Qd(this,a),c=this.b;P(this,Vd(this,a,b));this.b=c-ff[(this.H?8:0)+this.g]+(7!=this.f||this.g?0:2)}
function hf(a){var b=Pd(this,a);P(this,Ud(this,a,b,1)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}var jf=[7,13,13,17,14,18,17,21];function kf(a){var b=Td(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.F&128||(this.S=b>>16,this.X=this.S|b,this.O=0,this.N=-32768>b||32767<b?65536:0);this.b-=23}function lf(){this.b-=5}function mf(){this.L&49152||(xd(this),this.w.reset());this.b-=667}
function nf(){Hd(this);this.F|=this.L&16;this.b-=13}function of(a){if(a&8)V.call(this,a);else{var b=Id(this);a&=7;O(this,this.u[a]);this.u[a]=b;this.b-=9}}function W(a){a&1&&(this.N=65536);a&2&&(this.O=32768);a&4&&(this.X=0);a&8&&(this.S=32768);this.b-=5}function pf(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)O(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function qf(a){R(this,a,Qd(this,a),te);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}
function rf(a){R(this,a,0,ve);this.b-=this.g?9:3+(7==this.f?2:0)}function sf(){this.ea(28,5);this.b-=5}function tf(){this.F&4||this.B.$();this.F|=4;this.u[7]=this.u[7]+-2&65535;this.b-=3}function uf(a){R(this,a,Qd(this,a),we);this.b-=this.g?9:3+(7==this.f?2:0)}function V(a){var b;if(b=this.i)b=this.i,E(b,"undefined opcode "+J(b,a),!0,!0),b=$b(b);b||this.ea(8,6)}function ud(a){vf[a>>12].call(this,a)}function wf(a){xf[a>>6&3].call(this,a)}function yf(a){zf[a>>6&3].call(this,a)}
function Af(a){Bf[a>>6&3].call(this,a)}function Cf(a){Df[a&15].call(this,a)}function Ef(a){Ff[a&15].call(this,a)}function Gf(a){$f[a>>6&3].call(this,a)}function ag(a){bg[a>>6&3].call(this,a)}function cg(a){dg[a>>6&3].call(this,a)}
var vf=[function(a){eg[a>>8&15].call(this,a)},gf,We,Ge,Ce,Ee,xe,V,function(a){fg[a>>8&15].call(this,a)},hf,Xe,He,De,Fe,qf,V],eg=[function(a){gg[a>>4&15].call(this,a)},Te,Qe,Ie,Je,Oe,Ke,Me,ef,ef,wf,yf,Af,V,V,V],xf=[function(a){Cd(this,Vd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,he);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,le);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,je);this.b-=this.g?9:3+(7==this.f?2:0)}],zf=[function(a){R(this,a,0,
ne);this.b-=this.g?11:6},function(a){R(this,a,yd(this)?1:0,Yd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,yd(this)?1:0,te);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Td(this,a);Cd(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],Bf=[function(a){R(this,a,0,re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,pe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,be);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,$d);this.b-=this.g?9:3+(7==this.f?2:0)}],
gg=[function(a){hg[a&15].call(this,a)},V,V,V,cf,cf,cf,cf,of,V,Cf,Ef,rf,rf,rf,rf],hg=[$e,tf,nf,Se,af,mf,V,V,V,V,V,V,V,V,V,V],Df=[lf,function(){this.N=0;this.b-=5},function(){this.O=0;this.b-=5},T,function(){this.X=1;this.b-=5},T,T,T,function(){this.S=0;this.b-=5},T,T,T,T,T,T,T],Ff=[lf,function(){this.N=65536;this.b-=5},function(){this.O=32768;this.b-=5},W,function(){this.X=0;this.b-=5},W,W,W,function(){this.S=32768;this.b-=5},W,W,W,W,W,W,W],fg=[Re,Pe,Le,Ne,Ue,Ve,Ae,Be,Ze,sf,Gf,ag,cg,V,V,V],$f=[function(a){Cd(this,
Ud(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,ie);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,me);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,ke);this.b-=this.g?9:3+(7==this.f?2:0)}],bg=[function(a){Q(this,a,0,oe);this.b-=this.g?11:6},function(a){Q(this,a,yd(this)?1:0,Zd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,yd(this)?1:0,ue);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Sd(this,a);Cd(this,a<<8);this.b-=this.g?4:3+(7==
this.f?2:0)}],dg=[function(a){Q(this,a,0,se);this.b-=this.g?9+(this.Wa&1):3+(7==this.f?2:0)},function(a){Q(this,a,0,qe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,ce);this.b-=this.g?9+(this.Wa&1):3+(7==this.f?2:0)},function(a){Q(this,a,0,ae);this.b-=this.g?9:3+(7==this.f?2:0)}];function vd(a){ig[a>>12].call(this,a)}
var ig=[function(a){jg[a>>8&15].call(this,a)},gf,We,Ge,Ce,Ee,xe,function(a){kg[a>>8&15].call(this,a)},function(a){lg[a>>8&15].call(this,a)},hf,Xe,He,De,Fe,qf,V],jg=[function(a){mg[a>>4&15].call(this,a)},Te,Qe,Ie,Je,Oe,Ke,Me,ef,ef,wf,yf,Af,function(a){ng[a>>6&3].call(this,a)},V,V],ng=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.ta(a|this.M);O(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=Nd(this,a,0);Gd(this,a);P(this,a);this.b-=11},function(a){var b=Id(this),c=
this.b;Od(this,a,0,b);P(this,b);this.b=c-jf[this.g]},function(a){P(this,Vd(this,a,this.Da?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],mg=[function(a){og[a&15].call(this,a)},V,V,V,cf,cf,cf,cf,of,function(a){a&8?(this.L&49152||(this.L=this.L&-2017|(a&7)<<5,this.F|=1),this.b-=5):V.call(this,a)},Cf,Ef,rf,rf,rf,rf],og=[$e,tf,nf,Se,af,mf,function(){Hd(this);this.b-=13},V,V,V,V,V,V,V,V,V],kg=[kf,kf,Ye,Ye,ye,ye,ze,ze,uf,uf,V,V,V,V,pf,pf],lg=[Re,Pe,Le,Ne,Ue,Ve,Ae,Be,Ze,sf,Gf,ag,cg,function(a){pg[a>>6&3].call(this,
a)},V,V],pg=[V,function(a){a=Nd(this,a,65536);Gd(this,a);P(this,a);this.b-=11},function(a){var b=Id(this),c=this.b;Od(this,a,65536,b);P(this,b);this.b=c-jf[this.g]},V];
function qg(a){r.call(this,"ROM",a,qg);this.ja=this.f=null;this.D=a.addr;this.g=a.size;this.C=a.alias;this.B=a.file;this.G=oa(this.B);if(this.B){a=this.B;var b=pa(this.G);"json"!=b&&"hex"!=b&&(a=ra()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var c=this;Ba(a,null,!0,function(a,b,f){f?c.pa("Unable to load ROM resource (error "+f+": "+a+")"):(jb(c.Va,a,b),(a=Fa(a,b))?(c.f=a.ga,c.ja=a.ja):c.B=null,rg(c))})}}u(qg);qg.prototype.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;rg(this)};
qg.prototype.Aa=function(){if(this.ja){if(this.i){var a=this.i,b=this.id,c=this.D,d=this.g,e=this.ja,f=[],g;for(g in e){var l=e[g];"number"==typeof l&&(e[g]=l={o:l});var m=l.o,p=l.a;if(void 0!==m){var q=f,m=[m>>>0,g],v=ya(q,m,a.Vb);0>v&&q.splice(-(v+1),0,m)}p&&(l.a=p.replace(/''/g,'"'))}a.G.push({Ud:b,A:c,vc:d,ja:e,Ub:f})}delete this.ja}return!0};qg.prototype.za=function(){return!0};
function rg(a){if(!pb(a)){if(a.B){if(!a.f||!a.w)return;a.g||(a.g=a.f.length);if(a.f.length!=a.g)rb(a,"ROM size ("+k(a.f.length,8,!0)+") does not match specified size ("+k(a.g,8,!0)+")");else{var b;b=a.D;if(Yb(a.w,b,a.g,Cc)){var c;for(c=0;c<a.f.length;c++)a.w.gb(b+c,a.f[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.C?b.push(a.C):null!=a.C&&a.C.length&&(b=a.C);for(c=0;c<b.length;c++){var d=a,e=b[c],f=Xb(d.w,d.D,d.g);Wb(d.w,e,d.g,f)}delete a.f}}}H(a)}}
Ta(function(){for(var a=B(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new qg(d);A(d,c)}});
function sg(a){r.call(this,"RAM",a,sg);this.ja=this.g=null;this.G=a.addr;this.H=a.size;this.C=a.load;this.B=a.exec;this.D=!1;this.f=a.file;this.I=oa(this.f);if(this.f){a=this.f;var b=pa(this.I);"json"!=b&&"hex"!=b&&(a=ra()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Ba(a,null,!0,function(a,b,f){f?c.pa("Unable to load RAM resource (error "+f+": "+a+")"):(jb(c.Va,a,b),(a=Fa(a,b))?(c.g=a.ga,c.ja=a.ja,null==c.C&&null!=a.Lb&&(c.C=a.Lb),null==c.B&&null!=a.Kb&&(c.B=a.Kb)):c.f=null,
tg(c))})}}u(sg);sg.prototype.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;tg(this)};sg.prototype.Aa=function(){return!0};sg.prototype.za=function(){return!0};function tg(a){!a.D&&a.H&&Yb(a.w,a.G,a.H,1)&&(a.D=!0);if(!pb(a)){if(!a.D)n("No RAM allocated");else if(a.f){if(!a.g||!a.w)return;var b=a.G;null!==a.C&&(b=a.C);for(var c=0;c<a.g.length;c++)a.w.gb(b+c,a.g[c]);null!==a.B&&(b=a.b,c=a.B,b.xb=c,O(b,c));delete a.g}H(a)}}sg.prototype.reset=function(){};
Ta(function(){for(var a=B(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new sg(d);A(d,c)}});function ug(a){r.call(this,"Keyboard",a,ug,65536);H(this)}u(ug);ug.prototype.qa=function(){return!1};ug.prototype.Ca=function(a,b,c,d){this.B=a;this.b=c;this.i=d};Ta(function(){for(var a=B(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new ug(d);A(d,c)}});
function X(a){this.C=this.G=null;this.T=a.tabSize;this.M=a.charBOL;this.H=0;r.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.G="";else{var c;a=vg;b&&(void 0===c&&(c="Panel"),(c=mb(c,this.id))&&(b=c.J[b])&&this.qa(null,a,b))}this.I=this.K=null;this.exports={connect:this.cc,receiveData:this.Ob}}u(X);var vg="buffer";h=X.prototype;
h.qa=function(a,b,c){var d=this;switch(b){case vg:return this.J[b]=this.C=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.Ob(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Ob(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.Ca=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;var e=this;this.aa=sc(48,4);this.U=pc(this.b,function(){e.f&128||!e.D.length||(e.R=e.D.shift(),e.f|=128,e.f&64&&qc(e.b,e.aa))});this.ba=sc(52,4);this.V=pc(this.b,function(){e.g|=128;e.g&64&&qc(e.b,e.ba)});mc(b,this,wg);H(this)};
h.cc=function(){if(!this.I){var a=Pc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=va(b[0]);if(c!=this.Ua)return;b=va(b[1]);if(this.I=lb(b)){var d=this.I.exports;if(d){var e=d.connect;e&&e.call(this.I);if(this.K=d.receiveData){this.status(this.Va+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.Aa=function(a,b){if(!b)if(this.cc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.za=function(a){return a?this.save():!0};h.reset=function(){xg(this)};h.save=function(){var a=new N(this);a.set(0,[]);return a.data()};h.restore=function(){return xg(this)};function xg(a){a.R=0;a.f=0;a.g=128;a.D=[];return!0}h.Ob=function(a){if("number"==typeof a)this.D.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.D.push(a.charCodeAt(b));else this.D=this.D.concat(a);rc(this.b,this.U,1);return!0};h.Sc=function(){return this.f&65535};h.Ed=function(a){this.f=this.f&-112|a&111};
h.Rc=function(){this.f&=-129;0<this.D.length&&rc(this.b,this.U,1);return this.R};h.Dd=function(){};h.ed=function(){return this.g};h.Rd=function(a){128==(this.g&192)&&a&64&&rc(this.b,this.V,1);this.g=this.g&-70|a&69};h.dd=function(){return 0};
h.Qd=function(a){if(a&=255){E(this,"transmitByte("+k(a,2,!0)+")");this.K&&this.K.call(this.I,a);if(this.C)if(13==a)this.H=0;else if(8==a)this.C.value=this.C.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=wa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.T||8,c=a-this.H%a,this.T&&(b=ua("",c)));this.M&&!this.H&&c&&(b=String.fromCharCode(this.M)+b);this.C.value+=b;this.C.scrollTop=this.C.scrollHeight;this.H+=c}else if(null!=this.G){if(10==a||1024<=this.G.length)this.j(this.G),
this.G="";10!=a&&(this.G+=String.fromCharCode(a))}this.g&=-129;rc(this.b,this.V,1)}};var yg={},wg=(yg[65392]=[null,null,X.prototype.Sc,X.prototype.Ed,"RCSR"],yg[65394]=[null,null,X.prototype.Rc,X.prototype.Dd,"RBUF"],yg[65396]=[null,null,X.prototype.ed,X.prototype.Rd,"XCSR"],yg[65398]=[null,null,X.prototype.dd,X.prototype.Qd,"XBUF"],yg);Ta(function(){for(var a=B(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new X(d);A(d,c)}});
function wc(a){r.call(this,"PC11",a,wc);this.g=this.f=0}u(wc);h=wc.prototype;h.qa=function(){return!1};h.Ca=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;mc(b,this,zg);H(this)};h.Aa=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.za=function(a){return a?this.save():!0};h.reset=function(){this.f&=-2241;this.g=0};h.save=function(){return(new N(this)).data()};h.restore=function(){return!0};h.Lc=function(){return this.f};
h.xd=function(a){a&1&&(this.f&32768?a&=-2:(this.f&=-129,this.f|=2048));this.f=this.f&-66|a&65};h.Kc=function(){return this.g};h.wd=function(){};var Ag={},zg=(Ag[65384]=[null,null,wc.prototype.Lc,wc.prototype.xd,"PRS"],Ag[65386]=[null,null,wc.prototype.Kc,wc.prototype.wd,"PRB"],Ag);function Bg(a){r.call(this,"Debugger",a,Bg);this.la=a.base||16;this.ya=!1;this.R=this.xa=this.H=0;this.U=!1;this.C=-1;this.g=[];this.aa={}}u(Bg);
var Cg={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Bg.prototype.$b=function(){return-1};Bg.prototype.ac=function(){};
function Dg(a,b,c,d){if(c)if(b){0>a.C&&a.g.length&&(a.C=0);if(0>a.C||b!=a.g[a.C])a.g.splice(0,0,b),a.C=0;a.C--}else a.U?b="end":b=a.g[a.C+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(va(b.substring(c,f))),c=f+1}}return a}
function Eg(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
function Fg(a,b,c){var d;if(b){b=Gg(a,b);for(var e=0,f=!1,g=b,l=[],m=[],p=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<p.length;){var q=p[e++],v=q.length,q=va(q);if(!q){f=!0;break}q=Hg(a,q,null,!1===c);if(void 0===q){f=!0;c=!1;break}l.push(q);if(e==p.length)break;var q=p[e++],w=q.length;m.length&&Cg[q]<Cg[m[m.length-1]]&&Eg(l,m,1);m.push(q);b=b.substr(v+w)}Eg(l,m)&&1==l.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=l.pop(),c&&Ig(a,null,
d))}return d}function Gg(a,b){for(var c,d=a.ya?"(":"{",e=a.ya?")":"}",f=new RegExp(a.ya?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=Fg(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.R-a.xa}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
function Hg(a,b,c,d){var e;if(null!=b){e=a.$b(b);if(0<=e)e=a.ac(e);else if(e=a.aa[b],null==e){e=b;var f=a.la,g;if(e){f||(f=10);var l=e.charAt(0),m=0<e.indexOf(",");m&&(e=e.replace(/,/g,""));"#"==l?(f=8,l=null):"$"==l&&(f=16,l=null);null==l?e=e.substr(1):("0"==l&&(l=e.charAt(1),"b"==l&&m&&(f=2,l=null),"o"==l?(f=8,l=null):"x"==l&&(f=16,l=null)),null==l?e=e.substr(2):(l=e.charAt(e.length-1).toLowerCase(),"y"==l?(f=2,l=null):"."==l?(f=10,l=null):"h"==l&&(f=16,l=null),null==l&&(e=e.substr(0,e.length-1))));
var p,l=e;((m=f)&&10!=m?16==m?l.match(/^[0-9a-f]+$/i):8==m?l.match(/^[0-7]+$/):2==m&&l.match(/^[01]+$/):l.match(/^[0-9]+$/))&&!isNaN(p=parseInt(e,f))&&(g=p|0)}e=g}null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)}else d||a.j("missing "+(c||"value"));return e}
function Ig(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var l=0;l<f;l++){g&&(g=","+g);var m=d&255,p=8,q="";p?32<p&&(p=32):p=32;if(null==m||isNaN(m))for(;0<p--;)q="?"+q;else for(;0<p--;)q=(m&1?"1":"0")+q,m>>=1;g=q+g;d>>=8}d=k(c,0,!0)+" "+c+". "+na(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function Jg(a,b){if(b)return Ig(a,b,a.aa[b]);var c=0;for(b in a.aa)Ig(a,b,a.aa[b]),c++;return 0<c}
function J(a,b,c,d){switch(a.la){case 8:a=na(b,3*c);break;case 10:a=b.toString();break;default:a=k(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}function Kg(a){Bg.call(this,a);this.ya=!0;this.K=Z(0);this.Pa=Z(0);this.T=Z(0);this.G=[];this.f=this.M=this.D=[];Lg(this);this.oa=0;Mg(this);this.Fa={};Ng(this,a.messages);this.Ga=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Sc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Sc(b,a)})}
u(Kg,Bg);
var Og={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},Pg=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),Qg=
{61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],33024:[23,
4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106],35072:[107]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,63],35904:[72,63],
35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},Rg=[0],Sg=[58,60,65,96,108,
110,100,101,102,103,104,105,59,64];h=Kg.prototype;
h.Ca=function(a,b,c,d){this.w=b;this.b=c;this.B=a;(a=Pc(a,"messages"))&&Ng(this,a);this.Ya=Qg;this.nb=1145>this.b.$a?Sg:[];Tg(this,function(a){a:{var b=d.w.W,c=a[0],e=a=0,m=b.length;if(c){a=d.Y(Ug(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.w.ha;m=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,p=0;m--;){var q=b[e];q.type==c?p++||d.j("..."):(c=q.type,p=bc[c],q&&d.j(k(q.id,8)+" %"+k(e<<d.w.ha,
8)+" %%"+k(q.A,8)+" "+k(q.vb,4,!0)+" "+k(q.size,4,!0)+" "+p),c!=Bc&&(c=-1),p=0);a+=d.w.ua;e++}}});H(this)};
h.qa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.na=this.J[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Sc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.C<d.g.length-1&&(b=d.g[++d.C])):40==a.keyCode&&(0<d.C?b=d.g[--d.C]:(b="",d.C=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.J[b]=c,Na(c,function(){if(d.na){var a=d.na.value;
d.na.value="";Sc(d,a,!0);return!0}return!1}),!0;case "step":return this.J[b]=c,Na(c,function(a){var b=!1;ob(d,!0)||(nb(d,!0),b=d.ib(a?1:0),nb(d,!1));return b}),!0}return!1};h.ub=function(){this.na&&this.na.focus()};h.Y=function(a){a=a&&a.A;null==a&&(a=-1);return a};h.ob=function(a,b){var c=255,d=this.Y(a,!1,1);-1!==d&&(c=a.yb?this.w.Bb(d):this.b.Bb(d),b&&Vg(a,b));return c};h.ma=function(a,b){var c=65535,d=this.Y(a,!1,2);-1!==d&&(c=a.yb?this.w.pb(d):this.b.pb(d),b&&Vg(a,b));return c};
h.Fb=function(a,b,c){var d=this.Y(a,!0,1);-1!==d&&(a.yb?this.w.gb(d,b):this.b.gb(d,b),c&&Vg(a,c),this.B.$(!0))};h.Ta=function(a,b,c){var d=this.Y(a,!0,2);-1!==d&&(a.yb?this.w.Gb(d,b):this.b.Gb(d,b),c&&Vg(a,c),this.B.$(!0))};function Z(a,b){return{A:a,yb:b,Ba:!1}}function Wg(a){return[a.A,a.Ba]}function Xg(a){return{A:a[0],Ba:a[1]}}
function Ug(a,b,c){var d,e=(c?a.K:a.Pa).A;c=!1;if(void 0!==b){b=Gg(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.G.length;e++){var g=a.G[e].ja[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Z(d));break}}if(d=f)return d;e=Fg(a,b,void 0)}null!=e&&(d=Z(e,c));return d}function Yg(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.lc=Dg(a,b.hc=c[2]))}function Vg(a,b){null!=a.A&&(a.A+=b||1)}
function Ng(a,b){a.i=a;a.ka=a.nc=536870912;a.ra=null;a.wa=[];b=Dg(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in Gb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.ka|=Gb[c],a.j(c+" messages enabled"))}}function Tg(a,b){for(var c in Gb)if(64==Gb[c]){a.Fa[c]=b;break}}
h.$b=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function Zg(a){return 6>a?"R"+a:6==a?"SP":"PC"}h.ac=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ea[a-8]:20>a?b=this.b.va[a-16]:20==a&&(b=Lb(this.b)));return b};
h.message=function(a,b){b&&(a+=" @"+J(this,Z(this.b.tb).A));this.ka&1073741824?this.wa.push(a):this.ra&&a==this.ra||(this.ra=a,this.ka&-2147483648&&(this.da(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,Yc(a),a.na=0,a.B.$()))};
function Mg(a){var b;if(Wd(a)){if(!a.I||!a.I.length){a.I=Array(1E3);for(b=0;b<a.I.length;b++)a.I[b]=Z();a.fa=0;a.j("instruction history buffer allocated")}if(!a.ba||!a.ba.length)for(a.ba=Array(256),b=0;b<a.ba.length;b++)a.ba[b]=[b,0]}else a.I&&a.I.length&&a.j("instruction history buffer freed"),a.fa=0,a.I=[],a.ba=[]}h.hb=function(a,b){if(!$g(this,b))return!1;this.b.hb(a);return!0};
h.ib=function(a,b,c){if(!$g(this))return!1;this.H=0;a||Wd(this)&&Xd(this,this.b.u[7],0);try{a=Zc(this.b,a);var d=this.b.ib(a);0<d&&($c(this.b,a),this.H+=d,Wc(this.b,d,!0),Tc(this.b,d),this.R++)}catch(e){"number"!=typeof e&&(this.H=0,rb(this.b,e.stack||e.message))}!1!==c&&this.B.$();this.$(b||!1);return 0<this.H};h.da=function(a){this.b&&this.b.da(a)};h.$=function(a){void 0===a&&(a=!0);this.K=Z(this.b.u[7]);a&&1!=this.V?ah(this):bh(this)};
function $g(a,b){var c;(c=!a.b||!pb(a.b))||(c=a.b,c.v.ia?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.v.ca?(b||a.j("cpu busy or unavailable, command ignored"),!1):!qb(a.b)}h.Aa=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};h.za=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){Mg(this);this.R=this.xa=0;this.ra=null;this.H=0;this.K=Z(this.b.u[7]);this.v.ca=!1;ch(this);a||this.$()};
h.save=function(){var a=new N(this);a.set(0,Wg(this.K));a.set(1,Wg(this.T));a.set(2,[this.g,this.U,this.ka]);a.set(3,this.G);return a.data()};h.restore=function(a){var b=0;void 0!==a[2]&&(this.K=Xg(a[b++]),this.T=Xg(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.U=a[b][1],this.ka|=a[b][2]);a[3]&&(this.G=a[3]);return!0};h.start=function(a,b){this.V||this.j("running");this.v.ca=!0;this.xb=a;this.Ab=b};
h.stop=function(a,b){if(this.v.ca){this.v.ca=!1;this.H=b-this.Ab;if(!this.V){b="stopped";if(this.H){a-=this.xb;var c=0<a?Math.round(1E3*this.H/a):0;b+=" (";Wd(this)&&(b+=this.R+" opcodes, ",this.xa-=this.R,this.R=0);b+=this.H+" cycles, "+a+" ms, "+c+" hz)"}else G(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}this.$(!0);this.ub();ch(this,this.b.u[7])}};function Wd(a){return 1<a.f.length||!!a.oa}
function Xd(a,b,c){var d=a.b;if(0<c&&(a.oa&&!--a.oa||Kc(a,b,1,a.f)))return!0;0<=c&&a.ba.length&&(a.R++,null!=a.b.pb(b)&&(b=a.I[a.fa],b.A=d.u[7],b.Ba=!1,++a.fa==a.I.length&&(a.fa=0)));return!1}function $b(a){var b=a.b;if(b.v.ca)throw O(b,a.b.tb),a.da(),-1;return!1}function Lg(a){var b,c;a.f=["bp"];if(a.M)for(b=1;b<a.M.length;b++){c=a.M[b];var d=a.w;c=a.Y(c);Lc(d.W[c>>>d.ha],!1)}a.M=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.w,c=a.Y(c),Lc(d.W[c>>>d.ha],!0);a.D=["bw"];a.Wa=0}
h.Qa=function(a,b,c){var d=!0;c||dh(this,a,b,!1,!0);if(a!=this.f){var e=this.Y(b);if(-1===e)this.j("invalid address: "+J(this,b.A)),d=!1;else{var f=this.w;f.W[e>>>f.ha].Qa(e&f.w,a==this.D)}}d&&(a.push(b),c?b.Ba=!0:(eh(this,a,a.length-1,"set"),Mg(this)));return d};function dh(a,b,c,d,e){var f=!1;c=a.Y(c);for(var g=1;g<b.length;g++){var l=b[g];if(c==a.Y(l)&&(!d||l.Ba)){f=!0;l.Ba||e||eh(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.w,Lc(d.W[c>>>d.ha],b==a.D));l.Ba||Mg(a);break}}return f}
function fh(a,b){for(var c=1;c<b.length;c++)eh(a,b,c);return b.length-1}function eh(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.A)+(d?" "+d:c.hc?' "'+c.hc+'"':""))}function ch(a,b){if(void 0!==b)Kc(a,b,1,a.f,!0),a.V=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ba){if(!dh(a,a.f,c,!0))break;b=0}}}
function Kc(a,b,c,d,e){var f=!1;if(!a.Wa++)for(var g=1;!f&&g<d.length;g++){var l=d[g];if(!e||l.Ba)for(var m=a.Y(l),p=0;p<c;p++)if(b+p==m){var q,f=!0;l.Ba&&(dh(a,d,l,!0),e=!0);if(q=l.lc){for(var f=!1,v=0;v<q.length;v++)if(!gh(a,q[v],!0)){if(q[v].indexOf("if")){f=!0;break}for(var w=v+1;w<q.length&&q[w].indexOf("else");w++)v++;if(w==q.length){f=!0;break}}a.b.v.ca||(f=!0)}if(f){e||eh(a,d,g,"hit");break}}}a.Wa--;return f}
function hh(a,b,c,d){var e=Z(b.A),f=a.ma(b,2),g,l;for(l in a.Ya)if(g=a.Ya[l][f&l])break;g||(g=Rg);var m=g[0];0<=a.nb.indexOf(m)&&(g=Rg,m=g[0]);var p=l="",q=Pg[m],v=g.length-1;m||v||(l=J(a,f));for(m=1;m<=v;m++){var w=g[m];if(void 0!==w){var x;x=a;var C=w,w=b,y="",D=C&61440;if(4096==D)w=w.A+((f&255)<<24>>23)&65535,y=J(x,w);else if(8192==D)w=w.A-((f&63)<<1)&65535,y=J(x,w);else if(12288==D)y=J(x,f&7,1);else if(24576==D)y=J(x,f&63,1);else if(D=f&C,C&4032&&(D>>=6,C>>=6),C&63)switch(C=D&7,D&56){case 0:y=
Zg(C);break;case 8:y="@"+Zg(C);break;case 16:7>C?y="("+Zg(C)+")+":(D=x.ma(w,2),y="#"+J(x,D,0,!0));break;case 24:7>C?y="@("+Zg(C)+")+":(D=x.ma(w,2),y="@#"+J(x,D,0,!0));break;case 32:y="-("+Zg(C)+")";break;case 40:y="@-("+Zg(C)+")";break;case 48:D=x.ma(w,2);y=J(x,D,0,!0)+"("+Zg(C)+")";7==C&&(y=[y,J(x,D+w.A&65535)]);break;case 56:D=x.ma(w,2),y="@"+J(x,D)+"("+Zg(C)+")",7==C&&(y=[y,J(x,D+w.A&65535)])}x=y;if(!x||!x.length){l="INVALID";break}"string"!=typeof x&&(p=x[1],x=x[0]);0<l.length&&(l+=",");l+=x||
"???"}}f="";g=J(a,e.A)+":";if(-1!==e.A&&-1!==b.A){do if(f+=" "+J(a,a.ma(e,2)),null==e.A)break;while(e.A!=b.A)}g+=ua(f,24);g+=ua(q,5);l&&(g+=" "+l);if(c||p)g=ua(g,60)+";"+(c||""),g=a.b.v.Za?g+("cycles="+Uc(a.b).toString()+" cs="+k(a.b.qb)):g+(null!=d?"="+d.toString():""),p&&(g+=" @"+p);return g}function ih(a,b){switch(b){case "N":a=a.b.Da();break;case "Z":a=Ad(a.b);break;case "V":a=zd(a.b);break;case "C":a=yd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function jh(a,b){var c="",d=a.b;8>b?(c=Zg(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Ea[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.va[b-16]):20==b&&(c="PS="+J(a,Lb(d)));c&&(c+=" ");return c}function kh(a){var b,c="";for(b=0;6>b;b++)c+=jh(a,b);c=c+"\n"+(jh(a,6)+jh(a,7)+jh(a,20));return c+=ih(a,"T")+ih(a,"N")+ih(a,"Z")+ih(a,"V")+ih(a,"C")}h.Vb=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function lh(a,b,c){var d=[],e=a.Y(b)>>>0;for(b=0;b<a.G.length;b++){var f=a.G[b],g=f.A>>>0,l=f.vc;if(e>=g&&e<g+l){e=ya(f.Ub,[e-g],a.Vb);0<=e?mh(a,b,e,d):c&&(e=~e,mh(a,b,e-1,d),mh(a,b,e,d));break}}return d}function mh(a,b,c,d){var e={},f=a.G[b].Ub,g=0,l=null;0<=c&&c<f.length&&(g=f[c][0],l=f[c][1]);l&&(e=a.G[b].ja[l],l="."==l.charAt(0)?null:e.l||l);d.push(l);d.push(g);d.push(e.a);d.push(e.c)}
function nh(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Jg(a)||a.j("no variables"),!0;if(!c[2])return Jg(a,c[1]);if(!c[3])return delete a.aa[c[1]],!0;b=Fg(a,c[3]);return void 0!==b?(a.aa[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
function oh(a,b,c){var d=null;if(b=Ug(a,b,!0)){a.Y(b);var e=lh(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.A-e[1])&&(g=" + "+k(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.j(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.A)&&(g=" - "+k(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
function ah(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}f=Fg(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":O(d,f);a.K=Z(d.u[7]);break;case "N":d.S=f?32768:0;break;case "Z":d.X=
f?0:1;break;case "V":d.O=f?32768:0;break;case "C":d.N=f?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=f&65535;break}a.j("unknown register: "+e);return}a.B.$();a.j("updated registers:")}a.j(kh(a));c&&(a.K=Z(d.u[7]),bh(a,J(a,a.K.A)))}}function ph(a,b){b=va(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):Ig(a,null,c[2].charCodeAt(0)):Fg(a,b,!0)}
function qh(a,b,c){var d="t"!=b;c=Hg(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ma(c,function(){return nb(a,!0)&&a.ib(e,d,!1)},function(){a.B.$();nb(a,!1)})}
function bh(a,b,c,d){if(b=Ug(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=Hg(a,c.substr(1)),null!=c&&(d=c);else{d=Ug(a,c,!0);if(!d||d.A<b.A)return;e=d.A-b.A;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=ob(a,!1)||a.V?a.H:null;var g=null!=f?"cycles":null,l=lh(a,b),m=b.A;if(l[0]&&d&&(!c&&d||0>l[0].indexOf("+"))){var p=l[0]+":";l[2]&&(p+=" "+l[2]);a.j(p)}l[3]&&(g=l[3],f=null);f=hh(a,b,g,f);a.j(f);a.K=b;e-=b.A-m;c++}}}
function gh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.U&&(a.j("ended assemble at "+J(a,a.T.A)),a.K=a.T,a.U=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ra=null;if(pb(a)&&0<b.length){a.U&&(b="a "+J(a,a.T.A)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");if(g&&g.length)for(var l=g[0],m=l.charAt(0),p=1;p<l.length;p++){var q=l.charAt(p);if("?"==m||"r"==m||"a">q||"z"<q){g[0]=l.substr(p);g.unshift(l.substr(0,p));break}}g[0]=g[0].toLowerCase();switch(g[0].charAt(0)){case "a":var v=
Ug(a,g[1],!0);if(v)if(a.T=v,void 0===g[2])a.j("begin assemble at "+J(a,v.A)),a.U=!0,a.B.$();else{var w;a.j("not supported yet");w=[];if(w.length){for(var x=0;x<w.length;x++)a.Fb(v,w[x],1);a.j(hh(a,a.T))}}break;case "b":a:{var C=g[0],y=g[1],D=b;if("?"==y)a.j("breakpoint commands:"),a.j("\tbp [a]\tset exec breakpoint at addr [a]"),a.j("\tbr [a]\tset read breakpoint at addr [a]"),a.j("\tbw [a]\tset write breakpoint at addr [a]"),a.j("\tbc [a]\tclear breakpoint at addr [a]"),a.j("\tbl\tlist all breakpoints"),
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var Ca=C.charAt(1);if("l"==Ca){var bd;bd=0+fh(a,a.f);bd+=fh(a,a.M);(bd+=fh(a,a.D))||a.j("no breakpoints")}else if("n"==Ca)a.oa=Hg(a,y),a.j("break after "+a.oa+" instruction(s)");else if(void 0===y)a.j("missing breakpoint address");else{var U=Z();if("*"!=y&&(U=Ug(a,y,!0),!U))break a;"c"==Ca?null==U.A?(Lg(a),a.j("all breakpoints cleared")):dh(a,a.f,U)||dh(a,a.M,U)||dh(a,a.D,U)||a.j("breakpoint missing: "+J(a,U.A)):null!=U.A&&(Yg(a,U,D),"p"==Ca?a.Qa(a.f,
U):"r"==Ca?a.Qa(a.M,U):"w"==Ca?a.Qa(a.D,U):a.j("unknown breakpoint command: "+Ca))}}}break;case "c":a.Ra&&(a.Ra.value="");break;case "d":a:{var Xa,Ya=g[0],ha=g[1],Da=g[2],Jh=g[3];if("?"==ha){var Za="";for(Xa in Gb)a.Fa[Xa]&&(Za&&(Za+=","),Za+=Xa);Za+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
Za.length&&a.j("dump extension commands:\n\t"+Za)}else if("state"==ha){var Hf=rh(a.B,!0);"console"==Da?console.log(Hf):(a.Ra&&(a.Ra.value=""),a.j(Hf))}else if("symbols"==ha)for(var cd=0;cd<a.G.length;cd++){var dd=a.G[cd],$a;for($a in dd.ja)if("."!=$a.charAt(0)){var If=dd.ja[$a].o;if(void 0!==If){var Jf=dd.ja[$a].l;Jf&&($a=Jf);a.j(J(a,If)+" "+$a)}}}else{if("d"==Ya){for(Xa in Gb)if(g[1]==Xa){var Kf=a.Fa[Xa];Kf?(g.shift(),g.shift(),Kf(g)):a.j("no dump registered for "+ha);break a}ha||(Ya=a.Cb||"db")}else a.Cb=
Ya;if("dh"==Ya){var Lf=ha,Mf=Da,Nf="",Of=0,ca=a.fa,ia=a.I;if(ia.length){var Y=+Lf||a.Xa,tb=+Mf||10;isNaN(Y)?Y=tb:Nf="more ";Y>ia.length&&(a.j("note: only "+ia.length+" available"),Y=ia.length);ca-=Y;0>ca&&(null==ia[ia.length-1].A?(Y=ca+Y,ca=0):ca+=ia.length);var ed=[];"call"==Mf&&(tb=1E5,ed=["CALL"]);for(void 0!==Lf&&a.j(Y+" instructions earlier:");0<tb&&ca!=a.fa;){var Pf=ia[ca++];if(null==Pf.A)break;var ub=Z(Pf.A),Kh=Y--,Qf=hh(a,ub,"history",Kh);(!ed.length||0<=Qf.indexOf(ed[0]))&&a.j(Qf);ub.Jb&&
(ca+=ub.Jb,tb-=ub.Jb,Y-=ub.Jb);ca>=ia.length&&(ca=0);a.Xa=Y;Of++;tb--}}Of||(a.j("no "+Nf+"history available"),a.Xa=void 0)}else{var vb=Ug(a,ha);if(vb){var dc=0;Da&&("l"==Da.charAt(0)&&(Da=Da.substr(1)||Jh),dc=Hg(a,Da)>>>0,65536<dc&&(dc=65536));for(var wb="",ab="dd"==Ya?4:"dw"==Ya?2:1,ec=ab*dc||128,Lh=ec+15>>4||1;Lh--&&0<ec;){var fc=0,xb=0,yb,fd="",Rf="",ha=J(a,vb.A);for(yb=4==ab?16:a.la;0<yb&&0<ec;yb--){var gd,gc=2==ab?a.ma(vb,gd=2):a.ob(vb,gd=1),fc=fc|gc<<(xb<<3),xb=xb+gd;xb==ab&&(fd+=J(a,fc,ab),
fd+=1==ab?9==yb?"-":" ":" ",fc=xb=0);Rf+=32<=gc&&128>gc?String.fromCharCode(gc):".";ec--}wb&&(wb+="\n");wb+=ha+" "+fd+(0==yb?" "+Rf:"")}wb&&a.j(wb);a.Pa=vb}}}}break;case "e":if("else"==g[0])break;var bb,hd,id,jd,kd=g[0],ld=g[1];"eb"==kd?(bb=1,hd=255,id=a.ob,jd=a.Fb):"e"==kd||"ew"==kd?(bb=2,hd=65535,id=a.ma,jd=a.Ta):ld=null;if(null==ld)a.j("edit memory commands:"),a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var hc=Ug(a,ld);if(hc)for(var ic=2;ic<
g.length;ic++){var zb=Fg(a,g[ic]);if(void 0===zb){a.j("unrecognized value: "+g[ic]);break}zb&~hd&&a.j("warning: "+k(zb)+" exceeds "+bb+"-byte value");var Mh=id.call(a,hc);a.j("changing "+J(a,hc.A)+" from "+J(a,Mh,bb)+" to "+J(a,zb,bb));jd.call(a,hc,zb,bb)}}break;case "g":a:{var Sf=g[1],Nh=b;if(void 0!==Sf){var md=Ug(a,Sf,!0);if(!md)break a;Yg(a,md,Nh);a.Qa(a.f,md,!0)}a.hb(!0,c)}break;case "h":a.v.ca?(c||a.j("halting"),a.da()):ob(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var nd;
var Ab=b.substr(2),Ab=va(Ab);Fg(a,Ab)?(c||a.j("true: "+Ab),nd=!0):(c||a.j("false: "+Ab),nd=!1);nd||(d=!1);break}f=!0;break;case "k":var Oh=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var od=0,pd=Z(),Bb=Z(a.b.u[6]);for(a.j("stack trace for "+J(a,Bb.A));10>od;){for(var Ea=null,Ph=256;65536>Bb.A>>>0;){pd.A=a.ma(Bb,2);if(null==Bb.A||!Ph--)break;if(!(pd.A&1)){for(var Qh=a,jc=pd,Tf=null,Cb=jc.A,Uf=Cb,qd=1;6>=qd&&Cb;qd++){if(2<
qd){jc.A=Cb;var kc=hh(Qh,jc);if(0<=kc.indexOf("JSR")){var Vf=kc.indexOf(" ");if(Cb+(kc.indexOf(" ",Vf+1)-Vf-1)/2==Uf){Tf=kc;break}}}Cb-=2}jc.A=Uf;if(Ea=Tf)break}}if(!Ea||null==Ea)break;var Wf=null;if("ks"==Oh){var Xf=Ea.match(/[0-9A-F]+$/);Xf&&(Wf=oh(a,Xf[0]))}Ea=ua(Ea,50)+" ;"+(Wf||"stack="+J(a,Bb.A));a.j(Ea);od++}od||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){oh(a,g[1],!0);break}f=!0;break;case "m":a:{var ja,ka=null,F=g[1];"?"==F&&(F=void 0);if(void 0!==F){var xa=0;if("all"==
F)xa=1878917119,F=null;else if("on"==F)ka=!0,F=null;else if("off"==F)ka=!1,F=null;else{"keys"==F&&(F="key");"kbd"==F&&(F="keyboard");for(ja in Gb)if(F==ja){xa=Gb[ja];ka=!!(a.ka&xa);break}if(!xa){a.j("unknown message category: "+F);break a}}if(xa)if("on"==g[2])a.ka|=xa,ka=!0;else if("off"==g[2]&&(a.ka&=~xa,ka=!1,1073741824==xa)){for(var rd=0;rd<a.wa.length;rd++)a.j(a.wa[rd]);a.wa=[]}}var Rh=0,Db="";for(ja in Gb)if(!F||F==ja){var Sh=!!(a.ka&Gb[ja]);if(null===ka||ka==Sh)Db&&(Db+=","),++Rh%10||(Db+="\n\t"),
"key"==ja&&(ja="keys"),Db+=ja}void 0===F&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==ka?ka?"messages on: ":"messages off: ":"message categories:\n\t")+(Db||"none"));Mg(a)}break;case "p":if("print"==g[0]){ph(a,b.substr(5));break}var Th="pr"==g[0]?1:0;if(a.V)a.j("step in progress");else{var Yf=Z(a.b.u[7]);a.ob(Yf);a.V?(a.Qa(a.f,Yf,!0),a.hb()||(a.B&&a.B.ub(),a.V=0)):qh(a,Th?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}ah(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Eb=
+g[2];if(8==Eb||10==Eb||16==Eb)a.la=Eb;else{a.j("invalid base: "+Eb);break}}a.j("default base: "+a.la);break;case "cs":var Fb;void 0!==g[3]&&(Fb=+g[3]);switch(g[2]){case "int":a.b.ab=Fb;break;case "start":a.b.rb=Fb;break;case "stop":a.b.bb=Fb;break;default:a.j("unknown cs option");break a}void 0!==Fb&&Rc(a.b);a.j("checksums "+(a.b.v.Za?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Vc(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.Sa.toFixed(2)+
"Mhz")+" ("+a.b.La+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":qh(a,g[0],g[1]);break;case "u":bh(a,g[1],g[2],8);break;case "v":if("var"==g[0]){nh(a,b.substr(3))||(d=!1);break}if("ver"==
g[0]){a.j("PDPjs version 1.30.1 ("+a.b.$a+",RELEASE"+(sb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){ph(a,b.substr(1));break}var sd="commands:",td;for(td in Og)sd+="\n"+ua(td,9)+Og[td];Wd(a)||(sd+="\nnote: history disabled if no exec breakpoints");a.j(sd);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(Zf){a.j("debugger error: "+(Zf.stack||Zf.message)),d=!1}return d}
function Sc(a,b,c){b=Dg(a,b,c);for(var d in b)if(!gh(a,b[+d]))return!1;return!0}Ta(function(){for(var a=B(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Kg(d);A(d,c)}});
function sh(a,b,c){r.call(this,"Computer",a,sh,67108864);this.v.ia=!1;th(this,b);this.M=Pc(this,"autoPower",a);this.B=0;this.aa=a.busWidth||a.buswidth;this.f=uh;this.I=null;this.G=this.U=!1;this.ba=Pc(this,"url")||"";(Math.random()+.1).toString(36);this.g=vh(this);if(this.b=mb("CPU",this.id)){this.i=mb("Debugger",this.id);this.w=new Mb({id:this.Va+".bus",busWidth:this.aa},this.b,this.i);var d,e=kb(this.id);if((this.C=mb("Panel",this.id))&&this.C.Ra)for(b=0;b<e.length;b++)d=e[b],d.pa=this.C.pa,d.j=
this.C.j,d.Ra=this.C.Ra;this.j("PDPjs v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ca&&d.Ca(this,this.w,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=Pc(this,"state")||(f=!0,a.state))b=this.R=a,f||(this.G=!0,this.f=uh),this.f&&
(this.K=new N(this,"1.30.1"),wh(this.K)?b=null:delete this.K);!b&&this.f&&(b=xh(this))&&(this.G=!0);if(b){var g=this;Ba(b,null,!0,function(a,b,c){c?(g.H=null,g.G=!1,g.pa("Unable to load machine state from server (error "+c+(b?": "+va(b):"")+")")):(g.I=b,g.U=!0);H(g)})}else H(this);this.J.power||(this.M=!0);!c&&this.M&&yh(this,this.sb)}else n("Unable to find CPU component")}u(sh);var uh=0;
function th(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){n(d.message+" ("+c+")")}}a.V=b}function Pc(a,b,c){var d=b.toLowerCase(),d=db[b]||db[d];void 0===d&&a.V&&(d=a.V[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function yh(a,b,c){for(var d=kb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!pb(f)){pb(f,function(){yh(a,b,c)});return}}b.call(a,c)}
function zh(a,b){var c=new N(a,"1.30.1","validate");if(wh(c)&&Ah(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.pa("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=sh.prototype;
h.sb=function(a){void 0===a&&(a=this.f||(this.I?1:uh));if(!this.B){this.B++;var b=!1,c=!1;this.T=!1;var d=this.K||new N(this,"1.30.1");if(-1==a)b=!0;else if(a>uh){if(wh(d,this.I)){this.D=new N(this,"1.30.1","failsafe");wh(this.D)&&(Bh(this,d),a=2,Ch(this.D));this.D.set("timestamp",Aa());Dh(this.D);var e=this.f&&!this.G;if(1==a||Ga("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Ah(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?wh(d,g):("error"==
f&&"no machine state"!=g?(this.pa("Error: "+g),"unable to verify user"==g&&(Ka("user",""),this.g=null)):this.j(f+": "+g),Ch(d),wh(d)?(c=Ah(d),e=!0):c=!1))}e&&zh(this,c?d:null)}else 2==a&&d.clear()}else zh(this);delete this.I;delete this.K}e=kb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Eh(this,g,d,b,c));b=[d,a,c];-1!=a?yh(this,this.Xb,b):this.Xb(b)}};
function Eh(a,b,c,d,e){if(!b.v.ia){b.v.ia=!0;if(b.Aa){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Aa(f,d)&&f&&(n("Unable to restore state for "+b.type),a.R&&!a.U?(c.clear(),a.f=uh,window&&window.location.reload()):a.T=!0,b.Aa(null),e=!1)}if(!d&&b.Yb)for(a=b.Yb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Xb=function(a){var b=a[0],c=0>a[1];a=a[2];this.fa=!0;this.v.ia=!0;var d=this.J.power;d&&(d.textContent="Shutdown");this.b&&(Eh(this,this.b,b,c,a),this.b.lb());this.T&&(Bh(this,b),b.clear());!c&&this.D&&(this.D.clear(),delete this.D);this.B=0};
function Bh(a,b){if(Ga("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.1"};d.url=a.ba;d.user=c;d.type="bug";d.data=b;Ba("http://www.pcjs.org/api/v1/report",d,!0)}}
function rh(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new N(a,"1.30.1"),g=new N(a,"1.30.1","validate"),l=Aa();g.set("timestamp",l);f.set("timestamp",l);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.za&&(c&&a.b.da(),d=a.b.za(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.ia=!1,!1===d&&(e=null)));for(var l=kb(a.id),m=0;m<l.length;m++){var p=l[m];p.v.ia&&(p.za&&(d=p.za(b,c),"object"===typeof d&&f.set(p.id,
d)),c&&(p.v.ia=!1,!1===d&&(e=null)))}e&&(c?(l=d=!1,b?(a.g&&Fh(a,a.g,f.toString()),Dh(g)&&Dh(f)||(e=null,d=l=!0)):a.f&&(d=!0,l=3==a.f),d&&f.clear(l)):e=f.toString());c&&(a.v.ia=!1,b=a.J.power)&&(b.textContent="Power");a.B=0;return e}h.reset=function(){this.w&&this.w.reset&&(E(this,"Resetting "+this.w.type),this.w.reset());for(var a=kb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.w&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}};
h.start=function(a,b){for(var c=kb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.$(!0)};h.stop=function(a,b){for(var c=kb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.$(!0)};
h.qa=function(a,b,c){var d=this;switch(b){case "power":return this.J[b]=c,c.onclick=function(){d.B||(d.v.ia?rh(d,!1,!0):yh(d,d.sb))},!0;case "reset":return this.J[b]=c,c.onclick=function(){if(d.v.ia&&!d.B)if(d.f&&!d.H){var a=Ga("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");rh(d,a,!0);!a&&d.R?window&&window.location.reload():d.sb(uh)}else d.reset(),d.b&&d.b.lb()},!0;case "save":if(qa())c.parentNode.removeChild(c);else return this.J[b]=
c,c.onclick=function(){var a=vh(d,!0);if(a){var b=!!(d.f&&!d.H||d.R),c=rh(d,b);b?Fh(d,a,c):d.pa("Resume disabled, machine state not saved")}},!0}return!1};
function vh(a,b){var c=a.g;c||((c=Ja("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=Gh(a,c))||a.pa("The user ID is invalid.")):b&&a.pa("Browser local storage is not available"));return c}
function Gh(a,b){a.g=null;b=Ba(ra()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ka("user",b.data),a.g=b.data)}catch(d){n(d.message+" ("+c+")")}return a.g}function xh(a){var b=null;a.g&&(b=ra()+"/api/v1/user?req=load&user="+a.g+"&state="+Hh(a,"1.30.1"));return b}
function Fh(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Hh(a,"1.30.1");d.data=c;b=Ba(ra()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.pa("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.pa(c),Ka("user",""),a.g=null)}}h.ub=function(){};
h.$=function(a){this.b&&this.b.$(a);this.C&&this.C.$(a)};Ta(function(){for(var a=B(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=B(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=z(f),g=new sh(g,d,!0);A(g,f);g.M&&yh(g,g.sb)}});Oa.show.push(function(){for(var a=B(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=mb("Computer",c.id))&&c.fa&&!c.v.ia&&c.sb(-1)}});
Oa.exit.push(function(){for(var a=B(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=mb("Computer",c.id))&&c.v.ia&&rh(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=Hh(a,b,c);this.i=a.i;Ch(this,a.tc)}function Hh(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
N.prototype={constructor:N,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Ch(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 Ch(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Dh(a){var b=!0;if(Ia()){var c=JSON.stringify(a[a.id]);Ka(a.key,c)||(n("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Ah(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){n(c.message||c),b=!1}return b}function wh(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ia()&&(b=Ja(a.key))?(a[a.id]=b,a.b=!0):!1}var Ih=0;
function Uh(a,b,c,d,e,f){e("Loading "+a+"...");Ba(a,null,!0,function(g,l,m){m?(l||(l="unable to load "+a+" ("+m+")"),f(l,null)):Vh(l,a,b,c,d,e,f)})}
function Vh(a,b,c,d,e,f,g){function l(a,f){if(f)g(f,null);else{c&&(jb(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){f=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Wh(a,f,l):l(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Wh(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Ba(e,null,!0,function(f,g,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);Wh(a,b,c)}})}else c(a,null)}
function Xh(a,b,c,d){function e(a){if(void 0===l){var b=g&&B(g,"machine-warning");l=b&&b[0]||g}l&&(l.innerHTML=ta(a))}function f(a){e("Error: "+a);m&&(--Ih||Va(!0));m=!1}var g,l,m=!0;Ih++;ib[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=p:v.appendChild(document.createTextNode(p));q.appendChild(v)}c||
(c="/versions/pdpjs/1.30.1/components.xsl");p=function(d,l){l?Uh(c,null,null,!1,e,function(d,m){m?(jb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=l.transformNode(m))?(g.outerHTML=m,--Ih||Va(!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),--Ih||Va(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Uh(b,a,d,!0,e,p):Vh(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(w){f(w.message)}return m}window.embedPDP11=function(a,b,c,d){Va(!1);return Xh(a,b,c,d)};window.enableEvents=Va;window.sendEvent=Wa;})();//# sourceMappingURL=/tmp/pdpjs/1.30.1/pdp11-dbg.map