272 lines
101 KiB
JavaScript
272 lines
101 KiB
JavaScript
(function(){/*
|
|
http://pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/keys.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/weblib.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/messages.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/debugger.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/debugger.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/embed.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/component.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/defines.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/panel.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/bus.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/device.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/memory.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/cpu.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/cpustate.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/cpuops.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/rom.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/ram.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/keyboard.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/serialport.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/pc11.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/computer.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016
|
|
*/
|
|
for(var k,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,da=["Math","log2"],ea=0;ea<da.length-1;ea++){var fa=da[ea];fa in ba||(ba[fa]={});ba=ba[fa]}var ga=da[da.length-1],ha=ba[ga],ia=ha?ha:function(a){return Math.log(a)/Math.LN2};
|
|
ia!=ha&&null!=ia&&aa(ba,ga,{configurable:!0,writable:!0,value:ia});function na(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function l(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
|
|
function oa(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function pa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function qa(){var a=ra();return-1!==a.indexOf("pcjs.org",a.length-8)}var sa={"&":"&","<":"<",">":">",'"':""","'":"'"};function ta(a){return a.replace(/[&<>"']/g,function(a){return sa[a]})}
|
|
function ua(a,b){return(a+" ").slice(0,b)}function va(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var wa={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
|
|
function ya(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,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={ha:null,ka:null,Ua:null,Ta: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.Ua=g.load;d.Ta=g.exec;if(e=g.bytes)d.ha=e;else if(e=g.words)for(d.ha=Array(2*e.length),f=c=0;c<e.length;c++)d.ha[f++]=e[c]&255,d.ha[f++]=e[c]>>8&255;else if(e=g.data)for(d.ha=Array(4*e.length),f=c=0;c<e.length;c++)d.ha[f++]=
|
|
e[c]&255,d.ha[f++]=e[c]>>8&255,d.ha[f++]=e[c]>>16&255,d.ha[f++]=e[c]>>24&255;else d.ha=g;d.ka=g.symbols;d.ha.length?1==d.ha.length&&(n(d.ha[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.ha=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 Ia(){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 Ja(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Ka(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function La(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Ma(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
|
function Na(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Oa={init:[],show:[],exit:[]},Pa=!1,Qa=!1,Ra=!0;function Sa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ta(a){Oa.init.push(a)}
|
|
function Ua(a){if(Ra)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){n(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Va(a){!Ra&&a?(Ra=!0,Pa&&Wa("init"),Qa&&Wa("show")):Ra=a}function Wa(a){Oa[a]&&Ua(Oa[a])}Sa("onload",function(){Pa=!0;Ua(Oa.init)});Sa("onpageshow",function(){Qa=!0;Ua(Oa.show)});Sa(La("Opera")||La("iOS")?"onunload":"onbeforeunload",function(){Ua(Oa.exit)});
|
|
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Zb=b.comment;this.tc=b;b=this.id.indexOf(".");0>b?this.Za=this.id:(this.Ra=this.id.substr(0,b),this.Za=this.id.substr(b+1));this[a]=c;this.v={ready:!1,Ia:!1,Lb:!1,ga:!1,error:!1};this.Bb=null;this.v.error=!1;this.I={};this.i=null;this.la=d||0;t.push(this)}var cb=void 0,db={};
|
|
if(window){cb||(cb=window.location.search.substr(1));for(var eb,fb=/\+/g,gb=/([^&=]+)=?([^&]*)/g;eb=gb.exec(cb);)db[decodeURIComponent(eb[1].replace(fb," "))]=decodeURIComponent(eb[2].replace(fb," "))}function hb(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
|
|
function u(a,b){b||(b=r);a.prototype=hb(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var ib=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else ib={},t=[];function jb(a,b,c){ib[a]&&b&&(ib[a][b]=c)}function kb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<t.length;b++){var d=t[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
|
function lb(a){if(void 0!==a){var b;for(b=0;b<t.length;b++)if(t[b].id===a)return t[b]}return null}function mb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<t.length;d++)if(c)c==t[d]&&(c=null);else if(!(a!=t[d].type||b&&t[d].id.indexOf(b)))return t[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){n(c.message+" ("+a+")")}return b}
|
|
function A(a,b){b=B(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),m=0;m<h.length;m++)switch(g=h[m],g){case "pdp11-binding":(g=z(f))&&g.binding&&a.ra(g.type,g.binding,f,g.value),m=h.length}}}}
|
|
function B(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
|
|
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ra: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.Va=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.Za)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.Za+": "+a)},ja:function(a,b,c){c=c||this.type;b||n((c?c+": ":"")+a)},Aa:function(){return this.v.ga=!0},za:function(a,b){b&&(this.v.ga=!1);return!0}};function C(a,b,c,d){a.i&&(!0===c||D(a,c|0))&&a.i.message(b,d)}function D(a,b){if(a.i){a===a.i?b|=0:b=b||a.la;var c=a.i.la&b;return!!b&&c===b||!!(c&a.i.nc)}return!1}
|
|
function nb(a,b){if(a.v.Lb)return a.v.Ia=!1,a.v.Lb=!1;if(a.v.error)return a.j(a.toString()+" error"),!1;a.v.Ia=b;return a.v.Ia}function ob(a,b){a.v.Ia&&(b?a.v.Lb=!0:void 0===b&&a.j(a.toString()+" busy"));return a.v.Ia}function H(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.Bb;a.Bb=null;b&&b()}}function pb(a,b){b&&(a.v.ready?b():a.Bb=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)}
|
|
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.Xb=!0}u(ub);k=ub.prototype;
|
|
k.ra=function(a,b,c,d){if(this.D&&this.D.ra(a,b,c,d)||this.b&&this.b.ra(a,b,c,d)||this.i&&this.i.ra(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.ra.call(this,a,b,c,d)}};k.Ca=function(a,b,c,d){this.D=a;this.w=b;this.b=c;this.i=d};k.Aa=function(a,b){b||Ib();return!0};k.za=function(){return!0};
|
|
function Jb(a,b,c,d){if(a.I[b]){void 0===c&&(rb(a,"Value for "+b+" is invalid"),a.b.aa());var e=a.i&&a.i.ma||8;c=!a.b.v.da||a.v.Xb?8==e?na(c,d):l(c,d):"--------".substr(0,d||4);a.I[b].textContent!=c&&(a.I[b].textContent=c)}}function Kb(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.$=function(a){if(this.f&&(a||!this.b.v.da||this.v.Xb)){for(a=0;a<this.b.u.length;a++)Jb(this,"R"+a,this.b.u[a]);a=Lb(this.b);Jb(this,"PS",a);Jb(this,"NF",a&8?1:0,1);Jb(this,"ZF",a&4?1:0,1);Jb(this,"VF",a&2?1:0,1);Jb(this,"CF",a&1?1:0,1);Kb(this,"D",this.b.u[0],16);Kb(this,"A",this.b.u[7],22)}};function Ib(){for(var a=!1,b=B(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=lb(e.id);f||(a=!0,f=new ub(e));A(f,d);a&&H(f)}}Ta(Ib);
|
|
function Mb(a,b,c){r.call(this,"Bus",a,Mb,64);this.b=b;this.i=c;this.M=a.busWidth||16;this.g=0;this.K=[];this.F=null;this.H=Math.pow(2,this.M);this.f=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.Ha=[];this.A=0;this.D=[];this.mc=[Ob,Pb,Qb,Rb];a=new I(this);Sb(a,this.i);this.W=Array(this.C);for(b=0;b<this.C;b++)this.W[b]=a;H(this)}u(Mb);var Nb=8192,Tb=Nb-1;
|
|
function Ob(a,b){var c=-1,d=this.controller,e=d.Ha[a];e?e[0]?c=e[0](b):e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.Ha[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.i&&D(this.i,64)&&C(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Ub(d,b,!0);this.i&&D(this.i,64)&&C(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
|
|
function Pb(a,b,c){var d=!1,e=this.controller,f=e.Ha[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(c&1)f[3](a&255|b<<8,c&-2);else f[3](a&-256|b,c);d=!0}}else c&1&&(f=e.Ha[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,c),d=!0);d?this.i&&D(this.i,64)&&C(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Ub(e,c,!0,b),this.i&&D(this.i,64)&&C(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
|
|
function Qb(a,b){var c=-1,d=this.controller;(a=d.Ha[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.i&&D(this.i,64)&&C(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!0),c;c=Ub(d,b,!1);this.i&&D(this.i,64)&&C(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!0);return c}
|
|
function Rb(a,b,c){var d=!1,e=this.controller;if(a=e.Ha[a])a[3]?(a[3](b,c),d=!0):a[1]&&(a[1](b&255,c),a[1](b>>8,c+1),d=!0);d?this.i&&D(this.i,64)&&C(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!0):(Ub(e,c,!1,b),this.i&&D(this.i,64)&&C(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!0))}
|
|
function Vb(a,b){if(b!=a.g){var c;a.g&&(c=(1<<a.g)-Nb,Wb(a,c,Nb,a.K),a.g=0);b&&(a.g=b,c=(1<<b)-Nb,a.K=Xb(a,c,Nb),a.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.D.length;a++)this.D[a]();Vb(this,16)};function Ub(a,b,c,d){if(a.i&&D(a.i,536870912)&&(C(a.i,"warning: unknown I/O access ("+J(a.i,b)+","+J(a.i,d,c?1:2)+")",!0,!0),$b(a.i)))return 0;a.A||a.b.ea(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.W.length;){var m=a.W[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.B)return m.xb+=m.B-f,m.B=f,!0;if(f>=m.B+m.xb){q=m.size-(f-p);q>g&&(q=g);m.xb=f-m.B+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.W[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.W.length;)d.push(a.W[b++]),c-=a.ua;return d}function Wb(a,b,c,d){var e=0;for(b>>>=a.ia;0<c&&b<a.W.length;){var f=d[e++];if(!f)break;a.W[b++]=f;c-=a.ua}}k.qb=function(a){return this.W[(a&this.f)>>>this.ia].Hb(a&this.w,a)};k.Db=function(a){this.A++;a=this.W[(a&this.f)>>>this.ia].Nb(a&this.w,a);this.A--;return a};k.na=function(a){return this.W[(a&this.f)>>>this.ia].oa(a&this.w,a)};
|
|
k.rb=function(a){var b=a&this.w,c=(a&this.f)>>>this.ia;this.A++;a=this.W[c].Ob(b,a);this.A--;return a};k.Ib=function(a,b){this.W[(a&this.f)>>>this.ia].Kb(a&this.w,b&255,a)};k.Xa=function(a,b){this.A++;this.W[(a&this.f)>>>this.ia].Tb(a&this.w,b&255,a);this.A--};k.Ya=function(a,b){this.W[(a&this.f)>>>this.ia].yb(a&this.w,b&65535,a)};k.Jb=function(a,b){var c=a&this.w,d=(a&this.f)>>>this.ia;this.A++;this.W[d].Ub(c,b&65535,a);this.A--};
|
|
function cc(a){for(var b=0,c=[],d=0;d<a.C;d++){var e=a.W[d];if(e.Ja||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.Ha[m]?n("I/O address already registered: "+l(b,8,!0)):a.Ha[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.D.push(b)}
|
|
function gc(a,b){a.A||(a.i&&D(a.i,536870912)&&C(a.i,"memory fault on address "+J(a.i,b),!0,!0),a.b.ea(4,b))}function ac(a,b,c){n("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}function K(a){r.call(this,"Device",a,K,256);this.g={data:0,Sd:0,Gb:20,gd:0};this.f={Td:0,Sb:-1}}u(K);k=K.prototype;
|
|
k.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;var e=this;this.f.Sb=hc(c,function(){e.f.Ka|=128;e.f.Ka&64&&(ic(e.b,e.f.hd),jc(e.b,e.f.Sb,1E3/60))});this.f.hd=kc(64,6);ec(b,this,L);fc(b,this.reset.bind(this));H(this)};k.reset=function(){this.g.Gb=this.g.Gb&-120|20;this.f.Ka=0};k.Dc=function(){var a=this.f.Ka;this.f.Ka&=-129;return a};k.rd=function(a){this.f.Ka=a;a&64&&jc(this.b,this.f.Sb,1E3/60);this.f.Ka=a&-129};k.wc=function(a){return(a?this.g.gd:this.g.data)&65535};
|
|
k.kd=function(a){this.g.data=a};k.Fc=function(){var a=this.b;return a.F&62337|a.wa<<5|a.xa<<1};k.td=function(a){var b=this.b;a&=62337;if(b.F!=a){b.F=a;b.wa=a>>5&3;b.xa=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.La!=c&&(b.La=c,tc(b))}uc(this)};k.Gc=function(){var a=this.b.Na;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.Hc=function(){return this.b.vb};k.Ic=function(){return this.b.Oa};
|
|
k.ud=function(a){var b=this.b;1170>b.fb&&(a&=-49);b.Oa!=a&&(b.Oa=a,a&16?(b.bb=4194303,b.ya=3915776):(b.bb=262143,b.ya=253952),tc(b));uc(this)};function uc(a){a.g.Gb=a.g.Gb&-8|(a.b.La?a.b.Oa&16?1:2:4)}k.Wc=function(a){return this.b.T[1][a>>1&7]};k.Id=function(a,b){this.b.T[1][b>>1&7]=a&65295};k.Uc=function(a){return this.b.T[1][(a>>1&7)+8]};k.Gd=function(a,b){this.b.T[1][(b>>1&7)+8]=a&65295};k.Vc=function(a){return this.b.ta[1][a>>1&7]};
|
|
k.Hd=function(a,b){b=b>>1&7;this.b.ta[1][b]=a;this.b.T[1][b]&=65295};k.Tc=function(a){return this.b.ta[1][(a>>1&7)+8]};k.Fd=function(a,b){b=(b>>1&7)+8;this.b.ta[1][b]=a;this.b.T[1][b]&=65295};k.Cc=function(a){return this.b.T[0][a>>1&7]};k.qd=function(a,b){this.b.T[0][b>>1&7]=a&65295};k.Ac=function(a){return this.b.T[0][(a>>1&7)+8]};k.od=function(a,b){this.b.T[0][(b>>1&7)+8]=a&65295};k.Bc=function(a){return this.b.ta[0][a>>1&7]};k.pd=function(a,b){b=b>>1&7;this.b.ta[0][b]=a;this.b.T[0][b]&=65295};
|
|
k.zc=function(a){return this.b.ta[0][(a>>1&7)+8]};k.nd=function(a,b){b=(b>>1&7)+8;this.b.ta[0][b]=a;this.b.T[0][b]&=65295};k.bd=function(a){return this.b.T[3][a>>1&7]};k.Od=function(a,b){this.b.T[3][b>>1&7]=a&65295};k.$c=function(a){return this.b.T[3][(a>>1&7)+8]};k.Md=function(a,b){this.b.T[3][(b>>1&7)+8]=a&65295};k.ad=function(a){return this.b.ta[3][a>>1&7]};k.Nd=function(a,b){b=b>>1&7;this.b.ta[3][b]=a;this.b.T[3][b]&=65295};k.Zc=function(a){return this.b.ta[3][(a>>1&7)+8]};
|
|
k.Ld=function(a,b){b=(b>>1&7)+8;this.b.ta[3][b]=a;this.b.T[3][b]&=65295};k.jb=function(a){a&=7;return this.b.L&2048?this.b.Ea[a]:this.b.u[a]};k.nb=function(a,b){b&=7;this.b.L&2048?this.b.Ea[b]=a:this.b.u[b]=a};k.Nc=function(){return this.b.L&49152?this.b.va[0]:this.b.u[6]};k.zd=function(a){this.b.L&49152?this.b.va[0]=a:this.b.u[6]=a};k.Qc=function(){return this.b.u[7]};k.Cd=function(a){this.b.u[7]=a};k.kb=function(a){a&=7;return this.b.L&2048?this.b.u[a]:this.b.Ea[a]};
|
|
k.ob=function(a,b){b&=7;this.b.L&2048?this.b.u[b]=a:this.b.Ea[b]=a};k.Oc=function(){return 1==(this.b.L&49152)>>14?this.b.u[6]:this.b.va[1]};k.Ad=function(a){1==(this.b.L&49152)>>14?this.b.u[6]=a:this.b.va[1]=a};k.Pc=function(){return 3==(this.b.L&49152)>>14?this.b.u[6]:this.b.va[3]};k.Bd=function(a){3==(this.b.L&49152)>>14?this.b.u[6]=a:this.b.va[3]=a};k.yc=function(a){return this.b.gc[a-65504>>1]};k.md=function(a,b){this.b.gc[b-65504>>1]=a};k.dc=function(a){return 65520==a?61183:0};k.jc=function(){};
|
|
k.Yc=function(){return 1};k.Kd=function(){};k.xc=function(){return this.b.Z};k.ld=function(){this.b.Z=0};k.Ec=function(){return this.b.fc};k.sd=function(a,b){b&1||(a&=255);this.b.fc=a};k.Jc=function(a){return a?this.b.Qb:0};k.vd=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.Xc=function(a){return a?this.b.Pa&65280:0};k.Jd=function(a){this.b.Pa=a|255};k.Mc=function(){return Lb(this.b)};k.yd=function(a){vc(this.b,a&-1809|Lb(this.b)&1808);this.b.G|=128};
|
|
k.ic=function(a,b){D(this)&&C(this,"writeIgnored("+na(b)+"): "+na(a),!0,!0)};
|
|
var M={},L=(M[62592]=[null,null,K.prototype.Wc,K.prototype.Id,"SISDR",1145],M[62608]=[null,null,K.prototype.Uc,K.prototype.Gd,"SDSDR",1145],M[62624]=[null,null,K.prototype.Vc,K.prototype.Hd,"SISAR",1145],M[62640]=[null,null,K.prototype.Tc,K.prototype.Fd,"SDSAR",1145],M[62656]=[null,null,K.prototype.Cc,K.prototype.qd,"KISDR",1145],M[62672]=[null,null,K.prototype.Ac,K.prototype.od,"KDSDR",1145],M[62688]=[null,null,K.prototype.Bc,K.prototype.pd,"KISAR",1145],M[62704]=[null,null,K.prototype.zc,K.prototype.nd,
|
|
"KDSAR",1145],M[62798]=[null,null,K.prototype.Ic,K.prototype.ud,"MMR3",1145],M[65382]=[null,null,K.prototype.Dc,K.prototype.rd,"LKS"],M[65400]=[null,null,K.prototype.wc,K.prototype.kd,"CNSL"],M[65402]=[null,null,K.prototype.Fc,K.prototype.td,"MMR0",1145],M[65404]=[null,null,K.prototype.Gc,K.prototype.ic,"MMR1",1145],M[65406]=[null,null,K.prototype.Hc,K.prototype.ic,"MMR2",1145],M[65408]=[null,null,K.prototype.bd,K.prototype.Od,"UISDR",1145],M[65424]=[null,null,K.prototype.$c,K.prototype.Md,"UDSDR",
|
|
1145],M[65440]=[null,null,K.prototype.ad,K.prototype.Nd,"UISAR",1145],M[65456]=[null,null,K.prototype.Zc,K.prototype.Ld,"UDSAR",1145],M[65472]=[null,null,K.prototype.jb,K.prototype.nb,"R0SET0"],M[65473]=[null,null,K.prototype.jb,K.prototype.nb,"R1SET0"],M[65474]=[null,null,K.prototype.jb,K.prototype.nb,"R2SET0"],M[65475]=[null,null,K.prototype.jb,K.prototype.nb,"R3SET0"],M[65476]=[null,null,K.prototype.jb,K.prototype.nb,"R4SET0"],M[65477]=[null,null,K.prototype.jb,K.prototype.nb,"R5SET0"],M[65478]=
|
|
[null,null,K.prototype.Nc,K.prototype.zd,"R6KERNEL"],M[65479]=[null,null,K.prototype.Qc,K.prototype.Cd,"R7KERNEL"],M[65480]=[null,null,K.prototype.kb,K.prototype.ob,"R0SET1",1145],M[65481]=[null,null,K.prototype.kb,K.prototype.ob,"R1SET1",1145],M[65482]=[null,null,K.prototype.kb,K.prototype.ob,"R2SET1",1145],M[65483]=[null,null,K.prototype.kb,K.prototype.ob,"R3SET1",1145],M[65484]=[null,null,K.prototype.kb,K.prototype.ob,"R4SET1",1145],M[65485]=[null,null,K.prototype.kb,K.prototype.ob,"R5SET1",1145],
|
|
M[65486]=[null,null,K.prototype.Oc,K.prototype.Ad,"R6SUPER",1145],M[65487]=[null,null,K.prototype.Pc,K.prototype.Bd,"R6USER",1145],M[65504]=[null,null,K.prototype.yc,K.prototype.md,"CTRL",1170],M[65520]=[null,null,K.prototype.dc,K.prototype.jc,"LSIZE",1170],M[65522]=[null,null,K.prototype.dc,K.prototype.jc,"HSIZE",1170],M[65524]=[null,null,K.prototype.Yc,K.prototype.Kd,"SYSID",1170],M[65526]=[null,null,K.prototype.xc,K.prototype.ld,"CPUERR",1170],M[65528]=[null,null,K.prototype.Ec,K.prototype.sd,
|
|
"MB",1170],M[65530]=[null,null,K.prototype.Jc,K.prototype.vd,"PIR"],M[65532]=[null,null,K.prototype.Xc,K.prototype.Jd,"SL"],M[65534]=[null,null,K.prototype.Mc,K.prototype.yd,"PSW"],M);L[62594]=L[62592];L[62596]=L[62592];L[62598]=L[62592];L[62600]=L[62592];L[62602]=L[62592];L[62604]=L[62592];L[62606]=L[62592];L[62610]=L[62608];L[62612]=L[62608];L[62614]=L[62608];L[62616]=L[62608];L[62618]=L[62608];L[62620]=L[62608];L[62622]=L[62608];L[62626]=L[62624];L[62628]=L[62624];L[62630]=L[62624];L[62632]=L[62624];
|
|
L[62634]=L[62624];L[62636]=L[62624];L[62638]=L[62624];L[62642]=L[62640];L[62644]=L[62640];L[62646]=L[62640];L[62648]=L[62640];L[62650]=L[62640];L[62652]=L[62640];L[62654]=L[62640];L[62658]=L[62656];L[62660]=L[62656];L[62662]=L[62656];L[62664]=L[62656];L[62666]=L[62656];L[62668]=L[62656];L[62670]=L[62656];L[62674]=L[62672];L[62676]=L[62672];L[62678]=L[62672];L[62680]=L[62672];L[62682]=L[62672];L[62684]=L[62672];L[62686]=L[62672];L[62690]=L[62688];L[62692]=L[62688];L[62694]=L[62688];L[62696]=L[62688];
|
|
L[62698]=L[62688];L[62700]=L[62688];L[62702]=L[62688];L[62706]=L[62704];L[62708]=L[62704];L[62710]=L[62704];L[62712]=L[62704];L[62714]=L[62704];L[62716]=L[62704];L[62718]=L[62704];L[65410]=L[65408];L[65412]=L[65408];L[65414]=L[65408];L[65416]=L[65408];L[65418]=L[65408];L[65420]=L[65408];L[65422]=L[65408];L[65426]=L[65424];L[65428]=L[65424];L[65430]=L[65424];L[65432]=L[65424];L[65434]=L[65424];L[65436]=L[65424];L[65438]=L[65424];L[65442]=L[65440];L[65444]=L[65440];L[65446]=L[65440];L[65448]=L[65440];
|
|
L[65450]=L[65440];L[65452]=L[65440];L[65454]=L[65440];L[65458]=L[65456];L[65460]=L[65456];L[65462]=L[65456];L[65464]=L[65456];L[65466]=L[65456];L[65468]=L[65456];L[65470]=L[65456];L[65506]=L[65504];L[65508]=L[65504];L[65510]=L[65504];L[65512]=L[65504];L[65514]=L[65504];L[65516]=L[65504];L[65518]=L[65504];Ta(function(){for(var a=B(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=z(d);switch(c.type){case "default":c=new K(c);A(c,d);break;case "pc11":c=new wc(c),A(c,d)}}});var xc;
|
|
if(sb){var yc=new ArrayBuffer(2);(new DataView(yc)).setUint16(0,256,!0);xc=256===(new Uint16Array(yc))[0]}else xc=!1;var zc=xc;
|
|
function I(a,b,c,d,e,f){this.w=a;this.id=Ac+=2;this.b=null;this.B=b;this.xb=c;this.size=d||0;this.type=e||Bc;this.f=e==Cc;this.controller=null;Sb(this);this.Ja=this.pc=!1;if(d)if(f)this.controller=f,this.b=null,Dc(this,f.mc);else if(sb)this.A=new ArrayBuffer(d),this.F=new DataView(this.A,0,d),this.C=new Uint8Array(this.A,0,d),this.J=new Uint16Array(this.A,0,d>>1),this.b=new Int32Array(this.A,0,d>>2),Dc(this,zc?Ec:Fc);else{this.b=Array(d>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;Dc(this,Gc)}else Dc(this)}
|
|
var Bc=0,Cc=2,Zb=4,bc=["NONE","RAM","ROM","VID","H/W"],Ac=0;
|
|
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(sb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.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.Ja=!0}return!1},Sa:function(a,b){b?this.I++||Hc(this,Ic,!1):this.g++||Jc(this,Ic,!1)},K:function(){this.i&&D(this.i,128)&&(C(this.i,"attempt to read invalid block %"+
|
|
l(this.B),!0),this.i.aa());return 255},D:function(a,b){this.i&&D(this.i,128)&&(C(this.i,"attempt to write "+l(b,4,!0)+" to invalid block %"+l(this.B),!0),this.i.aa())},M:function(a,b){return this.Hb(a++,b++)|this.Hb(a,b)<<8},H:function(a,b,c){this.Kb(a++,b&255,c++);this.Kb(a,b>>8,c)},U:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ma:function(a,b){a&1&&gc(this.w,b);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+1]&255)<<8},sa:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=
|
|
this.b[c]&~(255<<a)|b<<a;this.Ja=!0},Za:function(a,b,c){a&1&&gc(this.w,c);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Ja=!0},O:function(a,b){if(this.i&&null!=this.B){var c=this.i;Kc(c,this.B+a,1,c.M)&&c.aa(!0)}return this.Nb(a,b)},ca:function(a,b){if(this.i&&null!=this.B){var c=this.i;Kc(c,this.B+a,2,c.M)&&c.aa(!0)}return this.Ob(a,b)},qa:function(a,b,c){if(this.i&&null!=this.B){var d=this.i;Kc(d,this.B+a,
|
|
1,d.C)&&d.aa(!0)}this.f?this.D(a,b,c):this.Tb(a,b,c)},xa:function(a,b,c){if(this.i&&null!=this.B){var d=this.i;Kc(d,this.B+a,2,d.C)&&d.aa(!0)}this.f?this.D(a,b,c):this.Ub(a,b,c)},N:function(a){return this.C[a]},P:function(a,b){a=this.C[a];this.i&&D(this.i,128)&&C(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ba:function(a,b){a&1&&gc(this.w,b);return this.F.getUint16(a,!0)},fa:function(a,b){a&1&&gc(this.w,b);a=this.J[a>>1];this.i&&D(this.i,128)&&C(this.i,"Memory.readWord("+
|
|
J(this.i,b)+"): "+J(this.i,a),!0);return a},pa:function(a,b){this.C[a]=b;this.Ja=!0},Ra:function(a,b,c){this.C[a]=b;this.Ja=!0;this.i&&D(this.i,128)&&C(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},wa:function(a,b,c){a&1&&gc(this.w,c);this.F.setUint16(a,b,!0);this.Ja=!0},ya:function(a,b,c){a&1&&gc(this.w,c);this.J[a>>1]=b;this.Ja=!0;this.i&&D(this.i,128)&&C(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0)}};
|
|
function Sb(a,b,c){a.i=b;a.g=a.I=0;c&&((a.g=c.g)&&Jc(a,Ic,!1),(a.I=c.I)&&Hc(a,Ic,!1))}function Lc(a,b){b?--a.I||(a.Kb=a.f?a.D:a.Tb,a.yb=a.f?a.H:a.Ub):--a.g||(a.Hb=a.Nb,a.oa=a.Ob)}function Hc(a,b,c){c&&a.I||(a.Kb=!a.f&&b[1]||a.D,a.yb=!a.f&&b[3]||a.H);if(c||void 0===c)a.Tb=b[1]||a.D,a.Ub=b[3]||a.H}function Jc(a,b,c){c&&a.g||(a.Hb=b[0]||a.K,a.oa=b[2]||a.M);if(c||void 0===c)a.Nb=b[0]||a.K,a.Ob=b[2]||a.M}function Dc(a,b){b||(b=Mc);Jc(a,b,void 0);Hc(a,b,void 0)}
|
|
var Mc=[],Gc=[I.prototype.U,I.prototype.sa,I.prototype.ma,I.prototype.Za],Ic=[I.prototype.O,I.prototype.qa,I.prototype.ca,I.prototype.xa];if(sb)var Fc=[I.prototype.N,I.prototype.pa,I.prototype.ba,I.prototype.wa],Ec=[I.prototype.P,I.prototype.Ra,I.prototype.fa,I.prototype.ya];
|
|
function Nc(a,b){r.call(this,"CPU",a,Nc,1);var c=a.multiplier||1;this.Ga=a.cycles||b;this.Ma=c;this.ab=Math.round(this.Ga/1E4)/100;this.Wa=this.ab*this.Ma;this.v.da=!1;this.v.Rb=!1;this.v.pb=a.autoStart;this.v.cb=!1;this.sb=this.ma=0;this.tb=a.csStart;this.gb=a.csInterval;this.hb=a.csStop;this.K=[];this.Fb=this.fd.bind(this);H(this)}u(Nc);var Oc=["power","reset"];k=Nc.prototype;
|
|
k.Ca=function(a,b,c,d){this.D=a;this.w=b;this.i=d;for(b=0;b<Oc.length;b++)(c=this.I[Oc[b]])&&this.D.ra(null,Oc[b],c);a=Pc(a,"autoStart");null!=a&&(this.v.pb="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){Qc(this);if(!this.restore(a))return!1;Rc(this)}else this.reset();this.i?(a=this.i,a.$a=!0,a.j("Type ? for help with PDP11 Debugger commands"),a.$(),a.Ga&&(b=a.Ga,a.Ga=null,Sc(a,b))):this.j("No debugger detected")}this.D.$();return!0};k.za=function(a){return a?this.save():!0};k.pb=function(){return this.v.pb||!this.i&&void 0===this.I.run?(this.lb(!0),!0):!1};k.$b=function(){return 0};
|
|
function Rc(a){void 0===a.tb&&(a.tb=0);void 0===a.gb&&(a.gb=-1);void 0===a.hb&&(a.hb=-1);a.v.cb=0<=a.tb&&0<a.gb;a.v.cb&&(a.sb=0,a.ma=a.tb-a.fa)}function Tc(a,b){if(a.v.cb){var c=!1;a.sb=a.sb+a.$b()|0;a.ma-=b;0>=a.ma&&(a.ma+=a.gb,c=!0);0<=a.hb&&a.hb<=Uc(a)&&(a.gb=a.hb=-1,Rc(a),a.aa(),c=!0);c&&a.j(Uc(a)+" cycles: checksum="+l(a.sb))}}
|
|
k.ra=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.D)if(a=d.D,a.v.ga)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.ga);c++);c==h.length&&(b=a);n("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.Bb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.da?d.aa():d.lb())},
|
|
!0;case "speed":return this.I[b]=c,!0;case "setSpeed":return this.I[b]=c,c.onclick=function(){Vc(d,d.Ma<<1,!0)},c.textContent=this.Wa.toFixed(2)+"Mhz",!0}return!1};k.$=function(){var a=this.I.speed;a&&(a.textContent=this.v.da&&this.U?this.U.toFixed(2)+"Mhz":"Stopped")};function Wc(a,b,c){a.fa+=b;c&&(a.ca=a.b=0)}function Xc(a,b){var c=1;b&&1<a.Ma&&a.U&&(c=a.U/a.ab);a.Cb=Math.round(1E3/30);a.Qa=Math.floor(a.Ga/30*c);b||(a.pa=a.Qa);a.eb=0}function Uc(a){return a.fa+a.O+a.ca-a.b}
|
|
function Qc(a){a.U=0;a.Eb=0;a.fa=a.O=a.ca=a.b=0;Rc(a);Vc(a,1)}function Vc(a,b,c){var d=!1;if(void 0!==b){.8>a.U/a.Wa?b=1:d=!0;a.Ma=b;b=a.ab*a.Ma;if(a.Wa!=b){a.Wa=b;b=a.Wa.toFixed(2)+"Mhz";var e=a.I.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.D&&a.D.wb()}Wc(a,a.O);a.O=0;a.N=za();a.ba=0;Xc(a);return d}function hc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function jc(a,b,c,d){0<=b&&b<a.K.length&&(d||0>a.K[b][0])&&(c=a.Ga*a.Ma/1E3*c|0,a.K[b][0]=c+Yc(a))}
|
|
function Zc(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function $c(a,b){for(var c=a.K.length-1;0<=c;c--){var d=a.K[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Yc(a,b){var c=a.ca-=a.b;a.b=0;b&&(a.ca=0);return c}
|
|
k.fd=function(){if(this.v.da){this.eb>=this.Ga&&Xc(this,!0);this.sa=0;this.Fa=za();if(this.ba){var a=this.Fa-this.ba;a>this.Cb&&(this.N+=a,this.N>this.Fa&&(this.N=this.Fa))}try{do{var b=Zc(this,this.v.cb?1:this.Qa);try{this.mb(b)}catch(e){if("number"!=typeof e)throw e;}b=Yc(this,!0);this.sa+=b;this.O+=b;Tc(this,b);$c(this,b);this.pa-=b;if(0>=this.pa){this.pa+=this.Qa;15<=++this.Eb&&(this.D&&this.D.$(),this.Eb=0);break}}while(this.v.da)}catch(e){this.aa();this.D&&this.D.stop(za(),Uc(this));rb(this,
|
|
e.stack||e.message);return}if(this.v.da){a=setTimeout;b=this.Fb;this.ba=za();var c=this.Cb;this.sa&&(c=Math.round(c*this.sa/this.Qa));var c=c-(this.ba-this.Fa),d=this.ba-this.N;d&&(this.U=Math.round(this.O/(10*d))/100,864E5<=d&&(this.fa=0,Vc(this)));if(0>c||this.U<this.Wa)-1E3>c&&(this.N-=c),c=0;this.eb+=this.sa;this.ba+=c;a(b,c)}}};
|
|
k.lb=function(a){if(qb(this))return!1;if(this.v.da)return this.j(this.toString()+" busy"),!1;Vc(this);this.v.da=!0;this.v.Rb=!0;var b=this.I.run;b&&(b.textContent="Halt");this.D&&(a&&this.D.wb(!0),this.D.start(this.N,Uc(this)));setTimeout(this.Fb,0);return!0};k.mb=function(){return 0};k.aa=function(a){if(this.v.da){Yc(this);Wc(this,this.O);this.O=0;this.v.da=!1;var b=this.I.run;b&&(b.textContent="Run");this.D&&this.D.stop(za(),Uc(this))}this.v.complete=a};
|
|
function ad(a){this.fb=+a.model||1170;this.zb=a.addrReset||0;Nc.call(this,a,6666667);this.decode=1120==this.fb?bd.bind(this):cd.bind(this);dd(this);this.A=0;this.P=null;this.v.complete=this.v.oc=!1}u(ad,Nc);k=ad.prototype;k.reset=function(){this.status("model "+this.fb);this.v.da&&this.aa();dd(this);Qc(this);this.v.error=!1;this.parent.reset.call(this)};
|
|
function dd(a){a.R=65536;a.S=32768;a.X=65535;a.V=32768;a.L=15;a.u=[0,0,0,0,0,0,0,a.zb];a.Ea=[0,0,0,0,0,0];a.va=[0,0,0,0];a.C=0;a.xa=0;a.sc=[4,2,0,1];a.T=[[0,0,0,0,0,0,0,0,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.uc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.gc=[0,0,0,0,0,0,0,0];a.fc=0;a.G=0;a.H=a.J=0;a.g=a.f=a.$a=0;a.qa=-1;ed(a)}function ed(a){a.Pa=255;a.Z=0;a.Qb=0;a.F=0;a.Na=0;a.vb=0;a.Oa=0;a.La=0;a.wa=0;a.bb=262143;a.ya=253952;a.G|=2;a.w&&tc(a)}function tc(a){a.La?(a.M=65536,a.Y=a.rc,a.oa=a.cd,a.yb=a.Pd,Vb(a.w,a.Oa&16?22:18)):(a.M=0,a.Y=a.qc,a.oa=a.ec,a.yb=a.kc,Vb(a.w,16))}function fd(a,b){a.zb=b;N(a,b);a.i&&(a.aa(),a.i.$())}k.$b=function(){return 0};
|
|
k.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.fa,this.Ma]);a.set(2,cc(this.w));return a.data()};k.restore=function(a){var b=a[1];this.fa=b[1];Vc(this,b[3]);a:{b=this.w;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.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.W[d];if(!f||!f.restore(e)){n("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function gd(a){return a.R&65536?1:0}
|
|
function hd(a){return a.S&32768?2:0}function id(a){return a.X&65535?0:4}k.Da=function(){return this.V&32768?8:0};function jd(a){var b=a.u[7];a.F&57344||(a.Na=0,a.vb=b);a.u[7]=b+2&65535;return a.oa(b)}function Dd(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{jd:a,ib:b,next:null}}function ic(a,b){if(b!=a.P){var c=a.P;if(!c||c.ib<=b.ib)b.next=c,a.P=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.L=a.L&63728|a.Da()|id(a)|hd(a)|gd(a)}function vc(a,b){a.V=b<<12;a.X=~b&4;a.S=b<<14;a.R=b<<16;if((b^a.L)&2048)for(var c=a.Ea.length;0<=--c;){var d=a.u[c];a.u[c]=a.Ea[c];a.Ea[c]=d}a.C=b>>14&3;c=a.L>>14&3;a.C!=c&&(a.va[c]=a.u[6],a.u[6]=a.va[a.C]);a.L=b;a.G|=2}function P(a,b){a.G&128||(a.V=a.X=b,a.S=0)}function Ed(a,b,c){a.G&128||(a.V=a.X=a.R=b,a.S=c||0)}function Fd(a,b,c,d){a.G&128||(a.V=a.X=a.R=b,a.S=(c^b)&(d^b))}function Gd(a,b){a.G&128||(a.V=a.X=a.R=b,a.S=a.V^a.R>>1)}
|
|
function Hd(a,b,c,d){a.G&128||(a.V=a.X=a.R=b,a.S=(c^d)&(d^b))}k.ea=function(a,b){if(!this.A){var c=!1;0>this.qa?this.qa=Lb(this):this.C||(a=4,c=!0);this.F&57344||(this.Na=63222,this.vb=a);this.C=0;var d=this.oa(a|this.M),e=this.oa(a+2&65535|this.M);vc(this,e&-12289|this.qa>>2&12288);c&&(this.Z|=4,this.u[6]=4);Id(this,this.qa);Id(this,this.u[7]);N(this,d);this.G&=-113;this.qa=-1;if(26!=b)throw a;}};function Jd(a){var b=Kd(a),c=Kd(a)&-1793;a.L&49152&&(c=c&-225|a.L&63712);N(a,b);vc(a,c);a.G&=-17}
|
|
function Ld(a,b,c){var d,e,f,g=0;d=b>>13;a.Oa&a.sc[a.C]||(d&=7);e=a.T[a.C][d];f=(a.ta[a.C][d]<<6)+(b&8191)&a.bb;if(f<a.ya)f&1&&!(c&1)&&(a.Z|=64,a.ea(4,10));else if(a.Oa&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var h=f>>13&31;31>h?a.Oa&32&&(f=a.uc[h]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.ya&&4186112>f&&(a.Z|=32,a.ea(4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?
|
|
192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.T[a.C][d]=e;if(4194170!==f||a.C)a.wa=a.C,a.xa=d;g&&(g&57344&&(0<=a.qa&&(g|=128),a.F&57344||(a.F=a.F|g|a.wa<<5|a.xa<<1),a.ea(168,16)),a.F&61440||!(4191360>f||4194239<f)||(a.F|=4096,a.F&512&&(a.G|=32)));return f}function Md(a,b){return a.w.qb(b)}function Nd(a,b,c){b&1&&a.b--;a.w.Ib(b,c&255)}function Kd(a){var b=a.oa(a.u[6]|a.M);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.F&57344||(a.Na=a.Na<<8|246);!a.C&&c<=a.Pa&&4<c&&(c<=a.Pa-32?(a.Z|=4,a.u[6]=4,a.ea(4,18)):(a.Z|=8,a.G|=4));a.yb(c,b)}
|
|
function Od(a,b,c,d){var e,f,g=d&8?0:a.M;switch(b){case 0:return a.ea(4,20),0;case 1:return 6===c&&!a.C&&d&4&&(a.u[6]<=a.Pa||65534<=a.u[6])&&(a.u[6]<=a.Pa-32||65534<=a.u[6]?(a.Z|=4,a.u[6]=4,a.ea(4,22)):(a.Z|=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.oa(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.oa(e)|g;
|
|
a.b-=8;break;case 6:return e=a.oa(Dd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.oa(Dd(a,2)),e=e+a.u[c]&65535,e=a.oa(e|a.M)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.F&57344||(a.Na=a.Na<<8|f<<3&248|c);6==c&&!a.C&&d&4&&0>=f&&(a.u[6]<=a.Pa||65534<=a.u[6])&&(a.u[6]<=a.Pa-32?(a.Z|=4,a.u[6]=4,a.ea(4,24)):(a.Z|=8,a.G|=64));return e}k.Db=function(a){if(!this.La)return this.w.Db(a);this.A++;a=Md(this,Ld(this,a,3));this.A--;return a};
|
|
k.rb=function(a){if(!this.La)return this.w.rb(a);this.A++;a=this.ec(Ld(this,a,2));this.A--;return a};k.Xa=function(a,b){this.La?(this.A++,Nd(this,Ld(this,a,5),b),this.A--):this.w.Xa(a,b)};k.Jb=function(a,b){this.La?(this.A++,this.kc(Ld(this,a,4),b),this.A--):this.w.Jb(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.ec=function(a){return this.w.na(a)};k.cd=function(a){return this.w.na(Ld(this,a,2))};k.kc=function(a,b){this.w.Ya(a,b&65535)};
|
|
k.Pd=function(a,b){this.w.Ya(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.L&61440)&&(d&=65535),a.C=a.L>>12&3,c=a.oa(d|c&a.M),a.C=a.L>>14&3):c=6!=d||(a.L>>2&12288)===(a.L&12288)?a.u[d]:a.va[a.L>>12&3];return c}function Qd(a,b,c,d){a.F&57344||(a.Na=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=Od(a,b,e,4),c&65536||(e&=65535),a.C=a.L>>12&3,e=Ld(a,e|c&65536,4),a.C=a.L>>14&3,a.w.Ya(e,d)):6!=e||(a.L>>2&12288)===(a.L&12288)?a.u[e]=d:a.va[a.L>>12&3]=d}
|
|
function Rd(a,b){b>>=6;var c=a.J=b&7;return(b=a.H=(b&56)>>3)?Md(a,a.Y(b,c,3)):a.u[c]&255}function Sd(a,b){b>>=6;var c=a.J=b&7;return(b=a.H=(b&56)>>3)?a.w.na(a.Y(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.Y(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.na(a.Y(b,c,2)):a.u[c]}
|
|
function Q(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.$a=a.Y(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.Y(b,e,6),a.w.Ya(e,d.call(a,c,a.w.na(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.Y(b,e,5),c):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}function Xd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.Ya(a.Y(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.mb=function(a){this.v.complete=!0;var b=this.v.oc=this.i&&Yd(this.i),c=a?this.v.Rb?0:1:-1;this.v.Rb=!1;this.ca=this.b=a;do{if(b){if(Zd(this.i,this.u[7],c)){this.aa();break}c=1}if(this.G&&(this.G&112&&(this.G&32?this.ea(168,28):this.G&64?this.ea(4,30):this.G&16&&this.ea(12,32),this.G&=-113),this.G&7))if(this.G&2){this.G&=-3;var d=160,e=(this.Qb&224)>>5;if(a=this.P&&this.P.ib>e?this.P:null)d=a.jd,e=a.ib;e>(this.L&224)>>5?(this.G&4&&(Dd(this,2),this.G&=-5),this.ea(d,26),e=!0):e=!1;if(e&&a)if(e=this.P,
|
|
e==a)this.P=a.next;else for(;e;){d=e.next;if(d==a){e.next=d.next;break}e=d}}else this.G&1&&this.G++;this.G=this.G&7|this.L&16;this.decode(jd(this))}while(0<this.b);return this.v.complete?this.ca-this.b:void 0===this.v.complete?0:-1};Ta(function(){for(var a=B(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new ad(d);A(d,c)}});function $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;Ed(this,a);return a&65535}
|
|
function ke(a,b){a=~b|256;Ed(this,a<<8);return a&255}function le(a,b){a=b-a;this.G&128||(this.V=this.X=a,this.S=b&(b^a));return a&65535}function me(a,b){a=b-a;var c=a<<8;b<<=8;this.G&128||(this.V=this.X=c,this.S=b&(b^c));return a&255}function ne(a,b){a=b+a;this.G&128||(this.V=this.X=a,this.S=a&(b^a));return a&65535}function oe(a,b){a=b+a;var c=a<<8;this.G&128||(this.V=this.X=c,this.S=c&(b<<8^c));return a&255}function pe(a,b){a=-b;Ed(this,a,a&b&32768);return a&65535}
|
|
function qe(a,b){a=-b;Ed(this,a<<8,(a&b&128)<<8);return a&255}function re(a,b){a=b<<1|this.R>>16&1;Gd(this,a);return a&65535}function se(a,b){a=b<<1|this.R>>16&1;Gd(this,a<<8);return a&255}function te(a,b){a=(this.R&65536|b)>>1|b<<16;Gd(this,a);return a&65535}function ue(a,b){a=((this.R&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.V=this.X=b&65280,this.S=this.R=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.J&&6<=this.f?1:0):(this.H?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.R=this.S=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.R=c<<17-b,c>>=b;else if(b)if(16<b)this.S=c,c=0;else{this.R=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.S=32768)}this.u[a]=c&65535;this.V=this.X=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.R=this.S=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.R=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.R=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.S=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.V=d>>16;this.X=d>>16|d;this.b-=(this.g?6:7)+b}function Ce(a){S(this,a,!gd(this))}function De(a){S(this,a,gd(this))}
|
|
function Ee(a){R(this,a,Sd(this,a),fe);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function Fe(a){Q(this,a,Rd(this,a),ge);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function Ge(a){R(this,a,Sd(this,a),he);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function He(a){Q(this,a,Rd(this,a),ie);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}
|
|
function Ie(a){P(this,Sd(this,a)&Vd(this,a));this.b-=this.g?4+(this.J&&6<=this.f?1:0):(this.H?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.J&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)}function Ke(a){S(this,a,id(this))}function Le(a){S(this,a,!this.Da()==!hd(this))}function Me(a){S(this,a,!id(this)&&!this.Da()==!hd(this))}function Ne(a){S(this,a,!gd(this)&&!id(this))}function Oe(a){S(this,a,id(this)||!this.Da()!=!hd(this))}
|
|
function Pe(a){S(this,a,gd(this)||id(this))}function Qe(a){S(this,a,!this.Da()!=!hd(this))}function Re(a){S(this,a,this.Da())}function Se(a){S(this,a,!id(this))}function Te(a){S(this,a,!this.Da())}function Ue(){this.ea(12,1);this.b-=5}function Ve(a){S(this,a,!0)}function We(a){S(this,a,!hd(this))}function Xe(a){S(this,a,hd(this))}function T(a){a&1&&(this.R=0);a&2&&(this.S=0);a&4&&(this.X=1);a&8&&(this.V=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.J&&6<=this.f?1:0):(this.H?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.J&&6<=this.f?1:0):(this.H?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.R=this.S=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.X=d>>16|d,this.V=d>>16):(this.S=32768,this.X=d>>15|d,this.V=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.X=this.V=0,this.S=32768,this.R=65536,this.b-=7}function af(){this.ea(24,2);this.b-=25}
|
|
function bf(){this.L&49152?(this.Z|=128,this.ea(4,3)):this.i?$b(this.i):this.aa();this.b-=7}function cf(){this.ea(16,4);this.b-=25}var df=[0,7,7,10,7,11,9,13];function ef(a){var b=this.b;N(this,Td(this,a));this.b=b-df[this.g]}var ff=[0,14,14,17,14,18,16,20];function gf(a){var b=this.b,c=Td(this,a);a=a>>6&7;Id(this,this.u[a]);this.u[a]=this.u[7];N(this,c);this.b=b-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),c=this.b;P(this,Xd(this,a,b));this.b=c-hf[(this.H?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.J&&6<=this.f?1:0):(this.H?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.V=b>>16,this.X=this.V|b,this.S=0,this.R=-32768>b||32767<b?65536:0);this.b-=23}function nf(){this.b-=5}function of(){this.L&49152||(ed(this),this.w.reset());this.b-=667}function pf(){Jd(this);this.G|=this.L&16;this.b-=13}function qf(a){if(a&8)V.call(this,a);else{var b=Kd(this);a&=7;N(this,this.u[a]);this.u[a]=b;this.b-=9}}
|
|
function W(a){a&1&&(this.R=65536);a&2&&(this.S=32768);a&4&&(this.X=0);a&8&&(this.V=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.J&&6<=this.f?1:0):(this.H?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.ea(28,5);this.b-=5}function vf(){this.G&4||this.D.$();this.G|=4;Dd(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 V(a){var b;if(b=this.i)b=this.i,C(b,"undefined opcode "+J(b,a),!0,!0),b=$b(b);b||this.ea(8,6)}function bd(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,V,function(a){Pf[a>>8&15].call(this,a)},kf,Ze,Je,Fe,He,sf,V],Of=[function(a){Qf[a>>4&15].call(this,a)},Ve,Se,Ke,Le,Qe,Me,Oe,gf,gf,yf,Af,Cf,V,V,V],zf=[function(a){Ed(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,gd(this)?1:0,$d);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,gd(this)?1:0,ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Vd(this,a);Ed(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)},V,V,V,ef,ef,ef,ef,qf,V,Ef,Gf,tf,tf,tf,tf],Rf=[bf,vf,pf,Ue,cf,of,V,V,V,V,V,V,V,V,V,V],Ff=[nf,function(){this.R=0;this.b-=5},function(){this.S=0;this.b-=5},T,function(){this.X=1;this.b-=5},T,T,T,function(){this.V=0;this.b-=5},T,T,T,T,T,T,T],Hf=[nf,function(){this.R=65536;this.b-=5},function(){this.S=32768;this.b-=5},W,function(){this.X=0;this.b-=5},W,W,W,function(){this.V=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,V,V,V],Jf=[function(a){Ed(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,gd(this)?1:0,ae);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,gd(this)?1:0,we);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Ud(this,a);Ed(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.$a&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.$a&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 cd(a){kg[a>>12].call(this,a)}
|
|
var kg=[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,V],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)},V,V],pg=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.oa(a|this.M);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),c=
|
|
this.b;Qd(this,a,0,b);P(this,b);this.b=c-lf[this.g]},function(a){P(this,Xd(this,a,this.Da?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],og=[function(a){qg[a&15].call(this,a)},V,V,V,ef,ef,ef,ef,qf,function(a){a&8?(this.L&49152||(this.L=this.L&-2017|(a&7)<<5,this.G|=1),this.b-=5):V.call(this,a)},Ef,Gf,tf,tf,tf,tf],qg=[bf,vf,pf,Ue,cf,of,function(){Jd(this);this.b-=13},V,V,V,V,V,V,V,V,V],mg=[mf,mf,$e,$e,Ae,Ae,Be,Be,wf,wf,V,V,V,V,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)},V,V],rg=[V,function(a){a=Pd(this,a,65536);Id(this,a);P(this,a);this.b-=11},function(a){var b=Kd(this),c=this.b;Qd(this,a,65536,b);P(this,b);this.b=c-lf[this.g]},V];
|
|
function sg(a){r.call(this,"ROM",a,sg);this.ka=this.f=null;this.C=a.addr;this.g=a.size;this.A=a.alias;this.D=a.file;this.F=oa(this.D);if(this.D){a=this.D;var b=pa(this.F);"json"!=b&&"hex"!=b&&(a=ra()+"/api/v1/dump?file="+this.D+"&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.Ra,a,b),(a=Ca(a,b))?(c.f=a.ha,c.ka=a.ka):c.D=null,tg(c))})}}u(sg);sg.prototype.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;tg(this)};
|
|
sg.prototype.Aa=function(){if(this.ka){if(this.i){var a=this.i,b=this.id,c=this.C,d=this.g,e=this.ka,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=ya(q,m,a.Wb);0>v&&q.splice(-(v+1),0,m)}p&&(h.a=p.replace(/''/g,'"'))}a.F.push({Ud:b,B:c,vc:d,ka:e,Vb:f})}delete this.ka}return!0};sg.prototype.za=function(){return!0};
|
|
function tg(a){if(!pb(a)){if(a.D){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,Cc)){var c;for(c=0;c<a.f.length;c++)a.w.Xa(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=B(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new sg(d);A(d,c)}});
|
|
function ug(a){r.call(this,"RAM",a,ug);this.ka=this.g=null;this.A=a.addr;this.C=a.size;this.Ua=a.load;this.Ta=a.exec;this.D=!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.Ra,a,b),(a=Ca(a,b))?(c.g=a.ha,c.ka=a.ka,null==c.Ua&&(c.Ua=a.Ua),null==c.Ta&&(c.Ta=a.Ta)):c.f=null,vg(c))})}}u(ug);
|
|
ug.prototype.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;vg(this)};ug.prototype.Aa=function(){return!0};ug.prototype.za=function(){return!0};function vg(a){if(a.w&&(!a.D&&a.C&&Yb(a.w,a.A,a.C,1)&&(a.D=!0),!pb(a))){if(!a.D)n("No RAM allocated");else if(a.f){if(!a.g||!a.w)return;wg(a,a.g,a.Ua,a.Ta,a.A);delete a.g}H(a)}}ug.prototype.reset=function(){};
|
|
function wg(a,b,c,d,e){var f=!1;if(null==c)for(var g=0;g<b.length-1;){var h=b[g]&255|(b[g+1]&255)<<8;if(h)if(h&255){if(1!=h)break;if(g+6>=b.length)break;for(var g=g+2,m=b[g++]&255|(b[g++]&255)<<8,p=b[g++]&255|(b[g++]&255)<<8,h=h+((m&255)+(m>>8)+(p&255)+(p>>8)),q=g,v=m-=6;0<m&&g<b.length;)h+=b[g++]&255,m--;if(m||g>=b.length)break;h+=b[g++]&255;if(h&255)break;if(v)for(;v--;)a.b.Xa(p++,b[q++]&255);else p&1?a.b.aa():fd(a.b,p);f=!0}else g++;else g+=2}if(!f&&(null==c&&(c=e),null!=c)){for(e=0;e<b.length;e++)a.b.Xa(c+
|
|
e,b[e]);null!=d&&fd(a.b,d);f=!0}return f}Ta(function(){for(var a=B(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new ug(d);A(d,c)}});function xg(a){r.call(this,"Keyboard",a,xg,65536);H(this)}u(xg);xg.prototype.ra=function(){return!1};xg.prototype.Ca=function(a,b,c,d){this.D=a;this.b=c;this.i=d};Ta(function(){for(var a=B(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new xg(d);A(d,c)}});
|
|
function X(a){this.A=this.F=null;this.O=a.tabSize;this.M=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=yg;b&&(void 0===c&&(c="Panel"),(c=mb(c,this.id))&&(b=c.I[b])&&this.ra(null,a,b))}this.J=this.K=null;this.exports={connect:this.cc,receiveData:this.Pb}}u(X);var yg="buffer";k=X.prototype;
|
|
k.ra=function(a,b,c){var d=this;switch(b){case yg: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.Ca=function(a,b,c,d){this.D=a;this.w=b;this.b=c;this.i=d;var e=this;this.ba=kc(48,4);this.P=hc(this.b,function(){e.f&128||!e.C.length||(e.N=e.C.shift(),e.f|=128,e.f&64&&ic(e.b,e.ba))});this.ca=kc(52,4);this.U=hc(this.b,function(){e.g|=128;e.g&64&&ic(e.b,e.ca)});ec(b,this,zg);H(this)};
|
|
k.cc=function(){if(!this.J){var a=Pc(this.D,"connection");if(a){var b=a.split("->");if(2==b.length){var c=va(b[0]);if(c!=this.Za)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.K=d.receiveData){this.status(this.Ra+"."+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(){Ag(this)};k.save=function(){var a=new O(this);a.set(0,[]);return a.data()};k.restore=function(){return Ag(this)};function Ag(a){a.N=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.P,1);return!0};k.Sc=function(){return this.f&65535};k.Ed=function(a){this.f=this.f&-112|a&111};
|
|
k.Rc=function(){this.f&=-129;0<this.C.length&&jc(this.b,this.P,1);return this.N};k.Dd=function(){};k.ed=function(){return this.g};k.Rd=function(a){128==(this.g&192)&&a&64&&jc(this.b,this.U,1);this.g=this.g&-70|a&69};k.dd=function(){return 0};
|
|
k.Qd=function(a){if(a&=255){C(this,"transmitByte("+l(a,2,!0)+")");this.K&&this.K.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.O||8,c=a-this.H%a,this.O&&(b=ua("",c)));this.M&&!this.H&&c&&(b=String.fromCharCode(this.M)+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.U,1)}};var Bg={},zg=(Bg[65392]=[null,null,X.prototype.Sc,X.prototype.Ed,"RCSR"],Bg[65394]=[null,null,X.prototype.Rc,X.prototype.Dd,"RBUF"],Bg[65396]=[null,null,X.prototype.ed,X.prototype.Rd,"XCSR"],Bg[65398]=[null,null,X.prototype.dd,X.prototype.Qd,"XBUF"],Bg);Ta(function(){for(var a=B(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new X(d);A(d,c)}});
|
|
function wc(a){r.call(this,"PC11",a,wc);this.g=a.autoMount||null;this.M=this.J=this.f=this.C=0;this.K=[];this.H=Cg;this.A=Dg;this.F="";this.N=!La("Mobi")&&window&&"FileReader"in window}u(wc);var Cg="",Dg=0;k=wc.prototype;
|
|
k.ra=function(a,b,c){var d=this,e=Dg;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&&Eg(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(this.N)return 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;Eg(d,oa(b,!0),b,1,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
|
|
k.Ca=function(a,b,c,d){this.D=a;this.w=b;this.b=c;this.i=d;this.O=Fg(a);var e=this;if((this.g=Pc(this.D,"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.U=kc(56,4);this.P=hc(this.b,function(){Gg(e)});ec(b,this,Hg);Ig(this,"None",Cg,!0);this.N&&Ig(this,"Local Tape","?");Ig(this,"Remote Tape","??");Jg(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.J=0};function Jg(a){a.C=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?Kg(a,c,b,1,!0):Lg(a)}return!!a.C}
|
|
function Eg(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;Kg(a,b,c,d,!1,e)}else Mg(a,!1)}
|
|
function Kg(a,b,c,d,e,f){var g=-1;if(a.F.toLowerCase()!=c.toLowerCase()||a.A!=d)g++,Mg(a,!0),a.v.Ia?a.ja("PC11 busy"):(e&&(a.C++,D(a)&&C(a,"auto-loading tape: "+b)),Ng(a,b,c,d,f)?g++:a.v.Ia=!0);g&&a.status(1==a.A?"tape attached":"tape loaded")}
|
|
function Ng(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),Og(a,b,c,d,e),a.H="?");Lg(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.D&&!a.D.v.ga;g?a.ja('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(jb(a.Ra,e,f),(e=Ca(e,f))&&Og(a,b,c,d,e.ha,e.Ua,
|
|
e.Ta));a.v.Ia=!1;a.C&&(a.C--,a.C||H(a));Lg(a)})}function Ig(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 Lg(a){var b=a.I.listTapes;if(b&&b.options){a=a.H||a.F;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 Og(a,b,c,d,e,f,g){a.F=c;a.A=d;2==d?a.O&&wg(a.O,e,f,g)?a.status("tape loaded: "+b):(a.F="",a.H=Cg,a.A=Dg,a.status("error loading tape: "+b)):(a.M=0,a.K=e,a.status("tape attached: "+b))}
|
|
function Mg(a,b){if(a.F||!1===b)a.F="",b||(a.A&&a.status(1==a.A?"tape detached":"tape unloaded"),a.H=Cg,a.A=Dg,Lg(a))}k.save=function(){return(new O(this)).data()};k.restore=function(){return!0};function Gg(a){1==(a.f&32769)&&!(a.f&128)&&a.M<a.K.length&&(a.J=a.K[a.M++]&255,a.f|=128,a.f&=-2049,a.f&64&&ic(a.b,a.U),jc(a.b,a.P,1E3/300,!0))}k.Lc=function(){return this.f&65534};k.xd=function(a){a&1&&(this.f&32768?a&=-2:(this.f&=-129,this.f|=2048,this.J=0));this.f=this.f&-66|a&65;Gg(this)};
|
|
k.Kc=function(){this.f&=-129;this.f|=2048;return this.J};k.wd=function(){};var Pg={},Hg=(Pg[65384]=[null,null,wc.prototype.Lc,wc.prototype.xd,"PRS"],Pg[65386]=[null,null,wc.prototype.Kc,wc.prototype.wd,"PRB"],Pg);function Qg(a){r.call(this,"Debugger",a,Qg);this.ma=a.base||16;this.ya=!1;this.N=this.xa=this.H=0;this.P=!1;this.A=-1;this.g=[];this.ba={}}u(Qg);var Rg={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};
|
|
Qg.prototype.ac=function(){return-1};Qg.prototype.bc=function(){};function Sg(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(va(b.substring(c,f))),c=f+1}}return a}
|
|
function Tg(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 Ug(a,b,c){var d;if(b){b=Vg(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=Wg(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&&Rg[q]<Rg[m[m.length-1]]&&Tg(h,m,1);m.push(q);b=b.substr(v+w)}Tg(h,m)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&Xg(a,null,
|
|
d))}return d}function Vg(a,b){for(var c,d=a.ya?"(":"{",e=a.ya?")":"}",f=new RegExp(a.ya?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=Ug(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(;c=b.match(/\$([a-z]+)/i);){d=null;switch(c[1].toLowerCase()){case "ops":d=a.N-a.xa}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
|
|
function Wg(a,b,c,d){var e;if(null!=b){e=a.ac(b);if(0<=e)e=a.bc(e);else if(e=a.ba[b],null==e){e=b;var f=a.ma,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 Xg(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 Yg(a,b){if(b)return Xg(a,b,a.ba[b]);var c=0;for(b in a.ba)Xg(a,b,a.ba[b]),c++;return 0<c}
|
|
function J(a,b,c,d){switch(a.ma){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 Zg(a){Qg.call(this,a);this.$a=!1;this.ya=!0;this.K=Z(0);this.Qa=Z(0);this.O=Z(0);this.F=[];this.f=this.M=this.C=[];$g(this);this.qa=0;ah(this);this.Fa={};bh(this,a.messages);this.Ga=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Sc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Sc(b,a)})}u(Zg,Qg);
|
|
var ch={"?":"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"},dh=".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(" "),
|
|
eh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
|
|
33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106],35072:[107]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,63],35904:[72,
|
|
63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},fh=[0],gh=[58,60,65,96,
|
|
108,110,100,101,102,103,104,105,59,64];k=Zg.prototype;
|
|
k.Ca=function(a,b,c,d){this.w=b;this.b=c;this.D=a;(a=Pc(a,"messages"))&&bh(this,a);this.eb=eh;this.zb=1145>this.b.fb?gh:[];hh(this,function(a){a:{var b=d.w.W,c=a[0],e=a=0,m=b.length;if(c){a=d.Y(ih(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.B,8)+" "+l(q.xb,4,!0)+" "+l(q.size,4,!0)+" "+p),c!=Bc&&(c=-1),p=0);a+=d.w.ua;e++}}});H(this)};
|
|
k.ra=function(a,b,c){var d=this;switch(b){case "debugInput":return this.pa=this.I[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Sc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.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.pa){var a=d.pa.value;
|
|
d.pa.value="";Sc(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.mb(a?1:0),nb(d,!1));return b}),!0}return!1};k.wb=function(){this.pa&&this.pa.focus()};k.Y=function(a){a=a&&a.B;null==a&&(a=-1);return a};k.qb=function(a,b){var c=255,d=this.Y(a,!1,1);-1!==d&&(c=a.Ab?this.w.Db(d):this.b.Db(d),b&&jh(a,b));return c};k.na=function(a,b){var c=65535,d=this.Y(a,!1,2);-1!==d&&(c=a.Ab?this.w.rb(d):this.b.rb(d),b&&jh(a,b));return c};
|
|
k.Ib=function(a,b,c){var d=this.Y(a,!0,1);-1!==d&&(a.Ab?this.w.Xa(d,b):this.b.Xa(d,b),c&&jh(a,c),this.D.$(!0))};k.Ya=function(a,b,c){var d=this.Y(a,!0,2);-1!==d&&(a.Ab?this.w.Jb(d,b):this.b.Jb(d,b),c&&jh(a,c),this.D.$(!0))};function Z(a,b){return{B:a,Ab:b,Ba:!1}}function kh(a){return[a.B,a.Ba]}function lh(a){return{B:a[0],Ba:a[1]}}
|
|
function ih(a,b,c){var d,e=(c?a.K:a.Qa).B;c=!1;if(void 0!==b){b=Vg(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.F.length;e++){var g=a.F[e].ka[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Z(d));break}}if(d=f)return d;e=Ug(a,b,void 0)}null!=e&&(d=Z(e,c));return d}function mh(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.lc=Sg(a,b.hc=c[2]))}function jh(a,b){null!=a.B&&(a.B+=b||1)}
|
|
function bh(a,b){a.i=a;a.la=a.nc=536870912;a.sa=null;a.wa=[];b=Sg(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.la|=tb[c],a.j(c+" messages enabled"))}}function hh(a,b){for(var c in tb)if(64==tb[c]){a.Fa[c]=b;break}}
|
|
k.ac=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 nh(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.bc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ea[a-8]:20>a?b=this.b.va[a-16]:20==a&&(b=Lb(this.b)));return b};
|
|
k.message=function(a,b){b&&(a+=" @"+J(this,Z(this.b.vb).B));this.la&1073741824?this.wa.push(a):this.sa&&a==this.sa||(this.sa=a,this.la&-2147483648&&(this.aa(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,Yc(a),a.pa=0,a.D.$()))};
|
|
function ah(a){var b;if(Yd(a)){if(!a.J||!a.J.length){a.J=Array(1E3);for(b=0;b<a.J.length;b++)a.J[b]=Z();a.fa=0;a.j("instruction history buffer allocated")}if(!a.ca||!a.ca.length)for(a.ca=Array(256),b=0;b<a.ca.length;b++)a.ca[b]=[b,0]}else a.J&&a.J.length&&a.j("instruction history buffer freed"),a.fa=0,a.J=[],a.ca=[]}k.lb=function(a,b){if(!oh(this,b))return!1;this.b.lb(a);return!0};
|
|
k.mb=function(a,b,c){if(!oh(this))return!1;this.H=0;a||Yd(this)&&Zd(this,this.b.u[7],0);try{a=Zc(this.b,a);var d=this.b.mb(a);0<d&&($c(this.b,a),this.H+=d,Wc(this.b,d,!0),Tc(this.b,d),this.N++)}catch(e){"number"!=typeof e&&(this.H=0,rb(this.b,e.stack||e.message))}!1!==c&&this.D.$();this.$(b||!1);return 0<this.H};k.aa=function(a){this.b&&this.b.aa(a)};k.$=function(a){this.$a&&(void 0===a&&(a=!0),this.K=Z(this.b.u[7]),a&&1!=this.U?ph(this):qh(this))};
|
|
function oh(a,b){var c;(c=!a.b||!pb(a.b))||(c=a.b,c.v.ga?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.v.da?(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){ah(this);this.N=this.xa=0;this.sa=null;this.H=0;this.K=Z(this.b.u[7]);this.v.da=!1;rh(this);a||this.$()};
|
|
k.save=function(){var a=new O(this);a.set(0,kh(this.K));a.set(1,kh(this.O));a.set(2,[this.g,this.P,this.la]);a.set(3,this.F);return a.data()};k.restore=function(a){var b=0;void 0!==a[2]&&(this.K=lh(a[b++]),this.O=lh(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.P=a[b][1],this.la|=a[b][2]);a[3]&&(this.F=a[3]);return!0};k.start=function(a,b){this.U||this.j("running");this.v.da=!0;this.Cb=a;this.Eb=b};
|
|
k.stop=function(a,b){if(this.v.da){this.v.da=!1;this.H=b-this.Eb;if(!this.U){b="stopped";if(this.H){a-=this.Cb;var c=0<a?Math.round(1E3*this.H/a):0;b+=" (";Yd(this)&&(b+=this.N+" opcodes, ",this.xa-=this.N,this.N=0);b+=this.H+" cycles, "+a+" ms, "+c+" hz)"}else D(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}this.$(!0);this.wb();rh(this,this.b.u[7])}};function Yd(a){return 1<a.f.length||!!a.qa}
|
|
function Zd(a,b,c){var d=a.b;if(0<c&&(a.qa&&!--a.qa||Kc(a,b,1,a.f)))return!0;0<=c&&a.ca.length&&(a.N++,null!=a.b.rb(b)&&(b=a.J[a.fa],b.B=d.u[7],b.Ba=!1,++a.fa==a.J.length&&(a.fa=0)));return!1}function $b(a){var b=a.b;if(b.v.da)throw N(b,a.b.vb),a.aa(),-1;return!1}function $g(a){var b,c;a.f=["bp"];if(a.M)for(b=1;b<a.M.length;b++){c=a.M[b];var d=a.w;c=a.Y(c);Lc(d.W[c>>>d.ia],!1)}a.M=["br"];if(a.C)for(b=1;b<a.C.length;b++)c=a.C[b],d=a.w,c=a.Y(c),Lc(d.W[c>>>d.ia],!0);a.C=["bw"];a.ab=0}
|
|
k.Sa=function(a,b,c){var d=!0;c||sh(this,a,b,!1,!0);if(a!=this.f){var e=this.Y(b);if(-1===e)this.j("invalid address: "+J(this,b.B)),d=!1;else{var f=this.w;f.W[e>>>f.ia].Sa(e&f.w,a==this.C)}}d&&(a.push(b),c?b.Ba=!0:(th(this,a,a.length-1,"set"),ah(this)));return d};function sh(a,b,c,d,e){var f=!1;c=a.Y(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.Y(h)&&(!d||h.Ba)){f=!0;h.Ba||e||th(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.w,Lc(d.W[c>>>d.ia],b==a.C));h.Ba||ah(a);break}}return f}
|
|
function uh(a,b){for(var c=1;c<b.length;c++)th(a,b,c);return b.length-1}function th(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.B)+(d?" "+d:c.hc?' "'+c.hc+'"':""))}function rh(a,b){if(void 0!==b)Kc(a,b,1,a.f,!0),a.U=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ba){if(!sh(a,a.f,c,!0))break;b=0}}}
|
|
function Kc(a,b,c,d,e){var f=!1;if(!a.ab++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Ba)for(var m=a.Y(h),p=0;p<c;p++)if(b+p==m){var q,f=!0;h.Ba&&(sh(a,d,h,!0),e=!0);if(q=h.lc){for(var f=!1,v=0;v<q.length;v++)if(!vh(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.da||(f=!0)}if(f){e||th(a,d,g,"hit");break}}}a.ab--;return f}
|
|
function wh(a,b,c,d){var e=Z(b.B),f=a.na(b,2),g,h;for(h in a.eb)if(g=a.eb[h][f&h])break;g||(g=fh);var m=g[0];0<=a.zb.indexOf(m)&&(g=fh,m=g[0]);var p=h="",q=dh[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="",F=E&61440;if(4096==F)w=w.B+((f&255)<<24>>23)&65535,y=J(x,w);else if(8192==F)w=w.B-((f&63)<<1)&65535,y=J(x,w);else if(12288==F)y=J(x,f&7,1);else if(24576==F)y=J(x,f&63,1);else if(F=f&E,E&4032&&(F>>=6,E>>=6),E&63)switch(E=F&7,F&56){case 0:y=
|
|
nh(E);break;case 8:y="@"+nh(E);break;case 16:7>E?y="("+nh(E)+")+":(F=x.na(w,2),y="#"+J(x,F,0,!0));break;case 24:7>E?y="@("+nh(E)+")+":(F=x.na(w,2),y="@#"+J(x,F,0,!0));break;case 32:y="-("+nh(E)+")";break;case 40:y="@-("+nh(E)+")";break;case 48:F=x.na(w,2);y=J(x,F,0,!0)+"("+nh(E)+")";7==E&&(y=[y,J(x,F+w.B&65535)]);break;case 56:F=x.na(w,2),y="@"+J(x,F)+"("+nh(E)+")",7==E&&(y=[y,J(x,F+w.B&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.B)+":";if(-1!==e.B&&-1!==b.B){do if(f+=" "+J(a,a.na(e,2)),null==e.B)break;while(e.B!=b.B)}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="+Uc(a.b).toString()+" cs="+l(a.b.sb)):g+(null!=d?"="+d.toString():""),p&&(g+=" @"+p);return g}function xh(a,b){switch(b){case "N":a=a.b.Da();break;case "Z":a=id(a.b);break;case "V":a=hd(a.b);break;case "C":a=gd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
|
|
function yh(a,b){var c="",d=a.b;8>b?(c=nh(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Ea[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.va[b-16]):20==b&&(c="PS="+J(a,Lb(d)));c&&(c+=" ");return c}function zh(a){var b,c="";for(b=0;6>b;b++)c+=yh(a,b);c=c+"\n"+(yh(a,6)+yh(a,7)+yh(a,20));return c+=xh(a,"T")+xh(a,"N")+xh(a,"Z")+xh(a,"V")+xh(a,"C")}k.Wb=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
|
function Ah(a,b,c){var d=[],e=a.Y(b)>>>0;for(b=0;b<a.F.length;b++){var f=a.F[b],g=f.B>>>0,h=f.vc;if(e>=g&&e<g+h){e=ya(f.Vb,[e-g],a.Wb);0<=e?Bh(a,b,e,d):c&&(e=~e,Bh(a,b,e-1,d),Bh(a,b,e,d));break}}return d}function Bh(a,b,c,d){var e={},f=a.F[b].Vb,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.F[b].ka[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}
|
|
function Ch(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Yg(a)||a.j("no variables"),!0;if(!c[2])return Yg(a,c[1]);if(!c[3])return delete a.ba[c[1]],!0;b=Ug(a,c[3]);return void 0!==b?(a.ba[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
|
|
function Dh(a,b,c){var d=null;if(b=ih(a,b,!0)){a.Y(b);var e=Ah(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.B-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.B)&&(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 ph(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=Ug(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.V=f?32768:0;break;case "Z":d.X=
|
|
f?0:1;break;case "V":d.S=f?32768:0;break;case "C":d.R=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.D.$();a.j("updated registers:")}a.j(zh(a));c&&(a.K=Z(d.u[7]),qh(a,J(a,a.K.B)))}}function Eh(a,b){b=va(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):Xg(a,null,c[2].charCodeAt(0)):Ug(a,b,!0)}
|
|
function Fh(a,b,c){var d="t"!=b;c=Wg(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.mb(e,d,!1)},function(){a.D.$();nb(a,!1)})}
|
|
function qh(a,b,c,d){if(b=ih(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=Wg(a,c.substr(1)),null!=c&&(d=c);else{d=ih(a,c,!0);if(!d||d.B<b.B)return;e=d.B-b.B;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=ob(a,!1)||a.U?a.H:null;var g=null!=f?"cycles":null,h=Ah(a,b),m=b.B;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=wh(a,b,g,f);a.j(f);a.K=b;e-=b.B-m;c++}}}
|
|
function vh(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.O.B)),a.K=a.O,a.P=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.sa=null;if(pb(a)&&0<b.length){a.P&&(b="a "+J(a,a.O.B)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");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}}g[0]=g[0].toLowerCase();switch(g[0].charAt(0)){case "a":var v=
|
|
ih(a,g[1],!0);if(v)if(a.O=v,void 0===g[2])a.j("begin assemble at "+J(a,v.B)),a.P=!0,a.D.$();else{var w;a.j("not supported yet");w=[];if(w.length){for(var x=0;x<w.length;x++)a.Ib(v,w[x],1);a.j(wh(a,a.O))}}break;case "b":a:{var E=g[0],y=g[1],F=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 Fa=E.charAt(1);if("l"==Fa){var kd;kd=0+uh(a,a.f);kd+=uh(a,a.M);(kd+=uh(a,a.C))||a.j("no breakpoints")}else if("n"==Fa)a.qa=Wg(a,y),a.j("break after "+a.qa+" instruction(s)");else if(void 0===y)a.j("missing breakpoint address");else{var U=Z();if("*"!=y&&(U=ih(a,y,!0),!U))break a;"c"==Fa?null==U.B?($g(a),a.j("all breakpoints cleared")):sh(a,a.f,U)||sh(a,a.M,U)||sh(a,a.C,U)||a.j("breakpoint missing: "+J(a,U.B)):null!=U.B&&(mh(a,U,F),"p"==Fa?a.Sa(a.f,
|
|
U):"r"==Fa?a.Sa(a.M,U):"w"==Fa?a.Sa(a.C,U):a.j("unknown breakpoint command: "+Fa))}}}break;case "c":a.Va&&(a.Va.value="");break;case "d":a:{var Xa,Ya=g[0],ja=g[1],Ga=g[2],Yh=g[3];if("?"==ja){var Za="";for(Xa in tb)a.Fa[Xa]&&(Za&&(Za+=","),Za+=Xa);Za+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
|
|
Za.length&&a.j("dump extension commands:\n\t"+Za)}else if("state"==ja){var Sf=Gh(a.D,!0);"console"==Ga?console.log(Sf):(a.Va&&(a.Va.value=""),a.j(Sf))}else if("symbols"==ja)for(var ld=0;ld<a.F.length;ld++){var md=a.F[ld],$a;for($a in md.ka)if("."!=$a.charAt(0)){var Tf=md.ka[$a].o;if(void 0!==Tf){var Uf=md.ka[$a].l;Uf&&($a=Uf);a.j(J(a,Tf)+" "+$a)}}}else{if("d"==Ya){for(Xa in tb)if(g[1]==Xa){var Vf=a.Fa[Xa];Vf?(g.shift(),g.shift(),Vf(g)):a.j("no dump registered for "+ja);break a}ja||(Ya=a.Fb||"db")}else a.Fb=
|
|
Ya;if("dh"==Ya){var Wf=ja,Xf=Ga,Yf="",Zf=0,ca=a.fa,ka=a.J;if(ka.length){var Y=+Wf||a.bb,vb=+Xf||10;isNaN(Y)?Y=vb:Yf="more ";Y>ka.length&&(a.j("note: only "+ka.length+" available"),Y=ka.length);ca-=Y;0>ca&&(null==ka[ka.length-1].B?(Y=ca+Y,ca=0):ca+=ka.length);var nd=[];"call"==Xf&&(vb=1E5,nd=["CALL"]);for(void 0!==Wf&&a.j(Y+" instructions earlier:");0<vb&&ca!=a.fa;){var $f=ka[ca++];if(null==$f.B)break;var wb=Z($f.B),Zh=Y--,ag=wh(a,wb,"history",Zh);(!nd.length||0<=ag.indexOf(nd[0]))&&a.j(ag);wb.Mb&&
|
|
(ca+=wb.Mb,vb-=wb.Mb,Y-=wb.Mb);ca>=ka.length&&(ca=0);a.bb=Y;Zf++;vb--}}Zf||(a.j("no "+Yf+"history available"),a.bb=void 0)}else{var xb=ih(a,ja);if(xb){var lc=0;Ga&&("l"==Ga.charAt(0)&&(Ga=Ga.substr(1)||Yh),lc=Wg(a,Ga)>>>0,65536<lc&&(lc=65536));for(var yb="",ab="dd"==Ya?4:"dw"==Ya?2:1,mc=ab*lc||128,$h=mc+15>>4||1;$h--&&0<mc;){var nc=0,zb=0,Ab,od="",bg="",ja=J(a,xb.B);for(Ab=4==ab?16:a.ma;0<Ab&&0<mc;Ab--){var pd,oc=2==ab?a.na(xb,pd=2):a.qb(xb,pd=1),nc=nc|oc<<(zb<<3),zb=zb+pd;zb==ab&&(od+=J(a,nc,ab),
|
|
od+=1==ab?9==Ab?"-":" ":" ",nc=zb=0);bg+=32<=oc&&128>oc?String.fromCharCode(oc):".";mc--}yb&&(yb+="\n");yb+=ja+" "+od+(0==Ab?" "+bg:"")}yb&&a.j(yb);a.Qa=xb}}}}break;case "e":if("else"==g[0])break;var bb,qd,rd,sd,td=g[0],ud=g[1];"eb"==td?(bb=1,qd=255,rd=a.qb,sd=a.Ib):"e"==td||"ew"==td?(bb=2,qd=65535,rd=a.na,sd=a.Ya):ud=null;if(null==ud)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 pc=ih(a,ud);if(pc)for(var qc=2;qc<
|
|
g.length;qc++){var Bb=Ug(a,g[qc]);if(void 0===Bb){a.j("unrecognized value: "+g[qc]);break}Bb&~qd&&a.j("warning: "+l(Bb)+" exceeds "+bb+"-byte value");var ai=rd.call(a,pc);a.j("changing "+J(a,pc.B)+" from "+J(a,ai,bb)+" to "+J(a,Bb,bb));sd.call(a,pc,Bb,bb)}}break;case "g":a:{var cg=g[1],bi=b;if(void 0!==cg){var vd=ih(a,cg,!0);if(!vd)break a;mh(a,vd,bi);a.Sa(a.f,vd,!0)}a.lb(!0,c)}break;case "h":a.v.da?(c||a.j("halting"),a.aa()):ob(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var wd;
|
|
var Cb=b.substr(2),Cb=va(Cb);Ug(a,Cb)?(c||a.j("true: "+Cb),wd=!0):(c||a.j("false: "+Cb),wd=!1);wd||(d=!1);break}f=!0;break;case "k":var ci=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var xd=0,yd=Z(),Db=Z(a.b.u[6]);for(a.j("stack trace for "+J(a,Db.B));10>xd;){for(var Ha=null,di=256;65536>Db.B>>>0;){yd.B=a.na(Db,2);if(null==Db.B||!di--)break;if(!(yd.B&1)){for(var ei=a,rc=yd,dg=null,Eb=rc.B,eg=Eb,zd=1;6>=zd&&Eb;zd++){if(2<
|
|
zd){rc.B=Eb;var sc=wh(ei,rc);if(0<=sc.indexOf("JSR")){var fg=sc.indexOf(" ");if(Eb+(sc.indexOf(" ",fg+1)-fg-1)/2==eg){dg=sc;break}}}Eb-=2}rc.B=eg;if(Ha=dg)break}}if(!Ha||null==Ha)break;var gg=null;if("ks"==ci){var hg=Ha.match(/[0-9A-F]+$/);hg&&(gg=Dh(a,hg[0]))}Ha=ua(Ha,50)+" ;"+(gg||"stack="+J(a,Db.B));a.j(Ha);xd++}xd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){Dh(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 xa=0;if("all"==
|
|
G)xa=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){xa=tb[la];ma=!!(a.la&xa);break}if(!xa){a.j("unknown message category: "+G);break a}}if(xa)if("on"==g[2])a.la|=xa,ma=!0;else if("off"==g[2]&&(a.la&=~xa,ma=!1,1073741824==xa)){for(var Ad=0;Ad<a.wa.length;Ad++)a.j(a.wa[Ad]);a.wa=[]}}var fi=0,Fb="";for(la in tb)if(!G||G==la){var gi=!!(a.la&tb[la]);if(null===ma||ma==gi)Fb&&(Fb+=","),++fi%10||(Fb+="\n\t"),
|
|
"key"==la&&(la="keys"),Fb+=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")+(Fb||"none"));ah(a)}break;case "p":if("print"==g[0]){Eh(a,b.substr(5));break}var hi="pr"==g[0]?1:0;if(a.U)a.j("step in progress");else{var ig=Z(a.b.u[7]);a.qb(ig);a.U?(a.Sa(a.f,ig,!0),a.lb()||(a.D&&a.D.wb(),a.U=0)):Fh(a,hi?"tr":"t")}break;case "r":if("reset"==b){a.D&&a.D.reset();break}ph(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Gb=
|
|
+g[2];if(8==Gb||10==Gb||16==Gb)a.ma=Gb;else{a.j("invalid base: "+Gb);break}}a.j("default base: "+a.ma);break;case "cs":var Hb;void 0!==g[3]&&(Hb=+g[3]);switch(g[2]){case "int":a.b.gb=Hb;break;case "start":a.b.tb=Hb;break;case "stop":a.b.hb=Hb;break;default:a.j("unknown cs option");break a}void 0!==Hb&&Rc(a.b);a.j("checksums "+(a.b.v.cb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Vc(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.Wa.toFixed(2)+
|
|
"Mhz")+" ("+a.b.Ma+"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":Fh(a,g[0],g[1]);break;case "u":qh(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Ch(a,b.substr(3))||(d=!1);break}if("ver"==
|
|
g[0]){a.j("PDPjs version 1.30.1 ("+a.b.fb+",RELEASE"+(sb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){Eh(a,b.substr(1));break}var Bd="commands:",Cd;for(Cd in ch)Bd+="\n"+ua(Cd,9)+ch[Cd];Yd(a)||(Bd+="\nnote: history disabled if no exec breakpoints");a.j(Bd);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(jg){a.j("debugger error: "+(jg.stack||jg.message)),d=!1}return d}
|
|
function Sc(a,b,c){b=Sg(a,b,c);for(var d in b)if(!vh(a,b[+d]))return!1;return!0}Ta(function(){for(var a=B(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Zg(d);A(d,c)}});
|
|
function Hh(a,b,c){r.call(this,"Computer",a,Hh,67108864);this.v.ga=!1;Ih(this,b);this.M=Pc(this,"autoPower",a);this.D=0;this.ba=a.busWidth||a.buswidth;this.f=Jh;this.J=null;this.F=this.P=!1;this.ca=Pc(this,"url")||"";(Math.random()+.1).toString(36);this.g=Kh(this);if(this.b=mb("CPU",this.id)){this.i=mb("Debugger",this.id);this.w=new Mb({id:this.Ra+".bus",busWidth:this.ba},this.b,this.i);var d,e=kb(this.id);if((this.A=mb("Panel",this.id))&&this.A.Va)for(b=0;b<e.length;b++)d=e[b],d.ja=this.A.ja,d.j=
|
|
this.A.j,d.Va=this.A.Va;this.j("PDPjs v1.30.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ca&&d.Ca(this,this.w,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=Pc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.F=!0,this.f=Jh),this.f&&
|
|
(this.K=new O(this,"1.30.1"),Lh(this.K)?b=null:delete this.K);!b&&this.f&&(b=Mh(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.M=!0);!c&&this.M&&Nh(this,this.ub)}else n("Unable to find CPU component")}u(Hh);var Jh=0;
|
|
function Ih(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){n(d.message+" ("+c+")")}}a.U=b}function Pc(a,b,c){var d=b.toLowerCase(),d=db[b]||db[d];void 0===d&&a.U&&(d=a.U[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Nh(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(){Nh(a,b,c)});return}}b.call(a,c)}
|
|
function Oh(a,b){var c=new O(a,"1.30.1","validate");if(Lh(c)&&Ph(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=Hh.prototype;
|
|
k.ub=function(a){void 0===a&&(a=this.f||(this.J?1:Jh));if(!this.D){this.D++;var b=!1,c=!1;this.O=!1;var d=this.K||new O(this,"1.30.1");if(-1==a)b=!0;else if(a>Jh){if(Lh(d,this.J)){this.C=new O(this,"1.30.1","failsafe");Lh(this.C)&&(Qh(this,d),a=2,Rh(this.C));this.C.set("timestamp",Aa());Sh(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=Ph(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Lh(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),Rh(d),Lh(d)?(c=Ph(d),e=!0):c=!1))}e&&Oh(this,c?d:null)}else 2==a&&d.clear()}else Oh(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=Th(this,g,d,b,c));b=[d,a,c];-1!=a?Nh(this,this.Yb,b):this.Yb(b)}};
|
|
function Th(a,b,c,d,e){if(!b.v.ga){b.v.ga=!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=Jh,window&&window.location.reload()):a.O=!0,b.Aa(null),e=!1)}if(!d&&b.Zb)for(a=b.Zb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
|
k.Yb=function(a){var b=a[0],c=0>a[1];a=a[2];this.fa=!0;this.v.ga=!0;var d=this.I.power;d&&(d.textContent="Shutdown");this.b&&(Th(this,this.b,b,c,a),this.b.pb());this.O&&(Qh(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.D=0};
|
|
function Qh(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.1"};d.url=a.ca;d.user=c;d.type="bug";d.data=b;Ba("http://www.pcjs.org/api/v1/report",d,!0)}}
|
|
function Gh(a,b,c){var d,e="none";if(a.D)return null;a.D--;var f=new O(a,"1.30.1"),g=new O(a,"1.30.1","validate"),h=Aa();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.za&&(c&&a.b.aa(),d=a.b.za(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.ga=!1,!1===d&&(e=null)));for(var h=kb(a.id),m=0;m<h.length;m++){var p=h[m];p.v.ga&&(p.za&&(d=p.za(b,c),"object"===typeof d&&f.set(p.id,
|
|
d)),c&&(p.v.ga=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&Uh(a,a.g,f.toString()),Sh(g)&&Sh(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.v.ga=!1,b=a.I.power)&&(b.textContent="Power");a.D=0;return e}k.reset=function(){this.w&&this.w.reset&&(C(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&&(C(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.$(!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.$(!0)};
|
|
k.ra=function(a,b,c){var d=this;switch(b){case "power":return this.I[b]=c,c.onclick=function(){d.D||(d.v.ga?Gh(d,!1,!0):Nh(d,d.ub))},!0;case "reset":return this.I[b]=c,c.onclick=function(){if(d.v.ga&&!d.D)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.");Gh(d,a,!0);!a&&d.N?window&&window.location.reload():d.ub(Jh)}else d.reset(),d.b&&d.b.pb()},!0;case "save":if(qa())c.parentNode.removeChild(c);else return this.I[b]=
|
|
c,c.onclick=function(){var a=Kh(d,!0);if(a){var b=!!(d.f&&!d.H||d.N),c=Gh(d,b);b?Uh(d,a,c):d.ja("Resume disabled, machine state not saved")}},!0}return!1};
|
|
function Kh(a,b){var c=a.g;c||((c=Ja("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Vh(a,c))||a.ja("The user ID is invalid.")):b&&a.ja("Browser local storage is not available"));return c}
|
|
function Vh(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 Mh(a){var b=null;a.g&&(b=ra()+"/api/v1/user?req=load&user="+a.g+"&state="+Wh(a,"1.30.1"));return b}
|
|
function Uh(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Wh(a,"1.30.1");d.data=c;b=Ba(ra()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.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 Fg(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.wb=function(){};k.$=function(a){this.b&&this.b.$(a);this.A&&this.A.$(a)};Ta(function(){for(var a=B(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=z(c),c=B(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=z(f),g=new Hh(g,d,!0);A(g,f);g.M&&Nh(g,g.ub)}});
|
|
Oa.show.push(function(){for(var a=B(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=mb("Computer",c.id))&&c.fa&&!c.v.ga&&c.ub(-1)}});Oa.exit.push(function(){for(var a=B(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=mb("Computer",c.id))&&c.v.ga&&Gh(c,!(!c.f||c.H),!0)}});function O(a,b,c){this.id=a.id;this.key=Wh(a,b,c);this.i=a.i;Rh(this,a.tc)}function Wh(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){Rh(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 Rh(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Sh(a){var b=!0;if(Ia()){var c=JSON.stringify(a[a.id]);Ka(a.key,c)||(n("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Ph(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){n(c.message||c),b=!1}return b}function Lh(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ia()&&(b=Ja(a.key))?(a[a.id]=b,a.b=!0):!1}var Xh=0;
|
|
function ii(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)):ji(h,a,b,c,d,e,f)})}
|
|
function ji(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?ki(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
|
function ki(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);ki(a,b,c)}})}else c(a,null)}
|
|
function li(a,b,c,d){function e(a){if(void 0===h){var b=g&&B(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ta(a))}function f(a){e("Error: "+a);m&&(--Xh||Va(!0));m=!1}var g,h,m=!0;Xh++;ib[a]={};try{if(g=document.getElementById(a)){var p;if("object"==typeof resources&&(p=resources.css)){var q=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=p:v.appendChild(document.createTextNode(p));q.appendChild(v)}c||
|
|
(c="/versions/pdpjs/1.30.1/components.xsl");p=function(d,h){h?ii(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,--Xh||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),--Xh||Va(!0)):f("invalid machine element: "+
|
|
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?ii(b,a,d,!0,e,p):ji(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 li(a,b,c,d)};window.enableEvents=Va;window.sendEvent=Wa;})();//# sourceMappingURL=/tmp/pdpjs/1.30.1/pdp11-dbg.map
|