Added new RL11 component (work-in-progress)

This commit is contained in:
Jeff Parsons 2016-10-24 16:28:48 -07:00 • committed by Jeff Parsons
commit 9e480d7574
24 changed files with 2760 additions and 585 deletions

View file

@ -1,4 +1,5 @@
(function(){/*
http://pcjs.org/modules/shared/lib/diskapi.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2016
@ -25,253 +26,283 @@
http://pcjs.org/modules/pdp11/lib/keyboard.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/serialport.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/pc11.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/disk.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/rl11.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pdp11/lib/computer.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016
*/
for(var k,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,da=["Math","log2"],ea=0;ea<da.length-1;ea++){var fa=da[ea];fa in ba||(ba[fa]={});ba=ba[fa]}var ga=da[da.length-1],ha=ba[ga],ia=ha?ha:function(a){return Math.log(a)/Math.LN2};
ia!=ha&&null!=ia&&aa(ba,ga,{configurable:!0,writable:!0,value:ia});function na(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function l(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
function oa(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function pa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function qa(){var a=ra();return-1!==a.indexOf("pcjs.org",a.length-8)}var sa={"&":"&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 xa(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var za=Date.now||function(){return+new Date};function Aa(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function Ba(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var m="",p;for(p in b)b.hasOwnProperty(p)&&(m&&(m+="&"),m+=p+"="+encodeURIComponent(b[p]));m=m.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(m)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g}
function Ca(a,b){var c,d={da:null,fa:null,ya:null,xa:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.ya=g.load;d.xa=g.exec;if(e=g.bytes)d.da=e;else if(e=g.words)for(d.da=Array(2*e.length),f=c=0;c<e.length;c++)d.da[f++]=e[c]&255,d.da[f++]=e[c]>>8&255;else if(e=g.data)for(d.da=Array(4*e.length),f=c=0;c<e.length;c++)d.da[f++]=
e[c]&255,d.da[f++]=e[c]>>8&255,d.da[f++]=e[c]>>16&255,d.da[f++]=e[c]>>24&255;else d.da=g;d.fa=g.symbols;d.da.length?1==d.da.length&&(n(d.da[0]),d=null):(n("Empty resource: "+a),d=null)}catch(h){n("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){n("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.da=e)}return d}
function ra(){return"http://"+(window?window.location.host:"www.pcjs.org")}function n(a){window&&window.alert(a)}function Da(a){var b=!1;window&&(b=window.confirm(a));return b}var Ea=null;function Fa(){if(null==Ea){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ea=a}return Ea}
function Ga(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Ka(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function La(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Ma(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Na(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Oa={init:[],show:[],exit:[]},Pa=!1,Qa=!1,Ra=!0;function Sa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ta(a){Oa.init.push(a)}
function Ua(a){if(Ra)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){n(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Va(a){!Ra&&a?(Ra=!0,Pa&&Wa("init"),Qa&&Wa("show")):Ra=a}function Wa(a){Oa[a]&&Ua(Oa[a])}Sa("onload",function(){Pa=!0;Ua(Oa.init)});Sa("onpageshow",function(){Qa=!0;Ua(Oa.show)});Sa(La("Opera")||La("iOS")?"onunload":"onbeforeunload",function(){Ua(Oa.exit)});
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Xb=b.comment;this.tc=b;b=this.id.indexOf(".");0>b?this.$a=this.id:(this.Sa=this.id.substr(0,b),this.$a=this.id.substr(b+1));this[a]=c;this.v={ready:!1,Ja:!1,Lb:!1,ka:!1,error:!1};this.Cb=null;this.v.error=!1;this.I={};this.i=null;this.na=d||0;t.push(this)}var Xa=void 0,db={};
if(window){Xa||(Xa=window.location.search.substr(1));for(var eb,fb=/\+/g,gb=/([^&=]+)=?([^&]*)/g;eb=gb.exec(Xa);)db[decodeURIComponent(eb[1].replace(fb," "))]=decodeURIComponent(eb[2].replace(fb," "))}function hb(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function u(a,b){b||(b=r);a.prototype=hb(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var ib=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else ib={},t=[];function jb(a,b,c){ib[a]&&b&&(ib[a][b]=c)}function kb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<t.length;b++){var d=t[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function lb(a){if(void 0!==a){var b;for(b=0;b<t.length;b++)if(t[b].id===a)return t[b]}return null}function mb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<t.length;d++)if(c)c==t[d]&&(c=null);else if(!(a!=t[d].type||b&&t[d].id.indexOf(b)))return t[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){n(c.message+" ("+a+")")}return b}
function B(a,b){b=C(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),m=0;m<h.length;m++)switch(g=h[m],g){case "pdp11-binding":(g=z(f))&&g.binding&&a.qa(g.type,g.binding,f,g.value),m=h.length}}}}
function C(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},qa:function(a,b,c){switch(b){case "clear":return this.I[b]||(this.I[b]=c,c.onclick=function(a){return function(){a.I.print&&(a.I.print.value="")}}(this)),!0;case "print":return this.I[b]||(this.Fa=this.I[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.ja=function(a){this.j(a,this.$a)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.$a+": "+a)},ja:function(a,b,c){c=c||this.type;b||n((c?c+": ":"")+a)},Aa:function(){return this.v.ka=!0},za:function(a,b){b&&(this.v.ka=!1);return!0}};function D(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.na;var c=a.i.na&b;return!!b&&c===b||!!(c&a.i.oc)}return!1}
function nb(a,b){if(a.v.Lb)return a.v.Ja=!1,a.v.Lb=!1;if(a.v.error)return a.j(a.toString()+" error"),!1;a.v.Ja=b;return a.v.Ja}function ob(a,b){a.v.Ja&&(b?a.v.Lb=!0:void 0===b&&a.j(a.toString()+" busy"));return a.v.Ja}function H(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.Cb;a.Cb=null;b&&b()}}function pb(a,b){b&&(a.v.ready?b():a.Cb=b);return a.v.ready}function qb(a){return a.v.error?(a.j(a.toString()+" error"),!0):!1}function rb(a,b){a.v.error=!0;a.ja(b)}
for(var k,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,ca=["Math","log2"],da=0;da<ca.length-1;da++){var fa=ca[da];fa in ba||(ba[fa]={});ba=ba[fa]}var ga=ca[ca.length-1],ha=ba[ga],ja=ha?ha:function(a){return Math.log(a)/Math.LN2};
ja!=ha&&null!=ja&&aa(ba,ga,{configurable:!0,writable:!0,value:ja});var ka={163840:[40,1,8],184320:[40,1,9],327680:[40,2,8],368640:[40,2,9],737280:[80,2,9],1228800:[80,2,15],1474560:[80,2,18],2949120:[80,2,36],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]};
function pa(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function qa(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function l(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
function ra(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function sa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ta(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ua={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function va(a){return a.replace(/[&<>"']/g,function(a){return ua[a]})}
function wa(a,b){return(a+" ").slice(0,b)}function xa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var ya={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
function za(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var Aa=Date.now||function(){return+new Date};function Ba(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function Da(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var m="",n;for(n in b)b.hasOwnProperty(n)&&(m&&(m+="&"),m+=n+"="+encodeURIComponent(b[n]));m=m.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(m)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g}
function Ea(a,b){var c,d={ea:null,ga:null,Ca:null,Ba:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Ca=g.load;d.Ba=g.exec;if(e=g.bytes)d.ea=e;else if(e=g.words)for(d.ea=Array(2*e.length),f=c=0;c<e.length;c++)d.ea[f++]=e[c]&255,d.ea[f++]=e[c]>>8&255;else if(e=g.data)for(d.ea=Array(4*e.length),f=c=0;c<e.length;c++)d.ea[f++]=
e[c]&255,d.ea[f++]=e[c]>>8&255,d.ea[f++]=e[c]>>16&255,d.ea[f++]=e[c]>>24&255;else d.ea=g;d.ga=g.symbols;d.ea.length?1==d.ea.length&&(p(d.ea[0]),d=null):(p("Empty resource: "+a),d=null)}catch(h){p("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){p("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.ea=e)}return d}
function Fa(){return"http://"+(window?window.location.host:"www.pcjs.org")}function p(a){window&&window.alert(a)}function Ga(a){var b=!1;window&&(b=window.confirm(a));return b}var Ha=null;function Ia(){if(null==Ha){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ha=a}return Ha}
function Ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Na(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Oa(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Pa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Qa(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Ra={init:[],show:[],exit:[]},Sa=!1,Ta=!1,Ua=!0;function Va(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Wa(a){Ra.init.push(a)}
function Xa(a){if(Ua)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){p(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ya(a){!Ua&&a?(Ua=!0,Sa&&Za("init"),Ta&&Za("show")):Ua=a}function Za(a){Ra[a]&&Xa(Ra[a])}Va("onload",function(){Sa=!0;Xa(Ra.init)});Va("onpageshow",function(){Ta=!0;Xa(Ra.show)});Va(Oa("Opera")||Oa("iOS")?"onunload":"onbeforeunload",function(){Xa(Ra.exit)});
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.mc=b.comment;this.Oc=b;b=this.id.indexOf(".");0>b?this.Za=this.id:(this.Ia=this.id.substr(0,b),this.Za=this.id.substr(b+1));this[a]=c;this.v={ready:!1,Qa:!1,Vb:!1,ha:!1,error:!1};this.Lb=null;this.v.error=!1;this.F={};this.i=null;this.na=d||0;t.push(this)}var $a=void 0,ab={};
if(window){$a||($a=window.location.search.substr(1));for(var hb,ib=/\+/g,jb=/([^&=]+)=?([^&]*)/g;hb=jb.exec($a);)ab[decodeURIComponent(hb[1].replace(ib," "))]=decodeURIComponent(hb[2].replace(ib," "))}function kb(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function u(a,b){b||(b=r);a.prototype=kb(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var lb=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else lb={},t=[];function mb(a,b,c){lb[a]&&b&&(lb[a][b]=c)}function nb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<t.length;b++){var d=t[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function ob(a){if(void 0!==a){var b;for(b=0;b<t.length;b++)if(t[b].id===a)return t[b]}return null}function pb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<t.length;d++)if(c)c==t[d]&&(c=null);else if(!(a!=t[d].type||b&&t[d].id.indexOf(b)))return t[d]}return null}function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){p(c.message+" ("+a+")")}return b}
function C(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),m=0;m<h.length;m++)switch(g=h[m],g){case "pdp11-binding":(g=A(f))&&g.binding&&a.qa(g.type,g.binding,f,g.value),m=h.length}}}}
function D(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},qa:function(a,b,c){switch(b){case "clear":return this.F[b]||(this.F[b]=c,c.onclick=function(a){return function(){a.F.print&&(a.F.print.value="")}}(this)),!0;case "print":return this.F[b]||(this.Ka=this.F[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.O=function(a){this.j(a,this.Za)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.Za+": "+a)},O:function(a,b,c){c=c||this.type;b||p((c?c+": ":"")+a)},za:function(){return this.v.ha=!0},ya:function(a,b){b&&(this.v.ha=!1);return!0}};function E(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.na;var c=a.i.na&b;return!!b&&c===b||!!(c&a.i.Ic)}return!1}
function qb(a,b){if(a.v.Vb)return a.v.Qa=!1,a.v.Vb=!1;if(a.v.error)return a.j(a.toString()+" error"),!1;a.v.Qa=b;return a.v.Qa}function rb(a,b){a.v.Qa&&(b?a.v.Vb=!0:void 0===b&&a.j(a.toString()+" busy"));return a.v.Qa}function G(a,b){a.v.error||(a.v.ready=!1!==b,a.v.ready&&(b=a.Lb,a.Lb=null,b&&b()))}function sb(a,b){b&&(a.v.ready?b():a.Lb=b);return a.v.ready}function tb(a){return a.v.error?(a.j(a.toString()+" error"),!0):!1}function ub(a,b){a.v.error=!0;a.O(b)}
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
var sb="undefined"!==typeof ArrayBuffer,tb={cpu:1,trap:16,bus:64,memory:128,device:256,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function ub(a){r.call(this,"Panel",a,ub);this.f=0;this.v.Vb=!0}u(ub);k=ub.prototype;
k.qa=function(a,b,c,d){if(this.B&&this.B.qa(a,b,c,d)||this.b&&this.b.qa(a,b,c,d)||this.i&&this.i.qa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.I[b]=c,this.f++,!0;default:return"rled"==a?(this.I[b]=c,this.f++,!0):this.parent.qa.call(this,a,b,c,d)}};k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d};k.Aa=function(a,b){b||vb();return!0};k.za=function(){return!0};
function wb(a,b,c,d){if(a.I[b]){void 0===c&&(rb(a,"Value for "+b+" is invalid"),a.b.ga());var e=a.i&&a.i.Y||8;c=!a.b.v.ea||a.v.Vb?8==e?na(c,d):l(c,d):"--------".substr(0,d||4);a.I[b].textContent!=c&&(a.I[b].textContent=c)}}function xb(a,b,c,d){for(var e=0;e<d;e++){var f=a.I[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
k.ca=function(a){if(this.f&&(a||!this.b.v.ea||this.v.Vb)){for(a=0;a<this.b.u.length;a++)wb(this,"R"+a,this.b.u[a]);a=Lb(this.b);wb(this,"PS",a);wb(this,"NF",a&8?1:0,1);wb(this,"ZF",a&4?1:0,1);wb(this,"VF",a&2?1:0,1);wb(this,"CF",a&1?1:0,1);xb(this,"D",this.b.u[0],16);xb(this,"A",this.b.u[7],22)}};function vb(){for(var a=!1,b=C(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=lb(e.id);f||(a=!0,f=new ub(e));B(f,d);a&&H(f)}}Ta(vb);
function Mb(a,b,c){r.call(this,"Bus",a,Mb,64);this.b=b;this.i=c;this.L=a.busWidth||16;this.B=0;this.K=[];this.F=null;this.H=Math.pow(2,this.L);this.g=this.H-1|0;this.ua=Nb;this.ia=Math.log2(this.ua);this.J=this.ua>>2;this.w=this.ua-1;this.C=this.H/this.ua|0;this.Ia=[];this.f=0;this.A=[];this.nc=[Ob,Pb,Qb,Rb];a=new I(this);Sb(a,this.i);this.V=Array(this.C);for(b=0;b<this.C;b++)this.V[b]=a;H(this)}u(Mb);var Nb=8192,Tb=Nb-1;
function Ob(a,b){var c=-1,d=this.controller,e=d.Ia[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.Ia[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.i&&F(this.i,64)&&D(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Ub(d,b,!0);this.i&&F(this.i,64)&&D(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
function Pb(a,b,c){var d=!1,e=this.controller,f=e.Ia[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.Ia[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d?this.i&&F(this.i,64)&&D(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Ub(e,c,!0,b),this.i&&F(this.i,64)&&D(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
function Qb(a,b){var c=-1,d=this.controller;(a=d.Ia[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.i&&F(this.i,64)&&D(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Ub(d,b,!1);this.i&&F(this.i,64)&&D(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
function Rb(a,b,c){var d=!1,e=this.controller;if(a=e.Ia[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.i&&F(this.i,64)&&D(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Ub(e,c,!1,b),this.i&&F(this.i,64)&&D(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
function Vb(a,b){if(b!=a.B){var c;a.B&&(c=(1<<a.B)-Nb,Wb(a,c,Nb,a.K),a.B=0);b&&(a.B=b,c=(1<<b)-Nb,a.K=Xb(a,c,Nb),a.F?Wb(a,c,Nb,a.F):(Yb(a,c,Nb,Zb,a),a.F=Xb(a,c,Nb)))}}k=Mb.prototype;k.reset=function(){for(var a=0;a<this.A.length;a++)this.A[a]();Vb(this,16)};function Ub(a,b,c,d){a.i&&F(a.i,536870912)&&(D(a.i,"warning: unknown I/O access ("+J(a.i,b)+","+J(a.i,d,c?1:2)+")",!0,!0),$b(a.i));a.f||a.b.ha(4,b);return 0}k.Aa=function(a,b){b||this.reset();return!0};
function Yb(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ia;0<g&&h<a.V.length;){var m=a.V[h],p=h*a.ua,q=a.ua-(f-p);q>g&&(q=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.D)return m.yb+=m.D-f,m.D=f,!0;if(f>=m.D+m.yb){q=m.size-(f-p);q>g&&(q=g);m.yb=f-m.D+q;f=p+a.ua;g-=q;h++;continue}}return ac(1,f,g)}f=new I(a,f,q,a.ua,d,e);Sb(f,a.i,m);a.V[h++]=f;f=p+a.ua;g-=q}if(0>=g){c/=1024;var v;e="";v?10<v&&(v=10):v=c&-65536?10:5;if(null==c||isNaN(c))for(;0<v--;)e="?"+e;else for(;0<v--;)e=String.fromCharCode(c%10+48)+e,c/=
10;a.status(e+"Kb "+bc[d]+" at "+na(b));return!0}return ac(2,b,c)}function Xb(a,b,c){var d=[];for(b>>>=a.ia;0<c&&b<a.V.length;)d.push(a.V[b++]),c-=a.ua;return d}function Wb(a,b,c,d){var e=0;for(b>>>=a.ia;0<c&&b<a.V.length;){var f=d[e++];if(!f)break;a.V[b++]=f;c-=a.ua}}k.tb=function(a){return this.V[(a&this.g)>>>this.ia].Fb(a&this.w,a)};k.Db=function(a){this.f++;a=this.V[(a&this.g)>>>this.ia].Nb(a&this.w,a);this.f--;return a};k.oa=function(a){return this.V[(a&this.g)>>>this.ia].pa(a&this.w,a)};
k.eb=function(a){var b=a&this.w,c=(a&this.g)>>>this.ia;this.f++;a=this.V[c].Ob(b,a);this.f--;return a};k.Gb=function(a,b){this.V[(a&this.g)>>>this.ia].Jb(a&this.w,b&255,a)};k.Ya=function(a,b){this.f++;this.V[(a&this.g)>>>this.ia].Kb(a&this.w,b&255,a);this.f--};k.Za=function(a,b){this.V[(a&this.g)>>>this.ia].zb(a&this.w,b&65535,a)};k.Hb=function(a,b){var c=a&this.w,d=(a&this.g)>>>this.ia;this.f++;this.V[d].Sb(c,b&65535,a);this.f--};
function cc(a){for(var b=0,c=[],d=0;d<a.C;d++){var e=a.V[d];if(e.Ka||e.pc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,m=[];g<e.length;){for(var p=e[g],q=g+1;q<e.length&&e[q]===p;)q++;m[h++]=q-g;m[h++]=p;g=q}m.length<e.length&&(e=m)}c[f]=e}}return c}function dc(a,b,c,d,e,f,g,h){for(;b<=c;b+=2){var m=b&Tb;void 0!==a.Ia[m]?n("I/O address already registered: "+l(b,8,!0)):a.Ia[m]=[d,e,f,g,h||"unknown",!1]}}
function ec(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.b.fb)){var g=f[0]?f[0].bind(b):null,h=f[1]?f[1].bind(b):null,m=f[2]?f[2].bind(b):null,p=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&m&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!h&&p&&(h=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));dc(a,e,e,g,h,m,p,f[4])}}}function fc(a,b){a.A.push(b)}
function gc(a,b,c){a.f||(a.i&&F(a.i,64)&&(D(a.i,"memory fault ("+c+") on address "+J(a.i,b),!0,!0),$b(a.i)),a.b.ha(4,b))}function ac(a,b,c){n("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}function K(a){r.call(this,"Device",a,K,256);this.g={data:0,Ud:0,Eb:20,jd:0};this.f={Vd:0,Rb:-1}}u(K);k=K.prototype;
k.Ea=function(a,b,c,d){this.w=b;this.b=c;this.i=d;var e=this;this.f.Rb=hc(c,function(){e.f.La|=128;e.f.La&64&&(ic(e.b,e.f.kd),jc(e.b,e.f.Rb,1E3/60))});this.f.kd=kc(64,6);ec(b,this,L);fc(b,this.reset.bind(this));H(this)};k.reset=function(){this.g.Eb=this.g.Eb&-120|20;this.f.La=0};k.Fc=function(){var a=this.f.La;this.f.La&=-129;return a};k.td=function(a){this.f.La=a;a&64&&jc(this.b,this.f.Rb,1E3/60);this.f.La=a&-129};k.yc=function(a){return(a?this.g.jd:this.g.data)&65535};
k.md=function(a){this.g.data=a};k.Hc=function(){var a=this.b;return a.C&62337|a.Ba<<5|a.Ca<<1};k.vd=function(a){var b=this.b;a&=62337;if(b.C!=a){b.C=a;b.Ba=a>>5&3;b.Ca=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ma!=c&&(b.Ma=c,lc(b))}vc(this)};k.Ic=function(){var a=this.b.Oa;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.Jc=function(){return this.b.xb};k.Kc=function(){return this.b.Pa};
k.wd=function(a){var b=this.b;1170>b.fb&&(a&=-49);b.Pa!=a&&(b.Pa=a,a&16?(b.rb=4194303,b.Ta=3915776):(b.rb=262143,b.Ta=253952),lc(b));vc(this)};function vc(a){a.g.Eb=a.g.Eb&-8|(a.b.Ma?a.b.Pa&16?1:2:4)}k.Yc=function(a){return this.b.U[1][a>>1&7]};k.Kd=function(a,b){this.b.U[1][b>>1&7]=a&65295};k.Wc=function(a){return this.b.U[1][(a>>1&7)+8]};k.Id=function(a,b){this.b.U[1][(b>>1&7)+8]=a&65295};k.Xc=function(a){return this.b.ta[1][a>>1&7]};
k.Jd=function(a,b){b=b>>1&7;this.b.ta[1][b]=a;this.b.U[1][b]&=65295};k.Vc=function(a){return this.b.ta[1][(a>>1&7)+8]};k.Hd=function(a,b){b=(b>>1&7)+8;this.b.ta[1][b]=a;this.b.U[1][b]&=65295};k.Ec=function(a){return this.b.U[0][a>>1&7]};k.sd=function(a,b){this.b.U[0][b>>1&7]=a&65295};k.Cc=function(a){return this.b.U[0][(a>>1&7)+8]};k.qd=function(a,b){this.b.U[0][(b>>1&7)+8]=a&65295};k.Dc=function(a){return this.b.ta[0][a>>1&7]};k.rd=function(a,b){b=b>>1&7;this.b.ta[0][b]=a;this.b.U[0][b]&=65295};
k.Bc=function(a){return this.b.ta[0][(a>>1&7)+8]};k.pd=function(a,b){b=(b>>1&7)+8;this.b.ta[0][b]=a;this.b.U[0][b]&=65295};k.dd=function(a){return this.b.U[3][a>>1&7]};k.Qd=function(a,b){this.b.U[3][b>>1&7]=a&65295};k.bd=function(a){return this.b.U[3][(a>>1&7)+8]};k.Od=function(a,b){this.b.U[3][(b>>1&7)+8]=a&65295};k.cd=function(a){return this.b.ta[3][a>>1&7]};k.Pd=function(a,b){b=b>>1&7;this.b.ta[3][b]=a;this.b.U[3][b]&=65295};k.ad=function(a){return this.b.ta[3][(a>>1&7)+8]};
k.Nd=function(a,b){b=(b>>1&7)+8;this.b.ta[3][b]=a;this.b.U[3][b]&=65295};k.jb=function(a){a&=7;return this.b.M&2048?this.b.Ha[a]:this.b.u[a]};k.ob=function(a,b){b&=7;this.b.M&2048?this.b.Ha[b]=a:this.b.u[b]=a};k.Pc=function(){return this.b.M&49152?this.b.wa[0]:this.b.u[6]};k.Bd=function(a){this.b.M&49152?this.b.wa[0]=a:this.b.u[6]=a};k.Sc=function(){return this.b.u[7]};k.Ed=function(a){this.b.u[7]=a};k.kb=function(a){a&=7;return this.b.M&2048?this.b.u[a]:this.b.Ha[a]};
k.pb=function(a,b){b&=7;this.b.M&2048?this.b.u[b]=a:this.b.Ha[b]=a};k.Qc=function(){return 1==(this.b.M&49152)>>14?this.b.u[6]:this.b.wa[1]};k.Cd=function(a){1==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.wa[1]=a};k.Rc=function(){return 3==(this.b.M&49152)>>14?this.b.u[6]:this.b.wa[3]};k.Dd=function(a){3==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.wa[3]=a};k.Ac=function(a){return this.b.hc[a-65504>>1]};k.od=function(a,b){this.b.hc[b-65504>>1]=a};k.ec=function(a){return 65520==a?61183:0};k.kc=function(){};
k.$c=function(){return 1};k.Md=function(){};k.zc=function(){return this.b.ba};k.nd=function(){this.b.ba=0};k.Gc=function(){return this.b.gc};k.ud=function(a,b){b&1||(a&=255);this.b.gc=a};k.Lc=function(a){return a?this.b.Qb:0};k.xd=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Qb=a;b.G|=2};k.Zc=function(a){return a?this.b.Qa&65280:0};k.Ld=function(a){this.b.Qa=a|255};k.Oc=function(){return Lb(this.b)};k.Ad=function(a){wc(this.b,a&-1809|Lb(this.b)&1808);this.b.G|=128};
k.jc=function(a,b){F(this)&&D(this,"writeIgnored("+na(b)+"): "+na(a),!0,!0)};
var M={},L=(M[62592]=[null,null,K.prototype.Yc,K.prototype.Kd,"SISDR",1145],M[62608]=[null,null,K.prototype.Wc,K.prototype.Id,"SDSDR",1145],M[62624]=[null,null,K.prototype.Xc,K.prototype.Jd,"SISAR",1145],M[62640]=[null,null,K.prototype.Vc,K.prototype.Hd,"SDSAR",1145],M[62656]=[null,null,K.prototype.Ec,K.prototype.sd,"KISDR",1145],M[62672]=[null,null,K.prototype.Cc,K.prototype.qd,"KDSDR",1145],M[62688]=[null,null,K.prototype.Dc,K.prototype.rd,"KISAR",1145],M[62704]=[null,null,K.prototype.Bc,K.prototype.pd,
"KDSAR",1145],M[62798]=[null,null,K.prototype.Kc,K.prototype.wd,"MMR3",1145],M[65382]=[null,null,K.prototype.Fc,K.prototype.td,"LKS"],M[65400]=[null,null,K.prototype.yc,K.prototype.md,"CNSL"],M[65402]=[null,null,K.prototype.Hc,K.prototype.vd,"MMR0",1145],M[65404]=[null,null,K.prototype.Ic,K.prototype.jc,"MMR1",1145],M[65406]=[null,null,K.prototype.Jc,K.prototype.jc,"MMR2",1145],M[65408]=[null,null,K.prototype.dd,K.prototype.Qd,"UISDR",1145],M[65424]=[null,null,K.prototype.bd,K.prototype.Od,"UDSDR",
1145],M[65440]=[null,null,K.prototype.cd,K.prototype.Pd,"UISAR",1145],M[65456]=[null,null,K.prototype.ad,K.prototype.Nd,"UDSAR",1145],M[65472]=[null,null,K.prototype.jb,K.prototype.ob,"R0SET0"],M[65473]=[null,null,K.prototype.jb,K.prototype.ob,"R1SET0"],M[65474]=[null,null,K.prototype.jb,K.prototype.ob,"R2SET0"],M[65475]=[null,null,K.prototype.jb,K.prototype.ob,"R3SET0"],M[65476]=[null,null,K.prototype.jb,K.prototype.ob,"R4SET0"],M[65477]=[null,null,K.prototype.jb,K.prototype.ob,"R5SET0"],M[65478]=
[null,null,K.prototype.Pc,K.prototype.Bd,"R6KERNEL"],M[65479]=[null,null,K.prototype.Sc,K.prototype.Ed,"R7KERNEL"],M[65480]=[null,null,K.prototype.kb,K.prototype.pb,"R0SET1",1145],M[65481]=[null,null,K.prototype.kb,K.prototype.pb,"R1SET1",1145],M[65482]=[null,null,K.prototype.kb,K.prototype.pb,"R2SET1",1145],M[65483]=[null,null,K.prototype.kb,K.prototype.pb,"R3SET1",1145],M[65484]=[null,null,K.prototype.kb,K.prototype.pb,"R4SET1",1145],M[65485]=[null,null,K.prototype.kb,K.prototype.pb,"R5SET1",1145],
M[65486]=[null,null,K.prototype.Qc,K.prototype.Cd,"R6SUPER",1145],M[65487]=[null,null,K.prototype.Rc,K.prototype.Dd,"R6USER",1145],M[65504]=[null,null,K.prototype.Ac,K.prototype.od,"CTRL",1170],M[65520]=[null,null,K.prototype.ec,K.prototype.kc,"LSIZE",1170],M[65522]=[null,null,K.prototype.ec,K.prototype.kc,"HSIZE",1170],M[65524]=[null,null,K.prototype.$c,K.prototype.Md,"SYSID",1170],M[65526]=[null,null,K.prototype.zc,K.prototype.nd,"CPUERR",1170],M[65528]=[null,null,K.prototype.Gc,K.prototype.ud,
"MB",1170],M[65530]=[null,null,K.prototype.Lc,K.prototype.xd,"PIR"],M[65532]=[null,null,K.prototype.Zc,K.prototype.Ld,"SL"],M[65534]=[null,null,K.prototype.Oc,K.prototype.Ad,"PSW"],M);L[62594]=L[62592];L[62596]=L[62592];L[62598]=L[62592];L[62600]=L[62592];L[62602]=L[62592];L[62604]=L[62592];L[62606]=L[62592];L[62610]=L[62608];L[62612]=L[62608];L[62614]=L[62608];L[62616]=L[62608];L[62618]=L[62608];L[62620]=L[62608];L[62622]=L[62608];L[62626]=L[62624];L[62628]=L[62624];L[62630]=L[62624];L[62632]=L[62624];
var vb="undefined"!==typeof ArrayBuffer,wb={cpu:1,trap:16,bus:64,memory:128,device:256,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function xb(a){r.call(this,"Panel",a,xb);this.f=0;this.v.jc=!0}u(xb);k=xb.prototype;
k.qa=function(a,b,c,d){if(this.B&&this.B.qa(a,b,c,d)||this.b&&this.b.qa(a,b,c,d)||this.i&&this.i.qa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.F[b]=c,this.f++,!0;default:return"rled"==a?(this.F[b]=c,this.f++,!0):this.parent.qa.call(this,a,b,c,d)}};k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d};k.za=function(a,b){b||yb();return!0};k.ya=function(){return!0};
function zb(a,b,c,d){if(a.F[b]){void 0===c&&(ub(a,"Value for "+b+" is invalid"),a.b.ia());var e=a.i&&a.i.Z||8;c=!a.b.v.fa||a.v.jc?8==e?qa(c,d):l(c,d):"--------".substr(0,d||4);a.F[b].textContent!=c&&(a.F[b].textContent=c)}}function Ab(a,b,c,d){for(var e=0;e<d;e++){var f=a.F[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
k.da=function(a){if(this.f&&(a||!this.b.v.fa||this.v.jc)){for(a=0;a<this.b.u.length;a++)zb(this,"R"+a,this.b.u[a]);a=Bb(this.b);zb(this,"PS",a);zb(this,"NF",a&8?1:0,1);zb(this,"ZF",a&4?1:0,1);zb(this,"VF",a&2?1:0,1);zb(this,"CF",a&1?1:0,1);Ab(this,"D",this.b.u[0],16);Ab(this,"A",this.b.u[7],22)}};function yb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=ob(e.id);f||(a=!0,f=new xb(e));C(f,d);a&&G(f)}}Wa(yb);
function Cb(a,b,c){r.call(this,"Bus",a,Cb,64);this.b=b;this.i=c;this.L=a.busWidth||16;this.B=0;this.K=[];this.G=null;this.I=Math.pow(2,this.L);this.g=this.I-1|0;this.ua=Qb;this.ka=Math.log2(this.ua);this.J=this.ua>>2;this.w=this.ua-1;this.C=this.I/this.ua|0;this.Pa=[];this.f=0;this.A=[];this.Fc=[Rb,Sb,Tb,Ub];a=new I(this);Vb(a,this.i);this.W=Array(this.C);for(b=0;b<this.C;b++)this.W[b]=a;G(this)}u(Cb);var Qb=8192,Wb=Qb-1;
function Rb(a,b){var c=-1,d=this.controller,e=d.Pa[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.Pa[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.i&&F(this.i,64)&&E(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Xb(d,b,!0);this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
function Sb(a,b,c){var d=!1,e=this.controller,f=e.Pa[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.Pa[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d?this.i&&F(this.i,64)&&E(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Xb(e,c,!0,b),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
function Tb(a,b){var c=-1,d=this.controller;(a=d.Pa[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.i&&F(this.i,64)&&E(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Xb(d,b,!1);this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
function Ub(a,b,c){var d=!1,e=this.controller;if(a=e.Pa[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.i&&F(this.i,64)&&E(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Xb(e,c,!1,b),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
function Yb(a,b){if(b!=a.B){var c;a.B&&(c=(1<<a.B)-Qb,Zb(a,c,Qb,a.K),a.B=0);b&&(a.B=b,c=(1<<b)-Qb,a.K=$b(a,c,Qb),a.G?Zb(a,c,Qb,a.G):(ac(a,c,Qb,bc,a),a.G=$b(a,c,Qb)))}}k=Cb.prototype;k.reset=function(){for(var a=0;a<this.A.length;a++)this.A[a]();Yb(this,16)};function Xb(a,b,c,d){a.i&&F(a.i,536870912)&&(E(a.i,"warning: unknown I/O access ("+J(a.i,b)+","+J(a.i,d,c?1:2)+")",!0,!0),cc(a.i));a.f||a.b.ja(4,b);return 0}k.za=function(a,b){b||this.reset();return!0};
function ac(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ka;0<g&&h<a.W.length;){var m=a.W[h],n=h*a.ua,q=a.ua-(f-n);q>g&&(q=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.D)return m.Eb+=m.D-f,m.D=f,!0;if(f>=m.D+m.Eb){q=m.size-(f-n);q>g&&(q=g);m.Eb=f-m.D+q;f=n+a.ua;g-=q;h++;continue}}return dc(1,f,g)}f=new I(a,f,q,a.ua,d,e);Vb(f,a.i,m);a.W[h++]=f;f=n+a.ua;g-=q}if(0>=g){c/=1024;var w;e="";w?10<w&&(w=10):w=c&-65536?10:5;if(null==c||isNaN(c))for(;0<w--;)e="?"+e;else for(;0<w--;)e=String.fromCharCode(c%10+48)+e,c/=
10;a.status(e+"Kb "+ec[d]+" at "+qa(b));return!0}return dc(2,b,c)}function $b(a,b,c){var d=[];for(b>>>=a.ka;0<c&&b<a.W.length;)d.push(a.W[b++]),c-=a.ua;return d}function Zb(a,b,c,d){var e=0;for(b>>>=a.ka;0<c&&b<a.W.length;){var f=d[e++];if(!f)break;a.W[b++]=f;c-=a.ua}}k.zb=function(a){return this.W[(a&this.g)>>>this.ka].Pb(a&this.w,a)};k.Mb=function(a){this.f++;a=this.W[(a&this.g)>>>this.ka].ac(a&this.w,a);this.f--;return a};k.oa=function(a){return this.W[(a&this.g)>>>this.ka].pa(a&this.w,a)};
k.lb=function(a){var b=a&this.w,c=(a&this.g)>>>this.ka;this.f++;a=this.W[c].bc(b,a);this.f--;return a};k.Qb=function(a,b){this.W[(a&this.g)>>>this.ka].Tb(a&this.w,b&255,a)};k.fb=function(a,b){this.f++;this.W[(a&this.g)>>>this.ka].Ub(a&this.w,b&255,a);this.f--};k.hb=function(a,b){this.W[(a&this.g)>>>this.ka].Fb(a&this.w,b&65535,a)};k.Rb=function(a,b){var c=a&this.w,d=(a&this.g)>>>this.ka;this.f++;this.W[d].fc(c,b&65535,a);this.f--};
function fc(a){for(var b=0,c=[],d=0;d<a.C;d++){var e=a.W[d];if(e.La||e.Kc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,m=[];g<e.length;){for(var n=e[g],q=g+1;q<e.length&&e[q]===n;)q++;m[h++]=q-g;m[h++]=n;g=q}m.length<e.length&&(e=m)}c[f]=e}}return c}function gc(a,b,c,d,e,f,g,h){for(;b<=c;b+=2){var m=b&Wb;void 0!==a.Pa[m]?p("I/O address already registered: "+l(b,8,!0)):a.Pa[m]=[d,e,f,g,h||"unknown",!1]}}
function hc(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[5]&&f[5]>a.b.mb)){var g=f[0]?f[0].bind(b):null,h=f[1]?f[1].bind(b):null,m=f[2]?f[2].bind(b):null,n=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&m&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!h&&n&&(h=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));gc(a,e,e,g,h,m,n,f[4])}}}function ic(a,b){a.A.push(b)}
function jc(a,b,c){a.f||(a.i&&F(a.i,64)&&(E(a.i,"memory fault ("+c+") on address "+J(a.i,b),!0,!0),cc(a.i)),a.b.ja(4,b))}function dc(a,b,c){p("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}function K(a){r.call(this,"Device",a,K,256);this.g={data:0,oe:0,Ob:20,Ed:0};this.f={se:0,ec:-1}}u(K);k=K.prototype;
k.wa=function(a,b,c,d){this.w=b;this.b=c;this.i=d;var e=this;this.f.ec=kc(c,function(){e.f.Ra|=128;e.f.Ra&64&&(lc(e.b,e.f.Fd),mc(e.b,e.f.ec,1E3/60))});this.f.Fd=nc(64,6);hc(b,this,L);ic(b,this.reset.bind(this));G(this)};k.reset=function(){this.g.Ob=this.g.Ob&-120|20;this.f.Ra=0};k.$c=function(){var a=this.f.Ra;this.f.Ra&=-129;return a};k.Od=function(a){this.f.Ra=a;a&64&&mc(this.b,this.f.ec,1E3/60);this.f.Ra=a&-129};k.Tc=function(a){return(a?this.g.Ed:this.g.data)&65535};
k.Hd=function(a){this.g.data=a};k.bd=function(){var a=this.b;return a.C&62337|a.Ea<<5|a.Fa<<1};k.Qd=function(a){var b=this.b;a&=62337;if(b.C!=a){b.C=a;b.Ea=a>>5&3;b.Fa=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Sa!=c&&(b.Sa=c,oc(b))}pc(this)};k.cd=function(){var a=this.b.Ua;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.dd=function(){return this.b.Db};k.ed=function(){return this.b.Va};
k.Rd=function(a){var b=this.b;1170>b.mb&&(a&=-49);b.Va!=a&&(b.Va=a,a&16?(b.xb=4194303,b.$a=3915776):(b.xb=262143,b.$a=253952),oc(b));pc(this)};function pc(a){a.g.Ob=a.g.Ob&-8|(a.b.Sa?a.b.Va&16?1:2:4)}k.td=function(a){return this.b.V[1][a>>1&7]};k.ee=function(a,b){this.b.V[1][b>>1&7]=a&65295};k.rd=function(a){return this.b.V[1][(a>>1&7)+8]};k.ce=function(a,b){this.b.V[1][(b>>1&7)+8]=a&65295};k.sd=function(a){return this.b.ta[1][a>>1&7]};
k.de=function(a,b){b=b>>1&7;this.b.ta[1][b]=a;this.b.V[1][b]&=65295};k.qd=function(a){return this.b.ta[1][(a>>1&7)+8]};k.be=function(a,b){b=(b>>1&7)+8;this.b.ta[1][b]=a;this.b.V[1][b]&=65295};k.Zc=function(a){return this.b.V[0][a>>1&7]};k.Nd=function(a,b){this.b.V[0][b>>1&7]=a&65295};k.Xc=function(a){return this.b.V[0][(a>>1&7)+8]};k.Ld=function(a,b){this.b.V[0][(b>>1&7)+8]=a&65295};k.Yc=function(a){return this.b.ta[0][a>>1&7]};k.Md=function(a,b){b=b>>1&7;this.b.ta[0][b]=a;this.b.V[0][b]&=65295};
k.Wc=function(a){return this.b.ta[0][(a>>1&7)+8]};k.Kd=function(a,b){b=(b>>1&7)+8;this.b.ta[0][b]=a;this.b.V[0][b]&=65295};k.zd=function(a){return this.b.V[3][a>>1&7]};k.ke=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.xd=function(a){return this.b.V[3][(a>>1&7)+8]};k.ie=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.yd=function(a){return this.b.ta[3][a>>1&7]};k.je=function(a,b){b=b>>1&7;this.b.ta[3][b]=a;this.b.V[3][b]&=65295};k.wd=function(a){return this.b.ta[3][(a>>1&7)+8]};
k.he=function(a,b){b=(b>>1&7)+8;this.b.ta[3][b]=a;this.b.V[3][b]&=65295};k.qb=function(a){a&=7;return this.b.M&2048?this.b.Na[a]:this.b.u[a]};k.ub=function(a,b){b&=7;this.b.M&2048?this.b.Na[b]=a:this.b.u[b]=a};k.kd=function(){return this.b.M&49152?this.b.Aa[0]:this.b.u[6]};k.Wd=function(a){this.b.M&49152?this.b.Aa[0]=a:this.b.u[6]=a};k.nd=function(){return this.b.u[7]};k.Zd=function(a){this.b.u[7]=a};k.rb=function(a){a&=7;return this.b.M&2048?this.b.u[a]:this.b.Na[a]};
k.vb=function(a,b){b&=7;this.b.M&2048?this.b.u[b]=a:this.b.Na[b]=a};k.ld=function(){return 1==(this.b.M&49152)>>14?this.b.u[6]:this.b.Aa[1]};k.Xd=function(a){1==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.Aa[1]=a};k.md=function(){return 3==(this.b.M&49152)>>14?this.b.u[6]:this.b.Aa[3]};k.Yd=function(a){3==(this.b.M&49152)>>14?this.b.u[6]=a:this.b.Aa[3]=a};k.Vc=function(a){return this.b.yc[a-65504>>1]};k.Jd=function(a,b){this.b.yc[b-65504>>1]=a};k.vc=function(a){return 65520==a?61183:0};k.Cc=function(){};
k.vd=function(){return 1};k.ge=function(){};k.Uc=function(){return this.b.ca};k.Id=function(){this.b.ca=0};k.ad=function(){return this.b.xc};k.Pd=function(a,b){b&1||(a&=255);this.b.xc=a};k.fd=function(a){return a?this.b.dc:0};k.Sd=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.dc=a;b.H|=2};k.ud=function(a){return a?this.b.Wa&65280:0};k.fe=function(a){this.b.Wa=a|255};k.jd=function(){return Bb(this.b)};k.Vd=function(a){qc(this.b,a&-1809|Bb(this.b)&1808);this.b.H|=128};
k.Bc=function(a,b){F(this)&&E(this,"writeIgnored("+qa(b)+"): "+qa(a),!0,!0)};
var M={},L=(M[62592]=[null,null,K.prototype.td,K.prototype.ee,"SISDR",1145],M[62608]=[null,null,K.prototype.rd,K.prototype.ce,"SDSDR",1145],M[62624]=[null,null,K.prototype.sd,K.prototype.de,"SISAR",1145],M[62640]=[null,null,K.prototype.qd,K.prototype.be,"SDSAR",1145],M[62656]=[null,null,K.prototype.Zc,K.prototype.Nd,"KISDR",1145],M[62672]=[null,null,K.prototype.Xc,K.prototype.Ld,"KDSDR",1145],M[62688]=[null,null,K.prototype.Yc,K.prototype.Md,"KISAR",1145],M[62704]=[null,null,K.prototype.Wc,K.prototype.Kd,
"KDSAR",1145],M[62798]=[null,null,K.prototype.ed,K.prototype.Rd,"MMR3",1145],M[65382]=[null,null,K.prototype.$c,K.prototype.Od,"LKS"],M[65400]=[null,null,K.prototype.Tc,K.prototype.Hd,"CNSL"],M[65402]=[null,null,K.prototype.bd,K.prototype.Qd,"MMR0",1145],M[65404]=[null,null,K.prototype.cd,K.prototype.Bc,"MMR1",1145],M[65406]=[null,null,K.prototype.dd,K.prototype.Bc,"MMR2",1145],M[65408]=[null,null,K.prototype.zd,K.prototype.ke,"UISDR",1145],M[65424]=[null,null,K.prototype.xd,K.prototype.ie,"UDSDR",
1145],M[65440]=[null,null,K.prototype.yd,K.prototype.je,"UISAR",1145],M[65456]=[null,null,K.prototype.wd,K.prototype.he,"UDSAR",1145],M[65472]=[null,null,K.prototype.qb,K.prototype.ub,"R0SET0"],M[65473]=[null,null,K.prototype.qb,K.prototype.ub,"R1SET0"],M[65474]=[null,null,K.prototype.qb,K.prototype.ub,"R2SET0"],M[65475]=[null,null,K.prototype.qb,K.prototype.ub,"R3SET0"],M[65476]=[null,null,K.prototype.qb,K.prototype.ub,"R4SET0"],M[65477]=[null,null,K.prototype.qb,K.prototype.ub,"R5SET0"],M[65478]=
[null,null,K.prototype.kd,K.prototype.Wd,"R6KERNEL"],M[65479]=[null,null,K.prototype.nd,K.prototype.Zd,"R7KERNEL"],M[65480]=[null,null,K.prototype.rb,K.prototype.vb,"R0SET1",1145],M[65481]=[null,null,K.prototype.rb,K.prototype.vb,"R1SET1",1145],M[65482]=[null,null,K.prototype.rb,K.prototype.vb,"R2SET1",1145],M[65483]=[null,null,K.prototype.rb,K.prototype.vb,"R3SET1",1145],M[65484]=[null,null,K.prototype.rb,K.prototype.vb,"R4SET1",1145],M[65485]=[null,null,K.prototype.rb,K.prototype.vb,"R5SET1",1145],
M[65486]=[null,null,K.prototype.ld,K.prototype.Xd,"R6SUPER",1145],M[65487]=[null,null,K.prototype.md,K.prototype.Yd,"R6USER",1145],M[65504]=[null,null,K.prototype.Vc,K.prototype.Jd,"CTRL",1170],M[65520]=[null,null,K.prototype.vc,K.prototype.Cc,"LSIZE",1170],M[65522]=[null,null,K.prototype.vc,K.prototype.Cc,"HSIZE",1170],M[65524]=[null,null,K.prototype.vd,K.prototype.ge,"SYSID",1170],M[65526]=[null,null,K.prototype.Uc,K.prototype.Id,"CPUERR",1170],M[65528]=[null,null,K.prototype.ad,K.prototype.Pd,
"MB",1170],M[65530]=[null,null,K.prototype.fd,K.prototype.Sd,"PIR"],M[65532]=[null,null,K.prototype.ud,K.prototype.fe,"SL"],M[65534]=[null,null,K.prototype.jd,K.prototype.Vd,"PSW"],M);L[62594]=L[62592];L[62596]=L[62592];L[62598]=L[62592];L[62600]=L[62592];L[62602]=L[62592];L[62604]=L[62592];L[62606]=L[62592];L[62610]=L[62608];L[62612]=L[62608];L[62614]=L[62608];L[62616]=L[62608];L[62618]=L[62608];L[62620]=L[62608];L[62622]=L[62608];L[62626]=L[62624];L[62628]=L[62624];L[62630]=L[62624];L[62632]=L[62624];
L[62634]=L[62624];L[62636]=L[62624];L[62638]=L[62624];L[62642]=L[62640];L[62644]=L[62640];L[62646]=L[62640];L[62648]=L[62640];L[62650]=L[62640];L[62652]=L[62640];L[62654]=L[62640];L[62658]=L[62656];L[62660]=L[62656];L[62662]=L[62656];L[62664]=L[62656];L[62666]=L[62656];L[62668]=L[62656];L[62670]=L[62656];L[62674]=L[62672];L[62676]=L[62672];L[62678]=L[62672];L[62680]=L[62672];L[62682]=L[62672];L[62684]=L[62672];L[62686]=L[62672];L[62690]=L[62688];L[62692]=L[62688];L[62694]=L[62688];L[62696]=L[62688];
L[62698]=L[62688];L[62700]=L[62688];L[62702]=L[62688];L[62706]=L[62704];L[62708]=L[62704];L[62710]=L[62704];L[62712]=L[62704];L[62714]=L[62704];L[62716]=L[62704];L[62718]=L[62704];L[65410]=L[65408];L[65412]=L[65408];L[65414]=L[65408];L[65416]=L[65408];L[65418]=L[65408];L[65420]=L[65408];L[65422]=L[65408];L[65426]=L[65424];L[65428]=L[65424];L[65430]=L[65424];L[65432]=L[65424];L[65434]=L[65424];L[65436]=L[65424];L[65438]=L[65424];L[65442]=L[65440];L[65444]=L[65440];L[65446]=L[65440];L[65448]=L[65440];
L[65450]=L[65440];L[65452]=L[65440];L[65454]=L[65440];L[65458]=L[65456];L[65460]=L[65456];L[65462]=L[65456];L[65464]=L[65456];L[65466]=L[65456];L[65468]=L[65456];L[65470]=L[65456];L[65506]=L[65504];L[65508]=L[65504];L[65510]=L[65504];L[65512]=L[65504];L[65514]=L[65504];L[65516]=L[65504];L[65518]=L[65504];Ta(function(){for(var a=C(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=z(d);switch(c.type){case "default":c=new K(c);B(c,d);break;case "pc11":c=new xc(c),B(c,d)}}});var yc;
if(sb){var zc=new ArrayBuffer(2);(new DataView(zc)).setUint16(0,256,!0);yc=256===(new Uint16Array(zc))[0]}else yc=!1;var Ac=yc;
function I(a,b,c,d,e,f){this.w=a;this.id=Bc+=2;this.b=null;this.D=b;this.yb=c;this.size=d||0;this.type=e||Cc;this.g=e==Dc;this.controller=null;Sb(this);this.Ka=this.pc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],Ec(this,f.nc);else if(sb)this.C=new ArrayBuffer(this.size),this.F=new DataView(this.C,0,this.size),this.f=new Uint8Array(this.C,0,this.size),this.J=new Uint16Array(this.C,0,this.size>>1),this.b=new Int32Array(this.C,0,this.size>>2),Ec(this,Ac?Fc:Gc);else{a=this.b=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;Ec(this,Hc)}else Ec(this)}var Cc=0,Dc=2,Zb=4,bc=["NONE","RAM","ROM","VID","H/W"],Bc=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(sb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.F.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(sb)for(b=0;b<a.length;b++)this.F.setInt32(b<<2,a[b],!0);else this.b=a;return this.Ka=!0}return!1},Wa:function(a,b){b?this.B++||Ic(this,Jc,!1):this.I++||Kc(this,Jc,!1)},K:function(a,b){this.i&&F(this.i,128)&&(D(this.i,
"attempt to read invalid address "+J(this.i,b),!0),$b(this.i));gc(this.w,b,2);return 255},A:function(a,b,c){this.i&&F(this.i,128)&&(D(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0),$b(this.i));gc(this.w,c,4)},L:function(a,b){return this.Fb(a++,b++)|this.Fb(a,b)<<8},H:function(a,b,c){this.Jb(a++,b&255,c++);this.Jb(a,b>>8,c)},R:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},la:function(a,b){a&1&&gc(this.w,b,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:
c&255|(this.b[b+1]&255)<<8},Sa:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Ka=!0},Ca:function(a,b,c){a&1&&gc(this.w,c,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Ka=!0},O:function(a,b){if(this.i&&null!=this.D){var c=this.i;Lc(c,this.D+a,1,c.L)&&c.ga(!0)}return this.Nb(a,b)},Y:function(a,b){if(this.i&&null!=this.D){var c=this.i;Lc(c,this.D+a,2,c.L)&&c.ga(!0)}return this.Ob(a,
b)},ra:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Lc(d,this.D+a,1,d.C)&&d.ga(!0)}this.g?this.A(a,b,c):this.Kb(a,b,c)},$a:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Lc(d,this.D+a,2,d.C)&&d.ga(!0)}this.g?this.A(a,b,c):this.Sb(a,b,c)},N:function(a){return this.f[a]},P:function(a,b){a=this.f[a];this.i&&F(this.i,128)&&D(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},X:function(a,b){a&1&&gc(this.w,b,2);return this.F.getUint16(a,!0)},aa:function(a,b){a&1&&gc(this.w,
b,2);a=this.J[a>>1];this.i&&F(this.i,128)&&D(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ma:function(a,b){this.f[a]=b;this.Ka=!0},sa:function(a,b,c){this.f[a]=b;this.Ka=!0;this.i&&F(this.i,128)&&D(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},va:function(a,b,c){a&1&&gc(this.w,c,4);this.F.setUint16(a,b,!0);this.Ka=!0},Ba:function(a,b,c){a&1&&gc(this.w,c,4);this.J[a>>1]=b;this.Ka=!0;this.i&&F(this.i,128)&&D(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,
b)+")",!0)}};function Sb(a,b,c){a.i=b;a.I=a.B=0;c&&((a.I=c.I)&&Kc(a,Jc,!1),(a.B=c.B)&&Ic(a,Jc,!1))}function Mc(a,b){b?--a.B||(a.Jb=a.g?a.A:a.Kb,a.zb=a.g?a.H:a.Sb):--a.I||(a.Fb=a.Nb,a.pa=a.Ob)}function Ic(a,b,c){c&&a.B||(a.Jb=!a.g&&b[1]||a.A,a.zb=!a.g&&b[3]||a.H);if(c||void 0===c)a.Kb=b[1]||a.A,a.Sb=b[3]||a.H}function Kc(a,b,c){c&&a.I||(a.Fb=b[0]||a.K,a.pa=b[2]||a.L);if(c||void 0===c)a.Nb=b[0]||a.K,a.Ob=b[2]||a.L}function Ec(a,b){b||(b=Nc);Kc(a,b,void 0);Ic(a,b,void 0)}
var Nc=[],Hc=[I.prototype.R,I.prototype.Sa,I.prototype.la,I.prototype.Ca],Jc=[I.prototype.O,I.prototype.ra,I.prototype.Y,I.prototype.$a];if(sb)var Gc=[I.prototype.N,I.prototype.ma,I.prototype.X,I.prototype.va],Fc=[I.prototype.P,I.prototype.sa,I.prototype.aa,I.prototype.Ba];
function Oc(a,b){r.call(this,"CPU",a,Oc,1);var c=a.multiplier||1;this.Ra=a.cycles||b;this.Na=c;this.qb=Math.round(this.Ra/1E4)/100;this.Xa=this.qb*this.Na;this.v.ea=!1;this.v.Ib=!1;this.v.ab=a.autoStart;this.v.cb=!1;this.ub=this.ma=0;this.vb=a.csStart;this.gb=a.csInterval;this.hb=a.csStop;this.K=[];this.dc=this.hd.bind(this);H(this)}u(Oc);var Pc=["power","reset"];k=Oc.prototype;
k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.i=d;for(b=0;b<Pc.length;b++)(c=this.I[Pc[b]])&&this.B.qa(null,Pc[b],c);a=Qc(a,"autoStart");null!=a&&(this.v.ab="true"==a?!0:"false"==a?!1:!!a);H(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.Aa=function(a,b){if(!b){if(a&&this.restore){Rc(this);if(!this.restore(a))return!1;Sc(this)}else this.reset();this.i?(a=this.i,b=this.v.ab,a.Ua=!0,a.j("Type ? for help with PDP11 Debugger commands"),a.ca(),b||a.lb(),a.Ca&&(b=a.Ca,a.Ca=null,Tc(a,b))):this.j("No debugger detected")}this.B.ca();return!0};k.za=function(a){return a?this.save():!0};k.ab=function(){return this.v.ab||!this.i&&void 0===this.I.run?(this.mb(),!0):!1};k.Yb=function(){return 0};
function Sc(a){void 0===a.vb&&(a.vb=0);void 0===a.gb&&(a.gb=-1);void 0===a.hb&&(a.hb=-1);a.v.cb=0<=a.vb&&0<a.gb;a.v.cb&&(a.ub=0,a.ma=a.vb-a.la)}function Uc(a,b){if(a.v.cb){var c=!1;a.ub=a.ub+a.Yb()|0;a.ma-=b;0>=a.ma&&(a.ma+=a.gb,c=!0);0<=a.hb&&a.hb<=Vc(a)&&(a.gb=a.hb=-1,Sc(a),a.ga(),c=!0);c&&a.j(Vc(a)+" cycles: checksum="+l(a.ub))}}
k.qa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.I[b]=c,!0;case "run":return this.I[b]=c,c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.v.ka)a=!0;else{var b=null,c,h=kb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.v.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.v.ka);c++);c==h.length&&(b=a);n("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.Cb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ea?d.ga():d.mb())},
!0;case "speed":return this.I[b]=c,!0;case "setSpeed":return this.I[b]=c,c.onclick=function(){Wc(d,d.Na<<1,!0)},c.textContent=this.Xa.toFixed(2)+"Mhz",!0}return!1};k.ca=function(){var a=this.I.speed;a&&(a.textContent=this.v.ea&&this.X?this.X.toFixed(2)+"Mhz":"Stopped")};function Xc(a,b,c){a.la+=b;c&&(a.aa=a.b=a.J=0)}function Yc(a,b){var c=1;b&&1<a.Na&&a.X&&(c=a.X/a.qb);a.ac=Math.round(1E3/30);a.Va=Math.floor(a.Ra/30*c);b||(a.ra=a.Va);a.sb=0}function Vc(a){return a.la+a.R+a.aa-a.b}
function Rc(a){a.X=0;a.bc=0;a.la=a.R=a.aa=a.b=a.J=0;Sc(a);Wc(a,1)}function Wc(a,b,c){var d=!1;if(void 0!==b){.8>a.X/a.Xa?b=1:d=!0;a.Na=b;b=a.qb*a.Na;if(a.Xa!=b){a.Xa=b;b=a.Xa.toFixed(2)+"Mhz";var e=a.I.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.B&&a.B.lb()}Xc(a,a.R);a.R=0;a.P=za();a.Y=0;Yc(a);return d}function hc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function jc(a,b,c){0<=b&&b<a.K.length&&0>a.K[b][0]&&(c=a.Ra*a.Na/1E3*c|0,a.K[b][0]=c+Zc(a))}
function $c(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function ad(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Zc(a,b){var c=a.aa-=a.b;a.b=a.J=0;b&&(a.aa=0);return c}
k.hd=function(){if(this.v.ea){this.sb>=this.Ra&&Yc(this,!0);this.va=0;this.Ua=za();if(this.Y){var a=this.Ua-this.Y;a>this.ac&&(this.P+=a,this.P>this.Ua&&(this.P=this.Ua))}try{do{var b=$c(this,this.v.cb?1:this.Va);try{this.nb(b)}catch(e){if("number"!=typeof e)throw e;}b=Zc(this,!0);this.va+=b;this.R+=b;Uc(this,b);ad(this,b);this.ra-=b;if(0>=this.ra){this.ra+=this.Va;15<=++this.bc&&(this.B&&this.B.ca(),this.bc=0);break}}while(this.v.ea)}catch(e){this.ga();this.B&&this.B.stop(za(),Vc(this));rb(this,
e.stack||e.message);return}if(this.v.ea){a=setTimeout;b=this.dc;this.Y=za();var c=this.ac;this.va&&(c=Math.round(c*this.va/this.Va));var c=c-(this.Y-this.Ua),d=this.Y-this.P;d&&(this.X=Math.round(this.R/(10*d))/100,864E5<=d&&(this.la=0,Wc(this)));if(0>c||this.X<this.Xa)-1E3>c&&(this.P-=c),c=0;this.sb+=this.va;this.Y+=c;a(b,c)}}};
k.mb=function(a){if(qb(this))return!1;if(this.v.ea)return this.j(this.toString()+" busy"),!1;Wc(this);this.v.ea=!0;this.v.Ib=!0;var b=this.I.run;b&&(b.textContent="Halt");this.B&&(a&&this.B.lb(!0),this.B.start(this.P,Vc(this)));setTimeout(this.dc,0);return!0};k.nb=function(){return 0};k.ga=function(a){var b=!1;if(this.v.ea){Zc(this);Xc(this,this.R);this.R=0;this.v.ea=!1;if(b=this.I.run)b.textContent="Run";this.B&&this.B.stop(za(),Vc(this));b=!0}this.v.complete=a;return b};
function bd(a){this.fb=+a.model||1170;this.Bb=a.addrReset||0;Oc.call(this,a,6666667);this.decode=1120==this.fb?cd.bind(this):dd.bind(this);ed(this);this.L=0;this.N=null;this.v.complete=!1}u(bd,Oc);k=bd.prototype;k.reset=function(){this.status("model "+this.fb);this.v.ea&&this.ga();ed(this);Rc(this);this.v.error=!1;this.parent.reset.call(this)};
function ed(a){a.S=65536;a.T=32768;a.Z=65535;a.W=32768;a.M=15;a.u=[0,0,0,0,0,0,0,a.Bb];a.Ha=[0,0,0,0,0,0];a.wa=[0,0,0,0];a.A=0;a.Ca=0;a.sc=[4,2,0,1];a.U=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ta=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.xc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.hc=[0,0,0,0,0,0,0,0];a.gc=0;a.G=0;a.F=a.H=0;a.g=a.f=a.bb=0;a.sa=-1;fd(a)}function fd(a){a.Qa=255;a.ba=0;a.Qb=0;a.C=0;a.Oa=0;a.xb=0;a.Pa=0;a.Ma=0;a.Ba=0;a.rb=262143;a.Ta=253952;a.N=null;a.w&&lc(a)}function lc(a){a.Ma?(a.O=65536,a.$=a.rc,a.pa=a.ed,a.zb=a.Rd,Vb(a.w,a.Pa&16?22:18)):(a.O=0,a.$=a.qc,a.pa=a.fc,a.zb=a.lc,Vb(a.w,16))}function gd(a,b,c){a.Bb=b;N(a,b);!c&&a.i&&(a.ga()||a.i.ca())}k.Yb=function(){return 0};
k.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.la,this.Na]);a.set(2,cc(this.w));return a.data()};k.restore=function(a){var b=a[1];this.la=b[1];Wc(this,b[3]);a:{b=this.w;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.J){for(var f=0,g=Array(b.J),h=0;h<e.length-1;)for(var m=e[h++],p=e[h++];m--;)g[f++]=p;e=g}f=b.V[d];if(!f||!f.restore(e)){n("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function hd(a){return a.S&65536?1:0}
function id(a){return a.T&32768?2:0}function jd(a){return a.Z&65535?0:4}k.Ga=function(){return this.W&32768?8:0};function kd(a){var b=a.u[7];a.C&57344||(a.Oa=0,a.xb=b);a.u[7]=b+2&65535;return a.pa(b)}function ld(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function N(a,b){a.u[7]=b&65535}function kc(a,b){return{ld:a,ib:b,next:null}}function ic(a,b){if(b!=a.N){var c=a.N;if(!c||c.ib<=b.ib)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.ib<=b.ib){b.next=d;c.next=b;break}c=d}while(c)}}a.G|=2}
function Lb(a){return a.M=a.M&63728|a.Ga()|jd(a)|id(a)|hd(a)}function wc(a,b){a.W=b<<12;a.Z=~b&4;a.T=b<<14;a.S=b<<16;if((b^a.M)&2048)for(var c=a.Ha.length;0<=--c;){var d=a.u[c];a.u[c]=a.Ha[c];a.Ha[c]=d}a.A=b>>14&3;c=a.M>>14&3;a.A!=c&&(a.wa[c]=a.u[6],a.u[6]=a.wa[a.A]);a.M=b;a.G|=2}function P(a,b){a.G&128||(a.W=a.Z=b,a.T=0)}function md(a,b,c){a.G&128||(a.W=a.Z=a.S=b,a.T=c||0)}function Fd(a,b,c,d){a.G&128||(a.W=a.Z=a.S=b,a.T=(c^b)&(d^b))}function Gd(a,b){a.G&128||(a.W=a.Z=a.S=b,a.T=a.W^a.S>>1)}
function Hd(a,b,c,d){a.G&128||(a.W=a.Z=a.S=b,a.T=(c^d)&(d^b))}k.ha=function(a,b){if(!this.L){var c=!1;0>this.sa?this.sa=Lb(this):this.A||(a=4,c=!0);this.C&57344||(this.Oa=63222,this.xb=a);this.A=0;var d=this.pa(a|this.O),e=this.pa(a+2&65535|this.O);wc(this,e&-12289|this.sa>>2&12288);c&&(this.ba|=4,this.u[6]=4);Id(this,this.sa);Id(this,this.u[7]);N(this,d);this.G&=-113;this.sa=-1;this.G|=8;this.wc=a;this.vc=b;if(26!=b)throw a;}};
function Jd(a){var b=Kd(a),c=Kd(a)&-1793;a.M&49152&&(c=c&-225|a.M&63712);N(a,b);wc(a,c);a.G&=-17}
function Ld(a,b,c){var d,e,f,g=0;d=b>>13;a.Pa&a.sc[a.A]||(d&=7);e=a.U[a.A][d];f=(a.ta[a.A][d]<<6)+(b&8191)&a.rb;if(f<a.Ta)f&1&&!(c&1)&&(a.ba|=64,a.ha(4,10));else if(a.Pa&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var h=f>>13&31;31>h?a.Pa&32&&(f=a.xc[h]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Ta&&4186112>f&&(a.ba|=32,a.ha(4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&
4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.U[a.A][d]=e;if(4194170!==f||a.A)a.Ba=a.A,a.Ca=d;g&&(g&57344&&(0<=a.sa&&(g|=128),a.C&57344||(a.C=a.C|g|a.Ba<<5|a.Ca<<1),a.ha(168,16)),a.C&61440||!(4191360>f||4194239<f)||(a.C|=4096,a.C&512&&(a.G|=32)));return f}function Md(a,b){return a.w.tb(b)}function Nd(a,b,c){b&1&&a.b--;a.w.Gb(b,c&255)}function Kd(a){var b=a.pa(a.u[6]|a.O);a.u[6]=a.u[6]+2&65535;return b}
function Id(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.C&57344||(a.Oa=a.Oa<<8|246);!a.A&&c<=a.Qa&&4<c&&(c<=a.Qa-32?(a.ba|=4,a.u[6]=4,a.ha(4,18)):(a.ba|=8,a.G|=4));a.zb(c,b)}
function Od(a,b,c,d){var e,f,g=d&8?0:a.O;switch(b){case 0:return a.ha(4,20),0;case 1:return 6===c&&!a.A&&d&4&&(a.u[6]<=a.Qa||65534<=a.u[6])&&(a.u[6]<=a.Qa-32||65534<=a.u[6]?(a.ba|=4,a.u[6]=4,a.ha(4,22)):(a.ba|=8,a.G|=64)),a.b-=3,7===c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!==c&&(e|=g);e=a.pa(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!==c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!==c&&(e|=g);e=a.pa(e)|
g;a.b-=8;break;case 6:return e=a.pa(ld(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.pa(ld(a,2)),e=e+a.u[c]&65535,e=a.pa(e|a.O)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.C&57344||(a.Oa=a.Oa<<8|f<<3&248|c);6==c&&!a.A&&d&4&&0>=f&&(a.u[6]<=a.Qa||65534<=a.u[6])&&(a.u[6]<=a.Qa-32?(a.ba|=4,a.u[6]=4,a.ha(4,24)):(a.ba|=8,a.G|=64));return e}k.Db=function(a){if(!this.Ma)return this.w.Db(a);this.L++;a=Md(this,Ld(this,a,3));this.L--;return a};
k.eb=function(a){if(!this.Ma)return this.w.eb(a);this.L++;a=this.fc(Ld(this,a,2));this.L--;return a};k.Ya=function(a,b){this.Ma?(this.L++,Nd(this,Ld(this,a,5),b),this.L--):this.w.Ya(a,b)};k.Hb=function(a,b){this.Ma?(this.L++,this.lc(Ld(this,a,4),b),this.L--):this.w.Hb(a,b)};k.qc=function(a,b,c){return Od(this,a,b,c)};k.rc=function(a,b,c){return Ld(this,Od(this,a,b,c),c)};k.fc=function(a){return this.w.oa(a)};k.ed=function(a){return this.w.oa(Ld(this,a,2))};k.lc=function(a,b){this.w.Za(a,b&65535)};
k.Rd=function(a,b){this.w.Za(Ld(this,a,4),b)};function Pd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=Od(a,b,d,2),c&65536||61440!==(a.M&61440)&&(d&=65535),a.A=a.M>>12&3,c=a.pa(d|c&a.O),a.A=a.M>>14&3):c=6!=d||(a.M>>2&12288)===(a.M&12288)?a.u[d]:a.wa[a.M>>12&3];return c}function Qd(a,b,c,d){a.C&57344||(a.Oa=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=Od(a,b,e,4),c&65536||(e&=65535),a.A=a.M>>12&3,e=Ld(a,e|c&65536,4),a.A=a.M>>14&3,a.w.Za(e,d)):6!=e||(a.M>>2&12288)===(a.M&12288)?a.u[e]=d:a.wa[a.M>>12&3]=d}
function Rd(a,b){b>>=6;var c=a.H=b&7;return(b=a.F=(b&56)>>3)?Md(a,a.$(b,c,3)):a.u[c]&255}function Sd(a,b){b>>=6;var c=a.H=b&7;return(b=a.F=(b&56)>>3)?a.w.oa(a.$(b,c,2)):a.u[c]}function Td(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return Od(a,b,c,8)}function Ud(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?Md(a,a.$(b,c,3)):a.u[c]&255}function Vd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.w.oa(a.$(b,c,2)):a.u[c]}
function Q(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.bb=a.$(b,e,7),Nd(a,e,d.call(a,c,Md(a,e)))):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.$(b,e,6),a.w.Za(e,d.call(a,c,a.w.oa(e)))):a.u[e]=d.call(a,c,a.u[e])}function Wd(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?Nd(a,a.$(b,e,5),c):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}function Xd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.Za(a.$(b,d,4),c):a.u[d]=c&65535;return c}
function S(a,b,c){c&&(N(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
k.nb=function(a){this.v.complete=!0;var b=this.i&&Yd(this.i)?1:this.v.Ib?-1:0,c=a?this.v.Ib?0:1:-1;this.v.Ib=!1;this.aa=this.b=a;do{if(b){if(this.i&&Zd(this.i,this.u[7],c)){this.ga();break}c||c++;b++}if(this.G){this.G&112&&(this.G&32?this.ha(168,28):this.G&64?this.ha(4,30):this.G&16&&this.ha(12,32),this.G&=-113);if(a=this.G&7){a=!1;if(this.G&2){this.G&=-3;var d=160,e=(this.Qb&224)>>5,f=this.N&&this.N.ib>e?this.N:null;f&&(d=f.ld,e=f.ib);e>(this.M&224)>>5?(this.G&4&&(ld(this,2),this.G&=-5),this.ha(d,
26),e=!0):e=!1;if(e){if(f)if(a=f,f=this.N,f==a)this.N=a.next;else for(;f;){e=f.next;if(e==a){f.next=e.next;break}f=e}a=!0}}else this.G&1&&this.G++;a=a&&0>c}if(a)break}this.G=this.G&7|this.M&16;this.decode(kd(this))}while(0<this.b);return this.v.complete?this.aa-this.b:void 0===this.v.complete?0:-1};Ta(function(){for(var a=C(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new bd(d);B(d,c)}});function $d(a,b){var c=b+a;Fd(this,c,a,b);return c&65535}
function ae(a,b){var c=b+a;Fd(this,c<<8,a<<8,b<<8);return c&255}function be(a,b){a=b<<1;Gd(this,a);return a&65535}function ce(a,b){a=b<<1;Gd(this,a<<8);return a&255}function de(a,b){a=b&32768|b>>1|b<<16;Gd(this,a);return a&65535}function ee(a,b){a=b&2048|b>>1|b<<8;Gd(this,a<<8);return a&255}function fe(a,b){a=b&~a;P(this,a);return a}function ge(a,b){a=b&~a;P(this,a<<8);return a}function he(a,b){a|=b;P(this,a);return a}function ie(a,b){a|=b;P(this,a<<8);return a}
function je(a,b){a=~b|65536;md(this,a);return a&65535}function ke(a,b){a=~b|256;md(this,a<<8);return a&255}function le(a,b){a=b-a;this.G&128||(this.W=this.Z=a,this.T=b&(b^a));return a&65535}function me(a,b){a=b-a;var c=a<<8;b<<=8;this.G&128||(this.W=this.Z=c,this.T=b&(b^c));return a&255}function ne(a,b){a=b+a;this.G&128||(this.W=this.Z=a,this.T=a&(b^a));return a&65535}function oe(a,b){a=b+a;var c=a<<8;this.G&128||(this.W=this.Z=c,this.T=c&(b<<8^c));return a&255}
function pe(a,b){a=-b;md(this,a,a&b&32768);return a&65535}function qe(a,b){a=-b;md(this,a<<8,(a&b&128)<<8);return a&255}function re(a,b){a=b<<1|this.S>>16&1;Gd(this,a);return a&65535}function se(a,b){a=b<<1|this.S>>16&1;Gd(this,a<<8);return a&255}function te(a,b){a=(this.S&65536|b)>>1|b<<16;Gd(this,a);return a&65535}function ue(a,b){a=((this.S&65536)>>8|b)>>1|b<<8;Gd(this,a<<8);return a&255}function ve(a,b){var c=b-a;Hd(this,c,a,b);return c&65535}
function we(a,b){var c=b-a;Hd(this,c<<8,a<<8,b<<8);return c&255}function xe(a,b){this.G&128||(this.W=this.Z=b&65280,this.T=this.S=0);return(b<<8|b>>8)&65535}function ye(a,b){a^=b;P(this,a);return a&65535}function ze(a){R(this,a,Sd(this,a),$d);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}
function Ae(a){var b=Vd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.S=this.T=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.S=c<<17-b,c>>=b;else if(b)if(16<b)this.T=c,c=0;else{this.S=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.T=32768)}this.u[a]=c&65535;this.W=this.Z=c;this.b-=(this.g?6:7)+b}
function Be(a){var b=Vd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.S=this.T=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.S=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.S=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.T=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.W=d>>16;this.Z=d>>16|d;this.b-=(this.g?6:7)+b}function Ce(a){S(this,a,!hd(this))}function De(a){S(this,a,hd(this))}
function Ee(a){R(this,a,Sd(this,a),fe);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}function Fe(a){Q(this,a,Rd(this,a),ge);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}function Ge(a){R(this,a,Sd(this,a),he);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}function He(a){Q(this,a,Rd(this,a),ie);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}
function Ie(a){P(this,Sd(this,a)&Vd(this,a));this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}function Je(a){P(this,(Rd(this,a)&Ud(this,a))<<8);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}function Ke(a){S(this,a,jd(this))}function Le(a){S(this,a,!this.Ga()==!id(this))}function Me(a){S(this,a,!jd(this)&&!this.Ga()==!id(this))}function Ne(a){S(this,a,!hd(this)&&!jd(this))}function Oe(a){S(this,a,jd(this)||!this.Ga()!=!id(this))}
function Pe(a){S(this,a,hd(this)||jd(this))}function Qe(a){S(this,a,!this.Ga()!=!id(this))}function Re(a){S(this,a,this.Ga())}function Se(a){S(this,a,!jd(this))}function Te(a){S(this,a,!this.Ga())}function Ue(){this.ha(12,1);this.b-=5}function Ve(a){S(this,a,!0)}function We(a){S(this,a,!id(this))}function Xe(a){S(this,a,id(this))}function T(a){a&1&&(this.S=0);a&2&&(this.T=0);a&4&&(this.Z=1);a&8&&(this.W=0);this.b-=5}
function Ye(a){var b=Sd(this,a);a=Vd(this,a);Hd(this,b-a,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}function Ze(a){var b=Rd(this,a)<<8;a=Ud(this,a)<<8;Hd(this,b-a,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.F?4:3)+(7==this.f?2:0)}
function $e(a){var b=Vd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.S=this.T=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.Z=d>>16|d,this.W=d>>16):(this.T=32768,this.Z=d>>15|d,this.W=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.Z=this.W=0,this.T=32768,this.S=65536,this.b-=7}function af(){this.ha(24,2);this.b-=25}
function bf(){this.M&49152?(this.ba|=128,this.ha(4,3)):this.i?$b(this.i):this.ga();this.b-=7}function cf(){this.ha(16,4);this.b-=25}var df=[0,7,7,10,7,11,9,13];function ef(a){this.J=this.b;N(this,Td(this,a));this.b=this.J-df[this.g]}var ff=[0,14,14,17,14,18,16,20];function gf(a){this.J=this.b;var b=Td(this,a);a=a>>6&7;Id(this,this.u[a]);this.u[a]=this.u[7];N(this,b);this.b=this.J-ff[this.g]}var hf=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
function jf(a){var b=Sd(this,a);this.J=this.b;P(this,Xd(this,a,b));this.b=this.J-hf[(this.F?8:0)+this.g]+(7!=this.f||this.g?0:2)}function kf(a){var b=Rd(this,a);P(this,Wd(this,a,b,1)<<8);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}var lf=[7,13,13,17,14,18,17,21];
function mf(a){var b=Vd(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.G&128||(this.W=b>>16,this.Z=this.W|b,this.T=0,this.S=-32768>b||32767<b?65536:0);this.b-=23}function nf(){this.b-=5}function of(){this.M&49152||(fd(this),this.w.reset());this.b-=667}function pf(){Jd(this);this.G|=this.M&16;this.b-=13}
function qf(a){if(a&8)U.call(this,a);else{var b=Kd(this);a&=7;7==a?N(this,b):(N(this,this.u[a]),this.u[a]=b);this.b-=9}}function W(a){a&1&&(this.S=65536);a&2&&(this.T=32768);a&4&&(this.Z=0);a&8&&(this.W=32768);this.b-=5}function rf(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)N(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function sf(a){R(this,a,Sd(this,a),ve);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.F?5:3)+(7==this.f?2:0)}
function tf(a){R(this,a,0,xe);this.b-=this.g?9:3+(7==this.f?2:0)}function uf(){this.ha(28,5);this.b-=5}function vf(){this.G&4||this.B.ca();this.G|=4;ld(this,-2);this.b-=3}function wf(a){R(this,a,Sd(this,a),ye);this.b-=this.g?9:3+(7==this.f?2:0)}function U(a){var b;if(b=this.i)b=this.i,D(b,"undefined opcode "+J(b,a),!0,!0),b=$b(b);b||this.ha(8,6)}function cd(a){xf[a>>12].call(this,a)}function yf(a){zf[a>>6&3].call(this,a)}function Af(a){Bf[a>>6&3].call(this,a)}
function Cf(a){Df[a>>6&3].call(this,a)}function Ef(a){Ff[a&15].call(this,a)}function Gf(a){Hf[a&15].call(this,a)}function If(a){Jf[a>>6&3].call(this,a)}function Kf(a){Lf[a>>6&3].call(this,a)}function Mf(a){Nf[a>>6&3].call(this,a)}
var xf=[function(a){Of[a>>8&15].call(this,a)},jf,Ye,Ie,Ee,Ge,ze,U,function(a){Pf[a>>8&15].call(this,a)},kf,Ze,Je,Fe,He,sf,U],Of=[function(a){Qf[a>>4&15].call(this,a)},Ve,Se,Ke,Le,Qe,Me,Oe,gf,gf,yf,Af,Cf,U,U,U],zf=[function(a){md(this,Xd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,je);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,ne);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,le);this.b-=this.g?9:3+(7==this.f?2:0)}],Bf=[function(a){R(this,a,0,
pe);this.b-=this.g?11:6},function(a){R(this,a,hd(this)?1:0,$d);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,hd(this)?1:0,ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Vd(this,a);md(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],Df=[function(a){R(this,a,0,te);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,de);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,be);this.b-=this.g?9:3+(7==this.f?2:0)}],
Qf=[function(a){Rf[a&15].call(this,a)},U,U,U,ef,ef,ef,ef,qf,U,Ef,Gf,tf,tf,tf,tf],Rf=[bf,vf,pf,Ue,cf,of,U,U,U,U,U,U,U,U,U,U],Ff=[nf,function(){this.S=0;this.b-=5},function(){this.T=0;this.b-=5},T,function(){this.Z=1;this.b-=5},T,T,T,function(){this.W=0;this.b-=5},T,T,T,T,T,T,T],Hf=[nf,function(){this.S=65536;this.b-=5},function(){this.T=32768;this.b-=5},W,function(){this.Z=0;this.b-=5},W,W,W,function(){this.W=32768;this.b-=5},W,W,W,W,W,W,W],Pf=[Te,Re,Ne,Pe,We,Xe,Ce,De,af,uf,If,Kf,Mf,U,U,U],Jf=[function(a){md(this,
Wd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,ke);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,oe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,me);this.b-=this.g?9:3+(7==this.f?2:0)}],Lf=[function(a){Q(this,a,0,qe);this.b-=this.g?11:6},function(a){Q(this,a,hd(this)?1:0,ae);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,hd(this)?1:0,we);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Ud(this,a);md(this,a<<8);this.b-=this.g?4:3+(7==
this.f?2:0)}],Nf=[function(a){Q(this,a,0,ue);this.b-=this.g?9+(this.bb&1):3+(7==this.f?2:0)},function(a){Q(this,a,0,se);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,ee);this.b-=this.g?9+(this.bb&1):3+(7==this.f?2:0)},function(a){Q(this,a,0,ce);this.b-=this.g?9:3+(7==this.f?2:0)}];function dd(a){Sf[a>>12].call(this,a)}
var Sf=[function(a){lg[a>>8&15].call(this,a)},jf,Ye,Ie,Ee,Ge,ze,function(a){mg[a>>8&15].call(this,a)},function(a){ng[a>>8&15].call(this,a)},kf,Ze,Je,Fe,He,sf,U],lg=[function(a){og[a>>4&15].call(this,a)},Ve,Se,Ke,Le,Qe,Me,Oe,gf,gf,yf,Af,Cf,function(a){pg[a>>6&3].call(this,a)},U,U],pg=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.pa(a|this.O);N(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=Pd(this,a,0);Id(this,a);P(this,a);this.b-=11},function(a){var b=Kd(this);this.J=
this.b;Qd(this,a,0,b);P(this,b);this.b=this.J-lf[this.g]},function(a){P(this,Xd(this,a,this.Ga?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],og=[function(a){qg[a&15].call(this,a)},U,U,U,ef,ef,ef,ef,qf,function(a){a&8?(this.M&49152||(this.M=this.M&-2017|(a&7)<<5,this.G|=1),this.b-=5):U.call(this,a)},Ef,Gf,tf,tf,tf,tf],qg=[bf,vf,pf,Ue,cf,of,function(){Jd(this);this.b-=13},U,U,U,U,U,U,U,U,U],mg=[mf,mf,$e,$e,Ae,Ae,Be,Be,wf,wf,U,U,U,U,rf,rf],ng=[Te,Re,Ne,Pe,We,Xe,Ce,De,af,uf,If,Kf,Mf,function(a){rg[a>>
6&3].call(this,a)},U,U],rg=[U,function(a){a=Pd(this,a,65536);Id(this,a);P(this,a);this.b-=11},function(a){var b=Kd(this);this.J=this.b;Qd(this,a,65536,b);P(this,b);this.b=this.J-lf[this.g]},U];
function sg(a){r.call(this,"ROM",a,sg);this.fa=this.f=null;this.C=a.addr;this.g=a.size;this.A=a.alias;this.B=a.file;this.F=oa(this.B);if(this.B){a=this.B;var b=pa(this.F);"json"!=b&&"hex"!=b&&(a=ra()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var c=this;Ba(a,null,!0,function(a,b,f){f?c.ja("Unable to load ROM resource (error "+f+": "+a+")"):(jb(c.Sa,a,b),(a=Ca(a,b))?(c.f=a.da,c.fa=a.fa):c.B=null,tg(c))})}}u(sg);sg.prototype.Ea=function(a,b,c,d){this.w=b;this.b=c;this.i=d;tg(this)};
sg.prototype.Aa=function(){this.fa&&(this.i&&ug(this.i,this.id,this.C,this.g,this.fa),delete this.fa);return!0};sg.prototype.za=function(){return!0};
function tg(a){if(!pb(a)){if(a.B){if(!a.f||!a.w)return;a.g||(a.g=a.f.length);if(a.f.length!=a.g)rb(a,"ROM size ("+l(a.f.length,8,!0)+") does not match specified size ("+l(a.g,8,!0)+")");else{var b;b=a.C;if(Yb(a.w,b,a.g,Dc)){var c;for(c=0;c<a.f.length;c++)a.w.Ya(b+c,a.f[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.A?b.push(a.A):null!=a.A&&a.A.length&&(b=a.A);for(c=0;c<b.length;c++){var d=a,e=b[c],f=Xb(d.w,d.C,d.g);Wb(d.w,e,d.g,f)}delete a.f}}}H(a)}}
Ta(function(){for(var a=C(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new sg(d);B(d,c)}});
function vg(a){r.call(this,"RAM",a,vg);this.fa=this.g=null;this.B=a.addr;this.C=a.size;this.ya=a.load;this.xa=a.exec;this.A=!1;this.f=a.file;this.F=oa(this.f);if(this.f){a=this.f;var b=pa(this.F);"json"!=b&&"hex"!=b&&(a=ra()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Ba(a,null,!0,function(a,b,f){f?c.ja("Unable to load RAM resource (error "+f+": "+a+")"):(jb(c.Sa,a,b),(a=Ca(a,b))?(c.g=a.da,c.fa=a.fa,null==c.ya&&(c.ya=a.ya),null==c.xa&&(c.xa=a.xa)):c.f=null,wg(c))})}}u(vg);
vg.prototype.Ea=function(a,b,c,d){this.w=b;this.b=c;this.i=d;wg(this)};vg.prototype.Aa=function(){this.fa&&(this.i&&ug(this.i,this.id,this.B,this.C,this.fa),delete this.fa);return!0};vg.prototype.za=function(){return!0};function wg(a){if(a.w&&(!a.A&&a.C&&Yb(a.w,a.B,a.C,1)&&(a.A=!0),!pb(a))){if(!a.A)n("No RAM allocated");else if(a.f){if(!a.g||!a.w)return;xg(a,a.g,a.ya,a.xa,a.B)}H(a)}}
vg.prototype.reset=function(){if(this.A){for(var a=this.w,b=this.B,c=this.C,d=b&a.w,b=b>>>a.ia;0<c&&b<a.V.length;){var e=a.V[b],f=c,g,d=d||0;void 0===f&&(f=e.size);if(sb)for(g=d;f--&&g<e.f.length;g++)e.f[g]=0;else for(g=d;f--&&g<e.size;g++)e.Kb(d,0,e.D+d);c-=a.ua;b++;d=0}this.g&&xg(this,this.g,this.ya,this.xa,this.B,!0)}};
function xg(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var m=b[h]&255|(b[h+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(h+6>=b.length)break;for(var h=h+2,p=b[h++]&255|(b[h++]&255)<<8,q=b[h++]&255|(b[h++]&255)<<8,m=m+((p&255)+(p>>8)+(q&255)+(q>>8)),v=h,w=p-=6;0<p&&h<b.length;)m+=b[h++]&255,p--;if(p||h>=b.length)break;m+=b[h++]&255;if(m&255)break;if(w)for(;w--;)a.b.Ya(q++,b[v++]&255);else q&1?a.b.ga():gd(a.b,q,f);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.b.Ya(c+
e,b[e]);null!=d&&gd(a.b,d,f);g=!0}return g}Ta(function(){for(var a=C(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new vg(d);B(d,c)}});function yg(a){r.call(this,"Keyboard",a,yg,65536);H(this)}u(yg);yg.prototype.qa=function(){return!1};yg.prototype.Ea=function(a,b,c,d){this.B=a;this.b=c;this.i=d};Ta(function(){for(var a=C(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new yg(d);B(d,c)}});
function X(a){this.N=a.baudReceive||9600;this.P=a.baudTransmit||9600;this.aa=a.upperCase;this.A=this.F=null;this.R=a.tabSize;this.O=a.charBOL;this.H=0;r.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.F="";else{var c;a=zg;b&&(void 0===c&&(c="Panel"),(c=mb(c,this.id))&&(b=c.I[b])&&this.qa(null,a,b))}this.J=this.L=null;this.exports={connect:this.cc,receiveData:this.Pb}}u(X);var zg="buffer";k=X.prototype;
k.qa=function(a,b,c){var d=this;switch(b){case zg:return this.I[b]=this.A=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.Pb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Pb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;var e=this;this.la=kc(48,4);this.X=hc(this.b,function(){e.f&128||!e.C.length||(e.K=e.C.shift()&255,e.aa&&97<=e.K&&122>e.K&&(e.K-=32),e.f|=128,e.f&64&&ic(e.b,e.la))});this.ma=kc(52,4);this.Y=hc(this.b,function(){e.g|=128;e.g&64&&ic(e.b,e.ma)});ec(b,this,Ag);H(this)};
k.cc=function(){if(!this.J){var a=Qc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=va(b[0]);if(c!=this.$a)return;b=va(b[1]);if(this.J=lb(b)){var d=this.J.exports;if(d){var e=d.connect;e&&e.call(this.J);if(this.L=d.receiveData){this.status(this.Sa+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.Aa=function(a,b){if(!b)if(this.cc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
k.za=function(a){return a?this.save():!0};k.reset=function(){Bg(this)};k.save=function(){var a=new O(this);a.set(0,[]);return a.data()};k.restore=function(){return Bg(this)};function Bg(a){a.K=0;a.f=0;a.g=128;a.C=[];return!0}k.Pb=function(a){if("number"==typeof a)this.C.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.C.push(a.charCodeAt(b));else this.C=this.C.concat(a);jc(this.b,this.X,1E3/Math.round(this.N/10));return!0};k.Uc=function(){return this.f&65534};
k.Gd=function(a){this.f=this.f&-112|a&111};k.Tc=function(){this.f&=-129;0<this.C.length&&jc(this.b,this.X,1E3/Math.round(this.N/10));return this.K};k.Fd=function(){};k.gd=function(){return this.g};k.Td=function(a){128==(this.g&192)&&a&64&&jc(this.b,this.Y,1E3/Math.round(this.P/10));this.g=this.g&-70|a&69};k.fd=function(){return 0};
k.Sd=function(a){if(a&=255){D(this,"transmitByte("+l(a,2,!0)+")");this.L&&this.L.call(this.J,a);if(this.A)if(13==a)this.H=0;else if(8==a)this.A.value=this.A.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=wa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.R||8,c=a-this.H%a,this.R&&(b=ua("",c)));this.O&&!this.H&&c&&(b=String.fromCharCode(this.O)+b);this.A.value+=b;this.A.scrollTop=this.A.scrollHeight;this.H+=c}else if(null!=this.F){if(10==a||1024<=this.F.length)this.j(this.F),
this.F="";10!=a&&(this.F+=String.fromCharCode(a))}this.g&=-129;jc(this.b,this.Y,1E3/Math.round(this.P/10))}};var Cg={},Ag=(Cg[65392]=[null,null,X.prototype.Uc,X.prototype.Gd,"RCSR"],Cg[65394]=[null,null,X.prototype.Tc,X.prototype.Fd,"RBUF"],Cg[65396]=[null,null,X.prototype.gd,X.prototype.Td,"XCSR"],Cg[65398]=[null,null,X.prototype.fd,X.prototype.Sd,"XBUF"],Cg);Ta(function(){for(var a=C(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new X(d);B(d,c)}});
function xc(a){r.call(this,"PC11",a,xc);this.g=a.autoMount||null;this.F=0;this.Y=a.baudReceive||3600;this.K=this.L=this.f=0;this.J=[];this.H=Dg;this.A=Eg;this.N=this.C="";this.da=this.ya=this.xa=null;this.P=-1;this.O=!La("Mobi")&&window&&"FileReader"in window}u(xc);var Dg="",Eg=0;k=xc.prototype;
k.qa=function(a,b,c){var d=this,e=Eg;switch(b){case "listTapes":return this.I[b]=c,c.onchange=function(){var a=d.I.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(m){n("PC11 option error: "+m.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.I[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.I[b]=c,c.onclick=
function(){var a=d.I.listTapes;a&&Fg(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.O){c.parentNode.removeChild(c);break}this.I[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Fg(d,oa(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.I[b]=c,!0}return!1};
k.Ea=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;this.R=Gg(a);var e=this;if((this.g=Qc(this.B,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){n("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.X=kc(56,4);this.aa=hc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.K<e.J.length&&(e.L=e.J[e.K++]&255,Hg(e,e.K/e.J.length*100),e.f|=128,e.f&=-2049,e.f&64&&ic(e.b,e.X))});ec(b,this,Ig);Jg(this,"None",Dg,!0);this.O&&Jg(this,"Local Tape",
"?");Jg(this,"Remote Tape","??");Kg(this)||H(this)};k.Aa=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.za=function(a){return a?this.save():!0};k.reset=function(){this.f&=-2241;this.L=0};function Kg(a){a.F=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.I.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=oa(b,!0)}b&&c?Lg(a,c,b,1,!0):Mg(a)}return!!a.F}
function Fg(a,b,c,d,e){if(c)if("?"==c)a.ja('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=oa(c);a.status("Attempting to load "+c+' as "'+b+'"');a.H="??"}else a.H=c;Lg(a,b,c,d,!1,e)}else Ng(a,!1)}
function Lg(a,b,c,d,e,f){var g=-1;if(a.C.toLowerCase()!=c.toLowerCase()||a.A!=d)g++,Ng(a,!0),a.v.Ja?a.ja("PC11 busy"):(e&&(a.F++,F(a)&&D(a,"auto-loading tape: "+b)),Og(a,b,c,d,f)?g++:a.v.Ja=!0);g&&Pg(a,a.N,a.C,a.A,a.da,a.ya,a.xa)}
function Og(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),Pg(a,b,c,d,e),a.H="?");Mg(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=pa(c),f="json"==e||"gz"==e?encodeURI(c):ra()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Ba(f,null,!0,function(e,f,g){var h=0>g&&a.B&&!a.B.v.ka;g?a.ja('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(jb(a.Sa,e,f),(e=Ca(e,f))&&Pg(a,b,c,d,e.da,e.ya,
e.xa));a.v.Ja=!1;a.F&&(a.F--,a.F||H(a));Mg(a)})}function Jg(a,b,c,d){if((a=a.I.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function Mg(a){var b=a.I.listTapes;if(b&&b.options){a=a.H||a.C;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function Hg(a,b){b|=0;if(b!==a.P){var c=a.I.readProgress;c&&(c=(c=C(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.P=b}}
function Pg(a,b,c,d,e,f,g){a.N=b;a.C=c;a.A=d;a.da=e;a.ya=f;a.xa=g;2==d?a.R&&xg(a.R,e,f,g)?a.status("tape loaded: "+b):(a.N="",a.C="",a.H=Dg,a.A=Eg,a.ja("No load address available for tape: "+b)):(a.K=0,a.J=e,a.status("tape attached: "+b),Hg(a,0))}function Ng(a,b){if(a.C||!1===b)a.N="",a.C="",b||(a.A&&a.status(1==a.A?"tape detached":"tape unloaded"),a.H=Dg,a.A=Eg,Mg(a))}k.save=function(){return(new O(this)).data()};k.restore=function(){return!0};k.Nc=function(){return this.f&65534};
k.zd=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&ic(this.b,this.X)):(this.f&=-129,this.f|=2048,this.L=0,jc(this.b,this.aa,1E3/Math.round(this.Y/10))));this.f=this.f&-66|a&65};k.Mc=function(){this.f&=-129;this.f|=2048;return this.L};k.yd=function(){};var Qg={},Ig=(Qg[65384]=[null,null,xc.prototype.Nc,xc.prototype.zd,"PRS"],Qg[65386]=[null,null,xc.prototype.Mc,xc.prototype.yd,"PRB"],Qg);
function Rg(a){r.call(this,"Debugger",a,Rg);this.Y=a.base||16;this.va=!1;this.J=0;this.O=!1;this.A=-1;this.g=[];this.R={}}u(Rg);var Sg={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Rg.prototype.Zb=function(){return-1};Rg.prototype.$b=function(){};
function Tg(a,b,c,d){if(c)if(b){0>a.A&&a.g.length&&(a.A=0);if(0>a.A||b!=a.g[a.A])a.g.splice(0,0,b),a.A=0;a.A--}else a.O?b="end":b=a.g[a.A+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(va(b.substring(c,f))),c=f+1}}return a}
function Ug(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
L[65450]=L[65440];L[65452]=L[65440];L[65454]=L[65440];L[65458]=L[65456];L[65460]=L[65456];L[65462]=L[65456];L[65464]=L[65456];L[65466]=L[65456];L[65468]=L[65456];L[65470]=L[65456];L[65506]=L[65504];L[65508]=L[65504];L[65510]=L[65504];L[65512]=L[65504];L[65514]=L[65504];L[65516]=L[65504];L[65518]=L[65504];
Wa(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=A(d);switch(c.type){case "default":c=new K(c);C(c,d);break;case "pc11":c=new rc(c);C(c,d);break;case "rl11":c=new sc(c),C(c,d)}}});var tc;if(vb){var uc=new ArrayBuffer(2);(new DataView(uc)).setUint16(0,256,!0);tc=256===(new Uint16Array(uc))[0]}else tc=!1;var Ec=tc;
function I(a,b,c,d,e,f){this.w=a;this.id=Fc+=2;this.b=null;this.D=b;this.Eb=c;this.size=d||0;this.type=e||Gc;this.f=e==Hc;this.controller=null;Vb(this);this.La=this.Kc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],Ic(this,f.Fc);else if(vb)this.C=new ArrayBuffer(this.size),this.G=new DataView(this.C,0,this.size),this.F=new Uint8Array(this.C,0,this.size),this.J=new Uint16Array(this.C,0,this.size>>1),this.b=new Int32Array(this.C,0,this.size>>2),Ic(this,Ec?Jc:Kc);else{a=this.b=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;Ic(this,Lc)}else Ic(this)}var Gc=0,Hc=2,bc=4,ec=["NONE","RAM","ROM","VID","H/W"],Fc=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(vb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.G.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(vb)for(b=0;b<a.length;b++)this.G.setInt32(b<<2,a[b],!0);else this.b=a;return this.La=!0}return!1},cb:function(a,b){b?this.B++||Mc(this,Nc,!1):this.g++||Oc(this,Nc,!1)},K:function(a,b){this.i&&F(this.i,128)&&(E(this.i,
"attempt to read invalid address "+J(this.i,b),!0),cc(this.i));jc(this.w,b,2);return 255},A:function(a,b,c){this.i&&F(this.i,128)&&(E(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0),cc(this.i));jc(this.w,c,4)},L:function(a,b){return this.Pb(a++,b++)|this.Pb(a,b)<<8},I:function(a,b,c){this.Tb(a++,b&255,c++);this.Tb(a,b>>8,c)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ba:function(a,b){a&1&&jc(this.w,b,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:
c&255|(this.b[b+1]&255)<<8},sa:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.La=!0},Fa:function(a,b,c){a&1&&jc(this.w,c,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.La=!0},P:function(a,b){if(this.i&&null!=this.D){var c=this.i;Pc(c,this.D+a,1,c.L)&&c.ia(!0)}return this.ac(a,b)},Y:function(a,b){if(this.i&&null!=this.D){var c=this.i;Pc(c,this.D+a,2,c.L)&&c.ia(!0)}return this.bc(a,
b)},ma:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Pc(d,this.D+a,1,d.C)&&d.ia(!0)}this.f?this.A(a,b,c):this.Ub(a,b,c)},va:function(a,b,c){if(this.i&&null!=this.D){var d=this.i;Pc(d,this.D+a,2,d.C)&&d.ia(!0)}this.f?this.A(a,b,c):this.fc(a,b,c)},N:function(a){return this.F[a]},R:function(a,b){a=this.F[a];this.i&&F(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},Ia:function(a,b){a&1&&jc(this.w,b,2);return this.G.getUint16(a,!0)},Z:function(a,b){a&1&&jc(this.w,
b,2);a=this.J[a>>1];this.i&&F(this.i,128)&&E(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},la:function(a,b){this.F[a]=b;this.La=!0},ra:function(a,b,c){this.F[a]=b;this.La=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},Za:function(a,b,c){a&1&&jc(this.w,c,4);this.G.setUint16(a,b,!0);this.La=!0},Ea:function(a,b,c){a&1&&jc(this.w,c,4);this.J[a>>1]=b;this.La=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,
b)+")",!0)}};function Vb(a,b,c){a.i=b;a.g=a.B=0;c&&((a.g=c.g)&&Oc(a,Nc,!1),(a.B=c.B)&&Mc(a,Nc,!1))}function Qc(a,b){b?--a.B||(a.Tb=a.f?a.A:a.Ub,a.Fb=a.f?a.I:a.fc):--a.g||(a.Pb=a.ac,a.pa=a.bc)}function Mc(a,b,c){c&&a.B||(a.Tb=!a.f&&b[1]||a.A,a.Fb=!a.f&&b[3]||a.I);if(c||void 0===c)a.Ub=b[1]||a.A,a.fc=b[3]||a.I}function Oc(a,b,c){c&&a.g||(a.Pb=b[0]||a.K,a.pa=b[2]||a.L);if(c||void 0===c)a.ac=b[0]||a.K,a.bc=b[2]||a.L}function Ic(a,b){b||(b=Rc);Oc(a,b,void 0);Mc(a,b,void 0)}
var Rc=[],Lc=[I.prototype.S,I.prototype.sa,I.prototype.ba,I.prototype.Fa],Nc=[I.prototype.P,I.prototype.ma,I.prototype.Y,I.prototype.va];if(vb)var Kc=[I.prototype.N,I.prototype.la,I.prototype.Ia,I.prototype.Za],Jc=[I.prototype.R,I.prototype.ra,I.prototype.Z,I.prototype.Ea];
function Sc(a,b){r.call(this,"CPU",a,Sc,1);var c=a.multiplier||1;this.Ya=a.cycles||b;this.Ta=c;this.wb=Math.round(this.Ya/1E4)/100;this.eb=this.wb*this.Ta;this.v.fa=!1;this.v.Sb=!1;this.v.ib=a.autoStart;this.v.kb=!1;this.Ab=this.ma=0;this.Bb=a.csStart;this.nb=a.csInterval;this.ob=a.csStop;this.K=[];this.tc=this.Dd.bind(this);G(this)}u(Sc);var Tc=["power","reset"];k=Sc.prototype;
k.wa=function(a,b,c,d){this.B=a;this.w=b;this.i=d;for(b=0;b<Tc.length;b++)(c=this.F[Tc[b]])&&this.B.qa(null,Tc[b],c);a=Uc(a,"autoStart");null!=a&&(this.v.ib="true"==a?!0:"false"==a?!1:!!a);G(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.za=function(a,b){if(!b){if(a&&this.restore){Vc(this);if(!this.restore(a))return!1;Wc(this)}else this.reset();this.i?(a=this.i,b=this.v.ib,a.ab=!0,a.j("Type ? for help with PDP11 Debugger commands"),a.da(),b||a.gb(),a.Fa&&(b=a.Fa,a.Fa=null,Xc(a,b))):this.j("No debugger detected")}this.B.da();return!0};k.ya=function(a){return a?this.save():!0};k.ib=function(){return this.v.ib||!this.i&&void 0===this.F.run?(this.sb(),!0):!1};k.nc=function(){return 0};
function Wc(a){void 0===a.Bb&&(a.Bb=0);void 0===a.nb&&(a.nb=-1);void 0===a.ob&&(a.ob=-1);a.v.kb=0<=a.Bb&&0<a.nb;a.v.kb&&(a.Ab=0,a.ma=a.Bb-a.la)}function Yc(a,b){if(a.v.kb){var c=!1;a.Ab=a.Ab+a.nc()|0;a.ma-=b;0>=a.ma&&(a.ma+=a.nb,c=!0);0<=a.ob&&a.ob<=Zc(a)&&(a.nb=a.ob=-1,Wc(a),a.ia(),c=!0);c&&a.j(Zc(a)+" cycles: checksum="+l(a.Ab))}}
k.qa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.F[b]=c,!0;case "run":return this.F[b]=c,c.onclick=function(){var a;if(a=d.B)if(a=d.B,a.v.ha)a=!0;else{var b=null,c,h=nb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.v.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.v.ha);c++);c==h.length&&(b=a);p("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.Lb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.fa?d.ia():d.sb())},
!0;case "speed":return this.F[b]=c,!0;case "setSpeed":return this.F[b]=c,c.onclick=function(){$c(d,d.Ta<<1,!0)},c.textContent=this.eb.toFixed(2)+"Mhz",!0}return!1};k.da=function(){var a=this.F.speed;a&&(a.textContent=this.v.fa&&this.Y?this.Y.toFixed(2)+"Mhz":"Stopped")};function ad(a,b,c){a.la+=b;c&&(a.ba=a.b=a.J=0)}function bd(a,b){var c=1;b&&1<a.Ta&&a.Y&&(c=a.Y/a.wb);a.qc=Math.round(1E3/30);a.bb=Math.floor(a.Ya/30*c);b||(a.ra=a.bb);a.yb=0}function Zc(a){return a.la+a.S+a.ba-a.b}
function Vc(a){a.Y=0;a.rc=0;a.la=a.S=a.ba=a.b=a.J=0;Wc(a);$c(a,1)}function $c(a,b,c){var d=!1;if(void 0!==b){.8>a.Y/a.eb?b=1:d=!0;a.Ta=b;b=a.wb*a.Ta;if(a.eb!=b){a.eb=b;b=a.eb.toFixed(2)+"Mhz";var e=a.F.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.B&&a.B.gb()}ad(a,a.S);a.S=0;a.R=Aa();a.Z=0;bd(a);return d}function kc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function mc(a,b,c){0<=b&&b<a.K.length&&0>a.K[b][0]&&(c=a.Ya*a.Ta/1E3*c|0,a.K[b][0]=c+cd(a))}
function dd(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function ed(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function cd(a,b){var c=a.ba-=a.b;a.b=a.J=0;b&&(a.ba=0);return c}
k.Dd=function(){if(this.v.fa){this.yb>=this.Ya&&bd(this,!0);this.va=0;this.ab=Aa();if(this.Z){var a=this.ab-this.Z;a>this.qc&&(this.R+=a,this.R>this.ab&&(this.R=this.ab))}try{do{var b=dd(this,this.v.kb?1:this.bb);try{this.tb(b)}catch(e){if("number"!=typeof e)throw e;}b=cd(this,!0);this.va+=b;this.S+=b;Yc(this,b);ed(this,b);this.ra-=b;if(0>=this.ra){this.ra+=this.bb;15<=++this.rc&&(this.B&&this.B.da(),this.rc=0);break}}while(this.v.fa)}catch(e){this.ia();this.B&&this.B.stop(Aa(),Zc(this));ub(this,
e.stack||e.message);return}if(this.v.fa){a=setTimeout;b=this.tc;this.Z=Aa();var c=this.qc;this.va&&(c=Math.round(c*this.va/this.bb));var c=c-(this.Z-this.ab),d=this.Z-this.R;d&&(this.Y=Math.round(this.S/(10*d))/100,864E5<=d&&(this.la=0,$c(this)));if(0>c||this.Y<this.eb)-1E3>c&&(this.R-=c),c=0;this.yb+=this.va;this.Z+=c;a(b,c)}}};
k.sb=function(a){if(tb(this))return!1;if(this.v.fa)return this.j(this.toString()+" busy"),!1;$c(this);this.v.fa=!0;this.v.Sb=!0;var b=this.F.run;b&&(b.textContent="Halt");this.B&&(a&&this.B.gb(!0),this.B.start(this.R,Zc(this)));setTimeout(this.tc,0);return!0};k.tb=function(){return 0};k.ia=function(a){var b=!1;if(this.v.fa){cd(this);ad(this,this.S);this.S=0;this.v.fa=!1;if(b=this.F.run)b.textContent="Run";this.B&&this.B.stop(Aa(),Zc(this));b=!0}this.v.complete=a;return b};
function fd(a){this.mb=+a.model||1170;this.Kb=a.addrReset||0;Sc.call(this,a,6666667);this.decode=1120==this.mb?gd.bind(this):hd.bind(this);id(this);this.L=0;this.N=null;this.v.complete=!1}u(fd,Sc);k=fd.prototype;k.reset=function(){this.status("model "+this.mb);this.v.fa&&this.ia();id(this);Vc(this);this.v.error=!1;this.parent.reset.call(this)};
function id(a){a.T=65536;a.U=32768;a.$=65535;a.X=32768;a.M=15;a.u=[0,0,0,0,0,0,0,a.Kb];a.Na=[0,0,0,0,0,0];a.Aa=[0,0,0,0];a.A=0;a.Fa=0;a.Nc=[4,2,0,1];a.V=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ta=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Sc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.yc=[0,0,0,0,0,0,0,0];a.xc=0;a.H=0;a.G=a.I=0;a.g=a.f=a.jb=0;a.sa=-1;jd(a)}function jd(a){a.Wa=255;a.ca=0;a.dc=0;a.C=0;a.Ua=0;a.Db=0;a.Va=0;a.Sa=0;a.Ea=0;a.xb=262143;a.$a=253952;a.N=null;a.w&&oc(a)}function oc(a){a.Sa?(a.P=65536,a.aa=a.Mc,a.pa=a.Ad,a.Fb=a.le,Yb(a.w,a.Va&16?22:18)):(a.P=0,a.aa=a.Lc,a.pa=a.wc,a.Fb=a.Dc,Yb(a.w,16))}function kd(a,b,c){a.Kb=b;N(a,b);!c&&a.i&&(a.ia()||a.i.da())}k.nc=function(){return 0};
k.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.la,this.Ta]);a.set(2,fc(this.w));return a.data()};k.restore=function(a){var b=a[1];this.la=b[1];$c(this,b[3]);a:{b=this.w;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.J){for(var f=0,g=Array(b.J),h=0;h<e.length-1;)for(var m=e[h++],n=e[h++];m--;)g[f++]=n;e=g}f=b.W[d];if(!f||!f.restore(e)){p("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function ld(a){return a.T&65536?1:0}
function md(a){return a.U&32768?2:0}function nd(a){return a.$&65535?0:4}k.Ma=function(){return this.X&32768?8:0};function od(a){var b=a.u[7];a.C&57344||(a.Ua=0,a.Db=b);a.u[7]=b+2&65535;return a.pa(b)}function pd(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function N(a,b){a.u[7]=b&65535}function nc(a,b){return{Gd:a,pb:b,next:null}}function lc(a,b){if(b!=a.N){var c=a.N;if(!c||c.pb<=b.pb)b.next=c,a.N=b;else{do{var d=c.next;if(!d||d.pb<=b.pb){b.next=d;c.next=b;break}c=d}while(c)}}a.H|=2}
function Bb(a){return a.M=a.M&63728|a.Ma()|nd(a)|md(a)|ld(a)}function qc(a,b){a.X=b<<12;a.$=~b&4;a.U=b<<14;a.T=b<<16;if((b^a.M)&2048)for(var c=a.Na.length;0<=--c;){var d=a.u[c];a.u[c]=a.Na[c];a.Na[c]=d}a.A=b>>14&3;c=a.M>>14&3;a.A!=c&&(a.Aa[c]=a.u[6],a.u[6]=a.Aa[a.A]);a.M=b;a.H|=2}function Q(a,b){a.H&128||(a.X=a.$=b,a.U=0)}function qd(a,b,c){a.H&128||(a.X=a.$=a.T=b,a.U=c||0)}function rd(a,b,c,d){a.H&128||(a.X=a.$=a.T=b,a.U=(c^b)&(d^b))}function sd(a,b){a.H&128||(a.X=a.$=a.T=b,a.U=a.X^a.T>>1)}
function td(a,b,c,d){a.H&128||(a.X=a.$=a.T=b,a.U=(c^d)&(d^b))}k.ja=function(a,b){if(!this.L){var c=!1;0>this.sa?this.sa=Bb(this):this.A||(a=4,c=!0);this.C&57344||(this.Ua=63222,this.Db=a);this.A=0;var d=this.pa(a|this.P),e=this.pa(a+2&65535|this.P);qc(this,e&-12289|this.sa>>2&12288);c&&(this.ca|=4,this.u[6]=4);ud(this,this.sa);ud(this,this.u[7]);N(this,d);this.H&=-113;this.sa=-1;this.H|=8;this.Rc=a;this.Qc=b;if(26!=b)throw a;}};
function Md(a){var b=Nd(a),c=Nd(a)&-1793;a.M&49152&&(c=c&-225|a.M&63712);N(a,b);qc(a,c);a.H&=-17}
function Od(a,b,c){var d,e,f,g=0;d=b>>13;a.Va&a.Nc[a.A]||(d&=7);e=a.V[a.A][d];f=(a.ta[a.A][d]<<6)+(b&8191)&a.xb;if(f<a.$a)f&1&&!(c&1)&&(a.ca|=64,a.ja(4,10));else if(a.Va&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var h=f>>13&31;31>h?a.Va&32&&(f=a.Sc[h]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.$a&&4186112>f&&(a.ca|=32,a.ja(4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&
4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.V[a.A][d]=e;if(4194170!==f||a.A)a.Ea=a.A,a.Fa=d;g&&(g&57344&&(0<=a.sa&&(g|=128),a.C&57344||(a.C=a.C|g|a.Ea<<5|a.Fa<<1),a.ja(168,16)),a.C&61440||!(4191360>f||4194239<f)||(a.C|=4096,a.C&512&&(a.H|=32)));return f}function Pd(a,b){return a.w.zb(b)}function Qd(a,b,c){b&1&&a.b--;a.w.Qb(b,c&255)}function Nd(a){var b=a.pa(a.u[6]|a.P);a.u[6]=a.u[6]+2&65535;return b}
function ud(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.C&57344||(a.Ua=a.Ua<<8|246);!a.A&&c<=a.Wa&&4<c&&(c<=a.Wa-32?(a.ca|=4,a.u[6]=4,a.ja(4,18)):(a.ca|=8,a.H|=4));a.Fb(c,b)}
function Rd(a,b,c,d){var e,f,g=d&8?0:a.P;switch(b){case 0:return a.ja(4,20),0;case 1:return 6===c&&!a.A&&d&4&&(a.u[6]<=a.Wa||65534<=a.u[6])&&(a.u[6]<=a.Wa-32||65534<=a.u[6]?(a.ca|=4,a.u[6]=4,a.ja(4,22)):(a.ca|=8,a.H|=64)),a.b-=3,7===c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!==c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!==c&&(e|=g);e=a.pa(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!==c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!==c&&(e|=g);e=a.pa(e)|
g;a.b-=8;break;case 6:return e=a.pa(pd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.pa(pd(a,2)),e=e+a.u[c]&65535,e=a.pa(e|a.P)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.C&57344||(a.Ua=a.Ua<<8|f<<3&248|c);6==c&&!a.A&&d&4&&0>=f&&(a.u[6]<=a.Wa||65534<=a.u[6])&&(a.u[6]<=a.Wa-32?(a.ca|=4,a.u[6]=4,a.ja(4,24)):(a.ca|=8,a.H|=64));return e}k.Mb=function(a){if(!this.Sa)return this.w.Mb(a);this.L++;a=Pd(this,Od(this,a,3));this.L--;return a};
k.lb=function(a){if(!this.Sa)return this.w.lb(a);this.L++;a=this.wc(Od(this,a,2));this.L--;return a};k.fb=function(a,b){this.Sa?(this.L++,Qd(this,Od(this,a,5),b),this.L--):this.w.fb(a,b)};k.Rb=function(a,b){this.Sa?(this.L++,this.Dc(Od(this,a,4),b),this.L--):this.w.Rb(a,b)};k.Lc=function(a,b,c){return Rd(this,a,b,c)};k.Mc=function(a,b,c){return Od(this,Rd(this,a,b,c),c)};k.wc=function(a){return this.w.oa(a)};k.Ad=function(a){return this.w.oa(Od(this,a,2))};k.Dc=function(a,b){this.w.hb(a,b&65535)};
k.le=function(a,b){this.w.hb(Od(this,a,4),b)};function Sd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=Rd(a,b,d,2),c&65536||61440!==(a.M&61440)&&(d&=65535),a.A=a.M>>12&3,c=a.pa(d|c&a.P),a.A=a.M>>14&3):c=6!=d||(a.M>>2&12288)===(a.M&12288)?a.u[d]:a.Aa[a.M>>12&3];return c}function Td(a,b,c,d){a.C&57344||(a.Ua=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=Rd(a,b,e,4),c&65536||(e&=65535),a.A=a.M>>12&3,e=Od(a,e|c&65536,4),a.A=a.M>>14&3,a.w.hb(e,d)):6!=e||(a.M>>2&12288)===(a.M&12288)?a.u[e]=d:a.Aa[a.M>>12&3]=d}
function Ud(a,b){b>>=6;var c=a.I=b&7;return(b=a.G=(b&56)>>3)?Pd(a,a.aa(b,c,3)):a.u[c]&255}function Vd(a,b){b>>=6;var c=a.I=b&7;return(b=a.G=(b&56)>>3)?a.w.oa(a.aa(b,c,2)):a.u[c]}function Wd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return Rd(a,b,c,8)}function Xd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?Pd(a,a.aa(b,c,3)):a.u[c]&255}function Yd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.w.oa(a.aa(b,c,2)):a.u[c]}
function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.jb=a.aa(b,e,7),Qd(a,e,d.call(a,c,Pd(a,e)))):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.aa(b,e,6),a.w.hb(e,d.call(a,c,a.w.oa(e)))):a.u[e]=d.call(a,c,a.u[e])}function Zd(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?Qd(a,a.aa(b,e,5),c):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}
function $d(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.hb(a.aa(b,d,4),c):a.u[d]=c&65535;return c}function T(a,b,c){c&&(N(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
k.tb=function(a){this.v.complete=!0;var b=this.i&&ae(this.i)?1:this.v.Sb?-1:0,c=a?this.v.Sb?0:1:-1;this.v.Sb=!1;this.ba=this.b=a;do{if(b){if(this.i&&be(this.i,this.u[7],c)){this.ia();break}c||c++;b++}if(this.H){this.H&112&&(this.H&32?this.ja(168,28):this.H&64?this.ja(4,30):this.H&16&&this.ja(12,32),this.H&=-113);if(a=this.H&7){a=!1;if(this.H&2){this.H&=-3;var d=160,e=(this.dc&224)>>5,f=this.N&&this.N.pb>e?this.N:null;f&&(d=f.Gd,e=f.pb);e>(this.M&224)>>5?(this.H&4&&(pd(this,2),this.H&=-5),this.ja(d,
26),e=!0):e=!1;if(e){if(f)if(a=f,f=this.N,f==a)this.N=a.next;else for(;f;){e=f.next;if(e==a){f.next=e.next;break}f=e}a=!0}}else this.H&1&&this.H++;a=a&&0>c}if(a)break}this.H=this.H&7|this.M&16;this.decode(od(this))}while(0<this.b);return this.v.complete?this.ba-this.b:void 0===this.v.complete?0:-1};Wa(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new fd(d);C(d,c)}});function ce(a,b){var c=b+a;rd(this,c,a,b);return c&65535}
function de(a,b){var c=b+a;rd(this,c<<8,a<<8,b<<8);return c&255}function ee(a,b){a=b<<1;sd(this,a);return a&65535}function fe(a,b){a=b<<1;sd(this,a<<8);return a&255}function ge(a,b){a=b&32768|b>>1|b<<16;sd(this,a);return a&65535}function he(a,b){a=b&2048|b>>1|b<<8;sd(this,a<<8);return a&255}function ie(a,b){a=b&~a;Q(this,a);return a}function je(a,b){a=b&~a;Q(this,a<<8);return a}function ke(a,b){a|=b;Q(this,a);return a}function le(a,b){a|=b;Q(this,a<<8);return a}
function me(a,b){a=~b|65536;qd(this,a);return a&65535}function ne(a,b){a=~b|256;qd(this,a<<8);return a&255}function oe(a,b){a=b-a;this.H&128||(this.X=this.$=a,this.U=b&(b^a));return a&65535}function pe(a,b){a=b-a;var c=a<<8;b<<=8;this.H&128||(this.X=this.$=c,this.U=b&(b^c));return a&255}function qe(a,b){a=b+a;this.H&128||(this.X=this.$=a,this.U=a&(b^a));return a&65535}function re(a,b){a=b+a;var c=a<<8;this.H&128||(this.X=this.$=c,this.U=c&(b<<8^c));return a&255}
function se(a,b){a=-b;qd(this,a,a&b&32768);return a&65535}function te(a,b){a=-b;qd(this,a<<8,(a&b&128)<<8);return a&255}function ue(a,b){a=b<<1|this.T>>16&1;sd(this,a);return a&65535}function ve(a,b){a=b<<1|this.T>>16&1;sd(this,a<<8);return a&255}function we(a,b){a=(this.T&65536|b)>>1|b<<16;sd(this,a);return a&65535}function xe(a,b){a=((this.T&65536)>>8|b)>>1|b<<8;sd(this,a<<8);return a&255}function ye(a,b){var c=b-a;td(this,c,a,b);return c&65535}
function ze(a,b){var c=b-a;td(this,c<<8,a<<8,b<<8);return c&255}function Ae(a,b){this.H&128||(this.X=this.$=b&65280,this.U=this.T=0);return(b<<8|b>>8)&65535}function Be(a,b){a^=b;Q(this,a);return a&65535}function Ce(a){S(this,a,Vd(this,a),ce);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}
function De(a){var b=Yd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.T=this.U=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.T=c<<17-b,c>>=b;else if(b)if(16<b)this.U=c,c=0;else{this.T=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.U=32768)}this.u[a]=c&65535;this.X=this.$=c;this.b-=(this.g?6:7)+b}
function Ee(a){var b=Yd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.T=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.T=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.U=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.X=d>>16;this.$=d>>16|d;this.b-=(this.g?6:7)+b}function Fe(a){T(this,a,!ld(this))}function Ge(a){T(this,a,ld(this))}
function He(a){S(this,a,Vd(this,a),ie);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}function Ie(a){R(this,a,Ud(this,a),je);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}function Je(a){S(this,a,Vd(this,a),ke);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}function Ke(a){R(this,a,Ud(this,a),le);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}
function Le(a){Q(this,Vd(this,a)&Yd(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}function Me(a){Q(this,(Ud(this,a)&Xd(this,a))<<8);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}function Ne(a){T(this,a,nd(this))}function Oe(a){T(this,a,!this.Ma()==!md(this))}function Pe(a){T(this,a,!nd(this)&&!this.Ma()==!md(this))}function Qe(a){T(this,a,!ld(this)&&!nd(this))}function Re(a){T(this,a,nd(this)||!this.Ma()!=!md(this))}
function Se(a){T(this,a,ld(this)||nd(this))}function Te(a){T(this,a,!this.Ma()!=!md(this))}function Ue(a){T(this,a,this.Ma())}function Ve(a){T(this,a,!nd(this))}function We(a){T(this,a,!this.Ma())}function Xe(){this.ja(12,1);this.b-=5}function Ye(a){T(this,a,!0)}function Ze(a){T(this,a,!md(this))}function $e(a){T(this,a,md(this))}function U(a){a&1&&(this.T=0);a&2&&(this.U=0);a&4&&(this.$=1);a&8&&(this.X=0);this.b-=5}
function af(a){var b=Vd(this,a);a=Yd(this,a);td(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}function bf(a){var b=Ud(this,a)<<8;a=Xd(this,a)<<8;td(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.G?4:3)+(7==this.f?2:0)}
function cf(a){var b=Yd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.$=d>>16|d,this.X=d>>16):(this.U=32768,this.$=d>>15|d,this.X=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.$=this.X=0,this.U=32768,this.T=65536,this.b-=7}function df(){this.ja(24,2);this.b-=25}
function ef(){this.M&49152?(this.ca|=128,this.ja(4,3)):this.i?cc(this.i):this.ia();this.b-=7}function ff(){this.ja(16,4);this.b-=25}var gf=[0,7,7,10,7,11,9,13];function hf(a){this.J=this.b;N(this,Wd(this,a));this.b=this.J-gf[this.g]}var jf=[0,14,14,17,14,18,16,20];function kf(a){this.J=this.b;var b=Wd(this,a);a=a>>6&7;ud(this,this.u[a]);this.u[a]=this.u[7];N(this,b);this.b=this.J-jf[this.g]}var lf=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
function mf(a){var b=Vd(this,a);this.J=this.b;Q(this,$d(this,a,b));this.b=this.J-lf[(this.G?8:0)+this.g]+(7!=this.f||this.g?0:2)}function nf(a){var b=Ud(this,a);Q(this,Zd(this,a,b,1)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}var of=[7,13,13,17,14,18,17,21];
function pf(a){var b=Yd(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.H&128||(this.X=b>>16,this.$=this.X|b,this.U=0,this.T=-32768>b||32767<b?65536:0);this.b-=23}function qf(){this.b-=5}function rf(){this.M&49152||(jd(this),this.w.reset());this.b-=667}function sf(){Md(this);this.H|=this.M&16;this.b-=13}
function tf(a){if(a&8)V.call(this,a);else{var b=Nd(this);a&=7;7==a?N(this,b):(N(this,this.u[a]),this.u[a]=b);this.b-=9}}function W(a){a&1&&(this.T=65536);a&2&&(this.U=32768);a&4&&(this.$=0);a&8&&(this.X=32768);this.b-=5}function uf(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)N(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function vf(a){S(this,a,Vd(this,a),ye);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.G?5:3)+(7==this.f?2:0)}
function wf(a){S(this,a,0,Ae);this.b-=this.g?9:3+(7==this.f?2:0)}function xf(){this.ja(28,5);this.b-=5}function yf(){this.H&4||this.B.da();this.H|=4;pd(this,-2);this.b-=3}function zf(a){S(this,a,Vd(this,a),Be);this.b-=this.g?9:3+(7==this.f?2:0)}function V(a){var b;if(b=this.i)b=this.i,E(b,"undefined opcode "+J(b,a),!0,!0),b=cc(b);b||this.ja(8,6)}function gd(a){Af[a>>12].call(this,a)}function Bf(a){Cf[a>>6&3].call(this,a)}function Df(a){Ef[a>>6&3].call(this,a)}
function Ff(a){Gf[a>>6&3].call(this,a)}function Hf(a){If[a&15].call(this,a)}function Jf(a){Kf[a&15].call(this,a)}function Lf(a){Mf[a>>6&3].call(this,a)}function Nf(a){Of[a>>6&3].call(this,a)}function Pf(a){Qf[a>>6&3].call(this,a)}
var Af=[function(a){Rf[a>>8&15].call(this,a)},mf,af,Le,He,Je,Ce,V,function(a){Sf[a>>8&15].call(this,a)},nf,bf,Me,Ie,Ke,vf,V],Rf=[function(a){Tf[a>>4&15].call(this,a)},Ye,Ve,Ne,Oe,Te,Pe,Re,kf,kf,Bf,Df,Ff,V,V,V],Cf=[function(a){qd(this,$d(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,me);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,qe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,oe);this.b-=this.g?9:3+(7==this.f?2:0)}],Ef=[function(a){S(this,a,0,
se);this.b-=this.g?11:6},function(a){S(this,a,ld(this)?1:0,ce);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,ld(this)?1:0,ye);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Yd(this,a);qd(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],Gf=[function(a){S(this,a,0,we);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ue);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ge);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ee);this.b-=this.g?9:3+(7==this.f?2:0)}],
Tf=[function(a){Uf[a&15].call(this,a)},V,V,V,hf,hf,hf,hf,tf,V,Hf,Jf,wf,wf,wf,wf],Uf=[ef,yf,sf,Xe,ff,rf,V,V,V,V,V,V,V,V,V,V],If=[qf,function(){this.T=0;this.b-=5},function(){this.U=0;this.b-=5},U,function(){this.$=1;this.b-=5},U,U,U,function(){this.X=0;this.b-=5},U,U,U,U,U,U,U],Kf=[qf,function(){this.T=65536;this.b-=5},function(){this.U=32768;this.b-=5},W,function(){this.$=0;this.b-=5},W,W,W,function(){this.X=32768;this.b-=5},W,W,W,W,W,W,W],Sf=[We,Ue,Qe,Se,Ze,$e,Fe,Ge,df,xf,Lf,Nf,Pf,V,V,V],Mf=[function(a){qd(this,
Zd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,ne);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,pe);this.b-=this.g?9:3+(7==this.f?2:0)}],Of=[function(a){R(this,a,0,te);this.b-=this.g?11:6},function(a){R(this,a,ld(this)?1:0,de);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,ld(this)?1:0,ze);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Xd(this,a);qd(this,a<<8);this.b-=this.g?4:3+(7==
this.f?2:0)}],Qf=[function(a){R(this,a,0,xe);this.b-=this.g?9+(this.jb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,he);this.b-=this.g?9+(this.jb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,fe);this.b-=this.g?9:3+(7==this.f?2:0)}];function hd(a){Vf[a>>12].call(this,a)}
var Vf=[function(a){Wf[a>>8&15].call(this,a)},mf,af,Le,He,Je,Ce,function(a){Xf[a>>8&15].call(this,a)},function(a){Yf[a>>8&15].call(this,a)},nf,bf,Me,Ie,Ke,vf,V],Wf=[function(a){Zf[a>>4&15].call(this,a)},Ye,Ve,Ne,Oe,Te,Pe,Re,kf,kf,Bf,Df,Ff,function(a){$f[a>>6&3].call(this,a)},V,V],$f=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.pa(a|this.P);N(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=Sd(this,a,0);ud(this,a);Q(this,a);this.b-=11},function(a){var b=Nd(this);this.J=
this.b;Td(this,a,0,b);Q(this,b);this.b=this.J-of[this.g]},function(a){Q(this,$d(this,a,this.Ma?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Zf=[function(a){ag[a&15].call(this,a)},V,V,V,hf,hf,hf,hf,tf,function(a){a&8?(this.M&49152||(this.M=this.M&-2017|(a&7)<<5,this.H|=1),this.b-=5):V.call(this,a)},Hf,Jf,wf,wf,wf,wf],ag=[ef,yf,sf,Xe,ff,rf,function(){Md(this);this.b-=13},V,V,V,V,V,V,V,V,V],Xf=[pf,pf,cf,cf,De,De,Ee,Ee,zf,zf,V,V,V,V,uf,uf],Yf=[We,Ue,Qe,Se,Ze,$e,Fe,Ge,df,xf,Lf,Nf,Pf,function(a){bg[a>>
6&3].call(this,a)},V,V],bg=[V,function(a){a=Sd(this,a,65536);ud(this,a);Q(this,a);this.b-=11},function(a){var b=Nd(this);this.J=this.b;Td(this,a,65536,b);Q(this,b);this.b=this.J-of[this.g]},V];
function cg(a){r.call(this,"ROM",a,cg);this.ga=this.f=null;this.C=a.addr;this.g=a.size;this.A=a.alias;this.B=a.file;this.G=ra(this.B);if(this.B){a=this.B;var b=sa(this.G);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.B+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?c.O("Unable to load ROM resource (error "+f+": "+a+")"):(mb(c.Ia,a,b),(a=Ea(a,b))?(c.f=a.ea,c.ga=a.ga):c.B=null,dg(c))})}}u(cg);cg.prototype.wa=function(a,b,c,d){this.w=b;this.b=c;this.i=d;dg(this)};
cg.prototype.za=function(){this.ga&&(this.i&&eg(this.i,this.id,this.C,this.g,this.ga),delete this.ga);return!0};cg.prototype.ya=function(){return!0};
function dg(a){if(!sb(a)){if(a.B){if(!a.f||!a.w)return;a.g||(a.g=a.f.length);if(a.f.length!=a.g)ub(a,"ROM size ("+l(a.f.length,8,!0)+") does not match specified size ("+l(a.g,8,!0)+")");else{var b;b=a.C;if(ac(a.w,b,a.g,Hc)){var c;for(c=0;c<a.f.length;c++)a.w.fb(b+c,a.f[c]);b=!0}else b=!1;if(b){b=[];"number"==typeof a.A?b.push(a.A):null!=a.A&&a.A.length&&(b=a.A);for(c=0;c<b.length;c++){var d=a,e=b[c],f=$b(d.w,d.C,d.g);Zb(d.w,e,d.g,f)}delete a.f}}}G(a)}}
Wa(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new cg(d);C(d,c)}});
function yg(a){r.call(this,"RAM",a,yg);this.ga=this.g=null;this.B=a.addr;this.C=a.size;this.Ca=a.load;this.Ba=a.exec;this.A=!1;this.f=a.file;this.G=ra(this.f);if(this.f){a=this.f;var b=sa(this.G);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?c.O("Unable to load RAM resource (error "+f+": "+a+")"):(mb(c.Ia,a,b),(a=Ea(a,b))?(c.g=a.ea,c.ga=a.ga,null==c.Ca&&(c.Ca=a.Ca),null==c.Ba&&(c.Ba=a.Ba)):c.f=null,zg(c))})}}u(yg);
yg.prototype.wa=function(a,b,c,d){this.w=b;this.b=c;this.i=d;zg(this)};yg.prototype.za=function(){this.ga&&(this.i&&eg(this.i,this.id,this.B,this.C,this.ga),delete this.ga);return!0};yg.prototype.ya=function(){return!0};function zg(a){if(a.w&&(!a.A&&a.C&&ac(a.w,a.B,a.C,1)&&(a.A=!0),!sb(a))){if(!a.A)p("No RAM allocated");else if(a.f){if(!a.g||!a.w)return;Ag(a,a.g,a.Ca,a.Ba,a.B)}G(a)}}
yg.prototype.reset=function(){if(this.A){for(var a=this.w,b=this.B,c=this.C,d=b&a.w,b=b>>>a.ka;0<c&&b<a.W.length;){var e=a.W[b],f=c,g,d=d||0;void 0===f&&(f=e.size);if(vb)for(g=d;f--&&g<e.F.length;g++)e.F[g]=0;else for(g=d;f--&&g<e.size;g++)e.Ub(d,0,e.D+d);c-=a.ua;b++;d=0}this.g&&Ag(this,this.g,this.Ca,this.Ba,this.B,!0)}};
function Ag(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var m=b[h]&255|(b[h+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(h+6>=b.length)break;for(var h=h+2,n=b[h++]&255|(b[h++]&255)<<8,q=b[h++]&255|(b[h++]&255)<<8,m=m+((n&255)+(n>>8)+(q&255)+(q>>8)),w=h,v=n-=6;0<n&&h<b.length;)m+=b[h++]&255,n--;if(n||h>=b.length)break;m+=b[h++]&255;if(m&255)break;if(v)for(;v--;)a.b.fb(q++,b[w++]&255);else q&1?a.b.ia():kd(a.b,q,f);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.b.fb(c+
e,b[e]);null!=d&&kd(a.b,d,f);g=!0}return g}Wa(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new yg(d);C(d,c)}});function Bg(a){r.call(this,"Keyboard",a,Bg,65536);G(this)}u(Bg);Bg.prototype.qa=function(){return!1};Bg.prototype.wa=function(a,b,c,d){this.B=a;this.b=c;this.i=d};Wa(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Bg(d);C(d,c)}});
function X(a){this.N=a.baudReceive||9600;this.R=a.baudTransmit||9600;this.ba=a.upperCase;this.A=this.G=null;this.S=a.tabSize;this.P=a.charBOL;this.I=0;r.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.G="";else{var c;a=Cg;b&&(void 0===c&&(c="Panel"),(c=pb(c,this.id))&&(b=c.F[b])&&this.qa(null,a,b))}this.J=this.L=null;this.exports={connect:this.sc,receiveData:this.cc}}u(X);var Cg="buffer";k=X.prototype;
k.qa=function(a,b,c){var d=this;switch(b){case Cg:return this.F[b]=this.A=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.cc(b);return!0},c.onkeypress=function(a){a=a||window.event;d.cc(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;var e=this;this.la=nc(48,4);this.Y=kc(this.b,function(){e.f&128||!e.C.length||(e.K=e.C.shift()&255,e.ba&&97<=e.K&&122>e.K&&(e.K-=32),e.f|=128,e.f&64&&lc(e.b,e.la))});this.ma=nc(52,4);this.Z=kc(this.b,function(){e.g|=128;e.g&64&&lc(e.b,e.ma)});hc(b,this,Dg);G(this)};
k.sc=function(){if(!this.J){var a=Uc(this.B,"connection");if(a){var b=a.split("->");if(2==b.length){var c=xa(b[0]);if(c!=this.Za)return;b=xa(b[1]);if(this.J=ob(b)){var d=this.J.exports;if(d){var e=d.connect;e&&e.call(this.J);if(this.L=d.receiveData){this.status(this.Ia+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.za=function(a,b){if(!b)if(this.sc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
k.ya=function(a){return a?this.save():!0};k.reset=function(){Eg(this)};k.save=function(){var a=new O(this);a.set(0,[]);return a.data()};k.restore=function(){return Eg(this)};function Eg(a){a.K=0;a.f=0;a.g=128;a.C=[];return!0}k.cc=function(a){if("number"==typeof a)this.C.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.C.push(a.charCodeAt(b));else this.C=this.C.concat(a);mc(this.b,this.Y,1E3/Math.round(this.N/10));return!0};k.pd=function(){return this.f&65534};
k.ae=function(a){this.f=this.f&-112|a&111};k.od=function(){this.f&=-129;0<this.C.length&&mc(this.b,this.Y,1E3/Math.round(this.N/10));return this.K};k.$d=function(){};k.Cd=function(){return this.g};k.ne=function(a){128==(this.g&192)&&a&64&&mc(this.b,this.Z,1E3/Math.round(this.R/10));this.g=this.g&-70|a&69};k.Bd=function(){return 0};
k.me=function(a){if(a&=255){E(this,"transmitByte("+l(a,2,!0)+")");this.L&&this.L.call(this.J,a);if(this.A)if(13==a)this.I=0;else if(8==a)this.A.value=this.A.value.slice(0,-1),0<this.I&&this.I--;else{var b;b=(b=ya[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.S||8,c=a-this.I%a,this.S&&(b=wa("",c)));this.P&&!this.I&&c&&(b=String.fromCharCode(this.P)+b);this.A.value+=b;this.A.scrollTop=this.A.scrollHeight;this.I+=c}else if(null!=this.G){if(10==a||1024<=this.G.length)this.j(this.G),
this.G="";10!=a&&(this.G+=String.fromCharCode(a))}this.g&=-129;mc(this.b,this.Z,1E3/Math.round(this.R/10))}};var Fg={},Dg=(Fg[65392]=[null,null,X.prototype.pd,X.prototype.ae,"RCSR"],Fg[65394]=[null,null,X.prototype.od,X.prototype.$d,"RBUF"],Fg[65396]=[null,null,X.prototype.Cd,X.prototype.ne,"XCSR"],Fg[65398]=[null,null,X.prototype.Bd,X.prototype.me,"XBUF"],Fg);Wa(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new X(d);C(d,c)}});
function rc(a){r.call(this,"PC11",a,rc);this.g=a.autoMount||null;this.G=0;this.Z=a.baudReceive||3600;this.K=this.L=this.f=0;this.J=[];this.I=Gg;this.A=Hg;this.N=this.C="";this.ea=this.Ca=this.Ba=null;this.S=-1;this.R=!Oa("Mobi")&&window&&"FileReader"in window}u(rc);var Gg="",Hg=0;k=rc.prototype;
k.qa=function(a,b,c){var d=this,e=Hg;switch(b){case "listTapes":return this.F[b]=c,c.onchange=function(){var a=d.F.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(m){p("PC11 option error: "+m.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.F[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.F[b]=c,c.onclick=
function(){var a=d.F.listTapes;a&&Ig(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.R){c.parentNode.removeChild(c);break}this.F[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Ig(d,ra(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.F[b]=c,!0}return!1};
k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;this.Y=Jg(a);var e=this;if((this.g=Uc(this.B,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){p("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.P=nc(56,4);this.ba=kc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.K<e.J.length&&(e.L=e.J[e.K++]&255,Kg(e,e.K/e.J.length*100),e.f|=128,e.f&=-2049,e.f&64&&lc(e.b,e.P))});hc(b,this,Lg);Mg(this,"None",Gg,!0);this.R&&Mg(this,"Local Tape",
"?");Mg(this,"Remote Tape","??");Ng(this)||G(this)};k.za=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.ya=function(a){return a?this.save():!0};k.reset=function(){this.f&=-2241;this.L=0};function Ng(a){a.G=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.F.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=ra(b,!0)}b&&c?Og(a,c,b,1,!0):Pg(a)}return!!a.G}
function Ig(a,b,c,d,e){if(c)if("?"==c)a.O('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"');a.I="??"}else a.I=c;Og(a,b,c,d,!1,e)}else Qg(a,!1)}
function Og(a,b,c,d,e,f){var g=-1;if(a.C.toLowerCase()!=c.toLowerCase()||a.A!=d)g++,Qg(a,!0),a.v.Qa?a.O("PC11 busy"):(e&&(a.G++,F(a)&&E(a,"auto-loading tape: "+b)),Rg(a,b,c,d,f)?g++:a.v.Qa=!0);g&&Sg(a,a.N,a.C,a.A,a.ea,a.Ca,a.Ba)}
function Rg(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),Sg(a,b,c,d,e),a.I="?");Pg(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=sa(c),f="json"==e||"gz"==e?encodeURI(c):Fa()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Da(f,null,!0,function(e,f,g){var h=0>g&&a.B&&!a.B.v.ha;g?a.O('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(mb(a.Ia,e,f),(e=Ea(e,f))&&Sg(a,b,c,d,e.ea,e.Ca,
e.Ba));a.v.Qa=!1;a.G&&(a.G--,a.G||G(a));Pg(a)})}function Mg(a,b,c,d){if((a=a.F.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function Pg(a){var b=a.F.listTapes;if(b&&b.options){a=a.I||a.C;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function Kg(a,b){b|=0;if(b!==a.S){var c=a.F.readProgress;c&&(c=(c=D(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.S=b}}
function Sg(a,b,c,d,e,f,g){a.N=b;a.C=c;a.A=d;a.ea=e;a.Ca=f;a.Ba=g;2==d?a.Y&&Ag(a.Y,e,f,g)?a.status("tape loaded: "+b):(a.N="",a.C="",a.I=Gg,a.A=Hg,a.O("No load address available for tape: "+b)):(a.K=0,a.J=e,a.status("tape attached: "+b),Kg(a,0))}function Qg(a,b){if(a.C||!1===b)a.N="",a.C="",b||(a.A&&a.status(1==a.A?"tape detached":"tape unloaded"),a.I=Gg,a.A=Hg,Pg(a))}k.save=function(){return(new O(this)).data()};k.restore=function(){return!0};k.hd=function(){return this.f&65534};
k.Ud=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&lc(this.b,this.P)):(this.f&=-129,this.f|=2048,this.L=0,mc(this.b,this.ba,1E3/Math.round(this.Z/10))));this.f=this.f&-66|a&65};k.gd=function(){this.f&=-129;this.f|=2048;return this.L};k.Td=function(){};var Tg={},Lg=(Tg[65384]=[null,null,rc.prototype.hd,rc.prototype.Ud,"PRS"],Tg[65386]=[null,null,rc.prototype.gd,rc.prototype.Td,"PRB"],Tg);
function Ug(a,b,c){r.call(this,"Disk",{id:a.Ia+".disk"+l(++Vg,4)},Ug,2097152);this.controller=a;this.B=a.B;this.i=a.i;this.A=b;this.Oa=b.name;this.Zb=b.Zb;Wg(this,c,b.Ha,b.Da,b.xa,b.Ja);G(this)}var Vg=0;u(Ug);Ug.prototype.wa=function(a,b,c,d){this.i=d};
function Wg(a,b,c,d,e,f){a.mode=b;a.Ha=c;a.Da=d;a.xa=e;a.Ja=f;a.b=[];if("preload"!=a.mode){b=Array(a.Ha);for(c=0;c<b.length;c++){d=Array(a.Da);for(e=0;e<d.length;e++){f=Array(a.xa);for(var g=1;g<=f.length;g++)f[g-1]=Xg(null,c,e,g,a.Ja,0);d[e]=f}b[c]=d}a.b=b}a.f=null}
function Yg(a,b,c,d,e){var f=c;if(a.w)return!0;a.Oa=b;a.Xa=c;a.Ac=ra(c);a.w=e;a.C=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ka[d];if(e){a.Ha=e[0];a.Da=e[1];a.xa=e[2];a.Ja=e[3]||512;c=a.Ja>>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.Ha);for(d=0;d<a.b.length;d++)for(var v=a.b[d]=Array(a.Da),x=0;x<v.length;x++)for(var z=v[x]=Array(a.xa),y=0;y<z.length;y++){for(var B=Xg(null,d,x,y+1,a.Ja,0),ia=B.data,Ja=0;Ja<c;Ja++,f+=4)var P=ia[Ja]=b.getInt32(f,
!0),e=e+P&-1;B.Gb=c;z[y]=B}a.f=e;c=a}else a.O("Unrecognized disk format ("+d+" bytes)");a.w&&(a.w.call(a.controller,a.A,c,a.Oa,a.Xa),a.w=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=sa(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ta(c,"/")&&(d="dir"),f=Fa()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.Zb?"":e)+"&format=json"));return!!Da(f,
null,!0,function(b,c,d){Zg(a,b,c,d)})}
function Zg(a,b,c,d){var e=null;a.g=!1;var f=0>d&&a.B&&!a.B.v.ha;if(d)a.controller.O('Unable to load disk "'+a.Oa+'" (error '+d+": "+b+")",f);else{mb(a.controller.Ia,b,c);try{if(0<ra(a.Ac,!0).toLowerCase().indexOf("-readonly"))a.g=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.g=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.Oa]:h=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(h.length)if(1==h.length)p(h[0]);else{a.Ha=h.length;a.Da=h[0].length;a.xa=h[0][0].length;var m=h[0][0][0];a.Ja=m&&m.length||512;for(d=c=0;d<a.Ha;d++)for(f=0;f<a.Da;f++)for(g=0;g<a.xa;g++)if(m=h[d][f][g]){var n=m.length;void 0===n&&(n=m.length=512);var n=n>>2,q=m.pattern;void 0===q&&(q=m.pattern=0);var w=m.data;if(void 0===w){var v=m.bytes;if(void 0!==v&&v.length){for(var x=n<<2,z=v.length;z<x;z++)v[z]=q;$g(m,v)}else w=[],q=m.pattern=q|q<<8|q<<16|q<<24,m.data=w;delete m.bytes}Xg(m,d,f);for(x=
0;x<w.length;x++)c=c+w[x]&-1}a.b=h;a.f=c;e=a}else p("Empty disk image: "+a.Oa)}catch(y){p("Disk image error ("+b+"): "+y.message)}}a.w&&(a.w.call(a.C,a.A,e,a.Oa,a.Xa),a.w=null)}function Xg(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.te=b;a.ue=c;a.Nb=a.Gb=0;a.La=!1;return a}function $g(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
function ah(a,b){var c=a.Da*a.xa,d=b/c|0;if(d<a.Ha){c=b%c;b=c/a.xa|0;var c=c%a.xa+1,e=null,f=a.A,g=a.b[d];if(g){a=g[b];if(!a&&f.Gc&&b<f.Da)for(a=g[b]=Array(f.Hc),g=0;g<a.length;g++)a[g]=Xg(null,d,b,g+1,f.uc,0);if(a){for(g=0;g<a.length;g++)if(a[g]&&a[g].sector==c){e=a[g];break}!e&&f.Gc&&9==f.hc&&(e=a[g]=Xg(null,d,b,f.hc,f.uc,0))}}return e}return null}
function bh(a,b){for(var c=1,d=0,e=0;c--;){var f;f=b++;var g=-1;if(a&&f<a.length)var g=a.data,h=f>>2,g=(h<g.length?g[h]:a.pattern)>>((f&3)<<3)&255;f=g;if(0>f)break;d|=f<<e;e+=8}return d}
Ug.prototype.save=function(){var a=0,b=[];b[a++]=[this.Xa,this.f,this.Ha,this.Da,this.xa,this.Ja];if(!this.g)for(var c=this.b,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Gb){for(var h=[],m=0,n=g.Nb,q=g.Nb+g.Gb;n<q;)h[m++]=g.data[n++];b[a++]=[d,e,f,g.Nb,h]}}return b};
Ug.prototype.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.b.length&&6<=e.length?Wg(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.f&&e[1]!=this.f&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.f+")",b=-2));for(this.b.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],h=g[f++],m=g[f++],n=g[f++];if(h>=this.b.length||m>=this.b[h].length||n>=this.b[h][m].length){c="sector (CHS="+h+":"+m+":"+n+") out of range ("+
b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(h=this.b[h][m][n]){for(m=h.data.length;m<e;)h.data[m++]=h.pattern;m=0;h.Nb=e;for(h.Gb=f.length;e<g;)h.data[e++]=f[m++];b++}}}0>b&&-2!=b&&this.controller.O("Unable to restore disk '"+this.Oa+": "+c);return b};
Ug.prototype.toJSON=function(){var a;a=0;for(var b;b=ah(this,a++);)ch(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function ch(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function sc(a){r.call(this,"RL11",a,sc,2097152);this.g=a.autoMount||null;this.A=0;this.f=Array(1);this.C=!Oa("Mobi")&&window&&"FileReader"in window}u(sc);k=sc.prototype;
k.qa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.F[b]=c,c.onchange=function(){var a=d.F.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){p("RL11 option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.F[b]=c,c.onchange=function(){var a=pa(c.value,10);null!=a&&dh(d,a)},!0;case "loadDrive":return this.F[b]=
c,c.onclick=function(){var a=d.F.listDisks;a&&eh(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.C){c.parentNode.removeChild(c);break}this.F[b]=c;c.onclick=function(){var a=d.F.listDrives;if(a&&a.options&&d.f)if(a=d.f[pa(a.value,10)||0])if(a=a.Hb){var b;b="";for(var c=0,h;h=ah(a,c++);)for(var m=0,n=h.length;m<n;m++)b+=String.fromCharCode(bh(h,m));b=btoa(b);a=a.Ac.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),"string"!=
typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");p(a)}else d.O("No disk loaded in drive.");else d.O("No disk drive selected.")};return!0;case "mountDrive":if(this.C)return this.F[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),
c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;eh(d,ra(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};k.wa=function(a,b,c,d){this.B=a;this.w=b;this.b=c;this.i=d;if((this.g=Uc(this.B,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(e){p("RL11 auto-mount error: "+e.message+" ("+this.g+")"),this.g=null}this.P=nc(112,5);hc(b,this,fh);gh(this,"None","",!0);this.C&&gh(this,"Local Disk","?");gh(this,"Remote Disk","??");hh(this)||G(this)};
k.za=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.B.lc){for(a=0;a<this.f.length;a++)ih(this,a,!0);hh(this,!0)}}else if(!this.restore(a))return!1;if(a=this.F.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;1>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";dh(this,0)}}return!0};k.ya=function(a){return a?this.save():!0};
k.reset=function(){for(var a=0;a<this.f.length;a++){var b=this.f[a];void 0===b&&(b=this.f[a]={});b.$b=a;b.Yb=b.Ib=!1;b.name=this.Za;b.Ha=512;b.Da=2;b.xa=40;b.Ja=256;b.Zb=!0;b.re=0;b.qe=0;b.pe=0;b.hc=1;b.Hc=b.xa;b.uc=b.Ja;b.ve=0;b.xe=null;b.Hb||(b.Xa="")}};k.save=function(){return(new O(this)).data()};k.restore=function(){return!0};
function hh(a,b){b||(a.A=0);if(a.g)for(var c in a.g){var d=a.g[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.F.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=ra(e,!0)}if(e&&f&&(g=c.charCodeAt(0)-65,0<=g&&g<a.f.length)){!jh(a,g,f,e,!0)&&b&&G(a,!1);continue}a.O("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.A}
function eh(a,b,c,d){var e=a.F.listDrives,e=e&&pa(e.value,10);if(void 0===e||0>e||e>=a.f.length)a.O("Unable to load the selected drive");else if(c)if("?"==c)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"')}jh(a,e,b,c,!1,d)}else ih(a,e)}
function jh(a,b,c,d,e,f){var g=-1,h=a.f[b];h.Xa.toLowerCase()!=d.toLowerCase()&&(g++,ih(a,b,!0),h.Yb?a.O("RL11 busy"):(h.Yb=!0,e&&(h.Xb=!0,a.A++,F(a)&&E(a,"auto-loading disk: "+c)),h.Ib=!!f,Yg(new Ug(a,h,"preload"),c,d,f,a.Jc)&&g++));return g}
k.Jc=function(a,b,c,d,e){var f;a.Yb=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.Ha||f[1]>a.Da)&&(this.O('Disk "'+c+'" too large for drive '+("RL"+a.$b)),b=null);b?(a.Hb=b,a.Oa=c,a.Xa=d,this.O('Mounted disk "'+c+'" in drive '+("RL"+a.$b),a.Xb||e),this.B&&this.B.gb()):a.Ib=!1;a.Xb&&(a.Xb=!1,--this.A||G(this));dh(this,a.$b)};
function gh(a,b,c,d){if((a=a.F.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function dh(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.F.listDisks;a=a.F.listDrives;if(d&&a&&d.options&&a.options&&(a=pa(a.value,10),c=c.Ib?"?":c.Xa,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function ih(a,b,c){var d=a.f[b];if(d.Hb||!1===c)d.Oa="",d.Xa="",d.Hb=null,d.Ib=!1,c||(a.O("Drive RL"+b+" unloaded",c),dh(a,b))}var fh={};
function kh(a){r.call(this,"Debugger",a,kh);this.Z=a.base||16;this.va=!1;this.J=0;this.P=!1;this.A=-1;this.g=[];this.S={}}u(kh);var lh={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};kh.prototype.oc=function(){return-1};kh.prototype.pc=function(){};
function mh(a,b,c,d){if(c)if(b){0>a.A&&a.g.length&&(a.A=0);if(0>a.A||b!=a.g[a.A])a.g.splice(0,0,b),a.A=0;a.A--}else a.P?b="end":b=a.g[a.A+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(xa(b.substring(c,f))),c=f+1}}return a}
function nh(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
function Vg(a,b,c){var d;if(b){b=Wg(a,b);for(var e=0,f=!1,g=b,h=[],m=[],p=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<p.length;){var q=p[e++],v=q.length,q=va(q);if(!q){f=!0;break}q=Xg(a,q,null,!1===c);if(void 0===q){f=!0;c=!1;break}h.push(q);if(e==p.length)break;var q=p[e++],w=q.length;m.length&&Sg[q]<Sg[m[m.length-1]]&&Ug(h,m,1);m.push(q);b=b.substr(v+w)}Ug(h,m)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&Yg(a,null,
d))}return d}function Wg(a,b){for(var c,d=a.va?"(":"{",e=a.va?")":"}",f=new RegExp(a.va?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=Vg(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
function Xg(a,b,c,d){var e;if(null!=b){e=a.Zb(b);if(0<=e)e=a.$b(e);else if(e=a.R[b],null==e){e=b;var f=a.Y,g;if(e){f||(f=10);var h=e.charAt(0),m=0<e.indexOf(",");m&&(e=e.replace(/,/g,""));"#"==h?(f=8,h=null):"$"==h&&(f=16,h=null);null==h?e=e.substr(1):("0"==h&&(h=e.charAt(1),"b"==h&&m&&(f=2,h=null),"o"==h?(f=8,h=null):"x"==h&&(f=16,h=null)),null==h?e=e.substr(2):(h=e.charAt(e.length-1).toLowerCase(),"y"==h?(f=2,h=null):"."==h?(f=10,h=null):"h"==h&&(f=16,h=null),null==h&&(e=e.substr(0,e.length-1))));
var p,h=e;((m=f)&&10!=m?16==m?h.match(/^[0-9a-f]+$/i):8==m?h.match(/^[0-7]+$/):2==m&&h.match(/^[01]+$/):h.match(/^[0-9]+$/))&&!isNaN(p=parseInt(e,f))&&(g=p|0)}e=g}null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)}else d||a.j("missing "+(c||"value"));return e}
function Yg(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var m=d&255,p=8,q="";p?32<p&&(p=32):p=32;if(null==m||isNaN(m))for(;0<p--;)q="?"+q;else for(;0<p--;)q=(m&1?"1":"0")+q,m>>=1;g=q+g;d>>=8}d=l(c,0,!0)+" "+c+". "+na(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function Zg(a,b){if(b)return Yg(a,b,a.R[b]);var c=0;for(b in a.R)Yg(a,b,a.R[b]),c++;return 0<c}
function J(a,b,c,d){switch(a.Y){case 8:a=na(b,3*c);break;case 10:a=b.toString();break;default:a=l(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
function $g(a){Rg.call(this,a);this.Ua=!1;this.va=!0;this.K=Z(0);this.Ta=Z(0);this.N=Z(0);this.H=[];this.f=this.L=this.C=[];ah(this);this.ma=0;bh(this);this.Ba={};ch(this,a.messages);this.Ca=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Tc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Tc(b,a)})}u($g,Rg);
var dh={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},eh=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
fh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
function oh(a,b,c){var d;if(b){b=ph(a,b);for(var e=0,f=!1,g=b,h=[],m=[],n=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<n.length;){var q=n[e++],w=q.length,q=xa(q);if(!q){f=!0;break}q=qh(a,q,null,!1===c);if(void 0===q){f=!0;c=!1;break}h.push(q);if(e==n.length)break;var q=n[e++],v=q.length;m.length&&lh[q]<lh[m[m.length-1]]&&nh(h,m,1);m.push(q);b=b.substr(w+v)}nh(h,m)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&rh(a,null,
d))}return d}function ph(a,b){for(var c,d=a.va?"(":"{",e=a.va?")":"}",f=new RegExp(a.va?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=oh(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
function qh(a,b,c,d){var e;null!=b?(e=a.oc(b),0<=e?e=a.pc(e):(e=a.S[b],null==e&&(e=pa(b,a.Z))),null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)):d||a.j("missing "+(c||"value"));return e}
function rh(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var m=d&255,n=8,q="";n?32<n&&(n=32):n=32;if(null==m||isNaN(m))for(;0<n--;)q="?"+q;else for(;0<n--;)q=(m&1?"1":"0")+q,m>>=1;g=q+g;d>>=8}d=l(c,0,!0)+" "+c+". "+qa(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function sh(a,b){if(b)return rh(a,b,a.S[b]);var c=0;for(b in a.S)rh(a,b,a.S[b]),c++;return 0<c}
function J(a,b,c,d){switch(a.Z){case 8:a=qa(b,3*c);break;case 10:a=b.toString();break;default:a=l(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
function th(a){kh.call(this,a);this.ab=!1;this.va=!0;this.K=Y(0);this.$a=Y(0);this.N=Y(0);this.I=[];this.f=this.L=this.C=[];uh(this);this.ma=0;vh(this);this.Ea={};wh(this,a.messages);this.Fa=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Xc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Xc(b,a)})}u(th,kh);
var xh={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},yh=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
zh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106,32768],35072:[107,32768]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,
63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},gh=[0],hh=
[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=$g.prototype;
k.Ea=function(a,b,c,d){this.w=b;this.b=c;this.B=a;(a=Qc(a,"messages"))&&ch(this,a);this.bb=fh;this.qb=1145>this.b.fb?hh:[];ih(this,function(a){a:{var b=d.w.V,c=a[0],e=a=0,m=b.length;if(c){a=d.$(jh(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.w.ia;m=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,p=0;m--;){var q=b[e];q.type==c?p++||d.j("..."):(c=q.type,p=bc[c],q&&d.j(l(q.id,8)+" %"+l(e<<d.w.ia,
8)+" %%"+l(q.D,8)+" "+l(q.yb,4,!0)+" "+l(q.size,4,!0)+" "+p),c!=Cc&&(c=-1),p=0);a+=d.w.ua;e++}}});H(this)};
k.qa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.la=this.I[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Tc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.A<d.g.length-1&&(b=d.g[++d.A])):40==a.keyCode&&(0<d.A?b=d.g[--d.A]:(b="",d.A=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.I[b]=c,Na(c,function(){if(d.la){var a=d.la.value;
d.la.value="";Tc(d,a,!0);return!0}return!1}),!0;case "step":return this.I[b]=c,Na(c,function(a){var b=!1;ob(d,!0)||(nb(d,!0),b=d.nb(a?1:0),nb(d,!1));return b}),!0}return!1};k.lb=function(a){if(this.la){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.la.focus();!a&&window&&window.scrollTo(b,c)}};k.$=function(a){a=a&&a.D;null==a&&(a=-1);return a};k.tb=function(a,b){var c=255,d=this.$(a,!1,1);-1!==d&&(c=a.Ab?this.w.Db(d):this.b.Db(d),b&&kh(a,b));return c};
k.oa=function(a,b){var c=65535,d=this.$(a,!1,2);-1!==d&&(c=a.Ab?this.w.eb(d):this.b.eb(d),b&&kh(a,b));return c};k.Gb=function(a,b,c){var d=this.$(a,!0,1);-1!==d&&(a.Ab?this.w.Ya(d,b):this.b.Ya(d,b),c&&kh(a,c),this.B.ca(!0))};k.Za=function(a,b,c){var d=this.$(a,!0,2);-1!==d&&(a.Ab?this.w.Hb(d,b):this.b.Hb(d,b),c&&kh(a,c),this.B.ca(!0))};function Z(a,b){return{D:a,Ab:b,Da:!1}}function lh(a){return[a.D,a.Da]}function mh(a){return{D:a[0],Da:a[1]}}
function jh(a,b,c){var d,e=(c?a.K:a.Ta).D;c=!1;if(void 0!==b){b=Wg(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.H.length;e++){var g=a.H[e].fa[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Z(d));break}}if(d=f)return d;e=Vg(a,b,void 0)}null!=e&&(d=Z(e,c));return d}function nh(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.mc=Tg(a,b.ic=c[2]))}function kh(a,b){null!=a.D&&(a.D+=b||1)}
function ch(a,b){a.i=a;a.na=a.oc=536870912;a.aa=null;a.ra=[];b=Tg(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in tb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.na|=tb[c],a.j(c+" messages enabled"))}}function ih(a,b){for(var c in tb)if(64==tb[c]){a.Ba[c]=b;break}}
k.Zb=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function oh(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.$b=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ha[a-8]:20>a?b=this.b.wa[a-16]:20==a&&(b=Lb(this.b)));return b};
k.message=function(a,b){b&&(a+=" @"+J(this,Z(this.b.xb).D));this.na&1073741824?this.ra.push(a):this.aa&&a==this.aa||(this.aa=a,this.na&-2147483648&&(this.ga(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,Zc(a),a.ra=0,a.B.ca()))};function bh(a){var b;if(!Yd(a))a.F&&a.F.length&&a.j("instruction history buffer freed"),a.X=0,a.F=[];else if(!a.F||!a.F.length){a.F=Array(1E3);for(b=0;b<a.F.length;b++)a.F[b]=Z();a.X=0;a.j("instruction history buffer allocated")}}
k.mb=function(a,b){if(!ph(this,b))return!1;this.b.mb(a);return!0};k.nb=function(a,b,c){if(!ph(this))return!1;this.J=0;a||Yd(this)&&Zd(this,this.b.u[7],0);try{a=$c(this.b,a);var d=this.b.nb(a);0<d&&(ad(this.b,a),this.J+=d,Xc(this.b,d,!0),Uc(this.b,d),this.sa++)}catch(e){"number"!=typeof e&&(this.J=0,rb(this.b,e.stack||e.message))}!1!==c&&this.B.ca();this.ca(b||!1);return 0<this.J};k.ga=function(a){this.b&&this.b.ga(a)};
k.ca=function(a){if(this.Ua){void 0===a&&(a=!0);var b;b=this.b;if(b=b.G&8?b.wc|b.vc<<8:0){var c=b>>8;this.j("trapped to "+J(this,b&255,1)+(c?" ("+J(this,c)+")":""))}this.K=Z(this.b.u[7]);a&&1!=this.P?qh(this):rh(this)}};function ph(a,b){var c;(c=!a.b||!pb(a.b))||(c=a.b,c.v.ka?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.v.ea?(b||a.j("cpu busy or unavailable, command ignored"),!1):!qb(a.b)}k.Aa=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
k.za=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){bh(this);this.sa=0;this.aa=null;this.J=0;this.K=Z(this.b.u[7]);this.v.ea=!1;sh(this);a||this.ca()};k.save=function(){var a=new O(this);a.set(0,lh(this.K));a.set(1,lh(this.N));a.set(2,[this.g,this.O,this.na]);a.set(3,this.H);return a.data()};
k.restore=function(a){var b=0;void 0!==a[2]&&(this.K=mh(a[b++]),this.N=mh(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.O=a[b][1],this.na|=a[b][2]);a[3]&&(this.H=a[3]);return!0};k.start=function(a,b){this.P||this.j("running");this.v.ea=!0;this.rb=a;this.sb=b};
k.stop=function(a,b){if(this.v.ea){this.v.ea=!1;this.J=b-this.sb;if(!this.P){b="stopped";if(this.J){a-=this.rb;var c=0<a?Math.round(1E3*this.J/a):0;b+=" (";Yd(this)&&(b+=this.sa+" instructions, ",this.sa=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}this.ca(!0);this.lb();sh(this,this.b.u[7]);this.aa=null}};function Yd(a){return 1<a.f.length||!!a.ma}
function Zd(a,b,c){var d=-1;c||(d=a.b.eb(b),0==d&&(b=ld(a.b,2)));if(0<c&&(a.ma&&!--a.ma||Lc(a,b,1,a.f)))return!0;0<=c&&a.F.length&&(a.sa++,0>d&&(d=a.b.eb(b)),65535!=(d&65535)&&(c=a.F[a.X],c.D=b,c.Da=!1,++a.X==a.F.length&&(a.X=0)));return!1}function $b(a){var b=a.b;if(b.v.ea)throw N(b,a.b.xb),a.ga(),-1;return!1}
function ah(a){var b,c;a.f=["bp"];if(a.L)for(b=1;b<a.L.length;b++){c=a.L[b];var d=a.w;c=a.$(c);Mc(d.V[c>>>d.ia],!1)}a.L=["br"];if(a.C)for(b=1;b<a.C.length;b++)c=a.C[b],d=a.w,c=a.$(c),Mc(d.V[c>>>d.ia],!0);a.C=["bw"];a.Ra=0}k.Wa=function(a,b,c){var d=!0;c||th(this,a,b,!1,!0);if(a!=this.f){var e=this.$(b);if(-1===e)this.j("invalid address: "+J(this,b.D)),d=!1;else{var f=this.w;f.V[e>>>f.ia].Wa(e&f.w,a==this.C)}}d&&(a.push(b),c?b.Da=!0:(uh(this,a,a.length-1,"set"),bh(this)));return d};
function th(a,b,c,d,e){var f=!1;c=a.$(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.$(h)&&(!d||h.Da)){f=!0;h.Da||e||uh(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.w,Mc(d.V[c>>>d.ia],b==a.C));h.Da||bh(a);break}}return f}function vh(a,b){for(var c=1;c<b.length;c++)uh(a,b,c);return b.length-1}function uh(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.D)+(d?" "+d:c.ic?' "'+c.ic+'"':""))}
function sh(a,b){if(void 0!==b)Lc(a,b,1,a.f,!0),a.P=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Da){if(!th(a,a.f,c,!0))break;b=0}}}
function Lc(a,b,c,d,e){var f=!1;if(!a.Ra++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Da)for(var m=a.$(h),p=0;p<c;p++)if(b+p==m){var q,f=!0;h.Da&&(th(a,d,h,!0),e=!0);if(q=h.mc){for(var f=!1,v=0;v<q.length;v++)if(!wh(a,q[v],!0)){if(q[v].indexOf("if")){f=!0;break}for(var w=v+1;w<q.length&&q[w].indexOf("else");w++)v++;if(w==q.length){f=!0;break}}a.b.v.ea||(f=!0)}if(f){e||uh(a,d,g,"hit");break}}}a.Ra--;return f}
function xh(a,b,c,d){var e=Z(b.D),f=a.oa(b,2),g,h;for(h in a.bb)if(g=a.bb[h][f&h])break;g||(g=gh);var m=g[0];0<=a.qb.indexOf(m)&&(g=gh,m=g[0]);var p=h="",q=eh[m],v=g.length-1;m||v||(h=J(a,f));for(m=1;m<=v;m++){var w=g[m];if(void 0!==w){var x;x=a;var E=w,w=b,y="",A=E&61440;if(4096==A)w=w.D+((f&255)<<24>>23)&65535,y=J(x,w);else if(8192==A)w=w.D-((f&63)<<1)&65535,y=J(x,w);else if(12288==A)y=J(x,f&7,1);else if(24576==A)y=J(x,f&63,1);else if(32768==A)y=J(x,f&255,1);else if(A=f&E,E&4032&&(A>>=6,E>>=6),
E&63)switch(E=A&7,A&56){case 0:y=oh(E);break;case 8:y="@"+oh(E);break;case 16:7>E?y="("+oh(E)+")+":(A=x.oa(w,2),y="#"+J(x,A,0,!0));break;case 24:7>E?y="@("+oh(E)+")+":(A=x.oa(w,2),y="@#"+J(x,A,0,!0));break;case 32:y="-("+oh(E)+")";break;case 40:y="@-("+oh(E)+")";break;case 48:A=x.oa(w,2);y=J(x,A,0,!0)+"("+oh(E)+")";7==E&&(y=J(x,A+w.D&65535));break;case 56:A=x.oa(w,2),y="@"+J(x,A)+"("+oh(E)+")",7==E&&(y="@"+J(x,A+w.D&65535))}x=y;if(!x||!x.length){h="INVALID";break}"string"!=typeof x&&(p=x[1],x=x[0]);
0<h.length&&(h+=",");h+=x||"???"}}f="";g=J(a,e.D)+":";if(-1!==e.D&&-1!==b.D){do if(f+=" "+J(a,a.oa(e,2)),null==e.D)break;while(e.D!=b.D)}g+=ua(f,24);g+=ua(q,5);h&&(g+=" "+h);if(c||p)g=ua(g,60)+";"+(c||""),g=a.b.v.cb?g+("cycles="+Vc(a.b).toString()+" cs="+l(a.b.ub)):g+(null!=d?"="+d.toString():""),p&&(g+=" @"+p);return g}function yh(a,b){switch(b){case "N":a=a.b.Ga();break;case "Z":a=jd(a.b);break;case "V":a=id(a.b);break;case "C":a=hd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function zh(a,b){var c="",d=a.b;8>b?(c=oh(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Ha[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.wa[b-16]):20==b&&(c="PS="+J(a,Lb(d)));c&&(c+=" ");return c}function Ah(a){var b,c="";for(b=0;6>b;b++)c+=zh(a,b);c=c+"\n"+(zh(a,6)+zh(a,7)+zh(a,20));return c+=yh(a,"T")+yh(a,"N")+yh(a,"Z")+yh(a,"V")+yh(a,"C")}k.Ub=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function ug(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var m=h.o,p=h.a;if(void 0!==m){var q=f,m=[m>>>0,g],v=xa(q,m,a.Ub);0>v&&q.splice(-(v+1),0,m)}p&&(h.a=p.replace(/''/g,'"'))}a.H.push({Wd:b,D:c,uc:d,fa:e,Tb:f})}function Bh(a,b,c){var d=[],e=a.$(b)>>>0;for(b=0;b<a.H.length;b++){var f=a.H[b],g=f.D>>>0,h=f.uc;if(e>=g&&e<g+h){e=xa(f.Tb,[e-g],a.Ub);0<=e?Ch(a,b,e,d):c&&(e=~e,Ch(a,b,e-1,d),Ch(a,b,e,d));break}}return d}
function Ch(a,b,c,d){var e={},f=a.H[b].Tb,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.H[b].fa[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function Dh(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Zg(a)||a.j("no variables"),!0;if(!c[2])return Zg(a,c[1]);if(!c[3])return delete a.R[c[1]],!0;b=Vg(a,c[3]);return void 0!==b?(a.R[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
function Eh(a,b,c){var d=null;if(b=jh(a,b,!0)){a.$(b);var e=Bh(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.D-e[1])&&(g=" + "+l(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.j(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.D)&&(g=" - "+l(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
function qh(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}f=Vg(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":N(d,f);a.K=Z(d.u[7]);break;case "N":d.W=f?32768:0;break;case "Z":d.Z=
f?0:1;break;case "V":d.T=f?32768:0;break;case "C":d.S=f?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=f&65535;break}a.j("unknown register: "+e);return}a.B.ca();a.j("updated registers:")}a.j(Ah(a));c&&(a.K=Z(d.u[7]),rh(a,J(a,a.K.D)))}}function Fh(a,b){b=va(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):Yg(a,null,c[2].charCodeAt(0)):Vg(a,b,!0)}
function Gh(a,b,c){var d="t"!=b;c=Xg(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ma(c,function(){return nb(a,!0)&&a.nb(e,d,!1)},function(){a.B.ca();nb(a,!1)})}
function rh(a,b,c,d){if(b=jh(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=Xg(a,c.substr(1)),null!=c&&(d=c);else{d=jh(a,c,!0);if(!d||d.D<b.D)return;e=d.D-b.D;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=ob(a,!1)||a.P?a.J:null;var g=null!=f?"cycles":null,h=Bh(a,b),m=b.D;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var p=h[0]+":";h[2]&&(p+=" "+h[2]);a.j(p)}h[3]&&(g=h[3],f=null);f=xh(a,b,g,f);a.j(f);a.K=b;e-=b.D-m;c++}}}
function wh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.O&&(a.j("ended assemble at "+J(a,a.N.D)),a.K=a.N,a.O=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.aa=null;if(pb(a)&&0<b.length){a.O&&(b="a "+J(a,a.N.D)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],m=h.charAt(0),p=1;p<h.length;p++){var q=h.charAt(p);if("?"==m||"r"==m||"a">q||"z"<q){g[0]=h.substr(p);g.unshift(h.substr(0,p));break}}switch(g[0].charAt(0)){case "a":var v=
jh(a,g[1],!0);if(v)if(a.N=v,void 0===g[2])a.j("begin assemble at "+J(a,v.D)),a.O=!0,a.B.ca();else{var w;a.j("not supported yet");w=[];if(w.length){for(var x=0;x<w.length;x++)a.Gb(v,w[x],1);a.j(xh(a,a.N))}}break;case "b":a:{var E=g[0],y=g[1],A=b;if("?"==y)a.j("breakpoint commands:"),a.j("\tbp [a]\tset exec breakpoint at addr [a]"),a.j("\tbr [a]\tset read breakpoint at addr [a]"),a.j("\tbw [a]\tset write breakpoint at addr [a]"),a.j("\tbc [a]\tclear breakpoint at addr [a]"),a.j("\tbl\tlist all breakpoints"),
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var Ha=E.charAt(1);if("l"==Ha){var nd;nd=0+vh(a,a.f);nd+=vh(a,a.L);(nd+=vh(a,a.C))||a.j("no breakpoints")}else if("n"==Ha)a.ma=Xg(a,y),a.j("break after "+a.ma+" instruction(s)");else if(void 0===y)a.j("missing breakpoint address");else{var V=Z();if("*"!=y&&(V=jh(a,y,!0),!V))break a;"c"==Ha?null==V.D?(ah(a),a.j("all breakpoints cleared")):th(a,a.f,V)||th(a,a.L,V)||th(a,a.C,V)||a.j("breakpoint missing: "+J(a,V.D)):null!=V.D&&(nh(a,V,A),"p"==Ha?a.Wa(a.f,
V):"r"==Ha?a.Wa(a.L,V):"w"==Ha?a.Wa(a.C,V):a.j("unknown breakpoint command: "+Ha))}}}break;case "c":a.Fa&&(a.Fa.value="");break;case "d":a:{var Ya,Za=g[0],ja=g[1],Ia=g[2],Zh=g[3];if("?"==ja){var $a="";for(Ya in tb)a.Ba[Ya]&&($a&&($a+=","),$a+=Ya);$a+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
$a.length&&a.j("dump extension commands:\n\t"+$a)}else if("state"==ja){var Tf=Hh(a.B,!0);"console"==Ia?console.log(Tf):(a.Fa&&(a.Fa.value=""),a.j(Tf))}else if("symbols"==ja)for(var od=0;od<a.H.length;od++){var pd=a.H[od],ab;for(ab in pd.fa)if("."!=ab.charAt(0)){var Uf=pd.fa[ab].o;if(void 0!==Uf){var Vf=pd.fa[ab].l;Vf&&(ab=Vf);a.j(J(a,Uf)+" "+ab)}}}else{if("d"==Za){for(Ya in tb)if(g[1]==Ya){var Wf=a.Ba[Ya];Wf?(g.shift(),g.shift(),Wf(g)):a.j("no dump registered for "+ja);break a}ja||(Za=a.Bb||"db")}else a.Bb=
Za;if("dh"==Za){var Xf=ja,Yf=Ia,Zf="",$f=0,ca=a.X,ka=a.F;if(ka.length){var Y=+Xf||a.Va,yb=+Yf||10;isNaN(Y)?Y=yb:Zf="more ";Y>ka.length&&(a.j("note: only "+ka.length+" available"),Y=ka.length);ca-=Y;0>ca&&(null==ka[ka.length-1].D?(Y=ca+Y,ca=0):ca+=ka.length);var qd=[];"call"==Yf&&(yb=1E5,qd=["CALL"]);for(void 0!==Xf&&a.j(Y+" instructions earlier:");0<yb&&ca!=a.X;){var ag=ka[ca++];if(null==ag.D)break;var zb=Z(ag.D),$h=Y--,bg=xh(a,zb,"history",$h);(!qd.length||0<=bg.indexOf(qd[0]))&&a.j(bg);zb.Mb&&(ca+=
zb.Mb,yb-=zb.Mb,Y-=zb.Mb);ca>=ka.length&&(ca=0);a.Va=Y;$f++;yb--}}$f||(a.j("no "+Zf+"history available"),a.Va=void 0)}else{var Ab=jh(a,ja);if(Ab){var mc=0;Ia&&("l"==Ia.charAt(0)&&(Ia=Ia.substr(1)||Zh),mc=Xg(a,Ia)>>>0,65536<mc&&(mc=65536));for(var Bb="",bb="dd"==Za?4:"dw"==Za?2:1,nc=bb*mc||128,ai=nc+15>>4||1;ai--&&0<nc;){var oc=0,Cb=0,Db,rd="",cg="",ja=J(a,Ab.D);for(Db=4==bb?16:a.Y;0<Db&&0<nc;Db--){var pc=1,qc=1==bb?a.tb(Ab,pc):a.oa(Ab,pc=2),oc=oc|qc<<(Cb<<3),Cb=Cb+pc;Cb==bb&&(rd+=J(a,oc,bb),rd+=1==
bb?9==Db?"-":" ":" ",oc=Cb=0);cg+=32<=qc&&128>qc?String.fromCharCode(qc):".";nc-=pc}Bb&&(Bb+="\n");Bb+=ja+" "+rd+(0==Db?" "+cg:"")}Bb&&a.j(Bb);a.Ta=Ab}}}}break;case "e":if("else"==g[0])break;var cb,sd,td,ud,vd=g[0],wd=g[1];"eb"==vd?(cb=1,sd=255,td=a.tb,ud=a.Gb):"e"==vd||"ew"==vd?(cb=2,sd=65535,td=a.oa,ud=a.Za):wd=null;if(null==wd)a.j("edit memory commands:"),a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var rc=jh(a,wd);if(rc)for(var sc=2;sc<g.length;sc++){var Eb=
Vg(a,g[sc]);if(void 0===Eb){a.j("unrecognized value: "+g[sc]);break}Eb&~sd&&a.j("warning: "+l(Eb)+" exceeds "+cb+"-byte value");var bi=td.call(a,rc);a.j("changing "+J(a,rc.D)+" from "+J(a,bi,cb)+" to "+J(a,Eb,cb));ud.call(a,rc,Eb,cb)}}break;case "g":a:{var dg=g[1],ci=b;if(void 0!==dg){var xd=jh(a,dg,!0);if(!xd)break a;nh(a,xd,ci);a.Wa(a.f,xd,!0)}a.mb(!0,c)}break;case "h":a.v.ea?(c||a.j("halting"),a.ga()):ob(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var yd;var Fb=b.substr(2),Fb=
va(Fb);Vg(a,Fb)?(c||a.j("true: "+Fb),yd=!0):(c||a.j("false: "+Fb),yd=!1);yd||(d=!1);break}f=!0;break;case "k":var di=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var zd=0,Ad=Z(),Gb=Z(a.b.u[6]);for(a.j("stack trace for "+J(a,Gb.D));10>zd;){for(var Ja=null,ei=256;65536>Gb.D>>>0;){Ad.D=a.oa(Gb,2);if(null==Gb.D||!ei--)break;if(!(Ad.D&1)){for(var fi=a,tc=Ad,eg=null,Hb=tc.D,fg=Hb,Bd=1;6>=Bd&&Hb;Bd++){if(2<Bd){tc.D=Hb;var uc=xh(fi,
tc);if(0<=uc.indexOf("JSR")){var gg=uc.indexOf(" ");if(Hb+(uc.indexOf(" ",gg+1)-gg-1)/2==fg){eg=uc;break}}}Hb-=2}tc.D=fg;if(Ja=eg)break}}if(!Ja||null==Ja)break;var hg=null;if("ks"==di){var ig=Ja.match(/[0-9A-F]+$/);ig&&(hg=Eh(a,ig[0]))}Ja=ua(Ja,50)+" ;"+(hg||"stack="+J(a,Gb.D));a.j(Ja);zd++}zd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){Eh(a,g[1],!0);break}f=!0;break;case "m":a:{var la,ma=null,G=g[1];"?"==G&&(G=void 0);if(void 0!==G){var ya=0;if("all"==G)ya=1878917119,G=null;
else if("on"==G)ma=!0,G=null;else if("off"==G)ma=!1,G=null;else{"keys"==G&&(G="key");"kbd"==G&&(G="keyboard");for(la in tb)if(G==la){ya=tb[la];ma=!!(a.na&ya);break}if(!ya){a.j("unknown message category: "+G);break a}}if(ya)if("on"==g[2])a.na|=ya,ma=!0;else if("off"==g[2]&&(a.na&=~ya,ma=!1,1073741824==ya)){for(var Cd=0;Cd<a.ra.length;Cd++)a.j(a.ra[Cd]);a.ra=[]}}var gi=0,Ib="";for(la in tb)if(!G||G==la){var hi=!!(a.na&tb[la]);if(null===ma||ma==hi)Ib&&(Ib+=","),++gi%10||(Ib+="\n\t"),"key"==la&&(la="keys"),
Ib+=la}void 0===G&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==ma?ma?"messages on: ":"messages off: ":"message categories:\n\t")+(Ib||"none"));bh(a)}break;case "p":if("print"==g[0]){Fh(a,b.substr(5));break}var ii="pr"==g[0]?1:0;if(a.P)a.j("step in progress");else{var jg=Z(a.b.u[7]);a.tb(jg);a.P?(a.Wa(a.f,jg,!0),a.mb()||(a.B&&a.B.lb(),a.P=0)):Gh(a,ii?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}qh(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Jb=
+g[2];if(8==Jb||10==Jb||16==Jb)a.Y=Jb;else{a.j("invalid base: "+Jb);break}}a.j("default base: "+a.Y);break;case "cs":var Kb;void 0!==g[3]&&(Kb=+g[3]);switch(g[2]){case "int":a.b.gb=Kb;break;case "start":a.b.vb=Kb;break;case "stop":a.b.hb=Kb;break;default:a.j("unknown cs option");break a}void 0!==Kb&&Sc(a.b);a.j("checksums "+(a.b.v.cb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Wc(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.Xa.toFixed(2)+
"Mhz")+" ("+a.b.Na+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":Gh(a,g[0],g[1]);break;case "u":rh(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Dh(a,b.substr(3))||(d=!1);break}if("ver"==
g[0]){a.j("PDPjs version 1.30.2 ("+a.b.fb+",RELEASE"+(sb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){Fh(a,b.substr(1));break}var Dd="commands:",Ed;for(Ed in dh)Dd+="\n"+ua(Ed,9)+dh[Ed];Yd(a)||(Dd+="\nnote: history disabled if no exec breakpoints");a.j(Dd);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(kg){a.j("debugger error: "+(kg.stack||kg.message)),d=!1}return d}
function Tc(a,b,c){b=Tg(a,b,c);for(var d in b)if(!wh(a,b[+d]))return!1;return!0}Ta(function(){for(var a=C(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new $g(d);B(d,c)}});
function Ih(a,b,c){r.call(this,"Computer",a,Ih,67108864);this.v.ka=!1;Jh(this,b);this.L=Qc(this,"autoPower",a);this.B=0;this.X=a.busWidth||a.buswidth;this.f=Kh;this.J=null;this.F=this.P=!1;this.Y=Qc(this,"url")||"";(Math.random()+.1).toString(36);this.g=Lh(this);if(this.b=mb("CPU",this.id)){this.i=mb("Debugger",this.id);this.w=new Mb({id:this.Sa+".bus",busWidth:this.X},this.b,this.i);var d,e=kb(this.id);if((this.A=mb("Panel",this.id))&&this.A.Fa)for(b=0;b<e.length;b++)d=e[b],d.ja=this.A.ja,d.j=this.A.j,
d.Fa=this.A.Fa;this.j("PDPjs v1.30.2\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ea&&d.Ea(this,this.w,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=Qc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.F=!0,this.f=Kh),this.f&&(this.K=
new O(this,"1.30.2"),Mh(this.K)?b=null:delete this.K);!b&&this.f&&(b=Nh(this))&&(this.F=!0);if(b){var g=this;Ba(b,null,!0,function(a,b,c){c?(g.H=null,g.F=!1,g.ja("Unable to load machine state from server (error "+c+(b?": "+va(b):"")+")")):(g.J=b,g.P=!0);H(g)})}else H(this);this.I.power||(this.L=!0);!c&&this.L&&Oh(this,this.wb)}else n("Unable to find CPU component")}u(Ih);var Kh=0;
function Jh(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){n(d.message+" ("+c+")")}}a.R=b}function Qc(a,b,c){var d=b.toLowerCase(),d=db[b]||db[d];void 0===d&&a.R&&(d=a.R[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Oh(a,b,c){for(var d=kb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!pb(f)){pb(f,function(){Oh(a,b,c)});return}}b.call(a,c)}
function Ph(a,b){var c=new O(a,"1.30.2","validate");if(Mh(c)&&Qh(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.ja("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=Ih.prototype;
k.wb=function(a){void 0===a&&(a=this.f||(this.J?1:Kh));if(!this.B){this.B++;var b=!1,c=!1;this.O=!1;var d=this.K||new O(this,"1.30.2");if(-1==a)b=!0;else if(a>Kh){if(Mh(d,this.J)){this.C=new O(this,"1.30.2","failsafe");Mh(this.C)&&(Rh(this,d),a=2,Sh(this.C));this.C.set("timestamp",Aa());Th(this.C);var e=this.f&&!this.F;if(1==a||Da("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Qh(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Mh(d,g):("error"==
f&&"no machine state"!=g?(this.ja("Error: "+g),"unable to verify user"==g&&(Ka("user",""),this.g=null)):this.j(f+": "+g),Sh(d),Mh(d)?(c=Qh(d),e=!0):c=!1))}e&&Ph(this,c?d:null)}else 2==a&&d.clear()}else Ph(this);delete this.J;delete this.K}e=kb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Uh(this,g,d,b,c));b=[d,a,c];-1!=a?Oh(this,this.Wb,b):this.Wb(b)}};
function Uh(a,b,c,d,e){if(!b.v.ka){b.v.ka=!0;if(b.Aa){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Aa(f,d)&&f&&(n("Unable to restore state for "+b.type),a.N&&!a.P?(c.clear(),a.f=Kh,window&&window.location.reload()):a.O=!0,b.Aa(null),e=!1)}if(!d&&b.Xb)for(a=b.Xb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
k.Wb=function(a){var b=a[0],c=0>a[1];a=a[2];this.aa=!0;this.v.ka=!0;var d=this.I.power;d&&(d.textContent="Shutdown");this.b&&(Uh(this,this.b,b,c,a),this.b.ab());this.O&&(Rh(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.B=0};
function Rh(a,b){if(Da("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.2"};d.url=a.Y;d.user=c;d.type="bug";d.data=b;Ba("http://www.pcjs.org/api/v1/report",d,!0)}}
function Hh(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new O(a,"1.30.2"),g=new O(a,"1.30.2","validate"),h=Aa();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.2");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.za&&(c&&a.b.ga(),d=a.b.za(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.ka=!1,!1===d&&(e=null)));for(var h=kb(a.id),m=0;m<h.length;m++){var p=h[m];p.v.ka&&(p.za&&(d=p.za(b,c),"object"===typeof d&&f.set(p.id,
d)),c&&(p.v.ka=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&Vh(a,a.g,f.toString()),Th(g)&&Th(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.v.ka=!1,b=a.I.power)&&(b.textContent="Power");a.B=0;return e}k.reset=function(){this.w&&this.w.reset&&(D(this,"Resetting "+this.w.type),this.w.reset());for(var a=kb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.w&&c.reset&&(D(this,"Resetting "+c.type),c.reset())}};
k.start=function(a,b){for(var c=kb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.ca(!0)};k.stop=function(a,b){for(var c=kb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.ca(!0)};
k.qa=function(a,b,c){var d=this;switch(b){case "power":return this.I[b]=c,c.onclick=function(){d.B||(d.v.ka?Hh(d,!1,!0):Oh(d,d.wb))},!0;case "reset":return this.I[b]=c,c.onclick=function(){if(d.v.ka&&!d.B)if(d.f&&!d.H){var a=Da("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Hh(d,a,!0);!a&&d.N?window&&window.location.reload():d.wb(Kh)}else d.reset(),d.b&&d.b.ab()},!0;case "save":if(qa())c.parentNode.removeChild(c);else return this.I[b]=
c,c.onclick=function(){var a=Lh(d,!0);if(a){var b=!!(d.f&&!d.H||d.N),c=Hh(d,b);b?Vh(d,a,c):d.ja("Resume disabled, machine state not saved")}},!0}return!1};
function Lh(a,b){var c=a.g;c||((c=Ga("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Wh(a,c))||a.ja("The user ID is invalid.")):b&&a.ja("Browser local storage is not available"));return c}
function Wh(a,b){a.g=null;b=Ba(ra()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ka("user",b.data),a.g=b.data)}catch(d){n(d.message+" ("+c+")")}return a.g}function Nh(a){var b=null;a.g&&(b=ra()+"/api/v1/user?req=load&user="+a.g+"&state="+Xh(a,"1.30.2"));return b}
function Vh(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Xh(a,"1.30.2");d.data=c;b=Ba(ra()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.ja("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.ja(c),Ka("user",""),a.g=null)}}
function Gg(a){var b;a=kb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.lb=function(a){if(this.Fa){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Fa.focus();!a&&window&&window.scrollTo(b,c)}};k.ca=function(a){this.b&&this.b.ca(a);this.A&&this.A.ca(a)};
Ta(function(){for(var a=C(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=C(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=z(f),g=new Ih(g,d,!0);B(g,f);g.L&&Oh(g,g.wb)}});Oa.show.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=mb("Computer",c.id))&&c.aa&&!c.v.ka&&c.wb(-1)}});
Oa.exit.push(function(){for(var a=C(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=mb("Computer",c.id))&&c.v.ka&&Hh(c,!(!c.f||c.H),!0)}});function O(a,b,c){this.id=a.id;this.key=Xh(a,b,c);this.i=a.i;Sh(this,a.tc)}function Xh(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
O.prototype={constructor:O,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Sh(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function Sh(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Th(a){var b=!0;if(Fa()){var c=JSON.stringify(a[a.id]);Ka(a.key,c)||(n("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Qh(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){n(c.message||c),b=!1}return b}function Mh(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Fa()&&(b=Ga(a.key))?(a[a.id]=b,a.b=!0):!1}var Yh=0;
function ji(a,b,c,d,e,f){e("Loading "+a+"...");Ba(a,null,!0,function(g,h,m){m?(h||(h="unable to load "+a+" ("+m+")"),f(h,null)):ki(h,a,b,c,d,e,f)})}
function ki(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(jb(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){f=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?li(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
function li(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Ba(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=h[0],p,q=/( [a-z]+=)(['"])(.*?)\2/g;p=q.exec(f);)m=0>m.indexOf(p[1])?m.replace(">",p[0]+">"):m.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);h[0]!=m&&(g=g.replace(h[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);li(a,b,c)}})}else c(a,null)}
function mi(a,b,c,d){function e(a){if(void 0===h){var b=g&&C(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ta(a))}function f(a){e("Error: "+a);m&&(--Yh||Va(!0));m=!1}var g,h,m=!0;Yh++;ib[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=p:v.appendChild(document.createTextNode(p));q.appendChild(v)}c||
(c="/versions/pdpjs/1.30.2/components.xsl");p=function(d,h){h?ji(c,null,null,!1,e,function(d,m){m?(jb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=h.transformNode(m))?(g.outerHTML=m,--Yh||Va(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Yh||Va(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?ji(b,a,d,!0,e,p):ki(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(w){f(w.message)}return m}window.embedPDP11=function(a,b,c,d){Va(!1);return mi(a,b,c,d)};window.enableEvents=Va;window.sendEvent=Wa;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11-dbg.map
63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},Ah=[0],Bh=
[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=th.prototype;
k.wa=function(a,b,c,d){this.w=b;this.b=c;this.B=a;(a=Uc(a,"messages"))&&wh(this,a);this.jb=zh;this.wb=1145>this.b.mb?Bh:[];Ch(this,function(a){a:{var b=d.w.W,c=a[0],e=a=0,m=b.length;if(c){a=d.aa(Dh(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.w.ka;m=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,n=0;m--;){var q=b[e];q.type==c?n++||d.j("..."):(c=q.type,n=ec[c],q&&d.j(l(q.id,8)+" %"+l(e<<d.w.ka,
8)+" %%"+l(q.D,8)+" "+l(q.Eb,4,!0)+" "+l(q.size,4,!0)+" "+n),c!=Gc&&(c=-1),n=0);a+=d.w.ua;e++}}});G(this)};
k.qa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.la=this.F[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Xc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.A<d.g.length-1&&(b=d.g[++d.A])):40==a.keyCode&&(0<d.A?b=d.g[--d.A]:(b="",d.A=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.F[b]=c,Qa(c,function(){if(d.la){var a=d.la.value;
d.la.value="";Xc(d,a,!0);return!0}return!1}),!0;case "step":return this.F[b]=c,Qa(c,function(a){var b=!1;rb(d,!0)||(qb(d,!0),b=d.tb(a?1:0),qb(d,!1));return b}),!0}return!1};k.gb=function(a){if(this.la){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.la.focus();!a&&window&&window.scrollTo(b,c)}};k.aa=function(a){a=a&&a.D;null==a&&(a=-1);return a};k.zb=function(a,b){var c=255,d=this.aa(a,!1,1);-1!==d&&(c=a.Jb?this.w.Mb(d):this.b.Mb(d),b&&Eh(a,b));return c};
k.oa=function(a,b){var c=65535,d=this.aa(a,!1,2);-1!==d&&(c=a.Jb?this.w.lb(d):this.b.lb(d),b&&Eh(a,b));return c};k.Qb=function(a,b,c){var d=this.aa(a,!0,1);-1!==d&&(a.Jb?this.w.fb(d,b):this.b.fb(d,b),c&&Eh(a,c),this.B.da(!0))};k.hb=function(a,b,c){var d=this.aa(a,!0,2);-1!==d&&(a.Jb?this.w.Rb(d,b):this.b.Rb(d,b),c&&Eh(a,c),this.B.da(!0))};function Y(a,b){return{D:a,Jb:b,Ga:!1}}function Fh(a){return[a.D,a.Ga]}function Gh(a){return{D:a[0],Ga:a[1]}}
function Dh(a,b,c){var d,e=(c?a.K:a.$a).D;c=!1;if(void 0!==b){b=ph(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.I.length;e++){var g=a.I[e].ga[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Y(d));break}}if(d=f)return d;e=oh(a,b,void 0)}null!=e&&(d=Y(e,c));return d}function Hh(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Ec=mh(a,b.zc=c[2]))}function Eh(a,b){null!=a.D&&(a.D+=b||1)}
function wh(a,b){a.i=a;a.na=a.Ic=536870912;a.ba=null;a.ra=[];b=mh(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in wb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.na|=wb[c],a.j(c+" messages enabled"))}}function Ch(a,b){for(var c in wb)if(64==wb[c]){a.Ea[c]=b;break}}
k.oc=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function Ih(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.pc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Na[a-8]:20>a?b=this.b.Aa[a-16]:20==a&&(b=Bb(this.b)));return b};
k.message=function(a,b){b&&(a+=" @"+J(this,Y(this.b.Db).D));this.na&1073741824?this.ra.push(a):this.ba&&a==this.ba||(this.ba=a,this.na&-2147483648&&(this.ia(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,cd(a),a.ra=0,a.B.da()))};function vh(a){var b;if(!ae(a))a.G&&a.G.length&&a.j("instruction history buffer freed"),a.Y=0,a.G=[];else if(!a.G||!a.G.length){a.G=Array(1E3);for(b=0;b<a.G.length;b++)a.G[b]=Y();a.Y=0;a.j("instruction history buffer allocated")}}
k.sb=function(a,b){if(!Jh(this,b))return!1;this.b.sb(a);return!0};k.tb=function(a,b,c){if(!Jh(this))return!1;this.J=0;a||ae(this)&&be(this,this.b.u[7],0);try{a=dd(this.b,a);var d=this.b.tb(a);0<d&&(ed(this.b,a),this.J+=d,ad(this.b,d,!0),Yc(this.b,d),this.sa++)}catch(e){"number"!=typeof e&&(this.J=0,ub(this.b,e.stack||e.message))}!1!==c&&this.B.da();this.da(b||!1);return 0<this.J};k.ia=function(a){this.b&&this.b.ia(a)};
k.da=function(a){if(this.ab){void 0===a&&(a=!0);var b;b=this.b;if(b=b.H&8?b.Rc|b.Qc<<8:0){var c=b>>8;this.j("trapped to "+J(this,b&255,1)+(c?" ("+J(this,c)+")":""))}this.K=Y(this.b.u[7]);a&&1!=this.R?Kh(this):Lh(this)}};function Jh(a,b){var c;(c=!a.b||!sb(a.b))||(c=a.b,c.v.ha?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.v.fa?(b||a.j("cpu busy or unavailable, command ignored"),!1):!tb(a.b)}k.za=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
k.ya=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){vh(this);this.sa=0;this.ba=null;this.J=0;this.K=Y(this.b.u[7]);this.v.fa=!1;Mh(this);a||this.da()};k.save=function(){var a=new O(this);a.set(0,Fh(this.K));a.set(1,Fh(this.N));a.set(2,[this.g,this.P,this.na]);a.set(3,this.I);return a.data()};
k.restore=function(a){var b=0;void 0!==a[2]&&(this.K=Gh(a[b++]),this.N=Gh(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.P=a[b][1],this.na|=a[b][2]);a[3]&&(this.I=a[3]);return!0};k.start=function(a,b){this.R||this.j("running");this.v.fa=!0;this.xb=a;this.yb=b};
k.stop=function(a,b){if(this.v.fa){this.v.fa=!1;this.J=b-this.yb;if(!this.R){b="stopped";if(this.J){a-=this.xb;var c=0<a?Math.round(1E3*this.J/a):0;b+=" (";ae(this)&&(b+=this.sa+" instructions, ",this.sa=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}this.da(!0);this.gb();Mh(this,this.b.u[7]);this.ba=null}};function ae(a){return 1<a.f.length||!!a.ma}
function be(a,b,c){var d=-1;c||(d=a.b.lb(b),0==d&&(b=pd(a.b,2)));if(0<c&&(a.ma&&!--a.ma||Pc(a,b,1,a.f)))return!0;0<=c&&a.G.length&&(a.sa++,0>d&&(d=a.b.lb(b)),65535!=(d&65535)&&(c=a.G[a.Y],c.D=b,c.Ga=!1,++a.Y==a.G.length&&(a.Y=0)));return!1}function cc(a){var b=a.b;if(b.v.fa)throw N(b,a.b.Db),a.ia(),-1;return!1}
function uh(a){var b,c;a.f=["bp"];if(a.L)for(b=1;b<a.L.length;b++){c=a.L[b];var d=a.w;c=a.aa(c);Qc(d.W[c>>>d.ka],!1)}a.L=["br"];if(a.C)for(b=1;b<a.C.length;b++)c=a.C[b],d=a.w,c=a.aa(c),Qc(d.W[c>>>d.ka],!0);a.C=["bw"];a.Ya=0}k.cb=function(a,b,c){var d=!0;c||Nh(this,a,b,!1,!0);if(a!=this.f){var e=this.aa(b);if(-1===e)this.j("invalid address: "+J(this,b.D)),d=!1;else{var f=this.w;f.W[e>>>f.ka].cb(e&f.w,a==this.C)}}d&&(a.push(b),c?b.Ga=!0:(Oh(this,a,a.length-1,"set"),vh(this)));return d};
function Nh(a,b,c,d,e){var f=!1;c=a.aa(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.aa(h)&&(!d||h.Ga)){f=!0;h.Ga||e||Oh(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.w,Qc(d.W[c>>>d.ka],b==a.C));h.Ga||vh(a);break}}return f}function Ph(a,b){for(var c=1;c<b.length;c++)Oh(a,b,c);return b.length-1}function Oh(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.D)+(d?" "+d:c.zc?' "'+c.zc+'"':""))}
function Mh(a,b){if(void 0!==b)Pc(a,b,1,a.f,!0),a.R=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ga){if(!Nh(a,a.f,c,!0))break;b=0}}}
function Pc(a,b,c,d,e){var f=!1;if(!a.Ya++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Ga)for(var m=a.aa(h),n=0;n<c;n++)if(b+n==m){var q,f=!0;h.Ga&&(Nh(a,d,h,!0),e=!0);if(q=h.Ec){for(var f=!1,w=0;w<q.length;w++)if(!Qh(a,q[w],!0)){if(q[w].indexOf("if")){f=!0;break}for(var v=w+1;v<q.length&&q[v].indexOf("else");v++)w++;if(v==q.length){f=!0;break}}a.b.v.fa||(f=!0)}if(f){e||Oh(a,d,g,"hit");break}}}a.Ya--;return f}
function Rh(a,b,c,d){var e=Y(b.D),f=a.oa(b,2),g,h;for(h in a.jb)if(g=a.jb[h][f&h])break;g||(g=Ah);var m=g[0];0<=a.wb.indexOf(m)&&(g=Ah,m=g[0]);var n=h="",q=yh[m],w=g.length-1;m||w||(h=J(a,f));for(m=1;m<=w;m++){var v=g[m];if(void 0!==v){var x;x=a;var z=v,v=b,y="",B=z&61440;if(4096==B)v=v.D+((f&255)<<24>>23)&65535,y=J(x,v);else if(8192==B)v=v.D-((f&63)<<1)&65535,y=J(x,v);else if(12288==B)y=J(x,f&7,1);else if(24576==B)y=J(x,f&63,1);else if(32768==B)y=J(x,f&255,1);else if(B=f&z,z&4032&&(B>>=6,z>>=6),
z&63)switch(z=B&7,B&56){case 0:y=Ih(z);break;case 8:y="@"+Ih(z);break;case 16:7>z?y="("+Ih(z)+")+":(B=x.oa(v,2),y="#"+J(x,B,0,!0));break;case 24:7>z?y="@("+Ih(z)+")+":(B=x.oa(v,2),y="@#"+J(x,B,0,!0));break;case 32:y="-("+Ih(z)+")";break;case 40:y="@-("+Ih(z)+")";break;case 48:B=x.oa(v,2);y=J(x,B,0,!0)+"("+Ih(z)+")";7==z&&(y=J(x,B+v.D&65535));break;case 56:B=x.oa(v,2),y="@"+J(x,B)+"("+Ih(z)+")",7==z&&(y="@"+J(x,B+v.D&65535))}x=y;if(!x||!x.length){h="INVALID";break}"string"!=typeof x&&(n=x[1],x=x[0]);
0<h.length&&(h+=",");h+=x||"???"}}f="";g=J(a,e.D)+":";if(-1!==e.D&&-1!==b.D){do if(f+=" "+J(a,a.oa(e,2)),null==e.D)break;while(e.D!=b.D)}g+=wa(f,24);g+=wa(q,5);h&&(g+=" "+h);if(c||n)g=wa(g,60)+";"+(c||""),g=a.b.v.kb?g+("cycles="+Zc(a.b).toString()+" cs="+l(a.b.Ab)):g+(null!=d?"="+d.toString():""),n&&(g+=" @"+n);return g}function Sh(a,b){switch(b){case "N":a=a.b.Ma();break;case "Z":a=nd(a.b);break;case "V":a=md(a.b);break;case "C":a=ld(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function Th(a,b){var c="",d=a.b;8>b?(c=Ih(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Na[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.Aa[b-16]):20==b&&(c="PS="+J(a,Bb(d)));c&&(c+=" ");return c}function Uh(a){var b,c="";for(b=0;6>b;b++)c+=Th(a,b);c=c+"\n"+(Th(a,6)+Th(a,7)+Th(a,20));return c+=Sh(a,"T")+Sh(a,"N")+Sh(a,"Z")+Sh(a,"V")+Sh(a,"C")}k.ic=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function eg(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var m=h.o,n=h.a;if(void 0!==m){var q=f,m=[m>>>0,g],w=za(q,m,a.ic);0>w&&q.splice(-(w+1),0,m)}n&&(h.a=n.replace(/''/g,'"'))}a.I.push({we:b,D:c,Pc:d,ga:e,gc:f})}function Vh(a,b,c){var d=[],e=a.aa(b)>>>0;for(b=0;b<a.I.length;b++){var f=a.I[b],g=f.D>>>0,h=f.Pc;if(e>=g&&e<g+h){e=za(f.gc,[e-g],a.ic);0<=e?Wh(a,b,e,d):c&&(e=~e,Wh(a,b,e-1,d),Wh(a,b,e,d));break}}return d}
function Wh(a,b,c,d){var e={},f=a.I[b].gc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.I[b].ga[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function Xh(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return sh(a)||a.j("no variables"),!0;if(!c[2])return sh(a,c[1]);if(!c[3])return delete a.S[c[1]],!0;b=oh(a,c[3]);return void 0!==b?(a.S[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
function Yh(a,b,c){var d=null;if(b=Dh(a,b,!0)){a.aa(b);var e=Vh(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.D-e[1])&&(g=" + "+l(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.j(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.D)&&(g=" - "+l(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
function Kh(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}f=oh(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":N(d,f);a.K=Y(d.u[7]);break;case "N":d.X=f?32768:0;break;case "Z":d.$=
f?0:1;break;case "V":d.U=f?32768:0;break;case "C":d.T=f?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=f&65535;break}a.j("unknown register: "+e);return}a.B.da();a.j("updated registers:")}a.j(Uh(a));c&&(a.K=Y(d.u[7]),Lh(a,J(a,a.K.D)))}}function Zh(a,b){b=xa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):rh(a,null,c[2].charCodeAt(0)):oh(a,b,!0)}
function $h(a,b,c){var d="t"!=b;c=qh(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Pa(c,function(){return qb(a,!0)&&a.tb(e,d,!1)},function(){a.B.da();qb(a,!1)})}
function Lh(a,b,c,d){if(b=Dh(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=qh(a,c.substr(1)),null!=c&&(d=c);else{d=Dh(a,c,!0);if(!d||d.D<b.D)return;e=d.D-b.D;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=rb(a,!1)||a.R?a.J:null;var g=null!=f?"cycles":null,h=Vh(a,b),m=b.D;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var n=h[0]+":";h[2]&&(n+=" "+h[2]);a.j(n)}h[3]&&(g=h[3],f=null);f=Rh(a,b,g,f);a.j(f);a.K=b;e-=b.D-m;c++}}}
function Qh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.P&&(a.j("ended assemble at "+J(a,a.N.D)),a.K=a.N,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ba=null;if(sb(a)&&0<b.length){a.P&&(b="a "+J(a,a.N.D)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],m=h.charAt(0),n=1;n<h.length;n++){var q=h.charAt(n);if("?"==m||"r"==m||"a">q||"z"<q){g[0]=h.substr(n);g.unshift(h.substr(0,n));break}}switch(g[0].charAt(0)){case "a":var w=
Dh(a,g[1],!0);if(w)if(a.N=w,void 0===g[2])a.j("begin assemble at "+J(a,w.D)),a.P=!0,a.B.da();else{var v;a.j("not supported yet");v=[];if(v.length){for(var x=0;x<v.length;x++)a.Qb(w,v[x],1);a.j(Rh(a,a.N))}}break;case "b":a:{var z=g[0],y=g[1],B=b;if("?"==y)a.j("breakpoint commands:"),a.j("\tbp [a]\tset exec breakpoint at addr [a]"),a.j("\tbr [a]\tset read breakpoint at addr [a]"),a.j("\tbw [a]\tset write breakpoint at addr [a]"),a.j("\tbc [a]\tclear breakpoint at addr [a]"),a.j("\tbl\tlist all breakpoints"),
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var ia=z.charAt(1);if("l"==ia){var Ja;Ja=0+Ph(a,a.f);Ja+=Ph(a,a.L);(Ja+=Ph(a,a.C))||a.j("no breakpoints")}else if("n"==ia)a.ma=qh(a,y),a.j("break after "+a.ma+" instruction(s)");else if(void 0===y)a.j("missing breakpoint address");else{var P=Y();if("*"!=y&&(P=Dh(a,y,!0),!P))break a;"c"==ia?null==P.D?(uh(a),a.j("all breakpoints cleared")):Nh(a,a.f,P)||Nh(a,a.L,P)||Nh(a,a.C,P)||a.j("breakpoint missing: "+J(a,P.D)):null!=P.D&&(Hh(a,P,B),"p"==ia?a.cb(a.f,
P):"r"==ia?a.cb(a.L,P):"w"==ia?a.cb(a.C,P):a.j("unknown breakpoint command: "+ia))}}}break;case "c":a.Ka&&(a.Ka.value="");break;case "d":a:{var bb,cb=g[0],la=g[1],La=g[2],si=g[3];if("?"==la){var db="";for(bb in wb)a.Ea[bb]&&(db&&(db+=","),db+=bb);db+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
db.length&&a.j("dump extension commands:\n\t"+db)}else if("state"==la){var fg=ai(a.B,!0);"console"==La?console.log(fg):(a.Ka&&(a.Ka.value=""),a.j(fg))}else if("symbols"==la)for(var vd=0;vd<a.I.length;vd++){var wd=a.I[vd],eb;for(eb in wd.ga)if("."!=eb.charAt(0)){var gg=wd.ga[eb].o;if(void 0!==gg){var hg=wd.ga[eb].l;hg&&(eb=hg);a.j(J(a,gg)+" "+eb)}}}else{if("d"==cb){for(bb in wb)if(g[1]==bb){var ig=a.Ea[bb];ig?(g.shift(),g.shift(),ig(g)):a.j("no dump registered for "+la);break a}la||(cb=a.Kb||"db")}else a.Kb=
cb;if("dh"==cb){var jg=la,kg=La,lg="",mg=0,ea=a.Y,ma=a.G;if(ma.length){var Z=+jg||a.bb,Db=+kg||10;isNaN(Z)?Z=Db:lg="more ";Z>ma.length&&(a.j("note: only "+ma.length+" available"),Z=ma.length);ea-=Z;0>ea&&(null==ma[ma.length-1].D?(Z=ea+Z,ea=0):ea+=ma.length);var xd=[];"call"==kg&&(Db=1E5,xd=["CALL"]);for(void 0!==jg&&a.j(Z+" instructions earlier:");0<Db&&ea!=a.Y;){var ng=ma[ea++];if(null==ng.D)break;var Eb=Y(ng.D),ti=Z--,og=Rh(a,Eb,"history",ti);(!xd.length||0<=og.indexOf(xd[0]))&&a.j(og);Eb.Wb&&(ea+=
Eb.Wb,Db-=Eb.Wb,Z-=Eb.Wb);ea>=ma.length&&(ea=0);a.bb=Z;mg++;Db--}}mg||(a.j("no "+lg+"history available"),a.bb=void 0)}else{var Fb=Dh(a,la);if(Fb){var vc=0;La&&("l"==La.charAt(0)&&(La=La.substr(1)||si),vc=qh(a,La)>>>0,65536<vc&&(vc=65536));for(var Gb="",fb="dd"==cb?4:"dw"==cb?2:1,wc=fb*vc||128,ui=wc+15>>4||1;ui--&&0<wc;){var xc=0,Hb=0,Ib,yd="",pg="",la=J(a,Fb.D);for(Ib=4==fb?16:a.Z;0<Ib&&0<wc;Ib--){var yc=1,zc=1==fb?a.zb(Fb,yc):a.oa(Fb,yc=2),xc=xc|zc<<(Hb<<3),Hb=Hb+yc;Hb==fb&&(yd+=J(a,xc,fb),yd+=1==
fb?9==Ib?"-":" ":" ",xc=Hb=0);pg+=32<=zc&&128>zc?String.fromCharCode(zc):".";wc-=yc}Gb&&(Gb+="\n");Gb+=la+" "+yd+(0==Ib?" "+pg:"")}Gb&&a.j(Gb);a.$a=Fb}}}}break;case "e":if("else"==g[0])break;var gb,zd,Ad,Bd,Cd=g[0],Dd=g[1];"eb"==Cd?(gb=1,zd=255,Ad=a.zb,Bd=a.Qb):"e"==Cd||"ew"==Cd?(gb=2,zd=65535,Ad=a.oa,Bd=a.hb):Dd=null;if(null==Dd)a.j("edit memory commands:"),a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var Ac=Dh(a,Dd);if(Ac)for(var Bc=2;Bc<g.length;Bc++){var Jb=
oh(a,g[Bc]);if(void 0===Jb){a.j("unrecognized value: "+g[Bc]);break}Jb&~zd&&a.j("warning: "+l(Jb)+" exceeds "+gb+"-byte value");var vi=Ad.call(a,Ac);a.j("changing "+J(a,Ac.D)+" from "+J(a,vi,gb)+" to "+J(a,Jb,gb));Bd.call(a,Ac,Jb,gb)}}break;case "g":a:{var qg=g[1],wi=b;if(void 0!==qg){var Ed=Dh(a,qg,!0);if(!Ed)break a;Hh(a,Ed,wi);a.cb(a.f,Ed,!0)}a.sb(!0,c)}break;case "h":a.v.fa?(c||a.j("halting"),a.ia()):rb(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var Fd;var Kb=b.substr(2),Kb=
xa(Kb);oh(a,Kb)?(c||a.j("true: "+Kb),Fd=!0):(c||a.j("false: "+Kb),Fd=!1);Fd||(d=!1);break}f=!0;break;case "k":var xi=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var Gd=0,Hd=Y(),Lb=Y(a.b.u[6]);for(a.j("stack trace for "+J(a,Lb.D));10>Gd;){for(var Ma=null,yi=256;65536>Lb.D>>>0;){Hd.D=a.oa(Lb,2);if(null==Lb.D||!yi--)break;if(!(Hd.D&1)){for(var zi=a,Cc=Hd,rg=null,Mb=Cc.D,sg=Mb,Id=1;6>=Id&&Mb;Id++){if(2<Id){Cc.D=Mb;var Dc=Rh(zi,
Cc);if(0<=Dc.indexOf("JSR")){var tg=Dc.indexOf(" ");if(Mb+(Dc.indexOf(" ",tg+1)-tg-1)/2==sg){rg=Dc;break}}}Mb-=2}Cc.D=sg;if(Ma=rg)break}}if(!Ma||null==Ma)break;var ug=null;if("ks"==xi){var vg=Ma.match(/[0-9A-F]+$/);vg&&(ug=Yh(a,vg[0]))}Ma=wa(Ma,50)+" ;"+(ug||"stack="+J(a,Lb.D));a.j(Ma);Gd++}Gd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){Yh(a,g[1],!0);break}f=!0;break;case "m":a:{var na,oa=null,H=g[1];"?"==H&&(H=void 0);if(void 0!==H){var Ca=0;if("all"==H)Ca=1878917119,H=null;
else if("on"==H)oa=!0,H=null;else if("off"==H)oa=!1,H=null;else{"keys"==H&&(H="key");"kbd"==H&&(H="keyboard");for(na in wb)if(H==na){Ca=wb[na];oa=!!(a.na&Ca);break}if(!Ca){a.j("unknown message category: "+H);break a}}if(Ca)if("on"==g[2])a.na|=Ca,oa=!0;else if("off"==g[2]&&(a.na&=~Ca,oa=!1,1073741824==Ca)){for(var Jd=0;Jd<a.ra.length;Jd++)a.j(a.ra[Jd]);a.ra=[]}}var Ai=0,Nb="";for(na in wb)if(!H||H==na){var Bi=!!(a.na&wb[na]);if(null===oa||oa==Bi)Nb&&(Nb+=","),++Ai%10||(Nb+="\n\t"),"key"==na&&(na="keys"),
Nb+=na}void 0===H&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==oa?oa?"messages on: ":"messages off: ":"message categories:\n\t")+(Nb||"none"));vh(a)}break;case "p":if("print"==g[0]){Zh(a,b.substr(5));break}var Ci="pr"==g[0]?1:0;if(a.R)a.j("step in progress");else{var wg=Y(a.b.u[7]);a.zb(wg);a.R?(a.cb(a.f,wg,!0),a.sb()||(a.B&&a.B.gb(),a.R=0)):$h(a,Ci?"tr":"t")}break;case "r":if("reset"==b){a.B&&a.B.reset();break}Kh(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Ob=
+g[2];if(8==Ob||10==Ob||16==Ob)a.Z=Ob;else{a.j("invalid base: "+Ob);break}}a.j("default base: "+a.Z);break;case "cs":var Pb;void 0!==g[3]&&(Pb=+g[3]);switch(g[2]){case "int":a.b.nb=Pb;break;case "start":a.b.Bb=Pb;break;case "stop":a.b.ob=Pb;break;default:a.j("unknown cs option");break a}void 0!==Pb&&Wc(a.b);a.j("checksums "+(a.b.v.kb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&($c(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.eb.toFixed(2)+
"Mhz")+" ("+a.b.Ta+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":$h(a,g[0],g[1]);break;case "u":Lh(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Xh(a,b.substr(3))||(d=!1);break}if("ver"==
g[0]){a.j("PDPjs version 1.30.2 ("+a.b.mb+",RELEASE"+(vb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){Zh(a,b.substr(1));break}var Kd="commands:",Ld;for(Ld in xh)Kd+="\n"+wa(Ld,9)+xh[Ld];ae(a)||(Kd+="\nnote: history disabled if no exec breakpoints");a.j(Kd);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(xg){a.j("debugger error: "+(xg.stack||xg.message)),d=!1}return d}
function Xc(a,b,c){b=mh(a,b,c);for(var d in b)if(!Qh(a,b[+d]))return!1;return!0}Wa(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new th(d);C(d,c)}});
function bi(a,b,c){r.call(this,"Computer",a,bi,67108864);this.v.ha=!1;ci(this,b);this.L=Uc(this,"autoPower",a);this.B=0;this.Y=a.busWidth||a.buswidth;this.f=di;this.J=null;this.G=this.R=!1;this.Z=Uc(this,"url")||"";(Math.random()+.1).toString(36);this.g=ei(this);if(this.b=pb("CPU",this.id)){this.i=pb("Debugger",this.id);this.w=new Cb({id:this.Ia+".bus",busWidth:this.Y},this.b,this.i);var d,e=nb(this.id);if((this.A=pb("Panel",this.id))&&this.A.Ka)for(b=0;b<e.length;b++)d=e[b],d.O=this.A.O,d.j=this.A.j,
d.Ka=this.A.Ka;this.j("PDPjs v1.30.2\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.wa&&d.wa(this,this.w,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.I=d:this.f=parseInt(d,10));var f;if(a=Uc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.G=!0,this.f=di),this.f&&(this.K=
new O(this,"1.30.2"),fi(this.K)?b=null:delete this.K);!b&&this.f&&(b=gi(this))&&(this.G=!0);if(b){var g=this;Da(b,null,!0,function(a,b,c){c?(g.I=null,g.G=!1,g.O("Unable to load machine state from server (error "+c+(b?": "+xa(b):"")+")")):(g.J=b,g.R=!0);G(g)})}else G(this);this.F.power||(this.L=!0);!c&&this.L&&hi(this,this.Cb)}else p("Unable to find CPU component")}u(bi);var di=0;
function ci(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){p(d.message+" ("+c+")")}}a.S=b}function Uc(a,b,c){var d=b.toLowerCase(),d=ab[b]||ab[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function hi(a,b,c){for(var d=nb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!sb(f)){sb(f,function(){hi(a,b,c)});return}}b.call(a,c)}
function ii(a,b){var c=new O(a,"1.30.2","validate");if(fi(c)&&ji(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.O("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=bi.prototype;
k.Cb=function(a){void 0===a&&(a=this.f||(this.J?1:di));if(!this.B){this.B++;var b=!1,c=!1;this.P=!1;var d=this.K||new O(this,"1.30.2");if(-1==a)b=!0;else if(a>di){if(fi(d,this.J)){this.C=new O(this,"1.30.2","failsafe");fi(this.C)&&(ki(this,d),a=2,li(this.C));this.C.set("timestamp",Ba());mi(this.C);var e=this.f&&!this.G;if(1==a||Ga("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=ji(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?fi(d,g):("error"==
f&&"no machine state"!=g?(this.O("Error: "+g),"unable to verify user"==g&&(Na("user",""),this.g=null)):this.j(f+": "+g),li(d),fi(d)?(c=ji(d),e=!0):c=!1))}e&&ii(this,c?d:null)}else 2==a&&d.clear()}else ii(this);delete this.J;delete this.K}e=nb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=ni(this,g,d,b,c));b=[d,a,c];-1!=a?hi(this,this.kc,b):this.kc(b)}};
function ni(a,b,c,d,e){if(!b.v.ha){b.v.ha=!0;if(b.za){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.za(f,d)&&f&&(p("Unable to restore state for "+b.type),a.N&&!a.R?(c.clear(),a.f=di,window&&window.location.reload()):a.P=!0,b.za(null),e=!1)}if(!d&&b.mc)for(a=b.mc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
k.kc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ba=!0;this.v.ha=!0;var d=this.F.power;d&&(d.textContent="Shutdown");this.b&&(ni(this,this.b,b,c,a),this.b.ib());this.P&&(ki(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.B=0};
function ki(a,b){if(Ga("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.2"};d.url=a.Z;d.user=c;d.type="bug";d.data=b;Da("http://www.pcjs.org/api/v1/report",d,!0)}}
function ai(a,b,c){var d,e="none";if(a.B)return null;a.B--;var f=new O(a,"1.30.2"),g=new O(a,"1.30.2","validate"),h=Ba();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.2");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.ya&&(c&&a.b.ia(),d=a.b.ya(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.ha=!1,!1===d&&(e=null)));for(var h=nb(a.id),m=0;m<h.length;m++){var n=h[m];n.v.ha&&(n.ya&&(d=n.ya(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.v.ha=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&oi(a,a.g,f.toString()),mi(g)&&mi(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.v.ha=!1,b=a.F.power)&&(b.textContent="Power");a.B=0;return e}k.reset=function(){this.w&&this.w.reset&&(E(this,"Resetting "+this.w.type),this.w.reset());for(var a=nb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.w&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}};
k.start=function(a,b){for(var c=nb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.da(!0)};k.stop=function(a,b){for(var c=nb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.da(!0)};
k.qa=function(a,b,c){var d=this;switch(b){case "power":return this.F[b]=c,c.onclick=function(){d.B||(d.v.ha?ai(d,!1,!0):hi(d,d.Cb))},!0;case "reset":return this.F[b]=c,c.onclick=function(){if(d.v.ha&&!d.B)if(d.f&&!d.I){var a=Ga("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");ai(d,a,!0);!a&&d.N?window&&window.location.reload():(a||(d.lc=!0),d.Cb(di),d.lc=!1)}else d.reset(),d.b&&d.b.ib()},!0;case "save":if(ta(Fa(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.F[b]=c,c.onclick=function(){var a=ei(d,!0);if(a){var b=!!(d.f&&!d.I||d.N),c=ai(d,b);b?oi(d,a,c):d.O("Resume disabled, machine state not saved")}},!0}return!1};
function ei(a,b){var c=a.g;c||((c=Ka("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=pi(a,c))||a.O("The user ID is invalid.")):b&&a.O("Browser local storage is not available"));return c}
function pi(a,b){a.g=null;b=Da(Fa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Na("user",b.data),a.g=b.data)}catch(d){p(d.message+" ("+c+")")}return a.g}function gi(a){var b=null;a.g&&(b=Fa()+"/api/v1/user?req=load&user="+a.g+"&state="+qi(a,"1.30.2"));return b}
function oi(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=qi(a,"1.30.2");d.data=c;b=Da(Fa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.O("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.O(c),Na("user",""),a.g=null)}}
function Jg(a){var b;a=nb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.gb=function(a){if(this.Ka){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Ka.focus();!a&&window&&window.scrollTo(b,c)}};k.da=function(a){this.b&&this.b.da(a);this.A&&this.A.da(a)};
Wa(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new bi(g,d,!0);C(g,f);g.L&&hi(g,g.Cb)}});Ra.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=pb("Computer",c.id))&&c.ba&&!c.v.ha&&c.Cb(-1)}});
Ra.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=pb("Computer",c.id))&&c.v.ha&&ai(c,!(!c.f||c.I),!0)}});function O(a,b,c){this.id=a.id;this.key=qi(a,b,c);this.i=a.i;li(this,a.Oc)}function qi(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
O.prototype={constructor:O,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){li(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function li(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function mi(a){var b=!0;if(Ia()){var c=JSON.stringify(a[a.id]);Na(a.key,c)||(p("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function ji(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){p(c.message||c),b=!1}return b}function fi(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ia()&&(b=Ka(a.key))?(a[a.id]=b,a.b=!0):!1}var ri=0;
function Di(a,b,c,d,e,f){e("Loading "+a+"...");Da(a,null,!0,function(g,h,m){m?(h||(h="unable to load "+a+" ("+m+")"),f(h,null)):Ei(h,a,b,c,d,e,f)})}
function Ei(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(mb(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(q){f=null,a=q.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Fi(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Fi(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Da(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=h[0],n,q=/( [a-z]+=)(['"])(.*?)\2/g;n=q.exec(f);)m=0>m.indexOf(n[1])?m.replace(">",n[0]+">"):m.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);h[0]!=m&&(g=g.replace(h[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);Fi(a,b,c)}})}else c(a,null)}
function Gi(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=va(a))}function f(a){e("Error: "+a);m&&(--ri||Ya(!0));m=!1}var g,h,m=!0;ri++;lb[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],w=document.createElement("style");w.type="text/css";w.styleSheet?w.styleSheet.cssText=n:w.appendChild(document.createTextNode(n));q.appendChild(w)}c||
(c="/versions/pdpjs/1.30.2/components.xsl");n=function(d,h){h?Di(c,null,null,!1,e,function(d,m){m?(mb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=h.transformNode(m))?(g.outerHTML=m,--ri||Ya(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--ri||Ya(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Di(b,a,d,!0,e,n):Ei(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(v){f(v.message)}return m}window.embedPDP11=function(a,b,c,d){Ya(!1);return Gi(a,b,c,d)};window.enableEvents=Ya;window.sendEvent=Za;})();//# sourceMappingURL=/tmp/pdpjs/1.30.2/pdp11-dbg.map